Search in sources :

Example 16 with ArtifactClient

use of org.jboss.pnc.client.ArtifactClient in project pnc by project-ncl.

the class ArtifactEndpointTest method shouldGetMilestonesInfo.

@Test
public void shouldGetMilestonesInfo() throws RemoteResourceException {
    ArtifactClient client = new ArtifactClient(RestClientConfiguration.asAnonymous());
    RemoteCollection<MilestoneInfo> milestonesInfo = client.getMilestonesInfo(artifactRest3.getId());
    assertThat(milestonesInfo).hasSize(1).first().extracting(MilestoneInfo::isBuilt).isEqualTo(false);
    RemoteCollection<MilestoneInfo> milestonesInfo2 = client.getMilestonesInfo(artifactRest1.getId());
    ObjectAssert<MilestoneInfo> milestone = assertThat(milestonesInfo2).hasSize(1).first();
    milestone.extracting(MilestoneInfo::isBuilt).isEqualTo(true);
    milestone.extracting(MilestoneInfo::getProductName).isEqualTo("Project Newcastle Demo Product");
    milestone.extracting(MilestoneInfo::getMilestoneVersion).isEqualTo("1.0.0.Build1");
}
Also used : MilestoneInfo(org.jboss.pnc.dto.response.MilestoneInfo) ArtifactClient(org.jboss.pnc.client.ArtifactClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 17 with ArtifactClient

use of org.jboss.pnc.client.ArtifactClient in project pnc by project-ncl.

the class ArtifactEndpointTest method shouldGetBuildsThatDependsOnArtifact.

@Test
public void shouldGetBuildsThatDependsOnArtifact() throws RemoteResourceException {
    ArtifactClient client = new ArtifactClient(RestClientConfiguration.asUser());
    RemoteCollection<Build> builds = client.getDependantBuilds(artifactRest3.getId());
    assertThat(builds).hasSize(2);
}
Also used : Build(org.jboss.pnc.dto.Build) ArtifactClient(org.jboss.pnc.client.ArtifactClient) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 18 with ArtifactClient

use of org.jboss.pnc.client.ArtifactClient in project pnc by project-ncl.

the class ArtifactEndpointTest method testGetAllArtifactsWithMd5.

@Test
public void testGetAllArtifactsWithMd5() throws RemoteResourceException {
    ArtifactClient client = new ArtifactClient(RestClientConfiguration.asAnonymous());
    RemoteCollection<Artifact> artifacts = client.getAll(null, artifactRest1.getMd5(), null);
    // artifacts 1 and 2 have same MD5
    assertThat(artifacts).hasSize(2).allSatisfy(a -> assertThat(a.getId()).isIn(artifactRest1.getId(), artifactRest2.getId()));
}
Also used : ArtifactClient(org.jboss.pnc.client.ArtifactClient) Artifact(org.jboss.pnc.dto.Artifact) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 19 with ArtifactClient

use of org.jboss.pnc.client.ArtifactClient in project pnc by project-ncl.

the class ArtifactEndpointTest method testGetAllArtifacts.

@Test
public void testGetAllArtifacts() throws RemoteResourceException {
    ArtifactClient client = new ArtifactClient(RestClientConfiguration.asAnonymous());
    RemoteCollection<Artifact> all = client.getAll(null, null, null);
    // from DatabaseDataInitializer
    assertThat(all).hasSize(10);
}
Also used : ArtifactClient(org.jboss.pnc.client.ArtifactClient) Artifact(org.jboss.pnc.dto.Artifact) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Example 20 with ArtifactClient

use of org.jboss.pnc.client.ArtifactClient in project pnc by project-ncl.

the class ArtifactEndpointTest method shouldGetArtifactRevision.

@Test
public void shouldGetArtifactRevision() throws Exception {
    ArtifactClient client = new ArtifactClient(RestClientConfiguration.asAnonymous());
    Iterator<ArtifactRevision> itOriginal = client.getRevisions(artifactRest1.getId()).iterator();
    // given latest revision
    ArtifactRevision lastRevOriginal = itOriginal.next();
    while (itOriginal.hasNext()) {
        ArtifactRevision candidate = itOriginal.next();
        if (candidate.getRev() > lastRevOriginal.getRev()) {
            lastRevOriginal = candidate;
        }
    }
    ArtifactRevision revision = client.getRevision(artifactRest1.getId(), lastRevOriginal.getRev());
    assertThat(revision.getId()).isEqualTo(artifactRest1.getId());
    assertThat(revision.getArtifactQuality()).isEqualTo(artifactRest1.getArtifactQuality());
    assertThat(revision.getModificationTime()).isEqualTo(artifactRest1.getModificationTime());
    assertThat(revision.getModificationUser()).isEqualTo(artifactRest1.getModificationUser());
    assertThat(revision.getQualityLevelReason()).isEqualTo(artifactRest1.getQualityLevelReason());
}
Also used : ArtifactClient(org.jboss.pnc.client.ArtifactClient) ArtifactRevision(org.jboss.pnc.dto.ArtifactRevision) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

ArtifactClient (org.jboss.pnc.client.ArtifactClient)31 ContainerTest (org.jboss.pnc.test.category.ContainerTest)30 Test (org.junit.Test)30 Artifact (org.jboss.pnc.dto.Artifact)22 ArtifactInfo (org.jboss.pnc.dto.response.ArtifactInfo)4 ArtifactRevision (org.jboss.pnc.dto.ArtifactRevision)3 HashSet (java.util.HashSet)2 BuildClient (org.jboss.pnc.client.BuildClient)2 Build (org.jboss.pnc.dto.Build)2 ArrayList (java.util.ArrayList)1 BadRequestException (javax.ws.rs.BadRequestException)1 ClientErrorException (javax.ws.rs.ClientErrorException)1 ClientException (org.jboss.pnc.client.ClientException)1 RemoteResourceException (org.jboss.pnc.client.RemoteResourceException)1 MilestoneInfo (org.jboss.pnc.dto.response.MilestoneInfo)1 RepositoryType (org.jboss.pnc.enums.RepositoryType)1 Before (org.junit.Before)1