Top Level Namespace

Includes:
OmfCommon::DefaultLogging, OmfEc::Backward::DSL, OmfEc::Backward::DefaultEvents, OmfEc::DSL

Defined Under Namespace

Modules: AMQP, Blather, OmfCommon, OmfEc, OmfRc Classes: Array, ExecApp, Hash, String

Constant Summary

Experiment =
OmfEc::Experiment

Instance Method Summary (collapse)

Methods included from OmfEc::Backward::DefaultEvents

included

Methods included from OmfEc::Backward::DSL

#defApplication, included, v5_style, #wait

Methods included from OmfEc::DSL

#after, #alias_event, #all_equal, #all_groups, #all_groups?, #defPrototype, #def_application, #def_event, #def_graph, #def_group, #def_property, #def_query, #deprecated_load_oedl, #done!, #ensure_property, #every, #get_resources, #group, #load_oedl, #ms, #on_event, #one_equal, #property

Methods included from OmfCommon::DefaultLogging

#debug, #error, #fatal, #get_logger, #info, #warn, #warn_deprecation, #warn_removed

Instance Method Details

- (Object) create_app(testbed)

Copyright © 2012 National ICT Australia Limited (NICTA). This software may be used and distributed solely under the terms of the MIT license (License). You should find a copy of the License in LICENSE.TXT or at opensource.org/licenses/MIT. By downloading or using this software you accept the terms and the liability disclaimer in the License.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'omf_ec/lib/omf_ec/backward/exp/testbed.rb', line 6

def create_app(testbed)
  testbed.create(:application, binary_path: @cmd) do |reply|
    if reply.success?
      app = reply.resource

      app.on_subscribed do
        app.configure(state: :running)

        app.on_inform  do |m|
          case m.itype
          when 'STATUS'
            if m[:status_type] == 'APP_EVENT'
              after(2) { OmfCommon.comm.disconnect ; OmfCommon.eventloop.stop } if m[:event] =~ /EXIT/
              info m[:msg] if m[:msg]
            else
              m.each_property do |k, v|
                info "#{k} => #{v.strip}" unless v.nil?
              end
            end
          when 'WARN'
            warn m[:reason], m.src
          when 'ERROR'
            error m[:reason], m.src
          end
        end
      end
    else
      error reply[:reason]
    end
  end
end