use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class HostGroupV4RequestToHostGroupConverterTest method testConvertWhenHostNameUpperCase.
@Test
public void testConvertWhenHostNameUpperCase() {
HostGroupV4Request source = new HostGroupV4Request();
source.setName("MixEdName");
HostGroup actual = underTest.convert(source);
assertEquals(actual.getName(), "mixedname");
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class DatahubRestResourceAuditEventConverter method requestParameters.
@Override
public Map<String, Object> requestParameters(StructuredRestCallEvent structuredEvent) {
Map<String, Object> params = legacyRestCommonService.addClusterCrnAndNameIfPresent(structuredEvent);
OperationDetails operation = structuredEvent.getOperation();
Optional<Stack> stack = stackService.findStackByNameAndWorkspaceId(operation.getResourceName(), operation.getWorkspaceId());
AuditEventName auditEventName = auditEventName(structuredEvent);
if (stack.isPresent() && auditEventName == AuditEventName.RESIZE_DATAHUB_CLUSTER) {
Json json = new Json(structuredEvent.getRestCall().getRestRequest().getBody());
String group = json.getValue("group");
HostGroup hostGroup = hostGroupService.getByClusterIdAndNameWithRecipes(stack.get().getCluster().getId(), group);
Integer desiredCount = json.getValue("desiredCount");
Integer originalNodeCount = hostGroup.getInstanceGroup().getNodeCount();
params.put("desiredCount", desiredCount);
params.put("originalCount", originalNodeCount);
params.put("hostGroup", group);
}
return params;
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClouderaManagerModificationServiceTest method setUp.
@BeforeEach
void setUp() {
MockitoAnnotations.openMocks(this);
stack.setName(STACK_NAME);
cluster = new Cluster();
cluster.setId(CLUSTER_ID);
cluster.setName(STACK_NAME);
stack.setCluster(cluster);
stack.setResourceCrn("crn:cdp:cloudbreak:us-west-1:someone:stack:12345");
hostGroup = new HostGroup();
hostGroup.setName(HOST_GROUP_NAME);
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClouderaManagerDecomissionerTest method createHostGroup.
private HostGroup createHostGroup() {
HostGroup hostGroup = new HostGroup();
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroup.setInstanceMetaData(Set.of(createDeletedInstanceMetadata(), createRunningInstanceMetadata()));
hostGroup.setInstanceGroup(instanceGroup);
return hostGroup;
}
use of com.sequenceiq.cloudbreak.domain.stack.cluster.host.HostGroup in project cloudbreak by hortonworks.
the class ClouderaManagerDecommisionerTest method createTestHostGroup.
private HostGroup createTestHostGroup(Long id, String name, int hostCount) {
HostGroup hostGroup = new HostGroup();
hostGroup.setName(name);
hostGroup.setId(id);
InstanceGroup instanceGroup = new InstanceGroup();
instanceGroup.setGroupName(name);
Set<InstanceMetaData> instanceMetaDatas = new HashSet<>();
for (long i = 0; i < hostCount; i++) {
InstanceMetaData instanceMetaData = new InstanceMetaData();
instanceMetaData.setInstanceId(name + "-instanceid-" + i);
instanceMetaData.setDiscoveryFQDN(name + "-host-" + i);
instanceMetaData.setInstanceGroup(instanceGroup);
instanceMetaData.setInstanceStatus(InstanceStatus.SERVICES_HEALTHY);
instanceMetaDatas.add(instanceMetaData);
}
instanceGroup.setInstanceMetaData(instanceMetaDatas);
hostGroup.setInstanceGroup(instanceGroup);
return hostGroup;
}
Aggregations