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");
}
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);
}
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()));
}
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);
}
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());
}
Aggregations