@Test void convertTestTemplateConversion() { InstanceGroupRequest request = new InstanceGroupRequest(); InstanceTemplateRequest instanceTemplateRequest = mock(InstanceTemplateRequest.class); request.setInstanceTemplateRequest(instanceTemplateRequest); Template template = mock(Template.class); when(templateConverter.convert(instanceTemplateRequest, MOCK, ACCOUNT_ID)).thenReturn(template); InstanceGroup result = underTest.convert(request, ACCOUNT_ID, MOCK.name(), NAME, HOSTNAME, DOMAINNAME); assertThat(result).isNotNull(); assertThat(result.getTemplate()).isSameAs(template); }
public InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain) { InstanceGroup instanceGroup = new InstanceGroup(); CloudPlatform cloudPlatform = CloudPlatform.valueOf(cloudPlatformString); instanceGroup.setTemplate(source.getInstanceTemplate() == null ? defaultInstanceGroupProvider.createDefaultTemplate(cloudPlatform, accountId) : templateConverter.convert(source.getInstanceTemplate(), cloudPlatform, accountId)); instanceGroup.setSecurityGroup(securityGroupConverter.convert(source.getSecurityGroup())); String instanceGroupName = source.getName(); instanceGroup.setGroupName(instanceGroupName); instanceGroup.setInstanceGroupType(source.getType()); instanceGroup.setAttributes(defaultInstanceGroupProvider.createAttributes(cloudPlatform, stackName, instanceGroupName)); if (source.getNodeCount() > 0) { addInstanceMetadatas(source, instanceGroup, hostname, domain); } instanceGroup.setNodeCount(source.getNodeCount()); return instanceGroup; }
InstanceGroupRequestToInstanceGroupConverter { public InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain) { InstanceGroup instanceGroup = new InstanceGroup(); CloudPlatform cloudPlatform = CloudPlatform.valueOf(cloudPlatformString); instanceGroup.setTemplate(source.getInstanceTemplate() == null ? defaultInstanceGroupProvider.createDefaultTemplate(cloudPlatform, accountId) : templateConverter.convert(source.getInstanceTemplate(), cloudPlatform, accountId)); instanceGroup.setSecurityGroup(securityGroupConverter.convert(source.getSecurityGroup())); String instanceGroupName = source.getName(); instanceGroup.setGroupName(instanceGroupName); instanceGroup.setInstanceGroupType(source.getType()); instanceGroup.setAttributes(defaultInstanceGroupProvider.createAttributes(cloudPlatform, stackName, instanceGroupName)); if (source.getNodeCount() > 0) { addInstanceMetadatas(source, instanceGroup, hostname, domain); } instanceGroup.setNodeCount(source.getNodeCount()); return instanceGroup; } }
InstanceGroupRequestToInstanceGroupConverter { public InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain) { InstanceGroup instanceGroup = new InstanceGroup(); CloudPlatform cloudPlatform = CloudPlatform.valueOf(cloudPlatformString); instanceGroup.setTemplate(source.getInstanceTemplate() == null ? defaultInstanceGroupProvider.createDefaultTemplate(cloudPlatform, accountId) : templateConverter.convert(source.getInstanceTemplate(), cloudPlatform, accountId)); instanceGroup.setSecurityGroup(securityGroupConverter.convert(source.getSecurityGroup())); String instanceGroupName = source.getName(); instanceGroup.setGroupName(instanceGroupName); instanceGroup.setInstanceGroupType(source.getType()); instanceGroup.setAttributes(defaultInstanceGroupProvider.createAttributes(cloudPlatform, stackName, instanceGroupName)); if (source.getNodeCount() > 0) { addInstanceMetadatas(source, instanceGroup, hostname, domain); } instanceGroup.setNodeCount(source.getNodeCount()); return instanceGroup; }  }
InstanceGroupRequestToInstanceGroupConverter { public InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain) { InstanceGroup instanceGroup = new InstanceGroup(); CloudPlatform cloudPlatform = CloudPlatform.valueOf(cloudPlatformString); instanceGroup.setTemplate(source.getInstanceTemplate() == null ? defaultInstanceGroupProvider.createDefaultTemplate(cloudPlatform, accountId) : templateConverter.convert(source.getInstanceTemplate(), cloudPlatform, accountId)); instanceGroup.setSecurityGroup(securityGroupConverter.convert(source.getSecurityGroup())); String instanceGroupName = source.getName(); instanceGroup.setGroupName(instanceGroupName); instanceGroup.setInstanceGroupType(source.getType()); instanceGroup.setAttributes(defaultInstanceGroupProvider.createAttributes(cloudPlatform, stackName, instanceGroupName)); if (source.getNodeCount() > 0) { addInstanceMetadatas(source, instanceGroup, hostname, domain); } instanceGroup.setNodeCount(source.getNodeCount()); return instanceGroup; }  InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain); }
InstanceGroupRequestToInstanceGroupConverter { public InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain) { InstanceGroup instanceGroup = new InstanceGroup(); CloudPlatform cloudPlatform = CloudPlatform.valueOf(cloudPlatformString); instanceGroup.setTemplate(source.getInstanceTemplate() == null ? defaultInstanceGroupProvider.createDefaultTemplate(cloudPlatform, accountId) : templateConverter.convert(source.getInstanceTemplate(), cloudPlatform, accountId)); instanceGroup.setSecurityGroup(securityGroupConverter.convert(source.getSecurityGroup())); String instanceGroupName = source.getName(); instanceGroup.setGroupName(instanceGroupName); instanceGroup.setInstanceGroupType(source.getType()); instanceGroup.setAttributes(defaultInstanceGroupProvider.createAttributes(cloudPlatform, stackName, instanceGroupName)); if (source.getNodeCount() > 0) { addInstanceMetadatas(source, instanceGroup, hostname, domain); } instanceGroup.setNodeCount(source.getNodeCount()); return instanceGroup; }  InstanceGroup convert(InstanceGroupRequest source, String accountId, String cloudPlatformString, String stackName, String hostname, String domain);  }