unageanu-jiji 1.1.4 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +24 -1
- data/README +0 -0
- data/base/shared_lib/moving_average.rb +34 -33
- data/base/shared_lib/system/cross.rb +76 -0
- data/base/shared_lib/system/position_manager.rb +160 -0
- data/base/shared_lib/system/signal.rb +347 -0
- data/html/css/datatable.css +4 -4
- data/html/css/default.css +57 -5
- data/html/css/treeview.css +205 -0
- data/html/img/bin_closed.png +0 -0
- data/html/img/bin_empty.png +0 -0
- data/html/img/button_add_small.gif +0 -0
- data/html/img/button_add_small_gray.gif +0 -0
- data/html/img/button_add_small_over.gif +0 -0
- data/html/img/button_mkcol.gif +0 -0
- data/html/img/button_mkcol_gray.gif +0 -0
- data/html/img/button_mkcol_over.gif +0 -0
- data/html/img/button_remove_small.gif +0 -0
- data/html/img/button_remove_small_gray.gif +0 -0
- data/html/img/button_remove_small_over.gif +0 -0
- data/html/img/button_rename.gif +0 -0
- data/html/img/button_rename_gray.gif +0 -0
- data/html/img/button_rename_over.gif +0 -0
- data/html/img/control_play.png +0 -0
- data/html/img/control_play_blue.png +0 -0
- data/html/img/folder.png +0 -0
- data/html/img/folder_brick.png +0 -0
- data/html/img/folder_user.png +0 -0
- data/html/{js/codepress/images → img}/line-numbers.png +0 -0
- data/html/img/page_white_ruby.png +0 -0
- data/html/img/sidebar_agent_edit.png +0 -0
- data/html/img/sidebar_agent_edit_over.png +0 -0
- data/html/img/sidebar_agent_edit_s.png +0 -0
- data/html/img/yui/treeview-sprite.gif +0 -0
- data/html/index.html +34 -18
- data/html/js/agent-editor/agent-editor-page.js +324 -0
- data/html/js/agent-editor/agent-editor.js +363 -0
- data/html/js/agent-editor/agent-list-tree.js +251 -0
- data/html/js/agent-selector.js +23 -28
- data/html/js/app.js +63 -91
- data/html/js/bt-create-page.js +25 -19
- data/html/js/container-min.js +1 -1
- data/html/js/container.js +944 -0
- data/html/js/edit_area/autocompletion.js +11 -13
- data/html/js/edit_area/edit_area.css +79 -40
- data/html/js/edit_area/edit_area.js +255 -226
- data/html/js/edit_area/edit_area_compressor.php +4 -4
- data/html/js/edit_area/edit_area_full.gz +0 -0
- data/html/js/edit_area/edit_area_full.js +31 -31
- data/html/js/edit_area/edit_area_full_with_plugins.gz +0 -0
- data/html/js/edit_area/edit_area_full_with_plugins.js +31 -31
- data/html/js/edit_area/edit_area_functions.js +448 -341
- data/html/js/edit_area/edit_area_loader.js +409 -397
- data/html/js/edit_area/elements_functions.js +120 -123
- data/html/js/edit_area/highlight.js +305 -197
- data/html/js/edit_area/images/goto.png +0 -0
- data/html/js/edit_area/images/help.png +0 -0
- data/html/js/edit_area/images/redo.png +0 -0
- data/html/js/edit_area/images/save.png +0 -0
- data/html/js/edit_area/images/search.png +0 -0
- data/html/js/edit_area/images/undo.png +0 -0
- data/html/js/edit_area/images/word_wrap.gif +0 -0
- data/html/js/edit_area/keyboard.js +5 -5
- data/html/js/edit_area/langs/bg.js +73 -0
- data/html/js/edit_area/langs/cs.js +2 -0
- data/html/js/edit_area/langs/de.js +2 -0
- data/html/js/edit_area/langs/dk.js +2 -0
- data/html/js/edit_area/langs/en.js +2 -0
- data/html/js/edit_area/langs/eo.js +2 -0
- data/html/js/edit_area/langs/es.js +2 -0
- data/html/js/edit_area/langs/fi.js +67 -0
- data/html/js/edit_area/langs/fr.js +2 -0
- data/html/js/edit_area/langs/hr.js +2 -0
- data/html/js/edit_area/langs/it.js +2 -0
- data/html/js/edit_area/langs/ja.js +2 -0
- data/html/js/edit_area/langs/mk.js +2 -0
- data/html/js/edit_area/langs/nl.js +2 -0
- data/html/js/edit_area/langs/pl.js +2 -0
- data/html/js/edit_area/langs/pt.js +2 -0
- data/html/js/edit_area/langs/ru.js +2 -0
- data/html/js/edit_area/langs/sk.js +2 -0
- data/html/js/edit_area/langs/zh.js +67 -0
- data/html/js/edit_area/manage_area.js +362 -205
- data/html/js/edit_area/plugins/charmap/langs/bg.js +12 -0
- data/html/js/edit_area/plugins/charmap/langs/zh.js +6 -0
- data/html/js/edit_area/plugins/test/langs/bg.js +10 -0
- data/html/js/edit_area/plugins/test/langs/zh.js +4 -0
- data/html/js/edit_area/reg_syntax/java.js +56 -0
- data/html/js/edit_area/reg_syntax/ruby.js +9 -9
- data/html/js/edit_area/reg_syntax.js +15 -13
- data/html/js/edit_area/regexp.js +36 -32
- data/html/js/edit_area/resize_area.js +43 -47
- data/html/js/edit_area/search_replace.js +29 -29
- data/html/js/edit_area/template.html +6 -4
- data/html/js/json-broker-client.js +23 -17
- data/html/js/result-page.js +107 -57
- data/html/js/rt-setting-page.js +38 -15
- data/html/js/sidebar.js +41 -27
- data/html/js/templates.js +167 -32
- data/html/js/utils.js +143 -7
- data/html/js/yui/treeview.js +3671 -0
- data/html/swf/chart.swf +0 -0
- data/html/test/agent_editor_spec.js +815 -0
- data/html/test/index.html +40 -0
- data/html/test/jsspec/JSSpec.css +224 -0
- data/html/test/jsspec/JSSpec.js +1549 -0
- data/html/test/jsspec/diff_match_patch.js +1 -0
- data/html/test/utils_spec.js +111 -0
- data/lib/jiji/agent/agent.rb +69 -12
- data/lib/jiji/agent/agent_manager.rb +18 -12
- data/lib/jiji/agent/agent_registry.rb +35 -121
- data/lib/jiji/collector.rb +16 -6
- data/lib/jiji/command.rb +46 -5
- data/lib/jiji/dao/file_system_dao.rb +158 -0
- data/lib/jiji/dao/timed_data_dao.rb +2 -0
- data/lib/jiji/dao/trade_result_dao.rb +1 -1
- data/lib/jiji/error.rb +24 -8
- data/lib/jiji/migration/migrator1_2_0.rb +67 -0
- data/lib/jiji/models.rb +82 -24
- data/lib/jiji/operator.rb +55 -51
- data/lib/jiji/output.rb +85 -29
- data/lib/jiji/output_manager.rb +84 -0
- data/lib/jiji/plugin/embedded/single_click_client.rb +2 -2
- data/lib/jiji/plugin/securities_plugin.rb +0 -1
- data/lib/jiji/process.rb +229 -208
- data/lib/jiji/process_manager.rb +190 -96
- data/lib/jiji/registry.rb +87 -19
- data/lib/jiji/server.rb +1 -0
- data/lib/jiji/service/agent_service.rb +147 -48
- data/lib/jiji/service/output_service.rb +37 -17
- data/lib/jiji/service/process_service.rb +3 -5
- data/lib/jiji/service/trade_result_service.rb +4 -5
- data/lib/jiji/util/file_lock.rb +4 -4
- data/lib/jiji/util/include_proxy.rb +17 -0
- data/lib/jiji/util/json_broker.rb +6 -4
- data/lib/jiji/util/util.rb +1 -1
- data/swf/chart/fx/chart/Chart.as +7 -0
- data/swf/chart/fx/chart/ui/graph/GraphManager.as +15 -2
- data/test/ProcessTest/agents/foo.rb +10 -0
- data/test/ProcessTest/conf/configuration.yaml +3 -0
- data/test/agent/agent_tests.rb +10 -0
- data/test/agent/test_AgentManager.rb +28 -12
- data/test/agent/test_AgentRegistry.rb +194 -99
- data/test/agent/test_PeriodicallyAgent.rb +1 -2
- data/test/agent/test_Permitter.rb +1 -2
- data/test/all_tests.rb +7 -19
- data/test/dao/dao_tests.rb +9 -0
- data/test/dao/test_FileSystemDao.rb +431 -0
- data/test/dao/test_RateDao.rb +5 -7
- data/test/dao/test_TradeResultDao.rb +1 -2
- data/test/migration/migration_tests.rb +10 -0
- data/test/migration/migrator1_2_0test_data/basic/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/basic/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/basic/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/migrator1_2_0test_data/illegal_props/props.yaml +1 -0
- data/test/migration/migrator1_2_0test_data/no_outs/props.yaml +85 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/M2NlOTA2ODEtZDdlNi00NWU1LWIwNDQtMjBmODY2ZGNkNzBj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MDVhYzcxMjYtMGFlMS00Mzk0LWEyNmUtYjVjZjgwNDA0ZmE2/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/MzA1YTk0NDgtNzhjNi00NDk3LTk2NTktYzE1ZjBhNzdiYjNj/56e75YuV5bmz5Z2H57ea/meta.yaml +8 -0
- data/test/migration/migrator1_2_0test_data/no_props/out/YjRkOTI1MzEtZTM4MS00YjQwLTg1ZTQtMWFmZDRlNDUwMzBm/56e75YuV5bmz5Z2H57ea/meta.yaml +9 -0
- data/test/migration/test_Migrator.rb +1 -1
- data/test/migration/test_Migrator1_0_3.rb +1 -1
- data/test/migration/test_Migrator1_1_0.rb +1 -1
- data/test/migration/test_Migrator1_2_0.rb +94 -0
- data/test/plugin/embedded/test_SingleClickClient.rb +1 -2
- data/test/plugin/plugin_tests.rb +8 -0
- data/test/plugin/test_Loader.rb +1 -1
- data/test/shared/rate.csv +144 -0
- data/test/shared/shared_tests.rb +9 -0
- data/test/shared/test_Cross.rb +144 -0
- data/test/shared/test_PositionManager.rb +285 -0
- data/test/shared/test_Signal.rb +65 -0
- data/test/test_Output.rb +28 -21
- data/test/test_OutputManager.rb +162 -0
- data/test/test_Output_registry.rb +6 -17
- data/test/test_Process.rb +434 -222
- data/test/test_ProcessManager.rb +458 -101
- data/test/test_utils.rb +71 -8
- data/test/util/test_BlockToSession.rb +1 -2
- data/test/util/test_CSV.rb +1 -2
- data/test/util/test_SynchronizeInterceptor.rb +1 -2
- data/test/util/util_tests.rb +9 -0
- metadata +127 -47
- data/html/js/agent-editor-page.js +0 -440
- data/html/js/codepress/codepress.css +0 -21
- data/html/js/codepress/codepress.html +0 -35
- data/html/js/codepress/codepress.js +0 -138
- data/html/js/codepress/engines/gecko.js +0 -293
- data/html/js/codepress/engines/khtml.js +0 -0
- data/html/js/codepress/engines/msie.js +0 -304
- data/html/js/codepress/engines/older.js +0 -0
- data/html/js/codepress/engines/opera.js +0 -260
- data/html/js/codepress/images/line-numbers.gif +0 -0
- data/html/js/codepress/index.html +0 -443
- data/html/js/codepress/languages/asp.css +0 -71
- data/html/js/codepress/languages/asp.js +0 -117
- data/html/js/codepress/languages/autoit.css +0 -13
- data/html/js/codepress/languages/autoit.js +0 -32
- data/html/js/codepress/languages/csharp.css +0 -9
- data/html/js/codepress/languages/csharp.js +0 -25
- data/html/js/codepress/languages/css.css +0 -10
- data/html/js/codepress/languages/css.js +0 -23
- data/html/js/codepress/languages/generic.css +0 -9
- data/html/js/codepress/languages/generic.js +0 -25
- data/html/js/codepress/languages/html.css +0 -13
- data/html/js/codepress/languages/html.js +0 -59
- data/html/js/codepress/languages/java.css +0 -7
- data/html/js/codepress/languages/java.js +0 -24
- data/html/js/codepress/languages/javascript.css +0 -8
- data/html/js/codepress/languages/javascript.js +0 -30
- data/html/js/codepress/languages/perl.css +0 -11
- data/html/js/codepress/languages/perl.js +0 -27
- data/html/js/codepress/languages/php.css +0 -12
- data/html/js/codepress/languages/php.js +0 -61
- data/html/js/codepress/languages/ruby.css +0 -10
- data/html/js/codepress/languages/ruby.js +0 -26
- data/html/js/codepress/languages/sql.css +0 -10
- data/html/js/codepress/languages/sql.js +0 -30
- data/html/js/codepress/languages/text.css +0 -5
- data/html/js/codepress/languages/text.js +0 -9
- data/html/js/codepress/languages/vbscript.css +0 -71
- data/html/js/codepress/languages/vbscript.js +0 -117
- data/html/js/codepress/languages/xsl.css +0 -15
- data/html/js/codepress/languages/xsl.js +0 -103
- data/html/js/codepress/license.txt +0 -458
- data/html/js/edit_area/images/Thumbs.db +0 -0
- data/test/plugin/test_gem/a/lib/jiji_plugin_test.rb +0 -6
@@ -1,18 +1,18 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
2
|
|
3
|
-
$: << "
|
4
|
-
$: << "../"
|
3
|
+
$: << "../lib"
|
5
4
|
|
6
5
|
require 'rubygems'
|
7
|
-
require
|
8
|
-
require
|
6
|
+
require 'runit/testcase'
|
7
|
+
require 'runit/cui/testrunner'
|
9
8
|
require 'jiji/agent/agent'
|
10
9
|
require 'jiji/agent/agent_manager'
|
11
10
|
require 'jiji/agent/agent_registry'
|
12
11
|
require 'jiji/agent/permitter'
|
13
12
|
require 'jiji/agent/util'
|
14
|
-
require
|
15
|
-
require
|
13
|
+
require 'jiji/configuration'
|
14
|
+
require 'jiji/dao/file_system_dao'
|
15
|
+
require 'fileutils'
|
16
16
|
|
17
17
|
# AgentRegistory のテスト
|
18
18
|
class AgentRegistryTest < RUNIT::TestCase
|
@@ -21,12 +21,19 @@ class AgentRegistryTest < RUNIT::TestCase
|
|
21
21
|
@dir = File.dirname(__FILE__) + "/agents"
|
22
22
|
FileUtils.mkdir_p @dir
|
23
23
|
|
24
|
-
@
|
24
|
+
@dao = JIJI::Dao::FileSystemDao.new( @dir )
|
25
|
+
@dao.mkcol "agents"
|
26
|
+
@dao.mkcol "shared"
|
27
|
+
|
28
|
+
@registry = JIJI::AgentRegistry.new( "agents", "shared" )
|
25
29
|
@registry.conf = JIJI::Configuration.new
|
30
|
+
@registry.file_dao = @dao
|
31
|
+
@registry.server_logger = Logger.new STDOUT
|
26
32
|
end
|
27
33
|
|
28
34
|
def teardown
|
29
35
|
FileUtils.rm_rf @dir
|
36
|
+
sleep 1
|
30
37
|
end
|
31
38
|
|
32
39
|
# 基本動作のテスト
|
@@ -34,8 +41,6 @@ class AgentRegistryTest < RUNIT::TestCase
|
|
34
41
|
|
35
42
|
# 最初は空
|
36
43
|
assert_equals @registry.collect, []
|
37
|
-
assert_equals @registry.files, []
|
38
|
-
assert_equals @registry.files(:shared_lib), []
|
39
44
|
|
40
45
|
# 追加
|
41
46
|
foo_body = "class Foo; include JIJI::Agent; end"
|
@@ -47,13 +52,15 @@ class AgentRegistryTest < RUNIT::TestCase
|
|
47
52
|
end
|
48
53
|
end
|
49
54
|
BODY
|
50
|
-
|
51
|
-
assert_equals @
|
52
|
-
assert_equals @
|
55
|
+
|
56
|
+
assert_equals @dao.put( "agents/foo.rb", foo_body ), :success
|
57
|
+
assert_equals @dao.put( "agents/var.rb", var_body ), :success
|
58
|
+
@registry.load( "agents/foo.rb" )
|
59
|
+
@registry.load( "agents/var.rb" )
|
53
60
|
|
54
61
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb", "Var@var.rb"]
|
55
|
-
assert_agent_files @
|
56
|
-
assert_agent_files @
|
62
|
+
assert_agent_files @dao.list("agents"), ["foo.rb","var.rb"]
|
63
|
+
assert_agent_files @dao.list("shared"), []
|
57
64
|
|
58
65
|
|
59
66
|
# 取得
|
@@ -82,12 +89,13 @@ BODY
|
|
82
89
|
"method called."
|
83
90
|
end
|
84
91
|
BODY
|
85
|
-
assert_equals @
|
92
|
+
assert_equals @dao.put( "shared/shared_lib.rb", shared_lib_body ), :success
|
93
|
+
@registry.load( "shared/shared_lib.rb" )
|
86
94
|
|
87
95
|
# 一覧
|
88
96
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb", "Var@var.rb"]
|
89
|
-
assert_agent_files @
|
90
|
-
assert_agent_files @
|
97
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb","var.rb"]
|
98
|
+
assert_agent_files @dao.list( "shared" ), ["shared_lib.rb"]
|
91
99
|
|
92
100
|
# 共有ライブラリを呼び出すAPIが利用可能になる。
|
93
101
|
assert_equals( safe(4) { obj.test[0] }, "val")
|
@@ -114,28 +122,28 @@ BODY
|
|
114
122
|
end
|
115
123
|
|
116
124
|
#ファイル取得
|
117
|
-
assert_equals @
|
118
|
-
assert_equals @
|
119
|
-
assert_equals @
|
125
|
+
assert_equals @dao.get( "agents/foo.rb" ), foo_body
|
126
|
+
assert_equals @dao.get( "agents/var.rb" ), var_body
|
127
|
+
assert_equals @dao.get( "shared/shared_lib.rb" ), shared_lib_body
|
120
128
|
begin
|
121
|
-
@
|
129
|
+
@dao.get( "agents/Not_Found" )
|
122
130
|
fail
|
123
131
|
rescue JIJI::UserError
|
124
132
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
125
133
|
end
|
126
134
|
begin
|
127
|
-
@
|
135
|
+
@dao.get( "shared/Not_Found" )
|
128
136
|
fail
|
129
137
|
rescue JIJI::UserError
|
130
138
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
131
139
|
end
|
132
140
|
begin
|
133
|
-
@
|
141
|
+
@dao.get( "shared/foo.rb" )
|
134
142
|
fail
|
135
143
|
rescue JIJI::UserError
|
136
144
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
137
145
|
end
|
138
|
-
|
146
|
+
|
139
147
|
# 上書き更新
|
140
148
|
var_body = <<-BODY
|
141
149
|
class Var2
|
@@ -145,13 +153,15 @@ BODY
|
|
145
153
|
end
|
146
154
|
end
|
147
155
|
BODY
|
148
|
-
assert_equals @
|
156
|
+
assert_equals @dao.put( "agents/var.rb", var_body ), :success
|
157
|
+
@registry.load( "agents/var.rb" )
|
158
|
+
|
149
159
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb", "Var2@var.rb"]
|
150
|
-
assert_agent_files @
|
160
|
+
assert_agent_files @dao.list("agents"), ["foo.rb","var.rb"]
|
151
161
|
|
152
|
-
assert_equals @
|
153
|
-
assert_equals @
|
154
|
-
assert_equals @
|
162
|
+
assert_equals @dao.get( "agents/foo.rb" ), foo_body
|
163
|
+
assert_equals @dao.get( "agents/var.rb" ), var_body
|
164
|
+
assert_equals @dao.get( "shared/shared_lib.rb" ), shared_lib_body
|
155
165
|
|
156
166
|
cl = @registry.get "Var2@var.rb"
|
157
167
|
assert_not_nil cl
|
@@ -160,7 +170,7 @@ BODY
|
|
160
170
|
assert_equals( safe(4) { obj.test[0] }, "val")
|
161
171
|
assert_equals( safe(4) { obj.test[1].foo}, "fooo" )
|
162
172
|
assert_equals( safe(4) { obj.test[2] }, "xx")
|
163
|
-
|
173
|
+
|
164
174
|
# 古いクラスは利用不可
|
165
175
|
begin
|
166
176
|
@registry.get("Var@var.rb")
|
@@ -170,52 +180,61 @@ BODY
|
|
170
180
|
end
|
171
181
|
|
172
182
|
# レジストリを再作成
|
173
|
-
@registry = JIJI::AgentRegistry.new( "
|
183
|
+
@registry = JIJI::AgentRegistry.new( "agents", "shared" )
|
174
184
|
@registry.conf = JIJI::Configuration.new
|
185
|
+
@registry.file_dao = @dao
|
186
|
+
@registry.server_logger = Logger.new STDOUT
|
187
|
+
|
175
188
|
assert_equals @registry.collect, []
|
176
|
-
assert_agent_files @
|
177
|
-
assert_agent_files @
|
178
|
-
|
189
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb","var.rb"]
|
190
|
+
assert_agent_files @dao.list( "shared" ), ["shared_lib.rb"]
|
191
|
+
|
179
192
|
# 再読み込み
|
180
193
|
@registry.load_all
|
181
194
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb", "Var2@var.rb"]
|
182
|
-
assert_agent_files @
|
183
|
-
assert_agent_files @
|
184
|
-
|
195
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb","var.rb"]
|
196
|
+
assert_agent_files @dao.list( "shared" ), ["shared_lib.rb"]
|
197
|
+
|
185
198
|
# 共有ライブラリを削除
|
186
|
-
|
187
|
-
@
|
199
|
+
#ライブラリ内のクラスは利用不可
|
200
|
+
@dao.delete( "shared/shared_lib.rb" )
|
201
|
+
@registry.unload( "shared/shared_lib.rb" )
|
188
202
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb", "Var2@var.rb"]
|
189
|
-
assert_agent_files @
|
190
|
-
assert_agent_files @
|
191
|
-
|
203
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb","var.rb"]
|
204
|
+
assert_agent_files @dao.list( "shared" ), []
|
205
|
+
|
192
206
|
cl = @registry.get "Var2@var.rb"
|
193
207
|
assert_not_nil cl
|
194
208
|
obj = @registry.create("Var2@var.rb",{})
|
195
|
-
assert_equals( safe(4) { obj.test[0] }, "val")
|
196
|
-
assert_equals( safe(4) { obj.test[1].foo}, "fooo" )
|
197
|
-
assert_equals( safe(4) { obj.test[2] }, "xx")
|
198
|
-
|
199
209
|
begin
|
200
|
-
|
210
|
+
safe(4) { obj.test[0] }
|
211
|
+
rescue NameError
|
212
|
+
end
|
213
|
+
#assert_equals( safe(4) { obj.test[0] }, "val")
|
214
|
+
#assert_equals( safe(4) { obj.test[1].foo}, "fooo" )
|
215
|
+
#assert_equals( safe(4) { obj.test[2] }, "xx")
|
216
|
+
|
217
|
+
begin
|
218
|
+
@dao.delete( "shared/NotFound" )
|
201
219
|
rescue JIJI::UserError
|
202
220
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
203
221
|
end
|
204
|
-
|
222
|
+
|
205
223
|
# 削除
|
206
|
-
@
|
224
|
+
@dao.delete( "agents/var.rb" )
|
225
|
+
@registry.unload( "agents/var.rb" )
|
207
226
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb"]
|
208
|
-
assert_agent_files @
|
209
|
-
assert_agent_files @
|
210
|
-
|
227
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb"]
|
228
|
+
assert_agent_files @dao.list( "shared" ), []
|
229
|
+
|
211
230
|
begin
|
212
|
-
@
|
231
|
+
@dao.delete( "NotFound" )
|
213
232
|
rescue JIJI::UserError
|
214
233
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
215
234
|
end
|
216
|
-
|
235
|
+
|
217
236
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb"]
|
218
|
-
assert_agent_files @
|
237
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb"]
|
219
238
|
|
220
239
|
# 削除したクラスは利用不可
|
221
240
|
cl = @registry.get "Foo@foo.rb"
|
@@ -228,16 +247,19 @@ BODY
|
|
228
247
|
end
|
229
248
|
|
230
249
|
# レジストリを再作成
|
231
|
-
@registry = JIJI::AgentRegistry.new( "
|
250
|
+
@registry = JIJI::AgentRegistry.new( "agents", "shared" )
|
232
251
|
@registry.conf = JIJI::Configuration.new
|
252
|
+
@registry.file_dao = @dao
|
253
|
+
@registry.server_logger = Logger.new STDOUT
|
254
|
+
|
233
255
|
@registry.load_all
|
234
256
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb"]
|
235
|
-
assert_agent_files @
|
236
|
-
assert_agent_files @
|
237
|
-
|
257
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb"]
|
258
|
+
assert_agent_files @dao.list( "shared" ), []
|
259
|
+
|
238
260
|
cl = @registry.get "Foo@foo.rb"
|
239
261
|
assert_not_nil cl
|
240
|
-
|
262
|
+
|
241
263
|
# 再登録
|
242
264
|
str = <<-CLASS_DEF
|
243
265
|
class Var; include JIJI::Agent; end
|
@@ -259,9 +281,10 @@ BODY
|
|
259
281
|
end
|
260
282
|
end
|
261
283
|
CLASS_DEF
|
262
|
-
@
|
284
|
+
@dao.put( "agents/var.rb", str )
|
285
|
+
@registry.load( "agents/var.rb" )
|
263
286
|
assert_equals @registry.collect.sort!, ["Foo@foo.rb", "S@var.rb", "Var3@var.rb", "Var@var.rb", "Xx::Var2_1@var.rb", "Xx::Var2_2@var.rb","Xx::Yy::Var2_3@var.rb"]
|
264
|
-
assert_agent_files @
|
287
|
+
assert_agent_files @dao.list( "agents" ), ["foo.rb","var.rb"]
|
265
288
|
|
266
289
|
# 取得
|
267
290
|
begin
|
@@ -294,7 +317,7 @@ CLASS_DEF
|
|
294
317
|
rescue JIJI::UserError
|
295
318
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
296
319
|
end
|
297
|
-
|
320
|
+
|
298
321
|
end
|
299
322
|
|
300
323
|
# エージェントファイル一覧を確認する。
|
@@ -302,8 +325,8 @@ CLASS_DEF
|
|
302
325
|
assert_equals files.length, expects.length
|
303
326
|
files.each_index { |i|
|
304
327
|
# 名前が取得できることを確認。最終更新日時は設定されていることのみ確認
|
305
|
-
assert_equals expects[i], files[i][
|
306
|
-
assert_not_nil files[i][
|
328
|
+
assert_equals expects[i], files[i][:name]
|
329
|
+
assert_not_nil files[i][:update]
|
307
330
|
}
|
308
331
|
end
|
309
332
|
|
@@ -333,7 +356,8 @@ CLASS_DEF
|
|
333
356
|
end
|
334
357
|
AGENT_STR
|
335
358
|
|
336
|
-
@
|
359
|
+
@dao.put( "agents/foo.rb", str )
|
360
|
+
@registry.load( "agents/foo.rb" )
|
337
361
|
|
338
362
|
ps = @registry.get_property_infos "Foo@foo.rb"
|
339
363
|
assert_equals ps, [
|
@@ -371,7 +395,8 @@ CLASS_DEF
|
|
371
395
|
end
|
372
396
|
end
|
373
397
|
CLASS_DEF
|
374
|
-
@
|
398
|
+
@dao.put( "agents/var.rb", str )
|
399
|
+
@registry.load( "agents/var.rb" )
|
375
400
|
|
376
401
|
agent = @registry.create "Test::Foo@var.rb"
|
377
402
|
assert_equals "test", safe(4){
|
@@ -389,13 +414,14 @@ CLASS_DEF
|
|
389
414
|
end
|
390
415
|
end
|
391
416
|
CLASS_DEF
|
392
|
-
@
|
417
|
+
@dao.put( "agents/var.rb", str )
|
418
|
+
@registry.load( "agents/var.rb" )
|
393
419
|
|
394
420
|
agent2 = @registry.create "Test::Foo@var.rb"
|
395
421
|
assert_equals ["test","test2"], safe(4){
|
396
422
|
[agent.test, agent2.test] # 古いクラスも再作成されるまでは有効
|
397
423
|
}
|
398
|
-
|
424
|
+
|
399
425
|
# コンパイルエラーになる場合
|
400
426
|
str = <<-CLASS_DEF
|
401
427
|
module Test
|
@@ -406,9 +432,13 @@ CLASS_DEF
|
|
406
432
|
end
|
407
433
|
end
|
408
434
|
CLASS_DEF
|
409
|
-
|
410
|
-
|
411
|
-
|
435
|
+
@dao.put( "agents/var.rb", str )
|
436
|
+
begin
|
437
|
+
@registry.load( "agents/var.rb" )
|
438
|
+
fail
|
439
|
+
rescue SyntaxError
|
440
|
+
end
|
441
|
+
|
412
442
|
begin
|
413
443
|
@registry.get("Test::Foo@var.rb")
|
414
444
|
fail
|
@@ -416,12 +446,12 @@ CLASS_DEF
|
|
416
446
|
assert_equals JIJI::ERROR_NOT_FOUND, $!.code
|
417
447
|
end
|
418
448
|
end
|
419
|
-
|
449
|
+
|
420
450
|
# 共有ライブラリの更新
|
421
451
|
def test_update_sharedlib
|
422
|
-
|
452
|
+
|
423
453
|
# 共有ライブラリを使うクラス
|
424
|
-
@
|
454
|
+
@dao.put "agents/foo.rb", <<-BODY
|
425
455
|
class Var
|
426
456
|
include JIJI::Agent
|
427
457
|
def init
|
@@ -436,21 +466,22 @@ CLASS_DEF
|
|
436
466
|
attr_reader :s
|
437
467
|
end
|
438
468
|
BODY
|
439
|
-
|
469
|
+
@registry.load( "agents/foo.rb" )
|
470
|
+
|
440
471
|
obj = @registry.create("Var@foo.rb",{})
|
441
|
-
|
472
|
+
|
442
473
|
# まだ共有ライブラリがないのでエラー
|
443
|
-
begin
|
444
|
-
safe(4) { obj.test }
|
474
|
+
begin
|
475
|
+
safe(4) { obj.test }
|
445
476
|
fail
|
446
477
|
rescue
|
447
478
|
end
|
448
|
-
begin
|
449
|
-
safe(4) { obj.init }
|
479
|
+
begin
|
480
|
+
safe(4) { obj.init }
|
450
481
|
fail
|
451
482
|
rescue
|
452
483
|
end
|
453
|
-
|
484
|
+
|
454
485
|
# 共有ライブラリを定義
|
455
486
|
shared_lib_body = <<-BODY
|
456
487
|
VALUE='val'
|
@@ -463,32 +494,33 @@ BODY
|
|
463
494
|
"method called."
|
464
495
|
end
|
465
496
|
BODY
|
466
|
-
assert_equals @
|
467
|
-
|
497
|
+
assert_equals @dao.put( "shared/shared_lib.rb", shared_lib_body ), :success
|
498
|
+
@registry.load( "shared/shared_lib.rb" )
|
499
|
+
|
468
500
|
assert_equals safe(4){obj.test[0]}, 'val'
|
469
501
|
assert_equals safe(4){obj.test[1].foo}, 'fooo'
|
470
502
|
assert_equals safe(4){obj.test[2]}, 'method called.'
|
471
|
-
|
503
|
+
|
472
504
|
safe(4){ obj.init }
|
473
505
|
assert_equals safe(4){obj.s.foo}, 'fooo'
|
474
|
-
|
506
|
+
|
475
507
|
obj2 = @registry.create("Var@foo.rb", {})
|
476
508
|
assert_equals safe(4){obj2.test[0]}, 'val'
|
477
509
|
assert_equals safe(4){obj2.test[1].foo}, 'fooo'
|
478
510
|
assert_equals safe(4){obj2.test[2]}, 'method called.'
|
479
511
|
safe(4){ obj2.init }
|
480
512
|
assert_equals safe(4){obj2.s.foo}, 'fooo'
|
481
|
-
|
513
|
+
|
482
514
|
# テスト2はまだ呼び出せない
|
483
|
-
begin
|
484
|
-
safe(4) { obj.test2 }
|
515
|
+
begin
|
516
|
+
safe(4) { obj.test2 }
|
485
517
|
fail
|
486
518
|
rescue; end
|
487
|
-
begin
|
488
|
-
safe(4) { obj2.test2 }
|
519
|
+
begin
|
520
|
+
safe(4) { obj2.test2 }
|
489
521
|
fail
|
490
522
|
rescue; end
|
491
|
-
|
523
|
+
|
492
524
|
# 共有ライブラリ2を追加
|
493
525
|
shared_lib_body = <<-BODY
|
494
526
|
VALUE2=JIJI::Agent::Shared::VALUE + ":" +JIJI::Agent::Shared.m
|
@@ -501,8 +533,9 @@ BODY
|
|
501
533
|
JIJI::Agent::Shared.m
|
502
534
|
end
|
503
535
|
BODY
|
504
|
-
assert_equals @
|
505
|
-
|
536
|
+
assert_equals @dao.put( "shared/shared_lib2.rb", shared_lib_body ), :success
|
537
|
+
@registry.load( "shared/shared_lib2.rb" )
|
538
|
+
|
506
539
|
assert_equals safe(4){obj.test[0]}, 'val'
|
507
540
|
assert_equals safe(4){obj.test[1].foo}, 'fooo'
|
508
541
|
assert_equals safe(4){obj.test[2]}, 'method called.'
|
@@ -511,7 +544,7 @@ BODY
|
|
511
544
|
assert_equals safe(4){obj2.test[2]}, 'method called.'
|
512
545
|
assert_equals safe(4){obj.s.foo}, 'fooo'
|
513
546
|
assert_equals safe(4){obj2.s.foo}, 'fooo'
|
514
|
-
|
547
|
+
|
515
548
|
assert_equals safe(4){obj.test2[0]}, 'val:method called.'
|
516
549
|
assert_equals safe(4){obj.test2[1].foo}, 'fooo'
|
517
550
|
assert_equals safe(4){obj.test2[1].foo2}, 'method called.:fooo'
|
@@ -520,7 +553,7 @@ BODY
|
|
520
553
|
assert_equals safe(4){obj2.test2[1].foo}, 'fooo'
|
521
554
|
assert_equals safe(4){obj2.test2[1].foo2}, 'method called.:fooo'
|
522
555
|
assert_equals safe(4){obj2.test2[2]}, 'method called.'
|
523
|
-
|
556
|
+
|
524
557
|
# 共有ライブラリを上書き更新
|
525
558
|
shared_lib_body = <<-BODY
|
526
559
|
VALUE='val2'
|
@@ -533,8 +566,9 @@ BODY
|
|
533
566
|
"method called2."
|
534
567
|
end
|
535
568
|
BODY
|
536
|
-
assert_equals @
|
537
|
-
|
569
|
+
assert_equals @dao.put( "shared/shared_lib.rb", shared_lib_body ), :success
|
570
|
+
@registry.load( "shared/shared_lib.rb" )
|
571
|
+
|
538
572
|
assert_equals safe(4){obj.test[0]}, 'val2'
|
539
573
|
assert_equals safe(4){obj.test[1].foo}, 'fooo2'
|
540
574
|
assert_equals safe(4){obj.test[2]}, 'method called2.'
|
@@ -551,7 +585,7 @@ BODY
|
|
551
585
|
}
|
552
586
|
assert_equals safe(4){obj.s.foo}, 'fooo2'
|
553
587
|
assert_equals safe(4){obj2.s.foo}, 'fooo2'
|
554
|
-
|
588
|
+
|
555
589
|
# 依存モジュール内からの呼び出し結果も変わる
|
556
590
|
assert_equals safe(4){obj.test2[0]}, 'val:method called.' # 定数は定義の段階で評価されているので変わらない
|
557
591
|
assert_equals safe(4){obj.test2[1].foo}, 'fooo'
|
@@ -563,5 +597,66 @@ BODY
|
|
563
597
|
assert_equals safe(4){obj2.test2[2]}, 'method called2.'
|
564
598
|
end
|
565
599
|
|
600
|
+
#階層構造を作成し、load_allするテスト。
|
601
|
+
def test_deep_directory
|
602
|
+
|
603
|
+
# 最初は空
|
604
|
+
assert_equals @registry.collect, []
|
605
|
+
|
606
|
+
# エージェントを追加
|
607
|
+
foo_body = "class Foo; include JIJI::Agent; end"
|
608
|
+
var_body = <<-BODY
|
609
|
+
class Var
|
610
|
+
include JIJI::Agent
|
611
|
+
def var
|
612
|
+
[JIJI::Agent::Shared::VALUE_D1, JIJI::Agent::Shared::VALUE_D2] # 共有ライブラリのAPIを使用。
|
613
|
+
end
|
614
|
+
end
|
615
|
+
BODY
|
616
|
+
|
617
|
+
@dao.mkcol "agents/folder1"
|
618
|
+
@dao.mkcol "agents/folder1/folder2"
|
619
|
+
|
620
|
+
assert_equals @dao.put( "agents/folder1/foo.rb", foo_body ), :success
|
621
|
+
assert_equals @dao.put( "agents/folder1/folder2/var.rb", var_body ), :success
|
622
|
+
@registry.load( "agents/folder1/foo.rb" )
|
623
|
+
@registry.load( "agents/folder1/folder2/var.rb" )
|
624
|
+
|
625
|
+
assert_equals @registry.collect.sort!, ["Foo@folder1/foo.rb", "Var@folder1/folder2/var.rb"]
|
626
|
+
|
627
|
+
obj = @registry.create("Var@folder1/folder2/var.rb",{})
|
628
|
+
begin
|
629
|
+
safe(4) { obj.var } #共有ライブラリが追加されていないのでエラーになる
|
630
|
+
fail
|
631
|
+
rescue; end
|
632
|
+
|
633
|
+
# 共有ライブラリを追加
|
634
|
+
@dao.mkcol "shared/folder1"
|
635
|
+
@dao.mkcol "shared/folder1/folder2"
|
636
|
+
|
637
|
+
shared_lib_body = "VALUE_D1='val'"
|
638
|
+
shared_lib_body2 = "VALUE_D2='val2'"
|
639
|
+
assert_equals @dao.put( "shared/folder1/shared_lib.rb", shared_lib_body ), :success
|
640
|
+
assert_equals @dao.put( "shared/folder1/folder2/shared_lib.rb", shared_lib_body2 ), :success
|
641
|
+
@registry.load( "shared/folder1/shared_lib.rb" )
|
642
|
+
@registry.load( "shared/folder1/folder2/shared_lib.rb" )
|
643
|
+
|
644
|
+
#定数が定義され、varメソッドが実行できるようになる
|
645
|
+
assert_equals safe(4) { obj.var }, ["val", "val2"]
|
646
|
+
|
647
|
+
|
648
|
+
# レジストリを再構築
|
649
|
+
@registry = JIJI::AgentRegistry.new( "agents", "shared" )
|
650
|
+
@registry.conf = JIJI::Configuration.new
|
651
|
+
@registry.file_dao = @dao
|
652
|
+
@registry.server_logger = Logger.new STDOUT
|
653
|
+
@registry.load_all
|
654
|
+
|
655
|
+
#エージェントと共有ライブラリが全てロードされていることを確認
|
656
|
+
assert_equals @registry.collect.sort!, ["Foo@folder1/foo.rb", "Var@folder1/folder2/var.rb"]
|
657
|
+
obj = @registry.create("Var@folder1/folder2/var.rb",{})
|
658
|
+
assert_equals safe(4) { obj.var }, ["val", "val2"]
|
659
|
+
end
|
660
|
+
|
566
661
|
end
|
567
662
|
|
data/test/all_tests.rb
CHANGED
@@ -13,24 +13,12 @@ require 'test_Configuration'
|
|
13
13
|
require 'test_Operator'
|
14
14
|
require 'test_Output'
|
15
15
|
require 'test_Output_registry'
|
16
|
+
require 'test_OutputManager'
|
16
17
|
require 'test_Process'
|
17
18
|
|
18
|
-
require '
|
19
|
-
require '
|
20
|
-
require '
|
21
|
-
|
22
|
-
require '
|
23
|
-
require '
|
24
|
-
|
25
|
-
require 'agent/test_AgentManager'
|
26
|
-
require 'agent/test_AgentRegistry'
|
27
|
-
require 'agent/test_PeriodicallyAgent'
|
28
|
-
require 'agent/test_Permitter'
|
29
|
-
|
30
|
-
require 'migration/test_Migrator'
|
31
|
-
require 'migration/test_Migrator1_0_3'
|
32
|
-
require 'migration/test_Migrator1_1_0'
|
33
|
-
|
34
|
-
require 'plugin/test_Loader'
|
35
|
-
#require 'plugin/embedded/test_SingleClickClient'
|
36
|
-
|
19
|
+
require 'agent/agent_tests'
|
20
|
+
require 'dao/dao_tests'
|
21
|
+
require 'migration/migration_tests'
|
22
|
+
require 'plugin/plugin_tests'
|
23
|
+
require 'shared/shared_tests'
|
24
|
+
require 'util/util_tests'
|