Skip to content

Commit

Permalink
adding update and delete validation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
azakrzewski-hy committed Dec 9, 2024
1 parent ab08fc3 commit 6afb106
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,5 @@
}
]
},
"generated_at": "2024-10-07T15:02:23Z"
"generated_at": "2024-12-09T11:44:50Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@
import java.util.Map;

public record HxInsightRequest(String url, Map<String, String> headers, String body)
{
}
{}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
url: /v1/ingestion-events
headers:
authorization: application/json
authorization: string
content-type: application/json
hxp-environment: string
user-agent: string
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
]
Original file line number Diff line number Diff line change
@@ -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"
]
}
]

0 comments on commit 6afb106

Please sign in to comment.