use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class ServiceTestUtils method createBlueprint.
public static Blueprint createBlueprint(String owner, String account) {
Blueprint blueprint = new Blueprint();
blueprint.setId(1L);
blueprint.setAmbariName("test-blueprint");
blueprint.setBlueprintText("dummyText");
blueprint.setHostGroupCount(3);
blueprint.setDescription("test blueprint");
blueprint.setName("multi-node-hdfs-yarn");
blueprint.setOwner(owner);
blueprint.setAccount(account);
blueprint.setPublicInAccount(true);
return blueprint;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintLoaderServiceTest method createBlueprint.
public static Blueprint createBlueprint(ResourceStatus resourceStatus, int index) {
Blueprint blueprint = new Blueprint();
blueprint.setId(Long.valueOf(index));
blueprint.setAmbariName("test-validation" + index);
blueprint.setBlueprintText(JSON + index);
blueprint.setHostGroupCount(3);
blueprint.setStatus(resourceStatus);
blueprint.setDescription("test validation" + index);
blueprint.setName("multi-node-hdfs-yarn" + index);
blueprint.setOwner(LUCKY_MAN);
blueprint.setAccount(LOTTERY_WINNERS);
blueprint.setPublicInAccount(true);
return blueprint;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintLoaderServiceTest method generateDatabaseData.
private Set<Blueprint> generateDatabaseData(int cacheSize) {
Set<Blueprint> databaseData = new HashSet<>();
for (int i = 0; i < cacheSize; i++) {
Blueprint blueprint = createBlueprint(DEFAULT, i);
databaseData.add(blueprint);
}
return databaseData;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class AmbariDecommissionerTest method testVerifyNodeCountWithValidationException.
@Test
public void testVerifyNodeCountWithValidationException() throws CloudbreakSecuritySetupException {
thrown.expect(NotEnoughNodeException.class);
String hostGroupName = "hostGroupName";
String hostname = "hostname";
String ipAddress = "192.18.256.1";
int gatewayPort = 1234;
String ambariName = "ambari-name";
Map<String, List<String>> blueprintMap = new HashMap<>();
blueprintMap.put(hostGroupName, Collections.singletonList("DATANODE"));
Blueprint blueprint = new Blueprint();
blueprint.setName(ambariName);
blueprint.setAmbariName(ambariName);
Cluster cluster = new Cluster();
cluster.setAmbariIp(ipAddress);
cluster.setBlueprint(blueprint);
Stack stack = new Stack();
stack.setGatewayPort(gatewayPort);
stack.setId(100L);
HostGroup hostGroup = new HostGroup();
hostGroup.setName(hostGroupName);
hostGroup.setHostMetadata(Collections.singleton(getHostMetadata(0L)));
AmbariClient ambariClient = mock(AmbariClient.class);
HttpClientConfig config = new HttpClientConfig(ipAddress);
when(tlsSecurityService.buildTLSClientConfigForPrimaryGateway(stack.getId(), cluster.getAmbariIp())).thenReturn(config);
when(ambariClientProvider.getAmbariClient(config, stack.getGatewayPort(), cluster)).thenReturn(ambariClient);
when(hostGroupService.getByClusterAndHostName(cluster, hostname)).thenReturn(hostGroup);
when(ambariClient.getBlueprintMap(ambariName)).thenReturn(blueprintMap);
when(configurationService.getConfiguration(ambariClient, hostGroupName)).thenReturn(Collections.singletonMap(ConfigParam.DFS_REPLICATION.key(), "3"));
thrown.expect(NotEnoughNodeException.class);
thrown.expectMessage("There is not enough node to downscale. Check the replication factor and the ApplicationMaster occupation.");
underTest.verifyNodeCount(stack, cluster, hostname);
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class UpdateAmbariRequestToUpdateClusterRequestConverter method convert.
@Override
public UpdateClusterJson convert(ReinstallRequestV2 source) {
UpdateClusterJson updateStackJson = new UpdateClusterJson();
updateStackJson.setValidateBlueprint(true);
updateStackJson.setKerberosPassword(source.getKerberosPassword());
updateStackJson.setKerberosPrincipal(source.getKerberosPrincipal());
Blueprint blueprint = blueprintRepository.findOneByName(source.getBlueprintName(), source.getAccount());
if (blueprint != null) {
updateStackJson.setBlueprintId(blueprint.getId());
updateStackJson.setAmbariStackDetails(source.getAmbariStackDetails());
Set<HostGroupRequest> hostgroups = new HashSet<>();
for (InstanceGroupV2Request instanceGroupV2Request : source.getInstanceGroups()) {
HostGroupRequest hostGroupRequest = new HostGroupRequest();
hostGroupRequest.setRecoveryMode(instanceGroupV2Request.getRecoveryMode());
hostGroupRequest.setRecipeNames(instanceGroupV2Request.getRecipeNames());
hostGroupRequest.setName(instanceGroupV2Request.getGroup());
ConstraintJson constraintJson = new ConstraintJson();
constraintJson.setHostCount(instanceGroupV2Request.getNodeCount());
constraintJson.setInstanceGroupName(instanceGroupV2Request.getGroup());
hostGroupRequest.setConstraint(constraintJson);
hostgroups.add(hostGroupRequest);
}
updateStackJson.setHostgroups(hostgroups);
} else {
throw new BadRequestException(String.format("Blueprint '%s' not available", source.getBlueprintName()));
}
return updateStackJson;
}
Aggregations