use of org.guvnor.structure.organizationalunit.config.RepositoryInfo in project kie-wb-common by kiegroup.
the class ConfigGroupToSpaceInfoConverter method toRepositoryInfo.
private RepositoryInfo toRepositoryInfo(ConfigGroup configGroup) {
final Map<String, Object> envMap = extractEnvMap(configGroup);
RepositoryUtils.cleanUpCredentialsFromEnvMap(envMap);
return new RepositoryInfo(configGroup.getName(), false, new RepositoryConfiguration(envMap));
}
use of org.guvnor.structure.organizationalunit.config.RepositoryInfo in project kie-wb-common by kiegroup.
the class ConfigGroupsMigrationServiceTest method checkSpaceRepo.
private void checkSpaceRepo(String repoName, SpaceInfo info) {
RepositoryInfo spaceRepo = info.getRepositories().stream().filter(repo -> repo.getName().equals(repoName)).findAny().orElse(null);
Assertions.assertThat(spaceRepo).isNotNull().hasFieldOrPropertyWithValue("name", repoName).hasFieldOrPropertyWithValue("deleted", DELETED);
assertEquals(SPACE_NAME, spaceRepo.getSpace());
assertEquals(SpacesAPI.Scheme.GIT.toString(), spaceRepo.getScheme());
assertEquals(REPO_AVOID_INDEX, spaceRepo.isAvoidIndex());
Assertions.assertThat(spaceRepo.getContributors()).hasSize(CONTRIBUTORS);
Assertions.assertThat(spaceRepo.getContributors().iterator().next()).hasFieldOrPropertyWithValue("username", CONTRIBUTOR).hasFieldOrPropertyWithValue("type", ContributorType.OWNER);
Assertions.assertThat(info.getSecurityGroups()).isEmpty();
}
use of org.guvnor.structure.organizationalunit.config.RepositoryInfo in project kie-wb-common by kiegroup.
the class ProjectImportServiceImpl method resolveGitRepository.
@Override
protected Repository resolveGitRepository(ExampleRepository repository) {
try {
String url = repository.getUrl();
final String alias = getRepositoryAlias(url) + "_" + LocalTime.now().toString();
Credentials credentials = repository.getCredentials();
String username = null;
String password = null;
if (credentials != null) {
username = credentials.getUsername();
password = credentials.getPassword();
}
final Map<String, Object> env = this.buildGitEnv(url, username, password, true);
final RepositoryInfo repositoryConfig = createConfigGroup(alias, env);
Repository repo = repositoryFactory.newRepository(repositoryConfig);
clonedRepositories.add(repo);
return repo;
} catch (final Exception e) {
logger.error("Error during create repository", e);
throw new RuntimeException(e);
}
}
use of org.guvnor.structure.organizationalunit.config.RepositoryInfo in project kie-wb-common by kiegroup.
the class BaseProjectImportService method createConfigGroup.
protected RepositoryInfo createConfigGroup(String alias, Map<String, Object> env) {
RepositoryConfiguration configuration = new RepositoryConfiguration(env);
configuration.add(EnvironmentParameters.AVOID_INDEX, true);
configuration.add(EnvironmentParameters.SPACE, this.getDefaultSpace());
RepositoryInfo repositoryConfig = new RepositoryInfo(alias, false, configuration);
return repositoryConfig;
}
use of org.guvnor.structure.organizationalunit.config.RepositoryInfo in project kie-wb-common by kiegroup.
the class ExamplesServiceImpl method cloneRepository.
private Repository cloneRepository(final String repositoryURL, final String userName, final String password) {
try {
final String alias = getRepositoryAlias(repositoryURL);
final Map<String, Object> env = this.buildGitEnv(repositoryURL, userName, password, false);
final RepositoryInfo repositoryConfig = this.createConfigGroup(alias, env);
Repository repository = repositoryFactory.newRepository(repositoryConfig);
this.ouService.addRepository(this.ouService.getOrganizationalUnit(this.playgroundSpaceName), repository);
return repository;
} catch (final Exception e) {
logger.error("Error during create repository", e);
throw new RuntimeException(e);
}
}
Aggregations