Search in sources :

Example 81 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class UpgradeServiceTest method getStack.

private Stack getStack() {
    Stack stack = new Stack();
    stack.setId(1L);
    stack.setEnvironmentCrn("env-crn");
    stack.setCloudPlatform("AWS");
    stack.setPlatformVariant("AWS");
    stack.setRegion("eu-central-1");
    Blueprint blueprint = new Blueprint();
    Cluster cluster = new Cluster();
    cluster.setId(1L);
    cluster.setBlueprint(blueprint);
    stack.setCluster(cluster);
    return stack;
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 82 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class ActiveCommandsValidatorTest method createStack.

private Stack createStack() {
    Blueprint blueprint = new Blueprint();
    blueprint.setBlueprintText("");
    Cluster cluster = new Cluster();
    cluster.setName("cluster");
    cluster.setBlueprint(blueprint);
    Stack stack = new Stack();
    stack.setCluster(cluster);
    return stack;
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Example 83 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class StructuredFlowEventFactoryTest method createStucturedFlowEvent.

@Test
public void createStucturedFlowEvent() {
    Stack stack = TestUtil.stack();
    Cluster cluster = TestUtil.cluster();
    Blueprint blueprint = TestUtil.blueprint();
    cluster.setBlueprint(blueprint);
    stack.setCluster(cluster);
    BlueprintDetails blueprintDetails = new BlueprintDetails();
    blueprintDetails.setBlueprintName(bpName);
    when(stackToStackDetailsConverter.convert(any())).thenReturn(null);
    when(blueprintToBlueprintDetailsConverter.convert(blueprint)).thenReturn(blueprintDetails);
    when(stackService.getByIdWithTransaction(1L)).thenReturn(stack);
    StructuredFlowEvent result = baseLegacyStructuredFlowEventFactory.createStucturedFlowEvent(1L, new FlowDetails(), true);
    assertNull(result.getException());
    assertEquals(bpName, result.getBlueprintDetails().getBlueprintName());
}
Also used : BlueprintDetails(com.sequenceiq.cloudbreak.structuredevent.event.BlueprintDetails) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) FlowDetails(com.sequenceiq.cloudbreak.structuredevent.event.FlowDetails) StructuredFlowEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredFlowEvent) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 84 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class StructuredSyncEventFactoryTest method createCDPStructuredSyncEvent.

@Test
public void createCDPStructuredSyncEvent() {
    Stack stack = TestUtil.stack();
    stack.setResourceCrn("crn");
    Cluster cluster = TestUtil.cluster();
    Blueprint blueprint = TestUtil.blueprint();
    cluster.setBlueprint(blueprint);
    stack.setCluster(cluster);
    BlueprintDetails blueprintDetails = new BlueprintDetails();
    blueprintDetails.setBlueprintName("testBpName");
    when(stackToStackDetailsConverter.convert(any())).thenReturn(null);
    when(blueprintToBlueprintDetailsConverter.convert(blueprint)).thenReturn(blueprintDetails);
    when(stackService.getByIdWithTransaction(1L)).thenReturn(stack);
    when(nodeConfig.getId()).thenReturn("cbid");
    StructuredSyncEvent result = underTest.createStructuredSyncEvent(1L);
    assertNull(result.getStack());
    assertEquals(CloudbreakEventService.DATAHUB_RESOURCE_TYPE, result.getOperation().getResourceType());
    assertEquals("crn", result.getOperation().getResourceCrn());
    assertEquals("cbid", result.getOperation().getCloudbreakId());
    assertEquals("testBpName", result.getBlueprintDetails().getBlueprintName());
}
Also used : BlueprintDetails(com.sequenceiq.cloudbreak.structuredevent.event.BlueprintDetails) Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) StructuredSyncEvent(com.sequenceiq.cloudbreak.structuredevent.event.StructuredSyncEvent) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 85 with Cluster

use of com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster in project cloudbreak by hortonworks.

the class StackStopRestrictionServiceTest method createStack.

private Stack createStack(String cloudProvider, Set<InstanceGroup> groups) {
    Stack stack = new Stack();
    stack.setCloudPlatform(cloudProvider);
    stack.setId(42L);
    stack.setInstanceGroups(groups);
    Cluster cluster = new Cluster();
    cluster.setId(42L);
    Blueprint blueprint = new Blueprint();
    blueprint.setBlueprintText("blueprint");
    cluster.setBlueprint(blueprint);
    stack.setCluster(cluster);
    if (groups != null) {
        groups.forEach(ig -> ig.setStack(stack));
    }
    return stack;
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack)

Aggregations

Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)407 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)248 Test (org.junit.jupiter.api.Test)125 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)63 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)60 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)58 Optional (java.util.Optional)51 Test (org.junit.Test)50 List (java.util.List)49 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)47 Set (java.util.Set)43 Json (com.sequenceiq.cloudbreak.common.json.Json)39 Map (java.util.Map)39 Collectors (java.util.stream.Collectors)39 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)37 InstanceGroup (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceGroup)36 Inject (javax.inject.Inject)36 Logger (org.slf4j.Logger)36 LoggerFactory (org.slf4j.LoggerFactory)36 DetailedStackStatus (com.sequenceiq.cloudbreak.api.endpoint.v4.common.DetailedStackStatus)35