Search in sources :

Example 16 with ApiHost

use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.

the class ClouderaManagerHostStatusCheckerTest method shouldBeTrueWhenOneInstanceIsOrchestrationFailed.

@Test
public void shouldBeTrueWhenOneInstanceIsOrchestrationFailed() throws ApiException {
    InstanceMetaData instanceMetaData = validInstanceMetadata();
    InstanceMetaData instanceMetaData2 = validInstanceMetadata();
    instanceMetaData2.setPrivateIp("2.2.2.2");
    instanceMetaData2.setInstanceStatus(InstanceStatus.ORCHESTRATION_FAILED);
    ApiHost apiHost = getValidApiHost(instanceMetaData);
    when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost)));
    boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData, instanceMetaData2));
    assertTrue(result);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) ApiHostList(com.cloudera.api.swagger.model.ApiHostList) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Example 17 with ApiHost

use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.

the class ClouderaManagerHostStatusCheckerTest method shouldBeTrueWhenOneInstanceIsTerminated.

@Test
public void shouldBeTrueWhenOneInstanceIsTerminated() throws ApiException {
    InstanceMetaData instanceMetaData = validInstanceMetadata();
    InstanceMetaData instanceMetaData2 = validInstanceMetadata();
    instanceMetaData2.setPrivateIp("2.2.2.2");
    instanceMetaData2.setInstanceStatus(InstanceStatus.TERMINATED);
    ApiHost apiHost = getValidApiHost(instanceMetaData);
    when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost)));
    boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData, instanceMetaData2));
    assertTrue(result);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) ApiHostList(com.cloudera.api.swagger.model.ApiHostList) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Example 18 with ApiHost

use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.

the class ClouderaManagerHostStatusCheckerTest method shouldBeFalseWhenHostsHasMissingHost.

@Test
public void shouldBeFalseWhenHostsHasMissingHost() throws ApiException {
    InstanceMetaData instanceMetaData = validInstanceMetadata();
    InstanceMetaData instanceMetaData2 = validInstanceMetadata();
    instanceMetaData2.setPrivateIp("2.2.2.2");
    ApiHost apiHost = getValidApiHost(instanceMetaData);
    when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost)));
    boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData, instanceMetaData2));
    assertFalse(result);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) ApiHostList(com.cloudera.api.swagger.model.ApiHostList) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Example 19 with ApiHost

use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.

the class ClouderaManagerHostStatusCheckerTest method shouldBeTrueWhenHostsReturnedHasRecentHeartbeat.

@Test
public void shouldBeTrueWhenHostsReturnedHasRecentHeartbeat() throws ApiException {
    InstanceMetaData instanceMetaData = validInstanceMetadata();
    ApiHost apiHost = getValidApiHost(instanceMetaData);
    when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost)));
    boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData));
    assertTrue(result);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) ApiHostList(com.cloudera.api.swagger.model.ApiHostList) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Example 20 with ApiHost

use of com.cloudera.api.swagger.model.ApiHost in project cloudbreak by hortonworks.

the class ClouderaManagerHostStatusCheckerTest method shouldBeTrueWhenOneInstanceHasNoDiscoveryFqdn.

@Test
public void shouldBeTrueWhenOneInstanceHasNoDiscoveryFqdn() throws ApiException {
    InstanceMetaData instanceMetaData = validInstanceMetadata();
    InstanceMetaData instanceMetaData2 = validInstanceMetadata();
    instanceMetaData2.setPrivateIp("2.2.2.2");
    instanceMetaData2.setDiscoveryFQDN(null);
    ApiHost apiHost = getValidApiHost(instanceMetaData);
    when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost)));
    boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData, instanceMetaData2));
    assertTrue(result);
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) ApiHostList(com.cloudera.api.swagger.model.ApiHostList) ApiHost(com.cloudera.api.swagger.model.ApiHost) Test(org.junit.Test)

Aggregations

ApiHost (com.cloudera.api.swagger.model.ApiHost)49 ApiHostList (com.cloudera.api.swagger.model.ApiHostList)30 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)26 Test (org.junit.Test)23 HostsResourceApi (com.cloudera.api.swagger.HostsResourceApi)16 ApiException (com.cloudera.api.swagger.client.ApiException)16 List (java.util.List)14 ApiClient (com.cloudera.api.swagger.client.ApiClient)13 Set (java.util.Set)13 Collectors (java.util.stream.Collectors)13 ClouderaManagerApiFactory (com.sequenceiq.cloudbreak.cm.client.retry.ClouderaManagerApiFactory)12 ApiCommand (com.cloudera.api.swagger.model.ApiCommand)11 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)11 HostGroup (com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup)11 ApiHealthSummary (com.cloudera.api.swagger.model.ApiHealthSummary)10 ApiRoleRef (com.cloudera.api.swagger.model.ApiRoleRef)10 ClouderaManagerPollingServiceProvider (com.sequenceiq.cloudbreak.cm.polling.ClouderaManagerPollingServiceProvider)10 Logger (org.slf4j.Logger)10 LoggerFactory (org.slf4j.LoggerFactory)10 ClouderaManagerResourceApi (com.cloudera.api.swagger.ClouderaManagerResourceApi)9