use of com.sequenceiq.mock.clouderamanager.ClouderaManagerDto 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.clouderamanager.ClouderaManagerDto in project cloudbreak by hortonworks.
the class PgkVersionSaltResponse method run.
@Override
public Object run(String mockUuid, Map<String, List<String>> params) throws Exception {
List<Map<String, String>> result = new ArrayList<>();
PackageVersionResponse response = new PackageVersionResponse();
ClouderaManagerDto cmDto = clouderaManagerStoreService.read(mockUuid);
List<ApiClusterTemplateHostInfo> hosts = cmDto.getClusterTemplate().getInstantiator().getHosts();
Map<String, String> pkgVersion = new HashMap<>();
for (ApiClusterTemplateHostInfo host : hosts) {
String hostName = host.getHostName();
pkgVersion.put(hostName, cmDto.getClusterTemplate().getCmVersion());
}
result.add(pkgVersion);
response.setResult(result);
return response;
}
use of com.sequenceiq.mock.clouderamanager.ClouderaManagerDto in project cloudbreak by hortonworks.
the class ResponseModifierService method handleProfiles.
public void handleProfiles(String mockUuid, String path) {
if (mockUuid != null && profileSupported(mockUuid, path) && clouderaManagerStoreService.exists(mockUuid)) {
ClouderaManagerDto dto = clouderaManagerStoreService.read(mockUuid);
Optional<CmProfile> http500 = dto.getActiveProfiles().stream().filter(p -> p.getProfile().equals("HTTP_500")).findFirst();
if (http500.isPresent()) {
int called = profileCalled.computeIfAbsent(path, key -> 0);
profileCalled.put(path, called + 1);
if (called < http500.get().getTimes()) {
throw new HttpServerErrorException(HttpStatus.INTERNAL_SERVER_ERROR, "HTTP_500 profile set");
}
}
}
}
Aggregations