Search in sources :

Example 16 with ConfigGroup

use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.

the class AppSetup method getGlobalConfiguration.

private ConfigGroup getGlobalConfiguration() {
    // Global Configurations used by many of Drools Workbench editors
    final ConfigGroup group = configurationFactory.newConfigGroup(ConfigType.GLOBAL, GLOBAL_SETTINGS, "");
    group.addConfigItem(configurationFactory.newConfigItem("drools.dateformat", "dd-MMM-yyyy"));
    group.addConfigItem(configurationFactory.newConfigItem("drools.datetimeformat", "dd-MMM-yyyy hh:mm:ss"));
    group.addConfigItem(configurationFactory.newConfigItem("drools.defaultlanguage", "en"));
    group.addConfigItem(configurationFactory.newConfigItem("drools.defaultcountry", "US"));
    group.addConfigItem(configurationFactory.newConfigItem("build.enable-incremental", "true"));
    group.addConfigItem(configurationFactory.newConfigItem("rule-modeller-onlyShowDSLStatements", "false"));
    return group;
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup)

Example 17 with ConfigGroup

use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.

the class BaseAppSetupTest method setupUndefinedConfigurationGroupTest.

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

Example 18 with ConfigGroup

use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.

the class BaseAppSetupTest method mockConfigurations.

private void mockConfigurations() {
    // doReturn( new ArrayList<ConfigGroup>() ).when( configurationService ).getConfiguration( any( ConfigType.class ) );
    doReturn(true).when(configurationService).updateConfiguration(any(ConfigGroup.class));
    doReturn(true).when(configurationService).addConfiguration(any(ConfigGroup.class));
    doReturn(new ConfigGroup()).when(configurationFactory).newConfigGroup(any(ConfigType.class), anyString(), anyString());
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) ConfigType(org.guvnor.structure.server.config.ConfigType)

Example 19 with ConfigGroup

use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.

the class AbstractWeldBuilderIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    // Define mandatory properties
    List<ConfigGroup> globalConfigGroups = configurationService.getConfiguration(ConfigType.GLOBAL);
    boolean globalSettingsDefined = false;
    for (ConfigGroup globalConfigGroup : globalConfigGroups) {
        if (GLOBAL_SETTINGS.equals(globalConfigGroup.getName())) {
            globalSettingsDefined = true;
            break;
        }
    }
    if (!globalSettingsDefined) {
        configurationService.addConfiguration(getGlobalConfiguration());
    }
}
Also used : ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) Before(org.junit.Before)

Example 20 with ConfigGroup

use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.

the class InternalMigrationServiceTest method testGetOrgUnitsByRepo.

@Test
public void testGetOrgUnitsByRepo() {
    final String repo1Name = "repo1", repo2Name = "repo2", repo3Name = "repo3", space1Name = "space1", space2Name = "space2";
    final int numberOfRepositories = 3;
    List<ConfigGroup> ouConfigs = new ArrayList<>();
    List<String> space1Repos = Arrays.asList(new String[] { repo1Name, repo2Name });
    List<String> space2Repos = Arrays.asList(new String[] { repo3Name });
    ConfigItem<List<String>> space1Config = new ConfigItem<>();
    space1Config.setName("repositories");
    space1Config.setValue(space1Repos);
    ConfigItem<List<String>> space2Config = new ConfigItem<>();
    space2Config.setName("repositories");
    space2Config.setValue(space2Repos);
    ConfigGroup space1 = new ConfigGroup();
    space1.setConfigItem(space1Config);
    space1.setName(space1Name);
    ConfigGroup space2 = new ConfigGroup();
    space2.setConfigItem(space2Config);
    space2.setName(space2Name);
    ouConfigs.add(space1);
    ouConfigs.add(space2);
    Map<String, String> orgUnitsByRepo = internalMigrationService.getOrgUnitsByRepo(ouConfigs);
    assertEquals(numberOfRepositories, orgUnitsByRepo.size());
    assertEquals(space1Name, orgUnitsByRepo.get(repo1Name));
    assertEquals(space1Name, orgUnitsByRepo.get(repo2Name));
    assertEquals(space2Name, orgUnitsByRepo.get(repo3Name));
}
Also used : ArrayList(java.util.ArrayList) ConfigItem(org.guvnor.structure.server.config.ConfigItem) ArrayList(java.util.ArrayList) List(java.util.List) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ConfigGroup(org.guvnor.structure.server.config.ConfigGroup) Test(org.junit.Test)

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