@@ -100,8 +100,8 @@ public class ServiceInstanceController extends BaseController {
|
||||
}, method = RequestMethod.GET)
|
||||
public ResponseEntity<?> getServiceInstanceLastOperation(@PathVariable Map<String, String> pathVariables,
|
||||
@PathVariable("instanceId") String serviceInstanceId,
|
||||
@RequestParam("service_id") String serviceDefinitionId,
|
||||
@RequestParam("plan_id") String planId,
|
||||
@RequestParam(value = "service_id", required = false) String serviceDefinitionId,
|
||||
@RequestParam(value = "plan_id", required = false) String planId,
|
||||
@RequestParam(value = "operation", required = false) String operation,
|
||||
@RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation,
|
||||
@RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString) {
|
||||
|
||||
@@ -73,6 +73,7 @@ public class ServiceInstanceControllerIntegrationTest extends ControllerIntegrat
|
||||
private UpdateServiceInstanceResponse asyncUpdateResponse;
|
||||
|
||||
private GetLastServiceOperationRequest lastOperationRequest;
|
||||
private GetLastServiceOperationRequest lastOperationRequestWithoutOptionalParameters;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
@@ -99,6 +100,8 @@ public class ServiceInstanceControllerIntegrationTest extends ControllerIntegrat
|
||||
asyncUpdateResponse = ServiceInstanceFixture.buildUpdateServiceInstanceResponse(true);
|
||||
|
||||
lastOperationRequest = ServiceInstanceFixture.buildGetLastOperationRequest();
|
||||
lastOperationRequestWithoutOptionalParameters =
|
||||
ServiceInstanceFixture.buildGetLastOperationRequestWithoutOptionalParameters();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -588,6 +591,22 @@ public class ServiceInstanceControllerIntegrationTest extends ControllerIntegrat
|
||||
.andExpect(jsonPath("$.description", is("all good")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lastOperationHasSucceededStatusWithoutOptionalParameters() throws Exception {
|
||||
GetLastServiceOperationResponse response = new GetLastServiceOperationResponse()
|
||||
.withOperationState(OperationState.SUCCEEDED)
|
||||
.withDescription("all good");
|
||||
|
||||
when(serviceInstanceService.getLastOperation(eq(lastOperationRequestWithoutOptionalParameters)))
|
||||
.thenReturn(response);
|
||||
|
||||
mockMvc.perform(get(buildUrl(lastOperationRequestWithoutOptionalParameters, false))
|
||||
.header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.state", is(OperationState.SUCCEEDED.toString())))
|
||||
.andExpect(jsonPath("$.description", is("all good")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lastOperationHasSucceededStatusWithCfInstanceId() throws Exception {
|
||||
GetLastServiceOperationResponse response = new GetLastServiceOperationResponse()
|
||||
|
||||
@@ -73,4 +73,8 @@ public class ServiceInstanceFixture {
|
||||
service.getPlans().get(0).getId(),
|
||||
"task_10");
|
||||
}
|
||||
|
||||
public static GetLastServiceOperationRequest buildGetLastOperationRequestWithoutOptionalParameters() {
|
||||
return new GetLastServiceOperationRequest("service-instance-id");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user