use of org.jboss.pnc.client.SCMRepositoryClient in project pnc by project-ncl.
the class BuildConfigurationEndpointTest method prepareData.
@SuppressWarnings("unchecked")
@BeforeClass
public static void prepareData() throws Exception {
BuildConfigurationClient bcc = new BuildConfigurationClient(RestClientConfiguration.asAnonymous());
Iterator<BuildConfiguration> it = bcc.getAll().iterator();
configurationId = it.next().getId();
configuration2Id = it.next().getId();
configuration3Id = it.next().getId();
configuration4Id = it.next().getId();
ProductClient pdc = new ProductClient(RestClientConfiguration.asAnonymous());
productId = pdc.getAll().iterator().next().getId();
EnvironmentClient ec = new EnvironmentClient(RestClientConfiguration.asAnonymous());
environmentId = ec.getAll().iterator().next().getId();
ProjectClient pjc = new ProjectClient(RestClientConfiguration.asAnonymous());
projectId = pjc.getAll().iterator().next().getId();
SCMRepositoryClient scmrc = new SCMRepositoryClient(RestClientConfiguration.asAnonymous());
final Iterator<SCMRepository> scmrIt = scmrc.getAll(null, null).iterator();
repositoryConfigurationId = scmrIt.next().getId();
repositoryConfiguration2Id = scmrIt.next().getId();
}
use of org.jboss.pnc.client.SCMRepositoryClient in project pnc by project-ncl.
the class BuildConfigurationEndpointTest method shouldChangeRepositoryConfiguration.
@Test
@InSequence(61)
public void shouldChangeRepositoryConfiguration() throws ClientException {
// given
BuildConfigurationClient bcClient = new BuildConfigurationClient(RestClientConfiguration.asUser());
SCMRepositoryClient scmClient = new SCMRepositoryClient(RestClientConfiguration.asAnonymous());
BuildConfiguration buildConfiguration = bcClient.getSpecific(configuration4Id);
// make sure this RC is not already set
assertThat(buildConfiguration.getScmRepository().getId()).isNotEqualTo(repositoryConfiguration2Id);
// when
BuildConfiguration updateBC = BuildConfiguration.builder().id(buildConfiguration.getId()).name(buildConfiguration.getName()).buildScript(buildConfiguration.getBuildScript()).creationTime(buildConfiguration.getCreationTime()).modificationTime(buildConfiguration.getModificationTime()).project(buildConfiguration.getProject()).environment(buildConfiguration.getEnvironment()).parameters(buildConfiguration.getParameters()).scmRepository(scmClient.getSpecific(repositoryConfiguration2Id)).buildType(buildConfiguration.getBuildType()).build();
bcClient.update(updateBC.getId(), updateBC);
BuildConfiguration updatedBC = bcClient.getSpecific(updateBC.getId());
// then
assertThat(updateBC.getScmRepository().getId()).isEqualTo(repositoryConfiguration2Id);
}
use of org.jboss.pnc.client.SCMRepositoryClient in project pnc by project-ncl.
the class SecondLevelCacheStoreTest method prepareData.
/**
* At first we need to create testing data and commit it.
*/
@Test
@InSequence(-2)
public void prepareData() throws Exception {
EnvironmentClient client = new EnvironmentClient(RestClientConfiguration.asAnonymous());
environmentId = client.getAll().iterator().next().getId();
SCMRepositoryClient scmrc = new SCMRepositoryClient(RestClientConfiguration.asAnonymous());
final Iterator<SCMRepository> scmrIt = scmrc.getAll(null, null).iterator();
repositoryConfigurationBCId = scmrIt.next().getId();
repositoryConfigurationDepBCId = scmrIt.next().getId();
Project projectBC = createProjectAndValidateResults("https://github.com/project-ncl/dependency-analysis", null, "Dependency Analysis New", "Dependency Analysis - Analise project dependencies.");
Project projectDepBC = createProjectAndValidateResults("https://github.com/project-ncl/pnc", null, "Project Newcastle Demo Project 1 New", "Example Project for Newcastle Demo");
projectBCId = projectBC.getId();
projectDepBCId = projectDepBC.getId();
BuildConfiguration dependencyBC = createBuildConfigurationAndValidateResults(projectDepBCId, environmentId, repositoryConfigurationDepBCId, "pnc-1.0.0.DR1-new", UUID.randomUUID().toString());
BuildConfiguration buildConfiguration = createBuildConfigurationAndValidateResults(projectBCId, environmentId, repositoryConfigurationBCId, "dependency-analysis-master-new", UUID.randomUUID().toString());
dependencyBCId = dependencyBC.getId();
buildConfigurationId = buildConfiguration.getId();
}
Aggregations