Search in sources :

Example 1 with StackRepoDetails

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);
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Test(org.junit.Test)

Example 2 with StackRepoDetails

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());
}
Also used : ComponentType(com.sequenceiq.cloudbreak.common.type.ComponentType) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Orchestrator(com.sequenceiq.cloudbreak.domain.Orchestrator) Stack(com.sequenceiq.cloudbreak.domain.Stack) Before(org.junit.Before)

Example 3 with StackRepoDetails

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);
}
Also used : StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) RDSConfig(com.sequenceiq.cloudbreak.domain.RDSConfig) Test(org.junit.Test)

Example 4 with StackRepoDetails

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());
}
Also used : AmbariDatabase(com.sequenceiq.cloudbreak.cloud.model.AmbariDatabase) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) HashMap(java.util.HashMap) CloudbreakDetails(com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails) StackTemplate(com.sequenceiq.cloudbreak.cloud.model.StackTemplate) AmbariRepo(com.sequenceiq.cloudbreak.cloud.model.AmbariRepo) Image(com.sequenceiq.cloudbreak.cloud.model.Image) Before(org.junit.Before)

Example 5 with StackRepoDetails

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);
}
Also used : AmbariStackDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson) StackRepoDetails(com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails) ClusterComponent(com.sequenceiq.cloudbreak.domain.ClusterComponent) AmbariRepoDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson) AmbariStackDetailsJson(com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson) Json(com.sequenceiq.cloudbreak.domain.json.Json)

Aggregations

StackRepoDetails (com.sequenceiq.cloudbreak.cloud.model.component.StackRepoDetails)21 AmbariRepo (com.sequenceiq.cloudbreak.cloud.model.AmbariRepo)7 Test (org.junit.Test)4 AmbariStackDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsJson)3 CloudbreakDetails (com.sequenceiq.cloudbreak.cloud.model.CloudbreakDetails)3 Image (com.sequenceiq.cloudbreak.cloud.model.Image)3 ClusterComponent (com.sequenceiq.cloudbreak.domain.ClusterComponent)3 Json (com.sequenceiq.cloudbreak.domain.json.Json)3 AmbariRepoDetailsJson (com.sequenceiq.cloudbreak.api.model.AmbariRepoDetailsJson)2 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)2 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)2 RDSConfig (com.sequenceiq.cloudbreak.domain.RDSConfig)2 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 AmbariStackDetailsResponse (com.sequenceiq.cloudbreak.api.model.AmbariStackDetailsResponse)1 BlueprintInputJson (com.sequenceiq.cloudbreak.api.model.BlueprintInputJson)1 BlueprintParameterJson (com.sequenceiq.cloudbreak.api.model.BlueprintParameterJson)1 CloudbreakDetailsJson (com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson)1