Search in sources :

Example 31 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class UpgradeValidationServiceTest method createAvailableInstance.

public InstanceMetaData createAvailableInstance(String id) {
    InstanceMetaData instanceMetaData = new InstanceMetaData();
    instanceMetaData.setInstanceId(id);
    instanceMetaData.setInstanceStatus(InstanceStatus.CREATED);
    return instanceMetaData;
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData)

Example 32 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class UpgradeValidationServiceTest method testNotAvailableInstances.

@Test
public void testNotAvailableInstances() {
    Stack stack = mock(Stack.class);
    InstanceMetaData im2 = createAvailableInstance("im2");
    im2.setInstanceStatus(InstanceStatus.DELETED_ON_PROVIDER_SIDE);
    Set<InstanceMetaData> allInstances = Set.of(createAvailableInstance("im1"), im2);
    assertThrows(BadRequestException.class, () -> underTest.validateStackForUpgrade(allInstances, stack));
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 33 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class UpgradeValidationServiceTest method testStackNotAvailable.

@Test
public void testStackNotAvailable() {
    Stack stack = mock(Stack.class);
    when(stack.isAvailable()).thenReturn(Boolean.FALSE);
    StackStatus stackStatus = new StackStatus();
    stackStatus.setStatus(Status.DELETED_ON_PROVIDER_SIDE);
    when(stack.getStackStatus()).thenReturn(stackStatus);
    Set<InstanceMetaData> allInstances = Set.of(createAvailableInstance("im1"), createAvailableInstance("im2"));
    assertThrows(BadRequestException.class, () -> underTest.validateStackForUpgrade(allInstances, stack));
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) StackStatus(com.sequenceiq.freeipa.entity.StackStatus) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 34 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class UpgradeValidationServiceTest method testStackValidationOk.

@Test
public void testStackValidationOk() {
    Stack stack = mock(Stack.class);
    when(stack.isAvailable()).thenReturn(Boolean.TRUE);
    Set<InstanceMetaData> allInstances = Set.of(createAvailableInstance("im1"), createAvailableInstance("im2"));
    underTest.validateStackForUpgrade(allInstances, stack);
    allInstances = Set.of(createAvailableInstance("im1"), createAvailableInstance("im2"), createAvailableInstance("im3"));
    underTest.validateStackForUpgrade(allInstances, stack);
    allInstances = Set.of(createAvailableInstance("im1"));
    underTest.validateStackForUpgrade(allInstances, stack);
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Stack(com.sequenceiq.freeipa.entity.Stack) Test(org.junit.jupiter.api.Test)

Example 35 with InstanceMetaData

use of com.sequenceiq.freeipa.entity.InstanceMetaData in project cloudbreak by hortonworks.

the class FreeIpaNodeUtilServiceTest method before.

@BeforeEach
void before() {
    Template template = new Template();
    template.setInstanceType(INSTANCE_TYPE);
    InstanceGroup ig = new InstanceGroup();
    ig.setTemplate(template);
    ig.setGroupName(GROUP_NAME);
    im = new InstanceMetaData();
    im.setPrivateIp(PRIVATE_IP);
    im.setInstanceId(INSTANCE_ID);
    im.setInstanceGroup(ig);
    im.setDiscoveryFQDN(FQDN);
}
Also used : InstanceMetaData(com.sequenceiq.freeipa.entity.InstanceMetaData) Template(com.sequenceiq.freeipa.entity.Template) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

InstanceMetaData (com.sequenceiq.freeipa.entity.InstanceMetaData)163 Stack (com.sequenceiq.freeipa.entity.Stack)104 Test (org.junit.jupiter.api.Test)77 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)30 List (java.util.List)19 Logger (org.slf4j.Logger)19 LoggerFactory (org.slf4j.LoggerFactory)19 Map (java.util.Map)18 Collectors (java.util.stream.Collectors)18 Inject (javax.inject.Inject)18 Set (java.util.Set)16 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)13 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)13 Node (com.sequenceiq.cloudbreak.common.orchestration.Node)12 BadRequestException (com.sequenceiq.cloudbreak.common.exception.BadRequestException)11 StackService (com.sequenceiq.freeipa.service.stack.StackService)10 ArrayList (java.util.ArrayList)10 Selectable (com.sequenceiq.cloudbreak.common.event.Selectable)9 HealthDetailsFreeIpaResponse (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.health.HealthDetailsFreeIpaResponse)9 Operation (com.sequenceiq.freeipa.entity.Operation)9