diff --git a/.secrets.baseline b/.secrets.baseline index d637c4c43..a4aaec714 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -296,5 +296,5 @@ } ] }, - "generated_at": "2024-10-07T15:02:23Z" + "generated_at": "2024-12-09T11:44:50Z" } diff --git a/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/OpenApiRequestValidationTest.java b/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/OpenApiRequestValidationTest.java index cde5d427c..0ccb1578b 100644 --- a/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/OpenApiRequestValidationTest.java +++ b/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/OpenApiRequestValidationTest.java @@ -27,8 +27,6 @@ import static org.assertj.core.api.Assertions.assertThat; -import java.util.Collections; - import com.atlassian.oai.validator.OpenApiInteractionValidator; import com.atlassian.oai.validator.model.Request; import com.atlassian.oai.validator.model.SimpleRequest; @@ -50,18 +48,37 @@ void testRequestToPresignedUrls() Request request = makeRequest(hxInsightRequest); - assertThat(classUnderTest.validateRequest(request).getMessages()).isEqualTo(Collections.emptyList()); + assertThat(classUnderTest.validateRequest(request).getMessages()).isEmpty(); } @Test - void testRequestToIngestionEvents() + void testCreateRequestToIngestionEvents() { HxInsightRequest hxInsightRequest = RequestLoader.load("/expected-hxinsight-requests/create-document-request.yml"); Request request = makeRequest(hxInsightRequest); - // assertThat(classUnderTest.validateRequest(request).getMessages()).isEqualTo(expectedBody); - assertThat(classUnderTest.validateRequest(request).getMessages()).isEqualTo(Collections.emptyList()); + assertThat(classUnderTest.validateRequest(request).getMessages()).isEmpty(); + } + + @Test + void testUpdateRequestToIngestionEvents() + { + HxInsightRequest hxInsightRequest = RequestLoader.load("/expected-hxinsight-requests/update-document-request.yml"); + + Request request = makeRequest(hxInsightRequest); + + assertThat(classUnderTest.validateRequest(request).getMessages()).isEmpty(); + } + + @Test + void testDeleteRequestToIngestionEvents() + { + HxInsightRequest hxInsightRequest = RequestLoader.load("/expected-hxinsight-requests/delete-document-request.yml"); + + Request request = makeRequest(hxInsightRequest); + + assertThat(classUnderTest.validateRequest(request).getMessages()).isEmpty(); } private static Request makeRequest(HxInsightRequest hxInsightRequest) diff --git a/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/util/insight_api/HxInsightRequest.java b/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/util/insight_api/HxInsightRequest.java index ef5a8c1f2..c87c73aa7 100644 --- a/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/util/insight_api/HxInsightRequest.java +++ b/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/util/insight_api/HxInsightRequest.java @@ -28,5 +28,4 @@ import java.util.Map; public record HxInsightRequest(String url, Map headers, String body) -{ -} +{} diff --git a/live-ingester/src/integration-test/resources/expected-hxinsight-requests/create-document-request.yml b/live-ingester/src/integration-test/resources/expected-hxinsight-requests/create-document-request.yml index 9ae55b5bd..206e1cf68 100644 --- a/live-ingester/src/integration-test/resources/expected-hxinsight-requests/create-document-request.yml +++ b/live-ingester/src/integration-test/resources/expected-hxinsight-requests/create-document-request.yml @@ -1,6 +1,6 @@ url: /v1/ingestion-events headers: - authorization: application/json + authorization: string content-type: application/json hxp-environment: string user-agent: string diff --git a/live-ingester/src/integration-test/resources/expected-hxinsight-requests/delete-document-request.yml b/live-ingester/src/integration-test/resources/expected-hxinsight-requests/delete-document-request.yml new file mode 100644 index 000000000..5d18d31d1 --- /dev/null +++ b/live-ingester/src/integration-test/resources/expected-hxinsight-requests/delete-document-request.yml @@ -0,0 +1,14 @@ +url: /v1/ingestion-events +headers: + authorization: string + content-type: application/json + hxp-environment: string + user-agent: string +body: [ + { + "objectId": "d71dd823-82c7-477c-8490-04cb0e826e65", + "sourceId" : "alfresco-dummy-source-id-0a63de491876", + "eventType": "delete", + "sourceTimestamp": 1611656982995 + } +] \ No newline at end of file diff --git a/live-ingester/src/integration-test/resources/expected-hxinsight-requests/update-document-request.yml b/live-ingester/src/integration-test/resources/expected-hxinsight-requests/update-document-request.yml new file mode 100644 index 000000000..ed1edf714 --- /dev/null +++ b/live-ingester/src/integration-test/resources/expected-hxinsight-requests/update-document-request.yml @@ -0,0 +1,69 @@ +url: /v1/ingestion-events +headers: + authorization: string + content-type: application/json + hxp-environment: string + user-agent: string +body: [ + { + "objectId": "d71dd823-82c7-477c-8490-04cb0e826e65", + "sourceId": "alfresco-dummy-source-id-0a63de491876", + "eventType": "update", + "sourceTimestamp": 1611656982995, + "properties": { + "cm:title": { + "value": "Purchase Order" + }, + "aspectsNames": { + "value": [ + "cm:versionable", + "cm:author", + "cm:titled" + ] + }, + "modifiedBy": { + "value": "abeecher" + }, + "createdAt": { + "value": 1611227655695 + }, + "modifiedAt": { + "value": 1611227655695 + }, + "cm:versionLabel": { + "value": "1.0" + }, + "createdBy": { + "value": "admin" + }, + "ALLOW_ACCESS": { + "value": [ + "GROUP_EVERYONE" + ] + }, + "cm:name": { + "value": "purchase-order-scan.pdf", + "annotation": "name" + }, + "type": { + "value": "cm:content" + }, + "DENY_ACCESS": { + "value": [] + }, + "cm:content": { + "file": { + "content-metadata": { + "size": 531152, + "name": "purchase-order-scan.pdf", + "content-type": "application/pdf" + } + } + } + }, + "removedProperties": [ + "cm:versionType", + "cm:description" + ] + } +] \ No newline at end of file