Class: VertxUnit::TestCompletion

Inherits:
Completion show all
Defined in:
/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb

Overview

This object provides callback-ability for the end of a test suite, the completion succeeds when all tests pass otherwise it fails.

Constant Summary

@@j_api_type =
Object.new

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Boolean) accept?(obj)

Returns:

  • (Boolean)


21
22
23
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 21

def @@j_api_type.accept?(obj)
  obj.class == TestCompletion
end

+ (Object) j_api_type



30
31
32
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 30

def self.j_api_type
  @@j_api_type
end

+ (Object) j_class



33
34
35
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 33

def self.j_class
  Java::IoVertxExtUnit::TestCompletion.java_class
end

+ (Object) unwrap(obj)



27
28
29
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 27

def @@j_api_type.unwrap(obj)
  obj.j_del
end

+ (Object) wrap(obj)



24
25
26
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 24

def @@j_api_type.wrap(obj)
  TestCompletion.new(obj)
end

Instance Method Details

- (void) await(timeoutMillis = nil)

This method returns an undefined value.

Cause the current thread to wait until this completion completes with a configurable timeout.

If completion times out or the current thread is interrupted, an exception will be thrown.

Parameters:

  • timeoutMillis (Fixnum) (defaults to: nil)
    the timeout in milliseconds

Raises:

  • (ArgumentError)


80
81
82
83
84
85
86
87
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 80

def await(timeoutMillis=nil)
  if !block_given? && timeoutMillis == nil
    return @j_del.java_method(:await, []).call()
  elsif timeoutMillis.class == Fixnum && !block_given?
    return @j_del.java_method(:await, [Java::long.java_class]).call(timeoutMillis)
  end
  raise ArgumentError, "Invalid arguments when calling await(#{timeoutMillis})"
end

- (void) await_success(timeoutMillis = nil)

This method returns an undefined value.

Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.

If completion times out or the current thread is interrupted or the suite fails, an exception will be thrown.

Parameters:

  • timeoutMillis (Fixnum) (defaults to: nil)
    the timeout in milliseconds

Raises:

  • (ArgumentError)


93
94
95
96
97
98
99
100
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 93

def await_success(timeoutMillis=nil)
  if !block_given? && timeoutMillis == nil
    return @j_del.java_method(:awaitSuccess, []).call()
  elsif timeoutMillis.class == Fixnum && !block_given?
    return @j_del.java_method(:awaitSuccess, [Java::long.java_class]).call(timeoutMillis)
  end
  raise ArgumentError, "Invalid arguments when calling await_success(#{timeoutMillis})"
end

- (true, false) completed?

Returns true if this completion is completed

Returns:

  • (true, false)
    true if this completion is completed

Raises:

  • (ArgumentError)


46
47
48
49
50
51
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 46

def completed?
  if !block_given?
    return @j_del.java_method(:isCompleted, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling completed?()"
end

- (true, false) failed?

Returns true if the this completion is completed and failed

Returns:

  • (true, false)
    true if the this completion is completed and failed

Raises:

  • (ArgumentError)


60
61
62
63
64
65
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 60

def failed?
  if !block_given?
    return @j_del.java_method(:isFailed, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling failed?()"
end

- (void) handler { ... }

This method returns an undefined value.

Completion handler to receive a completion signal when this completions completes.

Yields:

  • the completion handler

Raises:

  • (ArgumentError)


69
70
71
72
73
74
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 69

def handler
  if block_given?
    return @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call((Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))
  end
  raise ArgumentError, "Invalid arguments when calling handler()"
end

- (void) resolve(future = nil)

This method returns an undefined value.

Completes the future upon completion, otherwise fails it.

Parameters:

Raises:

  • (ArgumentError)


39
40
41
42
43
44
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 39

def resolve(future=nil)
  if future.class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:resolve, [Java::IoVertxCore::Future.java_class]).call(future.j_del)
  end
  raise ArgumentError, "Invalid arguments when calling resolve(#{future})"
end

- (true, false) succeeded?

Returns true if this completion is completed and succeeded

Returns:

  • (true, false)
    true if this completion is completed and succeeded

Raises:

  • (ArgumentError)


53
54
55
56
57
58
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/test_completion.rb', line 53

def succeeded?
  if !block_given?
    return @j_del.java_method(:isSucceeded, []).call()
  end
  raise ArgumentError, "Invalid arguments when calling succeeded?()"
end