use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData in project cloudbreak by hortonworks.
the class StackStatusIntegrationTest method createInstance.
private InstanceMetaData createInstance(String instanceName) {
InstanceMetaData instanceMetaData = new InstanceMetaData();
instanceMetaData.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY);
instanceMetaData.setInstanceId(instanceName);
instanceMetaData.setDiscoveryFQDN(instanceName);
return instanceMetaData;
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData in project cloudbreak by hortonworks.
the class UnhealthyInstancesDetectionHandlerTest method shouldCreateResponseWithExactInstances.
@Test
public void shouldCreateResponseWithExactInstances() {
long stackId = 1L;
UnhealthyInstancesDetectionRequest unhealthyInstancesDetectionRequest = new UnhealthyInstancesDetectionRequest(stackId);
Event<UnhealthyInstancesDetectionRequest> event = mock(Event.class);
when(event.getData()).thenReturn(unhealthyInstancesDetectionRequest);
Stack stack = mock(Stack.class);
when(stackService.getByIdWithTransaction(stackId)).thenReturn(stack);
Set<InstanceMetaData> unhealthyInstances = new HashSet<>();
InstanceMetaData imd1 = mock(InstanceMetaData.class);
InstanceMetaData imd2 = mock(InstanceMetaData.class);
InstanceMetaData imd3 = mock(InstanceMetaData.class);
unhealthyInstances.add(imd1);
unhealthyInstances.add(imd2);
unhealthyInstances.add(imd3);
when(candidateUnhealthyInstanceSelector.selectCandidateUnhealthyInstances(stack.getId())).thenReturn(unhealthyInstances);
Set<String> unhealthyInstanceIds = new HashSet<>();
unhealthyInstanceIds.add("i-0f1e0605506aaaaaa");
unhealthyInstanceIds.add("i-0f1e0605506cccccc");
when(unhealthyInstancesFinalizer.finalizeUnhealthyInstances(stack, unhealthyInstances)).thenReturn(unhealthyInstanceIds);
unhealthyInstancesDetectionHandler.accept(event);
verify(eventBus).notify(eq(EventSelectorUtil.selector(UnhealthyInstancesDetectionResult.class)), argThat(new UnhealthyInstancesResultMatcher(unhealthyInstanceIds)));
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData in project cloudbreak by hortonworks.
the class ClusterHostServiceRunnerTest method createInstanceMetadata.
private InstanceMetaData createInstanceMetadata(String fqdn, InstanceGroup instanceGroup, String privateIp) {
InstanceMetaData imd1 = new InstanceMetaData();
imd1.setDiscoveryFQDN(fqdn);
imd1.setInstanceGroup(instanceGroup);
imd1.setPrivateIp(privateIp);
return imd1;
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData in project cloudbreak by hortonworks.
the class GrainPropertiesServiceTest method testAllInOne.
@Test
public void testAllInOne() {
when(componentLocator.getComponentLocationByHostname(eq(cluster), argThat(namenodeMatcher))).thenReturn(Map.of("NAMENODE", List.of("NMHOST")));
when(componentLocator.getComponentLocationByHostname(eq(cluster), argThat(knoxGatewayMatcher))).thenReturn(Map.of("KNOX_GATEWAY", List.of("KWGHOST")));
GatewayConfig gwconfig = mock(GatewayConfig.class);
when(gwconfig.getPublicAddress()).thenReturn("GWPUBADDR");
when(gwconfig.getHostname()).thenReturn("GWHOSTNAME");
Node node1 = new Node("", "", "", "", "node1fqdn", "");
InstanceMetaData im1 = new InstanceMetaData();
im1.setDiscoveryFQDN(node1.getHostname());
InstanceGroup logIg = new InstanceGroup();
logIg.setAttributes(new Json("{}"));
logIg.setCloudIdentityType(CloudIdentityType.LOG);
im1.setInstanceGroup(logIg);
when(instanceMetaDataService.getAllInstanceMetadataByStackId(1L)).thenReturn(Set.of(im1));
List<GrainProperties> result = underTest.createGrainProperties(List.of(gwconfig), cluster, Set.of(node1));
assertThat(result, hasItem(allOf(hasProperty("properties", allOf(hasEntry("GWHOSTNAME", Map.of("gateway-address", "GWPUBADDR")))))));
assertThat(result, hasItem(allOf(hasProperty("properties", allOf(hasEntry("NMHOST", Map.of("roles", "namenode")))))));
assertThat(result, hasItem(allOf(hasProperty("properties", allOf(hasEntry("KWGHOST", Map.of("roles", "knox")))))));
assertThat(result, hasItem(allOf(hasProperty("properties", allOf(hasEntry("node1fqdn", Map.of("roles", "LOG_CLOUD_IDENTITY_ROLE")))))));
}
use of com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData in project cloudbreak by hortonworks.
the class ClusterUpscaleServiceTest method newInstance.
private InstanceMetaData newInstance(InstanceStatus status) {
InstanceMetaData instance = new InstanceMetaData();
instance.setInstanceStatus(status);
return instance;
}
Aggregations