@Test public void testSetProcessConfigAttributesWhenProcessConfigIsNotNull() { final Map<?, ?> configs = mock(Map.class); final ProcessConfig processConfig = new ProcessConfig("runtimeStrategy", "kBase", "kSession", "mergeMode"); final KieContainerResource containerResource = spy(new KieContainerResource()); final List<KieServerConfigItem> actualConfigItems = containerResource.getConfigItems(); final KieServerConfigItem expectedConfigItem0 = configItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_BASE, processConfig.getKBase()); final KieServerConfigItem expectedConfigItem1 = configItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_SESSION, processConfig.getKSession()); final KieServerConfigItem expectedConfigItem2 = configItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_MERGE_MODE, processConfig.getMergeMode()); final KieServerConfigItem expectedConfigItem3 = configItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_RUNTIME_STRATEGY, processConfig.getRuntimeStrategy()); doReturn(processConfig).when(configs).get(Capability.PROCESS); doReturn(configs).when(containerSpec).getConfigs(); instanceManager.setProcessConfigAttributes(containerSpec, containerResource); assertEquals(expectedConfigItem0, actualConfigItems.get(0)); assertEquals(expectedConfigItem1, actualConfigItems.get(1)); assertEquals(expectedConfigItem2, actualConfigItems.get(2)); assertEquals(expectedConfigItem3, actualConfigItems.get(3)); assertEquals(4, actualConfigItems.size()); }
void setProcessConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.PROCESS); if (containerConfig != null) { final ProcessConfig processConfig = (ProcessConfig) containerConfig; containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_BASE, processConfig.getKBase())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_SESSION, processConfig.getKSession())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_MERGE_MODE, processConfig.getMergeMode())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_RUNTIME_STRATEGY, processConfig.getRuntimeStrategy())); } }
KieServerInstanceManager { void setProcessConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.PROCESS); if (containerConfig != null) { final ProcessConfig processConfig = (ProcessConfig) containerConfig; containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_BASE, processConfig.getKBase())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_SESSION, processConfig.getKSession())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_MERGE_MODE, processConfig.getMergeMode())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_RUNTIME_STRATEGY, processConfig.getRuntimeStrategy())); } } }
KieServerInstanceManager { void setProcessConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.PROCESS); if (containerConfig != null) { final ProcessConfig processConfig = (ProcessConfig) containerConfig; containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_BASE, processConfig.getKBase())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_SESSION, processConfig.getKSession())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_MERGE_MODE, processConfig.getMergeMode())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_RUNTIME_STRATEGY, processConfig.getRuntimeStrategy())); } } KieServerInstanceManager(); }
KieServerInstanceManager { void setProcessConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.PROCESS); if (containerConfig != null) { final ProcessConfig processConfig = (ProcessConfig) containerConfig; containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_BASE, processConfig.getKBase())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_SESSION, processConfig.getKSession())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_MERGE_MODE, processConfig.getMergeMode())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_RUNTIME_STRATEGY, processConfig.getRuntimeStrategy())); } } KieServerInstanceManager(); static KieServerInstanceManager getInstance(); List<Container> startScanner(ServerTemplate serverTemplate,
                                        final ContainerSpec containerSpec,
                                        final long interval); List<Container> stopScanner(ServerTemplate serverTemplate,
                                       final ContainerSpec containerSpec); List<Container> scanNow(ServerTemplate serverTemplate,
                                   final ContainerSpec containerSpec); synchronized List<Container> startContainer(final ServerTemplate serverTemplate,
                                                       final ContainerSpec containerSpec); synchronized List<Container> stopContainer(ServerTemplate serverTemplate,
                                                      final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec,
                                            final boolean resetBeforeUpdate); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec,
                                                    final boolean resetBeforeUpdate); List<Container> getContainers(final ServerTemplate serverTemplate,
                                         final ContainerSpec containerSpec); List<Container> getContainers(ServerInstanceKey serverInstanceKey); synchronized List<Container> activateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); synchronized List<Container> deactivateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); boolean isAlive(ServerInstanceKey serverInstanceKey); }
KieServerInstanceManager { void setProcessConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.PROCESS); if (containerConfig != null) { final ProcessConfig processConfig = (ProcessConfig) containerConfig; containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_BASE, processConfig.getKBase())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_KIE_SESSION, processConfig.getKSession())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_MERGE_MODE, processConfig.getMergeMode())); containerResource.addConfigItem(makeKieServerConfigItem(KieServerConstants.CAPABILITY_BPM, KieServerConstants.PCFG_RUNTIME_STRATEGY, processConfig.getRuntimeStrategy())); } } KieServerInstanceManager(); static KieServerInstanceManager getInstance(); List<Container> startScanner(ServerTemplate serverTemplate,
                                        final ContainerSpec containerSpec,
                                        final long interval); List<Container> stopScanner(ServerTemplate serverTemplate,
                                       final ContainerSpec containerSpec); List<Container> scanNow(ServerTemplate serverTemplate,
                                   final ContainerSpec containerSpec); synchronized List<Container> startContainer(final ServerTemplate serverTemplate,
                                                       final ContainerSpec containerSpec); synchronized List<Container> stopContainer(ServerTemplate serverTemplate,
                                                      final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec); List<Container> upgradeContainer(final ServerTemplate serverTemplate,
                                            final ContainerSpec containerSpec,
                                            final boolean resetBeforeUpdate); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec); List<Container> upgradeAndStartContainer(final ServerTemplate serverTemplate,
                                                    final ContainerSpec containerSpec,
                                                    final boolean resetBeforeUpdate); List<Container> getContainers(final ServerTemplate serverTemplate,
                                         final ContainerSpec containerSpec); List<Container> getContainers(ServerInstanceKey serverInstanceKey); synchronized List<Container> activateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); synchronized List<Container> deactivateContainer(final ServerTemplate serverTemplate, final ContainerSpec containerSpec); boolean isAlive(ServerInstanceKey serverInstanceKey);  }