Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(irs-edc-client): #412 fix properties transforming for notific… #447

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public class EdcAssetService {
private static final String ASSET_CREATION_DATA_ADDRESS_PROXY_PATH = "https://w3id.org/edc/v0.0.1/ns/proxyPath";
private static final String ASSET_CREATION_DATA_ADDRESS_PROXY_QUERY_PARAMS = "https://w3id.org/edc/v0.0.1/ns/proxyQueryParams";
private static final String ASSET_CREATION_DATA_ADDRESS_METHOD = "https://w3id.org/edc/v0.0.1/ns/method";
private static final String ASSET_CREATION_PROPERTY_DESCRIPTION = "https://w3id.org/edc/v0.0.1/ns/description";
private static final String ASSET_CREATION_PROPERTY_CONTENT_TYPE = "https://w3id.org/edc/v0.0.1/ns/contenttype";
private static final String ASSET_CREATION_PROPERTY_POLICY_ID = "https://w3id.org/edc/v0.0.1/ns/policy-id";
private static final String ASSET_CREATION_PROPERTY_TYPE = "https://w3id.org/edc/v0.0.1/ns/type";
private static final String ASSET_CREATION_PROPERTY_NOTIFICATION_TYPE = "https://w3id.org/edc/v0.0.1/ns/notificationtype";
private static final String ASSET_CREATION_PROPERTY_NOTIFICATION_METHOD = "https://w3id.org/edc/v0.0.1/ns/notificationmethod";

private final EdcTransformer edcTransformer;
private final EdcConfiguration config;
Expand Down Expand Up @@ -115,9 +121,12 @@ public void deleteAsset(final String assetId) throws DeleteEdcAssetException {
private Asset createNotificationAssetRequest(final String assetName, final String baseUrl,
final NotificationMethod notificationMethod, final NotificationType notificationType) {
final String assetId = UUID.randomUUID().toString();
final Map<String, Object> properties = Map.of("description", assetName, "contenttype", DEFAULT_CONTENT_TYPE,
"policy-id", DEFAULT_POLICY_ID, "type", notificationType.getValue(), "notificationtype",
notificationType.getValue(), "notificationmethod", notificationMethod.getValue());
final Map<String, Object> properties = Map.of(ASSET_CREATION_PROPERTY_DESCRIPTION, assetName,
ASSET_CREATION_PROPERTY_CONTENT_TYPE, DEFAULT_CONTENT_TYPE,
ASSET_CREATION_PROPERTY_POLICY_ID, DEFAULT_POLICY_ID, ASSET_CREATION_PROPERTY_TYPE,
notificationType.getValue(), ASSET_CREATION_PROPERTY_NOTIFICATION_TYPE,
notificationType.getValue(), ASSET_CREATION_PROPERTY_NOTIFICATION_METHOD,
notificationMethod.getValue());

final DataAddress dataAddress = DataAddress.Builder.newInstance()
.type(HTTP_DATA)
Expand All @@ -139,7 +148,7 @@ private Asset createNotificationAssetRequest(final String assetName, final Strin

private Asset createDtrAssetRequest(final String assetName, final String baseUrl) {
final String assetId = UUID.randomUUID().toString();
final Map<String, Object> properties = Map.of("description", assetName, "type",
final Map<String, Object> properties = Map.of(ASSET_CREATION_PROPERTY_DESCRIPTION, assetName, ASSET_CREATION_PROPERTY_TYPE,
"data.core.digitalTwinRegistry");

final DataAddress dataAddress = DataAddress.Builder.newInstance()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ void setUp() {
@Test
void testAssetCreateRequestStructure() throws JSONException, JsonProcessingException {

Map<String, Object> properties = Map.of("description", "endpoint to qualityinvestigation receive",
"contenttype", "application/json", "policy-id", "use-eu", "type", "receive", "notificationtype",
"qualityinvestigation", "notificationmethod", "receive");
Map<String, Object> properties = Map.of("https://w3id.org/edc/v0.0.1/ns/description", "endpoint to qualityinvestigation receive",
"https://w3id.org/edc/v0.0.1/ns/contenttype", "application/json", "https://w3id.org/edc/v0.0.1/ns/policy-id", "use-eu", "https://w3id.org/edc/v0.0.1/ns/type", "receive", "https://w3id.org/edc/v0.0.1/ns/notificationtype",
ds-jhartmann marked this conversation as resolved.
Show resolved Hide resolved
"qualityinvestigation", "https://w3id.org/edc/v0.0.1/ns/notificationmethod", "receive");

DataAddress dataAddress = DataAddress.Builder.newInstance()
.type(HTTP_DATA)
Expand Down Expand Up @@ -124,23 +124,28 @@ void testAssetCreateRequestStructure() throws JSONException, JsonProcessingExcep
"@id": "Asset1",
"@type": "edc:Asset",
"edc:properties": {
"edc:type": "receive",
"edc:notificationtype": "qualityinvestigation",
"edc:policy-id": "use-eu",
"edc:description": "endpoint to qualityinvestigation receive",
"edc:id": "Asset1",
"edc:contenttype": "Asset"
"edc:contenttype": "application/json",
"edc:notificationmethod": "receive"
},
"edc:dataAddress": {
"@type": "edc:DataAddress",
"edc:method": "POST",
"edc:type": "HttpData",
"edc:proxyMethod": "true",
"edc:proxyBody": "true",
"edc:baseUrl": "https://traceability.dev.demo.catena-x.net/api/qualitynotifications/receive",
"edc:method": "POST",
"edc:proxyMethod": "true"
"edc:baseUrl": "https://traceability.dev.demo.catena-x.net/api/qualitynotifications/receive"
},
"@context": {
"dct": "https://purl.org/dc/terms/",
"tx": "https://w3id.org/tractusx/v0.0.1/ns/",
"edc": "https://w3id.org/edc/v0.0.1/ns/",
"dcat": "https://www.w3.org/ns/dcat/",
"odrl": "http://www.w3.org/ns/odrl/2/",
"dcat": "https://www.w3.org/ns/dcat/",
"dspace": "https://w3id.org/dspace/v0.8/"
}
}
Expand Down
Loading