@Test public void testBuildInstance() throws Exception { InstanceMetaData instanceMetaData = mock(InstanceMetaData.class); InstanceGroup instanceGroup = mock(InstanceGroup.class); ImageEntity imageEntity = mock(ImageEntity.class); when(imageService.getByStack(any())).thenReturn(imageEntity); when(imageEntity.getImageName()).thenReturn(IMAGE_NAME); when(instanceMetaData.getInstanceId()).thenReturn(INSTANCE_ID); when(instanceGroup.getGroupName()).thenReturn(GROUP_NAME); Template template = mock(Template.class); when(instanceGroup.getTemplate()).thenReturn(template); when(template.getVolumeCount()).thenReturn(VOLUME_COUNT); CloudInstance cloudInstance = underTest.buildInstance(stack, instanceMetaData, instanceGroup, stackAuthentication, 0L, InstanceStatus.CREATED); assertEquals(INSTANCE_ID, cloudInstance.getInstanceId()); }
public CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup, StackAuthentication stackAuthentication, Long privateId, InstanceStatus status) { ImageEntity imageEntity = imageService.getByStack(stack); return buildInstance(instanceMetaData, instanceGroup, stackAuthentication, privateId, status, imageEntity.getImageName(), stack.getEnvironmentCrn()); }
StackToCloudStackConverter implements Converter<Stack, CloudStack> { public CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup, StackAuthentication stackAuthentication, Long privateId, InstanceStatus status) { ImageEntity imageEntity = imageService.getByStack(stack); return buildInstance(instanceMetaData, instanceGroup, stackAuthentication, privateId, status, imageEntity.getImageName(), stack.getEnvironmentCrn()); } }
StackToCloudStackConverter implements Converter<Stack, CloudStack> { public CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup, StackAuthentication stackAuthentication, Long privateId, InstanceStatus status) { ImageEntity imageEntity = imageService.getByStack(stack); return buildInstance(instanceMetaData, instanceGroup, stackAuthentication, privateId, status, imageEntity.getImageName(), stack.getEnvironmentCrn()); }  }
StackToCloudStackConverter implements Converter<Stack, CloudStack> { public CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup, StackAuthentication stackAuthentication, Long privateId, InstanceStatus status) { ImageEntity imageEntity = imageService.getByStack(stack); return buildInstance(instanceMetaData, instanceGroup, stackAuthentication, privateId, status, imageEntity.getImageName(), stack.getEnvironmentCrn()); }  @Override CloudStack convert(Stack stack); CloudStack convertForDownscale(Stack stack, Set<String> deleteRequestedInstances); CloudStack convertForTermination(Stack stack, String instanceId); CloudStack convert(Stack stack, Collection<String> deleteRequestedInstances); CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup,
            StackAuthentication stackAuthentication, Long privateId, InstanceStatus status); List<CloudInstance> buildInstances(Stack stack); Map<String, Object> buildCloudInstanceParameters(String environmentCrn, InstanceMetaData instanceMetaData); }
StackToCloudStackConverter implements Converter<Stack, CloudStack> { public CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup, StackAuthentication stackAuthentication, Long privateId, InstanceStatus status) { ImageEntity imageEntity = imageService.getByStack(stack); return buildInstance(instanceMetaData, instanceGroup, stackAuthentication, privateId, status, imageEntity.getImageName(), stack.getEnvironmentCrn()); }  @Override CloudStack convert(Stack stack); CloudStack convertForDownscale(Stack stack, Set<String> deleteRequestedInstances); CloudStack convertForTermination(Stack stack, String instanceId); CloudStack convert(Stack stack, Collection<String> deleteRequestedInstances); CloudInstance buildInstance(Stack stack, InstanceMetaData instanceMetaData, InstanceGroup instanceGroup,
            StackAuthentication stackAuthentication, Long privateId, InstanceStatus status); List<CloudInstance> buildInstances(Stack stack); Map<String, Object> buildCloudInstanceParameters(String environmentCrn, InstanceMetaData instanceMetaData);  }