use of com.sequenceiq.mock.swagger.model.ApiCommand in project cloudbreak by hortonworks.
the class ClouderaManagerResourceOperation method importClusterTemplate.
public ResponseEntity<ApiCommand> importClusterTemplate(String mockUuid, @Valid Boolean addRepositories, @Valid ApiClusterTemplate body) {
clouderaManagerStoreService.importClusterTemplate(mockUuid, body);
ApiCommand response = new ApiCommand().id(Integer.valueOf(1)).name("Import ClusterTemplate").active(Boolean.TRUE);
return ResponseEntity.ok(response);
}
use of com.sequenceiq.mock.swagger.model.ApiCommand in project cloudbreak by hortonworks.
the class DataProviderService method getSuccessfulApiCommand.
public ApiCommand getSuccessfulApiCommand(Integer id) {
ApiCommand result = new ApiCommand();
result.setId(id);
result.setActive(false);
result.setSuccess(true);
return result;
}
use of com.sequenceiq.mock.swagger.model.ApiCommand in project cloudbreak by hortonworks.
the class ClusterResourceOperation method stopCommand.
public ResponseEntity<ApiCommand> stopCommand(String mockUuid, String clusterName) {
ClouderaManagerDto read = clouderaManagerStoreService.read(mockUuid);
Map<String, ApiServiceState> newStates = new HashMap<>();
read.getServiceStates().forEach((service, apiServiceState) -> newStates.put(service, ApiServiceState.STOPPED));
read.setServiceStates(newStates);
read.setStatus(ApiServiceState.STOPPED);
return responseCreatorComponent.exec(new ApiCommand().id(CommandId.CLUSTER_STOP).active(Boolean.TRUE).name("Stop"));
}
use of com.sequenceiq.mock.swagger.model.ApiCommand in project cloudbreak by hortonworks.
the class ClusterResourceOperation method startCommand.
public ResponseEntity<ApiCommand> startCommand(String mockUuid, String clusterName) {
ClouderaManagerDto read = clouderaManagerStoreService.read(mockUuid);
Map<String, ApiServiceState> newStates = new HashMap<>();
read.getServiceStates().forEach((service, apiServiceState) -> newStates.put(service, ApiServiceState.STARTED));
read.setServiceStates(newStates);
read.setStatus(ApiServiceState.STARTED);
return responseCreatorComponent.exec(new ApiCommand().id(CommandId.CLUSTER_START).active(Boolean.TRUE).name("Start"));
}
use of com.sequenceiq.mock.swagger.model.ApiCommand in project cloudbreak by hortonworks.
the class ResponseModifierServiceTest method testEvaluateResponseWhenTransformResponsePackage.
@Test
public void testEvaluateResponseWhenTransformResponsePackage() throws Throwable {
MockResponse mockResponse1 = createMockResponse(0, 200, "/path1", "get", null, new ApiCommand().id(Integer.valueOf(1)));
mockResponse1.setClss("com.cloudera.api.swagger.model.ApiCommand");
underTest.addResponse(mockResponse1);
ApiCommand actualPost = underTest.evaluateResponse("get_/path1", ApiCommand.class, () -> null);
assertEquals(actualPost.getId(), Integer.valueOf(1));
}
Aggregations