Source:
public void testStoreAndLoadServerTemplates() { templateStorage.store(serverTemplate); Collection<ServerTemplateKey> templateKeys = templateStorage.loadKeys(); assertNotNull(templateKeys); assertEquals(1, templateKeys.size()); ServerTemplateKey templateKey = templateKeys.iterator().next(); assertNotNull(templateKey); assertEquals(serverTemplate.getId(), templateKey.getId()); if (isRequired()) assertEquals(serverTemplate.getName(), templateKey.getName()); Collection<ServerTemplate> templates = templateStorage.load(); assertNotNull(templates); assertEquals(1, templates.size()); ServerTemplate template = templates.iterator().next(); assertNotNull(template); assertEquals(serverTemplate.getId(), template.getId()); if (isRequired()) assertEquals(serverTemplate.getName(), template.getName()); checkTemplateInstances(template); Collection<ContainerSpec> containerSpecs = template.getContainersSpec(); assertNotNull(containerSpecs); assertEquals(1, containerSpecs.size()); ContainerSpec spec = containerSpecs.iterator().next(); assertNotNull(spec); assertEquals(containerSpec.getId(), spec.getId()); assertEquals(containerSpec.getReleasedId(), spec.getReleasedId()); assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId()); if (isRequired()) assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName()); assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size()); assertTrue(spec.getConfigs().containsKey(Capability.RULE)); assertTrue(spec.getConfigs().containsKey(Capability.PROCESS)); RuleConfig ruleConfig = (RuleConfig) spec.getConfigs().get(Capability.RULE); assertNotNull(ruleConfig); assertEquals(this.ruleConfig.getPollInterval(), ruleConfig.getPollInterval()); assertEquals(this.ruleConfig.getScannerStatus(), ruleConfig.getScannerStatus()); ProcessConfig processConfig = (ProcessConfig) spec.getConfigs().get(Capability.PROCESS); assertNotNull(processConfig); assertEquals(this.processConfig.getKBase(), processConfig.getKBase()); assertEquals(this.processConfig.getKSession(), processConfig.getKSession()); assertEquals(this.processConfig.getMergeMode(), processConfig.getMergeMode()); assertEquals(this.processConfig.getRuntimeStrategy(), processConfig.getRuntimeStrategy()); }

Target:
public void testStoreAndLoadServerTemplates() { templateStorage.store(serverTemplate); Collection<ServerTemplateKey> templateKeys = templateStorage.loadKeys(); assertNotNull(templateKeys); assertEquals(1, templateKeys.size()); ServerTemplateKey templateKey = templateKeys.iterator().next(); assertNotNull(templateKey); assertEquals(serverTemplate.getId(), templateKey.getId()); if (isEnclosedTestAssertionRequired()) { assertEquals(serverTemplate.getName(), templateKey.getName()); } Collection<ServerTemplate> templates = templateStorage.load(); assertNotNull(templates); assertEquals(1, templates.size()); ServerTemplate template = templates.iterator().next(); assertNotNull(template); assertEquals(serverTemplate.getId(), template.getId()); if (isEnclosedTestAssertionRequired()) { assertEquals(serverTemplate.getName(), template.getName()); } checkTemplateInstances(template); Collection<ContainerSpec> containerSpecs = template.getContainersSpec(); assertNotNull(containerSpecs); assertEquals(1, containerSpecs.size()); ContainerSpec spec = containerSpecs.iterator().next(); assertNotNull(spec); assertEquals(containerSpec.getId(), spec.getId()); assertEquals(containerSpec.getReleasedId(), spec.getReleasedId()); assertEquals(containerSpec.getServerTemplateKey().getId(), spec.getServerTemplateKey().getId()); if (isEnclosedTestAssertionRequired()) { assertEquals(containerSpec.getServerTemplateKey().getName(), spec.getServerTemplateKey().getName()); } assertEquals(containerSpec.getConfigs().size(), spec.getConfigs().size()); assertTrue(spec.getConfigs().containsKey(Capability.RULE)); assertTrue(spec.getConfigs().containsKey(Capability.PROCESS)); RuleConfig ruleConfig = (RuleConfig) spec.getConfigs().get(Capability.RULE); assertNotNull(ruleConfig); assertEquals(this.ruleConfig.getPollInterval(), ruleConfig.getPollInterval()); assertEquals(this.ruleConfig.getScannerStatus(), ruleConfig.getScannerStatus()); ProcessConfig processConfig = (ProcessConfig) spec.getConfigs().get(Capability.PROCESS); assertNotNull(processConfig); assertEquals(this.processConfig.getKBase(), processConfig.getKBase()); assertEquals(this.processConfig.getKSession(), processConfig.getKSession()); assertEquals(this.processConfig.getMergeMode(), processConfig.getMergeMode()); assertEquals(this.processConfig.getRuntimeStrategy(), processConfig.getRuntimeStrategy()); }