Class List Method List File List

# Class: VertxUnit::EventBusCollector

Inherits:
  Object
  - Object
  - VertxUnit::EventBusCollector
  show all
Defined in:
  /Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/event_bus_collector.rb

## Overview

The event bus collector listen to events on the Vert.x event bus and translate them into reports.

## Class Method Summary (collapse)

- + (::VertxUnit::EventBusCollector) create(vertx = nil, reporter = nil) { ... }

## Instance Method Summary (collapse)

- - (::Vertx::MessageConsumer) register(address = nil)
  Register the collector as a consumer of the event bus with the specified address.

## Class Method Details

### + (`::VertxUnit::EventBusCollector`) create(vertx = nil, reporter = nil) { ... }

Parameters:

- vertx (`::Vertx::Vertx`) (defaults to: `nil`)

Yields:

Returns:

- (`::VertxUnit::EventBusCollector`)

Raises:

- (`ArgumentError`)

    22
    23
    24
    25
    26
    27
    28
    29
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/event_bus_collector.rb', line 22

    def self.create(vertx=nil,reporter=nil)
      if vertx.class.method_defined?(:j_del) && reporter.class == Hash && !block_given?
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtUnitCollect::EventBusCollector.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxExtUnitReport::ReportingOptions.java_class]).call(vertx.j_del,Java::IoVertxExtUnitReport::ReportingOptions.new(::Vertx::Util::Utils.to_json_object(reporter))),::VertxUnit::EventBusCollector)
      elsif vertx.class.method_defined?(:j_del) && block_given? && reporter == nil
        return ::Vertx::Util::Utils.safe_create(Java::IoVertxExtUnitCollect::EventBusCollector.java_method(:create, [Java::IoVertxCore::Vertx.java_class,Java::IoVertxCore::Handler.java_class]).call(vertx.j_del,(Proc.new { |event| yield(::Vertx::Util::Utils.safe_create(event,::VertxUnit::TestSuiteReport)) })),::VertxUnit::EventBusCollector)
      end
      raise ArgumentError, "Invalid arguments when calling create(vertx,reporter)"
    end

## Instance Method Details

### - (`::Vertx::MessageConsumer`) register(address = nil)

Register the collector as a consumer of the event bus with the specified address.

Parameters:

- address (`String`) (defaults to: `nil`) —
  the registration address

Returns:

- (`::Vertx::MessageConsumer`) —
  the subscribed message consumer

Raises:

- (`ArgumentError`)

    33
    34
    35
    36
    37
    38
    # File '/Users/julien/java/vertx-aggregator/modules/vertx-unit/src/main/resources/vertx-unit/event_bus_collector.rb', line 33

    def register(address=nil)
      if address.class == String && !block_given?
        return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:register, [Java::java.lang.String.java_class]).call(address),::Vertx::MessageConsumer)
      end
      raise ArgumentError, "Invalid arguments when calling register(address)"
    end