@Test public void setupUndefinedConfigurationGroupTest() { doReturn(new ArrayList<>()).when(configurationService).getConfiguration(eq(ConfigType.GLOBAL)); final ConfigType configType = ConfigType.GLOBAL; final String configGroupName = BaseAppSetup.GLOBAL_SETTINGS; final ConfigGroup configGroup = setupPredefinedGlobalConfiguration(); baseAppSetup.setupConfigurationGroup(configType, configGroupName, configGroup); verify(configurationService).addConfiguration(any(ConfigGroup.class)); verify(configurationService, never()).updateConfiguration(any(ConfigGroup.class)); }
protected void setupConfigurationGroup(ConfigType configType, String configGroupName, ConfigGroup configGroup, ConfigItem... configItemsToSetManually) { List<ConfigGroup> existentConfigGroups = configurationService.getConfiguration(configType); boolean settingsDefined = false; for (ConfigGroup existentConfigGroup : existentConfigGroups) { if (configGroupName.equals(existentConfigGroup.getName())) { settingsDefined = true; if (configItemsToSetManually != null) { for (ConfigItem configItem : configItemsToSetManually) { ConfigItem existentConfigItem = existentConfigGroup.getConfigItem(configItem.getName()); if (existentConfigItem == null) { existentConfigGroup.addConfigItem(configItem); configurationService.updateConfiguration(existentConfigGroup); } else if (!existentConfigItem.getValue().equals(configItem.getValue())) { existentConfigItem.setValue(configItem.getValue()); configurationService.updateConfiguration(existentConfigGroup); } } } break; } } if (!settingsDefined) { configurationService.addConfiguration(configGroup); } }
BaseAppSetup { protected void setupConfigurationGroup(ConfigType configType, String configGroupName, ConfigGroup configGroup, ConfigItem... configItemsToSetManually) { List<ConfigGroup> existentConfigGroups = configurationService.getConfiguration(configType); boolean settingsDefined = false; for (ConfigGroup existentConfigGroup : existentConfigGroups) { if (configGroupName.equals(existentConfigGroup.getName())) { settingsDefined = true; if (configItemsToSetManually != null) { for (ConfigItem configItem : configItemsToSetManually) { ConfigItem existentConfigItem = existentConfigGroup.getConfigItem(configItem.getName()); if (existentConfigItem == null) { existentConfigGroup.addConfigItem(configItem); configurationService.updateConfiguration(existentConfigGroup); } else if (!existentConfigItem.getValue().equals(configItem.getValue())) { existentConfigItem.setValue(configItem.getValue()); configurationService.updateConfiguration(existentConfigGroup); } } } break; } } if (!settingsDefined) { configurationService.addConfiguration(configGroup); } } }
BaseAppSetup { protected void setupConfigurationGroup(ConfigType configType, String configGroupName, ConfigGroup configGroup, ConfigItem... configItemsToSetManually) { List<ConfigGroup> existentConfigGroups = configurationService.getConfiguration(configType); boolean settingsDefined = false; for (ConfigGroup existentConfigGroup : existentConfigGroups) { if (configGroupName.equals(existentConfigGroup.getName())) { settingsDefined = true; if (configItemsToSetManually != null) { for (ConfigItem configItem : configItemsToSetManually) { ConfigItem existentConfigItem = existentConfigGroup.getConfigItem(configItem.getName()); if (existentConfigItem == null) { existentConfigGroup.addConfigItem(configItem); configurationService.updateConfiguration(existentConfigGroup); } else if (!existentConfigItem.getValue().equals(configItem.getValue())) { existentConfigItem.setValue(configItem.getValue()); configurationService.updateConfiguration(existentConfigGroup); } } } break; } } if (!settingsDefined) { configurationService.addConfiguration(configGroup); } } protected  BaseAppSetup();  BaseAppSetup(final IOService ioService,
                        final RepositoryService repositoryService,
                        final OrganizationalUnitService organizationalUnitService,
                        final KieModuleService moduleService,
                        final ConfigurationService configurationService,
                        final ConfigurationFactory configurationFactory); }
BaseAppSetup { protected void setupConfigurationGroup(ConfigType configType, String configGroupName, ConfigGroup configGroup, ConfigItem... configItemsToSetManually) { List<ConfigGroup> existentConfigGroups = configurationService.getConfiguration(configType); boolean settingsDefined = false; for (ConfigGroup existentConfigGroup : existentConfigGroups) { if (configGroupName.equals(existentConfigGroup.getName())) { settingsDefined = true; if (configItemsToSetManually != null) { for (ConfigItem configItem : configItemsToSetManually) { ConfigItem existentConfigItem = existentConfigGroup.getConfigItem(configItem.getName()); if (existentConfigItem == null) { existentConfigGroup.addConfigItem(configItem); configurationService.updateConfiguration(existentConfigGroup); } else if (!existentConfigItem.getValue().equals(configItem.getValue())) { existentConfigItem.setValue(configItem.getValue()); configurationService.updateConfiguration(existentConfigGroup); } } } break; } } if (!settingsDefined) { configurationService.addConfiguration(configGroup); } } protected  BaseAppSetup();  BaseAppSetup(final IOService ioService,
                        final RepositoryService repositoryService,
                        final OrganizationalUnitService organizationalUnitService,
                        final KieModuleService moduleService,
                        final ConfigurationService configurationService,
                        final ConfigurationFactory configurationFactory);  }
BaseAppSetup { protected void setupConfigurationGroup(ConfigType configType, String configGroupName, ConfigGroup configGroup, ConfigItem... configItemsToSetManually) { List<ConfigGroup> existentConfigGroups = configurationService.getConfiguration(configType); boolean settingsDefined = false; for (ConfigGroup existentConfigGroup : existentConfigGroups) { if (configGroupName.equals(existentConfigGroup.getName())) { settingsDefined = true; if (configItemsToSetManually != null) { for (ConfigItem configItem : configItemsToSetManually) { ConfigItem existentConfigItem = existentConfigGroup.getConfigItem(configItem.getName()); if (existentConfigItem == null) { existentConfigGroup.addConfigItem(configItem); configurationService.updateConfiguration(existentConfigGroup); } else if (!existentConfigItem.getValue().equals(configItem.getValue())) { existentConfigItem.setValue(configItem.getValue()); configurationService.updateConfiguration(existentConfigGroup); } } } break; } } if (!settingsDefined) { configurationService.addConfiguration(configGroup); } } protected  BaseAppSetup();  BaseAppSetup(final IOService ioService,
                        final RepositoryService repositoryService,
                        final OrganizationalUnitService organizationalUnitService,
                        final KieModuleService moduleService,
                        final ConfigurationService configurationService,
                        final ConfigurationFactory configurationFactory);   }