use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationFactoryImplTest method newConfigGroupWithoutNamespaceTest.
@Test
public void newConfigGroupWithoutNamespaceTest() {
final ConfigGroup configGroup = configurationFactory.newConfigGroup(ConfigType.GLOBAL, "my-config", "my-description");
assertEquals(ConfigType.GLOBAL, configGroup.getType());
assertEquals("my-config", configGroup.getName());
assertEquals("my-description", configGroup.getDescription());
assertTrue(configGroup.isEnabled());
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class ConfigGroupsMigrationService method groupRepositoryConfigGroupsBySpace.
private void groupRepositoryConfigGroupsBySpace() {
final org.uberfire.java.nio.file.Path systemDir = ioService.get(systemRepository.getUri());
final org.uberfire.java.nio.file.Path repositoriesDir = systemDir.resolve(ConfigType.REPOSITORY.getDir());
final DirectoryStream<org.uberfire.java.nio.file.Path> repoConfigs = getDirectoryStreamForFilesWithParticularExtension(repositoriesDir, ConfigType.REPOSITORY.getExt());
final Iterator<org.uberfire.java.nio.file.Path> it = repoConfigs.iterator();
while (it.hasNext()) {
final org.uberfire.java.nio.file.Path oldPath = it.next();
final String fileName = Paths.convert(oldPath).getFileName();
final String content = ioService.readAllString(oldPath);
final ConfigGroup repoConfig = marshaller.unmarshall(content);
final String space = repoConfig.getConfigItemValue("space");
final org.uberfire.java.nio.file.Path newPath = repositoriesDir.resolve(space).resolve(fileName);
ioService.move(oldPath, newPath);
}
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationFactoryImpl method newConfigGroup.
@Override
public ConfigGroup newConfigGroup(ConfigType type, final String name, final String description) {
if (ConfigType.SPACE.equals(type)) {
type = ConfigType.ORGANIZATIONAL_UNIT;
}
final ConfigGroup configGroup = new ConfigGroup();
configGroup.setDescription(description);
configGroup.setName(name);
configGroup.setType(type);
configGroup.setEnabled(true);
return configGroup;
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrateAllProjectsTest method initConfigGroups.
public List<ConfigGroup> initConfigGroups() {
List<ConfigGroup> spaceConfigs = new ArrayList<>();
List<String> spaceARepos = Collections.singletonList(REPO_A);
List<String> spaceBRepos = Arrays.asList(REPO_B, REPO_C);
ConfigItem<List<String>> spaceAConfig = new ConfigItem<>();
spaceAConfig.setName("repositories");
spaceAConfig.setValue(spaceARepos);
ConfigItem<List<String>> spaceBConfig = new ConfigItem<>();
spaceBConfig.setName("repositories");
spaceBConfig.setValue(spaceBRepos);
ConfigItem<List<Contributor>> contributors = new ConfigItem<>();
contributors.setName(SPACE_CONTRIBUTORS);
contributors.setValue(new ArrayList<>());
ConfigItem<List<String>> groups = new ConfigItem<>();
groups.setName(SECURITY_GROUPS);
groups.setValue(new ArrayList<>());
ConfigGroup spaceA = new ConfigGroup();
spaceA.setName(SPACE_A);
spaceA.setConfigItem(spaceAConfig);
spaceA.setConfigItem(contributors);
spaceA.setConfigItem(groups);
ConfigGroup spaceB = new ConfigGroup();
spaceB.setName(SPACE_B);
spaceB.setConfigItem(spaceBConfig);
spaceB.setConfigItem(contributors);
spaceB.setConfigItem(groups);
spaceConfigs.add(spaceA);
spaceConfigs.add(spaceB);
return spaceConfigs;
}
use of org.guvnor.structure.server.config.ConfigGroup in project kie-wb-common by kiegroup.
the class MigrationConfigurationServiceImplTest method removeConfigurationWithNamespaceTest.
@Test
public void removeConfigurationWithNamespaceTest() {
final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.REPOSITORY, "namespace", "config", "description");
configurationService.addConfiguration(config);
configurationService.removeConfiguration(config);
final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.REPOSITORY, "namespace");
assertEquals(0, configGroups.size());
}
Aggregations