epc 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/epc.rb +25 -5
- data/lib/epc/client/json_client.rb +4 -4
- data/lib/epc/command/archive_command.rb +7 -6
- data/lib/epc/command/attachto_command.rb +13 -0
- data/lib/epc/command/base_command.rb +120 -29
- data/lib/epc/command/config/create_config_command.rb +7 -11
- data/lib/epc/command/config/delete_config_command.rb +5 -5
- data/lib/epc/command/config/list_configs_command.rb +5 -5
- data/lib/epc/command/config/update_config_command.rb +11 -10
- data/lib/epc/command/copy_command.rb +14 -0
- data/lib/epc/command/create_command.rb +9 -5
- data/lib/epc/command/delete_command.rb +9 -9
- data/lib/epc/command/{copy_deployment_command.rb → deployment/copy_deployment_command.rb} +6 -5
- data/lib/epc/command/deployment/create_deployment_command.rb +15 -15
- data/lib/epc/command/deployment/list_deployments_command.rb +2 -4
- data/lib/epc/command/deployment/show_deployment_command.rb +5 -7
- data/lib/epc/command/deployment/submit_deployment_command.rb +15 -0
- data/lib/epc/command/deployment/update_deployment_command.rb +5 -14
- data/lib/epc/command/deployment/vote_deployment_command.rb +23 -0
- data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
- data/lib/epc/command/detachfrom_command.rb +13 -0
- data/lib/epc/command/group/create_group_command.rb +3 -3
- data/lib/epc/command/group/delete_group_command.rb +4 -5
- data/lib/epc/command/group/show_group_command.rb +2 -3
- data/lib/epc/command/group/update_group_command.rb +9 -7
- data/lib/epc/command/library/create_library_command.rb +1 -2
- data/lib/epc/command/library/delete_library_command.rb +4 -5
- data/lib/epc/command/library/list_libraries_command.rb +1 -1
- data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +3 -5
- data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
- data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +4 -5
- data/lib/epc/command/libraryset/create_libraryset_command.rb +5 -4
- data/lib/epc/command/libraryset/delete_libraryset_command.rb +4 -6
- data/lib/epc/command/libraryset/list_librarysets_command.rb +2 -2
- data/lib/epc/command/libraryset/show_libraryset_command.rb +3 -3
- data/lib/epc/command/libraryset/update_libraryset_command.rb +4 -3
- data/lib/epc/command/list_command.rb +10 -14
- data/lib/epc/command/list_objecttypes_command.rb +1 -1
- data/lib/epc/command/objectrole/create_objectrole_command.rb +4 -5
- data/lib/epc/command/objectrole/list_objectroles_command.rb +3 -8
- data/lib/epc/command/objectrole/update_objectrole_command.rb +3 -1
- data/lib/epc/command/permission/list_permissions_command.rb +1 -1
- data/lib/epc/command/permissiongroup/list_permissiongroups_command.rb +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +1 -2
- data/lib/epc/command/plugin/delete_plugin_command.rb +4 -6
- data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
- data/lib/epc/command/plugin/show_plugin_command.rb +2 -5
- data/lib/epc/command/plugin/update_plugin_command.rb +2 -6
- data/lib/epc/command/project/archive_project_command.rb +3 -12
- data/lib/epc/command/project/attachto_project_command.rb +133 -0
- data/lib/epc/command/project/create_project_command.rb +6 -6
- data/lib/epc/command/project/delete_project_command.rb +3 -24
- data/lib/epc/command/project/detachfrom_project_command.rb +66 -0
- data/lib/epc/command/project/list_projects_command.rb +12 -7
- data/lib/epc/command/project/show_project_command.rb +26 -25
- data/lib/epc/command/project/show_project_snapshot_command.rb +41 -0
- data/lib/epc/command/project/unarchive_project_command.rb +3 -10
- data/lib/epc/command/project/update_project_command.rb +5 -18
- data/lib/epc/command/projecttype/create_projecttype_command.rb +37 -0
- data/lib/epc/command/projecttype/delete_projecttype_command.rb +24 -0
- data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
- data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -4
- data/lib/epc/command/projecttype/update_projecttype_command.rb +61 -0
- data/lib/epc/command/push_command.rb +14 -8
- data/lib/epc/command/role/create_role_command.rb +26 -3
- data/lib/epc/command/role/delete_role_command.rb +3 -5
- data/lib/epc/command/role/list_roles_command.rb +7 -3
- data/lib/epc/command/role/show_role_command.rb +8 -5
- data/lib/epc/command/role/update_role_command.rb +14 -66
- data/lib/epc/command/runtime/create_runtime_command.rb +34 -0
- data/lib/epc/command/runtime/delete_runtime_command.rb +24 -0
- data/lib/epc/command/runtime/list_runtimes_command.rb +2 -2
- data/lib/epc/command/runtime/update_runtime_command.rb +49 -0
- data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +17 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +5 -6
- data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +18 -0
- data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +2 -2
- data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
- data/lib/epc/command/serviceversion/create_serviceversion_command.rb +8 -12
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -5
- data/lib/epc/command/serviceversion/list_serviceversions_command.rb +8 -1
- data/lib/epc/command/show_command.rb +8 -9
- data/lib/epc/command/show_metrics_command.rb +3 -3
- data/lib/epc/command/solution/archive_solution_command.rb +3 -10
- data/lib/epc/command/solution/create_solution_command.rb +2 -2
- data/lib/epc/command/solution/delete_solution_command.rb +3 -7
- data/lib/epc/command/solution/list_solutions_command.rb +11 -3
- data/lib/epc/command/solution/show_solution_command.rb +4 -6
- data/lib/epc/command/solution/unarchive_solution_command.rb +3 -8
- data/lib/epc/command/solution/update_solution_command.rb +4 -6
- data/lib/epc/command/submit_command.rb +16 -0
- data/lib/epc/command/unarchive_command.rb +7 -6
- data/lib/epc/command/update_command.rb +9 -8
- data/lib/epc/command/user/create_user_command.rb +2 -3
- data/lib/epc/command/user/delete_user_command.rb +3 -5
- data/lib/epc/command/user/list_users_command.rb +1 -1
- data/lib/epc/command/user/show_user_command.rb +2 -4
- data/lib/epc/command/user/update_user_command.rb +3 -14
- data/lib/epc/command/userproperty/list_user_properties_command.rb +23 -0
- data/lib/epc/command/vote_command.rb +16 -0
- data/lib/epc/config.rb +7 -1
- data/lib/epc/help.rb +51 -48
- data/lib/epc/modules/config.rb +39 -0
- data/lib/epc/modules/role.rb +133 -0
- data/lib/epc/runner.rb +23 -12
- data/lib/epc/version.rb +1 -1
- data/test/command/archive_project_command_test.rb +2 -13
- data/test/command/archive_solution_command_test.rb +4 -14
- data/test/command/copy_deployment_command_test.rb +4 -8
- data/test/command/create_config_command_test.rb +23 -23
- data/test/command/create_deployment_command_test.rb +33 -32
- data/test/command/create_group_command_test.rb +2 -2
- data/test/command/create_library_command_test.rb +6 -6
- data/test/command/create_librarylanguage_command_test.rb +3 -3
- data/test/command/create_libraryset_command_test.rb +6 -26
- data/test/command/create_objectrole_command_test.rb +4 -13
- data/test/command/create_project_command_test.rb +27 -13
- data/test/command/create_role_command_test.rb +3 -2
- data/test/command/create_runtime_command_test.rb +37 -0
- data/test/command/create_servicedefinition_command_test.rb +4 -17
- data/test/command/create_serviceversion_command_test.rb +8 -22
- data/test/command/create_solution_command_test.rb +5 -5
- data/test/command/create_user_command_test.rb +4 -4
- data/test/command/delete_config_command_test.rb +8 -15
- data/test/command/delete_library_command_test.rb +3 -4
- data/test/command/delete_librarylanguage_command_test.rb +3 -4
- data/test/command/delete_libraryset_command_test.rb +3 -4
- data/test/command/delete_plugin_command_test.rb +3 -4
- data/test/command/delete_project_command_test.rb +2 -10
- data/test/command/delete_projecttype_command_test.rb +31 -0
- data/test/command/delete_role_command_test.rb +5 -14
- data/test/command/delete_runtime_command_test.rb +31 -0
- data/test/command/delete_servicedefinition_command_test.rb +31 -0
- data/test/command/delete_serviceversion_command_test.rb +3 -2
- data/test/command/delete_solution_command_test.rb +3 -16
- data/test/command/delete_user_command_test.rb +3 -3
- data/test/command/list_config_command_test.rb +1 -0
- data/test/command/list_deployments_command_test.rb +11 -41
- data/test/command/list_objectroles_command_test.rb +4 -14
- data/test/command/list_projects_command_test.rb +0 -14
- data/test/command/list_roles_command_test.rb +3 -1
- data/test/command/list_runtimes_command_test.rb +2 -3
- data/test/command/list_runtimetypes_command_test.rb +29 -0
- data/test/command/list_userproperties_command_test.rb +33 -0
- data/test/command/push_command_test.rb +9 -1
- data/test/command/show_deployment_command_test.rb +36 -0
- data/test/command/show_group_command_test.rb +2 -1
- data/test/command/show_libraryset_command_test.rb +5 -3
- data/test/command/show_metrics_command_test.rb +4 -4
- data/test/command/show_plugin_command_test.rb +4 -4
- data/test/command/show_project_command_test.rb +5 -17
- data/test/command/show_project_snapshot_test.rb +33 -0
- data/test/command/show_projecttype_command_test.rb +5 -11
- data/test/command/show_role_command_test.rb +5 -12
- data/test/command/show_solution_command_test.rb +2 -15
- data/test/command/show_user_command_test.rb +4 -3
- data/test/command/submit_deployment_command_test.rb +4 -11
- data/test/command/unarchive_project_command_test.rb +2 -14
- data/test/command/unarchive_solution_command_test.rb +6 -16
- data/test/command/update_config_command_test.rb +14 -3
- data/test/command/update_deployment_command_test.rb +12 -26
- data/test/command/update_group_command_test.rb +2 -10
- data/test/command/update_librarylanguage_command_test.rb +5 -3
- data/test/command/update_libraryset_command_test.rb +4 -2
- data/test/command/update_plugin_command_test.rb +5 -4
- data/test/command/update_project_command_test.rb +6 -20
- data/test/command/update_role_command_test.rb +11 -8
- data/test/command/update_solution_command_test.rb +6 -12
- data/test/command/update_user_command_test.rb +3 -19
- data/test/command/vote_deployment_command_test.rb +2 -6
- metadata +66 -63
- data/lib/epc/command/attach_library_command.rb +0 -82
- data/lib/epc/command/attach_libraryset_command.rb +0 -31
- data/lib/epc/command/attach_runtime_command.rb +0 -26
- data/lib/epc/command/bind_service_command.rb +0 -35
- data/lib/epc/command/create_dependency_command.rb +0 -43
- data/lib/epc/command/dependency/delete_dependency_command.rb +0 -38
- data/lib/epc/command/detach_library_command.rb +0 -35
- data/lib/epc/command/detach_libraryset_command.rb +0 -8
- data/lib/epc/command/list_versions_command.rb +0 -38
- data/lib/epc/command/submit_deployment_command.rb +0 -19
- data/lib/epc/command/unbind_service_command.rb +0 -42
- data/lib/epc/command/undefine_service_command.rb +0 -33
- data/lib/epc/command/update_rolepermissions_command.rb +0 -83
- data/lib/epc/command/vote_deployment_command.rb +0 -29
- data/test/command/attach_library_command_test.rb +0 -124
- data/test/command/attach_libraryset_command_test.rb +0 -49
- data/test/command/attach_runtime_command_test.rb +0 -44
- data/test/command/bind_service_command_test.rb +0 -46
- data/test/command/create_dependency_command_test.rb +0 -55
- data/test/command/create_plugin_command_test.rb +0 -44
- data/test/command/delete_dependency_command_test.rb +0 -42
- data/test/command/detach_library_command_test.rb +0 -53
- data/test/command/unbind_service_command_test.rb +0 -48
- data/test/command/undefine_service_command_test.rb +0 -49
@@ -7,10 +7,11 @@ class DeleteUserCommandTest < Test::Unit::TestCase
|
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
9
|
@command = EPC::Command::DeleteUserCommand.new(@mock_client)
|
10
|
+
@command.object_id = 1
|
11
|
+
@command.object_type = "User"
|
10
12
|
end
|
11
13
|
|
12
14
|
should "fail if status is not 200" do
|
13
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
14
15
|
@command.expects(:ask_yn).returns("Y")
|
15
16
|
@mock_client.expects(:delete).with(EPC::Config::USERS_PATH + "/1").
|
16
17
|
returns([404, {:message => "Not Found"}, {}])
|
@@ -19,8 +20,7 @@ class DeleteUserCommandTest < Test::Unit::TestCase
|
|
19
20
|
end
|
20
21
|
|
21
22
|
|
22
|
-
should "delete a user
|
23
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
23
|
+
should "delete a user" do
|
24
24
|
@command.expects(:ask_yn).returns("Y")
|
25
25
|
@mock_client.expects(:delete).with(EPC::Config::USERS_PATH + "/1").
|
26
26
|
returns([200, {}, {}])
|
@@ -6,6 +6,7 @@ class ListConfigsCommandTest < Test::Unit::TestCase
|
|
6
6
|
context "execution" do
|
7
7
|
should "fail if configuration context can't be determined" do
|
8
8
|
@mock_client = mock("Client")
|
9
|
+
EPC::Command::ListConfigsCommand.send :include, EPC::Command::Config
|
9
10
|
@command = EPC::Command::ListConfigsCommand.new(@mock_client)
|
10
11
|
@command.expects(:extract_configuration_level).returns(nil)
|
11
12
|
|
@@ -7,11 +7,11 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
9
|
@command = EPC::Command::ListDeploymentsCommand.new(@mock_client)
|
10
|
+
@command.target_type = "Solution"
|
11
|
+
@command.target_id = 1
|
10
12
|
end
|
11
13
|
|
12
|
-
|
13
14
|
should "show exception message status is not 201" do
|
14
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
15
15
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
16
16
|
returns([400, {:message => "Not Found"}, {}])
|
17
17
|
@command.expects(:say).with("Deployments retrieval failed with [Not Found]")
|
@@ -20,7 +20,6 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
20
20
|
end
|
21
21
|
|
22
22
|
should "show a message if there are no deployments" do
|
23
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
24
23
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
25
24
|
returns([200, {}, {}])
|
26
25
|
|
@@ -29,42 +28,20 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
29
28
|
assert_equal(@command.execute("Solution:1"), 200)
|
30
29
|
end
|
31
30
|
|
32
|
-
should "list available deployments for solutions
|
33
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
34
|
-
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
35
|
-
returns([200,
|
36
|
-
[
|
37
|
-
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
38
|
-
], {}])
|
39
|
-
@command.expects(:say).at_least_once
|
40
|
-
assert_equal(@command.execute("Solution:FirstSolution"), 200)
|
41
|
-
end
|
31
|
+
should "list available deployments for solutions" do
|
42
32
|
|
43
|
-
should "list available deployments for solutions specified with id" do
|
44
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
45
33
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
46
34
|
returns([200,
|
47
35
|
[
|
48
36
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
49
37
|
], {}])
|
50
38
|
@command.expects(:say).at_least_once
|
51
|
-
assert_equal(@command.execute("Solution:
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
should "list available deployments for stages specified with name" do
|
56
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
57
|
-
@mock_client.expects(:get).with(EPC::Config::DEPLOYMENT_STAGES_PATH + "/1/deployments").
|
58
|
-
returns([200,
|
59
|
-
[
|
60
|
-
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
61
|
-
], {}])
|
62
|
-
@command.expects(:say).at_least_once
|
63
|
-
assert_equal(@command.execute("DeploymentStage:Development"), 200)
|
39
|
+
assert_equal(@command.execute("Solution:FirstSolution"), 200)
|
64
40
|
end
|
65
41
|
|
66
42
|
should "list available deployments for stages specified with id" do
|
67
|
-
@command.
|
43
|
+
@command.target_type = "DeploymentStage"
|
44
|
+
@command.target_id = 1
|
68
45
|
@mock_client.expects(:get).with(EPC::Config::DEPLOYMENT_STAGES_PATH + "/1/deployments").
|
69
46
|
returns([200,
|
70
47
|
[
|
@@ -74,7 +51,9 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
74
51
|
assert_equal(@command.execute("DeploymentStage:1"), 200)
|
75
52
|
end
|
76
53
|
|
77
|
-
should "list available deployments for users
|
54
|
+
should "list available deployments for users" do
|
55
|
+
@command.target_type = "User"
|
56
|
+
@command.target_id = 1
|
78
57
|
@command.expects(:retrieve_identifier_for).returns(1)
|
79
58
|
@mock_client.expects(:get).with(EPC::Config::USERS_PATH + "/1/deployments").
|
80
59
|
returns([200,
|
@@ -85,18 +64,9 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
85
64
|
assert_equal(@command.execute("User:Admin"), 200)
|
86
65
|
end
|
87
66
|
|
88
|
-
should "list available deployments for users specified with id" do
|
89
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
90
|
-
@mock_client.expects(:get).with(EPC::Config::USERS_PATH + "/1/deployments").
|
91
|
-
returns([200,
|
92
|
-
[
|
93
|
-
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
94
|
-
], {}])
|
95
|
-
@command.expects(:say).at_least_once
|
96
|
-
assert_equal(@command.execute("User:1"), 200)
|
97
|
-
end
|
98
|
-
|
99
67
|
should "try to determine solution context if no other option specified" do
|
68
|
+
@command.target_type = nil
|
69
|
+
@command.target_id = nil
|
100
70
|
EPC::Config.expects(:is_solution_dir?).returns(true)
|
101
71
|
@command.expects(:infer_solution_context).returns([1, "FirstSolution"])
|
102
72
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
@@ -7,18 +7,8 @@ class ListObjectrolesCommandTest < Test::Unit::TestCase
|
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
9
|
@command = EPC::Command::ListObjectrolesCommand.new(@mock_client)
|
10
|
-
|
11
|
-
|
12
|
-
should "raise exception if no parameters are given" do
|
13
|
-
assert_raise EPC::Error::FatalError do
|
14
|
-
@command.execute
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
should "raise exception if parameters are incorrect" do
|
19
|
-
assert_raise EPC::Error::FatalError do
|
20
|
-
@command.execute("Solution")
|
21
|
-
end
|
10
|
+
@command.target_type = "Solution"
|
11
|
+
@command.target_id = 1
|
22
12
|
end
|
23
13
|
|
24
14
|
should "show a message if status is not 200" do
|
@@ -26,7 +16,7 @@ class ListObjectrolesCommandTest < Test::Unit::TestCase
|
|
26
16
|
returns([404, {:message => "Not Found"}, {}])
|
27
17
|
|
28
18
|
@command.expects(:say).with("Request failed: [Not Found]")
|
29
|
-
assert_equal(@command.execute
|
19
|
+
assert_equal(@command.execute, 404)
|
30
20
|
end
|
31
21
|
|
32
22
|
should "list roles" do
|
@@ -34,7 +24,7 @@ class ListObjectrolesCommandTest < Test::Unit::TestCase
|
|
34
24
|
returns([200, [{:id => 1, :name => "SuperAdmin"}, {:id => 2, :name => "Admin"}], {}])
|
35
25
|
|
36
26
|
@command.expects(:say)
|
37
|
-
assert_equal(@command.execute
|
27
|
+
assert_equal(@command.execute, 200)
|
38
28
|
end
|
39
29
|
end
|
40
30
|
|
@@ -3,20 +3,6 @@ require 'test_helper'
|
|
3
3
|
class ListProjectsCommandTest < Test::Unit::TestCase
|
4
4
|
should_require_login
|
5
5
|
|
6
|
-
context "pre-execution checks" do
|
7
|
-
setup do
|
8
|
-
@mock_client = mock("Client")
|
9
|
-
@command = EPC::Command::ListProjectsCommand.new(@mock_client)
|
10
|
-
end
|
11
|
-
|
12
|
-
should "fail if solution id can't be determined" do
|
13
|
-
@command.expects(:infer_solution_context).returns(nil)
|
14
|
-
assert_raise EPC::Error::InputError do
|
15
|
-
assert_equal(@command.execute, 1)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
6
|
context "list projects" do
|
21
7
|
setup do
|
22
8
|
@mock_client = mock("Client")
|
@@ -35,10 +35,12 @@ class ListRolesCommandTest < Test::Unit::TestCase
|
|
35
35
|
end
|
36
36
|
|
37
37
|
should "retrieve roles for the user" do
|
38
|
+
@command.target_type = "User"
|
39
|
+
@command.target_id = 1
|
38
40
|
@mock_client.expects(:get).with(EPC::Config::USERS_PATH + "/1?include=roles").
|
39
41
|
returns([200, {:roles => [{:id => 1, :name => "SuperAdmin"}, {:id => 2, :name => "Admin"}]}, {}])
|
40
42
|
@command.expects(:say)
|
41
|
-
assert_equal(@command.execute
|
43
|
+
assert_equal(@command.execute, 200)
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
@@ -3,16 +3,15 @@ require 'test_helper'
|
|
3
3
|
class ListRuntimesCommandTest < Test::Unit::TestCase
|
4
4
|
should_require_login
|
5
5
|
|
6
|
-
context "list
|
6
|
+
context "list runtime types" do
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
|
-
|
10
9
|
@command = EPC::Command::ListRuntimesCommand.new(@mock_client)
|
11
10
|
end
|
12
11
|
|
13
12
|
should "show exception message status is not 201" do
|
14
13
|
@mock_client.expects(:get).with(EPC::Config::RUNTIMES_PATH).
|
15
|
-
returns([400, {
|
14
|
+
returns([400, {:message => "Not Found"}, {}])
|
16
15
|
@command.expects(:say).with("Request failed with: [Not Found]")
|
17
16
|
|
18
17
|
assert_equal(@command.execute, 400)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ListRuntimetypesCommandTest < Test::Unit::TestCase
|
4
|
+
should_require_login
|
5
|
+
|
6
|
+
context "list runtime types" do
|
7
|
+
setup do
|
8
|
+
@mock_client = mock("Client")
|
9
|
+
@command = EPC::Command::ListRuntimetypesCommand.new(@mock_client)
|
10
|
+
end
|
11
|
+
|
12
|
+
should "show exception message status is not 201" do
|
13
|
+
@mock_client.expects(:get).with(EPC::Config::RUNTIMES_PATH + "_types").
|
14
|
+
returns([400, {:message => "Not Found"}, {}])
|
15
|
+
@command.expects(:say).with("Request failed: [Not Found]")
|
16
|
+
|
17
|
+
assert_equal(@command.execute, 400)
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
should "display the runtimes" do
|
22
|
+
@mock_client.expects(:get).with(EPC::Config::RUNTIMES_PATH + "_types").
|
23
|
+
returns([200, [], {}])
|
24
|
+
@command.expects(:say)
|
25
|
+
|
26
|
+
assert_equal(@command.execute, 200)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class ListUsersCommandTest < Test::Unit::TestCase
|
2
|
+
should_require_login
|
3
|
+
|
4
|
+
context "execute" do
|
5
|
+
setup do
|
6
|
+
@mock_client = mock("Client")
|
7
|
+
@command = EPC::Command::ListUserpropertiesCommand.new(@mock_client)
|
8
|
+
@user_id = 1
|
9
|
+
@command.expects(:retrieve_identifier_for).with("User",'user@domain.com').returns(@user_id)
|
10
|
+
end
|
11
|
+
|
12
|
+
should "fail if the user cannot be found" do
|
13
|
+
@mock_client.expects(:get).with(EPC::Config::ENTITY_PROPERTIES_PATH + "/for/User/#{@user_id}").returns([404, {:message => "Entity was not found."}, {}])
|
14
|
+
@command.expects(:say).with("Request failed with [Entity was not found.]")
|
15
|
+
assert_equal 404, @command.execute
|
16
|
+
end
|
17
|
+
|
18
|
+
should "return a message if there are no properties" do
|
19
|
+
@mock_client.expects(:get).with(EPC::Config::ENTITY_PROPERTIES_PATH + "/for/User/#{@user_id}").returns([200, [], {}])
|
20
|
+
@command.expects(:say).with("No properties found for current user.")
|
21
|
+
assert_equal 200, @command.execute
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
should "return a list of properties if available" do
|
26
|
+
@mock_client.expects(:get).with(EPC::Config::ENTITY_PROPERTIES_PATH + "/for/User/#{@user_id}").returns([200, [{:id => 1, :name => "config", :value => "blue"}], {}])
|
27
|
+
@command.expects(:say)
|
28
|
+
assert_equal 200, @command.execute
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -156,7 +156,7 @@ class PushCommandTest < Test::Unit::TestCase
|
|
156
156
|
command.expects(:check_push_directory).returns(true)
|
157
157
|
command.expects(:recurse_project_directory).returns(
|
158
158
|
[["toplevel/lib/foo.jar", "toplevel/src/foo1.java", "toplevel/src/foo2.java"],
|
159
|
-
|
159
|
+
["lib/foo.jar", "src/foo1.java", "src/foo2.java"]])
|
160
160
|
|
161
161
|
expected_path = File.expand_path(".")
|
162
162
|
expected_zip_path = File.join(expected_path, "pushed.zip")
|
@@ -241,6 +241,14 @@ class PushCommandTest < Test::Unit::TestCase
|
|
241
241
|
assert_equal(@command.send(:check_push_directory, "path"), false)
|
242
242
|
end
|
243
243
|
|
244
|
+
should "raise an error if the directory is empty" do
|
245
|
+
temp_dir = Dir.mktmpdir()
|
246
|
+
assert_raise EPC::Error::BasicError, "The directory you are pushing is empty" do
|
247
|
+
@command.send(:check_push_directory, temp_dir)
|
248
|
+
end
|
249
|
+
Dir.rmdir(temp_dir)
|
250
|
+
end
|
251
|
+
|
244
252
|
end
|
245
253
|
|
246
254
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ShowDeploymentCommandTest < Test::Unit::TestCase
|
4
|
+
should_require_login
|
5
|
+
|
6
|
+
context "retrieval" do
|
7
|
+
setup do
|
8
|
+
@mock_client = mock("Client")
|
9
|
+
@command = EPC::Command::ShowDeploymentCommand.new(@mock_client)
|
10
|
+
@command.object_id = 1
|
11
|
+
@command.object_type = "Deployment"
|
12
|
+
end
|
13
|
+
|
14
|
+
should "notify if retrieval fails" do
|
15
|
+
@mock_client.expects(:get).returns([404, {:message => "Resource not found"}, {}])
|
16
|
+
@command.expects(:say).with("Request failed: [Resource not found]")
|
17
|
+
|
18
|
+
assert_equal(@command.execute([]), 404)
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
should "show details about the requested deployment" do
|
23
|
+
|
24
|
+
@mock_client.expects(:get).with(EPC::Config::DEPLOYMENTS_PATH+"/#{@command.object_id}?include=solution,deployment_stage,approvals,deployer,submitter").
|
25
|
+
returns([200, {:id=>3, :status=>"STARTED", :label=>"Deployment", :description=>"description", :dirty=>false, :user_id=>1,
|
26
|
+
:user_name=>"user_name", :last_updated_by=>{:id=>1, :name=>"user_name"}, :replaces=> 1,:deployment_stage=>{:id=>8, :name=>"DeploymentStageName"},
|
27
|
+
:solution=>{:id=>2, :name=>"Solution_name", :deployer=>{:id=>1, :name=>"user_name"},
|
28
|
+
:projects=>[{:id=>5, :name=>"Project-Name", :version=>5, :status=>"running", :status_message=>nil, :uris=>["test.project.target.com"], :instances=>1, :deployed_project_id=>15}]} }, {}])
|
29
|
+
|
30
|
+
@command.expects(:say).at_least_once
|
31
|
+
assert_equal(@command.execute([]), 200)
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -7,6 +7,8 @@ class ShowGroupCommandTest < Test::Unit::TestCase
|
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
9
|
@command = EPC::Command::ShowGroupCommand.new(@mock_client)
|
10
|
+
@command.object_id = 1
|
11
|
+
@command.object_type = 1
|
10
12
|
end
|
11
13
|
|
12
14
|
should "fail if status is not 200" do
|
@@ -17,7 +19,6 @@ class ShowGroupCommandTest < Test::Unit::TestCase
|
|
17
19
|
end
|
18
20
|
|
19
21
|
should "show a group specified by name" do
|
20
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
21
22
|
@mock_client.expects(:get).with(EPC::Config::GROUPS_PATH + "/1?include=users").
|
22
23
|
returns([200, {:id => 1, :name => "Grp1", :users => [{:id => 1, :name => "Group Leader", :email => "group_leader@epaas.com"}]}, {}])
|
23
24
|
@command.expects(:say).at_least_once
|
@@ -7,6 +7,8 @@ class ShowLibrarysetCommandTest < Test::Unit::TestCase
|
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
9
|
@command = EPC::Command::ShowLibrarysetCommand.new(@mock_client)
|
10
|
+
@command.object_id = 1
|
11
|
+
@command.object_type = "LibrarySet"
|
10
12
|
end
|
11
13
|
|
12
14
|
|
@@ -15,7 +17,7 @@ class ShowLibrarysetCommandTest < Test::Unit::TestCase
|
|
15
17
|
returns([404, {:message => "Not Found"}, {}])
|
16
18
|
|
17
19
|
@command.expects(:say).with("Request failed: [Not Found]")
|
18
|
-
assert_equal(@command.execute
|
20
|
+
assert_equal(@command.execute, 404)
|
19
21
|
end
|
20
22
|
|
21
23
|
should "show details about the requested library set" do
|
@@ -23,7 +25,7 @@ class ShowLibrarysetCommandTest < Test::Unit::TestCase
|
|
23
25
|
returns([200, {:id => 1, :name => "lib-set", :created_at => Time.now.to_s, :updated_at => Time.now.to_s, :libraries => [{:id => 1, :name => "lib1"}], :library_language => []}, {}])
|
24
26
|
|
25
27
|
@command.expects(:say).at_least_once
|
26
|
-
assert_equal(@command.execute
|
28
|
+
assert_equal(@command.execute, 200)
|
27
29
|
end
|
28
30
|
|
29
31
|
should "output the results as json when --json is passed" do
|
@@ -32,7 +34,7 @@ class ShowLibrarysetCommandTest < Test::Unit::TestCase
|
|
32
34
|
returns([200, {:id => 1, :name => "lib-set", :libraries => [{:id => 1, :name => "lib1"}], :library_language => []}, {}])
|
33
35
|
|
34
36
|
@command.expects(:say)
|
35
|
-
assert_equal(@command.execute
|
37
|
+
assert_equal(@command.execute, 200)
|
36
38
|
end
|
37
39
|
|
38
40
|
end
|
@@ -23,20 +23,20 @@ class ShowMetricsCommandTest < Test::Unit::TestCase
|
|
23
23
|
@command = EPC::Command::ShowMetricsCommand.new(@mock_client)
|
24
24
|
@command.expects(:say).with("You must specify the metrics to display.")
|
25
25
|
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:show_metrics])
|
26
|
-
assert_equal(@command.execute(
|
26
|
+
assert_equal(@command.execute([@id]), 1)
|
27
27
|
end
|
28
28
|
|
29
29
|
should "fail if status is not 302 (ok)" do
|
30
30
|
@mock_client.expects(:get).with(@url).returns([500, {:message => "System exception encountered"}, {}])
|
31
31
|
@command.expects(:say).with("Request failed: [System exception encountered]")
|
32
|
-
assert_equal 500, @command.execute(
|
32
|
+
assert_equal 500, @command.execute([@id, @metrics])
|
33
33
|
end
|
34
34
|
|
35
35
|
should "fail if second status is not 200 (ok)" do
|
36
36
|
@mock_client.expects(:get).with(@url).returns([302, {}, {uri: @redirect_url}])
|
37
37
|
EPC::Client::HttpClient.any_instance.expects(:get).with(@redirect_url).returns([500, {:message => "System exception encountered"}, {}])
|
38
38
|
@command.expects(:say).with("Request failed: [System exception encountered]")
|
39
|
-
assert_equal 500, @command.execute(
|
39
|
+
assert_equal 500, @command.execute([@id, @metrics])
|
40
40
|
end
|
41
41
|
|
42
42
|
should "show metrics" do
|
@@ -44,7 +44,7 @@ class ShowMetricsCommandTest < Test::Unit::TestCase
|
|
44
44
|
json = '{"id":{"metric":{"start":0,"stop":2,"step":3,"data":[1,2,3]}}}'
|
45
45
|
EPC::Client::HttpClient.any_instance.expects(:get).with(@redirect_url).returns([200, json, {}])
|
46
46
|
@command.expects(:say).times(3)
|
47
|
-
assert_equal 200, @command.execute(
|
47
|
+
assert_equal 200, @command.execute([@id, @metrics])
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -7,20 +7,20 @@ class ShowPluginCommandTest < Test::Unit::TestCase
|
|
7
7
|
setup do
|
8
8
|
@mock_client = mock("Client")
|
9
9
|
@command = EPC::Command::ShowPluginCommand.new(@mock_client)
|
10
|
+
@command.object_id = 1
|
11
|
+
@command.object_type = "Plugin"
|
10
12
|
end
|
11
13
|
|
12
14
|
should "show the plugin" do
|
13
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
14
15
|
@mock_client.expects(:get).with(EPC::Config::PLUGINS_PATH + "/1").returns([200, {:id => 1, :name => "plugin_name", :plugin_version => "1", :group => "plugin_groups", :inherited => true, :extensions => false, :executions => "exec_string", :configuration => "config_string"}, {}])
|
15
16
|
@command.expects(:say).at_least_once
|
16
|
-
@command.execute
|
17
|
+
@command.execute
|
17
18
|
end
|
18
19
|
|
19
20
|
should "report reason for request failure" do
|
20
|
-
@command.expects(:retrieve_identifier_for).returns(1)
|
21
21
|
@mock_client.expects(:get).with(EPC::Config::PLUGINS_PATH + "/1").returns([500, {:message => "System Exception"}, {}])
|
22
22
|
@command.expects(:say).with("Request failed: [System Exception]")
|
23
|
-
@command.execute
|
23
|
+
@command.execute
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|