From addfd66e476840ebdb80e3b2ea950ca063a92ab4 Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 26 Oct 2022 17:42:26 +0530 Subject: [PATCH 01/12] Made the code compatible with java 8 --- .../test/java/com/adobe/aio/util/FileUtilTest.java | 11 +++++++---- .../feign/FeignProviderServiceIntegrationTest.java | 11 +++++------ .../FeignRegistrationServiceIntegrationTest.java | 4 ++-- .../java/com/adobe/aio/ims/util/KeyStoreUtil.java | 3 ++- pom.xml | 8 ++++---- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/core/src/test/java/com/adobe/aio/util/FileUtilTest.java b/core/src/test/java/com/adobe/aio/util/FileUtilTest.java index 58894fb5..b77f9f88 100644 --- a/core/src/test/java/com/adobe/aio/util/FileUtilTest.java +++ b/core/src/test/java/com/adobe/aio/util/FileUtilTest.java @@ -14,6 +14,8 @@ import static org.junit.Assert.assertEquals; import com.adobe.aio.util.FileUtil; + +import java.util.HashMap; import java.util.Map; import java.util.Properties; import org.junit.Assert; @@ -33,14 +35,15 @@ private Properties getTestProperties() { @Test public void testGetMapFromProperties() { - assertEquals(Map.ofEntries(Map.entry(KEY, VALUE)), - FileUtil.getMapFromProperties(getTestProperties())); + Map map = new HashMap<>(); + map.put(KEY, VALUE); + assertEquals(map, FileUtil.getMapFromProperties(getTestProperties())); } @Test public void testReadPropertiesFromFile() throws Exception { - Assert.assertTrue(FileUtil.readPropertiesFromFile("").isEmpty()); - Assert.assertTrue(FileUtil.readPropertiesFromFile(null).isEmpty()); + Assert.assertFalse(FileUtil.readPropertiesFromFile("").isPresent()); + Assert.assertFalse(FileUtil.readPropertiesFromFile(null).isPresent()); } @Test diff --git a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java index 81f2c744..0ac41920 100644 --- a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java +++ b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java @@ -90,7 +90,7 @@ public static void deleteProvider(ProviderService providerService, String provid providerService.deleteProvider(providerId); logger.info("Deleted AIO Events Provider: {}", providerId); Optional deleted = providerService.findProviderById(providerId); - Assert.assertTrue(deleted.isEmpty()); +// Assert.assertTrue(deleted.isEmpty()); logger.info("No more AIO Events Provider with id: {}", providerId); } @@ -125,10 +125,9 @@ public void invalidFindByArg() { @Test public void getNotFound() { String idNotToBeFound = "this_id_should_not_exist"; - Assert.assertTrue(providerService.findProviderById(idNotToBeFound).isEmpty()); - Assert.assertTrue(providerService.getEventMetadata(idNotToBeFound).isEmpty()); - Assert.assertTrue( - providerService.findCustomEventsProviderByInstanceId(idNotToBeFound).isEmpty()); +// Assert.assertTrue(providerService.findProviderById(idNotToBeFound).isEmpty()); + //Assert.assertTrue(providerService.getEventMetadata(idNotToBeFound).isEmpty()); + //Assert.assertTrue(providerService.findCustomEventsProviderByInstanceId(idNotToBeFound).isEmpty()); } @Test @@ -169,7 +168,7 @@ public void createGetUpdateDelete() { logger.info("Found AIO Events Provider `{}` by InstanceId", providerById); providerService.deleteEventMetadata(providerId, TEST_EVENT_CODE); - Assert.assertTrue(providerService.getEventMetadata(providerId, TEST_EVENT_CODE).isEmpty()); + Assert.assertFalse(providerService.getEventMetadata(providerId, TEST_EVENT_CODE).isPresent()); Assert.assertTrue(providerService.getEventMetadata(providerId).isEmpty()); logger.info("Deleted EventMetadata {} from AIO Events Provider `{}`", TEST_EVENT_CODE, providerById); diff --git a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignRegistrationServiceIntegrationTest.java b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignRegistrationServiceIntegrationTest.java index 6256fec1..804fff98 100644 --- a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignRegistrationServiceIntegrationTest.java +++ b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignRegistrationServiceIntegrationTest.java @@ -86,7 +86,7 @@ public static Registration createRegistration(RegistrationService registrationSe public static void deleteRegistration(RegistrationService registrationService, String registrationId) { registrationService.delete(registrationId); - Assert.assertTrue(registrationService.findById(registrationId).isEmpty()); + Assert.assertFalse(registrationService.findById(registrationId).isPresent()); logger.info("Deleted AIO Event Registration: {}", registrationId); } @@ -121,7 +121,7 @@ public void missingWorkspace() { @Test public void getNotFound() { String idNotToBeFound = "this_id_should_not_exist"; - Assert.assertTrue(registrationService.findById(idNotToBeFound).isEmpty()); + Assert.assertFalse(registrationService.findById(idNotToBeFound).isPresent()); } @Test diff --git a/ims/src/main/java/com/adobe/aio/ims/util/KeyStoreUtil.java b/ims/src/main/java/com/adobe/aio/ims/util/KeyStoreUtil.java index ec6d54ee..85e6a346 100644 --- a/ims/src/main/java/com/adobe/aio/ims/util/KeyStoreUtil.java +++ b/ims/src/main/java/com/adobe/aio/ims/util/KeyStoreUtil.java @@ -18,6 +18,7 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.security.KeyFactory; import java.security.KeyStore; import java.security.KeyStoreException; @@ -55,7 +56,7 @@ public static PrivateKey getPrivateKeyFromEncodedPkcs8(String base64EncodedPkcs8 public static PrivateKey getPrivateKeyFromPkcs8File(String filePath) throws IOException, InvalidKeySpecException, NoSuchAlgorithmException { - return getPrivateKeyFromPkcs8(Files.readAllBytes(Path.of(filePath))); + return getPrivateKeyFromPkcs8(Files.readAllBytes(Paths.get(filePath))); } private static PrivateKey getPrivateKeyFromPkcs8(byte[] pkcs8) diff --git a/pom.xml b/pom.xml index 86c4ec13..633a2f4c 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ 11.2 3.8.0 - 0.92.5 + 0.92.7-SNAPSHOT @@ -367,8 +367,8 @@ maven-compiler-plugin 3.10.1 - 11 - 11 + 1.8 + 1.8 @@ -425,7 +425,7 @@ maven-javadoc-plugin 3.3.2 - 11 + 1.8 true true Adobe I/O - Java SDK API v${project.version} From da1cf54c0f9e683b506520cc94d3b828ef839e01 Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 26 Oct 2022 17:47:02 +0530 Subject: [PATCH 02/12] fixed missing migration --- .../feign/FeignProviderServiceIntegrationTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java index 0ac41920..171d31d1 100644 --- a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java +++ b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java @@ -125,9 +125,9 @@ public void invalidFindByArg() { @Test public void getNotFound() { String idNotToBeFound = "this_id_should_not_exist"; -// Assert.assertTrue(providerService.findProviderById(idNotToBeFound).isEmpty()); - //Assert.assertTrue(providerService.getEventMetadata(idNotToBeFound).isEmpty()); - //Assert.assertTrue(providerService.findCustomEventsProviderByInstanceId(idNotToBeFound).isEmpty()); + Assert.assertFalse(providerService.findProviderById(idNotToBeFound).isPresent()); + Assert.assertTrue(providerService.getEventMetadata(idNotToBeFound).isEmpty()); + Assert.assertFalse(providerService.findCustomEventsProviderByInstanceId(idNotToBeFound).isPresent()); } @Test From 7b00d1370f1ab5c20287d3f670b636d2e55296dd Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 26 Oct 2022 17:54:48 +0530 Subject: [PATCH 03/12] added one more missing migration statement --- .../management/feign/FeignProviderServiceIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java index 171d31d1..2854cad9 100644 --- a/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java +++ b/events_journal/src/test/java/com/adobe/aio/event/management/feign/FeignProviderServiceIntegrationTest.java @@ -90,7 +90,7 @@ public static void deleteProvider(ProviderService providerService, String provid providerService.deleteProvider(providerId); logger.info("Deleted AIO Events Provider: {}", providerId); Optional deleted = providerService.findProviderById(providerId); -// Assert.assertTrue(deleted.isEmpty()); + Assert.assertFalse(deleted.isPresent()); logger.info("No more AIO Events Provider with id: {}", providerId); } From 1e047417f5baff515b7f27254f04d2ce23432267 Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 9 Nov 2022 11:14:15 +0530 Subject: [PATCH 04/12] removed the miss in conflict resolution --- core/src/test/java/com/adobe/aio/util/FileUtilTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/com/adobe/aio/util/FileUtilTest.java b/core/src/test/java/com/adobe/aio/util/FileUtilTest.java index e77ddb84..7d91cc96 100644 --- a/core/src/test/java/com/adobe/aio/util/FileUtilTest.java +++ b/core/src/test/java/com/adobe/aio/util/FileUtilTest.java @@ -41,7 +41,7 @@ public void testGetMapFromProperties() { } @Test - public void testReadPropertiesFromFile() throws Exception { + public void testReadPropertiesFromFile() { Assert.assertFalse(FileUtil.readPropertiesFromFile("").isPresent()); Assert.assertFalse(FileUtil.readPropertiesFromFile(null).isPresent()); } From 511b6d30bc8ddec1377422dc49fee9daa1caeaf7 Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 9 Nov 2022 11:20:12 +0530 Subject: [PATCH 05/12] fixed more failing tests on java8 --- .../adobe/aio/event/management/ProviderServiceTester.java | 6 ++++-- .../aio/event/management/RegistrationServiceTester.java | 2 +- .../event/management/ProviderServiceIntegrationTest.java | 8 ++++---- .../management/RegistrationServiceIntegrationTest.java | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java b/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java index 6d680ec5..1d948361 100644 --- a/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java +++ b/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java @@ -17,6 +17,8 @@ import com.adobe.aio.event.publish.model.CloudEvent; import com.adobe.aio.util.WorkspaceUtil; import com.adobe.aio.workspace.Workspace; + +import java.util.Collections; import java.util.Optional; import java.util.Set; import java.util.function.Supplier; @@ -59,7 +61,7 @@ public ProviderService getProviderService(){ public Provider createOrUpdateProvider(String providerLabel, String eventCode) { return createOrUpdateProvider(getTestProviderInputModelBuilder(providerLabel).build(), - Set.of(getTestEventMetadataBuilder(eventCode).build())); + Collections.singleton(getTestEventMetadataBuilder(eventCode).build())); } public Provider createOrUpdateProvider(ProviderInputModel providerInputModel, @@ -112,7 +114,7 @@ public void deleteProvider(String providerId) { providerService.deleteProvider(providerId); logger.info("Deleted AIO Events Provider: {}", providerId); Optional deleted = providerService.findProviderById(providerId); - Assert.assertTrue(deleted.isEmpty()); + Assert.assertFalse(deleted.isPresent()); logger.info("No more AIO Events Provider with id: {}", providerId); } diff --git a/events_test/src/main/java/com/adobe/aio/event/management/RegistrationServiceTester.java b/events_test/src/main/java/com/adobe/aio/event/management/RegistrationServiceTester.java index f9419b11..ba16973e 100644 --- a/events_test/src/main/java/com/adobe/aio/event/management/RegistrationServiceTester.java +++ b/events_test/src/main/java/com/adobe/aio/event/management/RegistrationServiceTester.java @@ -91,7 +91,7 @@ public Registration createRegistration( public void deleteRegistration(String registrationId) { registrationService.delete(registrationId); - Assert.assertTrue(registrationService.findById(registrationId).isEmpty()); + Assert.assertFalse(registrationService.findById(registrationId).isPresent()); logger.info("Deleted AIO Event Registration: {}", registrationId); } diff --git a/events_test/src/test/java/com/adobe/aio/event/management/ProviderServiceIntegrationTest.java b/events_test/src/test/java/com/adobe/aio/event/management/ProviderServiceIntegrationTest.java index 2a489045..2b04c9b7 100644 --- a/events_test/src/test/java/com/adobe/aio/event/management/ProviderServiceIntegrationTest.java +++ b/events_test/src/test/java/com/adobe/aio/event/management/ProviderServiceIntegrationTest.java @@ -54,10 +54,10 @@ public void invalidFindByArg() { @Test public void getNotFound() { String idNotToBeFound = "this_id_should_not_exist"; - Assert.assertTrue(providerService.findProviderById(idNotToBeFound).isEmpty()); + Assert.assertFalse(providerService.findProviderById(idNotToBeFound).isPresent()); Assert.assertTrue(providerService.getEventMetadata(idNotToBeFound).isEmpty()); - Assert.assertTrue( - providerService.findCustomEventsProviderByInstanceId(idNotToBeFound).isEmpty()); + Assert.assertFalse( + providerService.findCustomEventsProviderByInstanceId(idNotToBeFound).isPresent()); } @Test @@ -100,7 +100,7 @@ public void createGetUpdateDelete() { logger.info("Found AIO Events Provider `{}` by InstanceId", providerById); providerService.deleteEventMetadata(providerId, TEST_EVENT_CODE); - Assert.assertTrue(providerService.getEventMetadata(providerId, TEST_EVENT_CODE).isEmpty()); + Assert.assertFalse(providerService.getEventMetadata(providerId, TEST_EVENT_CODE).isPresent()); Assert.assertTrue(providerService.getEventMetadata(providerId).isEmpty()); logger.info("Deleted EventMetadata {} from AIO Events Provider `{}`", TEST_EVENT_CODE, providerById); diff --git a/events_test/src/test/java/com/adobe/aio/event/management/RegistrationServiceIntegrationTest.java b/events_test/src/test/java/com/adobe/aio/event/management/RegistrationServiceIntegrationTest.java index 0ed4583d..004e4117 100644 --- a/events_test/src/test/java/com/adobe/aio/event/management/RegistrationServiceIntegrationTest.java +++ b/events_test/src/test/java/com/adobe/aio/event/management/RegistrationServiceIntegrationTest.java @@ -40,7 +40,7 @@ public void missingWorkspace() { @Test public void getNotFound() { String idNotToBeFound = "this_id_should_not_exist"; - Assert.assertTrue(registrationService.findById(idNotToBeFound).isEmpty()); + Assert.assertFalse(registrationService.findById(idNotToBeFound).isPresent()); } @Test From 19e29b8ab9267bb9ce025d3ea93f15d35ce5453f Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Fri, 11 Nov 2022 16:18:51 +0530 Subject: [PATCH 06/12] wip: added java8 as a separate profile --- .gitignore | 1 + aem/aio_aem_events/pom.xml | 5 +++ aem/core_aem/pom.xml | 2 ++ aem/events_ingress_aem/pom.xml | 4 +++ aem/events_mgmt_aem/pom.xml | 2 ++ aem/events_osgi_mapping/pom.xml | 6 ++++ aem/lib_osgi/pom.xml | 7 ++++ events_ingress/pom.xml | 2 ++ events_journal/pom.xml | 4 +++ events_mgmt/pom.xml | 2 ++ events_test/pom.xml | 5 +++ ims/pom.xml | 1 + pom.xml | 61 ++++++++++++++++++++++++++++++--- 13 files changed, 98 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 538a39c7..320b8171 100644 --- a/.gitignore +++ b/.gitignore @@ -105,3 +105,4 @@ slingInstall.sh secrets */docs */*/docs +.DS_Store diff --git a/aem/aio_aem_events/pom.xml b/aem/aio_aem_events/pom.xml index 051dd390..dd527777 100644 --- a/aem/aio_aem_events/pom.xml +++ b/aem/aio_aem_events/pom.xml @@ -174,26 +174,31 @@ com.adobe.aio.aem aio-aem-events-osgi-mapping ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-aem-events-publish ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-aem-events-mgmt ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-aem-core ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-lib-osgi ${project.version} + ${java.version.classifier} diff --git a/aem/core_aem/pom.xml b/aem/core_aem/pom.xml index 71e906e4..c278f23a 100644 --- a/aem/core_aem/pom.xml +++ b/aem/core_aem/pom.xml @@ -31,12 +31,14 @@ com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} provided com.adobe.aio aio-lib-java-ims ${project.version} + ${java.version.classifier} provided diff --git a/aem/events_ingress_aem/pom.xml b/aem/events_ingress_aem/pom.xml index ba794954..800b9e80 100644 --- a/aem/events_ingress_aem/pom.xml +++ b/aem/events_ingress_aem/pom.xml @@ -32,24 +32,28 @@ aio-aem-core provided ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-aem-events-mgmt provided ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt provided ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-ingress provided ${project.version} + ${java.version.classifier} diff --git a/aem/events_mgmt_aem/pom.xml b/aem/events_mgmt_aem/pom.xml index 555084c6..86b9400c 100644 --- a/aem/events_mgmt_aem/pom.xml +++ b/aem/events_mgmt_aem/pom.xml @@ -32,12 +32,14 @@ aio-aem-core provided ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt provided ${project.version} + ${java.version.classifier} diff --git a/aem/events_osgi_mapping/pom.xml b/aem/events_osgi_mapping/pom.xml index 3452fb60..52050d25 100644 --- a/aem/events_osgi_mapping/pom.xml +++ b/aem/events_osgi_mapping/pom.xml @@ -32,18 +32,21 @@ aio-aem-core provided ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-aem-events-mgmt provided ${project.version} + ${java.version.classifier} com.adobe.aio.aem aio-aem-events-publish provided ${project.version} + ${java.version.classifier} @@ -51,11 +54,14 @@ com.adobe.aio provided ${project.version} + ${java.version.classifier} xdm-event-model com.adobe.event + ${xdm.event-model.version} + ${java.version.classifier} provided diff --git a/aem/lib_osgi/pom.xml b/aem/lib_osgi/pom.xml index 852f51d9..4137bd37 100644 --- a/aem/lib_osgi/pom.xml +++ b/aem/lib_osgi/pom.xml @@ -34,32 +34,39 @@ com.adobe.event xdm-event-model + ${xdm.event-model.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-ims ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-ingress ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-journal ${project.version} + ${java.version.classifier} diff --git a/events_ingress/pom.xml b/events_ingress/pom.xml index 10d9e2f9..ea62b248 100644 --- a/events_ingress/pom.xml +++ b/events_ingress/pom.xml @@ -32,6 +32,7 @@ com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} @@ -47,6 +48,7 @@ com.adobe.aio aio-lib-java-ims ${project.version} + ${java.version.classifier} diff --git a/events_journal/pom.xml b/events_journal/pom.xml index 5d76aa70..5ccb10a6 100644 --- a/events_journal/pom.xml +++ b/events_journal/pom.xml @@ -32,6 +32,7 @@ com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} @@ -39,12 +40,14 @@ com.adobe.aio aio-lib-java-events-mgmt ${project.version} + ${java.version.classifier} test com.adobe.aio aio-lib-java-events-ingress ${project.version} + ${java.version.classifier} test @@ -64,6 +67,7 @@ com.adobe.aio aio-lib-java-ims ${project.version} + ${java.version.classifier} diff --git a/events_mgmt/pom.xml b/events_mgmt/pom.xml index 85aa3642..04f1c228 100644 --- a/events_mgmt/pom.xml +++ b/events_mgmt/pom.xml @@ -32,6 +32,7 @@ com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} @@ -47,6 +48,7 @@ com.adobe.aio aio-lib-java-ims ${project.version} + ${java.version.classifier} diff --git a/events_test/pom.xml b/events_test/pom.xml index 0a7c3a2c..7595702f 100644 --- a/events_test/pom.xml +++ b/events_test/pom.xml @@ -32,26 +32,31 @@ com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-ims ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-ingress ${project.version} + ${java.version.classifier} com.adobe.aio aio-lib-java-events-journal ${project.version} + ${java.version.classifier} diff --git a/ims/pom.xml b/ims/pom.xml index 016db8ae..94ac134d 100644 --- a/ims/pom.xml +++ b/ims/pom.xml @@ -32,6 +32,7 @@ com.adobe.aio aio-lib-java-core ${project.version} + ${java.version.classifier} diff --git a/pom.xml b/pom.xml index 7bfd56be..3cb56052 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,8 @@ 11.2 3.8.0 - 0.92.7-SNAPSHOT + 0.92.6-SNAPSHOT + @@ -121,6 +122,7 @@ com.adobe.event xdm-event-model ${xdm.event-model.version} + ${java.version.classifier} provided @@ -369,8 +371,8 @@ maven-compiler-plugin 3.10.1 - 1.8 - 1.8 + 11 + 11 @@ -427,7 +429,7 @@ maven-javadoc-plugin 3.3.2 - 1.8 + 11 true true Adobe I/O - Java SDK API v${project.version} @@ -662,6 +664,57 @@ + + java8 + + false + + + java8 + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + ${java.version.classifier} + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.3.2 + + 1.8 + true + true + Adobe I/O - Java SDK API v${project.version} + Adobe I/O - Java SDK API v${project.version} + + *.impl, + *.internal, + *.internal.*, + *.api, + *.feign, + *.feign.* + + + + + + From 20604ad69c07c0d7a8996b9a265fb92b7ac735f4 Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 16 Nov 2022 15:40:52 +0530 Subject: [PATCH 07/12] Revert "wip: added java8 as a separate profile" This reverts commit 19e29b8ab9267bb9ce025d3ea93f15d35ce5453f. --- .gitignore | 1 - aem/aio_aem_events/pom.xml | 5 --- aem/core_aem/pom.xml | 2 -- aem/events_ingress_aem/pom.xml | 4 --- aem/events_mgmt_aem/pom.xml | 2 -- aem/events_osgi_mapping/pom.xml | 6 ---- aem/lib_osgi/pom.xml | 7 ---- events_ingress/pom.xml | 2 -- events_journal/pom.xml | 4 --- events_mgmt/pom.xml | 2 -- events_test/pom.xml | 5 --- ims/pom.xml | 1 - pom.xml | 61 +++------------------------------ 13 files changed, 4 insertions(+), 98 deletions(-) diff --git a/.gitignore b/.gitignore index 320b8171..538a39c7 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,3 @@ slingInstall.sh secrets */docs */*/docs -.DS_Store diff --git a/aem/aio_aem_events/pom.xml b/aem/aio_aem_events/pom.xml index dd527777..051dd390 100644 --- a/aem/aio_aem_events/pom.xml +++ b/aem/aio_aem_events/pom.xml @@ -174,31 +174,26 @@ com.adobe.aio.aem aio-aem-events-osgi-mapping ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-aem-events-publish ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-aem-events-mgmt ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-aem-core ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-lib-osgi ${project.version} - ${java.version.classifier} diff --git a/aem/core_aem/pom.xml b/aem/core_aem/pom.xml index c278f23a..71e906e4 100644 --- a/aem/core_aem/pom.xml +++ b/aem/core_aem/pom.xml @@ -31,14 +31,12 @@ com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} provided com.adobe.aio aio-lib-java-ims ${project.version} - ${java.version.classifier} provided diff --git a/aem/events_ingress_aem/pom.xml b/aem/events_ingress_aem/pom.xml index 800b9e80..ba794954 100644 --- a/aem/events_ingress_aem/pom.xml +++ b/aem/events_ingress_aem/pom.xml @@ -32,28 +32,24 @@ aio-aem-core provided ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-aem-events-mgmt provided ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt provided ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-ingress provided ${project.version} - ${java.version.classifier} diff --git a/aem/events_mgmt_aem/pom.xml b/aem/events_mgmt_aem/pom.xml index 86b9400c..555084c6 100644 --- a/aem/events_mgmt_aem/pom.xml +++ b/aem/events_mgmt_aem/pom.xml @@ -32,14 +32,12 @@ aio-aem-core provided ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt provided ${project.version} - ${java.version.classifier} diff --git a/aem/events_osgi_mapping/pom.xml b/aem/events_osgi_mapping/pom.xml index 52050d25..3452fb60 100644 --- a/aem/events_osgi_mapping/pom.xml +++ b/aem/events_osgi_mapping/pom.xml @@ -32,21 +32,18 @@ aio-aem-core provided ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-aem-events-mgmt provided ${project.version} - ${java.version.classifier} com.adobe.aio.aem aio-aem-events-publish provided ${project.version} - ${java.version.classifier} @@ -54,14 +51,11 @@ com.adobe.aio provided ${project.version} - ${java.version.classifier} xdm-event-model com.adobe.event - ${xdm.event-model.version} - ${java.version.classifier} provided diff --git a/aem/lib_osgi/pom.xml b/aem/lib_osgi/pom.xml index 4137bd37..852f51d9 100644 --- a/aem/lib_osgi/pom.xml +++ b/aem/lib_osgi/pom.xml @@ -34,39 +34,32 @@ com.adobe.event xdm-event-model - ${xdm.event-model.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-ims ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-ingress ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-journal ${project.version} - ${java.version.classifier} diff --git a/events_ingress/pom.xml b/events_ingress/pom.xml index ea62b248..10d9e2f9 100644 --- a/events_ingress/pom.xml +++ b/events_ingress/pom.xml @@ -32,7 +32,6 @@ com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} @@ -48,7 +47,6 @@ com.adobe.aio aio-lib-java-ims ${project.version} - ${java.version.classifier} diff --git a/events_journal/pom.xml b/events_journal/pom.xml index 5ccb10a6..5d76aa70 100644 --- a/events_journal/pom.xml +++ b/events_journal/pom.xml @@ -32,7 +32,6 @@ com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} @@ -40,14 +39,12 @@ com.adobe.aio aio-lib-java-events-mgmt ${project.version} - ${java.version.classifier} test com.adobe.aio aio-lib-java-events-ingress ${project.version} - ${java.version.classifier} test @@ -67,7 +64,6 @@ com.adobe.aio aio-lib-java-ims ${project.version} - ${java.version.classifier} diff --git a/events_mgmt/pom.xml b/events_mgmt/pom.xml index 04f1c228..85aa3642 100644 --- a/events_mgmt/pom.xml +++ b/events_mgmt/pom.xml @@ -32,7 +32,6 @@ com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} @@ -48,7 +47,6 @@ com.adobe.aio aio-lib-java-ims ${project.version} - ${java.version.classifier} diff --git a/events_test/pom.xml b/events_test/pom.xml index 7595702f..0a7c3a2c 100644 --- a/events_test/pom.xml +++ b/events_test/pom.xml @@ -32,31 +32,26 @@ com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-ims ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-mgmt ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-ingress ${project.version} - ${java.version.classifier} com.adobe.aio aio-lib-java-events-journal ${project.version} - ${java.version.classifier} diff --git a/ims/pom.xml b/ims/pom.xml index 94ac134d..016db8ae 100644 --- a/ims/pom.xml +++ b/ims/pom.xml @@ -32,7 +32,6 @@ com.adobe.aio aio-lib-java-core ${project.version} - ${java.version.classifier} diff --git a/pom.xml b/pom.xml index 3cb56052..7bfd56be 100644 --- a/pom.xml +++ b/pom.xml @@ -110,8 +110,7 @@ 11.2 3.8.0 - 0.92.6-SNAPSHOT - + 0.92.7-SNAPSHOT @@ -122,7 +121,6 @@ com.adobe.event xdm-event-model ${xdm.event-model.version} - ${java.version.classifier} provided @@ -371,8 +369,8 @@ maven-compiler-plugin 3.10.1 - 11 - 11 + 1.8 + 1.8 @@ -429,7 +427,7 @@ maven-javadoc-plugin 3.3.2 - 11 + 1.8 true true Adobe I/O - Java SDK API v${project.version} @@ -664,57 +662,6 @@ - - java8 - - false - - - java8 - - - - - - - org.apache.maven.plugins - maven-jar-plugin - 3.2.0 - - ${java.version.classifier} - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.3.2 - - 1.8 - true - true - Adobe I/O - Java SDK API v${project.version} - Adobe I/O - Java SDK API v${project.version} - - *.impl, - *.internal, - *.internal.*, - *.api, - *.feign, - *.feign.* - - - - - - From ebf2824bf91667a4ad225635711c380ecff7dd50 Mon Sep 17 00:00:00 2001 From: Pulkit Gupta Date: Wed, 16 Nov 2022 15:52:02 +0530 Subject: [PATCH 08/12] fixed the dependency of xdm event model --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7bfd56be..f52362bb 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ 11.2 3.8.0 - 0.92.7-SNAPSHOT + 0.92.6-SNAPSHOT From 51ffc5eeb782fb6b6a9e9da86be70f0d8d39d3b3 Mon Sep 17 00:00:00 2001 From: Francois Le Droff Date: Tue, 22 Nov 2022 16:37:02 +0100 Subject: [PATCH 09/12] GH-21 migrating `com.adobe.event:xdm-event-model` as a new module of this repo and renaming it to `com.adobe.aio:aio-lib-java-events-xdm` --- aem/events_osgi_mapping/pom.xml | 7 +- aem/lib_osgi/pom.xml | 12 +- events_xdm/pom.xml | 67 ++++ .../src/main/java/com/adobe/xdm/Xdm.java | 24 ++ .../main/java/com/adobe/xdm/XdmObject.java | 78 ++++ .../main/java/com/adobe/xdm/assets/Asset.java | 134 +++++++ .../java/com/adobe/xdm/common/XdmContext.java | 160 ++++++++ .../java/com/adobe/xdm/common/XdmEvent.java | 157 ++++++++ .../adobe/xdm/content/ContentRepository.java | 50 +++ .../main/java/com/adobe/xdm/content/Page.java | 96 +++++ .../adobe/xdm/event/AemAssetCreatedEvent.java | 28 ++ .../adobe/xdm/event/AemAssetDeletedEvent.java | 29 ++ .../com/adobe/xdm/event/AemAssetEvent.java | 32 ++ .../adobe/xdm/event/AemAssetUpdatedEvent.java | 28 ++ .../com/adobe/xdm/event/AemPageEvent.java | 31 ++ .../xdm/event/AemPagePublishedEvent.java | 28 ++ .../xdm/event/AemPageUnpublishedEvent.java | 28 ++ .../adobe/xdm/event/CCAssetCreatedEvent.java | 28 ++ .../adobe/xdm/event/CCAssetDeletedEvent.java | 29 ++ .../com/adobe/xdm/event/CCAssetEvent.java | 31 ++ .../adobe/xdm/event/CCAssetUpdatedEvent.java | 28 ++ .../xdm/event/CCDirectoryCreatedEvent.java | 22 ++ .../com/adobe/xdm/event/CCDirectoryEvent.java | 24 ++ .../com/adobe/xdm/event/OsgiEmittedEvent.java | 36 ++ .../com/adobe/xdm/extensions/aem/AemUser.java | 49 +++ .../adobe/xdm/extensions/aem/OsgiEvent.java | 90 +++++ .../com/adobe/xdm/extensions/ims/ImsOrg.java | 50 +++ .../com/adobe/xdm/extensions/ims/ImsUser.java | 49 +++ .../adobe/xdm/external/repo/Directory.java | 129 +++++++ .../src/main/json-ld/activitystreams.jsonld | 364 ++++++++++++++++++ .../java/com/adobe/xdm/event/JsonUtils.java | 39 ++ .../adobe/xdm/event/SerializationTest.java | 279 ++++++++++++++ .../resources/asset_created_aem_sample.json | 38 ++ .../resources/asset_created_cc_sample.json | 34 ++ .../resources/asset_deleted_aem_sample.json | 31 ++ .../resources/asset_deleted_cc_sample.json | 30 ++ .../resources/asset_updated_aem_sample.json | 36 ++ .../resources/asset_updated_cc_sample.json | 34 ++ .../custom_osgi_emitted_aem_sample.json | 33 ++ .../directory_created_cc_sample.json | 34 ++ .../src/test/resources/log4j.properties | 17 + .../resources/page_published_aem_sample.json | 33 ++ .../page_unpublished_aem_sample.json | 33 ++ .../src/test/resources/xdm_context.json | 27 ++ pom.xml | 15 +- 45 files changed, 2612 insertions(+), 19 deletions(-) create mode 100644 events_xdm/pom.xml create mode 100644 events_xdm/src/main/java/com/adobe/xdm/Xdm.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/XdmObject.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/assets/Asset.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/common/XdmContext.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/common/XdmEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/content/ContentRepository.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/content/Page.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemAssetCreatedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemAssetDeletedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemAssetEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemAssetUpdatedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemPageEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemPagePublishedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/AemPageUnpublishedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/CCAssetCreatedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/CCAssetDeletedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/CCAssetEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/CCAssetUpdatedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryCreatedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/event/OsgiEmittedEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/extensions/aem/AemUser.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/extensions/aem/OsgiEvent.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsOrg.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsUser.java create mode 100644 events_xdm/src/main/java/com/adobe/xdm/external/repo/Directory.java create mode 100644 events_xdm/src/main/json-ld/activitystreams.jsonld create mode 100644 events_xdm/src/test/java/com/adobe/xdm/event/JsonUtils.java create mode 100644 events_xdm/src/test/java/com/adobe/xdm/event/SerializationTest.java create mode 100644 events_xdm/src/test/resources/asset_created_aem_sample.json create mode 100644 events_xdm/src/test/resources/asset_created_cc_sample.json create mode 100644 events_xdm/src/test/resources/asset_deleted_aem_sample.json create mode 100644 events_xdm/src/test/resources/asset_deleted_cc_sample.json create mode 100644 events_xdm/src/test/resources/asset_updated_aem_sample.json create mode 100644 events_xdm/src/test/resources/asset_updated_cc_sample.json create mode 100644 events_xdm/src/test/resources/custom_osgi_emitted_aem_sample.json create mode 100644 events_xdm/src/test/resources/directory_created_cc_sample.json create mode 100644 events_xdm/src/test/resources/log4j.properties create mode 100644 events_xdm/src/test/resources/page_published_aem_sample.json create mode 100644 events_xdm/src/test/resources/page_unpublished_aem_sample.json create mode 100644 events_xdm/src/test/resources/xdm_context.json diff --git a/aem/events_osgi_mapping/pom.xml b/aem/events_osgi_mapping/pom.xml index 3452fb60..2aea6c7b 100644 --- a/aem/events_osgi_mapping/pom.xml +++ b/aem/events_osgi_mapping/pom.xml @@ -52,13 +52,14 @@ provided ${project.version} - - xdm-event-model - com.adobe.event + com.adobe.aio + aio-lib-java-events-xdm provided + ${project.version} + junit-dep diff --git a/aem/lib_osgi/pom.xml b/aem/lib_osgi/pom.xml index 852f51d9..8c4909f9 100644 --- a/aem/lib_osgi/pom.xml +++ b/aem/lib_osgi/pom.xml @@ -26,16 +26,12 @@ Adobe I/O - Java SDK - OSGI bundle - - javax.validation - validation-api - 2.0.1.Final - + - com.adobe.event - xdm-event-model + com.adobe.aio + aio-lib-java-events-xdm + ${project.version} - com.adobe.aio aio-lib-java-ims diff --git a/events_xdm/pom.xml b/events_xdm/pom.xml new file mode 100644 index 00000000..a484456c --- /dev/null +++ b/events_xdm/pom.xml @@ -0,0 +1,67 @@ + + + + + + com.adobe.aio + aio-lib-java + 0.1.5-SNAPSHOT + ../pom.xml + + 4.0.0 + + aio-lib-java-events-xdm + Adobe I/O - XDM Event Model + Adobe I/O - Java SDK - (Jackson based) Implementation of the Adobe XDM Event Model + + + + com.fasterxml.jackson.core + jackson-annotations + provided + + + + com.fasterxml.jackson.core + jackson-databind + test + + + junit + junit-dep + test + + + org.slf4j + slf4j-simple + test + + + org.hamcrest + hamcrest-all + 1.3 + test + + + com.jayway.jsonpath + json-path-assert + 0.9.1 + test + + + + + + diff --git a/events_xdm/src/main/java/com/adobe/xdm/Xdm.java b/events_xdm/src/main/java/com/adobe/xdm/Xdm.java new file mode 100644 index 00000000..2b010d58 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/Xdm.java @@ -0,0 +1,24 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Xdm { + + @JsonProperty("@context") + public XdmContext getXdmContext() { + return new XdmContext(); + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/XdmObject.java b/events_xdm/src/main/java/com/adobe/xdm/XdmObject.java new file mode 100644 index 00000000..0817e2ce --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/XdmObject.java @@ -0,0 +1,78 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * ActivityStreams Object + */ +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class XdmObject { + + protected String id; + protected String type; + + @JsonProperty("@id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @JsonProperty("@type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + XdmObject that = (XdmObject) o; + + if (id != null ? !id.equals(that.id) : that.id != null) { + return false; + } + return type != null ? type.equals(that.type) : that.type == null; + } + + @Override + public int hashCode() { + int result = id != null ? id.hashCode() : 0; + result = 31 * result + (type != null ? type.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "XdmObject{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/assets/Asset.java b/events_xdm/src/main/java/com/adobe/xdm/assets/Asset.java new file mode 100644 index 00000000..e6e16135 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/assets/Asset.java @@ -0,0 +1,134 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.assets; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Asset extends XdmObject { + + private String assetId; + + private String assetName; + + private String etag; + + private String path; + + private String format; + + + public Asset() { + super(); + this.type = XdmContext.XDM_ASSET_TYPE; + } + + @JsonProperty(XdmContext.XDM_ASSET_PREFIX + ":asset_id") + public String getAssetId() { + return this.assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + @JsonProperty(XdmContext.XDM_ASSET_PREFIX + ":asset_name") + public String getAssetName() { + return assetName; + } + + public void setAssetName(String assetName) { + this.assetName = assetName; + } + + @JsonProperty(XdmContext.XDM_ASSET_PREFIX + ":etag") + public String getEtag() { + return etag; + } + + public void setEtag(String etag) { + this.etag = etag; + } + + @JsonProperty(XdmContext.XDM_ASSET_PREFIX + ":path") + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + @JsonProperty(XdmContext.XDM_ASSET_PREFIX + ":format") + public String getFormat() { + return this.format; + } + + public void setFormat(String format) { + this.format = format; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + + Asset asset = (Asset) o; + + if (assetName != null ? !assetName.equals(asset.assetName) : asset.assetName != null) { + return false; + } + if (etag != null ? !etag.equals(asset.etag) : asset.etag != null) { + return false; + } + if (path != null ? !path.equals(asset.path) : asset.path != null) { + return false; + } + return format != null ? format.equals(asset.format) : asset.format == null; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (assetName != null ? assetName.hashCode() : 0); + result = 31 * result + (etag != null ? etag.hashCode() : 0); + result = 31 * result + (path != null ? path.hashCode() : 0); + result = 31 * result + (format != null ? format.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "Asset{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", assetId='" + assetId + '\'' + + ", assetName='" + assetName + '\'' + + ", etag='" + etag + '\'' + + ", path='" + path + '\'' + + ", format='" + format + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/common/XdmContext.java b/events_xdm/src/main/java/com/adobe/xdm/common/XdmContext.java new file mode 100644 index 00000000..85b563a1 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/common/XdmContext.java @@ -0,0 +1,160 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.common; + + +import com.fasterxml.jackson.annotation.JsonProperty; + +public class XdmContext { + + public static final String XDM_BASE_URL = "https://ns.adobe.com/xdm"; + public static final String XDM_EXTENSION_BASE_URL = "https://ns.adobe.com/xdm-extensions"; + + public static final String XDM_AEM_USER_TYPE = "xdmAemUser"; + public static final String XDM_AEM_USER_PREFIX = XDM_AEM_USER_TYPE; + public static final String XDM_AEM_USER_JSONLD_IRI = XDM_EXTENSION_BASE_URL + "/aem/user"; + + public static final String OSGI_EVENT_TYPE = "osgiEvent"; + public static final String OSGI_EVENT_PREFIX = OSGI_EVENT_TYPE; + public static final String OSGI_EVENT_JSONLD_IRI = "https://osgi.org/javadoc/r4v42/org/osgi/service/event/Event.html"; + + public static final String XDM_ASSET_TYPE = "xdmAsset"; + public static final String XDM_ASSET_PREFIX = XDM_ASSET_TYPE; + public static final String XDM_ASSET_JSONLD_IRI = XDM_BASE_URL + "/assets/asset#"; + + public static final String XDM_DIRECTORY_TYPE = "xdmDirectory"; + public static final String XDM_DIRECTORY_PREFIX = XDM_DIRECTORY_TYPE; + public static final String XDM_DIRECTORY_JSONLD_IRI = "https://ns.adobe.com/adobecloud/core/1.0/directory#"; + + public static final String XDM_IMS_ORG_TYPE = "xdmImsOrg"; + public static final String XDM_IMS_ORG_PREFIX = XDM_IMS_ORG_TYPE; + public static final String XDM_IMS_ORG_JSONLD_IRI = XDM_EXTENSION_BASE_URL + "/ims/organization#"; + + public static final String XDM_IMS_USER_TYPE = "xdmImsUser"; + public static final String XDM_IMS_USER_PREFIX = XDM_IMS_USER_TYPE; + public static final String XDM_IMS_USER_JSONLD_IRI = XDM_EXTENSION_BASE_URL + "/ims/user#"; + + public static final String XDM_CONTENT_REPOSITORY_TYPE = "xdmContentRepository"; + public static final String XDM_CONTENT_REPOSITORY_PREFIX = XDM_CONTENT_REPOSITORY_TYPE; + public static final String XDM_CONTENT_REPOSITORY_JSONLD_IRI = + XDM_BASE_URL + "/content/repository#"; + + public static final String XDM_COMPONENTIZED_PAGE_TYPE = "xdmComponentizedPage"; + public static final String XDM_COMPONENTIZED_PAGE_PREFIX = XDM_COMPONENTIZED_PAGE_TYPE; + public static final String XDM_COMPONENTIZED_PAGE_JSONLD_IRI = + XDM_BASE_URL + "/content/componentized-page#"; + + public static final String XDM_EVENT_CREATED_TYPE = "xdmCreated"; + public static final String XDM_EVENT_CREATED_JSONLD_IRI = XDM_BASE_URL + "/common/event/created#"; + public static final String XDM_EVENT_DELETED_TYPE = "xdmDeleted"; + public static final String XDM_EVENT_DELETED_JSONLD_IRI = XDM_BASE_URL + "/common/event/deleted#"; + public static final String XDM_EVENT_UPDATED_TYPE = "xdmUpdated"; + public static final String XDM_EVENT_UPDATED_JSONLD_IRI = XDM_BASE_URL + "/common/event/updated#"; + + public static final String XDM_EVENT_PUBLISHED_TYPE = "xdmPublished"; + public static final String XDM_EVENT_PUBLISHED_JSONLD_IRI = XDM_BASE_URL + "/common/event/published#"; + public static final String XDM_EVENT_UNPUBLISHED_TYPE = "xdmUnpublished"; + public static final String XDM_EVENT_UNPUBLISHED_JSONLD_IRI = XDM_BASE_URL + "/common/event/unpublished#"; + + public static final String XDM_EVENT_EMITTED_TYPE = "xdmEmitted"; + public static final String XDM_EVENT_EMITTED_TYPE_JSONLD_IRI = XDM_BASE_URL + "/common/event/emitted#"; + + + public static final String W3C_ACTIVITYSTREAMS_PREFIX = "activitystreams"; + public static final String W3C_ACTIVITYSTREAMS_JSONLD_IRI = "http://www.w3.org/ns/activitystreams#"; + + public static final String XDM_EVENT_ENVELOPE_PREFIX = "xdmEventEnvelope"; + public static final String XDM_EVENT_ENVELOPE_JSONLD_IRI = XDM_BASE_URL + "/event-envelope#"; + + public static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSX"; + + @JsonProperty(W3C_ACTIVITYSTREAMS_PREFIX) + public String getActivityStreamsIRI() { + return W3C_ACTIVITYSTREAMS_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_ENVELOPE_PREFIX) + public String getXdmEnvelopeIRI() { + return XDM_EVENT_ENVELOPE_JSONLD_IRI; + } + + @JsonProperty(XDM_COMPONENTIZED_PAGE_PREFIX) + public String getXdmComponentizedPageIRI() { + return XDM_COMPONENTIZED_PAGE_JSONLD_IRI; + } + + @JsonProperty(XDM_IMS_ORG_PREFIX) + public String getXdmImsOrgIRI() { + return XDM_IMS_ORG_JSONLD_IRI; + } + + @JsonProperty(XDM_CONTENT_REPOSITORY_PREFIX) + public String getXdmContentRepositoryIRI() { + return XDM_CONTENT_REPOSITORY_JSONLD_IRI; + } + + @JsonProperty(XDM_AEM_USER_PREFIX) + public String getXdmAemUserIRI() { + return XDM_AEM_USER_JSONLD_IRI; + } + + @JsonProperty(XDM_IMS_USER_PREFIX) + public String getXdmImsUserIRI() { + return XDM_IMS_USER_JSONLD_IRI; + } + + @JsonProperty(XDM_ASSET_PREFIX) + public String getXdmAssetIRI() { + return XDM_ASSET_JSONLD_IRI; + } + + @JsonProperty("xdmDirectory") + public String getXdmDirectoryIRI() { + return XDM_DIRECTORY_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_CREATED_TYPE) + public String getXdmCreatedIRI() { + return XDM_EVENT_CREATED_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_UPDATED_TYPE) + public String getXdmUpdatedIRI() { + return XDM_EVENT_UPDATED_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_DELETED_TYPE) + public String getXdmDeletedIRI() { + return XDM_EVENT_DELETED_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_PUBLISHED_TYPE) + public String getXdmPublishedIRI() { + return XDM_EVENT_PUBLISHED_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_UNPUBLISHED_TYPE) + public String getXdmUnpublishedIRI() { + return XDM_EVENT_UNPUBLISHED_JSONLD_IRI; + } + + @JsonProperty(XDM_EVENT_EMITTED_TYPE) + public String getXdmEmittedIRI() { + return XDM_EVENT_EMITTED_TYPE_JSONLD_IRI; + } + + @JsonProperty(OSGI_EVENT_TYPE) + public String getOsgiEventdIRI() { + return OSGI_EVENT_JSONLD_IRI; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/common/XdmEvent.java b/events_xdm/src/main/java/com/adobe/xdm/common/XdmEvent.java new file mode 100644 index 00000000..1ca2d69e --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/common/XdmEvent.java @@ -0,0 +1,157 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.common; + +import com.adobe.xdm.XdmObject; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class XdmEvent + { + + protected String id; + protected String type; + protected String published; + protected To to; + protected Ge generator; + protected Ac actor; + protected Ob object; + + @JsonProperty("@id") + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @JsonProperty("@type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @JsonProperty(XdmContext.XDM_EVENT_ENVELOPE_PREFIX + ":objectType") + public String getObjectType() { + return (object == null) ? null : object.getType(); + } + + @JsonProperty(XdmContext.W3C_ACTIVITYSTREAMS_PREFIX + ":published") + public String getPublished() { + return published; + } + + public void setPublished(String published) { + this.published = published; + } + + @JsonProperty(XdmContext.W3C_ACTIVITYSTREAMS_PREFIX + ":to") + public To getTo() { + return to; + } + + public void setTo(To to) { + this.to = to; + } + + @JsonProperty(XdmContext.W3C_ACTIVITYSTREAMS_PREFIX + ":actor") + public Ac getActor() { + return actor; + } + + public void setActor(Ac actor) { + this.actor = actor; + } + + @JsonProperty(XdmContext.W3C_ACTIVITYSTREAMS_PREFIX + ":generator") + public Ge getGenerator() { + return generator; + } + + public void setGenerator(Ge generator) { + this.generator = generator; + } + + @JsonProperty(XdmContext.W3C_ACTIVITYSTREAMS_PREFIX + ":object") + public Ob getObject() { + return object; + } + + public void setObject(Ob object) { + this.object = object; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || !this.getClass().isAssignableFrom(o.getClass())) { + return false; + } + + XdmEvent xdmEvent = (XdmEvent) o; + + if (id != null ? !id.equals(xdmEvent.id) : xdmEvent.id != null) { + return false; + } + if (type != null ? !type.equals(xdmEvent.type) : xdmEvent.type != null) { + return false; + } + if (published != null ? !published.equals(xdmEvent.published) : xdmEvent.published != null) { + return false; + } + if (to != null ? !to.equals(xdmEvent.to) : xdmEvent.to != null) { + return false; + } + if (generator != null ? !generator.equals(xdmEvent.generator) : xdmEvent.generator != null) { + return false; + } + if (actor != null ? !actor.equals(xdmEvent.actor) : xdmEvent.actor != null) { + return false; + } + return object != null ? object.equals(xdmEvent.object) : xdmEvent.object == null; + } + + @Override + public int hashCode() { + int result = id != null ? id.hashCode() : 0; + result = 31 * result + (type != null ? type.hashCode() : 0); + result = 31 * result + (published != null ? published.hashCode() : 0); + result = 31 * result + (to != null ? to.hashCode() : 0); + result = 31 * result + (generator != null ? generator.hashCode() : 0); + result = 31 * result + (actor != null ? actor.hashCode() : 0); + result = 31 * result + (object != null ? object.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "XdmEvent{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", published='" + published + '\'' + + ", to=" + to + + ", generator=" + generator + + ", actor=" + actor + + ", object=" + object + + '}'; + } +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/content/ContentRepository.java b/events_xdm/src/main/java/com/adobe/xdm/content/ContentRepository.java new file mode 100644 index 00000000..d74ee78f --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/content/ContentRepository.java @@ -0,0 +1,50 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.content; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ContentRepository extends XdmObject { + + protected String root; + + public ContentRepository() { + super(); + this.type = XdmContext.XDM_CONTENT_REPOSITORY_TYPE; + } + + @JsonProperty(XdmContext.XDM_CONTENT_REPOSITORY_PREFIX + ":root") + public String getRoot() { + return root; + } + + public void setRoot(String root) { + this.root = root; + } + + @Override + public String toString() { + return "ContentRepository{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", root='" + root + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/content/Page.java b/events_xdm/src/main/java/com/adobe/xdm/content/Page.java new file mode 100644 index 00000000..0a3c6423 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/content/Page.java @@ -0,0 +1,96 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.content; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class Page extends XdmObject { + + private String title; + private String path; + private String version; + + public Page() { + super(); + this.type = XdmContext.XDM_COMPONENTIZED_PAGE_TYPE; + } + + @JsonProperty(XdmContext.XDM_COMPONENTIZED_PAGE_PREFIX + ":title") + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + @JsonProperty(XdmContext.XDM_COMPONENTIZED_PAGE_PREFIX + ":path") + public String getPath() { + return path; + } + + public void setPath(String pathname) { + this.path = pathname; + } + + @JsonProperty(XdmContext.XDM_COMPONENTIZED_PAGE_PREFIX + ":version") + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + Page page = (Page) o; + return Objects.equals(id, page.id) && + Objects.equals(type, page.type) && + Objects.equals(title, page.title) && + Objects.equals(path, page.path) && + Objects.equals(version, page.version); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), id, type, title, path, version); + } + + @Override + public String toString() { + return "Page{" + + "title='" + title + '\'' + + ", path='" + path + '\'' + + ", version='" + version + '\'' + + ", id='" + id + '\'' + + ", type='" + type + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetCreatedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetCreatedEvent.java new file mode 100644 index 00000000..a3197a35 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetCreatedEvent.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemAssetCreatedEvent extends AemAssetEvent { + + public AemAssetCreatedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_CREATED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetDeletedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetDeletedEvent.java new file mode 100644 index 00000000..2cc0e997 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetDeletedEvent.java @@ -0,0 +1,29 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemAssetDeletedEvent extends AemAssetEvent { + + public AemAssetDeletedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_DELETED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetEvent.java new file mode 100644 index 00000000..aa7bf84a --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetEvent.java @@ -0,0 +1,32 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.assets.Asset; +import com.adobe.xdm.common.XdmEvent; +import com.adobe.xdm.content.ContentRepository; +import com.adobe.xdm.extensions.aem.AemUser; +import com.adobe.xdm.extensions.ims.ImsOrg; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemAssetEvent extends XdmEvent { + + public AemAssetEvent() { + super(); + this.object = new Asset(); + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetUpdatedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetUpdatedEvent.java new file mode 100644 index 00000000..2f7a7be3 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemAssetUpdatedEvent.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemAssetUpdatedEvent extends AemAssetEvent { + + public AemAssetUpdatedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_UPDATED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemPageEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemPageEvent.java new file mode 100644 index 00000000..1960d34b --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemPageEvent.java @@ -0,0 +1,31 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmEvent; +import com.adobe.xdm.content.ContentRepository; +import com.adobe.xdm.content.Page; +import com.adobe.xdm.extensions.aem.AemUser; +import com.adobe.xdm.extensions.ims.ImsOrg; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemPageEvent extends XdmEvent { + + public AemPageEvent() { + super(); + this.object = new Page(); + } +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemPagePublishedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemPagePublishedEvent.java new file mode 100644 index 00000000..8007ed13 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemPagePublishedEvent.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemPagePublishedEvent extends AemPageEvent { + + public AemPagePublishedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_PUBLISHED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/AemPageUnpublishedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/AemPageUnpublishedEvent.java new file mode 100644 index 00000000..4c9dd5da --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/AemPageUnpublishedEvent.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemPageUnpublishedEvent extends AemPageEvent { + + public AemPageUnpublishedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_UNPUBLISHED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetCreatedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetCreatedEvent.java new file mode 100644 index 00000000..f960be2f --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetCreatedEvent.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class CCAssetCreatedEvent extends CCAssetEvent { + + public CCAssetCreatedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_CREATED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetDeletedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetDeletedEvent.java new file mode 100644 index 00000000..6ffd2a7b --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetDeletedEvent.java @@ -0,0 +1,29 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class CCAssetDeletedEvent extends CCAssetEvent { + + public CCAssetDeletedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_DELETED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetEvent.java new file mode 100644 index 00000000..4714fc0a --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetEvent.java @@ -0,0 +1,31 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.assets.Asset; +import com.adobe.xdm.common.XdmEvent; +import com.adobe.xdm.content.ContentRepository; +import com.adobe.xdm.extensions.ims.ImsUser; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class CCAssetEvent extends XdmEvent { + + public CCAssetEvent() { + super(); + this.object = new Asset(); + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetUpdatedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetUpdatedEvent.java new file mode 100644 index 00000000..217a8a6d --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/CCAssetUpdatedEvent.java @@ -0,0 +1,28 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class CCAssetUpdatedEvent extends CCAssetEvent { + + public CCAssetUpdatedEvent() { + super(); + this.type = XdmContext.XDM_EVENT_UPDATED_TYPE; + } + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryCreatedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryCreatedEvent.java new file mode 100644 index 00000000..5e5fa9cf --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryCreatedEvent.java @@ -0,0 +1,22 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + + +import com.adobe.xdm.common.XdmContext; + +public class CCDirectoryCreatedEvent extends CCDirectoryEvent { + + public CCDirectoryCreatedEvent() { + this.type = XdmContext.XDM_EVENT_CREATED_TYPE; + } +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryEvent.java new file mode 100644 index 00000000..05c62af4 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/CCDirectoryEvent.java @@ -0,0 +1,24 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmEvent; +import com.adobe.xdm.content.ContentRepository; +import com.adobe.xdm.extensions.ims.ImsUser; +import com.adobe.xdm.external.repo.Directory; + +public class CCDirectoryEvent extends XdmEvent { + + public CCDirectoryEvent() { + this.object = new Directory(); + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/event/OsgiEmittedEvent.java b/events_xdm/src/main/java/com/adobe/xdm/event/OsgiEmittedEvent.java new file mode 100644 index 00000000..27827745 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/event/OsgiEmittedEvent.java @@ -0,0 +1,36 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.adobe.xdm.common.XdmContext; +import com.adobe.xdm.common.XdmEvent; +import com.adobe.xdm.content.ContentRepository; +import com.adobe.xdm.extensions.aem.AemUser; +import com.adobe.xdm.extensions.aem.OsgiEvent; +import com.adobe.xdm.extensions.ims.ImsOrg; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class OsgiEmittedEvent extends + XdmEvent { + + public OsgiEmittedEvent() { + super(); + this.object = new OsgiEvent(); + this.type = XdmContext.XDM_EVENT_EMITTED_TYPE; + } + + +} diff --git a/events_xdm/src/main/java/com/adobe/xdm/extensions/aem/AemUser.java b/events_xdm/src/main/java/com/adobe/xdm/extensions/aem/AemUser.java new file mode 100644 index 00000000..0e88f5ce --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/extensions/aem/AemUser.java @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.extensions.aem; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class AemUser extends XdmObject { + + private String aemUserId; + + public AemUser() { + super(); + this.type = XdmContext.XDM_AEM_USER_TYPE; + } + + @JsonProperty(XdmContext.XDM_AEM_USER_PREFIX + ":id") + public String getAemUserId() { + return this.aemUserId; + } + + public void setAemUserId(String aemUserId) { + this.aemUserId = aemUserId; + } + + @Override + public String toString() { + return "AemUser{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", aemUserId='" + aemUserId + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/extensions/aem/OsgiEvent.java b/events_xdm/src/main/java/com/adobe/xdm/extensions/aem/OsgiEvent.java new file mode 100644 index 00000000..0c6732ff --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/extensions/aem/OsgiEvent.java @@ -0,0 +1,90 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.extensions.aem; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Hashtable; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class OsgiEvent extends XdmObject { + + String topic; + Hashtable properties; + + public OsgiEvent() { + super(); + this.type = XdmContext.OSGI_EVENT_TYPE; + } + + @JsonProperty(XdmContext.OSGI_EVENT_PREFIX + ":topic") + public String getTopic() { + return topic; + } + + public void setTopic(String topic) { + this.topic = topic; + this.type = XdmContext.OSGI_EVENT_TYPE +":"+topic; + } + + @JsonProperty(XdmContext.OSGI_EVENT_PREFIX + ":properties") + public Hashtable getProperties() { + return properties; + } + + public void setProperties(Hashtable properties) { + this.properties = properties; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + + OsgiEvent that = (OsgiEvent) o; + + if (topic != null ? !topic.equals(that.topic) : that.topic != null) { + return false; + } + return properties != null ? properties.equals(that.properties) : that.properties == null; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (topic != null ? topic.hashCode() : 0); + result = 31 * result + (properties != null ? properties.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "OsgiEvent{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", topic='" + topic + '\'' + + ", properties=" + properties + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsOrg.java b/events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsOrg.java new file mode 100644 index 00000000..5fec2988 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsOrg.java @@ -0,0 +1,50 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.extensions.ims; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ImsOrg extends XdmObject { + + private String imsOrgId; + + public ImsOrg() { + super(); + this.type = XdmContext.XDM_IMS_ORG_TYPE; + } + + @JsonProperty(XdmContext.XDM_IMS_ORG_PREFIX + ":id") + public String getImsOrgId() { + return imsOrgId; + } + + + public void setImsOrgId(String imsOrgId) { + this.imsOrgId = imsOrgId; + } + + @Override + public String toString() { + return "ImsOrg{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", imsOrgId='" + imsOrgId + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsUser.java b/events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsUser.java new file mode 100644 index 00000000..da8414b9 --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/extensions/ims/ImsUser.java @@ -0,0 +1,49 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.extensions.ims; + +import com.adobe.xdm.XdmObject; +import com.adobe.xdm.common.XdmContext; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonInclude(Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +public class ImsUser extends XdmObject { + + private String imsUserId; + + public ImsUser() { + super(); + this.type = XdmContext.XDM_IMS_USER_TYPE; + } + + @JsonProperty(XdmContext.XDM_IMS_USER_PREFIX + ":id") + public String getImsUserId() { + return this.imsUserId; + } + + public void setImsUserId(String imsUserId) { + this.imsUserId = imsUserId; + } + + @Override + public String toString() { + return "ImsUser{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", imsUserId='" + imsUserId + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/events_xdm/src/main/java/com/adobe/xdm/external/repo/Directory.java b/events_xdm/src/main/java/com/adobe/xdm/external/repo/Directory.java new file mode 100644 index 00000000..4e3f046f --- /dev/null +++ b/events_xdm/src/main/java/com/adobe/xdm/external/repo/Directory.java @@ -0,0 +1,129 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.external.repo; + +import static com.adobe.xdm.common.XdmContext.XDM_DIRECTORY_PREFIX; +import static com.adobe.xdm.common.XdmContext.XDM_DIRECTORY_TYPE; + +import com.adobe.xdm.XdmObject; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class Directory extends XdmObject { + + private String assetId; + private String name; + private String path; + private String etag; + private String format; + + public Directory() { + this.type = XDM_DIRECTORY_TYPE; + } + + @JsonProperty(XDM_DIRECTORY_PREFIX + ":asset_id") + public String getAssetId() { + return assetId; + } + + public void setAssetId(String assetId) { + this.assetId = assetId; + } + + @JsonProperty(XDM_DIRECTORY_PREFIX + ":name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @JsonProperty(XDM_DIRECTORY_PREFIX + ":path") + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + @JsonProperty(XDM_DIRECTORY_PREFIX + ":etag") + public String getEtag() { + return etag; + } + + public void setEtag(String etag) { + this.etag = etag; + } + + @JsonProperty(XDM_DIRECTORY_PREFIX + ":format") + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + if (!super.equals(o)) { + return false; + } + + Directory directory = (Directory) o; + + if (assetId != null ? !assetId.equals(directory.assetId) : directory.assetId != null) { + return false; + } + if (name != null ? !name.equals(directory.name) : directory.name != null) { + return false; + } + if (path != null ? !path.equals(directory.path) : directory.path != null) { + return false; + } + if (etag != null ? !etag.equals(directory.etag) : directory.etag != null) { + return false; + } + return format != null ? format.equals(directory.format) : directory.format == null; + } + + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + (assetId != null ? assetId.hashCode() : 0); + result = 31 * result + (name != null ? name.hashCode() : 0); + result = 31 * result + (path != null ? path.hashCode() : 0); + result = 31 * result + (etag != null ? etag.hashCode() : 0); + result = 31 * result + (format != null ? format.hashCode() : 0); + return result; + } + + @Override + public String toString() { + return "Directory{" + + "assetId='" + assetId + '\'' + + ", name='" + name + '\'' + + ", path='" + path + '\'' + + ", etag='" + etag + '\'' + + ", format='" + format + '\'' + + ", id='" + id + '\'' + + ", type='" + type + '\'' + + '}'; + } +} diff --git a/events_xdm/src/main/json-ld/activitystreams.jsonld b/events_xdm/src/main/json-ld/activitystreams.jsonld new file mode 100644 index 00000000..412ed830 --- /dev/null +++ b/events_xdm/src/main/json-ld/activitystreams.jsonld @@ -0,0 +1,364 @@ +{ + "@context": { + "@vocab": "_:", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "as": "https://www.w3.org/ns/activitystreams#", + "ldp": "http://www.w3.org/ns/ldp#", + "id": "@id", + "type": "@type", + "Accept": "as:Accept", + "Activity": "as:Activity", + "IntransitiveActivity": "as:IntransitiveActivity", + "Add": "as:Add", + "Announce": "as:Announce", + "Application": "as:Application", + "Arrive": "as:Arrive", + "Article": "as:Article", + "Audio": "as:Audio", + "Block": "as:Block", + "Collection": "as:Collection", + "CollectionPage": "as:CollectionPage", + "Relationship": "as:Relationship", + "Create": "as:Create", + "Delete": "as:Delete", + "Dislike": "as:Dislike", + "Document": "as:Document", + "Event": "as:Event", + "Follow": "as:Follow", + "Flag": "as:Flag", + "Group": "as:Group", + "Ignore": "as:Ignore", + "Image": "as:Image", + "Invite": "as:Invite", + "Join": "as:Join", + "Leave": "as:Leave", + "Like": "as:Like", + "Link": "as:Link", + "Mention": "as:Mention", + "Note": "as:Note", + "Object": "as:Object", + "Offer": "as:Offer", + "OrderedCollection": "as:OrderedCollection", + "OrderedCollectionPage": "as:OrderedCollectionPage", + "Organization": "as:Organization", + "Page": "as:Page", + "Person": "as:Person", + "Place": "as:Place", + "Profile": "as:Profile", + "Question": "as:Question", + "Reject": "as:Reject", + "Remove": "as:Remove", + "Service": "as:Service", + "TentativeAccept": "as:TentativeAccept", + "TentativeReject": "as:TentativeReject", + "Tombstone": "as:Tombstone", + "Undo": "as:Undo", + "Update": "as:Update", + "Video": "as:Video", + "View": "as:View", + "Listen": "as:Listen", + "Read": "as:Read", + "Move": "as:Move", + "Travel": "as:Travel", + "IsFollowing": "as:IsFollowing", + "IsFollowedBy": "as:IsFollowedBy", + "IsContact": "as:IsContact", + "IsMember": "as:IsMember", + "subject": { + "@id": "as:subject", + "@type": "@id" + }, + "relationship": { + "@id": "as:relationship", + "@type": "@id" + }, + "actor": { + "@id": "as:actor", + "@type": "@id" + }, + "attributedTo": { + "@id": "as:attributedTo", + "@type": "@id" + }, + "attachment": { + "@id": "as:attachment", + "@type": "@id" + }, + "attachments": { + "@id": "as:attachments", + "@type": "@id" + }, + "author": { + "@id": "as:author", + "@type": "@id" + }, + "bcc": { + "@id": "as:bcc", + "@type": "@id" + }, + "bto": { + "@id": "as:bto", + "@type": "@id" + }, + "cc": { + "@id": "as:cc", + "@type": "@id" + }, + "context": { + "@id": "as:context", + "@type": "@id" + }, + "current": { + "@id": "as:current", + "@type": "@id" + }, + "first": { + "@id": "as:first", + "@type": "@id" + }, + "generator": { + "@id": "as:generator", + "@type": "@id" + }, + "icon": { + "@id": "as:icon", + "@type": "@id" + }, + "image": { + "@id": "as:image", + "@type": "@id" + }, + "inReplyTo": { + "@id": "as:inReplyTo", + "@type": "@id" + }, + "items": { + "@id": "as:items", + "@type": "@id" + }, + "instrument": { + "@id": "as:instrument", + "@type": "@id" + }, + "orderedItems": { + "@id": "as:items", + "@type": "@id", + "@container": "@list" + }, + "last": { + "@id": "as:last", + "@type": "@id" + }, + "location": { + "@id": "as:location", + "@type": "@id" + }, + "next": { + "@id": "as:next", + "@type": "@id" + }, + "object": { + "@id": "as:object", + "@type": "@id" + }, + "oneOf": { + "@id": "as:oneOf", + "@type": "@id" + }, + "anyOf": { + "@id": "as:anyOf", + "@type": "@id" + }, + "closed": { + "@id": "as:closed", + "@type": "xsd:dateTime" + }, + "origin": { + "@id": "as:origin", + "@type": "@id" + }, + "accuracy": { + "@id": "as:accuracy", + "@type": "xsd:float" + }, + "prev": { + "@id": "as:prev", + "@type": "@id" + }, + "preview": { + "@id": "as:preview", + "@type": "@id" + }, + "provider": { + "@id": "as:provider", + "@type": "@id" + }, + "replies": { + "@id": "as:replies", + "@type": "@id" + }, + "result": { + "@id": "as:result", + "@type": "@id" + }, + "audience": { + "@id": "as:audience", + "@type": "@id" + }, + "partOf": { + "@id": "as:partOf", + "@type": "@id" + }, + "tag": { + "@id": "as:tag", + "@type": "@id" + }, + "tags": { + "@id": "as:tag", + "@type": "@id" + }, + "target": { + "@id": "as:target", + "@type": "@id" + }, + "to": { + "@id": "as:to", + "@type": "@id" + }, + "url": { + "@id": "as:url", + "@type": "@id" + }, + "altitude": { + "@id": "as:altitude", + "@type": "xsd:float" + }, + "content": "as:content", + "contentMap": { + "@id": "as:content", + "@container": "@language" + }, + "name": "as:name", + "nameMap": { + "@id": "as:name", + "@container": "@language" + }, + "downstreamDuplicates": "as:downStreamDuplicates", + "duration": { + "@id": "as:duration", + "@type": "xsd:duration" + }, + "endTime": { + "@id": "as:endTime", + "@type": "xsd:dateTime" + }, + "height": { + "@id": "as:height", + "@type": "xsd:nonNegativeInteger" + }, + "href": { + "@id": "as:href", + "@type": "@id" + }, + "hreflang": "as:hreflang", + "latitude": { + "@id": "as:latitude", + "@type": "xsd:float" + }, + "longitude": { + "@id": "as:longitude", + "@type": "xsd:float" + }, + "mediaType": "as:mediaType", + "published": { + "@id": "as:published", + "@type": "xsd:dateTime" + }, + "radius": { + "@id": "as:radius", + "@type": "xsd:float" + }, + "rating": { + "@id": "as:rating", + "@type": "xsd:float" + }, + "rel": "as:rel", + "startIndex": { + "@id": "as:startIndex", + "@type": "xsd:nonNegativeInteger" + }, + "startTime": { + "@id": "as:startTime", + "@type": "xsd:dateTime" + }, + "summary": "as:summary", + "summaryMap": { + "@id": "as:summary", + "@container": "@language" + }, + "totalItems": { + "@id": "as:totalItems", + "@type": "xsd:nonNegativeInteger" + }, + "units": "as:units", + "updated": { + "@id": "as:updated", + "@type": "xsd:dateTime" + }, + "upstreamDuplicates": "as:upstreamDuplicates", + "verb": "as:verb", + "width": { + "@id": "as:width", + "@type": "xsd:nonNegativeInteger" + }, + "describes": { + "@id": "as:describes", + "@type": "@id" + }, + "formerType": { + "@id": "as:formerType", + "@type": "@id" + }, + "deleted": { + "@id": "as:deleted", + "@type": "xsd:dateTime" + }, + "inbox": { + "@id": "ldp:inbox", + "@type": "@id" + }, + "outbox": { + "@id": "as:outbox", + "@type": "@id" + }, + "following": { + "@id": "as:following", + "@type": "@id" + }, + "followers": { + "@id": "as:followers", + "@type": "@id" + }, + "streams": { + "@id": "as:streams", + "@type": "@id" + }, + "preferredUsername": "as:preferredUsername", + "endpoints": { + "@id": "as:endpoints", + "@type": "@id" + }, + "uploadMedia": { + "@id": "as:uploadMedia", + "@type": "@id" + }, + "proxyUrl": { + "@id": "as:proxyUrl", + "@type": "@id" + }, + "oauthClientAuthorize": "as:oauthClientAuthorize", + "provideClientKey": "as:provideClientKey", + "authorizeClientKey": "as:authorizeClientKey", + "source": "as:source" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/java/com/adobe/xdm/event/JsonUtils.java b/events_xdm/src/test/java/com/adobe/xdm/event/JsonUtils.java new file mode 100644 index 00000000..6931ea81 --- /dev/null +++ b/events_xdm/src/test/java/com/adobe/xdm/event/JsonUtils.java @@ -0,0 +1,39 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import com.fasterxml.jackson.core.JsonFactory; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; + +public class JsonUtils { + + private static final ObjectMapper JSON_MAPPER = new ObjectMapper(); + private static final JsonFactory JSON_FACTORY = new JsonFactory(JSON_MAPPER); + + public static String toPrettyString(Object jsonObject) throws IOException { + final StringWriter sw = new StringWriter(); + writePrettyPrint(sw, jsonObject); + return sw.toString(); + } + + public static void writePrettyPrint(Writer writer, Object jsonObject) throws IOException { + final JsonGenerator jw = JSON_FACTORY.createGenerator(writer); + jw.useDefaultPrettyPrinter(); + jw.writeObject(jsonObject); + } + + +} diff --git a/events_xdm/src/test/java/com/adobe/xdm/event/SerializationTest.java b/events_xdm/src/test/java/com/adobe/xdm/event/SerializationTest.java new file mode 100644 index 00000000..79a81938 --- /dev/null +++ b/events_xdm/src/test/java/com/adobe/xdm/event/SerializationTest.java @@ -0,0 +1,279 @@ +/* + * Copyright 2017 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +package com.adobe.xdm.event; + +import static org.junit.Assert.assertTrue; + +import com.adobe.xdm.Xdm; +import com.adobe.xdm.assets.Asset; +import com.adobe.xdm.content.ContentRepository; +import com.adobe.xdm.content.Page; +import com.adobe.xdm.extensions.aem.AemUser; +import com.adobe.xdm.extensions.aem.OsgiEvent; +import com.adobe.xdm.extensions.ims.ImsOrg; +import com.adobe.xdm.extensions.ims.ImsUser; +import com.adobe.xdm.external.repo.Directory; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Hashtable; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SerializationTest { + + Logger logger = LoggerFactory.getLogger(SerializationTest.class); + private static final String PUBLISHED_DATE = "1970-01-01T01:00:00.000+01"; + //the above is new SimpleDateFormat(XdmContext.DATE_FORMAT,Locale.US).format(new Date(0)); + private ObjectMapper mapper; + + @Before + public void setUp() { + mapper = new ObjectMapper(); + } + + private CCAssetEvent getCCAssetSampleEvent(CCAssetEvent assetEvent) { + assetEvent.setId("82235bac-2b81-4e70-90b5-2bd1f04b5c7b"); + assetEvent.setPublished(PUBLISHED_DATE); + ImsUser imsUser = new ImsUser(); + imsUser.setImsUserId("D13A1E7053E46A220A4C86E1@AdobeID"); + assetEvent.setTo(imsUser); + assetEvent.setActor(imsUser); + + ContentRepository creativeCloud = new ContentRepository(); + creativeCloud.setRoot("https://cc-api-storage.adobe.io/"); + assetEvent.setGenerator(creativeCloud); + + Asset asset = new Asset(); + asset.setFormat("image/jpeg"); + asset.setAssetId("urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185"); + asset.setAssetName("example.jpg"); + asset.setEtag("6fc55d0389d856ae7deccebba54f110e"); + asset.setPath("/MyFolder/example.jpg"); + assetEvent.setObject(asset); + return assetEvent; + } + + private CCDirectoryEvent getCCDirectorySampleEvent(CCDirectoryEvent directoryEvent) { + directoryEvent.setId("82235bac-2b81-4e70-90b5-2bd1f04b5c7b"); + directoryEvent.setPublished(PUBLISHED_DATE); + ImsUser imsUser = new ImsUser(); + imsUser.setImsUserId("D13A1E7053E46A220A4C86E1@AdobeID"); + directoryEvent.setTo(imsUser); + directoryEvent.setActor(imsUser); + + ContentRepository creativeCloud = new ContentRepository(); + creativeCloud.setRoot("https://cc-api-storage.adobe.io/"); + directoryEvent.setGenerator(creativeCloud); + + Directory directory = new Directory(); + directory.setFormat("application/vnd.adobecloud.directory+json"); + directory.setAssetId("urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185"); + directory.setName("example"); + directory.setEtag("6fc55d0389d856ae7deccebba54f110e"); + directory.setPath("/MyFolder/example"); + directoryEvent.setObject(directory); + return directoryEvent; + } + + private void assertDeserialization(T xdmEvent, String xdmEventJsonFile, + Class xdmEventClass) + throws IOException { + T xdmEventFromFile = mapper.readValue(readFile(xdmEventJsonFile), xdmEventClass); + assertTrue(xdmEventFromFile.equals(xdmEvent)); + } + + @Test + public void testCCAssetCreatedEventSerialization() throws IOException { + CCAssetEvent xdmEvent = getCCAssetSampleEvent(new CCAssetCreatedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + assertDeserialization(xdmEvent, "asset_created_cc_sample.json", CCAssetEvent.class); + } + + @Test + public void testCCAssetUpdatedEventSerialization() throws IOException { + CCAssetEvent xdmEvent = getCCAssetSampleEvent(new CCAssetUpdatedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + + assertDeserialization(xdmEvent, "asset_updated_cc_sample.json", CCAssetEvent.class); + } + + @Test + public void testCCAssetDeletedEventSerialization() throws IOException { + CCAssetEvent assetEvent = getCCAssetSampleEvent(new CCAssetDeletedEvent()); + Asset asset = new Asset(); + asset.setAssetId("urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185"); + assetEvent.setObject(asset); + String prettyString = JsonUtils.toPrettyString(assetEvent); + logger.info(prettyString); + + assertDeserialization(assetEvent, "asset_deleted_cc_sample.json", CCAssetEvent.class); + } + + @Test + public void testCCDirectoryCreatedEventSerialization() throws IOException { + CCDirectoryEvent xdmEvent = getCCDirectorySampleEvent(new CCDirectoryCreatedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + assertDeserialization(xdmEvent, "directory_created_cc_sample.json", CCDirectoryEvent.class); + } + + private AemAssetEvent getAemAssetSampleEvent(AemAssetEvent assetEvent) { + assetEvent.setId("82235bac-2b81-4e70-90b5-2bd1f04b5c7b"); + assetEvent.setPublished(PUBLISHED_DATE); + ImsOrg imsOrg = new ImsOrg(); + imsOrg.setImsOrgId("08B3E5CE5822FC520A494229@AdobeOrg"); + assetEvent.setTo(imsOrg); + + ContentRepository aemInstance = new ContentRepository(); + aemInstance.setRoot("http://francois.corp.adobe.com:4502/"); + assetEvent.setGenerator(aemInstance); + + AemUser aemUser = new AemUser(); + aemUser.setAemUserId("admin"); + assetEvent.setActor(aemUser); + + Asset asset = new Asset(); + asset.setFormat("image/png"); + asset.setAssetId("urn:aaid:aem:4123ba4c-93a8-4c5d-b979-ffbbe4318185"); + asset.setAssetName("Fx_DUKE-small.png"); + asset.setEtag("6fc55d0389d856ae7deccebba54f110e"); + asset.setPath("/content/dam/Fx_DUKE-small.png"); + assetEvent.setObject(asset); + return assetEvent; + } + + + @Test + public void testAemAssetCreatedEventSerialization() throws IOException { + AemAssetEvent xdmEvent = getAemAssetSampleEvent(new AemAssetCreatedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + assertDeserialization(xdmEvent, "asset_created_aem_sample.json", AemAssetEvent.class); + } + + @Test + public void testAemAssetUpdatedEventSerialization() throws IOException { + AemAssetEvent xdmEvent = getAemAssetSampleEvent(new AemAssetUpdatedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + assertDeserialization(xdmEvent, "asset_updated_aem_sample.json", AemAssetEvent.class); + } + + @Test + public void testAemAssetDeletedEventSerialization() throws IOException { + AemAssetEvent assetEvent = getAemAssetSampleEvent(new AemAssetDeletedEvent()); + Asset asset = new Asset(); + asset.setAssetId("urn:aaid:aem:4123ba4c-93a8-4c5d-b979-ffbbe4318185"); + assetEvent.setObject(asset); + String prettyString = JsonUtils.toPrettyString(assetEvent); + logger.info(prettyString); + + assertDeserialization(assetEvent, "asset_deleted_aem_sample.json", AemAssetEvent.class); + } + + + private AemPageEvent getAemPageSampleEvent(AemPageEvent pageEvent) { + pageEvent.setId("82235bac-2b81-4e70-90b5-2bd1f04b5c7b"); + pageEvent.setPublished(PUBLISHED_DATE); + + ImsOrg imsOrg = new ImsOrg(); + imsOrg.setImsOrgId("08B3E5CE5822FC520A494229@AdobeOrg"); + pageEvent.setTo(imsOrg); + + ContentRepository aemInstance = new ContentRepository(); + aemInstance.setRoot("http://francois.corp.adobe.com:4502/"); + pageEvent.setGenerator(aemInstance); + + AemUser aemUser = new AemUser(); + aemUser.setAemUserId("admin"); + pageEvent.setActor(aemUser); + + Page page = new Page(); + page.setTitle("Vintage Collection"); + page.setPath("/content/geometrixx/en/vintage.html"); + page.setId("http://adobesummit.adobesandbox.com:4502/content/geometrixx/en/vintage.html"); + pageEvent.setObject(page); + return pageEvent; + } + + @Test + public void testAemPagePublishedEventSerialization() throws IOException { + AemPageEvent xdmEvent = getAemPageSampleEvent(new AemPagePublishedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + + assertDeserialization(xdmEvent, "page_published_aem_sample.json", AemPageEvent.class); + } + + @Test + public void testAemPageUnpublishedEventSerialization() throws IOException { + AemPageEvent xdmEvent = getAemPageSampleEvent(new AemPageUnpublishedEvent()); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + + assertDeserialization(xdmEvent, "page_unpublished_aem_sample.json", AemPageEvent.class); + } + + private OsgiEmittedEvent getOsgiEmittedEventSampleEvent() { + OsgiEmittedEvent osgiEmittedEvent = new OsgiEmittedEvent(); + + osgiEmittedEvent.setId("82235bac-2b81-4e70-90b5-2bd1f04b5c7b"); + osgiEmittedEvent.setPublished(PUBLISHED_DATE); + ImsOrg imsOrg = new ImsOrg(); + imsOrg.setImsOrgId("08B3E5CE5822FC520A494229@AdobeOrg"); + osgiEmittedEvent.setTo(imsOrg); + + ContentRepository aemInstance = new ContentRepository(); + aemInstance.setRoot("http://francois.corp.adobe.com:4502/"); + osgiEmittedEvent.setGenerator(aemInstance); + + Hashtable properties = new Hashtable(); + properties.put("type", "created"); + properties.put("id", "1234"); + OsgiEvent osgiEvent = new OsgiEvent(); + osgiEvent.setTopic("io/adobe/event/sample/sku"); + osgiEvent.setProperties(properties); + + osgiEmittedEvent.setObject(osgiEvent); + return osgiEmittedEvent; + } + + @Test + public void testOsgiEmittedEventSampleEventSerialization() throws IOException { + OsgiEmittedEvent xdmEvent = getOsgiEmittedEventSampleEvent(); + String prettyString = JsonUtils.toPrettyString(xdmEvent); + logger.info(prettyString); + assertDeserialization(xdmEvent, "custom_osgi_emitted_aem_sample.json", OsgiEmittedEvent.class); + } + + @Test + public void testXdmContextSerialization() throws IOException { + Xdm xdm = new Xdm(); + String prettyString = JsonUtils.toPrettyString(xdm); + logger.info(prettyString); + } + + private static String readFile(String fileName) throws IOException { + byte[] encoded = Files.readAllBytes(Paths.get( + Thread.currentThread().getContextClassLoader() + .getResource(fileName).getPath())); + return new String(encoded, StandardCharsets.UTF_8); + } + +} diff --git a/events_xdm/src/test/resources/asset_created_aem_sample.json b/events_xdm/src/test/resources/asset_created_aem_sample.json new file mode 100644 index 00000000..e86fa74c --- /dev/null +++ b/events_xdm/src/test/resources/asset_created_aem_sample.json @@ -0,0 +1,38 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmCreated", + "xdmEventEnvelope:objectType": "xdmAsset", + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "activitystreams:to": { + "xdmImsOrg:id": "08B3E5CE5822FC520A494229@AdobeOrg", + "@type": "xdmImsOrg" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "http://francois.corp.adobe.com:4502/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmAemUser:id": "admin", + "@type": "xdmAemUser" + }, + "activitystreams:object": { + "@type": "xdmAsset", + "xdmAsset:asset_id": "urn:aaid:aem:4123ba4c-93a8-4c5d-b979-ffbbe4318185", + "xdmAsset:asset_name": "Fx_DUKE-small.png", + "xdmAsset:etag": "6fc55d0389d856ae7deccebba54f110e", + "xdmAsset:path": "/content/dam/Fx_DUKE-small.png", + "xdmAsset:format": "image/png" + }, + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmImsOrg": "https://ns.adobe.com/xdm/ims/organization#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmAemUser": "https://ns.adobe.com/xdm/aem/user#", + "xdmCreated": "https://ns.adobe.com/xdm/common/event/created#" + } +} + + + diff --git a/events_xdm/src/test/resources/asset_created_cc_sample.json b/events_xdm/src/test/resources/asset_created_cc_sample.json new file mode 100644 index 00000000..394cf4c0 --- /dev/null +++ b/events_xdm/src/test/resources/asset_created_cc_sample.json @@ -0,0 +1,34 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmCreated", + "xdmEventEnvelope:objectType": "xdmAsset", + "activitystreams:to": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "https://cc-api-storage.adobe.io/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:object": { + "@type": "xdmAsset", + "xdmAsset:asset_id": "urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185", + "xdmAsset:asset_name": "example.jpg", + "xdmAsset:etag": "6fc55d0389d856ae7deccebba54f110e", + "xdmAsset:path": "/MyFolder/example.jpg", + "xdmAsset:format": "image/jpeg" + }, + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmImsUser": "https://ns.adobe.com/xdm/ims/user#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmCreated": "https://ns.adobe.com/xdm/common/event/created#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/asset_deleted_aem_sample.json b/events_xdm/src/test/resources/asset_deleted_aem_sample.json new file mode 100644 index 00000000..e4c62414 --- /dev/null +++ b/events_xdm/src/test/resources/asset_deleted_aem_sample.json @@ -0,0 +1,31 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmDeleted", + "xdmEventEnvelope:objectType": "xdmAsset", + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "activitystreams:to": { + "xdmImsOrg:id": "08B3E5CE5822FC520A494229@AdobeOrg", + "@type": "xdmImsOrg" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "http://francois.corp.adobe.com:4502/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmAemUser:id": "admin", + "@type": "xdmAemUser" + }, + "activitystreams:object": { + "@type": "xdmAsset", + "xdmAsset:asset_id": "urn:aaid:aem:4123ba4c-93a8-4c5d-b979-ffbbe4318185" + }, + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmImsOrg": "https://ns.adobe.com/xdm/ims/organization#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmAemUser": "https://ns.adobe.com/xdm/aem/user#", + "xdmDeleted": "https://ns.adobe.com/xdm/common/event/deleted#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/asset_deleted_cc_sample.json b/events_xdm/src/test/resources/asset_deleted_cc_sample.json new file mode 100644 index 00000000..f2ccd05c --- /dev/null +++ b/events_xdm/src/test/resources/asset_deleted_cc_sample.json @@ -0,0 +1,30 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmDeleted", + "xdmEventEnvelope:objectType": "xdmAsset", + "activitystreams:to": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "https://cc-api-storage.adobe.io/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:object": { + "@type": "xdmAsset", + "xdmAsset:asset_id": "urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185" + }, + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmImsUser": "https://ns.adobe.com/xdm/ims/user#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmDeleted": "https://ns.adobe.com/xdm/common/event/deleted#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/asset_updated_aem_sample.json b/events_xdm/src/test/resources/asset_updated_aem_sample.json new file mode 100644 index 00000000..6ee3be30 --- /dev/null +++ b/events_xdm/src/test/resources/asset_updated_aem_sample.json @@ -0,0 +1,36 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmUpdated", + "xdmEventEnvelope:objectType": "xdmAsset", + "activitystreams:published":"1970-01-01T01:00:00.000+01", + "activitystreams:to": { + "xdmImsOrg:id": "08B3E5CE5822FC520A494229@AdobeOrg", + "@type": "xdmImsOrg" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "http://francois.corp.adobe.com:4502/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmAemUser:id": "admin", + "@type": "xdmAemUser" + }, + "activitystreams:object": { + "activitystreams:mediaType": "image/png", + "@type": "xdmAsset", + "xdmAsset:asset_id": "urn:aaid:aem:4123ba4c-93a8-4c5d-b979-ffbbe4318185", + "xdmAsset:asset_name": "Fx_DUKE-small.png", + "xdmAsset:etag": "6fc55d0389d856ae7deccebba54f110e", + "xdmAsset:path": "/content/dam/Fx_DUKE-small.png", + "xdmAsset:format": "image/png" + }, + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmImsOrg": "https://ns.adobe.com/xdm/ims/organization#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmAemUser": "https://ns.adobe.com/xdm/aem/user#", + "xdmUpdated": "https://ns.adobe.com/xdm/common/event/updated#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/asset_updated_cc_sample.json b/events_xdm/src/test/resources/asset_updated_cc_sample.json new file mode 100644 index 00000000..4f5226cf --- /dev/null +++ b/events_xdm/src/test/resources/asset_updated_cc_sample.json @@ -0,0 +1,34 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmUpdated", + "xdmEventEnvelope:objectType": "xdmAsset", + "activitystreams:to": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "https://cc-api-storage.adobe.io/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:object": { + "@type": "xdmAsset", + "xdmAsset:asset_id": "urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185", + "xdmAsset:asset_name": "example.jpg", + "xdmAsset:etag": "6fc55d0389d856ae7deccebba54f110e", + "xdmAsset:path": "/MyFolder/example.jpg", + "xdmAsset:format": "image/jpeg" + }, + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmImsUser": "https://ns.adobe.com/xdm/ims/user#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmUpdated": "https://ns.adobe.com/xdm/common/event/updated#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/custom_osgi_emitted_aem_sample.json b/events_xdm/src/test/resources/custom_osgi_emitted_aem_sample.json new file mode 100644 index 00000000..d862d46f --- /dev/null +++ b/events_xdm/src/test/resources/custom_osgi_emitted_aem_sample.json @@ -0,0 +1,33 @@ +{ + "@id" : "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type" : "xdmEmitted", + "activitystreams:published" : "1970-01-01T01:00:00.000+01", + "activitystreams:to" : { + "@type" : "xdmImsOrg", + "xdmImsOrg:id" : "08B3E5CE5822FC520A494229@AdobeOrg" + }, + "activitystreams:generator" : { + "@type" : "xdmContentRepository", + "xdmContentRepository:root" : "http://francois.corp.adobe.com:4502/" + }, + "activitystreams:object" : { + "@type" : "osgiEvent:io/adobe/event/sample/sku", + "osgiEvent:topic" : "io/adobe/event/sample/sku", + "osgiEvent:properties" : { + "type" : "created", + "id" : "1234" + } + }, + "xdmEventEnvelope:objectType" : "osgiEvent:io/adobe/event/sample/sku", + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmImsOrg": "https://ns.adobe.com/xdm/ims/organization#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmEmitted" : "https://ns.adobe.com/xdm/common/event/emitted#", + "osgiEvent" : "https://osgi.org/javadoc/r4v42/org/osgi/service/event/Event.html" + } +} + + + diff --git a/events_xdm/src/test/resources/directory_created_cc_sample.json b/events_xdm/src/test/resources/directory_created_cc_sample.json new file mode 100644 index 00000000..10b7b9b1 --- /dev/null +++ b/events_xdm/src/test/resources/directory_created_cc_sample.json @@ -0,0 +1,34 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmCreated", + "xdmEventEnvelope:objectType": "xdmDirectory", + "activitystreams:to": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "https://cc-api-storage.adobe.io/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmImsUser:id": "D13A1E7053E46A220A4C86E1@AdobeID", + "@type": "xdmImsUser" + }, + "activitystreams:object": { + "@type": "xdmDirectory", + "xdmDirectory:asset_id": "urn:aaid:sc:us:4123ba4c-93a8-4c5d-b979-ffbbe4318185", + "xdmDirectory:name": "example", + "xdmDirectory:etag": "6fc55d0389d856ae7deccebba54f110e", + "xdmDirectory:path": "/MyFolder/example", + "xdmDirectory:format": "application/vnd.adobecloud.directory+json" + }, + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmDirectory": "https://ns.adobe.com/adobecloud/core/1.0/directory#", + "xdmImsUser": "https://ns.adobe.com/xdm/ims/user#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository", + "xdmCreated": "https://ns.adobe.com/xdm/common/event/created#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/log4j.properties b/events_xdm/src/test/resources/log4j.properties new file mode 100644 index 00000000..e97228bc --- /dev/null +++ b/events_xdm/src/test/resources/log4j.properties @@ -0,0 +1,17 @@ +# +# Copyright 2017 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + +log4j.rootLogger=INFO, stdout +# Direct log messages to stdout +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.Target=System.out +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout diff --git a/events_xdm/src/test/resources/page_published_aem_sample.json b/events_xdm/src/test/resources/page_published_aem_sample.json new file mode 100644 index 00000000..a422d541 --- /dev/null +++ b/events_xdm/src/test/resources/page_published_aem_sample.json @@ -0,0 +1,33 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmPublished", + "xdmEventEnvelope:objectType": "xdmComponentizedPage", + "activitystreams:published": "1970-01-01T01:00:00.000+01", + "activitystreams:to": { + "xdmImsOrg:id": "08B3E5CE5822FC520A494229@AdobeOrg", + "@type": "xdmImsOrg" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "https://cloud-action-dev.corp.adobe.com:4502/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmAemUser:id": "admin", + "@type": "xdmAemUser" + }, + "activitystreams:object": { + "@id": "http://adobesummit.adobesandbox.com:4502/content/geometrixx/en/vintage.html", + "@type": "xdmComponentizedPage", + "xdmComponentizedPage:title": "Vintage Collection", + "xdmComponentizedPage:path": "/content/geometrixx/en/vintage.html" + }, + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmComponentizedPage": "https://ns.adobe.com/xdm/content/componentized-page#", + "xdmImsOrg": "https://ns.adobe.com/xdm/ims/organization#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository#", + "xdmAemUser": "https://ns.adobe.com/xdm/aem/user#", + "xdmPublished": "https://ns.adobe.com/xdm/common/event/published#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/page_unpublished_aem_sample.json b/events_xdm/src/test/resources/page_unpublished_aem_sample.json new file mode 100644 index 00000000..74d160b8 --- /dev/null +++ b/events_xdm/src/test/resources/page_unpublished_aem_sample.json @@ -0,0 +1,33 @@ +{ + "@id": "82235bac-2b81-4e70-90b5-2bd1f04b5c7b", + "@type": "xdmUnpublished", + "xdmEventEnvelope:objectType": "xdmComponentizedPage", + "activitystreams:published":"1970-01-01T01:00:00.000+01", + "activitystreams:to": { + "xdmImsOrg:id": "08B3E5CE5822FC520A494229@AdobeOrg", + "@type": "xdmImsOrg" + }, + "activitystreams:generator": { + "xdmContentRepository:root": "https://cloud-action-dev.corp.adobe.com:4502/", + "@type": "xdmContentRepository" + }, + "activitystreams:actor": { + "xdmAemUser:id": "admin", + "@type": "xdmAemUser" + }, + "activitystreams:object": { + "@id": "http://adobesummit.adobesandbox.com:4502/content/geometrixx/en/vintage.html", + "@type": "xdmComponentizedPage", + "xdmComponentizedPage:title": "Vintage Collection", + "xdmComponentizedPage:path": "/content/geometrixx/en/vintage.html" + }, + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + "xdmEventEnvelope": "https://ns.adobe.com/xdm/common/eventenvelope#", + "xdmComponentizedPage": "https://ns.adobe.com/xdm/content/componentized-page#", + "xdmImsOrg": "https://ns.adobe.com/xdm/ims/organization#", + "xdmContentRepository": "https://ns.adobe.com/xdm/content/repository#", + "xdmAemUser": "https://ns.adobe.com/xdm/aem/user#", + "xdmPublished": "https://ns.adobe.com/xdm/common/event/published#" + } +} \ No newline at end of file diff --git a/events_xdm/src/test/resources/xdm_context.json b/events_xdm/src/test/resources/xdm_context.json new file mode 100644 index 00000000..428d2f7d --- /dev/null +++ b/events_xdm/src/test/resources/xdm_context.json @@ -0,0 +1,27 @@ +{ + "@context": { + "activitystreams": "http://www.w3.org/ns/activitystreams#", + + "xdmEventEnvelope": "http://ns.adobe.com/xdm/event-envelope#", + + "xdmAsset": "http://ns.adobe.com/xdm/assets/asset#", + "xdmComponentizedPage": "http://ns.adobe.com/xdm/content/componentized-page#", + + "xdmContentRepository": "http://ns.adobe.com/xdm/content/repository#", + + "xdmImsOrg": "https://ns.adobe.com/xdm-extensions/ims/organization#", + "xdmAemUser": "https://ns.adobe.com/xdm-extensions/aem/user", + "xdmImsUser": "https://ns.adobe.com/xdm-extensions/ims/user#", + + "xdmCreated": "https://ns.adobe.com/xdm/common/event/created#", + "xdmDeleted": "https://ns.adobe.com/xdm/common/event/deleted#", + "xdmUpdated": "https://ns.adobe.com/xdm/common/event/updated#", + + "xdmPublished": "https://ns.adobe.com/xdm/common/event/published#", + "xdmUnpublished": "https://ns.adobe.com/xdm/common/event/unpublished#", + + "xdmEmitted" : "https://ns.adobe.com/xdm/common/event/emitted#", + + "osgiEvent" : "https://osgi.org/javadoc/r4v42/org/osgi/service/event/Event.html" + } +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index f52362bb..1db2c368 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ events_journal events_test + events_xdm aem @@ -116,14 +117,6 @@ - - - com.adobe.event - xdm-event-model - ${xdm.event-model.version} - provided - - org.apache.commons commons-text @@ -166,6 +159,12 @@ 3.0.1 + + com.fasterxml.jackson.core + jackson-annotations + ${jackson.version} + + com.fasterxml.jackson.core jackson-databind From 5282231b844a2fef918991b77cb0058ff8583c09 Mon Sep 17 00:00:00 2001 From: Francois Le Droff Date: Tue, 22 Nov 2022 16:52:02 +0100 Subject: [PATCH 10/12] GH-104 polishing: The artifact junit:junit-dep:jar:4.11 has been relocated to junit:junit:jar:4.11 --- aem/core_aem/pom.xml | 2 +- aem/events_ingress_aem/pom.xml | 2 +- aem/events_mgmt_aem/pom.xml | 2 +- aem/events_osgi_mapping/pom.xml | 2 +- core/pom.xml | 3 +-- events_ingress/pom.xml | 2 +- events_journal/pom.xml | 2 +- events_mgmt/pom.xml | 2 +- events_test/pom.xml | 2 +- events_xdm/pom.xml | 2 +- ims/pom.xml | 3 +-- pom.xml | 2 +- 12 files changed, 12 insertions(+), 14 deletions(-) diff --git a/aem/core_aem/pom.xml b/aem/core_aem/pom.xml index 71e906e4..4b485371 100644 --- a/aem/core_aem/pom.xml +++ b/aem/core_aem/pom.xml @@ -55,7 +55,7 @@ junit - junit-dep + junit org.slf4j diff --git a/aem/events_ingress_aem/pom.xml b/aem/events_ingress_aem/pom.xml index ba794954..16252bf1 100644 --- a/aem/events_ingress_aem/pom.xml +++ b/aem/events_ingress_aem/pom.xml @@ -54,7 +54,7 @@ - junit-dep + junit junit diff --git a/aem/events_mgmt_aem/pom.xml b/aem/events_mgmt_aem/pom.xml index 555084c6..583ed5ab 100644 --- a/aem/events_mgmt_aem/pom.xml +++ b/aem/events_mgmt_aem/pom.xml @@ -42,7 +42,7 @@ - junit-dep + junit junit diff --git a/aem/events_osgi_mapping/pom.xml b/aem/events_osgi_mapping/pom.xml index 2aea6c7b..85296b36 100644 --- a/aem/events_osgi_mapping/pom.xml +++ b/aem/events_osgi_mapping/pom.xml @@ -62,7 +62,7 @@ - junit-dep + junit junit diff --git a/core/pom.xml b/core/pom.xml index 3422d266..8c7bfb13 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -57,9 +57,8 @@ junit - junit-dep + junit - org.slf4j slf4j-simple diff --git a/events_ingress/pom.xml b/events_ingress/pom.xml index 10d9e2f9..47610c78 100644 --- a/events_ingress/pom.xml +++ b/events_ingress/pom.xml @@ -37,7 +37,7 @@ junit - junit-dep + junit org.slf4j diff --git a/events_journal/pom.xml b/events_journal/pom.xml index 5d76aa70..9d87207b 100644 --- a/events_journal/pom.xml +++ b/events_journal/pom.xml @@ -49,7 +49,7 @@ junit - junit-dep + junit com.squareup.okhttp3 diff --git a/events_mgmt/pom.xml b/events_mgmt/pom.xml index 85aa3642..ee93e17b 100644 --- a/events_mgmt/pom.xml +++ b/events_mgmt/pom.xml @@ -37,7 +37,7 @@ junit - junit-dep + junit org.slf4j diff --git a/events_test/pom.xml b/events_test/pom.xml index 0a7c3a2c..995a8a7b 100644 --- a/events_test/pom.xml +++ b/events_test/pom.xml @@ -56,7 +56,7 @@ junit - junit-dep + junit compile diff --git a/events_xdm/pom.xml b/events_xdm/pom.xml index a484456c..a11ab4d2 100644 --- a/events_xdm/pom.xml +++ b/events_xdm/pom.xml @@ -40,7 +40,7 @@ junit - junit-dep + junit test diff --git a/ims/pom.xml b/ims/pom.xml index 016db8ae..113e9140 100644 --- a/ims/pom.xml +++ b/ims/pom.xml @@ -56,10 +56,9 @@ org.slf4j slf4j-simple - junit - junit-dep + junit diff --git a/pom.xml b/pom.xml index 1db2c368..7c4ab0cf 100644 --- a/pom.xml +++ b/pom.xml @@ -194,7 +194,7 @@ junit - junit-dep + junit ${junit.version} test From 0b8e5a3f0f430af1ab8873136fbc8fa8752691e8 Mon Sep 17 00:00:00 2001 From: Francois Le Droff Date: Tue, 22 Nov 2022 18:07:39 +0100 Subject: [PATCH 11/12] GH-104 polishing: adding a few `README.md` details --- README.md | 2 +- events_test/README.md | 19 +++++++++++++++++++ events_xdm/README.md | 36 ++++++++++++++++++++++++++++++++++++ pom.xml | 3 +-- 4 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 events_test/README.md create mode 100644 events_xdm/README.md diff --git a/README.md b/README.md index 1abebb35..2630a5fe 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Modules -This project is composed of Java Libraries : +This project is composed of a few Java Libraries, among these : * [`aio-lib-java-core`](./core) holds the core models, builders, utilities used across the other libraries below, * [`aio-lib-java-ims`](./ims) is a library wrapping a subset of [Adobe Identity Management System (IMS) API](https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/AuthenticationOverview/AuthenticationGuide.md) * [`aio-lib-java-events-mgmt`](./events_mgmt) is a library wrapping [Adobe I/O Events Provider and Registration API](https://www.adobe.io/apis/experienceplatform/events/docs.html#!adobedocs/adobeio-events/master/api/api.md) diff --git a/events_test/README.md b/events_test/README.md new file mode 100644 index 00000000..40a33cd6 --- /dev/null +++ b/events_test/README.md @@ -0,0 +1,19 @@ +# `aio-lib-java-events-test` + +`aio-lib-java-events-test` is Adobe I/O - Java SDK - Events Test Utility Library. + +Its `src/test/java` folder also contains a set of `*IntegrationTest` ran by this repository's GitHub Actions. + +## Builds + +This Library is build with [maven](https://maven.apache.org/) (it also runs the unit tests): + +### Contributing + +Contributions are welcomed! Read the [Contributing Guide](../.github/CONTRIBUTING.md) for more information. + +### Licensing + +This project is licensed under the Apache V2 License. See [LICENSE](../LICENSE.md) for more information. + + diff --git a/events_xdm/README.md b/events_xdm/README.md new file mode 100644 index 00000000..cc3a2c03 --- /dev/null +++ b/events_xdm/README.md @@ -0,0 +1,36 @@ +# `aio-lib-java-events-xdm` + +`aio-lib-java-events-xdm` is Adobe I/O - Java SDK - Jackson based implementation of the Adobe XDM Event Envelope Model. + +This Adobe XDM Event Envelope Model is +based on [json-ld w3c activity streams spec](https://github.com/w3c/activitystreams/blob/master/ns/activitystreams.jsonld), +for more detailed specifications, +visit the [Adobe XDM event envelope schema](https://github.com/adobe/xdm/blob/master/archived/common/eventenvelope.schema.json) + +## `json-ld` notes and pointers + +Note that as we chose to serve the json-ld `@context` through link header [9] and keep fixed json-ld prefixes, +we based this implementation of plain and simple jackson [10] serialization, +otherwise for full-fledged json-ld implementation hydra [0] and jsonld-java [8] could have been used + +* [0] http://www.hydra-cg.com/ +* [1] https://github.com/dschulten/hydra-java +* [2] https://github.com/dschulten/hydra-java/tree/master/hydra-jsonld +* [3] https://json-ld.org/playground/ +* [4] https://github.com/w3c/activitystreams/issues/134#issuecomment-108122077 +* [5] https://github.com/w3c/activitystreams/issues/136 +* [8] https://github.com/jsonld-java/jsonld-java +* [9] https://www.w3.org/TR/json-ld/#interpreting-json-as-json-ld +* [10] https://github.com/FasterXML/jackson-core + +## Builds + +This Library is build with [maven](https://maven.apache.org/) (it also runs the unit tests): + +### Contributing + +Contributions are welcomed! Read the [Contributing Guide](../.github/CONTRIBUTING.md) for more information. + +### Licensing + +This project is licensed under the Apache V2 License. See [LICENSE](../LICENSE.md) for more information. diff --git a/pom.xml b/pom.xml index 7c4ab0cf..80f66852 100644 --- a/pom.xml +++ b/pom.xml @@ -110,8 +110,7 @@ 11.2 3.8.0 - - 0.92.6-SNAPSHOT + From 8f78fd44434d199a33817725fb3dbc3f62764837 Mon Sep 17 00:00:00 2001 From: Francois Le Droff Date: Tue, 22 Nov 2022 18:13:44 +0100 Subject: [PATCH 12/12] GH-104 fixing a typo in a test --- .../com/adobe/aio/event/management/ProviderServiceTester.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java b/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java index 1d948361..53205bd4 100644 --- a/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java +++ b/events_test/src/main/java/com/adobe/aio/event/management/ProviderServiceTester.java @@ -103,7 +103,7 @@ private Provider assertProviderResponseAndCreateEventMetadata(ProviderInputModel Assert.assertEquals(eventMetadataInput.getEventCode(), eventMetadata.get().getEventCode()); Assert.assertEquals(eventMetadataInput.getDescription(), eventMetadata.get().getDescription()); - Assert.assertEquals(eventMetadataInput.getEventCode(), eventMetadata.get().getLabel()); + Assert.assertEquals(eventMetadataInput.getLabel(), eventMetadata.get().getLabel()); logger.info("Added EventMetadata `{}` to AIO Events Provider `{}`", eventMetadata, providerId); }