Class: VertxUnit::Completion

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

Overview

A completion object that emits completion notifications either succeeded or failed.

Direct Known Subclasses

Async, TestCompletion

Instance Method Summary (collapse)

Instance Method Details

- (void) await - (void) await(timeoutMillis)

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.

Overloads:

  • - (void) await(timeoutMillis)

    Parameters:

    • timeoutMillis (Fixnum)
      the timeout in milliseconds


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

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

- (void) awaitSuccess - (void) awaitSuccess(timeoutMillis)

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.

Overloads:

  • - (void) awaitSuccess(timeoutMillis)

    Parameters:

    • timeoutMillis (Fixnum)
      the timeout in milliseconds


72
73
74
75
76
77
78
79
80
81
82
83
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/completion.rb', line 72

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

- (true, false) isCompleted

Returns true if this completion is completed

Returns:

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


117
118
119
120
121
122
123
124
125
126
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/completion.rb', line 117

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

- (true, false) isFailed

Returns true if the this completion is completed and failed

Returns:

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


41
42
43
44
45
46
47
48
49
50
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/completion.rb', line 41

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

- (void) handler(completionHandler) { ... }

This method returns an undefined value.

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

Yields:

  • the completion handler


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/completion.rb', line 23

def handler
  if true
    if (block_given?)
      return @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_T.wrap(ar.result) : nil) } : promise)
    else
      promise = ::Vertx::Util::Utils.promise
      @j_del.java_method(:handler, [Java::IoVertxCore::Handler.java_class]).call(block_given? ? Proc.new { |ar| yield(ar.failed ? ar.cause : nil, ar.succeeded ? @j_arg_T.wrap(ar.result) : nil) } : promise)
      return ::Vertx::Util::Utils.safe_create(promise.future(),::Vertx::Future, nil)
    end
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling handler()"
  end
end

- (void) resolve(future)

This method returns an undefined value.

Completes the future upon completion, otherwise fails it.

Parameters:



55
56
57
58
59
60
61
62
63
64
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/completion.rb', line 55

def resolve(*args)
  if args[0].class.method_defined?(:j_del) && !block_given?
    return @j_del.java_method(:resolve, [Java::IoVertxCore::Promise.java_class]).call(args[0].j_del)
  end
  if defined?(super)
    super
  else
    raise ArgumentError, "Invalid arguments when calling resolve(#{args[0]})"
  end
end

- (true, false) isSucceeded

Returns true if this completion is completed and succeeded

Returns:

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


105
106
107
108
109
110
111
112
113
114
# File '/Users/julien/java/vertx-aggregator/modules/vertx-lang-ruby/vertx-lang-ruby/target/classes/vertx-unit/completion.rb', line 105

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