Source:
<code><START> private static ServerTemplate createServerTemplateWithContainer(String templateName, int templateCount) { <END> ServerTemplate template = new ServerTemplate(); template = new ServerTemplate(); template.setName(templateName); template.setId(UUID.randomUUID().toString()); specManageService.saveServerTemplate(template); Collection<org.kie.server.controller.api.model.spec.ServerTemplateKey> existing = specManageService.listServerTemplateKeys(); assertNotNull(existing); assertEquals(templateCount, existing.size()); Map<Capability, ContainerConfig> configs = new HashMap<Capability, ContainerConfig>(); RuleConfig ruleConfig = new RuleConfig(); ruleConfig.setPollInterval(1000l); ruleConfig.setScannerStatus(KieScannerStatus.STARTED); configs.put(Capability.RULE, ruleConfig); ProcessConfig processConfig = new ProcessConfig(); processConfig.setKBase("defaultKieBase"); processConfig.setKSession("defaultKieSession"); processConfig.setMergeMode("MERGE_COLLECTION"); processConfig.setRuntimeStrategy("PER_PROCESS_INSTANCE"); configs.put(Capability.PROCESS, processConfig); ContainerSpec containerSpec = new ContainerSpec(); containerSpec.setId("test container"); containerSpec.setServerTemplateKey(new ServerTemplateKey(template.getId(), template.getName())); containerSpec.setReleasedId(new ReleaseId("org.kie", "kie-server-kjar", "1.0")); containerSpec.setStatus(KieContainerStatus.STOPPED); containerSpec.setConfigs(configs); specManageService.saveContainerSpec(template.getId(), containerSpec); Container container = new Container(); container.setServerInstanceId(template.getId()); container.setServerTemplateId(template.getId()); container.setResolvedReleasedId(containerSpec.getReleasedId()); container.setContainerName(containerSpec.getContainerName()); container.setContainerSpecId(containerSpec.getId()); container.setUrl("<LINK_0>"); container.setStatus(containerSpec.getStatus()); return template; }</code><technical_language>This method is similar AbstractServiceImplTest.createServerTemplateWithContainer(). modify satisfy needs reduce duplication</technical_language>

Target:
private static ServerTemplate createServerTemplateWithContainer(String templateName, int templateCount) { ServerTemplate template = new ServerTemplate(); template.setName(templateName); template.setId(UUID.randomUUID().toString()); Map<Capability, ContainerConfig> configs = new HashMap<Capability, ContainerConfig>(); RuleConfig ruleConfig = new RuleConfig(); ruleConfig.setPollInterval(1000l); ruleConfig.setScannerStatus(KieScannerStatus.STARTED); configs.put(Capability.RULE, ruleConfig); ProcessConfig processConfig = new ProcessConfig(); processConfig.setKBase("defaultKieBase"); processConfig.setKSession("defaultKieSession"); processConfig.setMergeMode("MERGE_COLLECTION"); processConfig.setRuntimeStrategy("PER_PROCESS_INSTANCE"); configs.put(Capability.PROCESS, processConfig); ContainerSpec containerSpec = new ContainerSpec(); containerSpec.setId("test container"); containerSpec.setServerTemplateKey(new ServerTemplateKey(template.getId(), template.getName())); containerSpec.setReleasedId(new ReleaseId("org.kie", "kie-server-kjar", "1.0")); containerSpec.setStatus(KieContainerStatus.STOPPED); containerSpec.setConfigs(configs); containerSpec.setServerTemplateKey(new ServerTemplateKey(template.getId(), template.getName())); template.addContainerSpec(containerSpec); Container container = new Container(); container.setServerInstanceId(template.getId()); container.setServerTemplateId(template.getId()); container.setResolvedReleasedId(containerSpec.getReleasedId()); container.setContainerName(containerSpec.getContainerName()); container.setContainerSpecId(containerSpec.getId()); container.setUrl("<LINK_0>"); container.setStatus(containerSpec.getStatus()); return template; }