@Test public void teststoreNewImageComponent() throws CloudbreakImageNotFoundException, IOException { com.sequenceiq.cloudbreak.cloud.model.Image imageInComponent = new com.sequenceiq.cloudbreak.cloud.model.Image("imageOldName", Collections.emptyMap(), image.getOs(), image.getOsType(), statedImage.getImageCatalogUrl(), statedImage.getImageCatalogName(), "uuid2", packageVersions); when(componentConfigProviderService.getImage(anyLong())).thenReturn(imageInComponent); String imagename = "imagename"; when(imageService.determineImageName(anyString(), anyString(), eq(image))).thenReturn(imagename); underTest.storeNewImageComponent(stack, statedImage); ArgumentCaptor<Component> captor = ArgumentCaptor.forClass(Component.class); verify(componentConfigProviderService).replaceImageComponentWithNew(captor.capture()); assertEquals(ComponentType.IMAGE, captor.getValue().getComponentType()); assertEquals(ComponentType.IMAGE.name(), captor.getValue().getName()); assertEquals(imagename, captor.getValue().getAttributes().get(com.sequenceiq.cloudbreak.cloud.model.Image.class).getImageName()); assertEquals(image.getUuid(), captor.getValue().getAttributes().get(com.sequenceiq.cloudbreak.cloud.model.Image.class).getImageId()); }
public void storeNewImageComponent(Stack stack, StatedImage image) { Component imageComponent; try { Image newImage = getImageModelFromStatedImage(stack, image); imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(newImage), stack); } catch (IllegalArgumentException e) { LOGGER.info("Failed to create json", e); throw new CloudbreakServiceException("Failed to create json", e); } componentConfigProviderService.replaceImageComponentWithNew(imageComponent); }
StackImageUpdateService { public void storeNewImageComponent(Stack stack, StatedImage image) { Component imageComponent; try { Image newImage = getImageModelFromStatedImage(stack, image); imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(newImage), stack); } catch (IllegalArgumentException e) { LOGGER.info("Failed to create json", e); throw new CloudbreakServiceException("Failed to create json", e); } componentConfigProviderService.replaceImageComponentWithNew(imageComponent); } }
StackImageUpdateService { public void storeNewImageComponent(Stack stack, StatedImage image) { Component imageComponent; try { Image newImage = getImageModelFromStatedImage(stack, image); imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(newImage), stack); } catch (IllegalArgumentException e) { LOGGER.info("Failed to create json", e); throw new CloudbreakServiceException("Failed to create json", e); } componentConfigProviderService.replaceImageComponentWithNew(imageComponent); }  }
StackImageUpdateService { public void storeNewImageComponent(Stack stack, StatedImage image) { Component imageComponent; try { Image newImage = getImageModelFromStatedImage(stack, image); imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(newImage), stack); } catch (IllegalArgumentException e) { LOGGER.info("Failed to create json", e); throw new CloudbreakServiceException("Failed to create json", e); } componentConfigProviderService.replaceImageComponentWithNew(imageComponent); }  void storeNewImageComponent(Stack stack, StatedImage image); StatedImage getNewImageIfVersionsMatch(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); boolean isCbVersionOk(Stack stack); boolean isStackMatchIfPrewarmed(StatedImage image); CheckResult checkPackageVersions(Stack stack, StatedImage newImage); boolean isValidImage(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); }
StackImageUpdateService { public void storeNewImageComponent(Stack stack, StatedImage image) { Component imageComponent; try { Image newImage = getImageModelFromStatedImage(stack, image); imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(newImage), stack); } catch (IllegalArgumentException e) { LOGGER.info("Failed to create json", e); throw new CloudbreakServiceException("Failed to create json", e); } componentConfigProviderService.replaceImageComponentWithNew(imageComponent); }  void storeNewImageComponent(Stack stack, StatedImage image); StatedImage getNewImageIfVersionsMatch(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); boolean isCbVersionOk(Stack stack); boolean isStackMatchIfPrewarmed(StatedImage image); CheckResult checkPackageVersions(Stack stack, StatedImage newImage); boolean isValidImage(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl); static final String MIN_VERSION; }