Source:
<code>public void getContainersByContainerSpec_returnsContainerSpecData() { final String templateId = "templateId", templateName = "templateName", serverInstanceId = "serverInstanceId", containerSpecId = "g1:a1:1"; ServerInstanceKey serverInstanceKey = new ServerInstanceKey(templateId, null, serverInstanceId, null); final String containerName = "containerName1"; <START> final ReleaseId releaseId = new ReleaseId("g1", "a1", "1"); <END> Container container = new Container(containerSpecId, containerName, serverInstanceKey, Collections.emptyList(), releaseId, null); ContainerSpec containerSpec = new ContainerSpec( containerSpecId, containerName, new ServerTemplateKey(templateId, templateName), releaseId, KieContainerStatus.STARTED, Collections.emptyMap() ); ServerTemplate serverTemplate = new ServerTemplate( templateId, templateName, Collections.emptyList(), Collections.emptyMap(), Arrays.asList(containerSpec) ); final List<Container> containersInServerInstance = Collections.singletonList(container); KieServerTemplateStorage templateStorageMock = mock(KieServerTemplateStorage.class); when(templateStorageMock.load(eq(templateId))) .thenReturn(serverTemplate); KieServerInstanceManager instanceMangerMock = mock(KieServerInstanceManager.class); when(instanceMangerMock.getContainers(eq(serverTemplate), eq(containerSpec))) .thenReturn(containersInServerInstance); RuntimeManagementServiceCDI testedService = new RuntimeManagementServiceCDI(); testedService.setTemplateStorage(templateStorageMock); testedService.setKieServerInstanceManager(instanceMangerMock); ContainerSpecData containerSpecData = testedService.getContainersByContainerSpec(templateId, containerSpecId); assertThat(containerSpecData.getContainers()).contains(container); assertThat(containerSpecData.getContainerSpec()).isEqualTo(containerSpec); }</code><technical_language>releaseId containerSpecId related in principle, in practice</technical_language>

Target:
public void getContainersByContainerSpec_returnsContainerSpecData() { final String templateId = "templateId", templateName = "templateName", serverInstanceId = "serverInstanceId", containerName = "containerName1", group = "g1", artifact = "a1", version = "1", containerSpecId = String.join(":", group, artifact, version); final ReleaseId releaseId = new ReleaseId(group, artifact, version); ServerInstanceKey serverInstanceKey = new ServerInstanceKey(templateId, null, serverInstanceId, null); Container container = new Container(containerSpecId, containerName, serverInstanceKey, Collections.emptyList(), releaseId, null); ContainerSpec containerSpec = new ContainerSpec( containerSpecId, containerName, new ServerTemplateKey(templateId, templateName), releaseId, KieContainerStatus.STARTED, Collections.emptyMap() ); ServerTemplate serverTemplate = new ServerTemplate( templateId, templateName, Collections.emptyList(), Collections.emptyMap(), Collections.singletonList(containerSpec) ); final List<Container> containersInServerInstance = Collections.singletonList(container); KieServerTemplateStorage templateStorageMock = createMockStorageWithOneTemplate(serverTemplate); KieServerInstanceManager instanceMangerMock = mock(KieServerInstanceManager.class); when(instanceMangerMock.getContainers(eq(serverTemplate), eq(containerSpec))) .thenReturn(containersInServerInstance); RuntimeManagementServiceCDI testedService = new RuntimeManagementServiceCDI(); testedService.setTemplateStorage(templateStorageMock); testedService.setKieServerInstanceManager(instanceMangerMock); ContainerSpecData containerSpecData = testedService.getContainersByContainerSpec(templateId, containerSpecId); assertThat(containerSpecData.getContainers()).contains(container); assertThat(containerSpecData.getContainerSpec()).isEqualTo(containerSpec); }