Search in sources :

Example 6 with StackImageV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response in project cloudbreak by hortonworks.

the class ImageToStackImageV4ResponseConverterTest method shouldAllowNullImageCatalogUrlInCaseOfCustomImageCatalog.

@Test
public void shouldAllowNullImageCatalogUrlInCaseOfCustomImageCatalog() {
    ImageCatalog imageCatalog = new ImageCatalog();
    Image image = anImageWithoutImageCatalogUrl();
    when(restRequestThreadLocalService.getRequestedWorkspaceId()).thenReturn(WORKSPACE_ID);
    when(imageCatalogService.getImageCatalogByName(WORKSPACE_ID, IMAGE_CATALOG_NAME)).thenReturn(imageCatalog);
    StackImageV4Response actual = victim.convert(image);
    assertNull(actual.getCatalogUrl());
    assertEquals(IMAGE_CATALOG_NAME, actual.getCatalogName());
    assertEquals(IMAGE_ID, actual.getId());
    assertEquals(IMAGE_NAME, actual.getName());
}
Also used : StackImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response) Image(com.sequenceiq.cloudbreak.cloud.model.Image) ImageCatalog(com.sequenceiq.cloudbreak.domain.ImageCatalog) Test(org.junit.jupiter.api.Test)

Example 7 with StackImageV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response in project cloudbreak by hortonworks.

the class ImageToStackImageV4ResponseConverter method convert.

public StackImageV4Response convert(Image source) {
    StackImageV4Response image = new StackImageV4Response();
    image.setName(source.getImageName());
    decorateWithImageCatalogUrl(source, image);
    image.setCatalogName(Strings.isNullOrEmpty(source.getImageCatalogName()) ? "cloudbreak-default" : source.getImageCatalogName());
    image.setId(Strings.isNullOrEmpty(source.getImageId()) ? null : source.getImageId());
    return image;
}
Also used : StackImageV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response)

Aggregations

StackImageV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.image.StackImageV4Response)7 Image (com.sequenceiq.cloudbreak.cloud.model.Image)4 CloudbreakDetailsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.CloudbreakDetailsV4Response)3 PlacementSettingsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.PlacementSettingsV4Response)3 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)3 StackAuthenticationV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.authentication.StackAuthenticationV4Response)3 CustomDomainSettingsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.customdomain.CustomDomainSettingsV4Response)3 DatabaseResponse (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.database.DatabaseResponse)3 InstanceGroupV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.instancegroup.InstanceGroupV4Response)3 NetworkV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.network.NetworkV4Response)3 WorkspaceResourceV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.workspace.responses.WorkspaceResourceV4Response)3 AbstractEntityConverterTest (com.sequenceiq.cloudbreak.converter.AbstractEntityConverterTest)3 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)3 TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)3 Test (org.junit.Test)3 TestFailException (com.sequenceiq.it.cloudbreak.exception.TestFailException)2 ClusterV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.cluster.ClusterV4Response)1 ImageCatalog (com.sequenceiq.cloudbreak.domain.ImageCatalog)1 StackAuthentication (com.sequenceiq.cloudbreak.domain.StackAuthentication)1 LoadBalancer (com.sequenceiq.cloudbreak.domain.stack.loadbalancer.LoadBalancer)1