Class List Method List File List

# Class: VertxUnit::Completion

Inherits:
  Object
  - Object
  - VertxUnit::Completion
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/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)

- - (void) await(timeoutMillis = nil)
  Cause the current thread to wait until this completion completes with a configurable timeout.
- - (void) await_success(timeoutMillis = nil)
  Cause the current thread to wait until this completion completes and succeeds with a configurable timeout.
- - (true, false) completed?
  @return true if this completion is completed.
- - (true, false) failed?
  @return true if the this completion is completed and failed.
- - (void) handler { ... }
  Completion handler to receive a completion signal when this completions completes.
- - (void) resolve(future = nil)
  Completes the future upon completion, otherwise fails it.
- - (true, false) succeeded?
  @return true if the this completion is completed succeeded.

## 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`)

    64
    65
    66
    67
    68
    69
    70
    71
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 64

    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`)

    77
    78
    79
    80
    81
    82
    83
    84
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 77

    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?

@return true if this completion is completed

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    28
    29
    30
    31
    32
    33
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 28

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

### - (`true`, `false`) failed?

@return true if the this completion is completed and failed

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    44
    45
    46
    47
    48
    49
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 44

    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`)

    53
    54
    55
    56
    57
    58
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 53

    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, ar.succeeded ? ::Vertx::Util::Utils.from_object(ar.result) : 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:

- future (`::Vertx::Future`) (defaults to: `nil`) —
  the future to resolve

Raises:

- (`ArgumentError`)

    20
    21
    22
    23
    24
    25
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 20

    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?

@return true if the this completion is completed succeeded

Returns:

- (`true`, `false`)

Raises:

- (`ArgumentError`)

    36
    37
    38
    39
    40
    41
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/completion.rb', line 36

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