use of org.jboss.pnc.client.ArtifactClient in project pnc by project-ncl.
the class ArtifactEndpointTest method shouldNotModifyCreationModificationFields.
@Test
public void shouldNotModifyCreationModificationFields() throws ClientException {
String id = artifactRest3.getId();
ArtifactClient client = new ArtifactClient(RestClientConfiguration.asSystem());
// Updating a not audited property should not create a new revision and should not alter modificationUser and
// modificationTime. Also, creationTime should never be updated, not creationUser
Artifact artifact = client.getSpecific(id);
Artifact updatedArtifact = artifact.toBuilder().modificationTime(Instant.now()).md5("md5").creationTime(Instant.now()).size(1000L).build();
client.update(id, updatedArtifact);
Artifact updatedArtifactDB = client.getSpecific(id);
assertThat(updatedArtifactDB.getId()).isEqualTo(artifact.getId());
assertThat(updatedArtifactDB.getMd5()).isEqualTo(updatedArtifact.getMd5());
assertThat(updatedArtifactDB.getSize()).isEqualTo(updatedArtifact.getSize());
assertThat(updatedArtifactDB.getCreationTime()).isEqualTo(artifact.getCreationTime());
assertThat(updatedArtifactDB.getCreationUser()).isEqualTo(artifact.getCreationUser());
assertThat(updatedArtifactDB.getModificationTime()).isEqualTo(artifact.getModificationTime());
assertThat(updatedArtifactDB.getCreationTime()).isNotEqualTo(updatedArtifact.getCreationTime());
assertThat(updatedArtifactDB.getModificationTime()).isNotEqualTo(updatedArtifact.getModificationTime());
}
Aggregations