pione 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/.s3cfg +42 -0
- data/.travis.yml +18 -4
- data/.yardopts +1 -0
- data/Gemfile +3 -0
- data/History.txt +14 -0
- data/Procfile +7 -0
- data/Rakefile +25 -0
- data/bin/pione-interactive +6 -0
- data/bin/{pione-compiler → pione-notification-listener} +1 -1
- data/bin/{pione-broker → pione-task-worker-broker} +1 -1
- data/doc/man/pione-list-param.md +36 -0
- data/example/ActionError/ActionError.pione +9 -0
- data/example/ActionError/pione-package.json +15 -0
- data/example/CountChar/CountChar.pione +1 -1
- data/example/ScoreAggregation/ScoreAggregation.pione +1 -1
- data/example/Touch/pione-package.json +15 -0
- data/lib/pione.rb +12 -0
- data/lib/pione/agent.rb +3 -3
- data/lib/pione/agent/basic-agent.rb +10 -4
- data/lib/pione/agent/input-generator.rb +3 -3
- data/lib/pione/agent/{process-manager.rb → job-manager.rb} +10 -7
- data/lib/pione/agent/job-terminator.rb +2 -2
- data/lib/pione/agent/logger.rb +3 -3
- data/lib/pione/agent/messenger.rb +20 -9
- data/lib/pione/agent/notification-listener.rb +88 -0
- data/lib/pione/agent/task-worker-broker.rb +84 -0
- data/lib/pione/agent/task-worker.rb +3 -2
- data/lib/pione/agent/tuple-space-client.rb +1 -0
- data/lib/pione/agent/tuple-space-provider.rb +17 -35
- data/lib/pione/command.rb +33 -15
- data/lib/pione/command/action.rb +105 -0
- data/lib/pione/command/basic-command.rb +34 -376
- data/lib/pione/command/command-exception.rb +12 -11
- data/lib/pione/command/common.rb +198 -0
- data/lib/pione/command/option.rb +159 -204
- data/lib/pione/command/pione-action-exec.rb +85 -0
- data/lib/pione/command/pione-action-list.rb +43 -19
- data/lib/pione/command/pione-action-print.rb +79 -0
- data/lib/pione/command/pione-action.rb +8 -67
- data/lib/pione/command/pione-clean.rb +88 -68
- data/lib/pione/command/pione-client.rb +475 -332
- data/lib/pione/command/pione-command.rb +14 -31
- data/lib/pione/command/pione-compile.rb +90 -0
- data/lib/pione/command/pione-config-get.rb +53 -0
- data/lib/pione/command/pione-config-list.rb +64 -0
- data/lib/pione/command/pione-config-set.rb +59 -0
- data/lib/pione/command/pione-config-unset.rb +50 -0
- data/lib/pione/command/pione-config.rb +61 -0
- data/lib/pione/command/pione-diagnosis-notification.rb +235 -0
- data/lib/pione/command/pione-diagnosis.rb +21 -0
- data/lib/pione/command/pione-interactive.rb +188 -0
- data/lib/pione/command/pione-lang-check-syntax.rb +163 -0
- data/lib/pione/command/pione-lang-interactive.rb +146 -0
- data/lib/pione/command/pione-lang.rb +22 -0
- data/lib/pione/command/pione-log-format.rb +163 -0
- data/lib/pione/command/pione-log-list-id.rb +48 -0
- data/lib/pione/command/pione-log.rb +19 -101
- data/lib/pione/command/pione-notification-listener.rb +95 -0
- data/lib/pione/command/pione-package-add.rb +137 -0
- data/lib/pione/command/pione-package-build.rb +122 -0
- data/lib/pione/command/pione-package-show.rb +96 -0
- data/lib/pione/command/pione-package-update.rb +59 -0
- data/lib/pione/command/pione-package.rb +11 -139
- data/lib/pione/command/pione-task-worker-broker.rb +88 -0
- data/lib/pione/command/pione-task-worker.rb +148 -98
- data/lib/pione/command/pione-tuple-space-provider.rb +62 -54
- data/lib/pione/command/pione-tuple-space-viewer.rb +105 -83
- data/lib/pione/command/pione-val.rb +39 -39
- data/lib/pione/command/spawner.rb +34 -27
- data/lib/pione/front.rb +4 -2
- data/lib/pione/front/basic-front.rb +86 -23
- data/lib/pione/front/client-front.rb +2 -2
- data/lib/pione/front/diagnosis-notification-front.rb +40 -0
- data/lib/pione/front/front-exception.rb +7 -1
- data/lib/pione/front/notification-listener-front.rb +36 -0
- data/lib/pione/front/notification-recipient-interface.rb +19 -0
- data/lib/pione/front/relay-front.rb +4 -4
- data/lib/pione/front/task-worker-broker-front.rb +19 -0
- data/lib/pione/front/task-worker-front.rb +2 -2
- data/lib/pione/front/tuple-space-provider-front.rb +3 -2
- data/lib/pione/global.rb +3 -1
- data/lib/pione/global/client-variable.rb +1 -1
- data/lib/pione/global/config.rb +63 -7
- data/lib/pione/global/diagnosis-variable.rb +26 -0
- data/lib/pione/global/item.rb +28 -5
- data/lib/pione/global/log-variable.rb +6 -5
- data/lib/pione/global/network-variable.rb +75 -4
- data/lib/pione/global/path-variable.rb +1 -1
- data/lib/pione/global/system-variable.rb +12 -12
- data/lib/pione/global/task-worker-broker-variable.rb +43 -0
- data/lib/pione/global/tuple-space-notifier-variable.rb +3 -55
- data/lib/pione/lang/boolean.rb +4 -0
- data/lib/pione/lang/data-expr.rb +1 -1
- data/lib/pione/lang/integer.rb +1 -1
- data/lib/pione/lang/string.rb +4 -0
- data/lib/pione/lang/type.rb +1 -1
- data/lib/pione/location.rb +1 -0
- data/lib/pione/location/data-location.rb +41 -13
- data/lib/pione/location/dropbox-location.rb +175 -56
- data/lib/pione/location/ftp-location.rb +4 -1
- data/lib/pione/location/http-location.rb +5 -3
- data/lib/pione/location/https-location.rb +4 -2
- data/lib/pione/location/local-location.rb +6 -3
- data/lib/pione/location/location-exception.rb +12 -0
- data/lib/pione/location/notification-scheme.rb +46 -0
- data/lib/pione/log.rb +8 -7
- data/lib/pione/log/debug.rb +9 -9
- data/lib/pione/log/domain-log.rb +6 -1
- data/lib/pione/log/message-log-receiver.rb +32 -0
- data/lib/pione/log/system-log.rb +62 -141
- data/lib/pione/model.rb +7 -0
- data/lib/pione/model/notification-listener-model.rb +29 -0
- data/lib/pione/model/task-worker-broker-model.rb +129 -0
- data/lib/pione/notification.rb +13 -0
- data/lib/pione/notification/address.rb +104 -0
- data/lib/pione/notification/exception.rb +10 -0
- data/lib/pione/notification/message.rb +109 -0
- data/lib/pione/notification/receiver.rb +90 -0
- data/lib/pione/notification/recipient.rb +68 -0
- data/lib/pione/notification/task-worker-broker-recipient.rb +85 -0
- data/lib/pione/notification/transmitter.rb +84 -0
- data/lib/pione/pnml.rb +35 -0
- data/lib/pione/pnml/annotation-extractor.rb +47 -0
- data/lib/pione/pnml/compiler.rb +176 -0
- data/lib/pione/pnml/input-merge-complement.rb +78 -0
- data/lib/pione/pnml/input-parallelization-complement.rb +75 -0
- data/lib/pione/pnml/input-reduction.rb +80 -0
- data/lib/pione/pnml/invalid-arc-elimination.rb +41 -0
- data/lib/pione/pnml/io-expansion.rb +88 -0
- data/lib/pione/pnml/isolated-element-elimination.rb +32 -0
- data/lib/pione/pnml/net-rewriter.rb +44 -0
- data/lib/pione/pnml/output-decomposition-complement.rb +77 -0
- data/lib/pione/pnml/output-reduction.rb +86 -0
- data/lib/pione/pnml/output-synchronization-complement.rb +77 -0
- data/lib/pione/pnml/pione-model.rb +417 -0
- data/lib/pione/pnml/pnml-exception.rb +23 -0
- data/lib/pione/pnml/pnml-model.rb +368 -0
- data/lib/pione/pnml/reader.rb +51 -0
- data/lib/pione/rule-engine/action-handler.rb +8 -6
- data/lib/pione/rule-engine/basic-handler.rb +5 -5
- data/lib/pione/rule-engine/engine-exception.rb +7 -6
- data/lib/pione/rule-engine/flow-handler.rb +27 -18
- data/lib/pione/system.rb +3 -1
- data/lib/pione/system/domain-dump.rb +34 -0
- data/lib/pione/system/file-cache.rb +92 -13
- data/lib/pione/system/init.rb +3 -0
- data/lib/pione/system/normalizer.rb +40 -0
- data/lib/pione/system/status.rb +5 -5
- data/lib/pione/system/system-exception.rb +14 -1
- data/lib/pione/task-worker-broker.rb +7 -0
- data/lib/pione/task-worker-broker/basic-provider.rb +20 -0
- data/lib/pione/task-worker-broker/easy-provider.rb +65 -0
- data/lib/pione/test-helper.rb +27 -0
- data/lib/pione/test-helper/command-helper.rb +9 -101
- data/lib/pione/tuple-space/basic-tuple.rb +1 -1
- data/lib/pione/tuple-space/tuple-definition.yml +4 -6
- data/lib/pione/tuple-space/tuple-space-interface.rb +3 -45
- data/lib/pione/tuple-space/tuple-space-server.rb +45 -0
- data/lib/pione/util.rb +1 -2
- data/lib/pione/util/boolean-value.rb +62 -0
- data/lib/pione/util/completion.rb +111 -0
- data/lib/pione/util/evaluatable.rb +13 -27
- data/lib/pione/util/package-parameters-list.rb +15 -27
- data/lib/pione/util/zip.rb +8 -3
- data/lib/pione/version.rb +1 -1
- data/lib/rootage.rb +20 -0
- data/lib/rootage/action.rb +114 -0
- data/lib/rootage/argument.rb +46 -0
- data/lib/rootage/command.rb +218 -0
- data/lib/rootage/core.rb +532 -0
- data/lib/rootage/exception.rb +107 -0
- data/lib/rootage/help.rb +148 -0
- data/lib/rootage/help.txt.erb +31 -0
- data/lib/rootage/log.rb +226 -0
- data/lib/rootage/normalizer.rb +184 -0
- data/lib/rootage/option.rb +152 -0
- data/lib/rootage/scenario-test-result.erb +39 -0
- data/lib/rootage/scenario.rb +362 -0
- data/lib/rootage/test-helper.rb +115 -0
- data/man/pione-list-param.1 +44 -0
- data/misc/clock.rb +9 -0
- data/misc/machine-info.sh +21 -0
- data/misc/pione-completion.bash +238 -0
- data/misc/pione-completion.erb +53 -0
- data/misc/pione-completion.zsh +238 -0
- data/misc/pione.god +22 -0
- data/misc/ui.xml +23 -0
- data/pione.gemspec +3 -1
- data/test/agent/spec_basic-agent.rb +1 -1
- data/test/agent/spec_input-generator.rb +2 -2
- data/test/agent/spec_messenger.rb +6 -9
- data/test/agent/spec_notification-listener.rb +80 -0
- data/test/agent/{spec_broker.rb → spec_task-worker-broker.rb} +13 -10
- data/test/agent/spec_tuple-space-provider.rb +10 -6
- data/test/command/command-behavior.rb +3 -11
- data/test/command/data/pione-list-param/AdvancedParameters.pione +12 -0
- data/test/command/data/pione-list-param/BasicParameters.pione +12 -0
- data/test/command/spec_pione-action-exec.rb +16 -0
- data/test/command/spec_pione-action-list.rb +15 -10
- data/test/command/spec_pione-action-print.rb +14 -0
- data/test/command/spec_pione-action.rb +6 -19
- data/test/command/spec_pione-clean.rb +29 -46
- data/test/command/spec_pione-client.rb +29 -36
- data/test/command/spec_pione-command.rb +6 -6
- data/test/command/{spec_pione-compiler.rb → spec_pione-compile.rb} +11 -13
- data/test/command/spec_pione-config-get.rb +47 -0
- data/test/command/spec_pione-config-list.rb +42 -0
- data/test/command/spec_pione-config-set.rb +38 -0
- data/test/command/spec_pione-config-unset.rb +44 -0
- data/test/command/spec_pione-config.rb +11 -0
- data/test/command/spec_pione-diagnosis-notification.rb +23 -0
- data/test/command/spec_pione-diagnosis.rb +11 -0
- data/test/command/spec_pione-lang-check-syntax.rb +12 -0
- data/test/command/spec_pione-lang.rb +11 -0
- data/test/command/spec_pione-log-format.rb +29 -0
- data/test/command/spec_pione-log-list-id.rb +17 -0
- data/test/command/spec_pione-log.rb +6 -20
- data/test/command/spec_pione-package-add.rb +55 -0
- data/test/command/spec_pione-package-build.rb +57 -0
- data/test/command/spec_pione-package-show.rb +72 -0
- data/test/command/{spec_pione-update-package-info.rb → spec_pione-package-update.rb} +12 -13
- data/test/command/spec_pione-package.rb +4 -104
- data/test/command/spec_pione-val.rb +10 -7
- data/test/global/spec_config.rb +50 -0
- data/test/global/spec_item.rb +1 -1
- data/test/literate-action/data/HelloWorld.md +1 -1
- data/test/location/location-behavior.rb +1 -1
- data/test/location/spec_dropbox-location.rb +39 -0
- data/test/location/spec_notification-scheme.rb +37 -0
- data/test/log/spec_debug.rb +5 -4
- data/test/log/spec_message-log-receiver.rb +13 -0
- data/test/log/spec_message-log.rb +6 -9
- data/test/log/spec_system-log.rb +5 -3
- data/test/notification/spec_address.rb +229 -0
- data/test/notification/spec_message.rb +30 -0
- data/test/notification/spec_receiver.rb +36 -0
- data/test/notification/spec_transmitter.rb +37 -0
- data/test/pnml/data/ConditionalBranchIf.pnml +270 -0
- data/test/pnml/data/ConditionalBranchIfElse.pnml +309 -0
- data/test/pnml/data/IOExpansionComplex.pnml +363 -0
- data/test/pnml/data/IOExpansionSimple.pnml +140 -0
- data/test/pnml/data/InputMergeComplementComplex.pnml +381 -0
- data/test/pnml/data/InputMergeComplementSimple.pnml +248 -0
- data/test/pnml/data/InputParallelizationComplementComplex.pnml +433 -0
- data/test/pnml/data/InputParallelizationComplementSimple.pnml +288 -0
- data/test/pnml/data/InputReductionComplex.pnml +192 -0
- data/test/pnml/data/InputReductionLong.pnml +344 -0
- data/test/pnml/data/InputReductionSimple.pnml +140 -0
- data/test/pnml/data/IsolatedElementElimination.pnml +171 -0
- data/test/pnml/data/OutputDecompositionComplementComplex.pnml +381 -0
- data/test/pnml/data/OutputDecompositionComplementSimple.pnml +242 -0
- data/test/pnml/data/OutputReductionComplex.pnml +186 -0
- data/test/pnml/data/OutputReductionLong.pnml +344 -0
- data/test/pnml/data/OutputReductionSimple.pnml +140 -0
- data/test/pnml/data/OutputSynchronizationComplementComplex.pnml +498 -0
- data/test/pnml/data/OutputSynchronizationComplementSimple.pnml +347 -0
- data/test/pnml/data/SampleNet.pnml +238 -0
- data/test/pnml/spec_input-merge-complement.rb +40 -0
- data/test/pnml/spec_input-parallelization-complement.rb +50 -0
- data/test/pnml/spec_input-reduction.rb +113 -0
- data/test/pnml/spec_invalid-arc-elimination.rb +33 -0
- data/test/pnml/spec_io-expansion.rb +126 -0
- data/test/pnml/spec_isolated-element-elimination.rb +25 -0
- data/test/pnml/spec_output-decomposition-complement.rb +40 -0
- data/test/pnml/spec_output-reduction.rb +114 -0
- data/test/pnml/spec_output-synchronization-complement.rb +62 -0
- data/test/pnml/spec_pione-element.rb +144 -0
- data/test/pnml/spec_pnml-element.rb +373 -0
- data/test/pnml/spec_reader.rb +16 -0
- data/test/rootage/spec_argument.rb +18 -0
- data/test/rootage/spec_command.rb +239 -0
- data/test/rootage/spec_core.rb +198 -0
- data/test/rootage/spec_scenario.rb +149 -0
- data/test/system/{spec_domain-info.rb → spec_domain-dump.rb} +6 -6
- data/test/system/spec_file-cache.rb +6 -9
- data/test/tuple-space/spec_finished-tuple.rb +1 -1
- data/test/util/{spec_package-parameters-list_1.pione → data/package-parameters-list/Param1.pione} +0 -0
- data/test/util/{spec_package-parameters-list_2.pione → data/package-parameters-list/Param2.pione} +0 -0
- data/test/util/{spec_package-parameters-list_3.pione → data/package-parameters-list/Param3.pione} +0 -0
- data/test/util/{spec_package-parameters-list_4.pione → data/package-parameters-list/Param4.pione} +0 -0
- data/test/util/spec_boolean-value.rb +32 -0
- data/test/util/spec_completion.rb +22 -0
- data/test/util/spec_package-parameters-list.rb +39 -52
- data/test/util/spec_zip.rb +28 -1
- metadata +288 -47
- data/bin/pione-tuple-space-receiver +0 -5
- data/lib/pione/agent/broker.rb +0 -304
- data/lib/pione/agent/tuple-space-receiver.rb +0 -137
- data/lib/pione/command/pione-broker.rb +0 -104
- data/lib/pione/command/pione-compiler.rb +0 -57
- data/lib/pione/command/pione-relay-account-db.rb +0 -141
- data/lib/pione/command/pione-relay-client-db.rb +0 -118
- data/lib/pione/command/pione-relay.rb +0 -59
- data/lib/pione/command/pione-syntax-checker.rb +0 -214
- data/lib/pione/command/pione-tuple-space-receiver.rb +0 -111
- data/lib/pione/command/pione-update-package-info.rb +0 -53
- data/lib/pione/front/broker-front.rb +0 -22
- data/lib/pione/front/tuple-space-receiver-front.rb +0 -11
- data/lib/pione/global/broker-variable.rb +0 -33
- data/lib/pione/system/domain-info.rb +0 -25
- data/lib/pione/util/pnml-compiler.rb +0 -168
- data/test/agent/spec_tuple-space-receiver.rb +0 -47
- data/test/util/spec_pnml-compiler.rb +0 -32
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
describe Pione::Location::NotificationBroadcastScheme do
|
4
|
+
it "should parse" do
|
5
|
+
uri = URI.parse("pnb://255.255.255.255:56000")
|
6
|
+
uri.scheme.should == "pnb"
|
7
|
+
uri.host.should == "255.255.255.255"
|
8
|
+
uri.port.should == 56000
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe Pione::Location::NotificationMulticastScheme do
|
13
|
+
it "should parse" do
|
14
|
+
uri = URI.parse("pnm://239.0.0.1:56000")
|
15
|
+
uri.scheme.should == "pnm"
|
16
|
+
uri.host.should == "239.0.0.1"
|
17
|
+
uri.port.should == 56000
|
18
|
+
uri.interface.should.nil
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should parse with interface" do
|
22
|
+
uri = URI.parse("pnm://239.0.0.1:56000?if=192.168.100.10")
|
23
|
+
uri.scheme.should == "pnm"
|
24
|
+
uri.host.should == "239.0.0.1"
|
25
|
+
uri.port.should == 56000
|
26
|
+
uri.interface.should == "192.168.100.10"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe Pione::Location::NotificationUnicastScheme do
|
31
|
+
it "should parse" do
|
32
|
+
uri = URI.parse("pnu://192.168.100.11:56000")
|
33
|
+
uri.scheme.should == "pnu"
|
34
|
+
uri.host.should == "192.168.100.11"
|
35
|
+
uri.port.should == 56000
|
36
|
+
end
|
37
|
+
end
|
data/test/log/spec_debug.rb
CHANGED
@@ -5,6 +5,7 @@ describe "Pione::Log::Debug" do
|
|
5
5
|
@out = StringIO.new
|
6
6
|
@orig = Global.system_logger
|
7
7
|
Global.system_logger = Log::PioneSystemLogger.new(@out)
|
8
|
+
Global.system_logger.level = :debug
|
8
9
|
end
|
9
10
|
|
10
11
|
after do
|
@@ -12,7 +13,7 @@ describe "Pione::Log::Debug" do
|
|
12
13
|
Global.debug_system = false
|
13
14
|
Global.debug_rule_engine = false
|
14
15
|
Global.debug_communication = false
|
15
|
-
Global.
|
16
|
+
Global.debug_notification = false
|
16
17
|
Global.debug_ignored_exception = false
|
17
18
|
end
|
18
19
|
|
@@ -37,9 +38,9 @@ describe "Pione::Log::Debug" do
|
|
37
38
|
@out.string.should.include("XYZ")
|
38
39
|
end
|
39
40
|
|
40
|
-
it "should print
|
41
|
-
Global.
|
42
|
-
Log::Debug.
|
41
|
+
it "should print notification debug message" do
|
42
|
+
Global.debug_notification = true
|
43
|
+
Log::Debug.notification("XYZ")
|
43
44
|
sleep 0.1 while Global.system_logger.queued?
|
44
45
|
@out.string.should.include("XYZ")
|
45
46
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
describe Pione::Log::CUIMessageLogReceiver do
|
4
|
+
before do
|
5
|
+
@io = StringIO.new("", "w+")
|
6
|
+
@receiver = Log::CUIMessageLogReceiver.new(@io)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should receive a message" do
|
10
|
+
@receiver.receive("test message", 0, "TEST", :red)
|
11
|
+
@io.string.chomp.should == "%s test message" % " TEST".color(:red)
|
12
|
+
end
|
13
|
+
end
|
@@ -10,16 +10,13 @@ TestHelper.scope do |this|
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
describe
|
13
|
+
describe Pione::Log::MessageLog do
|
14
14
|
before do
|
15
|
+
@io = StringIO.new("", "w+")
|
15
16
|
tuple_space_server = TestHelper::TupleSpace.create(self)
|
17
|
+
receiver = Log::CUIMessageLogReceiver.new(@io)
|
16
18
|
@ts = tuple_space_server
|
17
|
-
@messenger = Agent
|
18
|
-
class << @messenger
|
19
|
-
attr_accessor :msgs
|
20
|
-
define_method(:puts) {|msg| @msgs << msg}
|
21
|
-
end
|
22
|
-
@messenger.msgs = []
|
19
|
+
@messenger = Agent::Messenger.new(tuple_space_server, receiver)
|
23
20
|
@sender = TestSender.new(@ts)
|
24
21
|
end
|
25
22
|
|
@@ -33,7 +30,7 @@ TestHelper.scope do |this|
|
|
33
30
|
sleep 1
|
34
31
|
@messenger.terminate
|
35
32
|
@messenger.wait_until_terminated
|
36
|
-
@
|
33
|
+
@io.string.lines.to_a.compact.size.should == 1
|
37
34
|
end
|
38
35
|
|
39
36
|
it "should send debug message" do
|
@@ -44,7 +41,7 @@ TestHelper.scope do |this|
|
|
44
41
|
sleep 1
|
45
42
|
@messenger.terminate
|
46
43
|
@messenger.wait_until_terminated
|
47
|
-
@
|
44
|
+
@io.string.lines.to_a.compact.size.should == 1
|
48
45
|
end
|
49
46
|
end
|
50
47
|
end
|
data/test/log/spec_system-log.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'pione/test-helper'
|
2
2
|
|
3
|
-
class TestLogger < Log::
|
3
|
+
class TestLogger < Log::PioneSystemLogger
|
4
4
|
forward :@out, :puts, :fatal
|
5
5
|
forward :@out, :puts, :error
|
6
6
|
forward :@out, :puts, :warn
|
@@ -71,6 +71,7 @@ describe "Pione::Log::PioneSystemLogger" do
|
|
71
71
|
before do
|
72
72
|
@out = StringIO.new
|
73
73
|
@logger = Log::PioneSystemLogger.new(@out)
|
74
|
+
@logger.level = :debug
|
74
75
|
end
|
75
76
|
|
76
77
|
after do
|
@@ -83,7 +84,8 @@ end
|
|
83
84
|
describe "Pione::Log::RubyStandardSystemLogger" do
|
84
85
|
before do
|
85
86
|
@out = StringIO.new
|
86
|
-
@logger =
|
87
|
+
@logger = Rootage::RubyStandardLogger.new(@out)
|
88
|
+
@logger.level = :debug
|
87
89
|
end
|
88
90
|
|
89
91
|
behaves_like "system logger"
|
@@ -112,7 +114,7 @@ Logger::Syslog.const_set :SYSLOG, MockSyslog
|
|
112
114
|
describe "Pione::Log::SyslogSystemLogger" do
|
113
115
|
before do
|
114
116
|
@out = MockSyslog.out
|
115
|
-
@logger =
|
117
|
+
@logger = Rootage::SyslogLogger.new
|
116
118
|
end
|
117
119
|
|
118
120
|
after do
|
@@ -0,0 +1,229 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
describe Pione::Notification::Address do
|
4
|
+
describe "target address" do
|
5
|
+
it "should get a URI for a target address \"255.255.255.255:56001\"" do
|
6
|
+
uri = Notification::Address.target_address_to_uri("pnb://255.255.255.255:56001")
|
7
|
+
uri.scheme.should == "pnb"
|
8
|
+
uri.host.should == "255.255.255.255"
|
9
|
+
uri.port.should == 56001
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should get a URI for a target address \"255.255.255.255\"" do
|
13
|
+
uri = Notification::Address.target_address_to_uri("255.255.255.255")
|
14
|
+
uri.scheme.should == "pnb"
|
15
|
+
uri.host.should == "255.255.255.255"
|
16
|
+
uri.port.should == Global.default_notification_target_port
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should get a URI for a target address \":56001\"" do
|
20
|
+
uri = Notification::Address.target_address_to_uri(":56001")
|
21
|
+
uri.scheme.should == "pnb"
|
22
|
+
uri.host.should == Global.default_notification_target_host
|
23
|
+
uri.port.should == 56001
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should get a URI for a target address \"pnb://255.255.255.255:56001\"" do
|
27
|
+
uri = Notification::Address.target_address_to_uri("255.255.255.255:56001")
|
28
|
+
uri.scheme.should == "pnb"
|
29
|
+
uri.host.should == "255.255.255.255"
|
30
|
+
uri.port.should == 56001
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should get a URI for a target address \"pnb://255.255.255.255\"" do
|
34
|
+
uri = Notification::Address.target_address_to_uri("pnb://255.255.255.255")
|
35
|
+
uri.scheme.should == "pnb"
|
36
|
+
uri.host.should == "255.255.255.255"
|
37
|
+
uri.port.should == Global.default_notification_target_port
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should get a URI for a target address \"pnb://.:56001\"" do
|
41
|
+
uri = Notification::Address.target_address_to_uri("pnb://.:56001")
|
42
|
+
uri.scheme.should == "pnb"
|
43
|
+
uri.host.should == Global.default_notification_target_host
|
44
|
+
uri.port.should == 56001
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should get a URI for a target address \"pnu://192.168.100.10:56001\"" do
|
48
|
+
uri = Notification::Address.target_address_to_uri("pnu://192.168.100.10:56001")
|
49
|
+
uri.scheme.should == "pnu"
|
50
|
+
uri.host.should == "192.168.100.10"
|
51
|
+
uri.port.should == 56001
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should get a URI for a target address \"pnu://192.168.100.10\"" do
|
55
|
+
uri = Notification::Address.target_address_to_uri("pnu://192.168.100.10")
|
56
|
+
uri.scheme.should == "pnu"
|
57
|
+
uri.host.should == "192.168.100.10"
|
58
|
+
uri.port.should == Global.default_notification_target_port
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should get a URI for a target address \"pnu://.:56001\"" do
|
62
|
+
uri = Notification::Address.target_address_to_uri("pnu://.:56001")
|
63
|
+
uri.scheme.should == "pnu"
|
64
|
+
uri.host.should == Global.default_notification_target_host
|
65
|
+
uri.port.should == 56001
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should get a URI for a target address \"pnm://239.1.2.3:56001\"" do
|
69
|
+
uri = Notification::Address.target_address_to_uri("pnm://239.1.2.3:56001")
|
70
|
+
uri.scheme.should == "pnm"
|
71
|
+
uri.host.should == "239.1.2.3"
|
72
|
+
uri.port.should == 56001
|
73
|
+
uri.interface.should.nil
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should get a URI for a target address \"pnm://239.1.2.3\"" do
|
77
|
+
uri = Notification::Address.target_address_to_uri("pnm://239.1.2.3")
|
78
|
+
uri.scheme.should == "pnm"
|
79
|
+
uri.host.should == "239.1.2.3"
|
80
|
+
uri.port.should == Global.default_notification_target_port
|
81
|
+
uri.interface.should.nil
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should get a URI for a target address \"pnm://.:56001\"" do
|
85
|
+
uri = Notification::Address.target_address_to_uri("pnm://.:56001")
|
86
|
+
uri.scheme.should == "pnm"
|
87
|
+
uri.host.should == Global.default_notification_target_host
|
88
|
+
uri.port.should == 56001
|
89
|
+
uri.interface.should.nil
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should get a URI for a target address \"pnm://239.1.2.3:56001?if=192.168.100.10\"" do
|
93
|
+
uri = Notification::Address.target_address_to_uri("pnm://239.1.2.3:56001?if=192.168.100.10")
|
94
|
+
uri.scheme.should == "pnm"
|
95
|
+
uri.host.should == "239.1.2.3"
|
96
|
+
uri.port.should == 56001
|
97
|
+
uri.interface.should == "192.168.100.10"
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should get a URI for a target address \"pnm://239.1.2.3?if=192.168.100.10\"" do
|
101
|
+
uri = Notification::Address.target_address_to_uri("pnm://239.1.2.3?if=192.168.100.10")
|
102
|
+
uri.scheme.should == "pnm"
|
103
|
+
uri.host.should == "239.1.2.3"
|
104
|
+
uri.port.should == Global.default_notification_target_port
|
105
|
+
uri.interface.should == "192.168.100.10"
|
106
|
+
end
|
107
|
+
|
108
|
+
it "should get a URI for a target address \"pnm://.:56001?if=192.168.100.10\"" do
|
109
|
+
uri = Notification::Address.target_address_to_uri("pnm://.:56001?if=192.168.100.10")
|
110
|
+
uri.scheme.should == "pnm"
|
111
|
+
uri.host.should == Global.default_notification_target_host
|
112
|
+
uri.port.should == 56001
|
113
|
+
uri.interface.should == "192.168.100.10"
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "receiver address" do
|
118
|
+
it "should get a URI for a receiver address \"0.0.0.0:56001\"" do
|
119
|
+
uri = Notification::Address.receiver_address_to_uri("pnb://0.0.0.0:56001")
|
120
|
+
uri.scheme.should == "pnb"
|
121
|
+
uri.host.should == "0.0.0.0"
|
122
|
+
uri.port.should == 56001
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should get a URI for a receiver address \"0.0.0.0\"" do
|
126
|
+
uri = Notification::Address.receiver_address_to_uri("0.0.0.0")
|
127
|
+
uri.scheme.should == "pnb"
|
128
|
+
uri.host.should == "0.0.0.0"
|
129
|
+
uri.port.should == Global.default_notification_receiver_port
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should get a URI for a receiver address \":56001\"" do
|
133
|
+
uri = Notification::Address.receiver_address_to_uri(":56001")
|
134
|
+
uri.scheme.should == "pnb"
|
135
|
+
uri.host.should == Global.default_notification_receiver_host
|
136
|
+
uri.port.should == 56001
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should get a URI for a receiver address \"pnb://0.0.0.0:56001\"" do
|
140
|
+
uri = Notification::Address.receiver_address_to_uri("0.0.0.0:56001")
|
141
|
+
uri.scheme.should == "pnb"
|
142
|
+
uri.host.should == "0.0.0.0"
|
143
|
+
uri.port.should == 56001
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should get a URI for a receiver address \"pnb://0.0.0.0\"" do
|
147
|
+
uri = Notification::Address.receiver_address_to_uri("pnb://0.0.0.0")
|
148
|
+
uri.scheme.should == "pnb"
|
149
|
+
uri.host.should == "0.0.0.0"
|
150
|
+
uri.port.should == Global.default_notification_receiver_port
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should get a URI for a receiver address \"pnb://.:56001\"" do
|
154
|
+
uri = Notification::Address.receiver_address_to_uri("pnb://.:56001")
|
155
|
+
uri.scheme.should == "pnb"
|
156
|
+
uri.host.should == Global.default_notification_receiver_host
|
157
|
+
uri.port.should == 56001
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should get a URI for a receiver address \"pnu://192.168.100.10:56001\"" do
|
161
|
+
uri = Notification::Address.receiver_address_to_uri("pnu://192.168.100.10:56001")
|
162
|
+
uri.scheme.should == "pnu"
|
163
|
+
uri.host.should == "192.168.100.10"
|
164
|
+
uri.port.should == 56001
|
165
|
+
end
|
166
|
+
|
167
|
+
it "should get a URI for a receiver address \"pnu://192.168.100.10\"" do
|
168
|
+
uri = Notification::Address.receiver_address_to_uri("pnu://192.168.100.10")
|
169
|
+
uri.scheme.should == "pnu"
|
170
|
+
uri.host.should == "192.168.100.10"
|
171
|
+
uri.port.should == Global.default_notification_receiver_port
|
172
|
+
end
|
173
|
+
|
174
|
+
it "should get a URI for a receiver address \"pnu://.:56001\"" do
|
175
|
+
uri = Notification::Address.receiver_address_to_uri("pnu://.:56001")
|
176
|
+
uri.scheme.should == "pnu"
|
177
|
+
uri.host.should == Global.default_notification_receiver_host
|
178
|
+
uri.port.should == 56001
|
179
|
+
end
|
180
|
+
|
181
|
+
it "should get a URI for a receiver address \"pnm://239.1.2.3:56001\"" do
|
182
|
+
uri = Notification::Address.receiver_address_to_uri("pnm://239.1.2.3:56001")
|
183
|
+
uri.scheme.should == "pnm"
|
184
|
+
uri.host.should == "239.1.2.3"
|
185
|
+
uri.port.should == 56001
|
186
|
+
uri.interface.should.nil
|
187
|
+
end
|
188
|
+
|
189
|
+
it "should get a URI for a receiver address \"pnm://239.1.2.3\"" do
|
190
|
+
uri = Notification::Address.receiver_address_to_uri("pnm://239.1.2.3")
|
191
|
+
uri.scheme.should == "pnm"
|
192
|
+
uri.host.should == "239.1.2.3"
|
193
|
+
uri.port.should == Global.default_notification_receiver_port
|
194
|
+
uri.interface.should.nil
|
195
|
+
end
|
196
|
+
|
197
|
+
it "should get a URI for a receiver address \"pnm://.:56001\"" do
|
198
|
+
uri = Notification::Address.receiver_address_to_uri("pnm://.:56001")
|
199
|
+
uri.scheme.should == "pnm"
|
200
|
+
uri.host.should == Global.default_notification_receiver_host
|
201
|
+
uri.port.should == 56001
|
202
|
+
uri.interface.should.nil
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should get a URI for a receiver address \"pnm://239.1.2.3:56001?if=192.168.100.10\"" do
|
206
|
+
uri = Notification::Address.receiver_address_to_uri("pnm://239.1.2.3:56001?if=192.168.100.10")
|
207
|
+
uri.scheme.should == "pnm"
|
208
|
+
uri.host.should == "239.1.2.3"
|
209
|
+
uri.port.should == 56001
|
210
|
+
uri.interface.should == "192.168.100.10"
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should get a URI for a receiver address \"pnm://239.1.2.3?if=192.168.100.10\"" do
|
214
|
+
uri = Notification::Address.receiver_address_to_uri("pnm://239.1.2.3?if=192.168.100.10")
|
215
|
+
uri.scheme.should == "pnm"
|
216
|
+
uri.host.should == "239.1.2.3"
|
217
|
+
uri.port.should == Global.default_notification_receiver_port
|
218
|
+
uri.interface.should == "192.168.100.10"
|
219
|
+
end
|
220
|
+
|
221
|
+
it "should get a URI for a receiver address \"pnm://.:56001?if=192.168.100.10\"" do
|
222
|
+
uri = Notification::Address.receiver_address_to_uri("pnm://.:56001?if=192.168.100.10")
|
223
|
+
uri.scheme.should == "pnm"
|
224
|
+
uri.host.should == Global.default_notification_receiver_host
|
225
|
+
uri.port.should == 56001
|
226
|
+
uri.interface.should == "192.168.100.10"
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
describe Pione::Notification::Message do
|
4
|
+
it "should dump and load" do
|
5
|
+
# create a notification message
|
6
|
+
message = Notification::Message.new(
|
7
|
+
"SPEC_NOTIFICATION", "TEST", {"attr1" => "val1", "attr2" => "val2"}
|
8
|
+
)
|
9
|
+
|
10
|
+
# check the message
|
11
|
+
message.notifier.should == "SPEC_NOTIFICATION"
|
12
|
+
message.type.should == "TEST"
|
13
|
+
message["attr1"].should == "val1"
|
14
|
+
message["attr2"].should == "val2"
|
15
|
+
message.version.should == Notification::Message::PROTOCOL_VERSION
|
16
|
+
|
17
|
+
# dump
|
18
|
+
data = message.dump
|
19
|
+
data.should.kind_of String
|
20
|
+
|
21
|
+
# load and test
|
22
|
+
_message = Notification::Message.load(data)
|
23
|
+
_message.should.kind_of Notification::Message
|
24
|
+
_message.notifier.should == "SPEC_NOTIFICATION"
|
25
|
+
_message.type.should == "TEST"
|
26
|
+
_message["attr1"].should == "val1"
|
27
|
+
_message["attr2"].should == "val2"
|
28
|
+
_message.version.should == Notification::Message::PROTOCOL_VERSION
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'pione/test-helper'
|
2
|
+
|
3
|
+
TestHelper.scope do |this|
|
4
|
+
def this.receive(target_address, receiver_address, context)
|
5
|
+
message = Notification::Message.new("SPEC_NOTIFICATION_SENDER", "SPEC_TEST", {})
|
6
|
+
|
7
|
+
Thread.new do
|
8
|
+
loop do
|
9
|
+
Notification::Transmitter.transmit(message, [URI.parse(target_address)])
|
10
|
+
sleep 1
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
receiver = Notification::Receiver.new(URI.parse(receiver_address))
|
15
|
+
context.should.not.raise do
|
16
|
+
Timeout.timeout(5) do
|
17
|
+
receiver.receive
|
18
|
+
receiver.close
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe Pione::Notification::Receiver do
|
24
|
+
it "should receive a notification from broadcast" do
|
25
|
+
this.receive("pnb://127.0.0.255:56000", "pnb://0.0.0.0:56000", self)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should receive a notification from multicast" do
|
29
|
+
this.receive("pnm://234.1.2.3:56000", "pnm://234.1.2.3:56000", self)
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should receive a notification from unicast" do
|
33
|
+
this.receive("pnu://127.0.0.1:56000", "pnu://0.0.0.0:56000", self)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|