use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response in project cloudbreak by hortonworks.
the class DatalakeService method addSharedServiceResponse.
public void addSharedServiceResponse(Stack stack, StackV4Response stackResponse) {
SharedServiceV4Response sharedServiceResponse = new SharedServiceV4Response();
if (!Strings.isNullOrEmpty(stack.getDatalakeCrn())) {
LOGGER.debug("Checking datalake through the datalakeCrn.");
Optional<ResourceBasicView> resourceBasicView = stackService.getResourceBasicViewByResourceCrn(stack.getDatalakeCrn());
if (resourceBasicView.isPresent()) {
ResourceBasicView s = resourceBasicView.get();
sharedServiceResponse.setSharedClusterId(s.getId());
sharedServiceResponse.setSharedClusterName(s.getName());
} else {
LOGGER.debug("Unable to find datalake with CRN {}", stack.getDatalakeCrn());
}
}
stackResponse.setSharedService(sharedServiceResponse);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response in project cloudbreak by hortonworks.
the class SdxServiceDecorator method prepareMultipleSdxAttributes.
public void prepareMultipleSdxAttributes(Set<StackViewV4Response> stackViewResponses) {
List<SdxClusterResponse> responses = sdxClientService.list();
for (StackViewV4Response stackViewResponse : stackViewResponses) {
Optional<SdxClusterResponse> first = responses.stream().filter(x -> x.getEnvironmentCrn().equals(stackViewResponse.getEnvironmentCrn())).findFirst();
if (first.isPresent()) {
SdxClusterResponse sdxCluster = first.get();
SharedServiceV4Response sharedServiceResponse = stackViewResponse.getCluster().getSharedServiceResponse();
sharedServiceResponse.setSdxCrn(sdxCluster.getCrn());
sharedServiceResponse.setSdxName(sdxCluster.getName());
} else {
LOGGER.info("No SDX cluster found for stack {}.", stackViewResponse.getCrn());
}
}
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response in project cloudbreak by hortonworks.
the class StackToStackV4ResponseConverterTest method setUp.
@Before
public void setUp() throws CloudbreakImageNotFoundException {
underTest = new StackToStackV4ResponseConverter();
MockitoAnnotations.initMocks(this);
when(imageService.getImage(anyLong())).thenReturn(new Image("cb-centos66-amb200-2015-05-25", Collections.emptyMap(), "redhat6", "redhat6", "", "default", "default-id", new HashMap<>()));
when(componentConfigProviderService.getCloudbreakDetails(anyLong())).thenReturn(new CloudbreakDetails("version"));
when(componentConfigProviderService.getStackTemplate(anyLong())).thenReturn(new StackTemplate("{}", "version"));
when(componentConfigProviderService.getTelemetry(anyLong())).thenReturn(new Telemetry());
Mockito.doAnswer(answer -> {
StackV4Response result = answer.getArgument(1, StackV4Response.class);
result.setSharedService(new SharedServiceV4Response());
return null;
}).when(datalakeService).addSharedServiceResponse(any(Stack.class), any(StackV4Response.class));
when(serviceEndpointCollector.filterByStackType(any(StackType.class), any(List.class))).thenReturn(new ArrayList());
credentialResponse = new CredentialResponse();
credentialResponse.setName("cred-name");
credentialResponse.setCrn("crn");
when(loadBalancerService.findByStackId(any())).thenReturn(Set.of());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.sharedservice.SharedServiceV4Response in project cloudbreak by hortonworks.
the class DatalakeService method addSharedServiceResponse.
public void addSharedServiceResponse(ClusterApiView cluster, ClusterViewV4Response clusterResponse) {
SharedServiceV4Response sharedServiceResponse = new SharedServiceV4Response();
if (cluster.getStack().getDatalakeCrn() != null) {
LOGGER.debug("Add shared service response by datalakeCrn");
Optional<ResourceBasicView> datalakeStack = stackService.getResourceBasicViewByResourceCrn(cluster.getStack().getDatalakeCrn());
datalakeStack.ifPresent(s -> {
sharedServiceResponse.setSharedClusterId(s.getId());
sharedServiceResponse.setSharedClusterName(s.getName());
});
}
clusterResponse.setSharedServiceResponse(sharedServiceResponse);
}
Aggregations