use of org.jboss.pnc.dto.Artifact 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.dto.Artifact 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.dto.Artifact in project pnc by project-ncl.
the class ArtifactEndpointTest method testGetAllArtifactsWithMd5AndSha1.
@Test
public void testGetAllArtifactsWithMd5AndSha1() throws RemoteResourceException {
ArtifactClient client = new ArtifactClient(RestClientConfiguration.asAnonymous());
RemoteCollection<Artifact> artifacts = client.getAll(null, artifactRest2.getMd5(), artifactRest2.getSha1());
assertThat(artifacts).hasSize(1).allSatisfy(a -> assertThat(a.getId()).isIn(artifactRest2.getId()));
}
use of org.jboss.pnc.dto.Artifact in project pnc by project-ncl.
the class ArtifactEndpointTest method shouldNotModifyBlacklistedQualityLevel.
@Test
public void shouldNotModifyBlacklistedQualityLevel() throws ClientException {
String id = artifactRest3.getId();
ArtifactClient client = new ArtifactClient(RestClientConfiguration.asSystem());
String REASON = "This artifact has severe CVEs";
Artifact artifact = client.getSpecific(id);
client.createQualityLevelRevision(id, "BLACKLISTED", REASON);
Artifact updatedArtifactDB = client.getSpecific(id);
assertThat(updatedArtifactDB.getId()).isEqualTo(artifact.getId());
assertThat(updatedArtifactDB.getArtifactQuality()).isEqualTo(ArtifactQuality.BLACKLISTED);
assertThat(updatedArtifactDB.getQualityLevelReason()).isEqualTo(REASON);
assertThat(updatedArtifactDB.getCreationTime()).isEqualTo(artifact.getCreationTime());
assertThat(updatedArtifactDB.getModificationTime()).isNotEqualTo(artifact.getModificationTime());
assertThat(updatedArtifactDB.getModificationUser().getUsername()).isEqualTo("system");
assertThatThrownBy(() -> client.createQualityLevelRevision(id, "DEPRECATED", REASON)).hasCauseInstanceOf(ClientErrorException.class);
}
use of org.jboss.pnc.dto.Artifact in project pnc by project-ncl.
the class ArtifactEndpointTest method testGetAllArtifactsWithSha256.
@Test
public void testGetAllArtifactsWithSha256() throws RemoteResourceException {
ArtifactClient client = new ArtifactClient(RestClientConfiguration.asAnonymous());
RemoteCollection<Artifact> artifacts = client.getAll(artifactRest1.getSha256(), null, null);
// artifacts 1 and 3 have same SHA256
assertThat(artifacts).hasSize(2).allSatisfy(a -> assertThat(a.getId()).isIn(artifactRest1.getId(), artifactRest4.getId()));
}
Aggregations