Sha256: e4b98c0a5e7422d7ce17fe5db37ba6ffe066e8e4ae48bd84bc1a097f21bdb071

Contents?: true

Size: 1.34 KB

Versions: 64

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8

require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
require 'data_objects/spec/shared/command_spec'

describe DataObjects::Oracle::Command do
  it_should_behave_like 'a Command'

  if JRUBY
    it_should_behave_like 'a Command with async'
  else
    describe 'running queries in parallel' do

      before do

        threads = []
        connections = []
        4.times do |i|
          # by default connection is not non_blocking, need to pass parameter
          connections[i] = DataObjects::Connection.new(CONFIG.uri+"?non_blocking=true")
        end

        @start = Time.now
        4.times do |i|
          threads << Thread.new do
            command = connections[i].create_command(CONFIG.sleep)
            result = command.execute_non_query
          end
        end

        threads.each{|t| t.join }
        @finish = Time.now

        connections.each {|c| c.close}
      end

      # after do
      #   @connection.close
      # end

      FINISH_IN_SECONDS = RUBY_VERSION > "1.9" ? 2 : 3

      it "should finish within #{FINISH_IN_SECONDS} seconds" do
        pending_if("Ruby on Windows doesn't support asynchronious operations", WINDOWS) do
          # puts "DEBUG: execution time = #{@finish - @start} seconds"
          (@finish - @start).should < FINISH_IN_SECONDS
        end
      end

    end

  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
do_oracle-0.10.17 spec/command_spec.rb
do_oracle-0.10.17-x86-mswin32-60 spec/command_spec.rb
do_oracle-0.10.17-x86-mingw32 spec/command_spec.rb
do_oracle-0.10.17-java spec/command_spec.rb
do_oracle-0.10.16 spec/command_spec.rb
do_oracle-0.10.16-x86-mswin32-60 spec/command_spec.rb
do_oracle-0.10.16-x86-mingw32 spec/command_spec.rb
do_oracle-0.10.16-java spec/command_spec.rb
do_oracle-0.10.15 spec/command_spec.rb
do_oracle-0.10.15-x86-mswin32-60 spec/command_spec.rb
do_oracle-0.10.15-x86-mingw32 spec/command_spec.rb
do_oracle-0.10.15-java spec/command_spec.rb
do_oracle-0.10.14 spec/command_spec.rb
do_oracle-0.10.14-x86-mswin32-60 spec/command_spec.rb
do_oracle-0.10.14-x86-mingw32 spec/command_spec.rb
do_oracle-0.10.14-java spec/command_spec.rb
do_oracle-0.10.13 spec/command_spec.rb
do_oracle-0.10.13-x86-mswin32-60 spec/command_spec.rb
do_oracle-0.10.13-x86-mingw32 spec/command_spec.rb
do_oracle-0.10.13-java spec/command_spec.rb