use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response in project cloudbreak by hortonworks.
the class ClusterToClusterV4ResponseConverter method convertNullableProperties.
private void convertNullableProperties(Cluster source, ClusterV4Response clusterResponse) {
if (source.getGateway() != null) {
GatewayV4Response gatewayV4Response = gatewayToGatewayV4ResponseConverter.convert(source.getGateway());
clusterResponse.setGateway(gatewayV4Response);
}
if (source.getAttributes() != null) {
Json fromVault = new Json(source.getAttributes());
clusterResponse.setAttributes(fromVault.getMap());
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response in project cloudbreak by hortonworks.
the class ClusterToClusterV4ResponseConverter method convert.
public ClusterV4Response convert(Cluster source) {
ClusterV4Response clusterResponse = new ClusterV4Response();
clusterResponse.setId(source.getId());
clusterResponse.setName(source.getName());
Stack stack = source.getStack();
clusterResponse.setStatus(stack.getStatus());
clusterResponse.setStatusReason(stack.getStatusReason());
setUptime(source, clusterResponse);
clusterResponse.setDescription(source.getDescription() == null ? "" : source.getDescription());
String managerAddress = stackUtil.extractClusterManagerAddress(stack);
Map<String, Collection<ClusterExposedServiceV4Response>> clusterExposedServicesForTopologies = serviceEndpointCollector.prepareClusterExposedServices(source, managerAddress);
clusterResponse.setExposedServices(clusterExposedServicesForTopologies);
convertCustomQueue(source, clusterResponse);
convertNullableProperties(source, clusterResponse);
convertContainerConfig(source, clusterResponse);
clusterResponse.setCreationFinished(source.getCreationFinished());
decorateResponseWithProxyConfig(source, clusterResponse);
clusterResponse.setCloudStorage(getCloudStorage(source));
clusterResponse.setCm(ClusterToClouderaManagerV4ResponseConverter.convert(source));
clusterResponse.setDatabases(source.getRdsConfigs().stream().filter(rds -> ResourceStatus.USER_MANAGED.equals(rds.getStatus())).map(rds -> rdsConfigToDatabaseV4ResponseConverter.convert(rds)).collect(Collectors.toList()));
clusterResponse.setWorkspace(workspaceToWorkspaceResourceV4ResponseConverter.convert(source.getWorkspace()));
clusterResponse.setBlueprint(getIfNotNull(source.getBlueprint(), blueprintToBlueprintV4ResponseConverter::convert));
clusterResponse.setExtendedBlueprintText(getExtendedBlueprintText(source));
convertDpSecrets(source, clusterResponse);
clusterResponse.setServerIp(stackUtil.extractClusterManagerIp(stack));
clusterResponse.setServerFqdn(source.getFqdn());
clusterResponse.setServerUrl(serviceEndpointCollector.getManagerServerUrl(source, managerAddress));
clusterResponse.setCustomConfigurationsName(getIfNotNull(source.getCustomConfigurations(), configurations -> configurations.getName()));
clusterResponse.setCustomConfigurationsCrn(getIfNotNull(source.getCustomConfigurations(), configurations -> configurations.getCrn()));
clusterResponse.setDatabaseServerCrn(source.getDatabaseServerCrn());
clusterResponse.setRangerRazEnabled(source.isRangerRazEnabled());
clusterResponse.setCertExpirationState(source.getCertExpirationState());
return clusterResponse;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response in project cloudbreak by hortonworks.
the class StackResponseUtilsTest method validateGetRoleConfigNameForHostGroup.
private void validateGetRoleConfigNameForHostGroup(String testService, String testRole, String testHostGroup, String expectedRoleConfigName) throws Exception {
StackV4Response mockStackResponse = mock(StackV4Response.class);
ClusterV4Response mockCluster = mock(ClusterV4Response.class);
BlueprintV4Response mockBluePrint = mock(BlueprintV4Response.class);
when(mockStackResponse.getCluster()).thenReturn(mockCluster);
when(mockCluster.getBlueprint()).thenReturn(mockBluePrint);
when(mockBluePrint.getBlueprint()).thenReturn(getTestBP());
String hostGroupRolename = underTest.getRoleConfigNameForHostGroup(mockStackResponse, testHostGroup, testService, testRole);
assertEquals("RoleConfigName in template should match for HostGroup", expectedRoleConfigName, hostGroupRolename);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response in project cloudbreak by hortonworks.
the class DatahubPollerProviderTest method getStackV4Response.
private StackV4Response getStackV4Response(Status status, Status clusterStatus, String crn) {
StackV4Response stack1 = new StackV4Response();
stack1.setStatus(status);
ClusterV4Response cluster = new ClusterV4Response();
cluster.setStatus(clusterStatus);
cluster.setName(crn);
cluster.setStatusReason("cluster reason");
stack1.setCluster(cluster);
stack1.setName(crn);
stack1.setCrn(crn);
stack1.setStatusReason("reason");
return stack1;
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response in project cloudbreak by hortonworks.
the class DatahubPollerServiceTest method getStack.
private StackV4Response getStack(Status status) {
StackV4Response stack = new StackV4Response();
stack.setStatus(status);
stack.setCrn(STACK_CRN);
ClusterV4Response cluster = new ClusterV4Response();
cluster.setStatus(status);
stack.setCluster(cluster);
return stack;
}
Aggregations