Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
pwinckles committed Mar 2, 2024
1 parent e91f2f9 commit 7da81c9
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 58 deletions.
2 changes: 1 addition & 1 deletion ocfl-java-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions ocfl-java-aws/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>stax2-api</artifactId>
<version>4.2.1</version>
<version>4.2.2</version>
</dependency>


Expand Down Expand Up @@ -98,7 +98,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions ocfl-java-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>net.jodah</groupId>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
</dependency>

Expand All @@ -113,7 +113,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -169,7 +169,7 @@
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<artifactId>bcprov-jdk18on</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

import static io.ocfl.api.OcflConstants.INVENTORY_SIDECAR_PREFIX;

import dev.failsafe.Failsafe;
import dev.failsafe.RetryPolicy;
import io.ocfl.api.OcflConstants;
import io.ocfl.api.OcflFileRetriever;
import io.ocfl.api.exception.CorruptObjectException;
Expand Down Expand Up @@ -79,8 +81,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import net.jodah.failsafe.Failsafe;
import net.jodah.failsafe.RetryPolicy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -134,10 +134,11 @@ public DefaultOcflStorage(Storage storage, boolean verifyInventoryDigest, OcflSt
this.initializer = Enforce.notNull(initializer, "initializer cannot be null");
this.logicalPathConstraints = LogicalPathConstraints.constraintsWithBackslashCheck();
this.validator = new Validator(storage);
this.invRetry = new RetryPolicy<Void>()
this.invRetry = RetryPolicy.<Void>builder()
.handle(RuntimeException.class)
.withBackoff(10, 200, ChronoUnit.MILLIS, 1.5)
.withMaxRetries(10);
.withMaxRetries(10)
.build();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions ocfl-java-itest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -124,13 +124,13 @@
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.9.4</version>
<version>1.12.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.9.4</version>
<version>1.12.3</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
26 changes: 0 additions & 26 deletions ocfl-java-itest/src/test/java/io/ocfl/itest/OcflITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
import io.ocfl.core.extension.storage.layout.config.HashedNTupleLayoutConfig;
import io.ocfl.core.extension.storage.layout.config.NTupleOmitPrefixStorageLayoutConfig;
import io.ocfl.core.model.Inventory;
import io.ocfl.core.path.constraint.ContentPathConstraints;
import io.ocfl.core.path.mapper.LogicalPathMappers;
import io.ocfl.itest.ext.TestLayoutExtension;
import io.ocfl.itest.ext.TestLayoutExtensionConfig;
import java.io.BufferedInputStream;
Expand Down Expand Up @@ -1786,30 +1784,6 @@ public void flatLayoutWithValidIds() {
verifyRepo(repoName);
}

@Test
public void makeContentPathsWindowsSafe() throws IOException {
var repoName = "windows-safe";
var repo = defaultRepo(repoName, builder -> builder.defaultLayoutConfig(new FlatLayoutConfig())
.logicalPathMapper(LogicalPathMappers.percentEncodingWindowsMapper())
.contentPathConstraints(ContentPathConstraints.windows()));

var logicalPath = "tést/<bad>:Path 1/\\|obj/?8*%id/#{something}/[0]/۞.txt";

repo.updateObject(ObjectVersionId.head("o1"), defaultVersionInfo.setMessage("1"), updater -> {
updater.writeFile(new ByteArrayInputStream("1".getBytes()), logicalPath);
});

verifyRepo(repoName);

var object = repo.getObject(ObjectVersionId.head("o1"));

assertTrue(object.containsFile(logicalPath), "expected object to contain logical path " + logicalPath);

try (var stream = object.getFile(logicalPath).getStream()) {
assertEquals("1", new String(stream.readAllBytes()));
}
}

@Test
public void createVersionsWithCustomCreateDates() {
var repo = defaultRepo("custom-date");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import io.ocfl.api.OcflConstants;
import io.ocfl.api.OcflRepository;
Expand All @@ -13,6 +15,8 @@
import io.ocfl.core.extension.storage.layout.config.FlatLayoutConfig;
import io.ocfl.core.extension.storage.layout.config.HashedNTupleIdEncapsulationLayoutConfig;
import io.ocfl.core.extension.storage.layout.config.HashedNTupleLayoutConfig;
import io.ocfl.core.path.constraint.ContentPathConstraints;
import io.ocfl.core.path.mapper.LogicalPathMappers;
import io.ocfl.core.util.FileUtil;
import io.ocfl.core.util.UncheckedFiles;
import io.ocfl.itest.ITestHelper;
Expand All @@ -35,6 +39,31 @@ public class FileSystemOcflITest extends OcflITest {

private Path reposDir;

// Doesn't work with s3 mock
@Test
public void makeContentPathsWindowsSafe() throws IOException {
var repoName = "windows-safe";
var repo = defaultRepo(repoName, builder -> builder.defaultLayoutConfig(new FlatLayoutConfig())
.logicalPathMapper(LogicalPathMappers.percentEncodingWindowsMapper())
.contentPathConstraints(ContentPathConstraints.windows()));

var logicalPath = "tést/<bad>:Path 1/\\|obj/?8*%id/#{something}/[0]/۞.txt";

repo.updateObject(ObjectVersionId.head("o1"), defaultVersionInfo.setMessage("1"), updater -> {
updater.writeFile(new ByteArrayInputStream("1".getBytes()), logicalPath);
});

verifyRepo(repoName);

var object = repo.getObject(ObjectVersionId.head("o1"));

assertTrue(object.containsFile(logicalPath), "expected object to contain logical path " + logicalPath);

try (var stream = object.getFile(logicalPath).getStream()) {
assertEquals("1", new String(stream.readAllBytes()));
}
}

// Does not work with S3Mock because the generated filenames are too long
@Test
public void hashedIdLayout() {
Expand Down
32 changes: 32 additions & 0 deletions ocfl-java-itest/src/test/java/io/ocfl/itest/s3/S3OcflITest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.adobe.testing.s3mock.junit5.S3MockExtension;
import com.mchange.v2.c3p0.ComboPooledDataSource;
Expand All @@ -14,14 +15,17 @@
import io.ocfl.core.OcflRepositoryBuilder;
import io.ocfl.core.cache.NoOpCache;
import io.ocfl.core.extension.UnsupportedExtensionBehavior;
import io.ocfl.core.extension.storage.layout.config.FlatLayoutConfig;
import io.ocfl.core.extension.storage.layout.config.HashedNTupleIdEncapsulationLayoutConfig;
import io.ocfl.core.extension.storage.layout.config.HashedNTupleLayoutConfig;
import io.ocfl.core.path.constraint.ContentPathConstraints;
import io.ocfl.core.path.mapper.LogicalPathMappers;
import io.ocfl.core.storage.cloud.CloudClient;
import io.ocfl.core.util.FileUtil;
import io.ocfl.itest.ITestHelper;
import io.ocfl.itest.OcflITest;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -98,6 +102,34 @@ protected void onAfter() {
});
}

// Doesn't work with s3 mock
@EnabledIfEnvironmentVariable(named = ENV_ACCESS_KEY, matches = ".+")
@EnabledIfEnvironmentVariable(named = ENV_SECRET_KEY, matches = ".+")
@EnabledIfEnvironmentVariable(named = ENV_BUCKET, matches = ".+")
@Test
public void makeContentPathsWindowsSafe() throws IOException {
var repoName = "windows-safe";
var repo = defaultRepo(repoName, builder -> builder.defaultLayoutConfig(new FlatLayoutConfig())
.logicalPathMapper(LogicalPathMappers.percentEncodingWindowsMapper())
.contentPathConstraints(ContentPathConstraints.windows()));

var logicalPath = "tést/<bad>:Path 1/\\|obj/?8*%id/#{something}/[0]/۞.txt";

repo.updateObject(ObjectVersionId.head("o1"), defaultVersionInfo.setMessage("1"), updater -> {
updater.writeFile(new ByteArrayInputStream("1".getBytes()), logicalPath);
});

verifyRepo(repoName);

var object = repo.getObject(ObjectVersionId.head("o1"));

assertTrue(object.containsFile(logicalPath), "expected object to contain logical path " + logicalPath);

try (var stream = object.getFile(logicalPath).getStream()) {
assertEquals("1", new String(stream.readAllBytes()));
}
}

// Doesn't work with mock https://github.com/adobe/S3Mock/issues/215
@Test
@EnabledIfEnvironmentVariable(named = ENV_ACCESS_KEY, matches = ".+")
Expand Down
38 changes: 19 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@

<java.version>11</java.version>

<jackson.version>2.15.0</jackson.version>
<slf4j.version>2.0.7</slf4j.version>
<jackson.version>2.16.1</jackson.version>
<slf4j.version>2.0.12</slf4j.version>
</properties>

<profiles>
Expand Down Expand Up @@ -103,7 +103,7 @@
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>false</autoReleaseAfterClose>
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
<stagingProgressTimeoutMinutes>60</stagingProgressTimeoutMinutes>
</configuration>
</plugin>
</plugins>
Expand Down Expand Up @@ -302,14 +302,14 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.4.7</version>
<version>1.5.1</version>
</dependency>

<!-- Caching -->
<dependency>
<groupId>com.github.ben-manes.caffeine</groupId>
<artifactId>caffeine</artifactId>
<version>3.1.6</version>
<version>3.1.8</version>
</dependency>

<!-- Byte manipulation -->
Expand All @@ -323,63 +323,63 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
<version>33.0.0-jre</version>
</dependency>
<dependency>
<groupId>net.jodah</groupId>
<groupId>dev.failsafe</groupId>
<artifactId>failsafe</artifactId>
<version>2.4.4</version>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.70</version>
<artifactId>bcprov-jdk18on</artifactId>
<version>1.77</version>
</dependency>

<!-- AWS -->
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.20.65</version>
<version>2.24.13</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<!-- Test -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.24.2</version>
<version>3.25.3</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.9.3</version>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.3.1</version>
<version>5.10.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.6.0</version>
<version>42.7.2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>2.2.220</version>
<version>2.2.224</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.1.4</version>
<version>3.3.3</version>
</dependency>
<dependency>
<groupId>com.mchange</groupId>
Expand All @@ -389,7 +389,7 @@
<dependency>
<groupId>com.adobe.testing</groupId>
<artifactId>s3mock-junit5</artifactId>
<version>2.11.0</version>
<version>3.5.1</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down

0 comments on commit 7da81c9

Please sign in to comment.