Source:
public void testContainerSpecSerialization() { final ContainerSpec spec = new ContainerSpec(); spec.setId("id"); spec.setContainerName("name"); spec.setStatus(KieContainerStatus.STARTED); spec.setReleasedId(new ReleaseId("groupId", "artifactId", "1.0")); final ProcessConfig processConfig = new ProcessConfig("runtimeStrategy", "kBase", "kSession", "mergeMode"); spec.addConfig(Capability.PROCESS, processConfig); final RuleConfig ruleConfig = new RuleConfig(1l, KieScannerStatus.SCANNING); spec.addConfig(Capability.RULE, ruleConfig); final String specContent = ControllerUtils.marshal(marshallingFormat.getType(), spec); LOGGER.info("{} content\n{}", marshallingFormat.getType(), specContent); final ContainerSpec specResult = ControllerUtils.unmarshal(specContent, marshallingFormat.getType(), ContainerSpec.class); assertNotNull(specResult); assertEquals(spec, specResult); assertEquals(spec.getId(), specResult.getId()); assertEquals(spec.getStatus(), specResult.getStatus()); assertEquals(spec.getContainerName(), specResult.getContainerName()); assertEquals(spec.getConfigs(), specResult.getConfigs()); assertEquals(spec.getReleasedId(), specResult.getReleasedId()); assertNotNull(specResult.getConfigs()); final ContainerConfig processConfigResult = specResult.getConfigs().get(Capability.PROCESS); assertNotNull(processConfigResult); assertTrue(processConfigResult instanceof ProcessConfig); assertEquals(processConfig, processConfigResult); final ContainerConfig ruleConfigResult = specResult.getConfigs().get(Capability.RULE); assertNotNull(ruleConfigResult); assertTrue(ruleConfigResult instanceof RuleConfig); assertEquals(ruleConfig, ruleConfigResult); }

Target:
public void testContainerSpecSerialization() { final ContainerSpec spec = new ContainerSpec(); spec.setId("id"); spec.setContainerName("name"); spec.setStatus(KieContainerStatus.STARTED); spec.setReleasedId(new ReleaseId("groupId", "artifactId", "1.0")); final ProcessConfig processConfig = new ProcessConfig("runtimeStrategy", "kBase", "kSession", "mergeMode"); spec.addConfig(Capability.PROCESS, processConfig); final RuleConfig ruleConfig = new RuleConfig(1L, KieScannerStatus.SCANNING); spec.addConfig(Capability.RULE, ruleConfig); final String specContent = ControllerUtils.marshal(marshallingFormat.getType(), spec); LOGGER.info("{} content\n{}", marshallingFormat.getType(), specContent); final ContainerSpec specResult = ControllerUtils.unmarshal(specContent, marshallingFormat.getType(), ContainerSpec.class); assertNotNull(specResult); assertEquals(spec, specResult); assertEquals(spec.getId(), specResult.getId()); assertEquals(spec.getStatus(), specResult.getStatus()); assertEquals(spec.getContainerName(), specResult.getContainerName()); assertEquals(spec.getConfigs(), specResult.getConfigs()); assertEquals(spec.getReleasedId(), specResult.getReleasedId()); assertNotNull(specResult.getConfigs()); final ContainerConfig processConfigResult = specResult.getConfigs().get(Capability.PROCESS); assertNotNull(processConfigResult); assertTrue(processConfigResult instanceof ProcessConfig); assertEquals(processConfig, processConfigResult); final ContainerConfig ruleConfigResult = specResult.getConfigs().get(Capability.RULE); assertNotNull(ruleConfigResult); assertTrue(ruleConfigResult instanceof RuleConfig); assertEquals(ruleConfig, ruleConfigResult); }