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.
Files changed (196) hide show
  1. data/lib/epc.rb +25 -5
  2. data/lib/epc/client/json_client.rb +4 -4
  3. data/lib/epc/command/archive_command.rb +7 -6
  4. data/lib/epc/command/attachto_command.rb +13 -0
  5. data/lib/epc/command/base_command.rb +120 -29
  6. data/lib/epc/command/config/create_config_command.rb +7 -11
  7. data/lib/epc/command/config/delete_config_command.rb +5 -5
  8. data/lib/epc/command/config/list_configs_command.rb +5 -5
  9. data/lib/epc/command/config/update_config_command.rb +11 -10
  10. data/lib/epc/command/copy_command.rb +14 -0
  11. data/lib/epc/command/create_command.rb +9 -5
  12. data/lib/epc/command/delete_command.rb +9 -9
  13. data/lib/epc/command/{copy_deployment_command.rb → deployment/copy_deployment_command.rb} +6 -5
  14. data/lib/epc/command/deployment/create_deployment_command.rb +15 -15
  15. data/lib/epc/command/deployment/list_deployments_command.rb +2 -4
  16. data/lib/epc/command/deployment/show_deployment_command.rb +5 -7
  17. data/lib/epc/command/deployment/submit_deployment_command.rb +15 -0
  18. data/lib/epc/command/deployment/update_deployment_command.rb +5 -14
  19. data/lib/epc/command/deployment/vote_deployment_command.rb +23 -0
  20. data/lib/epc/command/deploymentstage/list_deploymentstages_command.rb +1 -1
  21. data/lib/epc/command/detachfrom_command.rb +13 -0
  22. data/lib/epc/command/group/create_group_command.rb +3 -3
  23. data/lib/epc/command/group/delete_group_command.rb +4 -5
  24. data/lib/epc/command/group/show_group_command.rb +2 -3
  25. data/lib/epc/command/group/update_group_command.rb +9 -7
  26. data/lib/epc/command/library/create_library_command.rb +1 -2
  27. data/lib/epc/command/library/delete_library_command.rb +4 -5
  28. data/lib/epc/command/library/list_libraries_command.rb +1 -1
  29. data/lib/epc/command/librarylanguage/create_librarylanguage_command.rb +1 -1
  30. data/lib/epc/command/librarylanguage/delete_librarylanguage_command.rb +3 -5
  31. data/lib/epc/command/librarylanguage/list_librarylanguages_command.rb +1 -1
  32. data/lib/epc/command/librarylanguage/update_librarylanguage_command.rb +4 -5
  33. data/lib/epc/command/libraryset/create_libraryset_command.rb +5 -4
  34. data/lib/epc/command/libraryset/delete_libraryset_command.rb +4 -6
  35. data/lib/epc/command/libraryset/list_librarysets_command.rb +2 -2
  36. data/lib/epc/command/libraryset/show_libraryset_command.rb +3 -3
  37. data/lib/epc/command/libraryset/update_libraryset_command.rb +4 -3
  38. data/lib/epc/command/list_command.rb +10 -14
  39. data/lib/epc/command/list_objecttypes_command.rb +1 -1
  40. data/lib/epc/command/objectrole/create_objectrole_command.rb +4 -5
  41. data/lib/epc/command/objectrole/list_objectroles_command.rb +3 -8
  42. data/lib/epc/command/objectrole/update_objectrole_command.rb +3 -1
  43. data/lib/epc/command/permission/list_permissions_command.rb +1 -1
  44. data/lib/epc/command/permissiongroup/list_permissiongroups_command.rb +1 -1
  45. data/lib/epc/command/plugin/create_plugin_command.rb +1 -2
  46. data/lib/epc/command/plugin/delete_plugin_command.rb +4 -6
  47. data/lib/epc/command/plugin/list_plugins_command.rb +1 -1
  48. data/lib/epc/command/plugin/show_plugin_command.rb +2 -5
  49. data/lib/epc/command/plugin/update_plugin_command.rb +2 -6
  50. data/lib/epc/command/project/archive_project_command.rb +3 -12
  51. data/lib/epc/command/project/attachto_project_command.rb +133 -0
  52. data/lib/epc/command/project/create_project_command.rb +6 -6
  53. data/lib/epc/command/project/delete_project_command.rb +3 -24
  54. data/lib/epc/command/project/detachfrom_project_command.rb +66 -0
  55. data/lib/epc/command/project/list_projects_command.rb +12 -7
  56. data/lib/epc/command/project/show_project_command.rb +26 -25
  57. data/lib/epc/command/project/show_project_snapshot_command.rb +41 -0
  58. data/lib/epc/command/project/unarchive_project_command.rb +3 -10
  59. data/lib/epc/command/project/update_project_command.rb +5 -18
  60. data/lib/epc/command/projecttype/create_projecttype_command.rb +37 -0
  61. data/lib/epc/command/projecttype/delete_projecttype_command.rb +24 -0
  62. data/lib/epc/command/projecttype/list_projecttypes_command.rb +1 -1
  63. data/lib/epc/command/projecttype/show_projecttype_command.rb +2 -4
  64. data/lib/epc/command/projecttype/update_projecttype_command.rb +61 -0
  65. data/lib/epc/command/push_command.rb +14 -8
  66. data/lib/epc/command/role/create_role_command.rb +26 -3
  67. data/lib/epc/command/role/delete_role_command.rb +3 -5
  68. data/lib/epc/command/role/list_roles_command.rb +7 -3
  69. data/lib/epc/command/role/show_role_command.rb +8 -5
  70. data/lib/epc/command/role/update_role_command.rb +14 -66
  71. data/lib/epc/command/runtime/create_runtime_command.rb +34 -0
  72. data/lib/epc/command/runtime/delete_runtime_command.rb +24 -0
  73. data/lib/epc/command/runtime/list_runtimes_command.rb +2 -2
  74. data/lib/epc/command/runtime/update_runtime_command.rb +49 -0
  75. data/lib/epc/command/runtimetype/list_runtimetypes_command.rb +17 -0
  76. data/lib/epc/command/servicedefinition/create_servicedefinition_command.rb +5 -6
  77. data/lib/epc/command/servicedefinition/delete_servicedefinition_command.rb +18 -0
  78. data/lib/epc/command/servicedefinition/list_servicedefinitions_command.rb +2 -2
  79. data/lib/epc/command/servicetype/list_servicetypes_command.rb +1 -1
  80. data/lib/epc/command/serviceversion/create_serviceversion_command.rb +8 -12
  81. data/lib/epc/command/serviceversion/delete_serviceversion_command.rb +3 -5
  82. data/lib/epc/command/serviceversion/list_serviceversions_command.rb +8 -1
  83. data/lib/epc/command/show_command.rb +8 -9
  84. data/lib/epc/command/show_metrics_command.rb +3 -3
  85. data/lib/epc/command/solution/archive_solution_command.rb +3 -10
  86. data/lib/epc/command/solution/create_solution_command.rb +2 -2
  87. data/lib/epc/command/solution/delete_solution_command.rb +3 -7
  88. data/lib/epc/command/solution/list_solutions_command.rb +11 -3
  89. data/lib/epc/command/solution/show_solution_command.rb +4 -6
  90. data/lib/epc/command/solution/unarchive_solution_command.rb +3 -8
  91. data/lib/epc/command/solution/update_solution_command.rb +4 -6
  92. data/lib/epc/command/submit_command.rb +16 -0
  93. data/lib/epc/command/unarchive_command.rb +7 -6
  94. data/lib/epc/command/update_command.rb +9 -8
  95. data/lib/epc/command/user/create_user_command.rb +2 -3
  96. data/lib/epc/command/user/delete_user_command.rb +3 -5
  97. data/lib/epc/command/user/list_users_command.rb +1 -1
  98. data/lib/epc/command/user/show_user_command.rb +2 -4
  99. data/lib/epc/command/user/update_user_command.rb +3 -14
  100. data/lib/epc/command/userproperty/list_user_properties_command.rb +23 -0
  101. data/lib/epc/command/vote_command.rb +16 -0
  102. data/lib/epc/config.rb +7 -1
  103. data/lib/epc/help.rb +51 -48
  104. data/lib/epc/modules/config.rb +39 -0
  105. data/lib/epc/modules/role.rb +133 -0
  106. data/lib/epc/runner.rb +23 -12
  107. data/lib/epc/version.rb +1 -1
  108. data/test/command/archive_project_command_test.rb +2 -13
  109. data/test/command/archive_solution_command_test.rb +4 -14
  110. data/test/command/copy_deployment_command_test.rb +4 -8
  111. data/test/command/create_config_command_test.rb +23 -23
  112. data/test/command/create_deployment_command_test.rb +33 -32
  113. data/test/command/create_group_command_test.rb +2 -2
  114. data/test/command/create_library_command_test.rb +6 -6
  115. data/test/command/create_librarylanguage_command_test.rb +3 -3
  116. data/test/command/create_libraryset_command_test.rb +6 -26
  117. data/test/command/create_objectrole_command_test.rb +4 -13
  118. data/test/command/create_project_command_test.rb +27 -13
  119. data/test/command/create_role_command_test.rb +3 -2
  120. data/test/command/create_runtime_command_test.rb +37 -0
  121. data/test/command/create_servicedefinition_command_test.rb +4 -17
  122. data/test/command/create_serviceversion_command_test.rb +8 -22
  123. data/test/command/create_solution_command_test.rb +5 -5
  124. data/test/command/create_user_command_test.rb +4 -4
  125. data/test/command/delete_config_command_test.rb +8 -15
  126. data/test/command/delete_library_command_test.rb +3 -4
  127. data/test/command/delete_librarylanguage_command_test.rb +3 -4
  128. data/test/command/delete_libraryset_command_test.rb +3 -4
  129. data/test/command/delete_plugin_command_test.rb +3 -4
  130. data/test/command/delete_project_command_test.rb +2 -10
  131. data/test/command/delete_projecttype_command_test.rb +31 -0
  132. data/test/command/delete_role_command_test.rb +5 -14
  133. data/test/command/delete_runtime_command_test.rb +31 -0
  134. data/test/command/delete_servicedefinition_command_test.rb +31 -0
  135. data/test/command/delete_serviceversion_command_test.rb +3 -2
  136. data/test/command/delete_solution_command_test.rb +3 -16
  137. data/test/command/delete_user_command_test.rb +3 -3
  138. data/test/command/list_config_command_test.rb +1 -0
  139. data/test/command/list_deployments_command_test.rb +11 -41
  140. data/test/command/list_objectroles_command_test.rb +4 -14
  141. data/test/command/list_projects_command_test.rb +0 -14
  142. data/test/command/list_roles_command_test.rb +3 -1
  143. data/test/command/list_runtimes_command_test.rb +2 -3
  144. data/test/command/list_runtimetypes_command_test.rb +29 -0
  145. data/test/command/list_userproperties_command_test.rb +33 -0
  146. data/test/command/push_command_test.rb +9 -1
  147. data/test/command/show_deployment_command_test.rb +36 -0
  148. data/test/command/show_group_command_test.rb +2 -1
  149. data/test/command/show_libraryset_command_test.rb +5 -3
  150. data/test/command/show_metrics_command_test.rb +4 -4
  151. data/test/command/show_plugin_command_test.rb +4 -4
  152. data/test/command/show_project_command_test.rb +5 -17
  153. data/test/command/show_project_snapshot_test.rb +33 -0
  154. data/test/command/show_projecttype_command_test.rb +5 -11
  155. data/test/command/show_role_command_test.rb +5 -12
  156. data/test/command/show_solution_command_test.rb +2 -15
  157. data/test/command/show_user_command_test.rb +4 -3
  158. data/test/command/submit_deployment_command_test.rb +4 -11
  159. data/test/command/unarchive_project_command_test.rb +2 -14
  160. data/test/command/unarchive_solution_command_test.rb +6 -16
  161. data/test/command/update_config_command_test.rb +14 -3
  162. data/test/command/update_deployment_command_test.rb +12 -26
  163. data/test/command/update_group_command_test.rb +2 -10
  164. data/test/command/update_librarylanguage_command_test.rb +5 -3
  165. data/test/command/update_libraryset_command_test.rb +4 -2
  166. data/test/command/update_plugin_command_test.rb +5 -4
  167. data/test/command/update_project_command_test.rb +6 -20
  168. data/test/command/update_role_command_test.rb +11 -8
  169. data/test/command/update_solution_command_test.rb +6 -12
  170. data/test/command/update_user_command_test.rb +3 -19
  171. data/test/command/vote_deployment_command_test.rb +2 -6
  172. metadata +66 -63
  173. data/lib/epc/command/attach_library_command.rb +0 -82
  174. data/lib/epc/command/attach_libraryset_command.rb +0 -31
  175. data/lib/epc/command/attach_runtime_command.rb +0 -26
  176. data/lib/epc/command/bind_service_command.rb +0 -35
  177. data/lib/epc/command/create_dependency_command.rb +0 -43
  178. data/lib/epc/command/dependency/delete_dependency_command.rb +0 -38
  179. data/lib/epc/command/detach_library_command.rb +0 -35
  180. data/lib/epc/command/detach_libraryset_command.rb +0 -8
  181. data/lib/epc/command/list_versions_command.rb +0 -38
  182. data/lib/epc/command/submit_deployment_command.rb +0 -19
  183. data/lib/epc/command/unbind_service_command.rb +0 -42
  184. data/lib/epc/command/undefine_service_command.rb +0 -33
  185. data/lib/epc/command/update_rolepermissions_command.rb +0 -83
  186. data/lib/epc/command/vote_deployment_command.rb +0 -29
  187. data/test/command/attach_library_command_test.rb +0 -124
  188. data/test/command/attach_libraryset_command_test.rb +0 -49
  189. data/test/command/attach_runtime_command_test.rb +0 -44
  190. data/test/command/bind_service_command_test.rb +0 -46
  191. data/test/command/create_dependency_command_test.rb +0 -55
  192. data/test/command/create_plugin_command_test.rb +0 -44
  193. data/test/command/delete_dependency_command_test.rb +0 -42
  194. data/test/command/detach_library_command_test.rb +0 -53
  195. data/test/command/unbind_service_command_test.rb +0 -48
  196. data/test/command/undefine_service_command_test.rb +0 -49
@@ -21,7 +21,7 @@ class CreateSolutionCommandTest < Test::Unit::TestCase
21
21
  command.expects(:mkdir).with("FirstSolution").returns(:ok)
22
22
  command.expects(:say).with("Successfully created the solution with [http://localhost:3000] and created your local directory.")
23
23
 
24
- assert_equal(command.execute("", "FirstSolution"), 201)
24
+ assert_equal(command.execute(["FirstSolution"]), 201)
25
25
  end
26
26
 
27
27
  should "not create the solution directory if --nodir options specified" do
@@ -32,7 +32,7 @@ class CreateSolutionCommandTest < Test::Unit::TestCase
32
32
  command.expects(:mkdir).never
33
33
  command.expects(:say).with("Successfully created the solution with [http://localhost:3000].")
34
34
 
35
- assert_equal(command.execute("", "FirstSolution"), 201)
35
+ assert_equal(command.execute(["FirstSolution"]), 201)
36
36
 
37
37
  end
38
38
 
@@ -46,7 +46,7 @@ class CreateSolutionCommandTest < Test::Unit::TestCase
46
46
  command.expects(:say).with("Failed to create local directory [Test Solution] - [unknown error - File exists - Test Solution]")
47
47
  command.expects(:say).with("Successfully created the solution with [http://localhost:3000], but FAILED to create your local directory.")
48
48
 
49
- assert_equal(command.execute("", "Test Solution"), 1)
49
+ assert_equal(command.execute(["Test Solution"]), 1)
50
50
  end
51
51
 
52
52
  should "report failure if the status is not 201" do
@@ -55,7 +55,7 @@ class CreateSolutionCommandTest < Test::Unit::TestCase
55
55
  @mock_client.expects(:post).with("/api/v1/solutions", { :name => "Test Solution" }).returns([400, { :message => "Bad Request" }, {}])
56
56
  command.expects(:say).with("Solution creation failed [Bad Request].")
57
57
 
58
- assert_equal(command.execute("", "Test Solution"), 400)
58
+ assert_equal(command.execute(["Test Solution"]), 400)
59
59
  end
60
60
 
61
61
  should "report error is the call throws an exception" do
@@ -64,7 +64,7 @@ class CreateSolutionCommandTest < Test::Unit::TestCase
64
64
  @mock_client.expects(:post).with("/api/v1/solutions", { :name => "Test Solution" }).raises(StandardError.new("failed"))
65
65
  command.expects(:say).with("Solution creation failed [failed].")
66
66
 
67
- assert_equal(command.execute("", "Test Solution"), 1)
67
+ assert_equal(command.execute(["Test Solution"]), 1)
68
68
  end
69
69
  end
70
70
  end
@@ -15,7 +15,7 @@ class CreateUserCommandTest < Test::Unit::TestCase
15
15
 
16
16
  @mock_client.expects(:post).with("/api/v1/users", { :email => 'me@there.com', :password => 'testpass' }).returns(201, {}, {})
17
17
 
18
- assert_equal(command.execute("", "me@there.com"), 201)
18
+ assert_equal(command.execute(["me@there.com"]), 201)
19
19
  end
20
20
 
21
21
  should "report failure if email was not provided" do
@@ -23,7 +23,7 @@ class CreateUserCommandTest < Test::Unit::TestCase
23
23
  command.expects(:ask).with("Password: ").never
24
24
  @mock_client.expects(:post).never
25
25
  assert_raise EPC::Error::FatalError do
26
- assert_equal(command.execute(""), 1)
26
+ assert_equal(command.execute([]), 1)
27
27
  end
28
28
  end
29
29
 
@@ -35,7 +35,7 @@ class CreateUserCommandTest < Test::Unit::TestCase
35
35
  returns([201, { :id => 1, :caller_id => '123' }, {}])
36
36
  command.expects(:say).with("Successfully created the user with [http://localhost:3000]")
37
37
 
38
- assert_equal(command.execute("", "me@there.com"), 201)
38
+ assert_equal(command.execute(["me@there.com"]), 201)
39
39
  end
40
40
 
41
41
  should "report error if status is not 201" do
@@ -46,7 +46,7 @@ class CreateUserCommandTest < Test::Unit::TestCase
46
46
  returns([400, { :message => "Bad Request" }, {}])
47
47
  command.expects(:say).with("User creation failed [Bad Request].")
48
48
 
49
- assert_equal(command.execute("", "me@there.com"), 400)
49
+ assert_equal(command.execute(["me@there.com"]), 400)
50
50
  end
51
51
 
52
52
 
@@ -7,7 +7,9 @@ class DeleteConfigCommandTest < Test::Unit::TestCase
7
7
  context "valid commands" do
8
8
  setup do
9
9
  @mock_client = mock("Client")
10
+ EPC::Command::DeleteConfigCommand.send :include, EPC::Command::Config
10
11
  @command = EPC::Command::DeleteConfigCommand.new(@mock_client)
12
+ @command.object_id = "key1"
11
13
  end
12
14
 
13
15
  should "query the server for key id" do
@@ -15,17 +17,7 @@ class DeleteConfigCommandTest < Test::Unit::TestCase
15
17
  @mock_client.expects(:get).with(EPC::Config::CONFIGURATIONS_PATH + "/Project/1").
16
18
  returns([200, {:name => "key1", :id => 1}, {}])
17
19
  @command.expects(:say).with("key1 is not defined.")
18
- @command.execute("key1")
19
- end
20
-
21
- should "fail if querying the server fails" do
22
- assert_raise EPC::Error::FatalError do
23
- @command.options[:stage_name] = "Development"
24
- @command.expects(:extract_configuration_level).returns(["Project", 1])
25
- @mock_client.expects(:get).with(EPC::Config::CONFIGURATIONS_PATH + "/Project/1/Development").
26
- returns([404, {:message => "Not Found"}, {}])
27
- @command.execute("key1")
28
- end
20
+ @command.execute
29
21
  end
30
22
 
31
23
  should "notify if there are no keys defined" do
@@ -33,15 +25,16 @@ class DeleteConfigCommandTest < Test::Unit::TestCase
33
25
  @mock_client.expects(:get).with(EPC::Config::CONFIGURATIONS_PATH + "/Project/1").
34
26
  returns([200, {}, {}])
35
27
  @command.expects(:say).with("There are no configurations defined for this project.")
36
- @command.execute("key1")
28
+ @command.execute
37
29
  end
38
30
 
39
31
  should "notify user if key does not exist" do
32
+ @command.object_id = "key2"
40
33
  @command.expects(:extract_configuration_level).returns(["Project", 1])
41
34
  @mock_client.expects(:get).with(EPC::Config::CONFIGURATIONS_PATH + "/Project/1").
42
35
  returns([200, {:name => "key1", :id => 1}, {}])
43
36
  @command.expects(:say).with("key2 is not defined.")
44
- @command.execute("key2")
37
+ @command.execute
45
38
  end
46
39
 
47
40
  should "delete specified key" do
@@ -52,7 +45,7 @@ class DeleteConfigCommandTest < Test::Unit::TestCase
52
45
  @mock_client.expects(:delete).with(EPC::Config::CONFIGURATIONS_PATH + "/1").
53
46
  returns([200, {}, {}])
54
47
  @command.expects(:say).with("key1 succesfully removed.")
55
- @command.execute("key1")
48
+ @command.execute
56
49
  end
57
50
 
58
51
  should "notify when removal fails" do
@@ -63,7 +56,7 @@ class DeleteConfigCommandTest < Test::Unit::TestCase
63
56
  @mock_client.expects(:delete).with(EPC::Config::CONFIGURATIONS_PATH + "/1").
64
57
  returns([500, {:message => "System Exception"}, {}])
65
58
  @command.expects(:say).with("Request failed: [System Exception]")
66
- @command.execute("key1")
59
+ @command.execute
67
60
  end
68
61
  end
69
62
 
@@ -7,11 +7,12 @@ class DeleteLibraryCommandTest < Test::Unit::TestCase
7
7
  setup do
8
8
  @mock_client = mock("Client")
9
9
  @command = EPC::Command::DeleteLibraryCommand.new(@mock_client)
10
+ @command.object_id = 1
11
+ @command.object_type = "Library"
12
+ @command.expects(:ask_yn).returns("Y")
10
13
  end
11
14
 
12
15
  should "fail if status is not 200" do
13
- @command.expects(:retrieve_identifier_for).returns(1)
14
- @command.expects(:ask_yn).returns("Y")
15
16
  @mock_client.expects(:delete).with(EPC::Config::LIBRARIES_PATH + "/1").returns([404, {:message => "Not Found"}, {}])
16
17
  @command.expects(:say).with("Request failed: [Not Found]")
17
18
 
@@ -19,8 +20,6 @@ class DeleteLibraryCommandTest < Test::Unit::TestCase
19
20
  end
20
21
 
21
22
  should "delete a library" do
22
- @command.expects(:retrieve_identifier_for).returns(1)
23
- @command.expects(:ask_yn).returns("Y")
24
23
  @mock_client.expects(:delete).with(EPC::Config::LIBRARIES_PATH + "/1").returns([200, {}, {}])
25
24
  @command.expects(:say).with("Library deleted")
26
25
 
@@ -7,11 +7,12 @@ class DeleteLibrarylanguageCommandTest < Test::Unit::TestCase
7
7
  setup do
8
8
  @mock_client = mock("Client")
9
9
  @command = EPC::Command::DeleteLibrarylanguageCommand.new(@mock_client)
10
+ @command.expects(:ask_yn).returns("Y")
11
+ @command.object_id = 1
12
+ @command.object_type = "LibraryLanguage"
10
13
  end
11
14
 
12
15
  should "fail if status is not 200" do
13
- @command.expects(:retrieve_identifier_for).returns(1)
14
- @command.expects(:ask_yn).returns("Y")
15
16
  @mock_client.expects(:delete).with(EPC::Config::LIBRARY_LANGUAGES_PATH + "/1").
16
17
  returns([404, {:message => "Not Found"}, {}])
17
18
  @command.expects(:say).with("Request failed: [Not Found]")
@@ -20,8 +21,6 @@ class DeleteLibrarylanguageCommandTest < Test::Unit::TestCase
20
21
 
21
22
 
22
23
  should "delete a language specified by id" do
23
- @command.expects(:retrieve_identifier_for).returns(1)
24
- @command.expects(:ask_yn).returns("Y")
25
24
  @mock_client.expects(:delete).with(EPC::Config::LIBRARY_LANGUAGES_PATH + "/1").
26
25
  returns([200, {}, {}])
27
26
  @command.expects(:say).with("Language deleted")
@@ -7,12 +7,13 @@ class DeleteLibrarysetCommand < Test::Unit::TestCase
7
7
  setup do
8
8
  @mock_client = mock("Client")
9
9
  @command = EPC::Command::DeleteLibrarysetCommand.new(@mock_client)
10
+ @command.expects(:ask_yn).returns("Y")
11
+ @command.object_id = 1
12
+ @command.object_type = "LibrarySet"
10
13
  end
11
14
 
12
15
 
13
16
  should "fail if status is not 200" do
14
- @command.expects(:retrieve_identifier_for).returns(1)
15
- @command.expects(:ask_yn).returns("Y")
16
17
  @mock_client.expects(:delete).with(EPC::Config::LIBRARY_SETS_PATH + "/1").
17
18
  returns([404, {:message => "Not Found"}, {}])
18
19
  @command.expects(:say).with("Request failed: [Not Found]")
@@ -21,8 +22,6 @@ class DeleteLibrarysetCommand < Test::Unit::TestCase
21
22
 
22
23
 
23
24
  should "delete a set specified by id" do
24
- @command.expects(:retrieve_identifier_for).returns(1)
25
- @command.expects(:ask_yn).returns("Y")
26
25
  @mock_client.expects(:delete).with(EPC::Config::LIBRARY_SETS_PATH + "/1").
27
26
  returns([200, {}, {}])
28
27
  @command.expects(:say).with("Set deleted")
@@ -7,11 +7,12 @@ class DeletePluginCommandTest < Test::Unit::TestCase
7
7
  setup do
8
8
  @mock_client = mock("Client")
9
9
  @command = EPC::Command::DeletePluginCommand.new(@mock_client)
10
+ @command.object_id = 1
11
+ @command.object_type = "Plugin"
12
+ @command.expects(:ask_yn).returns("Y")
10
13
  end
11
14
 
12
15
  should "fail if status is not 200" do
13
- @command.expects(:retrieve_identifier_for).returns(1)
14
- @command.expects(:ask_yn).returns("Y")
15
16
  @mock_client.expects(:delete).with(EPC::Config::PLUGINS_PATH + "/1").
16
17
  returns([404, {:message => "Not Found"}, {}])
17
18
  @command.expects(:say).with("Request failed: [Not Found]")
@@ -20,8 +21,6 @@ class DeletePluginCommandTest < Test::Unit::TestCase
20
21
 
21
22
 
22
23
  should "delete a plugin specified by id" do
23
- @command.expects(:retrieve_identifier_for).returns(1)
24
- @command.expects(:ask_yn).returns("Y")
25
24
  @mock_client.expects(:delete).with(EPC::Config::PLUGINS_PATH + "/1").
26
25
  returns([200, {}, {}])
27
26
  @command.expects(:say).with("Plugin deleted")
@@ -4,19 +4,13 @@ require 'shoulda'
4
4
  require 'mocha'
5
5
 
6
6
  class DeleteProjectCommandTest < Test::Unit::TestCase
7
- context "pre-execution checks" do
8
- setup do
9
- @mock_client = mock("Client")
10
- @command = EPC::Command::DeleteProjectCommand.new(@mock_client)
11
- end
12
7
 
13
- end
14
8
  context "deletion" do
15
9
  setup do
16
10
  @mock_client = mock("Client")
17
11
  @command = EPC::Command::DeleteProjectCommand.new(@mock_client)
18
- @command.expects(:infer_solution_context).returns([1, "FirstSolution"])
19
- @command.expects(:infer_project_context).returns([1, "FirstProject"])
12
+ @command.object_id = 1
13
+ @command.object_type = "Project"
20
14
  @command.expects(:ask_yn).returns("y")
21
15
  end
22
16
 
@@ -31,8 +25,6 @@ class DeleteProjectCommandTest < Test::Unit::TestCase
31
25
  should "delete the project" do
32
26
  @mock_client.expects(:delete).with(EPC::Config::PROJECTS_PATH + "/1").
33
27
  returns([200, {}, {}])
34
- EPC::Config.expects(:is_project_dir?).returns(true)
35
- @command.expects(:remove_project_metadata).with(File.expand_path("."), "FirstProject")
36
28
 
37
29
  @command.expects(:say).with("Project deleted.")
38
30
  assert_equal(@command.execute, 200)
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class DeleteProjecttypeCommandTest < Test::Unit::TestCase
4
+ should_require_login
5
+
6
+ context "execute" do
7
+ setup do
8
+ @mock_client = mock("Client")
9
+ @command = EPC::Command::DeleteProjecttypeCommand.new(@mock_client)
10
+ @command.object_id = 1
11
+ @command.object_type = "ProjectType"
12
+ @command.expects(:ask_yn).returns("Y")
13
+ end
14
+
15
+ should "fail if status is not 200" do
16
+ @mock_client.expects(:delete).with(EPC::Config::PROJECT_TYPES_PATH + "/1").
17
+ returns([404, {:message => "Not Found"}, {}])
18
+ @command.expects(:say).with("Request failed: [Not Found]")
19
+ assert_equal(@command.execute(1), 404)
20
+ end
21
+
22
+
23
+ should "delete a project type" do
24
+ @mock_client.expects(:delete).with(EPC::Config::PROJECT_TYPES_PATH + "/1").
25
+ returns([200, {}, {}])
26
+ @command.expects(:say).with("Project type deleted")
27
+
28
+ assert_equal(@command.execute(1), 200)
29
+ end
30
+ end
31
+ end
@@ -7,35 +7,26 @@ class DeleteRoleCommandTest < Test::Unit::TestCase
7
7
  setup do
8
8
  @mock_client = mock("Client")
9
9
  @command = EPC::Command::DeleteRoleCommand.new(@mock_client)
10
+ @command.object_id = 1
11
+ @command.object_type = "Role"
12
+ @command.expects(:ask_yn).returns("Y")
10
13
  end
11
14
 
12
15
  should "fail if status is not 200" do
13
- @command.expects(:ask_yn).returns("Y")
14
16
  @mock_client.expects(:delete).with(EPC::Config::ROLES_PATH + "/1/system/true").
15
17
  returns([404, {:message => "Not Found"}, {}])
16
18
  @command.expects(:say).with("Request failed: [Not Found]")
17
- assert_equal(@command.execute(1), 404)
19
+ assert_equal(@command.execute, 404)
18
20
  end
19
21
 
20
22
 
21
23
  should "delete a role specified by id" do
22
- @command.expects(:ask_yn).returns("Y")
23
24
  @mock_client.expects(:delete).with(EPC::Config::ROLES_PATH + "/1/system/true").
24
25
  returns([200, {}, {}])
25
26
  @command.expects(:say).with("Role deleted")
26
27
 
27
- assert_equal(@command.execute(1), 200)
28
+ assert_equal(@command.execute, 200)
28
29
  end
29
30
 
30
-
31
- should "delete a role specified by name" do
32
- @command.expects(:ask_yn).returns("Y")
33
- @command.expects(:retrieve_identifier_for).returns(1)
34
- @mock_client.expects(:delete).with(EPC::Config::ROLES_PATH + "/1/system/true").
35
- returns([200, {}, {}])
36
- @command.expects(:say).with("Role deleted")
37
-
38
- assert_equal(@command.execute("admins"), 200)
39
- end
40
31
  end
41
32
  end
@@ -0,0 +1,31 @@
1
+ require 'test_helper'
2
+
3
+ class DeleteRuntimeCommandTest < Test::Unit::TestCase
4
+ should_require_login
5
+
6
+ context "execute" do
7
+ setup do
8
+ @mock_client = mock("Client")
9
+ @command = EPC::Command::DeleteRuntimeCommand.new(@mock_client)
10
+ @command.object_id = 1
11
+ @command.object_type = "Runtime"
12
+ @command.expects(:ask_yn).returns("Y")
13
+ end
14
+
15
+ should "fail if status is not 200" do
16
+ @mock_client.expects(:delete).with(EPC::Config::RUNTIMES_PATH + "/1").
17
+ returns([404, {:message => "Not Found"}, {}])
18
+ @command.expects(:say).with("Request failed: [Not Found]")
19
+ assert_equal(@command.execute(1), 404)
20
+ end
21
+
22
+
23
+ should "delete a runtime specified by id" do
24
+ @mock_client.expects(:delete).with(EPC::Config::RUNTIMES_PATH + "/1").
25
+ returns([200, {}, {}])
26
+ @command.expects(:say).with("Runtime deleted")
27
+
28
+ assert_equal(@command.execute(1), 200)
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ require File.expand_path "../../../lib/epc", __FILE__
2
+ require "test/unit"
3
+ require 'shoulda'
4
+ require 'mocha'
5
+
6
+ class DeleteServicedefinitionCommandTest < Test::Unit::TestCase
7
+ should_require_login
8
+
9
+ context "execution" do
10
+ setup do
11
+ @mock_client = mock('Client')
12
+ @command = EPC::Command::DeleteServicedefinitionCommand.new(@mock_client)
13
+ @command.object_id = 1
14
+ @command.object_type = "ServiceDefinition"
15
+ end
16
+
17
+
18
+ should "fail if status is not 201" do
19
+ @mock_client.expects(:delete).with(EPC::Config::SERVICE_DEFINITIONS_PATH + "/1").returns([400, {:message => 'Not Found'}])
20
+ @command.expects(:say).with("Request failed: [Not Found]")
21
+ assert_equal(@command.execute, 400)
22
+ end
23
+
24
+ should "undefine a service" do
25
+ @mock_client.expects(:delete).with(EPC::Config::SERVICE_DEFINITIONS_PATH + "/1").returns([200, {'id' => 1}])
26
+ @command.expects(:say).with("Service definition deleted")
27
+ assert_equal(@command.execute, 200)
28
+ end
29
+ end
30
+ end
31
+
@@ -7,11 +7,13 @@ class DeleteServiceversionCommandTest < Test::Unit::TestCase
7
7
  setup do
8
8
  @mock_client = mock("Client")
9
9
  @command = EPC::Command::DeleteServiceversionCommand.new(@mock_client)
10
+ @command.object_id = 1
11
+ @command.object_type = "ServiceVersion"
12
+ @command.expects(:ask_yn).returns("Y")
10
13
  end
11
14
 
12
15
 
13
16
  should "fail if status is not 200" do
14
- @command.expects(:ask_yn).returns("Y")
15
17
  @mock_client.expects(:delete).with(EPC::Config::SERVICE_VERSIONS_PATH + "/1").
16
18
  returns([404, {:message => "Not Found"}, {}])
17
19
 
@@ -20,7 +22,6 @@ class DeleteServiceversionCommandTest < Test::Unit::TestCase
20
22
  end
21
23
 
22
24
  should "delete the service version from core" do
23
- @command.expects(:ask_yn).returns("Y")
24
25
  @mock_client.expects(:delete).with(EPC::Config::SERVICE_VERSIONS_PATH + "/1").
25
26
  returns([200, {}, {}])
26
27
 
@@ -4,27 +4,14 @@ require 'shoulda'
4
4
  require 'mocha'
5
5
 
6
6
  class DeleteSolutionCommandTest < Test::Unit::TestCase
7
- context "pre-execution checks" do
8
-
9
- setup do
10
- @mock_client = mock("Client")
11
- @command = EPC::Command::DeleteSolutionCommand.new(@mock_client)
12
- end
13
-
14
- should "fail if solution id can't be determined" do
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
- end
20
- end
21
7
 
22
8
  context "deletion" do
23
9
  setup do
24
10
  @mock_client = mock("Client")
25
11
  @command = EPC::Command::DeleteSolutionCommand.new(@mock_client)
26
- @command.expects(:infer_solution_context).returns([1, "FirstSolution"])
27
- @command.expects(:ask).returns("y")
12
+ @command.object_id = 1
13
+ @command.object_type = "Solution"
14
+ @command.expects(:ask_yn).returns("y")
28
15
  end
29
16
 
30
17
  should "fail if status is not 201" do