Skip to content

Commit

Permalink
Stop asking metadata to convert to new protocol (#3307)
Browse files Browse the repository at this point in the history
* Stop asking metadata to convert to new protocol

Stop asking metadata to convert to new protocol

* Fix test cases and avoid calling deprecated API
  • Loading branch information
rafaelbey authored Dec 18, 2024
1 parent 171cfae commit d467d9a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ public String getMetaDataApiUrl(Identity identity, AlloySDLC alloySDLC, String c
{
Assert.assertTrue(alloySDLC.project == null, () -> "Accessing metadata services using project id was demised. Please update AlloySDLC to provide group and artifact IDs");
Assert.assertTrue(alloySDLC.groupId != null && alloySDLC.artifactId != null, () -> "AlloySDLC info must contain and group and artifact IDs to access metadata services");
return (isLatestRevision(alloySDLC)) ?
metaDataServerConfiguration.getAlloy().getBaseUrl() + "/projects/" + alloySDLC.groupId + "/" + alloySDLC.artifactId + "/revisions/latest/pureModelContextData?clientVersion=" + clientVersion :
metaDataServerConfiguration.getAlloy().getBaseUrl() + "/projects/" + alloySDLC.groupId + "/" + alloySDLC.artifactId + "/versions/" + alloySDLC.version + "/pureModelContextData?clientVersion=" + clientVersion;
String version = isLatestRevision(alloySDLC) ? "master-SNAPSHOT" : alloySDLC.version;
return this.metaDataServerConfiguration.getAlloy().getBaseUrl() + "/projects/" + alloySDLC.groupId + "/" + alloySDLC.artifactId + "/versions/" + version + "/pureModelContextData?convertToNewProtocol=false&clientVersion=" + clientVersion;
}

public List<String> checkAllPathsExist(PureModelContextData data, AlloySDLC alloySDLC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@ private static void configureWireMockForRetries() throws JsonProcessingException
PureModelContextData data = PureModelContextData.newPureModelContextData(new Protocol(), new PureModelContextPointer(), Lists.fixedSize.empty());
String pmcdJson = objectMapper.writeValueAsString(data);

WireMock.stubFor(WireMock.get("/alloy/projects/groupId/artifactId/versions/1.0.0/pureModelContextData?clientVersion=" + CLIENT_VERSION)
WireMock.stubFor(WireMock.get("/alloy/projects/groupId/artifactId/versions/1.0.0/pureModelContextData?convertToNewProtocol=false&clientVersion=" + CLIENT_VERSION)
.inScenario("RETRY_FAILURES")
.whenScenarioStateIs(Scenario.STARTED)
.willReturn(WireMock.aResponse().withStatus(503).withBody("a failure"))
.willSetStateTo("FAILED_1"));

WireMock.stubFor(WireMock.get("/alloy/projects/groupId/artifactId/versions/1.0.0/pureModelContextData?clientVersion=" + CLIENT_VERSION)
WireMock.stubFor(WireMock.get("/alloy/projects/groupId/artifactId/versions/1.0.0/pureModelContextData?convertToNewProtocol=false&clientVersion=" + CLIENT_VERSION)
.inScenario("RETRY_FAILURES")
.whenScenarioStateIs("FAILED_1")
.willReturn(WireMock.aResponse().withStatus(503).withBody("a failure"))
.willSetStateTo("FAILED_2"));

WireMock.stubFor(WireMock.get("/alloy/projects/groupId/artifactId/versions/1.0.0/pureModelContextData?clientVersion=" + CLIENT_VERSION)
WireMock.stubFor(WireMock.get("/alloy/projects/groupId/artifactId/versions/1.0.0/pureModelContextData?convertToNewProtocol=false&clientVersion=" + CLIENT_VERSION)
.inScenario("RETRY_FAILURES")
.whenScenarioStateIs("FAILED_2")
.willReturn(WireMock.okJson(pmcdJson))
Expand Down Expand Up @@ -252,7 +252,7 @@ private static void configureWireMockForRetries() throws JsonProcessingException
WireMock.stubFor(WireMock.get("/sdlc/api/projects/proj-1235/workspaces/workspaceAbc/revisions/HEAD/upstreamProjects")
.willReturn(WireMock.okJson("[{\"projectId\": \"org.finos.legend.dependency:models\",\"versionId\": \"2.0.1\"}]")));

WireMock.stubFor(WireMock.get("/alloy/projects/org.finos.legend.dependency/models/versions/2.0.1/pureModelContextData?clientVersion=" + CLIENT_VERSION)
WireMock.stubFor(WireMock.get("/alloy/projects/org.finos.legend.dependency/models/versions/2.0.1/pureModelContextData?convertToNewProtocol=false&clientVersion=" + CLIENT_VERSION)
.willReturn(WireMock.okJson(pmcdJsonDep)));
}

Expand Down

0 comments on commit d467d9a

Please sign in to comment.