use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.
the class AmbariClusterServiceTest method testRecreateFailNotEmbeddedDb.
@Test(expected = BadRequestException.class)
public void testRecreateFailNotEmbeddedDb() {
RDSConfig rdsConfig = new RDSConfig();
rdsConfig.setDatabaseEngine(DatabaseVendor.POSTGRES.name());
when(rdsConfigService.findByClusterIdAndType(anyString(), anyString(), any(Long.class), eq(RdsType.AMBARI))).thenReturn(rdsConfig);
ambariClusterService.recreate(1L, 1L, new HashSet<>(), false, new StackRepoDetails(), null, null);
}
use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.
the class AmbariClusterServiceTest method setup.
@Before
public void setup() throws CloudbreakException {
Cluster cluster = new Cluster();
cluster.setId(1L);
cluster.setBlueprint(new Blueprint());
cluster.getBlueprint().setId(1L);
Stack stack = new Stack();
stack.setOrchestrator(new Orchestrator());
stack.setCluster(cluster);
when(clusterRepository.findById(any(Long.class))).thenReturn(cluster);
when(stackService.getByIdWithLists(any(Long.class))).thenReturn(stack);
when(orchestratorTypeResolver.resolveType(any(Orchestrator.class))).thenReturn(OrchestratorType.HOST);
when(orchestratorTypeResolver.resolveType(anyString())).thenReturn(OrchestratorType.HOST);
when(clusterComponentConfigProvider.getHDPRepo(any(Long.class))).thenReturn(new StackRepoDetails());
when(clusterComponentConfigProvider.store(any(ClusterComponent.class))).thenAnswer(invocation -> invocation.getArgumentAt(0, ClusterComponent.class));
when(clusterComponentConfigProvider.getComponent(any(Long.class), any(ComponentType.class))).thenReturn(new ClusterComponent());
when(blueprintService.get(any(Long.class))).thenReturn(cluster.getBlueprint());
}
use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.
the class AmbariClusterServiceTest method testRecreateSuccess.
@Test
public void testRecreateSuccess() {
RDSConfig rdsConfig = new RDSConfig();
rdsConfig.setDatabaseEngine(DatabaseVendor.EMBEDDED.name());
when(rdsConfigService.findByClusterIdAndType(anyString(), anyString(), any(Long.class), eq(RdsType.AMBARI))).thenReturn(rdsConfig);
ambariClusterService.recreate(1L, 1L, new HashSet<>(), false, new StackRepoDetails(), null, null);
}
use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.
the class StackToStackResponseConverterTest method setUp.
@Before
public void setUp() throws CloudbreakImageNotFoundException {
underTest = new StackToStackResponseConverter();
MockitoAnnotations.initMocks(this);
when(imageService.getImage(anyLong())).thenReturn(new Image("cb-centos66-amb200-2015-05-25", new HashMap<>(), "redhat6", "", "default", "default-id"));
when(componentConfigProvider.getCloudbreakDetails(anyLong())).thenReturn(new CloudbreakDetails("version"));
when(componentConfigProvider.getStackTemplate(anyLong())).thenReturn(new StackTemplate("{}", "version"));
when(clusterComponentConfigProvider.getHDPRepo(anyLong())).thenReturn(new StackRepoDetails());
when(clusterComponentConfigProvider.getAmbariDatabase(anyLong())).thenReturn(new AmbariDatabase());
when(clusterComponentConfigProvider.getAmbariRepo(anyLong())).thenReturn(new AmbariRepo());
}
use of com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails in project cloudbreak by hortonworks.
the class ClusterCreationSetupService method determineHDPRepoConfig.
private ClusterComponent determineHDPRepoConfig(Blueprint blueprint, long stackId, Optional<Component> stackHdpRepoConfig, ClusterRequest request, Cluster cluster, IdentityUser user, Optional<Component> stackImageComponent) throws JsonProcessingException {
Json stackRepoDetailsJson;
if (!stackHdpRepoConfig.isPresent()) {
AmbariStackDetailsJson ambariStackDetails = request.getAmbariStackDetails();
if (ambariStackDetails != null) {
setOsTypeFromImageIfMissing(cluster, stackImageComponent, ambariStackDetails);
StackRepoDetails stackRepoDetails = conversionService.convert(ambariStackDetails, StackRepoDetails.class);
stackRepoDetailsJson = new Json(stackRepoDetails);
} else {
StackRepoDetails stackRepoDetails = SerializationUtils.clone(defaultHDPInfo(blueprint, request, user).getRepo());
Optional<String> vdfUrl = getVDFUrlByOsType(stackId, stackRepoDetails);
vdfUrl.ifPresent(s -> stackRepoDetails.getStack().put(CUSTOM_VDF_REPO_KEY, s));
stackRepoDetailsJson = new Json(stackRepoDetails);
}
} else {
stackRepoDetailsJson = stackHdpRepoConfig.get().getAttributes();
}
return new ClusterComponent(ComponentType.HDP_REPO_DETAILS, stackRepoDetailsJson, cluster);
}
Aggregations