@Test public void testSetRuleConfigAttributesWhenRuleConfigIsNotNull() { final Map<?, ?> configs = mock(Map.class); final RuleConfig containerConfig = mock(RuleConfig.class); final ArgumentCaptor<KieScannerResource> scannerResourceCaptor = ArgumentCaptor.forClass(KieScannerResource.class); final Long pollInterval = 1L; final KieScannerStatus scannerStatus = KieScannerStatus.CREATED; doReturn(pollInterval).when(containerConfig).getPollInterval(); doReturn(scannerStatus).when(containerConfig).getScannerStatus(); doReturn(containerConfig).when(configs).get(Capability.RULE); doReturn(configs).when(containerSpec).getConfigs(); instanceManager.setRuleConfigAttributes(containerSpec, containerResource); verify(containerResource).setScanner(scannerResourceCaptor.capture()); final KieScannerResource scannerResource = scannerResourceCaptor.getValue(); assertEquals(pollInterval, scannerResource.getPollInterval()); assertEquals(scannerStatus, scannerResource.getStatus()); }
void setRuleConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig != null) { final RuleConfig ruleConfig = (RuleConfig) containerConfig; final KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(ruleConfig.getPollInterval()); scannerResource.setStatus(ruleConfig.getScannerStatus()); containerResource.setScanner(scannerResource); } }
KieServerInstanceManager { void setRuleConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig != null) { final RuleConfig ruleConfig = (RuleConfig) containerConfig; final KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(ruleConfig.getPollInterval()); scannerResource.setStatus(ruleConfig.getScannerStatus()); containerResource.setScanner(scannerResource); } } }
KieServerInstanceManager { void setRuleConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig != null) { final RuleConfig ruleConfig = (RuleConfig) containerConfig; final KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(ruleConfig.getPollInterval()); scannerResource.setStatus(ruleConfig.getScannerStatus()); containerResource.setScanner(scannerResource); } } KieServerInstanceManager(); }
KieServerInstanceManager { void setRuleConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig != null) { final RuleConfig ruleConfig = (RuleConfig) containerConfig; final KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(ruleConfig.getPollInterval()); scannerResource.setStatus(ruleConfig.getScannerStatus()); containerResource.setScanner(scannerResource); } } 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 setRuleConfigAttributes(final ContainerSpec containerSpec, final KieContainerResource containerResource) { final ContainerConfig containerConfig = containerSpec.getConfigs().get(Capability.RULE); if (containerConfig != null) { final RuleConfig ruleConfig = (RuleConfig) containerConfig; final KieScannerResource scannerResource = new KieScannerResource(); scannerResource.setPollInterval(ruleConfig.getPollInterval()); scannerResource.setStatus(ruleConfig.getScannerStatus()); containerResource.setScanner(scannerResource); } } 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);  }