Search in sources :

Example 26 with ConfigGroup

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());
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) Test(org.junit.Test)

Example 27 with ConfigGroup

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());
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) Test(org.junit.Test)

Example 28 with ConfigGroup

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());
}
Also used : List(java.util.List) ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) Test(org.junit.Test)

Example 29 with ConfigGroup

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());
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) Test(org.junit.Test)

Example 30 with ConfigGroup

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"));
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup)

Aggregations

ConfigGroup (org.guvnor.structure.server.config.ConfigGroup)40 Test (org.junit.Test)15 ConfigItem (org.guvnor.structure.server.config.ConfigItem)9 ArrayList (java.util.ArrayList)7 ConfigType (org.guvnor.structure.server.config.ConfigType)6 List (java.util.List)5 Before (org.junit.Before)4 HashMap (java.util.HashMap)3 File (java.io.File)2 Path (java.nio.file.Path)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 URL (java.net.URL)1 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1 Repository (org.guvnor.structure.repositories.Repository)1 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)1 WorkDefinition (org.jbpm.process.core.WorkDefinition)1 ExampleRepository (org.kie.workbench.common.screens.examples.model.ExampleRepository)1 Mockito.anyString (org.mockito.Mockito.anyString)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)1