mirror of https://github.com/shred/acme4j
Update dependencies, fix deprecation warnings
parent
42e94125d8
commit
4c34ce8352
|
@ -26,6 +26,7 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.mockito.ArgumentMatchers;
|
||||||
import org.shredzone.acme4j.challenge.Challenge;
|
import org.shredzone.acme4j.challenge.Challenge;
|
||||||
import org.shredzone.acme4j.challenge.Http01Challenge;
|
import org.shredzone.acme4j.challenge.Http01Challenge;
|
||||||
import org.shredzone.acme4j.connector.Resource;
|
import org.shredzone.acme4j.connector.Resource;
|
||||||
|
@ -128,8 +129,8 @@ public class SessionTest {
|
||||||
final AcmeProvider mockProvider = mock(AcmeProvider.class);
|
final AcmeProvider mockProvider = mock(AcmeProvider.class);
|
||||||
|
|
||||||
when(mockProvider.createChallenge(
|
when(mockProvider.createChallenge(
|
||||||
org.mockito.Matchers.any(Session.class),
|
ArgumentMatchers.any(Session.class),
|
||||||
org.mockito.Matchers.eq(challengeType)))
|
ArgumentMatchers.eq(challengeType)))
|
||||||
.thenReturn(mockChallenge);
|
.thenReturn(mockChallenge);
|
||||||
|
|
||||||
Session session = new Session(serverUri, keyPair) {
|
Session session = new Session(serverUri, keyPair) {
|
||||||
|
@ -160,8 +161,8 @@ public class SessionTest {
|
||||||
|
|
||||||
final AcmeProvider mockProvider = mock(AcmeProvider.class);
|
final AcmeProvider mockProvider = mock(AcmeProvider.class);
|
||||||
when(mockProvider.resources(
|
when(mockProvider.resources(
|
||||||
org.mockito.Matchers.any(Session.class),
|
ArgumentMatchers.any(Session.class),
|
||||||
org.mockito.Matchers.eq(serverUri)))
|
ArgumentMatchers.eq(serverUri)))
|
||||||
.thenReturn(directoryMap);
|
.thenReturn(directoryMap);
|
||||||
|
|
||||||
Session session = new Session(serverUri, keyPair) {
|
Session session = new Session(serverUri, keyPair) {
|
||||||
|
@ -180,8 +181,8 @@ public class SessionTest {
|
||||||
|
|
||||||
// Make sure directory is only read once!
|
// Make sure directory is only read once!
|
||||||
verify(mockProvider, times(1)).resources(
|
verify(mockProvider, times(1)).resources(
|
||||||
org.mockito.Matchers.any(Session.class),
|
ArgumentMatchers.any(Session.class),
|
||||||
org.mockito.Matchers.any(URI.class));
|
ArgumentMatchers.any(URI.class));
|
||||||
|
|
||||||
// Simulate a cache expiry
|
// Simulate a cache expiry
|
||||||
session.directoryCacheExpiry = new Date();
|
session.directoryCacheExpiry = new Date();
|
||||||
|
@ -194,8 +195,8 @@ public class SessionTest {
|
||||||
assertThat(session.resourceUri(Resource.NEW_REG),
|
assertThat(session.resourceUri(Resource.NEW_REG),
|
||||||
is(nullValue()));
|
is(nullValue()));
|
||||||
verify(mockProvider, times(2)).resources(
|
verify(mockProvider, times(2)).resources(
|
||||||
org.mockito.Matchers.any(Session.class),
|
ArgumentMatchers.any(Session.class),
|
||||||
org.mockito.Matchers.any(URI.class));
|
ArgumentMatchers.any(URI.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ package org.shredzone.acme4j.connector;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
import static org.mockito.Matchers.*;
|
|
||||||
import static org.mockito.Mockito.*;
|
import static org.mockito.Mockito.*;
|
||||||
import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
|
import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs;
|
||||||
|
|
||||||
|
@ -36,6 +35,7 @@ import org.jose4j.base64url.Base64Url;
|
||||||
import org.jose4j.jwx.CompactSerializer;
|
import org.jose4j.jwx.CompactSerializer;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.mockito.ArgumentMatchers;
|
||||||
import org.shredzone.acme4j.Session;
|
import org.shredzone.acme4j.Session;
|
||||||
import org.shredzone.acme4j.exception.AcmeException;
|
import org.shredzone.acme4j.exception.AcmeException;
|
||||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||||
|
@ -232,8 +232,12 @@ public class DefaultConnectionTest {
|
||||||
int delta = 10 * 60 * 60;
|
int delta = 10 * 60 * 60;
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
when(mockUrlConnection.getHeaderField("Retry-After")).thenReturn(String.valueOf(delta));
|
when(mockUrlConnection.getHeaderField("Retry-After"))
|
||||||
when(mockUrlConnection.getHeaderFieldDate(eq("Date"), anyLong())).thenReturn(now);
|
.thenReturn(String.valueOf(delta));
|
||||||
|
when(mockUrlConnection.getHeaderFieldDate(
|
||||||
|
ArgumentMatchers.eq("Date"),
|
||||||
|
ArgumentMatchers.anyLong()))
|
||||||
|
.thenReturn(now);
|
||||||
|
|
||||||
try (DefaultConnection conn = new DefaultConnection(mockHttpConnection)) {
|
try (DefaultConnection conn = new DefaultConnection(mockHttpConnection)) {
|
||||||
conn.conn = mockUrlConnection;
|
conn.conn = mockUrlConnection;
|
||||||
|
|
8
pom.xml
8
pom.xml
|
@ -52,8 +52,8 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<bouncycastle.version>1.54</bouncycastle.version>
|
<bouncycastle.version>1.54</bouncycastle.version>
|
||||||
<jose4j.version>0.5.0</jose4j.version>
|
<jose4j.version>0.5.1</jose4j.version>
|
||||||
<slf4j.version>1.7.18</slf4j.version>
|
<slf4j.version>1.7.21</slf4j.version>
|
||||||
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
@ -186,13 +186,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>uk.co.datumedge</groupId>
|
<groupId>uk.co.datumedge</groupId>
|
||||||
<artifactId>hamcrest-json</artifactId>
|
<artifactId>hamcrest-json</artifactId>
|
||||||
<version>[0.1,)</version>
|
<version>[0.2,)</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
<artifactId>mockito-core</artifactId>
|
<artifactId>mockito-core</artifactId>
|
||||||
<version>[1.9.5,)</version>
|
<version>[2.0,)</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
Loading…
Reference in New Issue