Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion aem/core_aem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
2 changes: 1 addition & 1 deletion aem/events_ingress_aem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!-- test -->
<dependency>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</dependency>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion aem/events_mgmt_aem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

<!-- test -->
<dependency>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</dependency>
<dependency>
Expand Down
9 changes: 5 additions & 4 deletions aem/events_osgi_mapping/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,17 @@
<scope>provided</scope>
<version>${project.version}</version>
</dependency>
<!-- adobe.io XDM event model -->
<dependency>
<artifactId>xdm-event-model</artifactId>
<groupId>com.adobe.event</groupId>
<groupId>com.adobe.aio</groupId>
<artifactId>aio-lib-java-events-xdm</artifactId>
<scope>provided</scope>
<version>${project.version}</version>
</dependency>


<!-- test -->
<dependency>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</dependency>
<dependency>
Expand Down
12 changes: 4 additions & 8 deletions aem/lib_osgi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,12 @@
<name>Adobe I/O - Java SDK - OSGI bundle</name>

<dependencies>
<dependency> <!-- TODO: Remove this when xdm-event-model no longer depends on it -->
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>

<dependency>
<groupId>com.adobe.event</groupId>
<artifactId>xdm-event-model</artifactId>
<groupId>com.adobe.aio</groupId>
<artifactId>aio-lib-java-events-xdm</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.adobe.aio</groupId>
<artifactId>aio-lib-java-ims</artifactId>
Expand Down
3 changes: 1 addition & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@

<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
Expand Down
11 changes: 7 additions & 4 deletions core/src/test/java/com/adobe/aio/util/FileUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -33,14 +35,15 @@ private Properties getTestProperties() {

@Test
public void testGetMapFromProperties() {
assertEquals(Map.ofEntries(Map.entry(KEY, VALUE)),
FileUtil.getMapFromProperties(getTestProperties()));
Map<String, String> map = new HashMap<>();
map.put(KEY, VALUE);
assertEquals(map, FileUtil.getMapFromProperties(getTestProperties()));
}

@Test
public void testReadPropertiesFromFile() {
Assert.assertTrue(FileUtil.readPropertiesFromFile("").isEmpty());
Assert.assertTrue(FileUtil.readPropertiesFromFile(null).isEmpty());
Assert.assertFalse(FileUtil.readPropertiesFromFile("").isPresent());
Assert.assertFalse(FileUtil.readPropertiesFromFile(null).isPresent());
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion events_ingress/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
2 changes: 1 addition & 1 deletion events_journal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
Expand Down
2 changes: 1 addition & 1 deletion events_mgmt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
Expand Down
19 changes: 19 additions & 0 deletions events_test/README.md
Original file line number Diff line number Diff line change
@@ -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.


2 changes: 1 addition & 1 deletion events_test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@

<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<artifactId>junit</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -101,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);
}
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
36 changes: 36 additions & 0 deletions events_xdm/README.md
Original file line number Diff line number Diff line change
@@ -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.
67 changes: 67 additions & 0 deletions events_xdm/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<groupId>com.adobe.aio</groupId>
<artifactId>aio-lib-java</artifactId>
<version>0.1.5-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>aio-lib-java-events-xdm</artifactId>
<name>Adobe I/O - XDM Event Model</name>
<description>Adobe I/O - Java SDK - (Jackson based) Implementation of the Adobe XDM Event Model</description>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.9.1</version>
<scope>test</scope>
</dependency>

</dependencies>

</project>

24 changes: 24 additions & 0 deletions events_xdm/src/main/java/com/adobe/xdm/Xdm.java
Original file line number Diff line number Diff line change
@@ -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();
}

}
Loading