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
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
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 @@ -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
3 changes: 2 additions & 1 deletion ims/src/main/java/com/adobe/aio/ims/util/KeyStoreUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
<feign.version>11.2</feign.version>
<feign-form.version>3.8.0</feign-form.version>

<xdm.event-model.version>0.92.5</xdm.event-model.version>
<xdm.event-model.version>0.92.6-SNAPSHOT</xdm.event-model.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -369,8 +369,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>11</source>
<target>11</target>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>

Expand Down Expand Up @@ -427,7 +427,7 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<source>11</source>
<source>1.8</source>
<notimestamp>true</notimestamp>
<quiet>true</quiet>
<doctitle>Adobe I/O - Java SDK API v${project.version}</doctitle>
Expand Down