From e47e15a2ef8336381f4370e64bf96bd54bd74dd5 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 1 Mar 2024 14:33:07 -0700 Subject: [PATCH] Dependency Updates (#35) * Bump spring versions to match other duracloud projects * SF -> 5.3.x * Data -> 2.7.x * Security -> 5.8.x * Batch -> 4.3.x * Update duracloud deps to latest release * Match commons-lang3 with duracloud version * Update easymock * Update spring data api usage * Remove exception which no longer exists * Replace wix with testcontainers * Update slf4j and logback * Update jackson * Update hibernate and mysql-connector * Misc dependency updates * javax.interceptor-api * aspectjweaver * dbcp2 * mapdb * Plugin updates * Add maven-war-plugin * Remove redundant groupId * Update CI to java 17 * Another maven plugin update * Increase memory usage for maven * Set release version to 17 --- .github/workflows/ci-build.yml | 10 +-- pom.xml | 86 +++++++++---------- rewrite/pom.xml | 8 +- snapshot-bridge-webapp/pom.xml | 9 +- .../bridge/rest/SnapshotResource.java | 4 +- .../bridge/rest/RestoreResourceTest.java | 5 +- .../bridge/rest/SnapshotResourceTest.java | 10 +-- snapshot-common-db/pom.xml | 9 +- .../snapshot/db/SnapshotDatabaseConfig.java | 2 +- .../snapshot/db/JpaIntegrationTestBase.java | 50 +++++------ .../snapshot/db/repo/SnapshotRepoTest.java | 1 + .../src/test/resources/db_init.sql | 3 +- snapshot-common-test/pom.xml | 1 - snapshot-common/pom.xml | 1 - snapshot-service-impl/pom.xml | 9 +- .../service/impl/SnapshotManagerImpl.java | 19 ++-- .../service/impl/SnapshotManagerImplTest.java | 5 +- snapshot-service/pom.xml | 1 - 18 files changed, 111 insertions(+), 122 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e9455dc1..3d867651 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest env: # Specify memory for Maven - MAVEN_OPTS: "-Xmx256M" + MAVEN_OPTS: "-Xmx512M" steps: # Output current build environment - run: echo "This is a CI build of branch ${{ github.ref }} in repository ${{ github.repository }}" @@ -20,10 +20,10 @@ jobs: uses: actions/checkout@v2 # https://github.com/actions/setup-java - - name: Install JDK 11 + - name: Install JDK 17 uses: actions/setup-java@v2 with: - java-version: 11 + java-version: 17 distribution: adopt # https://github.com/actions/cache @@ -47,7 +47,7 @@ jobs: uses: actions/setup-java@v2 if: github.ref == 'refs/heads/develop' && github.event_name == 'push' with: - java-version: 11 + java-version: 17 distribution: adopt server-id: sonatype-snapshots # Value of the distributionManagement/repository/id field of the pom.xml server-username: SONATYPE_USERNAME # env variable for sonatype username @@ -59,7 +59,7 @@ jobs: uses: actions/setup-java@v2 if: github.ref == 'refs/heads/main' && github.event_name == 'push' with: - java-version: 11 + java-version: 17 distribution: adopt server-id: sonatype-releases # Value of the distributionManagement/repository/id field of the pom.xml server-username: SONATYPE_USERNAME # env variable for sonatype username diff --git a/pom.xml b/pom.xml index c3fb75b6..5c69dfe4 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,7 @@ org.apache.maven.plugins maven-source-plugin - 2.3 + 3.3.0 attach-sources @@ -135,7 +135,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.6.3 attach-javadocs @@ -158,7 +158,7 @@ org.apache.maven.plugins maven-gpg-plugin - 3.0.1 + 3.1.0 sign-artifacts @@ -185,18 +185,20 @@ INFO UTF-8 - 1.7.6 - 4.3.30.RELEASE - 1.11.23.RELEASE - 4.2.20.RELEASE - 3.0.7.RELEASE - 5.4.3.Final - 5.1.49 - 7.1.0 - 7.1.0 + 2.0.9 + 1.4.14 + 5.3.29 + 2.7.15 + 5.8.5 + 4.3.10 + 5.4.33.Final + 5.4.3.Final + 8.2.0 + 8.0.0 + 8.0.0 1.1.0 1.3.4 - 2.12.3 + 2.16.0 2.3.1 2.3.3 1.3.2 @@ -261,7 +263,7 @@ org.sonatype.plugins nexus-staging-maven-plugin - 1.6.6 + 1.6.13 true sonatype-releases @@ -276,9 +278,9 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.11.0 - 11 + 17 UTF-8 @@ -304,7 +306,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.16 + 3.2.3 @@ -361,7 +363,7 @@ maven-resources-plugin - 3.0.1 + 3.3.1 copy-resources @@ -385,7 +387,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M3 + 3.4.1 @@ -403,7 +405,7 @@ - [3.5.0,4.0.0) + [3.6.3,4.0.0) @@ -415,7 +417,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - 3.1.0 + 3.3.1 verify-style @@ -566,7 +568,7 @@ javax.interceptor javax.interceptor-api - 1.2 + 1.2.2 @@ -602,7 +604,7 @@ org.aspectj aspectjweaver - 1.8.8 + 1.9.21 @@ -621,7 +623,7 @@ org.apache.commons commons-dbcp2 - 2.1 + 2.11.0 commons-logging @@ -637,6 +639,7 @@ + javax.xml.bind jaxb-api ${jaxb.api.version} @@ -657,7 +660,7 @@ ch.qos.logback logback-classic - 1.2.0 + ${logback.version} @@ -673,11 +676,18 @@ - mysql - mysql-connector-java + com.mysql + mysql-connector-j ${mysql.connector.version} + + + org.jboss.logging + jboss-logging + 3.4.1.Final + + org.hibernate hibernate-entitymanager @@ -687,12 +697,8 @@ org.hibernate hibernate-validator - ${hibernate.version} + ${hibernate.validator.version} - - org.jboss.logging - jboss-logging - com.fasterxml classmate @@ -721,21 +727,15 @@ org.easymock easymock - 4.0.2 + 5.2.0 test - com.wix - wix-embedded-mysql - 2.2.10 + org.testcontainers + mysql + 1.19.3 test - - - commons-io - commons-io - - @@ -782,7 +782,7 @@ org.apache.commons commons-lang3 - 3.1 + 3.12.0 diff --git a/rewrite/pom.xml b/rewrite/pom.xml index ba7b87d0..02b6497a 100644 --- a/rewrite/pom.xml +++ b/rewrite/pom.xml @@ -2,7 +2,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - org.duracloud.snapshot ROOT war 3.2.0-SNAPSHOT @@ -22,7 +21,7 @@ org.apache.maven.plugins maven-dependency-plugin - 2.10 + 3.6.1 copy-build-artifact @@ -47,6 +46,11 @@ + + org.apache.maven.plugins + maven-war-plugin + 3.4.0 + diff --git a/snapshot-bridge-webapp/pom.xml b/snapshot-bridge-webapp/pom.xml index 1f5b2dd9..9082882e 100644 --- a/snapshot-bridge-webapp/pom.xml +++ b/snapshot-bridge-webapp/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 3.2.0-SNAPSHOT - org.duracloud.snapshot bridge war DuraCloud to Bridge Web Application @@ -50,7 +49,7 @@ org.apache.maven.plugins maven-war-plugin - 2.4 + 3.4.0 ${project.artifactId}-${project.version} @@ -64,7 +63,7 @@ org.apache.maven.plugins maven-dependency-plugin - 2.10 + 3.6.1 copy-build-artifact @@ -220,8 +219,8 @@ - mysql - mysql-connector-java + com.mysql + mysql-connector-j diff --git a/snapshot-bridge-webapp/src/main/java/org/duracloud/snapshot/bridge/rest/SnapshotResource.java b/snapshot-bridge-webapp/src/main/java/org/duracloud/snapshot/bridge/rest/SnapshotResource.java index 36f3fa89..3924a9be 100644 --- a/snapshot-bridge-webapp/src/main/java/org/duracloud/snapshot/bridge/rest/SnapshotResource.java +++ b/snapshot-bridge-webapp/src/main/java/org/duracloud/snapshot/bridge/rest/SnapshotResource.java @@ -620,7 +620,7 @@ public Response create(@PathParam("snapshotId") String snapshotId, log.info("cleaning up post exception..."); try { log.debug("deleting newly created snapshot..."); - snapshotRepo.delete(snapshot.getId()); + snapshotRepo.deleteById(snapshot.getId()); } catch (Exception e) { log.error("failed to cleanup snapshot " + snapshotId + ": " + e.getMessage(), e); @@ -778,7 +778,7 @@ public Response getContent(@PathParam("snapshotId") String snapshotId, pageSize = 1000; } - PageRequest pageable = new PageRequest(page, pageSize); + PageRequest pageable = PageRequest.of(page, pageSize); List items; if (null == prefix || prefix.equals("")) { diff --git a/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/RestoreResourceTest.java b/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/RestoreResourceTest.java index d48816c9..15c2a040 100644 --- a/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/RestoreResourceTest.java +++ b/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/RestoreResourceTest.java @@ -15,7 +15,6 @@ import java.util.Date; import javax.ws.rs.core.Response; -import org.codehaus.jettison.json.JSONException; import org.duracloud.snapshot.SnapshotException; import org.duracloud.snapshot.common.test.SnapshotTestBase; import org.duracloud.snapshot.db.model.DuracloudEndPointConfig; @@ -162,7 +161,7 @@ public void testCancelSnapshot() throws SnapshotException { } @Test - public void testGetRestore() throws SnapshotException, JSONException { + public void testGetRestore() throws SnapshotException { String restorationId = "restoration-id"; Restoration restoration = setupRestoration(); expect(manager.get(restorationId)).andReturn(restoration); @@ -173,7 +172,7 @@ public void testGetRestore() throws SnapshotException, JSONException { } @Test - public void testGetRestoreBySnapshot() throws SnapshotException, JSONException { + public void testGetRestoreBySnapshot() throws SnapshotException { String snapshotId = "snapshot-id"; Restoration restoration = setupRestoration(); expect(manager.getBySnapshotId(snapshotId)).andReturn(restoration); diff --git a/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/SnapshotResourceTest.java b/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/SnapshotResourceTest.java index b5bb3c51..0822e21a 100644 --- a/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/SnapshotResourceTest.java +++ b/snapshot-bridge-webapp/src/test/java/org/duracloud/snapshot/bridge/rest/SnapshotResourceTest.java @@ -25,7 +25,6 @@ import javax.ws.rs.core.Response.Status; import org.apache.http.HttpStatus; -import org.codehaus.jettison.json.JSONException; import org.duracloud.client.ContentStore; import org.duracloud.common.constant.Constants; import org.duracloud.common.notification.NotificationManager; @@ -304,7 +303,7 @@ public void testRestartFailure() throws SnapshotException { } @Test - public void testComplete() throws SnapshotException, JSONException { + public void testComplete() throws SnapshotException { String snapshotId = "snapshot-name"; List snapshotAlternateIds = new ArrayList(); String altId1 = "alternate-name-1"; @@ -335,7 +334,7 @@ public void testComplete() throws SnapshotException, JSONException { } @Test - public void testCompleteDuplicateAltId() throws SnapshotException, JSONException { + public void testCompleteDuplicateAltId() throws SnapshotException { String snapshotId = "snapshot-name"; List snapshotAlternateIds = new ArrayList(); String altId1 = "alternate-name-1"; @@ -359,7 +358,7 @@ public void testCompleteDuplicateAltId() throws SnapshotException, JSONException } @Test - public void testCancel() throws SnapshotException, JSONException { + public void testCancel() throws SnapshotException { String snapshotId = "snapshot-name"; expect(this.snapshotRepo.findByName(snapshotId)).andReturn(snapshot); @@ -375,7 +374,7 @@ public void testCancel() throws SnapshotException, JSONException { } @Test - public void testCancelFailure() throws SnapshotException, JSONException { + public void testCancelFailure() throws SnapshotException { String snapshotId = "snapshot-name"; expect(this.snapshotRepo.findByName(snapshotId)).andReturn(snapshot); @@ -386,7 +385,6 @@ public void testCancelFailure() throws SnapshotException, JSONException { assertEquals(HttpStatus.SC_INTERNAL_SERVER_ERROR, response.getStatus()); assertTrue(response.getEntity() instanceof ResponseDetails); assertNotNull(((ResponseDetails) response.getEntity()).getMessage()); - } @Test diff --git a/snapshot-common-db/pom.xml b/snapshot-common-db/pom.xml index ff4f809a..f3b87fa1 100644 --- a/snapshot-common-db/pom.xml +++ b/snapshot-common-db/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 3.2.0-SNAPSHOT - org.duracloud.snapshot snapshot-common-db jar Snapshot Common DB @@ -40,8 +39,8 @@ - mysql - mysql-connector-java + com.mysql + mysql-connector-j @@ -74,8 +73,8 @@ - com.wix - wix-embedded-mysql + org.testcontainers + mysql diff --git a/snapshot-common-db/src/main/java/org/duracloud/snapshot/db/SnapshotDatabaseConfig.java b/snapshot-common-db/src/main/java/org/duracloud/snapshot/db/SnapshotDatabaseConfig.java index 412cea64..a62d2f84 100644 --- a/snapshot-common-db/src/main/java/org/duracloud/snapshot/db/SnapshotDatabaseConfig.java +++ b/snapshot-common-db/src/main/java/org/duracloud/snapshot/db/SnapshotDatabaseConfig.java @@ -47,7 +47,7 @@ public class SnapshotDatabaseConfig { @Bean(name = SNAPSHOT_REPO_DATA_SOURCE_BEAN, destroyMethod = "close") public BasicDataSource snapshotDataSource() { BasicDataSource dataSource = new BasicDataSource(); - dataSource.setDriverClassName("com.mysql.jdbc.Driver"); + dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver"); dataSource.setUrl(MessageFormat.format("jdbc:mysql://{0}:{1}/{2}" + "?useLegacyDatetimeCode=false" + "&serverTimezone=GMT" + diff --git a/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/JpaIntegrationTestBase.java b/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/JpaIntegrationTestBase.java index c5ef0127..c48eaa4d 100644 --- a/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/JpaIntegrationTestBase.java +++ b/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/JpaIntegrationTestBase.java @@ -8,22 +8,14 @@ package org.duracloud.snapshot.db; -import static com.wix.mysql.EmbeddedMysql.anEmbeddedMysql; -import static com.wix.mysql.config.Charset.UTF8; -import static com.wix.mysql.config.MysqldConfig.aMysqldConfig; -import static com.wix.mysql.distribution.Version.v5_7_latest; - -import java.util.concurrent.TimeUnit; - -import com.wix.mysql.EmbeddedMysql; -import com.wix.mysql.ScriptResolver; -import com.wix.mysql.config.MysqldConfig; import org.easymock.EasyMockRunner; import org.easymock.EasyMockSupport; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.ClassRule; import org.junit.runner.RunWith; import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.testcontainers.containers.MySQLContainer; /** * @author Daniel Bernstein @@ -32,31 +24,29 @@ @RunWith(EasyMockRunner.class) public abstract class JpaIntegrationTestBase extends EasyMockSupport { - private EmbeddedMysql mysqld = null; - - protected AnnotationConfigApplicationContext context; + @ClassRule + public static MySQLContainer mysql = new MySQLContainer<>() + .withUsername("user") + .withPassword("pass") + .withDatabaseName("snapshot") + .withInitScript("db_init.sql") + .withEnv("TZ", "GMT") + .withEnv("max_connect_errors", "666"); - @Before - public void setup() { - int port = 3310; - MysqldConfig config = aMysqldConfig(v5_7_latest).withCharset(UTF8).withPort(port).withUser("user", "pass") - .withTimeZone("GMT").withTimeout(2, TimeUnit.MINUTES) - .withServerVariable("max_connect_errors", 666) - .withServerVariable("log_syslog", 0) - .build(); - - mysqld = anEmbeddedMysql(config).addSchema("snapshot", ScriptResolver.classPathScript("db_init.sql")).start(); + protected static AnnotationConfigApplicationContext context; + @BeforeClass + public static void setup() { System.setProperty("generate.database", "true"); - System.setProperty("snapshot.db.port", port + ""); + System.setProperty("snapshot.db.port", mysql.getFirstMappedPort().toString()); context = new AnnotationConfigApplicationContext("org.duracloud.snapshot.db"); - } - @After - public void tearDown() { - mysqld.stop(); + @AfterClass + public static void tearDown() { + context.close(); + mysql.close(); } } diff --git a/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/repo/SnapshotRepoTest.java b/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/repo/SnapshotRepoTest.java index cd8053c7..6ea05b8b 100644 --- a/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/repo/SnapshotRepoTest.java +++ b/snapshot-common-db/src/test/java/org/duracloud/snapshot/db/repo/SnapshotRepoTest.java @@ -23,6 +23,7 @@ * @author Daniel Bernstein */ public class SnapshotRepoTest extends JpaIntegrationTestBase { + @Test public void testFindByStatusOrderBySnapshotDateAsc() { SnapshotRepo repo = context.getBean(SnapshotRepo.class); diff --git a/snapshot-common-db/src/test/resources/db_init.sql b/snapshot-common-db/src/test/resources/db_init.sql index 47b8bba7..d0dd02bc 100644 --- a/snapshot-common-db/src/test/resources/db_init.sql +++ b/snapshot-common-db/src/test/resources/db_init.sql @@ -1,2 +1 @@ -grant all privileges on mill.* to "user"@"localhost" identified by "pass"; -flush privileges; \ No newline at end of file +ALTER DATABASE snapshot CHARACTER SET utf8 COLLATE utf8_general_ci; diff --git a/snapshot-common-test/pom.xml b/snapshot-common-test/pom.xml index 46bf7f95..536b7bce 100644 --- a/snapshot-common-test/pom.xml +++ b/snapshot-common-test/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - org.duracloud.snapshot snapshot-common-test jar 3.2.0-SNAPSHOT diff --git a/snapshot-common/pom.xml b/snapshot-common/pom.xml index 3647b332..6ee99c61 100644 --- a/snapshot-common/pom.xml +++ b/snapshot-common/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 3.2.0-SNAPSHOT - org.duracloud.snapshot snapshot-common jar Snapshot Common diff --git a/snapshot-service-impl/pom.xml b/snapshot-service-impl/pom.xml index 28c3472d..93a6d696 100644 --- a/snapshot-service-impl/pom.xml +++ b/snapshot-service-impl/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 - org.duracloud.snapshot snapshot-service-impl jar 3.2.0-SNAPSHOT @@ -23,7 +22,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.2 + 3.5.1 false @@ -184,8 +183,8 @@ - mysql - mysql-connector-java + com.mysql + mysql-connector-j @@ -201,7 +200,7 @@ org.mapdb mapdb - 3.0.5 + 3.0.10 diff --git a/snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/SnapshotManagerImpl.java b/snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/SnapshotManagerImpl.java index 12f991a4..63d4d8db 100644 --- a/snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/SnapshotManagerImpl.java +++ b/snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/SnapshotManagerImpl.java @@ -186,16 +186,19 @@ public void addContentItem(Snapshot snapshot, @Transactional public Snapshot addAlternateSnapshotIds(Snapshot snapshot, List alternateIds) throws AlternateIdAlreadyExistsException { - snapshot = this.snapshotRepo.findOne(snapshot.getId()); - for (String altId : alternateIds) { - Snapshot altSnapshot = this.snapshotRepo.findBySnapshotAlternateIds(altId); - if (altSnapshot != null && !altSnapshot.getName().equals(snapshot.getName())) { - throw new AlternateIdAlreadyExistsException("The alternate snapshot id (" - + altId + ") already exists in another snapshot (" + - altSnapshot.getName() + ")"); + final var query = snapshotRepo.findById(snapshot.getId()); + if (query.isPresent()) { + snapshot = query.get(); + for (String altId : alternateIds) { + Snapshot altSnapshot = this.snapshotRepo.findBySnapshotAlternateIds(altId); + if (altSnapshot != null && !altSnapshot.getName().equals(snapshot.getName())) { + throw new AlternateIdAlreadyExistsException("The alternate snapshot id (" + + altId + ") already exists in another snapshot (" + + altSnapshot.getName() + ")"); + } } + snapshot.addSnapshotAlternateIds(alternateIds); } - snapshot.addSnapshotAlternateIds(alternateIds); return this.snapshotRepo.saveAndFlush(snapshot); } diff --git a/snapshot-service-impl/src/test/java/org/duracloud/snapshot/service/impl/SnapshotManagerImplTest.java b/snapshot-service-impl/src/test/java/org/duracloud/snapshot/service/impl/SnapshotManagerImplTest.java index dfc4ce23..76e54414 100644 --- a/snapshot-service-impl/src/test/java/org/duracloud/snapshot/service/impl/SnapshotManagerImplTest.java +++ b/snapshot-service-impl/src/test/java/org/duracloud/snapshot/service/impl/SnapshotManagerImplTest.java @@ -32,6 +32,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.Optional; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; @@ -257,7 +258,7 @@ public void testAddDuplicateAlternateIdsInSameSnapshot() throws AlternateIdAlrea List alternateIds = Arrays.asList(new String[] {altTestId}); String snapshotId = "test"; expect(snapshot.getId()).andReturn(1l); - expect(this.snapshotRepo.findOne(isA(Long.class))).andReturn(snapshot); + expect(this.snapshotRepo.findById(isA(Long.class))).andReturn(Optional.of(snapshot)); expect(snapshot.getName()).andReturn(snapshotId).times(2); expect(this.snapshotRepo.findBySnapshotAlternateIds(altTestId)) @@ -279,7 +280,7 @@ public void testAddDuplicateAlternateIdsInDifferentSnapshot() { expect(snapshot2.getName()).andReturn("snapshot2").atLeastOnce(); expect(snapshot.getId()).andReturn(1l); - expect(this.snapshotRepo.findOne(isA(Long.class))).andReturn(snapshot); + expect(this.snapshotRepo.findById(isA(Long.class))).andReturn(Optional.of(snapshot)); expect(this.snapshotRepo.findBySnapshotAlternateIds(altTestId)).andReturn(snapshot2); replayAll(); diff --git a/snapshot-service/pom.xml b/snapshot-service/pom.xml index 62322e87..797555b0 100644 --- a/snapshot-service/pom.xml +++ b/snapshot-service/pom.xml @@ -3,7 +3,6 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 3.2.0-SNAPSHOT - org.duracloud.snapshot snapshot-service jar Snapshot Service Layer