pione 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/Gemfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +94 -0
- data/Rakefile +118 -0
- data/bin/pione-broker +5 -0
- data/bin/pione-clean +5 -0
- data/bin/pione-client +5 -0
- data/bin/pione-eval +111 -0
- data/bin/pione-relay +5 -0
- data/bin/pione-relay-account-db +5 -0
- data/bin/pione-relay-client-db +5 -0
- data/bin/pione-search-log +30 -0
- data/bin/pione-syntax-checker +5 -0
- data/bin/pione-task-worker +5 -0
- data/bin/pione-tuple-space-provider +5 -0
- data/bin/pione-tuple-space-receiver +5 -0
- data/bin/pione-tuple-space-viewer +5 -0
- data/demo/demo.rb +311 -0
- data/demo/public/base.css +94 -0
- data/demo/public/demo.js +107 -0
- data/demo/public/index.html +91 -0
- data/demo/public/jquery-1.8.3.min.js +2 -0
- data/example/CountChar/CountChar.pione +64 -0
- data/example/CountChar/misc/CountChar.rb +22 -0
- data/example/CountChar/text/aidokushono_insho.txt +32 -0
- data/example/CountChar/text/aikokuka_shokan.txt +108 -0
- data/example/CountChar/text/carlyle_hakubutsukan.txt +58 -0
- data/example/CountChar/text/dark_minister.txt +2440 -0
- data/example/CountChar/text/kaikano_otto.txt +61 -0
- data/example/CountChar/text/kaikon.txt +30 -0
- data/example/CountChar/text/nagashimano_shi.txt +45 -0
- data/example/CountChar/text/saikachibuchi.txt +80 -0
- data/example/CountChar/text/saikonihonno_josei.txt +91 -0
- data/example/CountChar/text/taishojugonenno_bundan.txt +21 -0
- data/example/FeatureExample/FeatureExample.pione +7 -0
- data/example/Fib/Fib.pione +56 -0
- data/example/Fib/FibBC.pione +56 -0
- data/example/HelloWorld/HelloWorld.pione +5 -0
- data/example/LucasNumber/LucasNumber.pione +64 -0
- data/example/MakePair/MakePair.pione +14 -0
- data/example/MakePair/data/1.i +0 -0
- data/example/MakePair/data/2.i +0 -0
- data/example/MakePair/data/3.i +0 -0
- data/example/MakePair/data/4.i +0 -0
- data/example/MakePair/data/5.i +0 -0
- data/example/SieveOfEratosthenes/SieveOfEratosthenes.pione +61 -0
- data/example/SingleParticlesWithRef/Makefile +289 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.Makefile +153 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRef.pione +116 -0
- data/example/SingleParticlesWithRef/SingleParticlesWithRefFull.pione +400 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-0-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-120-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-180-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-240-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-300-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-0-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-120-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-180-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-240-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-300-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift-noise-60-60-0.roi +0 -0
- data/example/SingleParticlesWithRef/data/121p-shift.pdb +3381 -0
- data/example/SingleParticlesWithRef/data/all.ref2d +0 -0
- data/example/SingleParticlesWithRef/data/all.ref3d +0 -0
- data/example/Sum/Sum.pione +52 -0
- data/example/SyntaxError/call_rule_error.pione +6 -0
- data/example/SyntaxError/feature_line_error.pione +7 -0
- data/example/SyntaxError/flow_block_error.pione +5 -0
- data/example/SyntaxError/input_line_error.pione +6 -0
- data/example/SyntaxError/invalid_rule_name.pione +6 -0
- data/example/SyntaxError/param_line_error.pione +7 -0
- data/example/SyntaxError/variable-binding-error.pione +11 -0
- data/lib/pione.rb +241 -0
- data/lib/pione/agent/basic-agent.rb +333 -0
- data/lib/pione/agent/broker.rb +274 -0
- data/lib/pione/agent/command-listener.rb +47 -0
- data/lib/pione/agent/input-generator.rb +194 -0
- data/lib/pione/agent/logger.rb +65 -0
- data/lib/pione/agent/process-manager.rb +38 -0
- data/lib/pione/agent/rule-provider.rb +64 -0
- data/lib/pione/agent/task-worker.rb +274 -0
- data/lib/pione/agent/trivial-routine-worker.rb +28 -0
- data/lib/pione/agent/tuple-space-client.rb +146 -0
- data/lib/pione/agent/tuple-space-server-client-life-checker.rb +29 -0
- data/lib/pione/command-option/basic-option.rb +42 -0
- data/lib/pione/command-option/child-process-option.rb +17 -0
- data/lib/pione/command-option/common-option.rb +29 -0
- data/lib/pione/command-option/daemon-option.rb +12 -0
- data/lib/pione/command-option/presence-notifier-option.rb +15 -0
- data/lib/pione/command-option/task-worker-owner-option.rb +17 -0
- data/lib/pione/command-option/tuple-space-provider-option.rb +26 -0
- data/lib/pione/command-option/tuple-space-provider-owner-option.rb +16 -0
- data/lib/pione/command-option/tuple-space-receiver-option.rb +12 -0
- data/lib/pione/command/basic-command.rb +126 -0
- data/lib/pione/command/child-process.rb +43 -0
- data/lib/pione/command/daemon-process.rb +18 -0
- data/lib/pione/command/front-owner-command.rb +37 -0
- data/lib/pione/command/pione-broker.rb +53 -0
- data/lib/pione/command/pione-clean.rb +16 -0
- data/lib/pione/command/pione-client.rb +273 -0
- data/lib/pione/command/pione-relay-account-db.rb +85 -0
- data/lib/pione/command/pione-relay-client-db.rb +80 -0
- data/lib/pione/command/pione-relay.rb +47 -0
- data/lib/pione/command/pione-syntax-checker.rb +103 -0
- data/lib/pione/command/pione-task-worker.rb +123 -0
- data/lib/pione/command/pione-tuple-space-provider.rb +87 -0
- data/lib/pione/command/pione-tuple-space-receiver.rb +55 -0
- data/lib/pione/command/pione-tuple-space-viewer.rb +151 -0
- data/lib/pione/command/tuple-space-provider-owner.rb +6 -0
- data/lib/pione/front/basic-front.rb +64 -0
- data/lib/pione/front/broker-front.rb +30 -0
- data/lib/pione/front/client-front.rb +28 -0
- data/lib/pione/front/relay-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +16 -0
- data/lib/pione/front/task-worker-owner.rb +42 -0
- data/lib/pione/front/tuple-space-provider-front.rb +22 -0
- data/lib/pione/front/tuple-space-provider-owner.rb +11 -0
- data/lib/pione/front/tuple-space-receiver-front.rb +18 -0
- data/lib/pione/model/assignment.rb +89 -0
- data/lib/pione/model/basic-model.rb +395 -0
- data/lib/pione/model/binary-operator.rb +80 -0
- data/lib/pione/model/block.rb +233 -0
- data/lib/pione/model/boolean.rb +138 -0
- data/lib/pione/model/call-rule.rb +69 -0
- data/lib/pione/model/data-expr.rb +360 -0
- data/lib/pione/model/feature-expr.rb +794 -0
- data/lib/pione/model/float.rb +107 -0
- data/lib/pione/model/integer.rb +140 -0
- data/lib/pione/model/list.rb +104 -0
- data/lib/pione/model/message.rb +80 -0
- data/lib/pione/model/package.rb +48 -0
- data/lib/pione/model/parameters.rb +282 -0
- data/lib/pione/model/rule-expr.rb +120 -0
- data/lib/pione/model/rule-io.rb +166 -0
- data/lib/pione/model/rule.rb +294 -0
- data/lib/pione/model/string.rb +111 -0
- data/lib/pione/model/undefined-value.rb +24 -0
- data/lib/pione/model/variable-table.rb +315 -0
- data/lib/pione/model/variable.rb +87 -0
- data/lib/pione/parser/block-parser.rb +83 -0
- data/lib/pione/parser/common-parser.rb +145 -0
- data/lib/pione/parser/document-parser.rb +58 -0
- data/lib/pione/parser/error-message.yml +4 -0
- data/lib/pione/parser/expr-parser.rb +266 -0
- data/lib/pione/parser/feature-expr-parser.rb +105 -0
- data/lib/pione/parser/flow-element-parser.rb +181 -0
- data/lib/pione/parser/literal-parser.rb +182 -0
- data/lib/pione/parser/rule-definition-parser.rb +163 -0
- data/lib/pione/parser/syntax-error.rb +61 -0
- data/lib/pione/patch/array-patch.rb +3 -0
- data/lib/pione/patch/drb-patch.rb +467 -0
- data/lib/pione/patch/monitor-patch.rb +16 -0
- data/lib/pione/patch/rinda-patch.rb +759 -0
- data/lib/pione/patch/uri-patch.rb +66 -0
- data/lib/pione/relay/receiver-socket.rb +69 -0
- data/lib/pione/relay/relay-account-db.rb +55 -0
- data/lib/pione/relay/relay-client-db.rb +53 -0
- data/lib/pione/relay/relay-socket.rb +215 -0
- data/lib/pione/relay/trampoline.rb +22 -0
- data/lib/pione/relay/transmitter-socket.rb +167 -0
- data/lib/pione/resource/basic-resource.rb +92 -0
- data/lib/pione/resource/dropbox-resource.rb +106 -0
- data/lib/pione/resource/ftp.rb +84 -0
- data/lib/pione/resource/local.rb +113 -0
- data/lib/pione/rule-handler/action-handler.rb +184 -0
- data/lib/pione/rule-handler/basic-handler.rb +217 -0
- data/lib/pione/rule-handler/flow-handler.rb +339 -0
- data/lib/pione/rule-handler/root-handler.rb +23 -0
- data/lib/pione/rule-handler/system-handler.rb +13 -0
- data/lib/pione/system/common.rb +22 -0
- data/lib/pione/system/config.rb +20 -0
- data/lib/pione/system/document.rb +81 -0
- data/lib/pione/system/file-cache.rb +150 -0
- data/lib/pione/system/global.rb +346 -0
- data/lib/pione/system/identifier.rb +61 -0
- data/lib/pione/system/init.rb +16 -0
- data/lib/pione/system/object.rb +35 -0
- data/lib/pione/transformer/block-transformer.rb +23 -0
- data/lib/pione/transformer/document-transformer.rb +36 -0
- data/lib/pione/transformer/expr-transformer.rb +89 -0
- data/lib/pione/transformer/feature-expr-transformer.rb +56 -0
- data/lib/pione/transformer/flow-element-transformer.rb +66 -0
- data/lib/pione/transformer/literal-transformer.rb +76 -0
- data/lib/pione/transformer/rule-definition-transformer.rb +62 -0
- data/lib/pione/transformer/transformer-module.rb +37 -0
- data/lib/pione/tuple-space/data-finder.rb +165 -0
- data/lib/pione/tuple-space/presence-notifier.rb +83 -0
- data/lib/pione/tuple-space/relay.rb +9 -0
- data/lib/pione/tuple-space/tuple-space-provider.rb +85 -0
- data/lib/pione/tuple-space/tuple-space-receiver.rb +140 -0
- data/lib/pione/tuple-space/tuple-space-server-interface.rb +60 -0
- data/lib/pione/tuple-space/tuple-space-server.rb +156 -0
- data/lib/pione/tuple-space/update-criteria.rb +96 -0
- data/lib/pione/tuple/agent-tuple.rb +10 -0
- data/lib/pione/tuple/attribute-tuple.rb +7 -0
- data/lib/pione/tuple/base-uri-tuple.rb +9 -0
- data/lib/pione/tuple/basic-tuple.rb +317 -0
- data/lib/pione/tuple/bye-tuple.rb +9 -0
- data/lib/pione/tuple/command-tuple.rb +9 -0
- data/lib/pione/tuple/data-tuple.rb +18 -0
- data/lib/pione/tuple/dry-run-tuple.rb +8 -0
- data/lib/pione/tuple/exception-tuple.rb +11 -0
- data/lib/pione/tuple/finished-tuple.rb +17 -0
- data/lib/pione/tuple/foreground-tuple.rb +7 -0
- data/lib/pione/tuple/log-tuple.rb +14 -0
- data/lib/pione/tuple/process-info-tuple.rb +9 -0
- data/lib/pione/tuple/request-rule-tuple.rb +9 -0
- data/lib/pione/tuple/rule-tuple.rb +10 -0
- data/lib/pione/tuple/shift-tuple.rb +13 -0
- data/lib/pione/tuple/task-tuple.rb +36 -0
- data/lib/pione/tuple/task-worker-resource-tuple.rb +9 -0
- data/lib/pione/tuple/working-tuple.rb +13 -0
- data/lib/pione/uri-scheme/basic-scheme.rb +40 -0
- data/lib/pione/uri-scheme/broadcast-scheme.rb +11 -0
- data/lib/pione/uri-scheme/dropbox-scheme.rb +9 -0
- data/lib/pione/uri-scheme/local-scheme.rb +28 -0
- data/lib/pione/util/error-report.rb +12 -0
- data/lib/pione/util/log.rb +79 -0
- data/lib/pione/util/message.rb +155 -0
- data/lib/pione/util/misc.rb +73 -0
- data/lib/pione/util/terminal.rb +78 -0
- data/lib/pione/util/waiter-table.rb +53 -0
- data/lib/pione/version.rb +3 -0
- data/misc/env.sh +2 -0
- data/misc/test-drb-stop-service.rb +34 -0
- data/misc/test-ensure-and-thread-kill.rb +40 -0
- data/misc/test-many-waiters-client.rb +56 -0
- data/misc/test-many-waiters-server.rb +14 -0
- data/misc/write_and_take_test.png +0 -0
- data/misc/write_and_take_test.rb +36 -0
- data/pione.gemspec +49 -0
- data/test/agent/spec_basic-agent.rb +170 -0
- data/test/agent/spec_broker.rb +36 -0
- data/test/agent/spec_command-listener.rb +30 -0
- data/test/agent/spec_input-generator.rb +123 -0
- data/test/agent/spec_logger.rb +71 -0
- data/test/agent/spec_rule-provider.rb +65 -0
- data/test/agent/spec_task-worker.rb +307 -0
- data/test/agent/spec_tuple-space-client.rb +30 -0
- data/test/model/spec_assignment.rb +51 -0
- data/test/model/spec_binary-operator.rb +39 -0
- data/test/model/spec_block.rb +154 -0
- data/test/model/spec_boolean.rb +115 -0
- data/test/model/spec_call-rule.rb +23 -0
- data/test/model/spec_data-expr.rb +312 -0
- data/test/model/spec_feature-expr.rb +359 -0
- data/test/model/spec_feature-expr.yml +16 -0
- data/test/model/spec_float.rb +141 -0
- data/test/model/spec_integer.rb +141 -0
- data/test/model/spec_list.rb +26 -0
- data/test/model/spec_message.rb +42 -0
- data/test/model/spec_package.rb +15 -0
- data/test/model/spec_parameters.rb +148 -0
- data/test/model/spec_rule-expr.rb +66 -0
- data/test/model/spec_rule-io.rb +32 -0
- data/test/model/spec_rule.rb +158 -0
- data/test/model/spec_string.rb +106 -0
- data/test/model/spec_variable-table.rb +117 -0
- data/test/model/spec_variable.rb +84 -0
- data/test/parser/spec_block-parser.rb +5 -0
- data/test/parser/spec_block-parser.yml +85 -0
- data/test/parser/spec_common-parser.rb +281 -0
- data/test/parser/spec_expr-parser.rb +6 -0
- data/test/parser/spec_expr-parser.yml +82 -0
- data/test/parser/spec_feature-expr-parser.rb +32 -0
- data/test/parser/spec_feature-expr-parser.yml +25 -0
- data/test/parser/spec_flow-element-parser.rb +5 -0
- data/test/parser/spec_flow-element-parser.yml +180 -0
- data/test/parser/spec_literal-parser.rb +5 -0
- data/test/parser/spec_literal-parser.yml +123 -0
- data/test/parser/spec_rule-definition-parser.rb +5 -0
- data/test/parser/spec_rule-definition-parser.yml +93 -0
- data/test/patch/spec_rinda-patch.rb +32 -0
- data/test/patch/spec_uri-patch.rb +23 -0
- data/test/rule-handler/spec_action-handler.rb +135 -0
- data/test/rule-handler/spec_flow-handler.rb +127 -0
- data/test/spec_common.rb +14 -0
- data/test/spec_data-finder.rb +88 -0
- data/test/spec_data-finder.yml +115 -0
- data/test/spec_document.rb +76 -0
- data/test/spec_identifier.rb +29 -0
- data/test/spec_log.rb +52 -0
- data/test/spec_object.rb +20 -0
- data/test/spec_resource.rb +73 -0
- data/test/spec_update-criteria.rb +83 -0
- data/test/test-util.rb +223 -0
- data/test/transformer/spec_block-transformer.rb +26 -0
- data/test/transformer/spec_expr-transformer.rb +106 -0
- data/test/transformer/spec_feature-expr-transformer.rb +21 -0
- data/test/transformer/spec_flow-element-transformer.rb +154 -0
- data/test/transformer/spec_literal-transformer.rb +58 -0
- data/test/transformer/spec_rule-definition-transformer.rb +168 -0
- data/test/tuple-space/spec_tuple-space-provider.rb +36 -0
- data/test/tuple-space/spec_tuple-space-receiver.rb +32 -0
- data/test/tuple-space/spec_tuple-space-server.rb +49 -0
- data/test/tuple/spec_basic-tuple.rb +87 -0
- data/test/tuple/spec_data-tuple.rb +85 -0
- data/test/tuple/spec_finished-tuple.rb +61 -0
- data/test/tuple/spec_task-tuple.rb +127 -0
- data/test/tuple/spec_working-tuple.rb +58 -0
- data/test/uri-scheme/spec_broadcast-scheme.rb +40 -0
- data/test/uri-scheme/spec_dropbox-scheme.rb +31 -0
- data/test/uri-scheme/spec_local-scheme.rb +69 -0
- metadata +660 -0
@@ -0,0 +1,170 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
class TestAgentType < Agent::BasicAgent
|
4
|
+
set_agent_type :test_agent_type
|
5
|
+
end
|
6
|
+
|
7
|
+
class TestStateTransition < Agent::BasicAgent
|
8
|
+
define_state :test1
|
9
|
+
define_state :test2
|
10
|
+
define_state :test3
|
11
|
+
|
12
|
+
define_state_transition :initialized => :test1
|
13
|
+
define_state_transition :test1 => :test2
|
14
|
+
define_state_transition :test2 => :test3
|
15
|
+
define_state_transition :test3 => :terminated
|
16
|
+
end
|
17
|
+
|
18
|
+
class TestLoopStateTransition < Agent::BasicAgent
|
19
|
+
define_state :test
|
20
|
+
|
21
|
+
define_state_transition :initialized => :test
|
22
|
+
define_state_transition :test => :test
|
23
|
+
end
|
24
|
+
|
25
|
+
class TestConditionalStateTransition < Agent::BasicAgent
|
26
|
+
define_state :test
|
27
|
+
define_state :testA
|
28
|
+
define_state :testB
|
29
|
+
|
30
|
+
define_state_transition :initialized => :test
|
31
|
+
define_state_transition :test => lambda{|agent,result| agent.next_state }
|
32
|
+
define_state_transition :testA => :test
|
33
|
+
define_state_transition :testB => :test
|
34
|
+
|
35
|
+
attr_reader :next_state
|
36
|
+
|
37
|
+
def transit_to_test
|
38
|
+
case @next_state
|
39
|
+
when nil
|
40
|
+
@next_state = :testA
|
41
|
+
when :testA
|
42
|
+
@next_state = :testB
|
43
|
+
when :testB
|
44
|
+
@next_state = :terminated
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class TestExceptionTransition < Agent::BasicAgent
|
50
|
+
define_state :test
|
51
|
+
define_state :ehandler
|
52
|
+
|
53
|
+
define_state_transition :initialized => :test
|
54
|
+
define_state_transition :test => :terminated
|
55
|
+
define_state_transition :ehandler => :terminated
|
56
|
+
|
57
|
+
define_exception_handler RuntimeError => :ehandler
|
58
|
+
|
59
|
+
def transit_to_test
|
60
|
+
raise RuntimeError.new(:test_exception)
|
61
|
+
end
|
62
|
+
|
63
|
+
def transit_to_ehandler(e)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe 'Pione::Agent::BasicAgent' do
|
68
|
+
describe 'agent type' do
|
69
|
+
it 'should get the agent type' do
|
70
|
+
TestAgentType.agent_type.should == :test_agent_type
|
71
|
+
TestAgentType.new.agent_type.should == :test_agent_type
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
describe 'simple transition' do
|
76
|
+
it 'should return states' do
|
77
|
+
states = TestStateTransition.states
|
78
|
+
states.should.include :initialized
|
79
|
+
states.should.include :test1
|
80
|
+
states.should.include :test2
|
81
|
+
states.should.include :test3
|
82
|
+
states.should.include :terminated
|
83
|
+
states.should.include :error
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'should transit' do
|
87
|
+
ts = TestStateTransition.new
|
88
|
+
ts.current_state.should == nil
|
89
|
+
ts.transit
|
90
|
+
ts.should.initialized
|
91
|
+
ts.transit
|
92
|
+
ts.should.test1
|
93
|
+
ts.transit
|
94
|
+
ts.should.test2
|
95
|
+
ts.transit
|
96
|
+
ts.should.test3
|
97
|
+
ts.transit
|
98
|
+
ts.should.terminated
|
99
|
+
should.raise(Agent::TransitionError) { ts.transit }
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should run' do
|
103
|
+
ts = TestStateTransition.start
|
104
|
+
ts.wait_till(:terminated)
|
105
|
+
ts.should.terminated
|
106
|
+
should.raise(Agent::TransitionError) { ts.start }
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'should terminate' do
|
110
|
+
ts = TestStateTransition.new
|
111
|
+
ts.transit # to initialized
|
112
|
+
ts.transit # to test1
|
113
|
+
ts.terminate
|
114
|
+
ts.should.terminated
|
115
|
+
should.raise(Agent::TransitionError) { ts.transit }
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
describe 'loop transition' do
|
120
|
+
it 'should loop' do
|
121
|
+
ts = TestLoopStateTransition.new
|
122
|
+
100.times { ts.transit }
|
123
|
+
ts.should.test
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'should terminate' do
|
127
|
+
ts = TestLoopStateTransition.start
|
128
|
+
sleep 0.1
|
129
|
+
ts.terminate
|
130
|
+
ts.should.terminated
|
131
|
+
should.raise(Agent::TransitionError) { ts.transit }
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
describe 'conditional transition' do
|
136
|
+
it 'should transit' do
|
137
|
+
ts = TestConditionalStateTransition.new
|
138
|
+
ts.current_state.should.nil
|
139
|
+
ts.transit
|
140
|
+
ts.should.initialized
|
141
|
+
ts.transit
|
142
|
+
ts.should.test
|
143
|
+
ts.transit
|
144
|
+
ts.should.testA
|
145
|
+
ts.transit
|
146
|
+
ts.should.test
|
147
|
+
ts.transit
|
148
|
+
ts.should.testB
|
149
|
+
ts.transit
|
150
|
+
ts.should.test
|
151
|
+
ts.transit
|
152
|
+
ts.should.terminated
|
153
|
+
should.raise(Agent::TransitionError) { ts.transit }
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
describe 'exception handling transition' do
|
158
|
+
it 'should handle an exception' do
|
159
|
+
ts = TestExceptionTransition.new
|
160
|
+
ts.current_state.should.nil
|
161
|
+
ts.transit
|
162
|
+
ts.should.initialized
|
163
|
+
ts.transit
|
164
|
+
ts.should.ehandler
|
165
|
+
ts.transit
|
166
|
+
ts.should.terminated
|
167
|
+
should.raise(Agent::TransitionError) { ts.transit }
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe "Pione::Agent::Broker" do
|
4
|
+
before do
|
5
|
+
DRb.start_service
|
6
|
+
@broker_front = Pione::Front::BrokerFront.new(self)
|
7
|
+
@ts_server1 = TupleSpaceServer.new(task_worker_resource: 1)
|
8
|
+
@ts_server2 = TupleSpaceServer.new(task_worker_resource: 2)
|
9
|
+
@ts_server3 = TupleSpaceServer.new(task_worker_resource: 3)
|
10
|
+
@broker1 = Agent[:broker].new(task_worker_resource: 5)
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
@broker_front.terminate
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should run workers" do
|
18
|
+
@broker1.start
|
19
|
+
@broker1.task_workers.size.should == 0
|
20
|
+
@broker1.add_tuple_space_server @ts_server1
|
21
|
+
sleep 2
|
22
|
+
@broker1.task_workers.size.should == 5
|
23
|
+
@ts_server1.current_task_worker_size.should == 5
|
24
|
+
@broker1.add_tuple_space_server @ts_server2
|
25
|
+
sleep 2
|
26
|
+
@broker1.task_workers.size.should == 5
|
27
|
+
@ts_server1.current_task_worker_size.should == 2
|
28
|
+
@ts_server2.current_task_worker_size.should == 3
|
29
|
+
@broker1.add_tuple_space_server @ts_server3
|
30
|
+
sleep 2
|
31
|
+
@broker1.task_workers.size.should == 5
|
32
|
+
@ts_server1.current_task_worker_size.should == 1
|
33
|
+
@ts_server2.current_task_worker_size.should == 2
|
34
|
+
@ts_server3.current_task_worker_size.should == 2
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
class TestCommandListener < Pione::Agent::TupleSpaceClient
|
4
|
+
define_state :test
|
5
|
+
|
6
|
+
define_state_transition :initialized => :test
|
7
|
+
define_state_transition :test => :test
|
8
|
+
|
9
|
+
def transit_to_test
|
10
|
+
sleep 0.1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'Pione::Agent::CommandListener' do
|
15
|
+
before do
|
16
|
+
create_remote_tuple_space_server
|
17
|
+
end
|
18
|
+
|
19
|
+
after do
|
20
|
+
DRb.stop_service
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should terminate' do
|
24
|
+
agent = TestCommandListener.start(tuple_space_server)
|
25
|
+
agent.wait_till(:test)
|
26
|
+
write(Tuple[:command].new("terminate"))
|
27
|
+
agent.wait_till(:terminated)
|
28
|
+
agent.should.be.terminated
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe "Pione::Agent::InputGenerator" do
|
4
|
+
before do
|
5
|
+
@orig = Global.input_generator_stream_check_timespan
|
6
|
+
DRb.start_service
|
7
|
+
create_remote_tuple_space_server
|
8
|
+
Global.input_generator_stream_check_timespan = 0.1
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
DRb.stop_service
|
13
|
+
Global.input_generator_stream_check_timespan = @orig
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'dir generator' do
|
17
|
+
it 'should generate inputs from files in the directory' do
|
18
|
+
Dir.mktmpdir do |dir|
|
19
|
+
# make local uri
|
20
|
+
uri = URI.parse("local:%s" % dir).as_directory
|
21
|
+
|
22
|
+
# create input files
|
23
|
+
Resource[uri + "1.a"].create("11")
|
24
|
+
Resource[uri + "2.b"].create("22")
|
25
|
+
Resource[uri + "3.c"].create("33")
|
26
|
+
|
27
|
+
# make generator and wait to finish it's job
|
28
|
+
generator = Agent[:input_generator].start_by_dir(tuple_space_server, uri)
|
29
|
+
generator.wait_till(:terminated)
|
30
|
+
|
31
|
+
# check exceptions
|
32
|
+
check_exceptions
|
33
|
+
|
34
|
+
# check data
|
35
|
+
count_tuple(Tuple[:data].any).should == 3
|
36
|
+
should.not.raise(Rinda::RequestExpiredError) do
|
37
|
+
(1..3).each do |i|
|
38
|
+
tuple = Tuple[:data].new(name: "#{i}.#{(i+96).chr}", domain: "input")
|
39
|
+
data = read(tuple, 0)
|
40
|
+
should.not.raise(Resource::NotFound) do
|
41
|
+
Resource[URI(data.uri)].read.should == "#{i}#{i}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'with stream generator' do
|
50
|
+
it 'should stream' do
|
51
|
+
Dir.mktmpdir do |dir|
|
52
|
+
# make local uri
|
53
|
+
uri = URI.parse("local:%s" % dir).as_directory
|
54
|
+
|
55
|
+
# create input files
|
56
|
+
Resource[uri + "1.a"].create("11")
|
57
|
+
Resource[uri + "2.b"].create("22")
|
58
|
+
Resource[uri + "3.c"].create("33")
|
59
|
+
|
60
|
+
# make generator and wait to finish it's job
|
61
|
+
generator = Agent[:input_generator].start_by_stream(tuple_space_server, uri)
|
62
|
+
generator.should.stream
|
63
|
+
generator.terminate
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should provide files in a directory by stream generator' do
|
68
|
+
Dir.mktmpdir do |dir|
|
69
|
+
## initial inputs
|
70
|
+
# make local uri
|
71
|
+
uri = URI.parse("local:%s" % dir).as_directory
|
72
|
+
|
73
|
+
# create input files
|
74
|
+
Resource[uri + "1.a"].create("11")
|
75
|
+
Resource[uri + "2.b"].create("22")
|
76
|
+
Resource[uri + "3.c"].create("33")
|
77
|
+
|
78
|
+
# make generator and wait to finish it's job
|
79
|
+
generator = Agent[:input_generator].start_by_stream(tuple_space_server, uri)
|
80
|
+
generator.wait_till(:sleeping)
|
81
|
+
|
82
|
+
# check exceptions
|
83
|
+
check_exceptions
|
84
|
+
|
85
|
+
# check data
|
86
|
+
count_tuple(Tuple[:data].any).should == 3
|
87
|
+
|
88
|
+
## an addtional input
|
89
|
+
# create additional files
|
90
|
+
Resource[uri + "4.d"].create("44")
|
91
|
+
sleep 0.2
|
92
|
+
generator.wait_till(:sleeping)
|
93
|
+
|
94
|
+
# check exceptions
|
95
|
+
check_exceptions
|
96
|
+
|
97
|
+
# check data
|
98
|
+
count_tuple(Tuple[:data].any).should == 4
|
99
|
+
|
100
|
+
# create additional files
|
101
|
+
Resource[uri + "5.e"].create("55")
|
102
|
+
sleep 0.2
|
103
|
+
generator.wait_till(:sleeping)
|
104
|
+
|
105
|
+
# check exceptions
|
106
|
+
check_exceptions
|
107
|
+
|
108
|
+
# check data
|
109
|
+
count_tuple(Tuple[:data].any).should == 5
|
110
|
+
|
111
|
+
should.not.raise(Rinda::RequestExpiredError) do
|
112
|
+
(1..3).each do |i|
|
113
|
+
tuple = Tuple[:data].new(name: "#{i}.#{(i+96).chr}", domain: "input")
|
114
|
+
data = read(tuple, 0)
|
115
|
+
should.not.raise(Resource::NotFound) do
|
116
|
+
Resource[URI(data.uri)].read.should == "#{i}#{i}"
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe "Pione::Agent::Logger" do
|
4
|
+
before do
|
5
|
+
DRb.start_service
|
6
|
+
create_remote_tuple_space_server
|
7
|
+
@buf = StringIO.new("", "w+")
|
8
|
+
@logger = Agent[:logger].start(tuple_space_server, @buf)
|
9
|
+
@msg1 = "e07860f6-18f0-4c1a-8a5a-7d9f3353c83f"
|
10
|
+
@msg2 = "c8fa705d-fc30-42fa-a05f-a2493717dc39"
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
DRb.stop_service
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should say hello and bye" do
|
18
|
+
# say hello
|
19
|
+
@logger.wait_till(:take)
|
20
|
+
read_all(Tuple[:agent].any).should.include @logger.to_agent_tuple
|
21
|
+
# say bye
|
22
|
+
@logger.terminate
|
23
|
+
@logger.wait_till(:terminated)
|
24
|
+
read_all(Tuple[:agent].any).should.not.include @logger.to_agent_tuple
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should log messages" do
|
28
|
+
# send log messages
|
29
|
+
write(Tuple[:log].new(Log.new{|msg| msg.add_record(:test, :key, @msg1)}))
|
30
|
+
write(Tuple[:log].new(Log.new{|msg| msg.add_record(:test, :key, @msg2)}))
|
31
|
+
@logger.wait_till(:take)
|
32
|
+
@logger.wait_to_clear_logs
|
33
|
+
# check messages
|
34
|
+
@buf.string.should.include @msg1
|
35
|
+
@buf.string.should.include @msg2
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should terminate logging by terminate message" do
|
39
|
+
# terminate
|
40
|
+
@logger.wait_till(:take)
|
41
|
+
@logger.wait_to_clear_logs
|
42
|
+
@logger.terminate
|
43
|
+
@logger.wait_till(:terminated)
|
44
|
+
# write a message after logger was terminated
|
45
|
+
write(Tuple[:log].new(Log.new{|msg| msg.add_record(:test, :key, @msg1)}))
|
46
|
+
sleep 0.1 # wait a little...
|
47
|
+
@buf.string.should.not.include @msg1
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should terminate logging by exceptions" do
|
51
|
+
# write a message
|
52
|
+
write(Tuple[:log].new(Log.new{|msg| msg.add_record(:test, :key, @msg1)}))
|
53
|
+
@logger.wait_to_clear_logs
|
54
|
+
# remote server is shoutdown
|
55
|
+
remote_drb_server.stop_service
|
56
|
+
DRb.stop_service
|
57
|
+
DRb.remove_server(remote_drb_server)
|
58
|
+
sleep 1
|
59
|
+
|
60
|
+
# write a message after remote server was down
|
61
|
+
Util.ignore_exception do
|
62
|
+
write(Tuple[:log].new(Log.new{|msg| msg.add_record(:test, :key, @msg2)}))
|
63
|
+
end
|
64
|
+
@logger.wait_till(:terminated)
|
65
|
+
# logger is terminated
|
66
|
+
@logger.should.be.terminated
|
67
|
+
# check log content
|
68
|
+
@buf.string.should.include @msg1
|
69
|
+
@buf.string.should.not.include @msg2
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
require 'pione/agent/rule-provider'
|
3
|
+
|
4
|
+
describe "Agent::RuleProvider" do
|
5
|
+
before do
|
6
|
+
create_remote_tuple_space_server
|
7
|
+
@provider = Agent[:rule_provider].start(tuple_space_server)
|
8
|
+
doc = Document.parse(<<-DOCUMENT)
|
9
|
+
Rule abc
|
10
|
+
input '*.a'
|
11
|
+
output '{$INPUT[1].MATCH[1]}.b'
|
12
|
+
Action---
|
13
|
+
content "echo 'abc' > {$OUTPUT[1]}"
|
14
|
+
---End
|
15
|
+
|
16
|
+
Rule xyz
|
17
|
+
input '*.a'
|
18
|
+
output '{$INPUT[1].MATCH[1]}.b'
|
19
|
+
Action---
|
20
|
+
content "echo 'xyz' > {$OUTPUT[1]}"
|
21
|
+
---End
|
22
|
+
DOCUMENT
|
23
|
+
@rule_abc = doc['&main:abc']
|
24
|
+
@rule_xyz = doc['&main:xyz']
|
25
|
+
@provider.read_document(doc)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should provide known rule information" do
|
29
|
+
# wait provider's setup
|
30
|
+
@provider.wait_till(:request_waiting)
|
31
|
+
# write a request
|
32
|
+
write_and_wait_to_be_taken(Tuple[:request_rule].new(rule_path: '&main:abc'))
|
33
|
+
check_exceptions
|
34
|
+
# check rule tuple
|
35
|
+
should.not.raise(Rinda::RequestExpiredError) do
|
36
|
+
rule = read(Tuple[:rule].new(rule_path: '&main:abc'))
|
37
|
+
rule.status.should == :known
|
38
|
+
rule.content.class.should == Rule::ActionRule
|
39
|
+
rule.content.should == @rule_abc
|
40
|
+
end
|
41
|
+
# write another request
|
42
|
+
write_and_wait_to_be_taken(Tuple[:request_rule].new(rule_path: '&main:xyz'))
|
43
|
+
check_exceptions
|
44
|
+
# check rule tuple
|
45
|
+
should.not.raise(Rinda::RequestExpiredError) do
|
46
|
+
rule = read(Tuple[:rule].new(rule_path: '&main:xyz'))
|
47
|
+
rule.status.should == :known
|
48
|
+
rule.content.class.should == Rule::ActionRule
|
49
|
+
rule.content.should == @rule_xyz
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should provide unknown rule information" do
|
54
|
+
# wait provider's setup
|
55
|
+
@provider.wait_till(:request_waiting)
|
56
|
+
# write a request
|
57
|
+
write_and_wait_to_be_taken(Tuple[:request_rule].new(rule_path: "aaa"))
|
58
|
+
check_exceptions
|
59
|
+
# check unknown rule tuple
|
60
|
+
should.not.raise(Rinda::RequestExpiredError) do
|
61
|
+
rule = read(Tuple[:rule].new(rule_path: "aaa"))
|
62
|
+
rule.status.should == :unknown
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|