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

ACS-8809 Rename timestamp to sourceTimestamp #680

Merged
merged 2 commits into from
Sep 23, 2024
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 @@ -104,7 +104,7 @@ void shouldIncludeBasicProperties()
assertEquals(nodeId, event.get("objectId").asText());
assertEquals(sourceId, event.get("sourceId").asText());
assertEquals(eventType, event.get("eventType").asText());
assertTrue(event.has("timestamp"));
assertTrue(event.has("sourceTimestamp"));
assertTrue(event.has("properties"));
}, 15, 200);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ final void testCreateNodeContainingImageFile() throws IOException

WireMock.verify(exactly(1), postRequestedFor(urlEqualTo("/presigned-urls")));
WireMock.verify(moreThanOrExactly(2), postRequestedFor(urlEqualTo("/ingestion-events"))
.withRequestBody(containing(createdNode.id()).and(containing("timestamp")))
.withRequestBody(containing(createdNode.id()).and(containing("sourceTimestamp")))
.withHeader(USER_AGENT, matching(getAppInfoRegex())));
}, INITIAL_DELAY_MS);
}
Expand Down Expand Up @@ -189,7 +189,7 @@ final void testCreateNodeContainingTextFile() throws IOException

WireMock.verify(exactly(1), postRequestedFor(urlEqualTo("/presigned-urls")));
WireMock.verify(moreThanOrExactly(2), postRequestedFor(urlEqualTo("/ingestion-events"))
.withRequestBody(containing(createdNode.id()).and(containing("timestamp")))
.withRequestBody(containing(createdNode.id()).and(containing("sourceTimestamp")))
.withHeader(USER_AGENT, matching(getAppInfoRegex())));
}, INITIAL_DELAY_MS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void testReceiveDeleteEvent() throws IOException
RetryUtils.retryWithBackoff(() -> verify(exactly(1), postRequestedFor(urlEqualTo("/ingestion-events"))
.withRequestBody(containing("\"objectId\":\"%s\"".formatted(createdNode.id())))
.withRequestBody(containing("\"sourceId\":\"alfresco-dummy-source-id-0a63de491876\""))
.withRequestBody(containing("\"timestamp\""))
.withRequestBody(containing("\"sourceTimestamp\""))
.withRequestBody(containing("\"eventType\":\"delete\""))
.withHeader(USER_AGENT, matching(getAppInfoRegex()))), DELAY_MS);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ final void testSendTimestampToHxi()
// then
RetryUtils.retryWithBackoff(() -> verify(exactly(1), postRequestedFor(urlEqualTo("/ingestion-events"))
.withRequestBody(containing(updatedNode.id()))
.withRequestBody(containing("timestamp"))
.withRequestBody(containing("sourceTimestamp"))
.withHeader(USER_AGENT, matching(getAppInfoRegex()))));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void shouldIngestOnlyMetadataIfThereIsNoContent()
"objectId" : "5018ff83-ec45-4a11-95c4-681761752aa7",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp": 1707153500,
"sourceTimestamp": 1707153500,
"properties" : {
"type": {"value": "cm:category"},
"createdAt": {"value": 1707153552},
Expand Down Expand Up @@ -122,7 +122,7 @@ void shouldIngestMetadataAndContent()
"objectId" : "37be157c-741c-4e51-b781-20d36e4e335a",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp": 1308061016,
"sourceTimestamp": 1308061016,
"properties" : {
"type": {"value": "cm:content"},
"createdBy": {"value": "admin"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void givenMappingForImage_whenContentWithMatchingTypeIngested_thenProcessWithTra
"objectId" : "37be157c-741c-4e51-b781-20d36e4e335a",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp": %s,
"sourceTimestamp": %s,
"properties" : {
"type": {"value": "cm:content"},
"createdBy": {"value": "admin"},
Expand Down Expand Up @@ -168,7 +168,7 @@ void givenMappingForNonImage_whenContentWithMatchingTypeIngested_thenProcessWith
"objectId" : "37be157c-741c-4e51-b781-20d36e4e335a",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp": %s,
"sourceTimestamp": %s,
"properties" : {
"type": {"value": "cm:content"},
"createdBy": {"value": "admin"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void givenExactAndWildcardMimeTypeMappingForContentConfigured_whenContentWithNot
"objectId" : "37be157c-741c-4e51-b781-20d36e4e335a",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp" : %s,
"sourceTimestamp" : %s,
"properties" : {
"type": {"value": "cm:content"},
"createdBy": {"value": "admin"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void testCreateRequest()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "create",
"timestamp": 1611227656423,
"sourceTimestamp": 1611227656423,
"properties": {
"cm:autoVersion": {"value": true},
"createdAt": {"value": 1611227655695},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void testDeleteRequest()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "delete",
"timestamp": 1611656982995
"sourceTimestamp": 1611656982995
}""";
containerSupport.expectHxIngestMessageReceived(expectedBody);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void givenMappingForImage_whenContentWithMatchingTypeIngested_thenProcessWithTra
"objectId": "d71dd823-01c7-477c-8490-04cb0e826e61",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "create",
"timestamp" : 1611227656423,
"sourceTimestamp" : 1611227656423,
"properties": {
"cm:autoVersion": {"value": true},
"createdAt": {"value": 1611227655695},
Expand Down Expand Up @@ -209,7 +209,7 @@ void givenMappingForNonImage_whenContentWithMatchingTypeIngested_thenProcessWith
"objectId": "d71dd823-01c7-477c-8490-04cb0e826e61",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "create",
"timestamp" : 1611227656423,
"sourceTimestamp" : 1611227656423,
"properties": {
"cm:autoVersion": {"value": true},
"createdAt": {"value": 1611227655695},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void givenExactAndWildcardMimeTypeMappingForContentConfigured_whenContentWithNot
"objectId": "d71dd823-01c7-477c-8490-04cb0e826e61",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "create",
"timestamp": 1611227656423,
"sourceTimestamp": 1611227656423,
"properties": {
"cm:autoVersion": {"value": true},
"createdAt": {"value": 1611227655695},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void testUpdateRequestWithPredictionPreviouslyApplied()
"objectId": "34563456-3456-3456-3456-345634563456",
"eventType": "update",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"timestamp" : %s,
"sourceTimestamp" : %s,
"properties": {
"createdAt" : {
"value" : 1611227655695
Expand Down Expand Up @@ -413,7 +413,7 @@ void testPredictionNodeConfirmedByUserRaisesHxIEventAgainstParent()
"objectId": "5f355d16-f824-4173-bf4b-b1ec37ef5549",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": %s,
"sourceTimestamp": %s,
"properties": {
"cm:description": {"value": "predicted value"}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void testTransferRendition()
"objectId": "f71dd823-82c7-477c-8490-04cb0e826e67",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1308061016,
"sourceTimestamp": 1308061016,
"properties": {
"cm:content": {
"file": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void testCreateRequestWithAspectInAllowedFilterAndTypeInAllowedFilterAndAncestor
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e01",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "create",
"timestamp": 1611227656423,
"sourceTimestamp": 1611227656423,
"properties": {
"cm:autoVersion": {"value": true},
"createdAt": {"value": 1709378055695},
Expand Down Expand Up @@ -262,7 +262,7 @@ void testCreateRequestWithAtLeastOneAspectPresentInAllowedFilterAndTypeInAllowed
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e03",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "create",
"timestamp": 1611227656423,
"sourceTimestamp": 1611227656423,
"properties": {
"cm:autoVersion": {"value": true},
"createdAt": {"value": 1709378055695},
Expand Down Expand Up @@ -424,7 +424,7 @@ void testUpdateRequestWithAspectInAllowedFilterAndTypeInAllowedFilterAndAncestor
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e05",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties": {
"cm:title": {"value": "Purchase Order"},
"aspectsNames": {"value" : [ "cm:versionable", "cm:auditable" ]},
Expand Down Expand Up @@ -616,7 +616,7 @@ void testUpdateRequestWithAtLeastOneAspectInAllowedFilterAndTypeInAllowedFilterA
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e07",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties": {
"cm:title": {"value": "Purchase Order"},
"aspectsNames": {"value" : [ "cm:versionable", "cm:author", "cm:titled", "cm:classifiable" ]},
Expand Down Expand Up @@ -1047,7 +1047,7 @@ void testUpdateRequestWithAspectInAllowedFilterAndTypeInAllowedFilterAndAncestor
"objectId" : "d71dd823-82c7-477c-8490-04cb0e826e13",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties" : {
"cm:title" : {
"value" : "Purchase Order"
Expand Down Expand Up @@ -1173,7 +1173,7 @@ void testUpdateRequestWithAspectInAllowedFilterAndTypeInAllowedFilterAndAncestor
{
"objectId" : "d71dd823-82c7-477c-8490-04cb0e826e14",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"eventType" : "delete"
}
""";
Expand Down Expand Up @@ -1255,7 +1255,7 @@ void testUpdateRequestWithAspectModifiedToFitDeniedFilterAndTypeInAllowedFilterA
{
"objectId" : "d71dd823-82c7-477c-8490-04cb0e826e15",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"timestamp" : 1611656982995,
"sourceTimestamp" : 1611656982995,
"eventType" : "delete"
}
""";
Expand Down Expand Up @@ -1332,7 +1332,7 @@ void testUpdateRequestWithAspectModifiedToFitAllowedFilterAndTypeInAllowedFilter
"objectId" : "d71dd823-82c7-477c-8490-04cb0e826e16",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "create",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties" : {
"cm:title" : {
"value" : "Purchase Order"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void testUpdateRequest()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp" : 1611656982995,
"sourceTimestamp" : 1611656982995,
"properties": {
"cm:title": {"value": "Purchase Order"},
"aspectsNames": {"value": ["cm:versionable", "cm:author", "cm:titled"]},
Expand Down Expand Up @@ -218,7 +218,7 @@ void testContentUpdateRequest()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties": {
"createdAt" : {
"value" : 1611227655695
Expand Down Expand Up @@ -291,7 +291,7 @@ void shouldCreateProperty()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties": {
"cm:title": {"value": "Purchase Order"},
"createdAt" : {
Expand Down Expand Up @@ -366,7 +366,7 @@ void shouldUpdateProperty()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties": {
"cm:title": {"value": "Summary for year 2024"},
"createdAt" : {
Expand Down Expand Up @@ -441,7 +441,7 @@ void shouldDeleteProperty()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp" : 1611656982995,
"sourceTimestamp" : 1611656982995,
"properties": {
"createdAt" : {
"value" : 1611227655695
Expand Down Expand Up @@ -534,7 +534,7 @@ void shouldMapTagsAndCategoriesToJustIds()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties": {
"cm:taggable": {"value": ["51d0b636-3c3b-4e33-ba1f-098474f53e8c"]},
"cm:categories": {"value": ["a9f57ef6-2acf-4b2a-ae85-82cf552bec58"]},
Expand Down Expand Up @@ -683,7 +683,7 @@ void testRemovingContentFromNode()
"objectId": "d71dd823-82c7-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1611656982995,
"sourceTimestamp": 1611656982995,
"properties" : {
"cm:title" : {
"value" : "Purchase Order"
Expand Down Expand Up @@ -777,7 +777,7 @@ void testLogInEvent()
"objectId": "321d84e3-a5fe-431e-92f5-f8e09480305e",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp": 1704798873615,
"sourceTimestamp": 1704798873615,
"properties": {
"aspectsNames": {"value": ["cm:preferences", "cm:ownable"]},
"cm:homeFolderProvider" : {
Expand Down Expand Up @@ -860,7 +860,7 @@ void testUpdateFolderName()
"objectId": "82c7d723-1dd8-477c-8490-04cb0e826e65",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType": "update",
"timestamp" : 1611656982995,
"sourceTimestamp" : 1611656982995,
"properties": {
"cm:name": {"value": "New Folder"},
"createdAt" : {
Expand Down Expand Up @@ -978,7 +978,7 @@ void testUpdatePermissions()
"objectId" : "9f3380e3-b9b1-4b01-b1c6-ef1f717a9abb",
"sourceId" : "alfresco-dummy-source-id-0a63de491876",
"eventType" : "update",
"timestamp" : 1722422055416,
"sourceTimestamp" : 1722422055416,
"properties" : {
"ALLOW_ACCESS" : {
"value" : [ "GROUP_EVERYONE", "abeecher" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public void serialize(DeleteNodeEvent event, JsonGenerator jgen, SerializerProvi

jgen.writeStringField("objectId", event.getObjectId());
jgen.writeStringField("sourceId", event.getSourceId());
jgen.writeNumberField("timestamp", event.getTimestamp());
jgen.writeNumberField("sourceTimestamp", event.getTimestamp());

jgen.writeStringField("eventType", "delete");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void serialize(UpdateNodeEvent event, JsonGenerator jgen, SerializerProvi
jgen.writeStringField("sourceId", event.getSourceId());

jgen.writeStringField("eventType", serializeEventType(event.getEventType()));
jgen.writeNumberField("timestamp", event.getTimestamp());
jgen.writeNumberField("sourceTimestamp", event.getTimestamp());

if (!event.getMetadataPropertiesToSet().isEmpty() || !event.getContentPropertiesToSet().isEmpty())
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@

public record DeleteNodeCommand(
String nodeId,
long timestamp)
long sourceTimestamp)
{
public DeleteNodeCommand
{
ensureNotBlank(nodeId, "Node id cannot be blank.");
ensureThat(timestamp > 0, "Timestamp cannot be negative or zero.");
ensureThat(sourceTimestamp > 0, "Source timestamp cannot be negative or zero.");
}
}
Loading
Loading