Search in sources :

Example 1 with BlueprintResponse

use of com.sequenceiq.cloudbreak.api.model.BlueprintResponse in project cloudbreak by hortonworks.

the class BlueprintToBlueprintResponseConverter method convert.

@Override
public BlueprintResponse convert(Blueprint entity) {
    BlueprintResponse blueprintJson = new BlueprintResponse();
    blueprintJson.setId(entity.getId());
    blueprintJson.setName(entity.getName());
    blueprintJson.setPublicInAccount(entity.isPublicInAccount());
    blueprintJson.setDescription(entity.getDescription() == null ? "" : entity.getDescription());
    blueprintJson.setHostGroupCount(entity.getHostGroupCount());
    blueprintJson.setStatus(entity.getStatus());
    try {
        blueprintJson.setInputs(convertInputParameters(entity.getInputParameters()));
    } catch (IOException e) {
        LOGGER.error(String.format("Blueprint's (%s, id:%s) input parameters could not be converted to JSON.", entity.getName(), entity.getId()), e);
    }
    blueprintJson.setAmbariBlueprint(entity.getBlueprintText());
    return blueprintJson;
}
Also used : IOException(java.io.IOException) BlueprintResponse(com.sequenceiq.cloudbreak.api.model.BlueprintResponse)

Example 2 with BlueprintResponse

use of com.sequenceiq.cloudbreak.api.model.BlueprintResponse in project cloudbreak by hortonworks.

the class BlueprintToBlueprintResponseConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    given(jsonHelper.createJsonFromString(anyString())).willReturn(jsonNode);
    given(jsonNode.toString()).willReturn("dummyAmbariBlueprint");
    // WHEN
    BlueprintResponse result = underTest.convert(getSource());
    // THEN
    assertAllFieldsNotNull(result);
}
Also used : BlueprintResponse(com.sequenceiq.cloudbreak.api.model.BlueprintResponse) Test(org.junit.Test)

Aggregations

BlueprintResponse (com.sequenceiq.cloudbreak.api.model.BlueprintResponse)2 IOException (java.io.IOException)1 Test (org.junit.Test)1