Search in sources :

Example 1 with RecipeV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.responses.RecipeV4Response in project cloudbreak by hortonworks.

the class RecipeToRecipeV4ResponseConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    // WHEN
    Recipe recipe = getSource();
    when(workspaceToWorkspaceResourceV4ResponseConverter.convert(recipe.getWorkspace())).thenReturn(new WorkspaceResourceV4Response());
    RecipeV4Response result = underTest.convert(recipe);
    // THEN
    assertAllFieldsNotNull(result, List.of("created"));
}
Also used : Recipe(com.sequenceiq.cloudbreak.domain.Recipe) WorkspaceResourceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.workspace.responses.WorkspaceResourceV4Response) RecipeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.responses.RecipeV4Response) Test(org.junit.Test) AbstractEntityConverterTest(com.sequenceiq.cloudbreak.converter.AbstractEntityConverterTest)

Example 2 with RecipeV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.responses.RecipeV4Response in project cloudbreak by hortonworks.

the class RecipeToRecipeV4ResponseConverter method convert.

public RecipeV4Response convert(Recipe recipe) {
    RecipeV4Response json = new RecipeV4Response();
    json.setName(recipe.getName());
    json.setDescription(recipe.getDescription());
    json.setType(RecipeV4Type.valueOf(recipe.getRecipeType().name()));
    json.setContent(recipe.getContent());
    WorkspaceResourceV4Response workspace = workspaceToWorkspaceResourceV4ResponseConverter.convert(recipe.getWorkspace());
    json.setWorkspace(workspace);
    json.setCreator(recipe.getCreator());
    json.setCrn(recipe.getResourceCrn());
    json.setCreated(recipe.getCreated());
    return json;
}
Also used : WorkspaceResourceV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.workspace.responses.WorkspaceResourceV4Response) RecipeV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.responses.RecipeV4Response)

Aggregations

RecipeV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.recipes.responses.RecipeV4Response)2 WorkspaceResourceV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.workspace.responses.WorkspaceResourceV4Response)2 AbstractEntityConverterTest (com.sequenceiq.cloudbreak.converter.AbstractEntityConverterTest)1 Recipe (com.sequenceiq.cloudbreak.domain.Recipe)1 Test (org.junit.Test)1