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,158 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::RuleCondition' do
|
4
|
+
it 'should be equal' do
|
5
|
+
a = RuleCondition.new(
|
6
|
+
[DataExpr.new("a")],
|
7
|
+
[DataExpr.new("a")],
|
8
|
+
Parameters.new(Variable.new("var") => "a".to_pione),
|
9
|
+
Feature.and(Feature::RequisiteExpr.new("a"))
|
10
|
+
)
|
11
|
+
b = RuleCondition.new(
|
12
|
+
[DataExpr.new("a")],
|
13
|
+
[DataExpr.new("a")],
|
14
|
+
Parameters.new(Variable.new("var") => "a".to_pione),
|
15
|
+
Feature.and(Feature::RequisiteExpr.new("a"))
|
16
|
+
)
|
17
|
+
a.should == b
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'should not be equal' do
|
21
|
+
a = RuleCondition.new(
|
22
|
+
[DataExpr.new("a")],
|
23
|
+
[DataExpr.new("a")],
|
24
|
+
Parameters.new(Variable.new("var") => "a".to_pione),
|
25
|
+
Feature.and(Feature::RequisiteExpr.new("a"))
|
26
|
+
)
|
27
|
+
b = RuleCondition.new(
|
28
|
+
[DataExpr.new("b")],
|
29
|
+
[DataExpr.new("b")],
|
30
|
+
Parameters.new(Variable.new("var") => "b".to_pione),
|
31
|
+
Feature.and(Feature::RequisiteExpr.new("b"))
|
32
|
+
)
|
33
|
+
a.should.not == b
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
condition_a = RuleCondition.new(
|
38
|
+
[DataExpr.new("a")],
|
39
|
+
[DataExpr.new("a")],
|
40
|
+
Parameters.new(Variable.new("var") => "a".to_pione),
|
41
|
+
Feature.and(Feature::RequisiteExpr.new("a"))
|
42
|
+
)
|
43
|
+
condition_b = RuleCondition.new(
|
44
|
+
[DataExpr.new("b")],
|
45
|
+
[DataExpr.new("b")],
|
46
|
+
Parameters.new(Variable.new("var") => "b".to_pione),
|
47
|
+
Feature.and(Feature::RequisiteExpr.new("b"))
|
48
|
+
)
|
49
|
+
|
50
|
+
describe 'Model::ActionRule' do
|
51
|
+
it 'should be equal' do
|
52
|
+
a = ActionRule.new(
|
53
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
54
|
+
condition_a,
|
55
|
+
'echo "a"'
|
56
|
+
)
|
57
|
+
b = ActionRule.new(
|
58
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
59
|
+
condition_a,
|
60
|
+
'echo "a"'
|
61
|
+
)
|
62
|
+
a.should == b
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should be not equal' do
|
66
|
+
a = ActionRule.new(
|
67
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
68
|
+
condition_a,
|
69
|
+
'echo "a"'
|
70
|
+
)
|
71
|
+
b = ActionRule.new(
|
72
|
+
RuleExpr.new(Package.new("test"), 'b'),
|
73
|
+
condition_b,
|
74
|
+
'echo "b"'
|
75
|
+
)
|
76
|
+
a.should.not == b
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'should be action rule' do
|
80
|
+
ActionRule.new(
|
81
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
82
|
+
condition_a,
|
83
|
+
'echo "a"'
|
84
|
+
).should.action
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'should be not flow rule' do
|
88
|
+
ActionRule.new(
|
89
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
90
|
+
condition_a,
|
91
|
+
'echo "a"'
|
92
|
+
).should.not.flow
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'should make an action handler' do
|
96
|
+
create_remote_tuple_space_server
|
97
|
+
rule = ActionRule.new(
|
98
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
99
|
+
condition_a,
|
100
|
+
'echo "a"'
|
101
|
+
)
|
102
|
+
dir = Dir.mktmpdir
|
103
|
+
uri_a = "local:#{dir}/1.a"
|
104
|
+
uri_b = "local:#{dir}/1.b"
|
105
|
+
Resource[uri_a].create("1")
|
106
|
+
inputs = [Tuple[:data].new(name: '1.a', uri: uri_a)]
|
107
|
+
params = Parameters.empty
|
108
|
+
handler = rule.make_handler(tuple_space_server, inputs, params, [])
|
109
|
+
handler.should.be.kind_of(RuleHandler::ActionHandler)
|
110
|
+
tuple_space_server.terminate
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe 'Model::FlowRule' do
|
115
|
+
it 'should be equal' do
|
116
|
+
a = FlowRule.new(
|
117
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
118
|
+
condition_a,
|
119
|
+
'echo "a"'
|
120
|
+
)
|
121
|
+
b = FlowRule.new(
|
122
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
123
|
+
condition_a,
|
124
|
+
'echo "a"'
|
125
|
+
)
|
126
|
+
a.should == b
|
127
|
+
end
|
128
|
+
|
129
|
+
it 'should be not equal' do
|
130
|
+
a = FlowRule.new(
|
131
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
132
|
+
condition_a,
|
133
|
+
'echo "a"'
|
134
|
+
)
|
135
|
+
b = FlowRule.new(
|
136
|
+
RuleExpr.new(Package.new("test"), 'b'),
|
137
|
+
condition_b,
|
138
|
+
'echo "b"'
|
139
|
+
)
|
140
|
+
a.should.not == b
|
141
|
+
end
|
142
|
+
|
143
|
+
it 'should be flow rule' do
|
144
|
+
FlowRule.new(
|
145
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
146
|
+
condition_a,
|
147
|
+
'echo "a"'
|
148
|
+
).should.flow
|
149
|
+
end
|
150
|
+
|
151
|
+
it 'should be not action rule' do
|
152
|
+
FlowRule.new(
|
153
|
+
RuleExpr.new(Package.new("test"), 'a'),
|
154
|
+
condition_a,
|
155
|
+
'echo "a"'
|
156
|
+
).should.not.action
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::PioneString' do
|
4
|
+
before do
|
5
|
+
@a = PioneString.new("a")
|
6
|
+
@b = PioneString.new("b")
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should get a ruby object that has same value' do
|
10
|
+
@a.to_ruby.should == "a"
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should equal' do
|
14
|
+
@a.should == PioneString.new("a")
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should not equal' do
|
18
|
+
@a.should.not == @b
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should expand variables' do
|
22
|
+
vtable = VariableTable.new({
|
23
|
+
Variable.new("var1") => PioneString.new("a"),
|
24
|
+
Variable.new("var2") => PioneString.new("b")
|
25
|
+
})
|
26
|
+
PioneString.new("{$var1}:{$var2}").eval(vtable).should ==
|
27
|
+
PioneString.new("a:b")
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should expand an expression' do
|
31
|
+
vtable = VariableTable.new
|
32
|
+
PioneString.new("1 + 1 = <?1 + 1?>").eval(vtable).should ==
|
33
|
+
PioneString.new("1 + 1 = 2")
|
34
|
+
PioneString.new("1 + 2 = <? 1 + 2 ?>").eval(vtable).should ==
|
35
|
+
PioneString.new("1 + 2 = 3")
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'pione method ==' do
|
39
|
+
it 'should true' do
|
40
|
+
@a.call_pione_method("==", PioneString.new("a")).should.true
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should false' do
|
44
|
+
@a.call_pione_method("==", @b).should.not.true
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'should raise type error' do
|
48
|
+
should.raise(PioneModelTypeError) do
|
49
|
+
@a.call_pione_method("==", PioneInteger.new(1))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
describe 'pione method !=' do
|
55
|
+
it 'should true' do
|
56
|
+
@a.call_pione_method("!=", @b).should.true
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should false' do
|
60
|
+
@a.call_pione_method("!=", PioneString.new("a")).should.not.true
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'should raise type error' do
|
64
|
+
should.raise(PioneModelTypeError) do
|
65
|
+
@a.call_pione_method("!=", PioneInteger.new(1))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
describe 'pione method +' do
|
71
|
+
it 'should get appended string' do
|
72
|
+
@a.call_pione_method("+", @b).should == PioneString.new("ab")
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should raise type error' do
|
76
|
+
should.raise(PioneModelTypeError) do
|
77
|
+
@a.call_pione_method("!=", PioneInteger.new(1))
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe 'pione method as_string' do
|
83
|
+
it 'should get string' do
|
84
|
+
@a.call_pione_method("as_string").should == @a
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe 'pione method length' do
|
89
|
+
it 'should get length of string' do
|
90
|
+
@a.call_pione_method("length").should == PioneInteger.new(1)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe 'pione method include?' do
|
95
|
+
it 'should get truth' do
|
96
|
+
PioneString.new("acd").call_pione_method("include?", @a).should.true
|
97
|
+
PioneString.new("acd").call_pione_method("include?", @b).should.false
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should raise type error' do
|
101
|
+
should.raise(PioneModelTypeError) do
|
102
|
+
@a.call_pione_method("include?", PioneInteger.new(1))
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::VariableTable' do
|
4
|
+
before do
|
5
|
+
@table = VariableTable.new
|
6
|
+
@table.set(Variable.new('A'), PioneInteger.new(1))
|
7
|
+
@table.set(Variable.new('B'), PioneInteger.new(2))
|
8
|
+
@table.set(Variable.new('C'), PioneInteger.new(3))
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should get an empty table' do
|
12
|
+
VariableTable.empty.should.empty
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should get a variable value' do
|
16
|
+
@table.get(Variable.new('A')).should == PioneInteger.new(1)
|
17
|
+
@table.get(Variable.new('B')).should == PioneInteger.new(2)
|
18
|
+
@table.get(Variable.new('C')).should == PioneInteger.new(3)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should get nil if the variable is unknown in the table' do
|
22
|
+
@table.get(Variable.new('D')).should.nil
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should set a new variable' do
|
26
|
+
@table.set(Variable.new('D'), PioneInteger.new(4))
|
27
|
+
@table.get(Variable.new('D')).should == PioneInteger.new(4)
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'should not raise errors by binding same value as same name variable' do
|
31
|
+
should.not.raise(VariableBindingError) do
|
32
|
+
@table.set(Variable.new('A'), PioneInteger.new(1))
|
33
|
+
@table.set(Variable.new('B'), PioneInteger.new(2))
|
34
|
+
@table.set(Variable.new('C'), PioneInteger.new(3))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'should raise an error by binding different value as same name variable' do
|
39
|
+
should.raise(VariableBindingError) do
|
40
|
+
@table.set(Variable.new('A'), PioneInteger.new(100))
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should expand a string with variable name form' do
|
45
|
+
@table.expand('{$A}').should == '1'
|
46
|
+
@table.expand('{$B}').should == '2'
|
47
|
+
@table.expand('{$C}').should == '3'
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should expand a string with variable expression form' do
|
51
|
+
@table.expand('<? $A + 1 ?>').should == '2'
|
52
|
+
@table.expand('<? $B + 1 ?>').should == '3'
|
53
|
+
@table.expand('<? $C + 1 ?>').should == '4'
|
54
|
+
end
|
55
|
+
|
56
|
+
it 'should get keys' do
|
57
|
+
vars = @table.variables
|
58
|
+
vars.should.include(Variable.new("A"))
|
59
|
+
vars.should.include(Variable.new("B"))
|
60
|
+
vars.should.include(Variable.new("C"))
|
61
|
+
vars.should.not.include(Variable.new("D"))
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'should raise an error by unknown variable when expanding a string' do
|
65
|
+
should.raise(UnboundVariableError) do
|
66
|
+
@table.expand('{$D}')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'should have input auto variables' do
|
71
|
+
input_exprs = [
|
72
|
+
DataExpr.new('*.a'),
|
73
|
+
DataExpr.new('*.b').all
|
74
|
+
]
|
75
|
+
input_tuples = [
|
76
|
+
Tuple[:data].new(name: '1.a', uri: 'test'),
|
77
|
+
[ Tuple[:data].new(name: '1.b', uri: 'test1'),
|
78
|
+
Tuple[:data].new(name: '2.b', uri: 'test2'),
|
79
|
+
Tuple[:data].new(name: '3.b', uri: 'test3')]
|
80
|
+
]
|
81
|
+
|
82
|
+
@table.make_input_auto_variables(input_exprs, input_tuples)
|
83
|
+
|
84
|
+
input = @table.get(Variable.new('I'))
|
85
|
+
input.should.kind_of(RuleIOList)
|
86
|
+
input.should == @table.get(Variable.new('INPUT'))
|
87
|
+
|
88
|
+
input1 = input[0]
|
89
|
+
input1.should.kind_of(RuleIOElement)
|
90
|
+
input1.name.should == "1.a".to_pione
|
91
|
+
input1.match.size.should == 2
|
92
|
+
input1.match[0] == "1.a".to_pione
|
93
|
+
input1.match[1] == "1".to_pione
|
94
|
+
input1.uri = "test"
|
95
|
+
|
96
|
+
input2 = input[1]
|
97
|
+
input2.should.kind_of(RuleIOList)
|
98
|
+
input2.size.should == 3
|
99
|
+
input2[0].should.kind_of(RuleIOElement)
|
100
|
+
input2[0].name.should == "1.b".to_pione
|
101
|
+
input2[0].match.size.should == 2
|
102
|
+
input2[0].match[0].should == "1.b".to_pione
|
103
|
+
input2[0].match[1].should == "1".to_pione
|
104
|
+
input2[1].should.kind_of(RuleIOElement)
|
105
|
+
input2[1].name.should == "2.b".to_pione
|
106
|
+
input2[1].match.size.should == 2
|
107
|
+
input2[1].match[0].should == "2.b".to_pione
|
108
|
+
input2[1].match[1].should == "2".to_pione
|
109
|
+
input2[2].should.kind_of(RuleIOElement)
|
110
|
+
input2[2].name.should == "3.b".to_pione
|
111
|
+
input2[2].match.size.should == 2
|
112
|
+
input2[2].match[0].should == "3.b".to_pione
|
113
|
+
input2[2].match[1].should == "3".to_pione
|
114
|
+
|
115
|
+
@table.get(Variable.new('*')).should == PioneString.new('1')
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require_relative '../test-util'
|
2
|
+
|
3
|
+
describe 'Model::Variable' do
|
4
|
+
before do
|
5
|
+
@a = Variable.new("a")
|
6
|
+
@b = Variable.new("b")
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'should equal' do
|
10
|
+
@a.should == Variable.new("a")
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should not equal' do
|
14
|
+
@a.should.not == @b
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'pione method ==' do
|
18
|
+
it 'should true' do
|
19
|
+
@a.call_pione_method("==", @a).should.true
|
20
|
+
vtable = VariableTable.new
|
21
|
+
vtable.set(@a, PioneInteger.new(1))
|
22
|
+
vtable.set(@b, PioneInteger.new(1))
|
23
|
+
BinaryOperator.new("==", @a, @b).eval(vtable).should.true
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should false' do
|
27
|
+
vtable = VariableTable.new
|
28
|
+
vtable.set(@a, PioneInteger.new(1))
|
29
|
+
vtable.set(@b, PioneInteger.new(2))
|
30
|
+
BinaryOperator.new("==", @a, @b).eval(vtable).should.false
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should raise unbound variable error' do
|
34
|
+
vtable = VariableTable.new
|
35
|
+
vtable.set(@a, PioneInteger.new(1))
|
36
|
+
should.raise(UnboundVariableError) do
|
37
|
+
BinaryOperator.new("==", @a, @b).eval(vtable)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should raise type error' do
|
42
|
+
vtable = VariableTable.new
|
43
|
+
vtable.set(@a, PioneInteger.new(1))
|
44
|
+
vtable.set(@b, PioneFloat.new(1.0))
|
45
|
+
should.raise(PioneModelTypeError) do
|
46
|
+
BinaryOperator.new("==", @a, @b).eval(vtable)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'pione method !=' do
|
52
|
+
it 'should true' do
|
53
|
+
vtable = VariableTable.new
|
54
|
+
vtable.set(@a, PioneInteger.new(1))
|
55
|
+
vtable.set(@b, PioneInteger.new(2))
|
56
|
+
BinaryOperator.new("!=", @a, @b).eval(vtable).should.true
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should false' do
|
60
|
+
@a.call_pione_method("!=", @a).should.false
|
61
|
+
vtable = VariableTable.new
|
62
|
+
vtable.set(@a, PioneInteger.new(1))
|
63
|
+
vtable.set(@b, PioneInteger.new(1))
|
64
|
+
BinaryOperator.new("!=", @a, @b).eval(vtable).should.false
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should raise unbound variable error' do
|
68
|
+
vtable = VariableTable.new
|
69
|
+
vtable.set(@a, PioneInteger.new(1))
|
70
|
+
should.raise(UnboundVariableError) do
|
71
|
+
BinaryOperator.new("!=", @a, @b).eval(vtable)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
it 'should raise type error' do
|
76
|
+
vtable = VariableTable.new
|
77
|
+
vtable.set(@a, PioneInteger.new(1))
|
78
|
+
vtable.set(@b, PioneFloat.new(1.0))
|
79
|
+
should.raise(PioneModelTypeError) do
|
80
|
+
BinaryOperator.new("!=", @a, @b).eval(vtable)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|