Search in sources :

Example 1 with SpaceInfo

use of org.guvnor.structure.organizationalunit.config.SpaceInfo in project kie-wb-common by kiegroup.

the class InternalMigrationService method createSpaceDirs.

public void createSpaceDirs(Path niogitDir, List<ConfigGroup> orgUnitConfigs) {
    orgUnitConfigs.stream().forEach(group -> {
        Path ouSpace = niogitDir.resolve(group.getName());
        ouSpace.toFile().mkdir();
        SpaceInfo space = configGroupToSpaceInfoConverter.toSpaceInfo(group);
        configGroupToSpaceInfoConverter.cleanUpRepositories(group);
        spaceConfigStorageRegistry.get(group.getName()).saveSpaceInfo(space);
    });
}
Also used : Path(java.nio.file.Path) SpaceInfo(org.guvnor.structure.organizationalunit.config.SpaceInfo)

Example 2 with SpaceInfo

use of org.guvnor.structure.organizationalunit.config.SpaceInfo in project kie-wb-common by kiegroup.

the class ConfigGroupsMigrationServiceTest method testMigration.

@Test
public void testMigration() {
    migrationService.moveDataToSpaceConfigRepo();
    ArgumentCaptor<SpaceInfo> infoCaptor = ArgumentCaptor.forClass(SpaceInfo.class);
    verify(configurationService).getConfiguration(eq(ConfigType.SPACE));
    verify(configurationService, times(2)).getConfiguration(eq(ConfigType.REPOSITORY), eq(SPACE_NAME));
    verify(migrationService).saveSpaceInfo(infoCaptor.capture());
    verify(backwardCompatibleUtil, times(5)).compat(any());
    verify(configurationService).removeConfiguration(any());
    verify(configGroupToSpaceInfoConverter).cleanUpRepositories(any());
    SpaceInfo info = infoCaptor.getValue();
    Assertions.assertThat(info).hasFieldOrPropertyWithValue("name", SPACE_NAME).hasFieldOrPropertyWithValue("defaultGroupId", SPACE_GROUP);
    Assertions.assertThat(info.getContributors()).hasSize(CONTRIBUTORS);
    Assertions.assertThat(info.getContributors().iterator().next()).hasFieldOrPropertyWithValue("username", CONTRIBUTOR).hasFieldOrPropertyWithValue("type", ContributorType.OWNER);
    info.getRepositories().forEach(repositoryInfo -> {
        Assertions.assertThat(repositoryInfo.getConfiguration().getEnvironment()).doesNotContainKeys(EnvironmentParameters.USER_NAME, EnvironmentParameters.PASSWORD, EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD);
    });
    verify(configurationService).cleanUpSystemRepository();
    Assertions.assertThat(info.getSecurityGroups()).isEmpty();
    Assertions.assertThat(info.getRepositories()).hasSize(SPACE_REPOS);
    checkSpaceRepo(TEST_LEGACY_REPO, info);
    checkSpaceRepo(TEST_MULTIPLE_INSTANCE_REPO, info);
}
Also used : SpaceInfo(org.guvnor.structure.organizationalunit.config.SpaceInfo) Test(org.junit.Test)

Example 3 with SpaceInfo

use of org.guvnor.structure.organizationalunit.config.SpaceInfo in project kie-wb-common by kiegroup.

the class MigrationRepositoryServiceImpl method removeRepositoryFromSpaceInfo.

private void removeRepositoryFromSpaceInfo(Repository repo) {
    SpaceConfigStorage spaceConfigStorage = this.spaceConfigStorage.get(repo.getSpace().getName());
    SpaceInfo spaceInfo = this.spaceConfigStorage.get(repo.getSpace().getName()).loadSpaceInfo();
    spaceInfo.removeRepository(repo.getAlias());
    spaceConfigStorage.saveSpaceInfo(spaceInfo);
}
Also used : SpaceInfo(org.guvnor.structure.organizationalunit.config.SpaceInfo) SpaceConfigStorage(org.guvnor.structure.organizationalunit.config.SpaceConfigStorage)

Aggregations

SpaceInfo (org.guvnor.structure.organizationalunit.config.SpaceInfo)3 Path (java.nio.file.Path)1 SpaceConfigStorage (org.guvnor.structure.organizationalunit.config.SpaceConfigStorage)1 Test (org.junit.Test)1