epc 1.0.2 → 1.0.3
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 +71 -54
- data/lib/epc/command/archive_command.rb +12 -0
- data/lib/epc/command/attach_libraryset_command.rb +1 -2
- data/lib/epc/command/attach_runtime_command.rb +0 -1
- data/lib/epc/command/base_command.rb +52 -63
- data/lib/epc/command/config/delete_config_command.rb +57 -0
- data/lib/epc/command/{list_config_command.rb → config/list_configs_command.rb} +1 -1
- data/lib/epc/command/config/update_config_command.rb +56 -0
- data/lib/epc/command/create_command.rb +0 -1
- data/lib/epc/command/delete_command.rb +16 -0
- data/lib/epc/command/{delete_dependency_command.rb → dependency/delete_dependency_command.rb} +14 -16
- data/lib/epc/command/deploy_command.rb +1 -2
- data/lib/epc/command/deployment/list_deployments_command.rb +49 -0
- data/lib/epc/command/deployment/show_deployment_command.rb +61 -0
- data/lib/epc/command/{update_deploymentproject_command.rb → deployment/update_deployment_command.rb} +3 -3
- data/lib/epc/command/{list_stages_command.rb → deploymentstage/list_deploymentstages_command.rb} +1 -1
- data/lib/epc/command/group/delete_group_command.rb +25 -0
- data/lib/epc/command/{list_groups_command.rb → group/list_groups_command.rb} +1 -1
- data/lib/epc/command/{show_group_command.rb → group/show_group_command.rb} +2 -9
- data/lib/epc/command/{update_group_command.rb → group/update_group_command.rb} +3 -20
- data/lib/epc/command/library/create_library_command.rb +2 -5
- data/lib/epc/command/library/delete_library_command.rb +23 -0
- data/lib/epc/command/{list_libraries_command.rb → library/list_libraries_command.rb} +1 -1
- data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +24 -0
- data/lib/epc/command/{list_librarylanguages_command.rb → librarylanguage/list_librarylanguages_command.rb} +1 -1
- data/lib/epc/command/{update_librarylanguage_command.rb → librarylanguage/update_librarylanguage_command.rb} +6 -10
- data/lib/epc/command/libraryset/create_libraryset_command.rb +1 -6
- data/lib/epc/command/{delete_libraryset_command.rb → libraryset/delete_libraryset_command.rb} +2 -18
- data/lib/epc/command/{list_librarysets_command.rb → libraryset/list_librarysets_command.rb} +1 -1
- data/lib/epc/command/{show_libraryset_command.rb → libraryset/show_libraryset_command.rb} +2 -17
- data/lib/epc/command/{update_libraryset_command.rb → libraryset/update_libraryset_command.rb} +4 -16
- data/lib/epc/command/list_command.rb +22 -0
- data/lib/epc/command/list_metrics_command.rb +25 -0
- data/lib/epc/command/list_objecttypes_command.rb +2 -4
- data/lib/epc/command/list_versions_command.rb +0 -1
- data/lib/epc/command/{list_objectroles_command.rb → objectrole/list_objectroles_command.rb} +3 -3
- data/lib/epc/command/objectrole/update_objectrole_command.rb +14 -0
- data/lib/epc/command/{list_rolepermissions_command.rb → permission/list_permissions_command.rb} +2 -2
- data/lib/epc/command/{list_permissiongroups_command.rb → permissiongroup/list_permissiongroups_command.rb} +1 -1
- data/lib/epc/command/plugin/create_plugin_command.rb +42 -0
- data/lib/epc/command/plugin/delete_plugin_command.rb +26 -0
- data/lib/epc/command/plugin/list_plugins_command.rb +19 -0
- data/lib/epc/command/plugin/show_plugin_command.rb +29 -0
- data/lib/epc/command/plugin/update_plugin_command.rb +53 -0
- data/lib/epc/command/{archive_project_command.rb → project/archive_project_command.rb} +4 -3
- data/lib/epc/command/{delete_project_command.rb → project/delete_project_command.rb} +11 -7
- data/lib/epc/command/{list_projects_command.rb → project/list_projects_command.rb} +8 -9
- data/lib/epc/command/{show_project_command.rb → project/show_project_command.rb} +64 -29
- data/lib/epc/command/{unarchive_project_command.rb → project/unarchive_project_command.rb} +5 -4
- data/lib/epc/command/{update_project_command.rb → project/update_project_command.rb} +11 -5
- data/lib/epc/command/{list_projecttypes_command.rb → projecttype/list_projecttypes_command.rb} +1 -1
- data/lib/epc/command/{show_projecttype_command.rb → projecttype/show_projecttype_command.rb} +4 -3
- data/lib/epc/command/pull_command.rb +33 -35
- data/lib/epc/command/{delete_role_command.rb → role/delete_role_command.rb} +3 -4
- data/lib/epc/command/{list_roles_command.rb → role/list_roles_command.rb} +4 -3
- data/lib/epc/command/{show_role_command.rb → role/show_role_command.rb} +18 -10
- data/lib/epc/command/role/update_role_command.rb +95 -0
- data/lib/epc/command/{list_runtimes_command.rb → runtime/list_runtimes_command.rb} +0 -0
- data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +23 -0
- data/lib/epc/command/{list_servicedefinitions_command.rb → servicedefinition/list_servicedefinitions_command.rb} +1 -0
- data/lib/epc/command/{list_service_types_command.rb → servicetype/list_servicetypes_command.rb} +0 -0
- data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +24 -0
- data/lib/epc/command/{list_serviceversions_command.rb → serviceversion/list_serviceversions_command.rb} +1 -1
- data/lib/epc/command/show_command.rb +27 -0
- data/lib/epc/command/show_instances_command.rb +33 -0
- data/lib/epc/command/show_metrics_command.rb +55 -0
- data/lib/epc/command/{archive_solution_command.rb → solution/archive_solution_command.rb} +2 -1
- data/lib/epc/command/solution/create_solution_command.rb +0 -1
- data/lib/epc/command/{delete_solution_command.rb → solution/delete_solution_command.rb} +5 -10
- data/lib/epc/command/solution/list_solutions_command.rb +1 -1
- data/lib/epc/command/{show_solution_command.rb → solution/show_solution_command.rb} +12 -7
- data/lib/epc/command/{unarchive_solution_command.rb → solution/unarchive_solution_command.rb} +1 -1
- data/lib/epc/command/solution/update_solution_command.rb +2 -1
- data/lib/epc/command/unarchive_command.rb +12 -0
- data/lib/epc/command/update_command.rb +15 -0
- data/lib/epc/command/update_rolepermissions_command.rb +2 -2
- data/lib/epc/command/{delete_user_command.rb → user/delete_user_command.rb} +4 -12
- data/lib/epc/command/{list_users_command.rb → user/list_users_command.rb} +1 -1
- data/lib/epc/command/{show_user_command.rb → user/show_user_command.rb} +3 -17
- data/lib/epc/command/{update_user_command.rb → user/update_user_command.rb} +2 -4
- data/lib/epc/config.rb +4 -1
- data/lib/epc/help.rb +50 -35
- data/lib/epc/runner.rb +16 -5
- data/lib/epc/version.rb +1 -1
- data/lib/epc/vertical_bar.rb +40 -0
- data/test/command/create_library_command_test.rb +5 -2
- data/test/command/create_libraryset_command_test.rb +1 -1
- data/test/command/create_plugin_command_test.rb +44 -0
- data/test/command/create_servicedefinition_command_test.rb +43 -0
- data/test/command/delete_config_command_test.rb +0 -11
- data/test/command/delete_dependency_command_test.rb +3 -11
- data/test/command/delete_library_command_test.rb +2 -15
- data/test/command/delete_librarylanguage_command_test.rb +2 -24
- data/test/command/delete_libraryset_command_test.rb +2 -24
- data/test/command/delete_plugin_command_test.rb +32 -0
- data/test/command/delete_project_command_test.rb +0 -6
- data/test/command/delete_role_command_test.rb +1 -1
- data/test/command/delete_serviceversion_command_test.rb +0 -22
- data/test/command/delete_solution_command_test.rb +4 -4
- data/test/command/delete_user_command_test.rb +2 -24
- data/test/command/list_config_command_test.rb +3 -3
- data/test/command/list_deployments_command_test.rb +17 -20
- data/test/command/list_deploymentstages_command_test.rb +2 -2
- data/test/command/list_metrics_command_test.rb +40 -0
- data/test/command/{list_rolepermissions_command_test.rb → list_permissions_command_test.rb} +2 -2
- data/test/command/list_plugins_command_test.rb +27 -0
- data/test/command/list_projects_command_test.rb +3 -5
- data/test/command/list_roles_command_test.rb +2 -3
- data/test/command/pull_command_test.rb +13 -9
- data/test/command/show_group_command_test.rb +1 -23
- data/test/command/show_instances_command_test.rb +33 -0
- data/test/command/show_libraryset_command_test.rb +0 -11
- data/test/command/show_metrics_command_test.rb +51 -0
- data/test/command/show_plugin_command_test.rb +28 -0
- data/test/command/show_project_command_test.rb +1 -1
- data/test/command/show_projecttype_command_test.rb +0 -5
- data/test/command/show_role_command_test.rb +1 -1
- data/test/command/show_solution_command_test.rb +1 -1
- data/test/command/show_user_command_test.rb +2 -22
- data/test/command/update_config_command_test.rb +3 -9
- data/test/command/{update_deploymentproject_command_test.rb → update_deployment_command_test.rb} +6 -11
- data/test/command/update_group_command_test.rb +1 -20
- data/test/command/update_librarylanguage_command_test.rb +0 -15
- data/test/command/update_libraryset_command_test.rb +0 -13
- data/test/command/update_plugin_command_test.rb +41 -0
- data/test/command/update_project_command_test.rb +3 -3
- data/test/command/update_role_command_test.rb +2 -1
- data/test/command/update_solution_command_test.rb +3 -9
- data/test/command/update_user_command_test.rb +0 -6
- metadata +177 -165
- data/lib/epc/command/define_service_command.rb +0 -37
- data/lib/epc/command/delete_config_command.rb +0 -63
- data/lib/epc/command/delete_group_command.rb +0 -40
- data/lib/epc/command/delete_library_command.rb +0 -30
- data/lib/epc/command/delete_librarylanguage_command.rb +0 -40
- data/lib/epc/command/delete_serviceversion_command.rb +0 -52
- data/lib/epc/command/list_approvals_command.rb +0 -27
- data/lib/epc/command/list_attachedlibraries_command.rb +0 -42
- data/lib/epc/command/list_boundservices_command.rb +0 -40
- data/lib/epc/command/list_dependencies_command.rb +0 -43
- data/lib/epc/command/list_deployments_command.rb +0 -68
- data/lib/epc/command/list_solutions_command.rb +0 -25
- data/lib/epc/command/show_deployment_command.rb +0 -57
- data/lib/epc/command/update_config_command.rb +0 -62
- data/lib/epc/command/update_role_command.rb +0 -47
- data/lib/epc/command/update_solution_command.rb +0 -45
- data/test/command/define_service_command_test.rb +0 -55
- data/test/command/delete_group_command_test.rb +0 -56
- data/test/command/list_approvals_command_test.rb +0 -41
- data/test/command/list_boundservices_command_test.rb +0 -46
- data/test/command/list_dependencies_command_test.rb +0 -46
- data/test/command/update_rolepermissions_command_test.rb +0 -54
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require File.expand_path "../../../lib/epc", __FILE__
|
|
2
|
+
require "test/unit"
|
|
3
|
+
require 'shoulda'
|
|
4
|
+
require 'mocha'
|
|
5
|
+
|
|
6
|
+
class CreateServicedefinitionCommandTest < Test::Unit::TestCase
|
|
7
|
+
should_require_login
|
|
8
|
+
|
|
9
|
+
context "execution" do
|
|
10
|
+
setup do
|
|
11
|
+
@mock_client = mock('Client')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
should "require both the name and service type" do
|
|
15
|
+
@command = EPC::Command::CreateServicedefinitionCommand.new(@mock_client)
|
|
16
|
+
assert_raise EPC::Error::FatalError do
|
|
17
|
+
@command.execute("")
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "service definition" do
|
|
24
|
+
setup do
|
|
25
|
+
@mock_client = stub('Client')
|
|
26
|
+
@command = EPC::Command::CreateServicedefinitionCommand.new(@mock_client, {:service_type => "MySQL"})
|
|
27
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
should "fail if status is not 201" do
|
|
31
|
+
@mock_client.expects(:post).with(EPC::Config::SERVICE_DEFINITIONS_PATH, {:name => "service", :type_id => 1}).returns([400, {:message => 'Not Found'}])
|
|
32
|
+
@command.expects(:say).with("Service definition failed with: [Not Found]")
|
|
33
|
+
@command.execute("", "service", "MySQL")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
should "define a service" do
|
|
37
|
+
@mock_client.expects(:post).with(EPC::Config::SERVICE_DEFINITIONS_PATH, {:name => "service", :type_id => 1}).returns([201, {'id' => 1}])
|
|
38
|
+
@command.expects(:say).with("service has been defined.")
|
|
39
|
+
@command.execute("", "service", "MySQL")
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
@@ -3,17 +3,6 @@ require 'test_helper'
|
|
|
3
3
|
class DeleteConfigCommandTest < Test::Unit::TestCase
|
|
4
4
|
should_require_login
|
|
5
5
|
|
|
6
|
-
context "invalid commands" do
|
|
7
|
-
setup do
|
|
8
|
-
@mock_client = mock("Client")
|
|
9
|
-
@command = EPC::Command::DeleteConfigCommand.new(@mock_client)
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
should "fail when no key is specified" do
|
|
13
|
-
@command.expects(:say).with("You must specify the key you wish to delete.")
|
|
14
|
-
@command.execute()
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
6
|
|
|
18
7
|
context "valid commands" do
|
|
19
8
|
setup do
|
|
@@ -9,18 +9,10 @@ class DeleteDependencyCommandTest < Test::Unit::TestCase
|
|
|
9
9
|
@command = EPC::Command::DeleteDependencyCommand.new(@mock_client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
should "fail if no dependency id specified" do
|
|
13
|
-
@command.expects(:say).with("You must specify a dependency_id")
|
|
14
|
-
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:delete_dependency])
|
|
15
|
-
|
|
16
|
-
assert_equal(@command.execute, 1)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
12
|
should "fail if project id can't be determined" do
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
assert_equal(@command.execute("1"), 1)
|
|
13
|
+
assert_raise EPC::Error::FatalError do
|
|
14
|
+
assert_equal(@command.execute("1"), 1)
|
|
15
|
+
end
|
|
24
16
|
end
|
|
25
17
|
|
|
26
18
|
context "deletion" do
|
|
@@ -9,22 +9,8 @@ class DeleteLibraryCommandTest < Test::Unit::TestCase
|
|
|
9
9
|
@command = EPC::Command::DeleteLibraryCommand.new(@mock_client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
should "fail if no library name of id specified" do
|
|
13
|
-
assert_raise EPC::Error::FatalError do
|
|
14
|
-
assert_equal(@command.execute, 1)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
should "fail if library id can't be determined" do
|
|
19
|
-
assert_raise EPC::Error::FatalError do
|
|
20
|
-
@command.expects(:ask_yn).returns("Y")
|
|
21
|
-
@command.expects(:retrieve_libraries).returns(nil)
|
|
22
|
-
|
|
23
|
-
assert_equal(@command.execute("libmath"), 1)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
12
|
should "fail if status is not 200" do
|
|
13
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
28
14
|
@command.expects(:ask_yn).returns("Y")
|
|
29
15
|
@mock_client.expects(:delete).with(EPC::Config::LIBRARIES_PATH + "/1").returns([404, {:message => "Not Found"}, {}])
|
|
30
16
|
@command.expects(:say).with("Request failed: [Not Found]")
|
|
@@ -33,6 +19,7 @@ class DeleteLibraryCommandTest < Test::Unit::TestCase
|
|
|
33
19
|
end
|
|
34
20
|
|
|
35
21
|
should "delete a library" do
|
|
22
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
36
23
|
@command.expects(:ask_yn).returns("Y")
|
|
37
24
|
@mock_client.expects(:delete).with(EPC::Config::LIBRARIES_PATH + "/1").returns([200, {}, {}])
|
|
38
25
|
@command.expects(:say).with("Library deleted")
|
|
@@ -9,21 +9,8 @@ class DeleteLibrarylanguageCommandTest < Test::Unit::TestCase
|
|
|
9
9
|
@command = EPC::Command::DeleteLibrarylanguageCommand.new(@mock_client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
should "fail if no names are specified" do
|
|
13
|
-
@command.expects(:say).with("You need to specify a language id/name")
|
|
14
|
-
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:delete_librarylanguage])
|
|
15
|
-
assert_equal(@command.execute, 1)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
should "fail if language id can't be determined" do
|
|
19
|
-
@command.expects(:ask_yn).returns("Y")
|
|
20
|
-
@command.expects(:get_resource_id).with(EPC::Config::LIBRARY_LANGUAGES_PATH, :name, "ruby").returns(nil)
|
|
21
|
-
@command.expects(:say).with("Language could not be determined")
|
|
22
|
-
|
|
23
|
-
assert_equal(@command.execute("ruby"), 1)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
12
|
should "fail if status is not 200" do
|
|
13
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
27
14
|
@command.expects(:ask_yn).returns("Y")
|
|
28
15
|
@mock_client.expects(:delete).with(EPC::Config::LIBRARY_LANGUAGES_PATH + "/1").
|
|
29
16
|
returns([404, {:message => "Not Found"}, {}])
|
|
@@ -33,6 +20,7 @@ class DeleteLibrarylanguageCommandTest < Test::Unit::TestCase
|
|
|
33
20
|
|
|
34
21
|
|
|
35
22
|
should "delete a language specified by id" do
|
|
23
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
36
24
|
@command.expects(:ask_yn).returns("Y")
|
|
37
25
|
@mock_client.expects(:delete).with(EPC::Config::LIBRARY_LANGUAGES_PATH + "/1").
|
|
38
26
|
returns([200, {}, {}])
|
|
@@ -41,15 +29,5 @@ class DeleteLibrarylanguageCommandTest < Test::Unit::TestCase
|
|
|
41
29
|
assert_equal(@command.execute(1), 200)
|
|
42
30
|
end
|
|
43
31
|
|
|
44
|
-
|
|
45
|
-
should "delete a language specified by name" do
|
|
46
|
-
@command.expects(:ask_yn).returns("Y")
|
|
47
|
-
@command.expects(:get_resource_id).with(EPC::Config::LIBRARY_LANGUAGES_PATH, :name, "ruby").returns(1)
|
|
48
|
-
@mock_client.expects(:delete).with(EPC::Config::LIBRARY_LANGUAGES_PATH + "/1").
|
|
49
|
-
returns([200, {}, {}])
|
|
50
|
-
@command.expects(:say).with("Language deleted")
|
|
51
|
-
|
|
52
|
-
assert_equal(@command.execute("ruby"), 200)
|
|
53
|
-
end
|
|
54
32
|
end
|
|
55
33
|
end
|
|
@@ -9,21 +9,9 @@ class DeleteLibrarysetCommand < Test::Unit::TestCase
|
|
|
9
9
|
@command = EPC::Command::DeleteLibrarysetCommand.new(@mock_client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
should "fail if no names are specified" do
|
|
13
|
-
@command.expects(:say).with("You need to specify a set id/name")
|
|
14
|
-
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:delete_libraryset])
|
|
15
|
-
assert_equal(@command.execute, 1)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
should "fail if set id can't be determined" do
|
|
19
|
-
@command.expects(:ask_yn).returns("Y")
|
|
20
|
-
@command.expects(:get_resource_id).with(EPC::Config::LIBRARY_SETS_PATH, :name, "rubyset").returns(nil)
|
|
21
|
-
@command.expects(:say).with("Set could not be determined")
|
|
22
|
-
|
|
23
|
-
assert_equal(@command.execute("rubyset"), 1)
|
|
24
|
-
end
|
|
25
12
|
|
|
26
13
|
should "fail if status is not 200" do
|
|
14
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
27
15
|
@command.expects(:ask_yn).returns("Y")
|
|
28
16
|
@mock_client.expects(:delete).with(EPC::Config::LIBRARY_SETS_PATH + "/1").
|
|
29
17
|
returns([404, {:message => "Not Found"}, {}])
|
|
@@ -33,6 +21,7 @@ class DeleteLibrarysetCommand < Test::Unit::TestCase
|
|
|
33
21
|
|
|
34
22
|
|
|
35
23
|
should "delete a set specified by id" do
|
|
24
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
36
25
|
@command.expects(:ask_yn).returns("Y")
|
|
37
26
|
@mock_client.expects(:delete).with(EPC::Config::LIBRARY_SETS_PATH + "/1").
|
|
38
27
|
returns([200, {}, {}])
|
|
@@ -40,16 +29,5 @@ class DeleteLibrarysetCommand < Test::Unit::TestCase
|
|
|
40
29
|
|
|
41
30
|
assert_equal(@command.execute(1), 200)
|
|
42
31
|
end
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
should "delete a set specified by name" do
|
|
46
|
-
@command.expects(:ask_yn).returns("Y")
|
|
47
|
-
@command.expects(:get_resource_id).with(EPC::Config::LIBRARY_SETS_PATH, :name, "rubyset").returns(1)
|
|
48
|
-
@mock_client.expects(:delete).with(EPC::Config::LIBRARY_SETS_PATH + "/1").
|
|
49
|
-
returns([200, {}, {}])
|
|
50
|
-
@command.expects(:say).with("Set deleted")
|
|
51
|
-
|
|
52
|
-
assert_equal(@command.execute("rubyset"), 200)
|
|
53
|
-
end
|
|
54
32
|
end
|
|
55
33
|
end
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
require 'test_helper'
|
|
2
|
+
|
|
3
|
+
class DeletePluginCommandTest < Test::Unit::TestCase
|
|
4
|
+
should_require_login
|
|
5
|
+
|
|
6
|
+
context "execute" do
|
|
7
|
+
setup do
|
|
8
|
+
@mock_client = mock("Client")
|
|
9
|
+
@command = EPC::Command::DeletePluginCommand.new(@mock_client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
should "fail if status is not 200" do
|
|
13
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
14
|
+
@command.expects(:ask_yn).returns("Y")
|
|
15
|
+
@mock_client.expects(:delete).with(EPC::Config::PLUGINS_PATH + "/1").
|
|
16
|
+
returns([404, {:message => "Not Found"}, {}])
|
|
17
|
+
@command.expects(:say).with("Request failed: [Not Found]")
|
|
18
|
+
assert_equal(@command.execute(1), 404)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
should "delete a plugin specified by id" do
|
|
23
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
24
|
+
@command.expects(:ask_yn).returns("Y")
|
|
25
|
+
@mock_client.expects(:delete).with(EPC::Config::PLUGINS_PATH + "/1").
|
|
26
|
+
returns([200, {}, {}])
|
|
27
|
+
@command.expects(:say).with("Plugin deleted")
|
|
28
|
+
|
|
29
|
+
assert_equal(@command.execute(1), 200)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -10,12 +10,6 @@ class DeleteProjectCommandTest < Test::Unit::TestCase
|
|
|
10
10
|
@command = EPC::Command::DeleteProjectCommand.new(@mock_client)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
should "fail no project specified" do
|
|
14
|
-
@command.expects(:infer_project_context).returns(nil)
|
|
15
|
-
@command.expects(:say).with("Project name could not be inferred")
|
|
16
|
-
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:delete_project])
|
|
17
|
-
assert_equal(@command.execute, 1)
|
|
18
|
-
end
|
|
19
13
|
end
|
|
20
14
|
context "deletion" do
|
|
21
15
|
setup do
|
|
@@ -30,7 +30,7 @@ class DeleteRoleCommandTest < Test::Unit::TestCase
|
|
|
30
30
|
|
|
31
31
|
should "delete a role specified by name" do
|
|
32
32
|
@command.expects(:ask_yn).returns("Y")
|
|
33
|
-
@command.expects(:
|
|
33
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
34
34
|
@mock_client.expects(:delete).with(EPC::Config::ROLES_PATH + "/1/system/true").
|
|
35
35
|
returns([200, {}, {}])
|
|
36
36
|
@command.expects(:say).with("Role deleted")
|
|
@@ -9,28 +9,6 @@ class DeleteServiceversionCommandTest < Test::Unit::TestCase
|
|
|
9
9
|
@command = EPC::Command::DeleteServiceversionCommand.new(@mock_client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
should "fail if no service version identifier specified" do
|
|
13
|
-
@command.expects(:say).with("You must specify a service version identifier")
|
|
14
|
-
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:delete_serviceversion])
|
|
15
|
-
|
|
16
|
-
assert_equal(@command.execute, 1)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
should "fail if service label specified without definition_name" do
|
|
20
|
-
@command.expects(:ask_yn).returns("Y")
|
|
21
|
-
@command.expects(:say).with("You must specify the definition name")
|
|
22
|
-
|
|
23
|
-
@command.expects(:say).with(EPC::Help::COMMAND_USAGES[:delete_serviceversion])
|
|
24
|
-
assert_equal(@command.execute("main_db"), 1)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
should "query core for service-version id and show a message if it can't be found" do
|
|
28
|
-
@command.expects(:ask_yn).returns("Y")
|
|
29
|
-
@mock_client.expects(:get)
|
|
30
|
-
@command.expects(:say).with("Service version not found.")
|
|
31
|
-
|
|
32
|
-
assert_equal(@command.execute("main_db", "definition"), 1)
|
|
33
|
-
end
|
|
34
12
|
|
|
35
13
|
should "fail if status is not 200" do
|
|
36
14
|
@command.expects(:ask_yn).returns("Y")
|
|
@@ -12,10 +12,10 @@ class DeleteSolutionCommandTest < Test::Unit::TestCase
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
should "fail if solution id can't be determined" do
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
assert_raise EPC::Error::FatalError do
|
|
16
|
+
@command.expects(:infer_solution_context).returns(nil)
|
|
17
|
+
assert_equal(@command.execute("FirstSolution"), 1)
|
|
18
|
+
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
@@ -9,13 +9,8 @@ class DeleteUserCommandTest < Test::Unit::TestCase
|
|
|
9
9
|
@command = EPC::Command::DeleteUserCommand.new(@mock_client)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
should "fail if no user is specified" do
|
|
13
|
-
assert_raise EPC::Error::FatalError do
|
|
14
|
-
assert_equal(@command.execute, 1)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
12
|
should "fail if status is not 200" do
|
|
13
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
19
14
|
@command.expects(:ask_yn).returns("Y")
|
|
20
15
|
@mock_client.expects(:delete).with(EPC::Config::USERS_PATH + "/1").
|
|
21
16
|
returns([404, {:message => "Not Found"}, {}])
|
|
@@ -23,17 +18,9 @@ class DeleteUserCommandTest < Test::Unit::TestCase
|
|
|
23
18
|
assert_equal(@command.execute(1), 404)
|
|
24
19
|
end
|
|
25
20
|
|
|
26
|
-
should "fail if user_id can't be determined" do
|
|
27
|
-
@command.expects(:ask_yn).returns("Y")
|
|
28
|
-
@command.expects(:get_resource_id).with(EPC::Config::USERS_PATH, :email, "admin").returns(nil)
|
|
29
|
-
assert_raise EPC::Error::FatalError do
|
|
30
|
-
assert_equal(@command.execute("admin"), 1)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
|
|
35
21
|
|
|
36
22
|
should "delete a user specified by id" do
|
|
23
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
37
24
|
@command.expects(:ask_yn).returns("Y")
|
|
38
25
|
@mock_client.expects(:delete).with(EPC::Config::USERS_PATH + "/1").
|
|
39
26
|
returns([200, {}, {}])
|
|
@@ -43,14 +30,5 @@ class DeleteUserCommandTest < Test::Unit::TestCase
|
|
|
43
30
|
end
|
|
44
31
|
|
|
45
32
|
|
|
46
|
-
should "delete a user specified by name" do
|
|
47
|
-
@command.expects(:ask_yn).returns("Y")
|
|
48
|
-
@command.expects(:get_resource_id).with(EPC::Config::USERS_PATH, :email, "admin").returns(1)
|
|
49
|
-
@mock_client.expects(:delete).with(EPC::Config::USERS_PATH + "/1").
|
|
50
|
-
returns([200, {}, {}])
|
|
51
|
-
@command.expects(:say).with("User deleted")
|
|
52
|
-
|
|
53
|
-
assert_equal(@command.execute("admin"), 200)
|
|
54
|
-
end
|
|
55
33
|
end
|
|
56
34
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
require 'test_helper'
|
|
2
2
|
|
|
3
|
-
class
|
|
3
|
+
class ListConfigsCommandTest < Test::Unit::TestCase
|
|
4
4
|
should_require_login
|
|
5
5
|
|
|
6
6
|
context "execution" do
|
|
7
7
|
should "fail if configuration context can't be determined" do
|
|
8
8
|
@mock_client = mock("Client")
|
|
9
|
-
@command = EPC::Command::
|
|
9
|
+
@command = EPC::Command::ListConfigsCommand.new(@mock_client)
|
|
10
10
|
@command.expects(:extract_configuration_level).returns(nil)
|
|
11
11
|
|
|
12
12
|
assert_raise EPC::Error::FatalError do
|
|
@@ -19,7 +19,7 @@ class ListConfigCommandTest < Test::Unit::TestCase
|
|
|
19
19
|
setup do
|
|
20
20
|
@mock_client = mock("Client")
|
|
21
21
|
@names_hash = {:solution => "S1", :project => "P1"}
|
|
22
|
-
@command = EPC::Command::
|
|
22
|
+
@command = EPC::Command::ListConfigsCommand.new(@mock_client)
|
|
23
23
|
@command.expects(:extract_configuration_level).returns(["User", 1])
|
|
24
24
|
end
|
|
25
25
|
|
|
@@ -11,92 +11,89 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
should "show exception message status is not 201" do
|
|
14
|
-
@command.
|
|
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]")
|
|
18
18
|
|
|
19
|
-
assert_equal(@command.execute, 400)
|
|
19
|
+
assert_equal(@command.execute("Solution:1"), 400)
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
should "show a message if there are no deployments" do
|
|
23
|
-
@command.
|
|
23
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
24
24
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
|
25
25
|
returns([200, {}, {}])
|
|
26
26
|
|
|
27
27
|
@command.expects(:say).returns("You have no deployments created.You can create them with epc create deployment.")
|
|
28
28
|
|
|
29
|
-
assert_equal(@command.execute, 200)
|
|
29
|
+
assert_equal(@command.execute("Solution:1"), 200)
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
should "list available deployments for solutions specified with name" do
|
|
33
|
-
@command.
|
|
34
|
-
@command.expects(:get_resource_id).with(EPC::Config::SOLUTIONS_PATH, :name, "FirstSolution").returns(1)
|
|
33
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
35
34
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
|
36
35
|
returns([200,
|
|
37
36
|
[
|
|
38
37
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
|
39
38
|
], {}])
|
|
40
39
|
@command.expects(:say).at_least_once
|
|
41
|
-
assert_equal(@command.execute, 200)
|
|
40
|
+
assert_equal(@command.execute("Solution:FirstSolution"), 200)
|
|
42
41
|
end
|
|
43
42
|
|
|
44
43
|
should "list available deployments for solutions specified with id" do
|
|
45
|
-
@command.
|
|
44
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
46
45
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
|
47
46
|
returns([200,
|
|
48
47
|
[
|
|
49
48
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
|
50
49
|
], {}])
|
|
51
50
|
@command.expects(:say).at_least_once
|
|
52
|
-
assert_equal(@command.execute, 200)
|
|
51
|
+
assert_equal(@command.execute("Solution:1"), 200)
|
|
53
52
|
end
|
|
54
53
|
|
|
55
54
|
|
|
56
55
|
should "list available deployments for stages specified with name" do
|
|
57
|
-
@command.
|
|
58
|
-
@command.expects(:get_resource_id).with(EPC::Config::DEPLOYMENT_STAGES_PATH, :name, "Development", :case_sensitivity => false).returns(1)
|
|
56
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
59
57
|
@mock_client.expects(:get).with(EPC::Config::DEPLOYMENT_STAGES_PATH + "/1/deployments").
|
|
60
58
|
returns([200,
|
|
61
59
|
[
|
|
62
60
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
|
63
61
|
], {}])
|
|
64
62
|
@command.expects(:say).at_least_once
|
|
65
|
-
assert_equal(@command.execute, 200)
|
|
63
|
+
assert_equal(@command.execute("DeploymentStage:Development"), 200)
|
|
66
64
|
end
|
|
67
65
|
|
|
68
66
|
should "list available deployments for stages specified with id" do
|
|
69
|
-
@command.
|
|
67
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
70
68
|
@mock_client.expects(:get).with(EPC::Config::DEPLOYMENT_STAGES_PATH + "/1/deployments").
|
|
71
69
|
returns([200,
|
|
72
70
|
[
|
|
73
71
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
|
74
72
|
], {}])
|
|
75
73
|
@command.expects(:say).at_least_once
|
|
76
|
-
assert_equal(@command.execute, 200)
|
|
74
|
+
assert_equal(@command.execute("DeploymentStage:1"), 200)
|
|
77
75
|
end
|
|
78
76
|
|
|
79
77
|
should "list available deployments for users specified with name" do
|
|
80
|
-
@command.
|
|
81
|
-
@command.expects(:get_resource_id).with(EPC::Config::USERS_PATH, :name, "Admin").returns(1)
|
|
78
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
82
79
|
@mock_client.expects(:get).with(EPC::Config::USERS_PATH + "/1/deployments").
|
|
83
80
|
returns([200,
|
|
84
81
|
[
|
|
85
82
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
|
86
83
|
], {}])
|
|
87
84
|
@command.expects(:say).at_least_once
|
|
88
|
-
assert_equal(@command.execute, 200)
|
|
85
|
+
assert_equal(@command.execute("User:Admin"), 200)
|
|
89
86
|
end
|
|
90
87
|
|
|
91
88
|
should "list available deployments for users specified with id" do
|
|
92
|
-
@command.
|
|
89
|
+
@command.expects(:retrieve_identifier_for).returns(1)
|
|
93
90
|
@mock_client.expects(:get).with(EPC::Config::USERS_PATH + "/1/deployments").
|
|
94
91
|
returns([200,
|
|
95
92
|
[
|
|
96
93
|
{:id => 1, :deployer_name => "deployer_name", :solution_name => "FirstSolution", :deployment_stage_name => "development", :status => "RUNNING"}
|
|
97
94
|
], {}])
|
|
98
95
|
@command.expects(:say).at_least_once
|
|
99
|
-
assert_equal(@command.execute, 200)
|
|
96
|
+
assert_equal(@command.execute("User:1"), 200)
|
|
100
97
|
end
|
|
101
98
|
|
|
102
99
|
should "try to determine solution context if no other option specified" do
|
|
@@ -105,7 +102,7 @@ class ListDeploymentsCommandTest < Test::Unit::TestCase
|
|
|
105
102
|
@mock_client.expects(:get).with(EPC::Config::SOLUTIONS_PATH + "/1/deployments").
|
|
106
103
|
returns([200, {}, {}])
|
|
107
104
|
@command.expects(:say).at_least_once
|
|
108
|
-
assert_equal(@command.execute, 200)
|
|
105
|
+
assert_equal(@command.execute(""), 200)
|
|
109
106
|
end
|
|
110
107
|
|
|
111
108
|
end
|