diff --git a/extensions/common/api/lib/management-api-lib/src/main/java/org/eclipse/edc/api/management/ManagementApi.java b/extensions/common/api/lib/management-api-lib/src/main/java/org/eclipse/edc/api/management/ManagementApi.java index e101cebb55..3b660ab165 100644 --- a/extensions/common/api/lib/management-api-lib/src/main/java/org/eclipse/edc/api/management/ManagementApi.java +++ b/extensions/common/api/lib/management-api-lib/src/main/java/org/eclipse/edc/api/management/ManagementApi.java @@ -18,5 +18,5 @@ public interface ManagementApi { String MANAGEMENT_API_CONTEXT = "management-api"; - String MANAGEMENT_API_V_3_1_ALPHA = "v3.1-alpha"; + String MANAGEMENT_API_V_4_ALPHA = "v4alpha"; } diff --git a/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiConfigurationExtension.java b/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiConfigurationExtension.java index ee08b62841..542304b8fc 100644 --- a/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiConfigurationExtension.java +++ b/extensions/common/api/management-api-configuration/src/main/java/org/eclipse/edc/connector/api/management/configuration/ManagementApiConfigurationExtension.java @@ -63,7 +63,7 @@ import static java.lang.String.format; import static java.util.Optional.ofNullable; import static org.eclipse.edc.api.management.ManagementApi.MANAGEMENT_API_CONTEXT; -import static org.eclipse.edc.api.management.ManagementApi.MANAGEMENT_API_V_3_1_ALPHA; +import static org.eclipse.edc.api.management.ManagementApi.MANAGEMENT_API_V_4_ALPHA; import static org.eclipse.edc.jsonld.spi.JsonLdKeywords.VOCAB; import static org.eclipse.edc.policy.model.OdrlNamespace.ODRL_PREFIX; import static org.eclipse.edc.policy.model.OdrlNamespace.ODRL_SCHEMA; @@ -166,9 +166,9 @@ public void initialize(ServiceExtensionContext context) { managementApiTransformerRegistry.register(new JsonObjectToAssetTransformer()); managementApiTransformerRegistry.register(new JsonValueToGenericTypeTransformer(jsonLdMapper)); - var managementApiTransformerRegistryV31Alpha = managementApiTransformerRegistry.forContext(MANAGEMENT_API_V_3_1_ALPHA); + var managementApiTransformerRegistryV4Alpha = managementApiTransformerRegistry.forContext(MANAGEMENT_API_V_4_ALPHA); - managementApiTransformerRegistryV31Alpha.register(new JsonObjectFromPolicyTransformer(factory, participantIdMapper, true)); + managementApiTransformerRegistryV4Alpha.register(new JsonObjectFromPolicyTransformer(factory, participantIdMapper, true)); registerVersionInfo(getClass().getClassLoader()); } diff --git a/extensions/common/api/management-api-configuration/src/main/resources/management-api-version.json b/extensions/common/api/management-api-configuration/src/main/resources/management-api-version.json index b6457fc106..9a07bec56a 100644 --- a/extensions/common/api/management-api-configuration/src/main/resources/management-api-version.json +++ b/extensions/common/api/management-api-configuration/src/main/resources/management-api-version.json @@ -8,6 +8,12 @@ { "version": "3.1.0-alpha", "urlPath": "/v3.1alpha", + "lastUpdated": "2024-09-04T10:17:00Z", + "maturity": "alpha" + }, + { + "version": "4.0.0-alpha", + "urlPath": "/v4alpha", "lastUpdated": "2024-11-21T14:24:00Z", "maturity": "alpha" } diff --git a/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/ContractAgreementApiExtension.java b/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/ContractAgreementApiExtension.java index 5cd1dbd5e9..ec8ebc59fd 100644 --- a/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/ContractAgreementApiExtension.java +++ b/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/ContractAgreementApiExtension.java @@ -17,7 +17,7 @@ import org.eclipse.edc.connector.controlplane.api.management.contractagreement.v2.ContractAgreementApiV2Controller; import org.eclipse.edc.connector.controlplane.api.management.contractagreement.v3.ContractAgreementApiV3Controller; -import org.eclipse.edc.connector.controlplane.api.management.contractagreement.v31alpha.ContractAgreementApiV31AlphaController; +import org.eclipse.edc.connector.controlplane.api.management.contractagreement.v4alpha.ContractAgreementApiV4AlphaController; import org.eclipse.edc.connector.controlplane.services.spi.contractagreement.ContractAgreementService; import org.eclipse.edc.runtime.metamodel.annotation.Extension; import org.eclipse.edc.runtime.metamodel.annotation.Inject; @@ -29,7 +29,7 @@ import org.eclipse.edc.web.spi.configuration.ApiContext; import static org.eclipse.edc.api.management.ManagementApi.MANAGEMENT_API_CONTEXT; -import static org.eclipse.edc.api.management.ManagementApi.MANAGEMENT_API_V_3_1_ALPHA; +import static org.eclipse.edc.api.management.ManagementApi.MANAGEMENT_API_V_4_ALPHA; @Extension(value = ContractAgreementApiExtension.NAME) public class ContractAgreementApiExtension implements ServiceExtension { @@ -57,11 +57,11 @@ public void initialize(ServiceExtensionContext context) { var monitor = context.getMonitor(); var managementApiTransformerRegistry = transformerRegistry.forContext(MANAGEMENT_API_CONTEXT); - var managementApiTransformerRegistryV31Alpha = managementApiTransformerRegistry.forContext(MANAGEMENT_API_V_3_1_ALPHA); + var managementApiTransformerRegistryV31Alpha = managementApiTransformerRegistry.forContext(MANAGEMENT_API_V_4_ALPHA); webService.registerResource(ApiContext.MANAGEMENT, new ContractAgreementApiV2Controller(service, managementApiTransformerRegistry, monitor, validatorRegistry)); webService.registerResource(ApiContext.MANAGEMENT, new ContractAgreementApiV3Controller(service, managementApiTransformerRegistry, monitor, validatorRegistry)); - webService.registerResource(ApiContext.MANAGEMENT, new ContractAgreementApiV31AlphaController(service, managementApiTransformerRegistryV31Alpha, monitor, validatorRegistry)); + webService.registerResource(ApiContext.MANAGEMENT, new ContractAgreementApiV4AlphaController(service, managementApiTransformerRegistryV31Alpha, monitor, validatorRegistry)); } } diff --git a/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV3Alpha.java b/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v4alpha/ContractAgreementApiV4Alpha.java similarity index 91% rename from extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV3Alpha.java rename to extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v4alpha/ContractAgreementApiV4Alpha.java index 880c644b4b..39c3447586 100644 --- a/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV3Alpha.java +++ b/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v4alpha/ContractAgreementApiV4Alpha.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.connector.controlplane.api.management.contractagreement.v31alpha; +package org.eclipse.edc.connector.controlplane.api.management.contractagreement.v4alpha; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.Operation; @@ -28,9 +28,9 @@ import org.eclipse.edc.api.management.schema.ManagementApiSchema; import org.eclipse.edc.api.model.ApiCoreSchema; -@OpenAPIDefinition(info = @Info(version = "v3.1-alpha")) -@Tag(name = "Contract Agreement v3.1-alpha") -public interface ContractAgreementApiV3Alpha { +@OpenAPIDefinition(info = @Info(version = "v4alpha")) +@Tag(name = "Contract Agreement v4alpha") +public interface ContractAgreementApiV4Alpha { @Operation(description = "Gets all contract agreements according to a particular query", requestBody = @RequestBody(content = @Content(schema = @Schema(implementation = ApiCoreSchema.QuerySpecSchema.class))), @@ -41,7 +41,7 @@ public interface ContractAgreementApiV3Alpha { content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiCoreSchema.ApiErrorDetailSchema.class)))) } ) - JsonArray queryAgreementsV31Alpha(JsonObject querySpecJson); + JsonArray queryAgreementsV4Alpha(JsonObject querySpecJson); @Operation(description = "Gets an contract agreement with the given ID", responses = { @@ -53,7 +53,7 @@ public interface ContractAgreementApiV3Alpha { content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiCoreSchema.ApiErrorDetailSchema.class)))) } ) - JsonObject getAgreementByIdV31Alpha(String id); + JsonObject getAgreementByIdV4Alpha(String id); @Operation(description = "Gets a contract negotiation with the given contract agreement ID", @@ -66,6 +66,6 @@ public interface ContractAgreementApiV3Alpha { content = @Content(array = @ArraySchema(schema = @Schema(implementation = ApiCoreSchema.ApiErrorDetailSchema.class)))) } ) - JsonObject getNegotiationByAgreementIdV31Alpha(String id); + JsonObject getNegotiationByAgreementIdV4Alpha(String id); } diff --git a/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV31AlphaController.java b/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v4alpha/ContractAgreementApiV4AlphaController.java similarity index 71% rename from extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV31AlphaController.java rename to extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v4alpha/ContractAgreementApiV4AlphaController.java index 4dcbd094f0..3576ceb18a 100644 --- a/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV31AlphaController.java +++ b/extensions/control-plane/api/management-api/contract-agreement-api/src/main/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v4alpha/ContractAgreementApiV4AlphaController.java @@ -12,7 +12,7 @@ * */ -package org.eclipse.edc.connector.controlplane.api.management.contractagreement.v31alpha; +package org.eclipse.edc.connector.controlplane.api.management.contractagreement.v4alpha; import jakarta.json.JsonArray; import jakarta.json.JsonObject; @@ -32,30 +32,30 @@ @Consumes(APPLICATION_JSON) @Produces(APPLICATION_JSON) -@Path("/v3.1alpha/contractagreements") -public class ContractAgreementApiV31AlphaController extends BaseContractAgreementApiController implements ContractAgreementApiV3Alpha { - public ContractAgreementApiV31AlphaController(ContractAgreementService service, TypeTransformerRegistry transformerRegistry, Monitor monitor, JsonObjectValidatorRegistry validatorRegistry) { +@Path("/v4alpha/contractagreements") +public class ContractAgreementApiV4AlphaController extends BaseContractAgreementApiController implements ContractAgreementApiV4Alpha { + public ContractAgreementApiV4AlphaController(ContractAgreementService service, TypeTransformerRegistry transformerRegistry, Monitor monitor, JsonObjectValidatorRegistry validatorRegistry) { super(service, transformerRegistry, monitor, validatorRegistry); } @POST @Path("/request") @Override - public JsonArray queryAgreementsV31Alpha(JsonObject querySpecJson) { + public JsonArray queryAgreementsV4Alpha(JsonObject querySpecJson) { return queryAgreements(querySpecJson); } @GET @Path("{id}") @Override - public JsonObject getAgreementByIdV31Alpha(@PathParam("id") String id) { + public JsonObject getAgreementByIdV4Alpha(@PathParam("id") String id) { return getAgreementById(id); } @GET @Path("{id}/negotiation") @Override - public JsonObject getNegotiationByAgreementIdV31Alpha(@PathParam("id") String id) { + public JsonObject getNegotiationByAgreementIdV4Alpha(@PathParam("id") String id) { return getNegotiationByAgreementId(id); } } diff --git a/extensions/control-plane/api/management-api/contract-agreement-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV31AlphaControllerTest.java b/extensions/control-plane/api/management-api/contract-agreement-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV4AlphaControllerTest.java similarity index 68% rename from extensions/control-plane/api/management-api/contract-agreement-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV31AlphaControllerTest.java rename to extensions/control-plane/api/management-api/contract-agreement-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV4AlphaControllerTest.java index 67c5426165..2f34c85fc8 100644 --- a/extensions/control-plane/api/management-api/contract-agreement-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV31AlphaControllerTest.java +++ b/extensions/control-plane/api/management-api/contract-agreement-api/src/test/java/org/eclipse/edc/connector/controlplane/api/management/contractagreement/v31alpha/ContractAgreementApiV4AlphaControllerTest.java @@ -16,18 +16,19 @@ import io.restassured.specification.RequestSpecification; import org.eclipse.edc.connector.controlplane.api.management.contractagreement.BaseContractAgreementApiControllerTest; +import org.eclipse.edc.connector.controlplane.api.management.contractagreement.v4alpha.ContractAgreementApiV4AlphaController; import static io.restassured.RestAssured.given; -class ContractAgreementApiV31AlphaControllerTest extends BaseContractAgreementApiControllerTest { +class ContractAgreementApiV4AlphaControllerTest extends BaseContractAgreementApiControllerTest { @Override protected Object controller() { - return new ContractAgreementApiV31AlphaController(service, transformerRegistry, monitor, validatorRegistry); + return new ContractAgreementApiV4AlphaController(service, transformerRegistry, monitor, validatorRegistry); } protected RequestSpecification baseRequest() { return given() - .baseUri("http://localhost:" + port + "/v3.1alpha/contractagreements") + .baseUri("http://localhost:" + port + "/v4alpha/contractagreements") .when(); } } \ No newline at end of file diff --git a/system-tests/management-api/management-api-test-runner/src/test/java/org/eclipse/edc/test/e2e/managementapi/ContractAgreementApiEndToEndTest.java b/system-tests/management-api/management-api-test-runner/src/test/java/org/eclipse/edc/test/e2e/managementapi/ContractAgreementApiEndToEndTest.java index 0c1868360c..d5c0504ba9 100644 --- a/system-tests/management-api/management-api-test-runner/src/test/java/org/eclipse/edc/test/e2e/managementapi/ContractAgreementApiEndToEndTest.java +++ b/system-tests/management-api/management-api-test-runner/src/test/java/org/eclipse/edc/test/e2e/managementapi/ContractAgreementApiEndToEndTest.java @@ -67,7 +67,7 @@ void getById(ManagementEndToEndTestContext context, ContractNegotiationStore sto var agreement = createContractAgreement("cn1"); store.save(createContractNegotiationBuilder("cn1").contractAgreement(agreement).build()); - var json = context.baseRequest() + context.baseRequest() .contentType(JSON) .get("/v3/contractagreements/cn1") .then() @@ -81,13 +81,13 @@ void getById(ManagementEndToEndTestContext context, ContractNegotiationStore sto } @Test - void getByIdV31Alpha(ManagementEndToEndTestContext context, ContractNegotiationStore store) { + void getByIdV4Alpha(ManagementEndToEndTestContext context, ContractNegotiationStore store) { var agreement = createContractAgreement("cn1"); store.save(createContractNegotiationBuilder("cn1").contractAgreement(agreement).build()); context.baseRequest() .contentType(JSON) - .get("/v3.1alpha/contractagreements/cn1") + .get("/v4alpha/contractagreements/cn1") .then() .statusCode(200) .contentType(JSON)