use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationServiceImplTest method updateConfigurationWithNamespaceTest.
@Test
public void updateConfigurationWithNamespaceTest() {
final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace", "config", "description");
config.addConfigItem(configurationFactory.newConfigItem("space", "namespace"));
configurationService.addConfiguration(config);
config.setDescription("new-description");
configurationService.updateConfiguration(config);
final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.REPOSITORY, "namespace");
assertEquals(1, configGroups.size());
assertEquals("config", configGroups.get(0).getName());
assertEquals("new-description", configGroups.get(0).getDescription());
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationServiceImplTest method addAndGetConfigurationWithNamespaceTest.
@Test
public void addAndGetConfigurationWithNamespaceTest() {
final ConfigGroup configGroup1 = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace1", "repo1", "repo1-description");
configGroup1.addConfigItem(configurationFactory.newConfigItem("space", "namespace1"));
configurationService.addConfiguration(configGroup1);
final ConfigGroup configGroup2 = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace1", "repo2", "repo2-description");
configGroup2.addConfigItem(configurationFactory.newConfigItem("space", "namespace1"));
configurationService.addConfiguration(configGroup2);
configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.GLOBAL, "global1", "global1-description"));
final ConfigGroup configGroup3 = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace2", "repo3", "repo3-description");
configGroup3.addConfigItem(configurationFactory.newConfigItem("space", "namespace2"));
configurationService.addConfiguration(configGroup3);
final List<ConfigGroup> repositoryNamespace1ConfigGroups = configurationService.getConfiguration(ConfigType.REPOSITORY, "namespace1");
assertEquals(2, repositoryNamespace1ConfigGroups.size());
assertEquals("repo1", repositoryNamespace1ConfigGroups.get(0).getName());
assertEquals("repo2", repositoryNamespace1ConfigGroups.get(1).getName());
final List<ConfigGroup> repositoryNamespace2ConfigGroups = configurationService.getConfiguration(ConfigType.REPOSITORY, "namespace2");
assertEquals(1, repositoryNamespace2ConfigGroups.size());
assertEquals("repo3", repositoryNamespace2ConfigGroups.get(0).getName());
final List<ConfigGroup> globalConfigGroups = configurationService.getConfiguration(ConfigType.GLOBAL);
assertEquals(1, globalConfigGroups.size());
assertEquals("global1", globalConfigGroups.get(0).getName());
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationServiceImplTest method addAndGetConfigurationByNamespaceTest.
@Test
public void addAndGetConfigurationByNamespaceTest() {
final ConfigGroup configGroup1 = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace1", "repo1", "repo1-description");
configGroup1.addConfigItem(configurationFactory.newConfigItem("space", "namespace1"));
configurationService.addConfiguration(configGroup1);
final ConfigGroup configGroup2 = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace1", "repo2", "repo2-description");
configGroup2.addConfigItem(configurationFactory.newConfigItem("space", "namespace1"));
configurationService.addConfiguration(configGroup2);
final ConfigGroup configGroup3 = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace2", "repo3", "repo3-description");
configGroup3.addConfigItem(configurationFactory.newConfigItem("space", "namespace2"));
configurationService.addConfiguration(configGroup3);
final Map<String, List<ConfigGroup>> configGroupsByNamespace = configurationService.getConfigurationByNamespace(ConfigType.REPOSITORY);
assertEquals(2, configGroupsByNamespace.size());
final List<ConfigGroup> repositoryNamespace1ConfigGroups = configGroupsByNamespace.get("namespace1");
assertEquals(2, repositoryNamespace1ConfigGroups.size());
assertEquals("repo1", repositoryNamespace1ConfigGroups.get(0).getName());
assertEquals("repo2", repositoryNamespace1ConfigGroups.get(1).getName());
final List<ConfigGroup> repositoryNamespace2ConfigGroups = configGroupsByNamespace.get("namespace2");
assertEquals(1, repositoryNamespace2ConfigGroups.size());
assertEquals("repo3", repositoryNamespace2ConfigGroups.get(0).getName());
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationServiceImplTest method updateConfigurationWithoutNamespaceTest.
@Test
public void updateConfigurationWithoutNamespaceTest() {
final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.GLOBAL, "config", "description");
configurationService.addConfiguration(config);
config.setDescription("new-description");
configurationService.updateConfiguration(config);
final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.GLOBAL);
assertEquals(1, configGroups.size());
assertEquals("config", configGroups.get(0).getName());
assertEquals("new-description", configGroups.get(0).getDescription());
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class ConfigGroupsMigrationServiceTest method createConfigGroupsWithOldConfigurationService.
private void createConfigGroupsWithOldConfigurationService() {
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.GLOBAL, "global1", "global1-description"));
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.GLOBAL, "global2", "global2-description"));
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.ORGANIZATIONAL_UNIT, "ou1", "ou1-description"));
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.ORGANIZATIONAL_UNIT, "ou2", "ou2-description"));
final ConfigGroup repo1 = oldConfigurationFactory.newConfigGroup(ConfigType.REPOSITORY, "repo1", "repo1-description");
repo1.addConfigItem(oldConfigurationFactory.newConfigItem("space", "ou1"));
oldConfigurationService.addConfiguration(repo1);
final ConfigGroup repo2 = oldConfigurationFactory.newConfigGroup(ConfigType.REPOSITORY, "repo2", "repo2-description");
repo2.addConfigItem(oldConfigurationFactory.newConfigItem("space", "ou1"));
oldConfigurationService.addConfiguration(repo2);
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.EDITOR, "editor1", "editor1-description"));
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.EDITOR, "editor2", "editor2-description"));
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.DEPLOYMENT, "deployment1", "deployment1-description"));
oldConfigurationService.addConfiguration(oldConfigurationFactory.newConfigGroup(ConfigType.DEPLOYMENT, "deployment2", "deployment2-description"));
}
Aggregations