From d467d9a3ad81297085a440ccc2b92a29bea2f4b0 Mon Sep 17 00:00:00 2001 From: Rafael Bey <24432403+rafaelbey@users.noreply.github.com> Date: Wed, 18 Dec 2024 09:16:58 -0500 Subject: [PATCH] Stop asking metadata to convert to new protocol (#3307) * Stop asking metadata to convert to new protocol Stop asking metadata to convert to new protocol * Fix test cases and avoid calling deprecated API --- .../pure/modelManager/sdlc/alloy/AlloySDLCLoader.java | 5 ++--- .../language/pure/modelManager/sdlc/TestSDLCLoader.java | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/main/java/org/finos/legend/engine/language/pure/modelManager/sdlc/alloy/AlloySDLCLoader.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/main/java/org/finos/legend/engine/language/pure/modelManager/sdlc/alloy/AlloySDLCLoader.java index a24fb630469..7f54f09e217 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/main/java/org/finos/legend/engine/language/pure/modelManager/sdlc/alloy/AlloySDLCLoader.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/main/java/org/finos/legend/engine/language/pure/modelManager/sdlc/alloy/AlloySDLCLoader.java @@ -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 checkAllPathsExist(PureModelContextData data, AlloySDLC alloySDLC) diff --git a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/test/java/org/finos/legend/engine/language/pure/modelManager/sdlc/TestSDLCLoader.java b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/test/java/org/finos/legend/engine/language/pure/modelManager/sdlc/TestSDLCLoader.java index 62a91b4ed4c..dd3402af54f 100644 --- a/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/test/java/org/finos/legend/engine/language/pure/modelManager/sdlc/TestSDLCLoader.java +++ b/legend-engine-core/legend-engine-core-base/legend-engine-core-language-pure/legend-engine-language-pure-modelManager-sdlc/src/test/java/org/finos/legend/engine/language/pure/modelManager/sdlc/TestSDLCLoader.java @@ -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)) @@ -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))); }