Search in sources :

Example 1 with SCMRepositoryClient

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();
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) SCMRepositoryClient(org.jboss.pnc.client.SCMRepositoryClient) ProductClient(org.jboss.pnc.client.ProductClient) EnvironmentClient(org.jboss.pnc.client.EnvironmentClient) ProjectClient(org.jboss.pnc.client.ProjectClient) BuildConfigurationClient(org.jboss.pnc.client.BuildConfigurationClient) SCMRepository(org.jboss.pnc.dto.SCMRepository) BeforeClass(org.junit.BeforeClass)

Example 2 with SCMRepositoryClient

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);
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) SCMRepositoryClient(org.jboss.pnc.client.SCMRepositoryClient) BuildConfigurationClient(org.jboss.pnc.client.BuildConfigurationClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 3 with SCMRepositoryClient

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();
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) SCMRepositoryClient(org.jboss.pnc.client.SCMRepositoryClient) Project(org.jboss.pnc.dto.Project) EnvironmentClient(org.jboss.pnc.client.EnvironmentClient) SCMRepository(org.jboss.pnc.dto.SCMRepository) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

SCMRepositoryClient (org.jboss.pnc.client.SCMRepositoryClient)3 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)3 InSequence (org.jboss.arquillian.junit.InSequence)2 BuildConfigurationClient (org.jboss.pnc.client.BuildConfigurationClient)2 EnvironmentClient (org.jboss.pnc.client.EnvironmentClient)2 SCMRepository (org.jboss.pnc.dto.SCMRepository)2 ContainerTest (org.jboss.pnc.test.category.ContainerTest)2 Test (org.junit.Test)2 ProductClient (org.jboss.pnc.client.ProductClient)1 ProjectClient (org.jboss.pnc.client.ProjectClient)1 Project (org.jboss.pnc.dto.Project)1 BeforeClass (org.junit.BeforeClass)1