From 442a630ce41616c4ead66ca220f87a2ed26b1610 Mon Sep 17 00:00:00 2001
From: Kacper Magdziarz <95610011+kmagdziarz@users.noreply.github.com>
Date: Wed, 4 Dec 2024 14:56:34 +0100
Subject: [PATCH] [ACS-9062] Switch to ACS Event Model 1.0.2 (#763)
---
live-ingester/pom.xml | 2 +-
.../UpdateRequestIntegrationTest.java | 3 +++
.../adapters/config/MappingConfig.java | 4 ++--
.../property/PropertyMappingHelper.java | 14 ++++++------
.../mapper/property/PropertiesMapperTest.java | 22 +++++++++----------
pom.xml | 4 ++--
6 files changed, 26 insertions(+), 23 deletions(-)
diff --git a/live-ingester/pom.xml b/live-ingester/pom.xml
index 66ed1eb8e..cedbe3713 100644
--- a/live-ingester/pom.xml
+++ b/live-ingester/pom.xml
@@ -78,7 +78,7 @@
org.alfresco
- acs-enterprise-event-model
+ acs-event-model
diff --git a/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/UpdateRequestIntegrationTest.java b/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/UpdateRequestIntegrationTest.java
index e234db80f..6b3aca860 100644
--- a/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/UpdateRequestIntegrationTest.java
+++ b/live-ingester/src/integration-test/java/org/alfresco/hxi_connector/live_ingester/domain/usecase/e2e/repository/UpdateRequestIntegrationTest.java
@@ -190,6 +190,7 @@ void testContentUpdateRequest()
}
},
"resourceBefore": {
+ "@type": "NodeResource",
"content": {
"mimeType": "application/pdf",
"sizeInBytes": 123,
@@ -767,6 +768,7 @@ void testLogInEvent()
"isFile": false
},
"resourceBefore": {
+ "@type": "NodeResource",
"properties": {
"cm:preferenceValues": null
},
@@ -854,6 +856,7 @@ void testUpdateFolderName()
"aspectNames": [ "cm:versionable", "cm:author", "cm:titled" ]
},
"resourceBefore": {
+ "@type": "NodeResource",
"name": "Old Folder"
}
}
diff --git a/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/config/MappingConfig.java b/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/config/MappingConfig.java
index ffb591f20..ed3376902 100644
--- a/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/config/MappingConfig.java
+++ b/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/config/MappingConfig.java
@@ -31,11 +31,11 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.alfresco.enterprise.repo.event.databind.EnterpriseObjectMapperFactory;
import org.alfresco.hxi_connector.live_ingester.adapters.config.jackson.DeleteNodeEventSerializer;
import org.alfresco.hxi_connector.live_ingester.adapters.config.jackson.UpdateNodeEventSerializer;
import org.alfresco.hxi_connector.live_ingester.domain.ports.ingestion_engine.DeleteNodeEvent;
import org.alfresco.hxi_connector.live_ingester.domain.ports.ingestion_engine.UpdateNodeEvent;
+import org.alfresco.repo.event.databind.ObjectMapperFactory;
@Configuration
public class MappingConfig
@@ -44,7 +44,7 @@ public class MappingConfig
@Bean
public ObjectMapper objectMapper()
{
- ObjectMapper objectMapper = EnterpriseObjectMapperFactory.createInstance();
+ ObjectMapper objectMapper = ObjectMapperFactory.createInstance();
objectMapper.registerModule(new JavaTimeModule());
objectMapper.registerModule(createModuleWithCustomSerializers());
diff --git a/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertyMappingHelper.java b/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertyMappingHelper.java
index 3b12cda92..14e0faf04 100644
--- a/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertyMappingHelper.java
+++ b/live-ingester/src/main/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertyMappingHelper.java
@@ -49,10 +49,10 @@
import lombok.NoArgsConstructor;
-import org.alfresco.enterprise.repo.event.v1.model.EnterpriseEventData;
import org.alfresco.hxi_connector.live_ingester.domain.usecase.metadata.model.PropertyDelta;
import org.alfresco.repo.event.v1.model.ContentInfo;
import org.alfresco.repo.event.v1.model.DataAttributes;
+import org.alfresco.repo.event.v1.model.EventData;
import org.alfresco.repo.event.v1.model.NodeResource;
import org.alfresco.repo.event.v1.model.RepoEvent;
import org.alfresco.repo.event.v1.model.UserInfo;
@@ -107,26 +107,26 @@ public static Optional> calculateModifiedAtDelta(RepoEvent> calculateAllowAccessDelta(RepoEvent> event)
{
- EnterpriseEventData enterpriseEventData = (EnterpriseEventData) event.getData();
+ EventData eventData = (EventData) event.getData();
- if (enterpriseEventData.getResourceReaderAuthorities() == null)
+ if (eventData.getResourceReaderAuthorities() == null)
{
return Optional.of(PropertyDelta.updated(ALLOW_ACCESS, Set.of(GROUP_EVERYONE)));
}
- return Optional.of(PropertyDelta.updated(ALLOW_ACCESS, enterpriseEventData.getResourceReaderAuthorities()));
+ return Optional.of(PropertyDelta.updated(ALLOW_ACCESS, eventData.getResourceReaderAuthorities()));
}
public static Optional> calculateDenyAccessDelta(RepoEvent> event)
{
- EnterpriseEventData enterpriseEventData = (EnterpriseEventData) event.getData();
+ EventData eventData = (EventData) event.getData();
- if (enterpriseEventData.getResourceDeniedAuthorities() == null)
+ if (eventData.getResourceDeniedAuthorities() == null)
{
return Optional.of(PropertyDelta.updated(DENY_ACCESS, Set.of()));
}
- return Optional.of(PropertyDelta.updated(DENY_ACCESS, enterpriseEventData.getResourceDeniedAuthorities()));
+ return Optional.of(PropertyDelta.updated(DENY_ACCESS, eventData.getResourceDeniedAuthorities()));
}
private static Long toMilliseconds(ZonedDateTime time)
diff --git a/live-ingester/src/test/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertiesMapperTest.java b/live-ingester/src/test/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertiesMapperTest.java
index 75d0513ff..7c7df7f0e 100644
--- a/live-ingester/src/test/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertiesMapperTest.java
+++ b/live-ingester/src/test/java/org/alfresco/hxi_connector/live_ingester/adapters/messaging/repository/mapper/property/PropertiesMapperTest.java
@@ -57,10 +57,10 @@
import org.junit.jupiter.api.Test;
-import org.alfresco.enterprise.repo.event.v1.model.EnterpriseEventData;
import org.alfresco.hxi_connector.live_ingester.domain.usecase.metadata.model.PropertyDelta;
import org.alfresco.repo.event.v1.model.ContentInfo;
import org.alfresco.repo.event.v1.model.DataAttributes;
+import org.alfresco.repo.event.v1.model.EventData;
import org.alfresco.repo.event.v1.model.EventType;
import org.alfresco.repo.event.v1.model.NodeResource;
import org.alfresco.repo.event.v1.model.RepoEvent;
@@ -373,12 +373,12 @@ void shouldAddACLInfo_NodeCreated()
setType(event, NODE_CREATED);
- given(event.getData()).willReturn(mock(EnterpriseEventData.class));
+ given(event.getData()).willReturn(mock(EventData.class));
given(event.getData().getResource()).willReturn(nodeResourceWithRequiredFields().build());
given(event.getData().getResourceBefore()).willReturn(NodeResource.builder().build());
- given(((EnterpriseEventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
- given(((EnterpriseEventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
+ given(((EventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
+ given(((EventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
// when
Set> propertyDeltas = propertiesMapper.mapToPropertyDeltas(event);
@@ -399,12 +399,12 @@ void shouldAddDefaultACLInfoIfNotPresent_NodeCreated()
setType(event, NODE_CREATED);
- given(event.getData()).willReturn(mock(EnterpriseEventData.class));
+ given(event.getData()).willReturn(mock(EventData.class));
given(event.getData().getResource()).willReturn(nodeResourceWithRequiredFields().build());
given(event.getData().getResourceBefore()).willReturn(NodeResource.builder().build());
- given(((EnterpriseEventData) event.getData()).getResourceReaderAuthorities()).willReturn(null);
- given(((EnterpriseEventData) event.getData()).getResourceDeniedAuthorities()).willReturn(null);
+ given(((EventData) event.getData()).getResourceReaderAuthorities()).willReturn(null);
+ given(((EventData) event.getData()).getResourceDeniedAuthorities()).willReturn(null);
// when
Set> propertyDeltas = propertiesMapper.mapToPropertyDeltas(event);
@@ -426,12 +426,12 @@ void shouldAddACLInfo_NodePermissionsUpdated()
setType(event, PERMISSION_UPDATED);
- given(event.getData()).willReturn(mock(EnterpriseEventData.class));
+ given(event.getData()).willReturn(mock(EventData.class));
given(event.getData().getResource()).willReturn(nodeResourceWithRequiredFields().build());
given(event.getData().getResourceBefore()).willReturn(NodeResource.builder().build());
- given(((EnterpriseEventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
- given(((EnterpriseEventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
+ given(((EventData) event.getData()).getResourceReaderAuthorities()).willReturn(Set.of(groupEveryone));
+ given(((EventData) event.getData()).getResourceDeniedAuthorities()).willReturn(Set.of(bob));
// when
Set> propertyDeltas = propertiesMapper.mapToPropertyDeltas(event);
@@ -469,7 +469,7 @@ private static DataAttributes mockData(RepoEvent data = mock();
+ EventData data = mock();
given(event.getData()).willReturn(data);
diff --git a/pom.xml b/pom.xml
index ebf904158..262b0a575 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,7 +71,7 @@
23.4.0-M1
4.9.0
4.1.0
- 0.0.68
+ 1.0.2
3.3.5
4.8.1
3.17.0
@@ -223,7 +223,7 @@
org.alfresco
- acs-enterprise-event-model
+ acs-event-model
${alfresco-event-model.version}