Skip to content

Commit

Permalink
corrected unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
renjingxiao committed Sep 10, 2023
1 parent 3848bd2 commit 2b51d95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public void updateArtifactState(String groupId, String artifactId, UpdateState d
requireParameter("artifactId", artifactId);
requireParameter("body.state", data.getState());

ArtifactMetaDataDto metaData = storage.getArtifactMetaData(groupId, artifactId);
ArtifactMetaDataDto metaData = storage.getArtifactMetaData(defaultGroupIdToNull(groupId), artifactId);

if (!metaData.getState().equals(data.getState())) {
storage.updateArtifactState(defaultGroupIdToNull(groupId), artifactId, data.getState());
Expand Down Expand Up @@ -666,7 +666,7 @@ public void updateArtifactVersionState(String groupId, String artifactId, String
requireParameter("artifactId", artifactId);
requireParameter("version", version);

ArtifactMetaDataDto metaData = storage.getArtifactMetaData(groupId, artifactId);
ArtifactMetaDataDto metaData = storage.getArtifactMetaData(defaultGroupIdToNull(groupId), artifactId);

if (!metaData.getState().equals(data.getState())) {
storage.updateArtifactState(defaultGroupIdToNull(groupId), artifactId, version, data.getState());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ public void testUpdateArtifactState() throws Exception {
.then()
.statusCode(204);

// Sends a GET request to check if the artifact state is DEPRECATED.
// Send a GET request to check if the artifact state is DEPRECATED.
given()
.when()
.contentType(CT_JSON)
Expand Down Expand Up @@ -727,20 +727,20 @@ public void testUpdateArtifactVersionState() throws Exception {
.contentType(CT_JSON)
.pathParam("groupId", "testUpdateArtifactVersionState")
.pathParam("artifactId", "testUpdateArtifactVersionState/EmptyAPI")
.pathParam("version", "1")
.pathParam("versionId", "1")
.body(updateState)
.put("/registry/v2/groups/{groupId}/artifacts/{artifactId}/versions/{version}/state")
.put("/registry/v2/groups/{groupId}/artifacts/{artifactId}/versions/{versionId}/state")
.then()
.statusCode(204);

// Sends a GET request to check if the artifact state is DEPRECATED.
// Send a GET request to check if the artifact state is DEPRECATED.
given()
.when()
.contentType(CT_JSON)
.pathParam("groupId", "testUpdateArtifactVersionState")
.pathParam("artifactId", "testUpdateArtifactVersionState/EmptyAPI")
.pathParam("version", "1")
.get("/registry/v2/groups/{groupId}/artifacts/{artifactId}/versions/{version}")
.pathParam("versionId", "1")
.get("/registry/v2/groups/{groupId}/artifacts/{artifactId}/versions/{versionId}")
.then()
.statusCode(200)
.header("X-Registry-Deprecated", "true");
Expand Down

0 comments on commit 2b51d95

Please sign in to comment.