use of com.sequenceiq.cloudbreak.api.model.BlueprintRequest in project cloudbreak by hortonworks.
the class BlueprintCreationTest method testBlueprintCreation.
@Test
@Parameters({ "blueprintName", "blueprintFile" })
public void testBlueprintCreation(@Optional("it-hdp-multi-blueprint") String blueprintName, @Optional("classpath:/blueprint/hdp-multinode-default.bp") String blueprintFile) throws Exception {
// GIVEN
String blueprintContent = ResourceUtil.readStringFromResource(applicationContext, blueprintFile);
// WHEN
BlueprintRequest blueprintRequest = new BlueprintRequest();
blueprintRequest.setName(blueprintName);
blueprintRequest.setDescription("Blueprint for integration testing");
blueprintRequest.setAmbariBlueprint(blueprintContent);
String id = getCloudbreakClient().blueprintEndpoint().postPrivate(blueprintRequest).getId().toString();
// THEN
Assert.assertNotNull(id);
getItContext().putContextParam(CloudbreakITContextConstants.BLUEPRINT_ID, id, true);
}
use of com.sequenceiq.cloudbreak.api.model.BlueprintRequest in project cloudbreak by hortonworks.
the class BlueprintToBlueprintRequestConverter method convert.
@Override
public BlueprintRequest convert(Blueprint source) {
BlueprintRequest blueprintRequest = new BlueprintRequest();
blueprintRequest.setName("");
blueprintRequest.setDescription(source.getDescription());
blueprintRequest.setAmbariBlueprint(source.getBlueprintText());
return blueprintRequest;
}
use of com.sequenceiq.cloudbreak.api.model.BlueprintRequest in project cloudbreak by hortonworks.
the class DefaultBlueprintCache method loadBlueprintsFromFile.
@PostConstruct
public void loadBlueprintsFromFile() {
for (String blueprintStrings : blueprintArray) {
try {
String[] split = blueprintStrings.split("=");
if (blueprintUtils.isBlueprintNamePreConfigured(blueprintStrings, split)) {
LOGGER.info("Load default validation '{}'.", blueprintStrings);
BlueprintRequest blueprintJson = new BlueprintRequest();
blueprintJson.setName(split[0].trim());
JsonNode jsonNode = blueprintUtils.convertStringToJsonNode(blueprintUtils.readDefaultBlueprintFromFile(split));
blueprintJson.setAmbariBlueprint(jsonNode.get("blueprint").toString());
Blueprint bp = converter.convert(blueprintJson);
JsonNode inputs = jsonNode.get("inputs");
JsonNode description = jsonNode.get("description");
bp.setDescription(description == null ? split[0] : description.asText(split[0]));
BlueprintInputParameters inputParameters = new BlueprintInputParameters(blueprintUtils.prepareInputs(inputs));
bp.setInputParameters(new Json(inputParameters));
defaultBlueprints.put(bp.getName(), bp);
}
} catch (IOException e) {
LOGGER.info("Can not read default validation from file: ", e);
}
}
}
Aggregations