4242 * @author Eric Bottard
4343 * @author Glenn Renfro
4444 * @author David Turanski
45+ * @author Gunnar Hillert
4546 */
4647@ FixMethodOrder (MethodSorters .NAME_ASCENDING )
4748public class TaskExecutionsDocumentation extends BaseDocumentation {
@@ -79,21 +80,48 @@ public void launchTask() throws Exception {
7980 }
8081
8182 @ Test
82- public void stopTask () throws Exception {
83+ public void launchTaskCurrentCount () throws Exception {
8384 this .mockMvc .perform (
84- post ("/tasks/executions" )
85- .param ("name" , "taskA" )
86- .param ("properties" , "app.my-task.foo=bar,deployer.my-task.something-else=3" )
87- .param ("arguments" , "--server.port=8080 --foo=bar" ))
88- .andExpect (status ().isCreated ());
85+ get ("/tasks/executions/current" ))
86+ .andDo (print ())
87+ .andExpect (status ().isOk ())
88+ .andDo (this .documentationHandler .document (
89+ responseFields (
90+ fieldWithPath ("[].name" ).description ("The name of the platform instance (account)" ),
91+ fieldWithPath ("[].type" ).description ("The platform type" ),
92+ fieldWithPath ("[].maximumTaskExecutions" ).description ("The number of maximum task execution" ),
93+ fieldWithPath ("[].runningExecutionCount" ).description ("The number of running executions" )
94+ )
95+ ));
96+ }
97+
98+ @ Test
99+ public void launchTaskDisplayDetail () throws Exception {
89100 this .mockMvc .perform (
90- post ("/tasks/executions/{id}" , 1 ))
101+ get ("/tasks/executions/{id}" , "1" ))
91102 .andDo (print ())
92103 .andExpect (status ().isOk ())
93104 .andDo (this .documentationHandler .document (
94105 pathParameters (
95106 parameterWithName ("id" ).description ("The id of an existing task execution (required)" )
96- )));
107+ ),
108+ responseFields (
109+ fieldWithPath ("executionId" ).description ("The id of the task execution" ),
110+ fieldWithPath ("exitCode" ).description ("The exit code of the task execution" ),
111+ fieldWithPath ("taskName" ).description ("The task name related to the task execution" ),
112+ fieldWithPath ("startTime" ).description ("The start time of the task execution" ),
113+ fieldWithPath ("endTime" ).description ("The end time of the task execution" ),
114+ fieldWithPath ("exitMessage" ).description ("The exit message of the task execution" ),
115+ fieldWithPath ("arguments" ).description ("The arguments of the task execution" ),
116+ fieldWithPath ("jobExecutionIds" ).description ("The job executions ids of the task executions" ),
117+ fieldWithPath ("errorMessage" ).description ("The error message of the task execution" ),
118+ fieldWithPath ("externalExecutionId" ).description ("The external id of the task execution" ),
119+ fieldWithPath ("taskExecutionStatus" ).description ("The status of the task execution" ),
120+ fieldWithPath ("parentExecutionId" ).description ("The id of parent task execution, " +
121+ "null if task execution does not have parent" ),
122+ subsectionWithPath ("_links.self" ).description ("Link to the task execution resource" )
123+ )
124+ ));
97125 }
98126
99127 @ Test
@@ -147,52 +175,46 @@ public void listTaskExecutionsByName() throws Exception {
147175 }
148176
149177 @ Test
150- public void launchTaskDisplayDetail () throws Exception {
178+ public void stopTask () throws Exception {
151179 this .mockMvc .perform (
152- get ("/tasks/executions/{id}" , "1" ))
180+ post ("/tasks/executions" )
181+ .param ("name" , "taskA" )
182+ .param ("properties" , "app.my-task.foo=bar,deployer.my-task.something-else=3" )
183+ .param ("arguments" , "--server.port=8080 --foo=bar" ))
184+ .andExpect (status ().isCreated ());
185+ this .mockMvc .perform (
186+ post ("/tasks/executions/{id}" , 1 ))
153187 .andDo (print ())
154188 .andExpect (status ().isOk ())
155189 .andDo (this .documentationHandler .document (
156190 pathParameters (
157- parameterWithName ("id" ).description ("The id of an existing task execution (required)" )
158- ),
159- responseFields (
160- fieldWithPath ("executionId" ).description ("The id of the task execution" ),
161- fieldWithPath ("exitCode" ).description ("The exit code of the task execution" ),
162- fieldWithPath ("taskName" ).description ("The task name related to the task execution" ),
163- fieldWithPath ("startTime" ).description ("The start time of the task execution" ),
164- fieldWithPath ("endTime" ).description ("The end time of the task execution" ),
165- fieldWithPath ("exitMessage" ).description ("The exit message of the task execution" ),
166- fieldWithPath ("arguments" ).description ("The arguments of the task execution" ),
167- fieldWithPath ("jobExecutionIds" ).description ("The job executions ids of the task execution" ),
168- fieldWithPath ("errorMessage" ).description ("The error message of the task execution" ),
169- fieldWithPath ("externalExecutionId" ).description ("The external id of the task execution" ),
170- fieldWithPath ("taskExecutionStatus" ).description ("The status of the task execution" ),
171- fieldWithPath ("parentExecutionId" ).description ("The id of parent task execution, " +
172- "null if task execution does not have parent" ),
173- subsectionWithPath ("_links.self" ).description ("Link to the task execution resource" )
174- )
175- ));
191+ parameterWithName ("id" ).description ("The ids of an existing task execution (required)" )
192+ )));
176193 }
177194
178195 @ Test
179- public void launchTaskCurrentCount () throws Exception {
196+ public void taskExecutionRemove () throws Exception {
197+
198+ documentation .dontDocument ( () -> this .mockMvc .perform (
199+ post ("/tasks/executions" )
200+ .param ("name" , "taskB" )
201+ .param ("properties" , "app.my-task.foo=bar,deployer.my-task.something-else=3" )
202+ .param ("arguments" , "--server.port=8080 --foo=bar" ))
203+ .andExpect (status ().isCreated ()));
204+
180205 this .mockMvc .perform (
181- get ("/tasks/executions/current " ))
206+ delete ("/tasks/executions/{ids}?action=CLEANUP" , "1 " ))
182207 .andDo (print ())
183208 .andExpect (status ().isOk ())
184209 .andDo (this .documentationHandler .document (
185- responseFields (
186- fieldWithPath ("[].name" ).description ("The name of the platform instance (account)" ),
187- fieldWithPath ("[].type" ).description ("The platform type" ),
188- fieldWithPath ("[].maximumTaskExecutions" ).description ("The number of maximum task execution" ),
189- fieldWithPath ("[].runningExecutionCount" ).description ("The number of number execution" )
190- )
191- ));
210+ requestParameters (parameterWithName ("action" ).description ("Optional. Defaults to: CLEANUP." )),
211+ pathParameters (parameterWithName ("ids" )
212+ .description ("The id of an existing task execution (required). Multiple comma separated values are accepted." ))
213+ ));
192214 }
193215
194216 @ Test
195- public void removeTaskExecution () throws Exception {
217+ public void taskExecutionRemoveAndTaskDataRemove () throws Exception {
196218
197219 documentation .dontDocument ( () -> this .mockMvc .perform (
198220 post ("/tasks/executions" )
@@ -201,14 +223,23 @@ public void removeTaskExecution() throws Exception {
201223 .param ("arguments" , "--server.port=8080 --foo=bar" ))
202224 .andExpect (status ().isCreated ()));
203225
226+ documentation .dontDocument ( () -> this .mockMvc .perform (
227+ post ("/tasks/executions" )
228+ .param ("name" , "taskB" )
229+ .param ("properties" , "app.my-task.foo=bar2,deployer.my-task.something-else=3" )
230+ .param ("arguments" , "--server.port=8082 --foo=bar2" ))
231+ .andExpect (status ().isCreated ()));
232+
204233 this .mockMvc .perform (
205- delete ("/tasks/executions/{id} " , "1" ))
234+ delete ("/tasks/executions/{ids}?action=CLEANUP,REMOVE_DATA " , "1,2 " ))
206235 .andDo (print ())
207236 .andExpect (status ().isOk ())
208237 .andDo (this .documentationHandler .document (
209- pathParameters (parameterWithName ("id" )
210- .description ("The id of an existing task execution (required)" ))
238+ requestParameters (parameterWithName ("action" ).description ("Using both actions CLEANUP and REMOVE_DATA simultaneously." )),
239+ pathParameters (parameterWithName ("ids" )
240+ .description ("Providing 2 comma separated task execution id values." ))
211241 ));
242+
212243 }
213244
214245 private void createTaskDefinition (String taskName ) throws Exception {
0 commit comments