Sha256: 5ae123e985bc6e8bb0ff16c92d034a9a6712bf42bb56b9561157bf9c02b3f1ff

Contents?: true

Size: 1.36 KB

Versions: 28

Compression:

Stored size: 1.36 KB

Contents

require_relative 'mock_app/test_service'

class MockApp < Cuboid::Application

    # This app is going to be using a max of 2 threads.
    provision_cores  2
    # This app is going to be using a max of 200MB of RAM.
    provision_memory 200 * 1024 * 1024
    # This app is going to be using a max of 2GB of disk space.
    provision_disk   2   * 1024 * 1024 * 1024

    validate_options_with :do_validate_options

    # Register event handlers.
    handler_for :pause,   :do_pause
    handler_for :resume,  :do_resume
    handler_for :suspend, :do_suspend
    handler_for :restore, :do_restore
    handler_for :abort,   :do_abort

    # RPC, report and snapshot file.
    serialize_with Marshal

    agent_service_for :test_service, TestService

    # Execution entry point.
    def run
        ap __method__
        report 'My results.'

        sleep 5
    end

    def do_validate_options( options )
        return true if !options.is_a?( Hash )
        !options.include?( 'invalid' )
    end

    def do_pause
        ap __method__
    end

    def do_resume
        ap __method__
    end

    def do_suspend
        # Write pending state and data to Cuboid::Data::Application.
        ap __method__
    end

    def do_restore
        # Restore special state and data from Cuboid::Data::Application.
        ap __method__
    end

    def do_abort
        ap __method__
    end

end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
cuboid-0.2.13 spec/support/fixtures/mock_app.rb
cuboid-0.2.12 spec/support/fixtures/mock_app.rb
cuboid-0.2.11 spec/support/fixtures/mock_app.rb
cuboid-0.2.10 spec/support/fixtures/mock_app.rb
cuboid-0.2.9 spec/support/fixtures/mock_app.rb
cuboid-0.2.8 spec/support/fixtures/mock_app.rb
cuboid-0.2.7 spec/support/fixtures/mock_app.rb
cuboid-0.2.6 spec/support/fixtures/mock_app.rb
cuboid-0.2.5 spec/support/fixtures/mock_app.rb
cuboid-0.2.4.2 spec/support/fixtures/mock_app.rb
cuboid-0.2.4.1 spec/support/fixtures/mock_app.rb
cuboid-0.2.4 spec/support/fixtures/mock_app.rb
cuboid-0.2.3 spec/support/fixtures/mock_app.rb
cuboid-0.2.2 spec/support/fixtures/mock_app.rb
cuboid-0.2.1 spec/support/fixtures/mock_app.rb
cuboid-0.2 spec/support/fixtures/mock_app.rb
cuboid-0.1.9.1 spec/support/fixtures/mock_app.rb
cuboid-0.1.9 spec/support/fixtures/mock_app.rb
cuboid-0.1.8 spec/support/fixtures/mock_app.rb
cuboid-0.1.7 spec/support/fixtures/mock_app.rb