From a953e87b1b21ff109759fd3c3037bf3c6ef62cc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20K=C3=B6rber?= Date: Thu, 27 Apr 2017 22:40:40 +0200 Subject: [PATCH] Put test JSONs in separate files --- .../shredzone/acme4j/AuthorizationTest.java | 8 +- .../org/shredzone/acme4j/CertificateTest.java | 4 +- .../java/org/shredzone/acme4j/OrderTest.java | 4 +- .../acme4j/RegistrationBuilderTest.java | 4 +- .../shredzone/acme4j/RegistrationTest.java | 24 +- .../org/shredzone/acme4j/SessionTest.java | 4 +- .../acme4j/challenge/ChallengeTest.java | 28 +- .../acme4j/challenge/DnsChallengeTest.java | 4 +- .../acme4j/challenge/HttpChallengeTest.java | 6 +- .../challenge/OutOfBandChallengeTest.java | 4 +- .../challenge/TlsSni02ChallengeTest.java | 4 +- .../connector/DefaultConnectionTest.java | 2 +- .../provider/AbstractAcmeProviderTest.java | 6 +- .../org/shredzone/acme4j/util/JSONTest.java | 18 +- .../org/shredzone/acme4j/util/TestUtils.java | 25 +- .../src/test/resources/json.properties | 297 ------------------ .../json/authorizationChallenges.json | 27 ++ .../src/test/resources/json/datatypes.json | 12 + .../src/test/resources/json/directory.json | 20 ++ .../test/resources/json/directoryNoMeta.json | 5 + .../src/test/resources/json/dnsChallenge.json | 5 + .../test/resources/json/genericChallenge.json | 6 + .../test/resources/json/httpChallenge.json | 5 + .../resources/json/httpNoTokenChallenge.json | 4 + .../resources/json/modifyRegistration.json | 7 + .../json/modifyRegistrationResponse.json | 7 + .../json/newAuthorizationRequest.json | 7 + .../json/newAuthorizationResponse.json | 21 ++ .../test/resources/json/newRegistration.json | 7 + .../json/newRegistrationResponse.json | 6 + .../src/test/resources/json/oobChallenge.json | 4 + .../json/requestCertificateRequest.json | 4 + .../requestCertificateRequestWithDate.json | 6 + .../resources/json/requestOrderRequest.json | 5 + .../resources/json/requestOrderResponse.json | 11 + .../json/revokeCertificateRequest.json | 4 + .../revokeCertificateWithReasonRequest.json | 5 + .../resources/json/tlsSni02Challenge.json | 5 + .../resources/json/triggerHttpChallenge.json | 6 + .../json/triggerHttpChallengeRequest.json | 6 + .../json/triggerHttpChallengeResponse.json | 7 + .../json/updateAuthorizationResponse.json | 22 ++ .../json/updateHttpChallengeResponse.json | 7 + .../resources/json/updateOrderResponse.json | 12 + .../resources/json/updateRegistration.json | 3 + .../json/updateRegistrationResponse.json | 9 + 46 files changed, 322 insertions(+), 375 deletions(-) delete mode 100644 acme4j-client/src/test/resources/json.properties create mode 100644 acme4j-client/src/test/resources/json/authorizationChallenges.json create mode 100644 acme4j-client/src/test/resources/json/datatypes.json create mode 100644 acme4j-client/src/test/resources/json/directory.json create mode 100644 acme4j-client/src/test/resources/json/directoryNoMeta.json create mode 100644 acme4j-client/src/test/resources/json/dnsChallenge.json create mode 100644 acme4j-client/src/test/resources/json/genericChallenge.json create mode 100644 acme4j-client/src/test/resources/json/httpChallenge.json create mode 100644 acme4j-client/src/test/resources/json/httpNoTokenChallenge.json create mode 100644 acme4j-client/src/test/resources/json/modifyRegistration.json create mode 100644 acme4j-client/src/test/resources/json/modifyRegistrationResponse.json create mode 100644 acme4j-client/src/test/resources/json/newAuthorizationRequest.json create mode 100644 acme4j-client/src/test/resources/json/newAuthorizationResponse.json create mode 100644 acme4j-client/src/test/resources/json/newRegistration.json create mode 100644 acme4j-client/src/test/resources/json/newRegistrationResponse.json create mode 100644 acme4j-client/src/test/resources/json/oobChallenge.json create mode 100644 acme4j-client/src/test/resources/json/requestCertificateRequest.json create mode 100644 acme4j-client/src/test/resources/json/requestCertificateRequestWithDate.json create mode 100644 acme4j-client/src/test/resources/json/requestOrderRequest.json create mode 100644 acme4j-client/src/test/resources/json/requestOrderResponse.json create mode 100644 acme4j-client/src/test/resources/json/revokeCertificateRequest.json create mode 100644 acme4j-client/src/test/resources/json/revokeCertificateWithReasonRequest.json create mode 100644 acme4j-client/src/test/resources/json/tlsSni02Challenge.json create mode 100644 acme4j-client/src/test/resources/json/triggerHttpChallenge.json create mode 100644 acme4j-client/src/test/resources/json/triggerHttpChallengeRequest.json create mode 100644 acme4j-client/src/test/resources/json/triggerHttpChallengeResponse.json create mode 100644 acme4j-client/src/test/resources/json/updateAuthorizationResponse.json create mode 100644 acme4j-client/src/test/resources/json/updateHttpChallengeResponse.json create mode 100644 acme4j-client/src/test/resources/json/updateOrderResponse.json create mode 100644 acme4j-client/src/test/resources/json/updateRegistration.json create mode 100644 acme4j-client/src/test/resources/json/updateRegistrationResponse.json diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/AuthorizationTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/AuthorizationTest.java index 15032f44..ef104cc5 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/AuthorizationTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/AuthorizationTest.java @@ -104,7 +104,7 @@ public class AuthorizationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateAuthorizationResponse"); + return getJSON("updateAuthorizationResponse"); } @Override @@ -157,7 +157,7 @@ public class AuthorizationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateAuthorizationResponse"); + return getJSON("updateAuthorizationResponse"); } @Override @@ -210,7 +210,7 @@ public class AuthorizationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateAuthorizationResponse"); + return getJSON("updateAuthorizationResponse"); } @Override @@ -288,7 +288,7 @@ public class AuthorizationTest { provider.putTestChallenge(DUPLICATE_TYPE, new Challenge(session)); Authorization authorization = new Authorization(session, locationUrl); - authorization.unmarshalAuthorization(getJsonAsObject("authorizationChallenges")); + authorization.unmarshalAuthorization(getJSON("authorizationChallenges")); return authorization; } } diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/CertificateTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/CertificateTest.java index 492a2790..b7377e6d 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/CertificateTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/CertificateTest.java @@ -153,7 +153,7 @@ public class CertificateTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("revokeCertificateRequest"))); + assertThat(claims.toString(), sameJSONAs(getJSON("revokeCertificateRequest").toString())); assertThat(session, is(notNullValue())); } @@ -183,7 +183,7 @@ public class CertificateTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("revokeCertificateWithReasonRequest"))); + assertThat(claims.toString(), sameJSONAs(getJSON("revokeCertificateWithReasonRequest").toString())); assertThat(session, is(notNullValue())); } diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/OrderTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/OrderTest.java index c67c742a..284f9400 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/OrderTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/OrderTest.java @@ -57,7 +57,7 @@ public class OrderTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateOrderResponse"); + return getJSON("updateOrderResponse"); } }; @@ -107,7 +107,7 @@ public class OrderTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateOrderResponse"); + return getJSON("updateOrderResponse"); } }; diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationBuilderTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationBuilderTest.java index c7acda65..5008e952 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationBuilderTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationBuilderTest.java @@ -56,7 +56,7 @@ public class RegistrationBuilderTest { public void sendJwkSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(session, is(notNullValue())); assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("newRegistration"))); + assertThat(claims.toString(), sameJSONAs(getJSON("newRegistration").toString())); isUpdate = false; } @@ -78,7 +78,7 @@ public class RegistrationBuilderTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("newRegistrationResponse"); + return getJSON("newRegistrationResponse"); } }; diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java index 2df2a1cc..3cba54e9 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/RegistrationTest.java @@ -75,9 +75,9 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(locationUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("updateRegistration"))); + assertThat(claims.toString(), sameJSONAs(getJSON("updateRegistration").toString())); assertThat(session, is(notNullValue())); - jsonResponse = getJsonAsObject("updateRegistrationResponse"); + jsonResponse = getJSON("updateRegistrationResponse"); response = HttpURLConnection.HTTP_ACCEPTED; } @@ -179,7 +179,7 @@ public class RegistrationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateRegistrationResponse"); + return getJSON("updateRegistrationResponse"); } @Override @@ -226,7 +226,7 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("newAuthorizationRequest"))); + assertThat(claims.toString(), sameJSONAs(getJSON("newAuthorizationRequest").toString())); assertThat(session, is(notNullValue())); } @@ -238,7 +238,7 @@ public class RegistrationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("newAuthorizationResponse"); + return getJSON("newAuthorizationResponse"); } @Override @@ -307,7 +307,7 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("requestOrderRequest"))); + assertThat(claims.toString(), sameJSONAs(getJSON("requestOrderRequest").toString())); assertThat(session, is(notNullValue())); } @@ -319,7 +319,7 @@ public class RegistrationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("requestOrderResponse"); + return getJSON("requestOrderResponse"); } @Override @@ -374,7 +374,7 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("requestCertificateRequestWithDate"))); + assertThat(claims.toString(), sameJSONAs(getJSON("requestCertificateRequestWithDate").toString())); assertThat(session, is(notNullValue())); } @@ -430,7 +430,7 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("requestCertificateRequest"))); + assertThat(claims.toString(), sameJSONAs(getJSON("requestCertificateRequest").toString())); assertThat(session, is(notNullValue())); } @@ -478,7 +478,7 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("requestCertificateRequestWithDate"))); + assertThat(claims.toString(), sameJSONAs(getJSON("requestCertificateRequestWithDate").toString())); assertThat(session, is(notNullValue())); } @@ -650,7 +650,7 @@ public class RegistrationTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(locationUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("modifyRegistration"))); + assertThat(claims.toString(), sameJSONAs(getJSON("modifyRegistration").toString())); assertThat(session, is(notNullValue())); } @@ -662,7 +662,7 @@ public class RegistrationTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("modifyRegistrationResponse"); + return getJSON("modifyRegistrationResponse"); } @Override diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java index 1b786701..cd422796 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/SessionTest.java @@ -164,7 +164,7 @@ public class SessionTest { when(mockProvider.directory( ArgumentMatchers.any(Session.class), ArgumentMatchers.eq(serverUri))) - .thenReturn(getJsonAsObject("directory")); + .thenReturn(getJSON("directory")); Session session = new Session(serverUri, keyPair) { @Override @@ -202,7 +202,7 @@ public class SessionTest { when(mockProvider.directory( ArgumentMatchers.any(Session.class), ArgumentMatchers.eq(serverUri))) - .thenReturn(getJsonAsObject("directoryNoMeta")); + .thenReturn(getJSON("directoryNoMeta")); Session session = new Session(serverUri, keyPair) { @Override diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/ChallengeTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/ChallengeTest.java index e305db30..fdb826d4 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/ChallengeTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/ChallengeTest.java @@ -73,7 +73,7 @@ public class ChallengeTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateHttpChallengeResponse"); + return getJSON("updateHttpChallengeResponse"); } }; @@ -105,7 +105,7 @@ public class ChallengeTest { assertThat(challenge.getValidated(), is(nullValue())); // Unmarshall a challenge JSON - challenge.unmarshall(getJsonAsObject("genericChallenge")); + challenge.unmarshall(getJSON("genericChallenge")); // Test unmarshalled values assertThat(challenge.getType(), is("generic-01")); @@ -123,10 +123,8 @@ public class ChallengeTest { */ @Test public void testRespond() throws JoseException { - String json = TestUtils.getJson("genericChallenge"); - Challenge challenge = new Challenge(session); - challenge.unmarshall(JSON.parse(json)); + challenge.unmarshall(getJSON("genericChallenge")); JSONBuilder cb = new JSONBuilder(); challenge.respond(cb); @@ -140,7 +138,7 @@ public class ChallengeTest { @Test(expected = AcmeProtocolException.class) public void testNotAcceptable() throws URISyntaxException { Http01Challenge challenge = new Http01Challenge(session); - challenge.unmarshall(getJsonAsObject("dnsChallenge")); + challenge.unmarshall(getJSON("dnsChallenge")); } /** @@ -152,7 +150,7 @@ public class ChallengeTest { @Override public void sendSignedRequest(URL url, JSONBuilder claims, Session session) { assertThat(url, is(resourceUrl)); - assertThat(claims.toString(), sameJSONAs(getJson("triggerHttpChallengeRequest"))); + assertThat(claims.toString(), sameJSONAs(getJSON("triggerHttpChallengeRequest").toString())); assertThat(session, is(notNullValue())); } @@ -165,14 +163,14 @@ public class ChallengeTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("triggerHttpChallengeResponse"); + return getJSON("triggerHttpChallengeResponse"); } }; Session session = provider.createSession(); Http01Challenge challenge = new Http01Challenge(session); - challenge.unmarshall(getJsonAsObject("triggerHttpChallenge")); + challenge.unmarshall(getJSON("triggerHttpChallenge")); challenge.trigger(); @@ -202,7 +200,7 @@ public class ChallengeTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateHttpChallengeResponse"); + return getJSON("updateHttpChallengeResponse"); } @Override @@ -214,7 +212,7 @@ public class ChallengeTest { Session session = provider.createSession(); Challenge challenge = new Http01Challenge(session); - challenge.unmarshall(getJsonAsObject("triggerHttpChallengeResponse")); + challenge.unmarshall(getJSON("triggerHttpChallengeResponse")); challenge.update(); @@ -246,7 +244,7 @@ public class ChallengeTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateHttpChallengeResponse"); + return getJSON("updateHttpChallengeResponse"); } @@ -259,7 +257,7 @@ public class ChallengeTest { Session session = provider.createSession(); Challenge challenge = new Http01Challenge(session); - challenge.unmarshall(getJsonAsObject("triggerHttpChallengeResponse")); + challenge.unmarshall(getJSON("triggerHttpChallengeResponse")); try { challenge.update(); @@ -314,7 +312,7 @@ public class ChallengeTest { @Override public JSON readJsonResponse() { - return getJsonAsObject("updateRegistrationResponse"); + return getJSON("updateRegistrationResponse"); } }; @@ -330,7 +328,7 @@ public class ChallengeTest { @Test(expected = IllegalArgumentException.class) public void testBadUnmarshall() { Challenge challenge = new Challenge(session); - challenge.unmarshall(getJsonAsObject("updateRegistrationResponse")); + challenge.unmarshall(getJSON("updateRegistrationResponse")); } } diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/DnsChallengeTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/DnsChallengeTest.java index 5c36bf9c..881e5da3 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/DnsChallengeTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/DnsChallengeTest.java @@ -15,7 +15,7 @@ package org.shredzone.acme4j.challenge; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; -import static org.shredzone.acme4j.util.TestUtils.getJsonAsObject; +import static org.shredzone.acme4j.util.TestUtils.getJSON; import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs; import java.io.IOException; @@ -47,7 +47,7 @@ public class DnsChallengeTest { @Test public void testDnsChallenge() throws IOException { Dns01Challenge challenge = new Dns01Challenge(session); - challenge.unmarshall(getJsonAsObject("dnsChallenge")); + challenge.unmarshall(getJSON("dnsChallenge")); assertThat(challenge.getType(), is(Dns01Challenge.TYPE)); assertThat(challenge.getStatus(), is(Status.PENDING)); diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/HttpChallengeTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/HttpChallengeTest.java index 0e048069..b0355d05 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/HttpChallengeTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/HttpChallengeTest.java @@ -15,7 +15,7 @@ package org.shredzone.acme4j.challenge; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; -import static org.shredzone.acme4j.util.TestUtils.getJsonAsObject; +import static org.shredzone.acme4j.util.TestUtils.getJSON; import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs; import java.io.IOException; @@ -50,7 +50,7 @@ public class HttpChallengeTest { @Test public void testHttpChallenge() throws IOException { Http01Challenge challenge = new Http01Challenge(session); - challenge.unmarshall(getJsonAsObject("httpChallenge")); + challenge.unmarshall(getJSON("httpChallenge")); assertThat(challenge.getType(), is(Http01Challenge.TYPE)); assertThat(challenge.getStatus(), is(Status.PENDING)); @@ -70,7 +70,7 @@ public class HttpChallengeTest { @Test(expected = AcmeProtocolException.class) public void testNoTokenSet() { Http01Challenge challenge = new Http01Challenge(session); - challenge.unmarshall(getJsonAsObject("httpNoTokenChallenge")); + challenge.unmarshall(getJSON("httpNoTokenChallenge")); challenge.getToken(); } diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/OutOfBandChallengeTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/OutOfBandChallengeTest.java index dd98d2b2..7f67a480 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/OutOfBandChallengeTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/OutOfBandChallengeTest.java @@ -15,7 +15,7 @@ package org.shredzone.acme4j.challenge; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; -import static org.shredzone.acme4j.util.TestUtils.getJsonAsObject; +import static org.shredzone.acme4j.util.TestUtils.getJSON; import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs; import java.io.IOException; @@ -45,7 +45,7 @@ public class OutOfBandChallengeTest { @Test public void testHttpChallenge() throws IOException { OutOfBand01Challenge challenge = new OutOfBand01Challenge(session); - challenge.unmarshall(getJsonAsObject("oobChallenge")); + challenge.unmarshall(getJSON("oobChallenge")); assertThat(challenge.getType(), is(OutOfBand01Challenge.TYPE)); assertThat(challenge.getStatus(), is(Status.PENDING)); diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/TlsSni02ChallengeTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/TlsSni02ChallengeTest.java index e04b201a..ce7fbc96 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/TlsSni02ChallengeTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/challenge/TlsSni02ChallengeTest.java @@ -15,7 +15,7 @@ package org.shredzone.acme4j.challenge; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; -import static org.shredzone.acme4j.util.TestUtils.getJsonAsObject; +import static org.shredzone.acme4j.util.TestUtils.getJSON; import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs; import java.io.IOException; @@ -47,7 +47,7 @@ public class TlsSni02ChallengeTest { @Test public void testTlsSni02Challenge() throws IOException { TlsSni02Challenge challenge = new TlsSni02Challenge(session); - challenge.unmarshall(getJsonAsObject("tlsSni02Challenge")); + challenge.unmarshall(getJSON("tlsSni02Challenge")); assertThat(challenge.getType(), is(TlsSni02Challenge.TYPE)); assertThat(challenge.getStatus(), is(Status.PENDING)); diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java index 8dbe484c..886e0141 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/connector/DefaultConnectionTest.java @@ -73,7 +73,7 @@ public class DefaultConnectionTest { when(mockProvider.directory( ArgumentMatchers.any(Session.class), ArgumentMatchers.eq(URI.create(TestUtils.ACME_SERVER_URI)))) - .thenReturn(TestUtils.getJsonAsObject("directory")); + .thenReturn(TestUtils.getJSON("directory")); session = TestUtils.session(mockProvider); session.setLocale(Locale.JAPAN); diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/provider/AbstractAcmeProviderTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/provider/AbstractAcmeProviderTest.java index 2a7c73bf..40eeef70 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/provider/AbstractAcmeProviderTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/provider/AbstractAcmeProviderTest.java @@ -17,7 +17,7 @@ import static org.hamcrest.Matchers.*; import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; -import static org.shredzone.acme4j.util.TestUtils.getJsonAsObject; +import static org.shredzone.acme4j.util.TestUtils.getJSON; import static uk.co.datumedge.hamcrest.json.SameJSONAs.sameJSONAs; import java.net.HttpURLConnection; @@ -86,7 +86,7 @@ public class AbstractAcmeProviderTest { final Session session = mock(Session.class); when(connection.accept(any(Integer.class))).thenReturn(HttpURLConnection.HTTP_OK); - when(connection.readJsonResponse()).thenReturn(getJsonAsObject("directory")); + when(connection.readJsonResponse()).thenReturn(getJSON("directory")); AbstractAcmeProvider provider = new AbstractAcmeProvider() { @Override @@ -108,7 +108,7 @@ public class AbstractAcmeProviderTest { }; JSON map = provider.directory(session, testServerUri); - assertThat(map.toString(), sameJSONAs(TestUtils.getJson("directory"))); + assertThat(map.toString(), sameJSONAs(TestUtils.getJSON("directory").toString())); verify(connection).sendRequest(testResolvedUrl, session); verify(connection).accept(any(Integer.class)); diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/util/JSONTest.java b/acme4j-client/src/test/java/org/shredzone/acme4j/util/JSONTest.java index 1c8b43d1..443c78bd 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/util/JSONTest.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/util/JSONTest.java @@ -82,7 +82,7 @@ public class JSONTest { */ @Test public void testObject() { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); assertThat(json.keySet(), containsInAnyOrder( "text", "number", "boolean", "uri", "url", "date", "array", @@ -98,7 +98,7 @@ public class JSONTest { */ @Test public void testArray() { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); JSON.Array array = json.get("array").asArray(); assertThat(array.size(), is(4)); @@ -114,7 +114,7 @@ public class JSONTest { */ @Test public void testEmptyArray() { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); JSON.Array array = json.get("missingArray").asArray(); assertThat(array.size(), is(0)); @@ -127,7 +127,7 @@ public class JSONTest { */ @Test public void testArrayIterator() { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); JSON.Array array = json.get("array").asArray(); Iterator it = array.iterator(); @@ -165,7 +165,7 @@ public class JSONTest { */ @Test public void testArrayStream() { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); JSON.Array array = json.get("array").asArray(); List streamValues = array.stream().collect(Collectors.toList()); @@ -186,7 +186,7 @@ public class JSONTest { public void testGetter() { Instant date = LocalDate.of(2016, 1, 8).atStartOfDay(ZoneId.of("UTC")).toInstant(); - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); assertThat(json.get("text").asString(), is("lorem ipsum")); assertThat(json.get("number").asInt(), is(123)); @@ -215,7 +215,7 @@ public class JSONTest { */ @Test public void testNullGetter() throws MalformedURLException { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); assertThat(json.get("none"), is(notNullValue())); assertThat(json.get("none").asString(), is(nullValue())); @@ -256,7 +256,7 @@ public class JSONTest { */ @Test public void testWrongGetter() throws MalformedURLException { - JSON json = TestUtils.getJsonAsObject("json"); + JSON json = TestUtils.getJSON("datatypes"); try { json.get("text").asObject(); @@ -306,7 +306,7 @@ public class JSONTest { */ @Test public void testSerialization() throws IOException, ClassNotFoundException { - JSON originalJson = TestUtils.getJsonAsObject("newAuthorizationResponse"); + JSON originalJson = TestUtils.getJSON("newAuthorizationResponse"); // Serialize byte[] data; diff --git a/acme4j-client/src/test/java/org/shredzone/acme4j/util/TestUtils.java b/acme4j-client/src/test/java/org/shredzone/acme4j/util/TestUtils.java index 8a735d07..9f475085 100644 --- a/acme4j-client/src/test/java/org/shredzone/acme4j/util/TestUtils.java +++ b/acme4j-client/src/test/java/org/shredzone/acme4j/util/TestUtils.java @@ -17,6 +17,7 @@ import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.UncheckedIOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; @@ -38,7 +39,6 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Arrays; import java.util.Map; -import java.util.ResourceBundle; import java.util.TreeMap; import org.hamcrest.BaseMatcher; @@ -67,8 +67,6 @@ public final class TestUtils { public static final String ACME_SERVER_URI = "https://example.com/acme"; - private static final ResourceBundle JSON_RESOURCE = ResourceBundle.getBundle("json"); - private TestUtils() { // utility class without constructor } @@ -93,25 +91,18 @@ public final class TestUtils { } /** - * Reads a JSON string from {@code json.properties}. - * - * @param key - * JSON resource - * @return Resource contents as string - */ - public static String getJson(String key) { - return JSON_RESOURCE.getString(key); - } - - /** - * Reads a JSON string from {@code json.properties} and parses it. + * Reads a JSON string from json test files and parses it. * * @param key * JSON resource * @return Parsed JSON resource */ - public static JSON getJsonAsObject(String key) { - return JSON.parse(getJson(key)); + public static JSON getJSON(String key) { + try { + return JSON.parse(TestUtils.class.getResourceAsStream("/json/" + key + ".json")); + } catch (IOException ex) { + throw new UncheckedIOException(ex); + } } /** diff --git a/acme4j-client/src/test/resources/json.properties b/acme4j-client/src/test/resources/json.properties deleted file mode 100644 index 281aac6e..00000000 --- a/acme4j-client/src/test/resources/json.properties +++ /dev/null @@ -1,297 +0,0 @@ -# -# acme4j - Java ACME client -# -# Copyright (C) 2015 Richard "Shred" Körber -# http://acme4j.shredzone.org -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# - -directory = \ - {\ - "new-reg": "https://example.com/acme/new-reg",\ - "new-authz": "https://example.com/acme/new-authz",\ - "new-cert": "https://example.com/acme/new-cert",\ - "new-nonce": "https://example.com/acme/new-nonce",\ - "meta": {\ - "terms-of-service": "https://example.com/acme/terms",\ - "website": "https://www.example.com/",\ - "caa-identities": ["example.com"],\ - "x-test-string": "foobar",\ - "x-test-uri": "https://www.example.org",\ - "x-test-array": ["foo", "bar", "barfoo"]\ - }\ - } - -directoryNoMeta = \ - {\ - "new-reg": "https://example.com/acme/new-reg",\ - "new-authz": "https://example.com/acme/new-authz",\ - "new-cert": "https://example.com/acme/new-cert"\ - } - -json = \ - {\ - "text": "lorem ipsum",\ - "number": 123,\ - "boolean": true,\ - "uri": "mailto:foo@example.com",\ - "url": "http://example.com",\ - "date": "2016-01-08T00:00:00Z",\ - "array": ["foo", 987, [1, 2, 3], {"test": "ok"}],\ - "collect": ["foo", "bar", "barfoo"],\ - "status": "VALID",\ - "binary": "Q2hhaW5zYXc"\ - } - -newRegistration = \ - {"resource":"new-reg",\ - "terms-of-service-agreed":true,\ - "contact":["mailto:foo@example.com"]} - -newRegistrationResponse = \ - {"terms-of-service-agreed":true,\ - "contact":["mailto:foo@example.com"]} - -modifyRegistration = \ - {"resource":"reg",\ - "contact":["mailto:foo2@example.com","mailto:foo3@example.com"]} - -modifyRegistrationResponse = \ - {"terms-of-service-agreed":true,\ - "contact":["mailto:foo2@example.com","mailto:foo3@example.com"]} - -updateRegistration = \ - {"resource":"reg"} - -updateRegistrationResponse = \ - {"contact":["mailto:foo2@example.com"],\ - "status":"good",\ - "terms-of-service-agreed":true,\ - "authorizations":"https://example.com/acme/reg/1/authz",\ - "certificates":"https://example.com/acme/reg/1/cert"} - -newAuthorizationRequest = \ - {"resource":"new-authz",\ - "identifier":{"type":"dns","value":"example.org"}} - -newAuthorizationResponse = \ - {\ - "status": "pending",\ - "identifier": {\ - "type": "dns",\ - "value": "example.org"\ - },\ - "challenges": [\ - {\ - "type": "http-01",\ - "status":"pending",\ - "uri": "https://example.com/authz/asdf/0",\ - "token": "IlirfxKKXAsHtmzK29Pj8A"\ - },\ - {\ - "type": "dns-01",\ - "status":"pending",\ - "uri": "https://example.com/authz/asdf/1",\ - "token": "DGyRejmCefe7v4NfDGDKfA"\ - }\ - ]\ - } - -updateAuthorizationResponse = \ - {\ - "status": "valid",\ - "expires": "2016-01-02T17:12:40Z",\ - "identifier": {\ - "type": "dns",\ - "value": "example.org"\ - },\ - "challenges": [\ - {\ - "type": "http-01",\ - "status":"pending",\ - "uri": "https://example.com/authz/asdf/0",\ - "token": "IlirfxKKXAsHtmzK29Pj8A"\ - },\ - {\ - "type": "dns-01",\ - "status":"pending",\ - "uri": "https://example.com/authz/asdf/1",\ - "token": "DGyRejmCefe7v4NfDGDKfA"\ - }\ - ]\ - } - -requestOrderRequest = \ - {\ - "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb",\ - "notBefore": "2016-01-01T00:00:00Z",\ - "notAfter": "2016-01-08T00:00:00Z"\ - } - -requestOrderResponse = \ - {\ - "status": "pending",\ - "expires": "2016-01-01T00:00:00Z",\ - "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb",\ - "notBefore": "2016-01-01T00:00:00Z",\ - "notAfter": "2016-01-08T00:00:00Z",\ - "authorizations": [\ - "https://example.com/acme/authz/1234",\ - "https://example.com/acme/authz/2345"\ - ]\ - } - -updateOrderResponse = \ - {\ - "status": "pending",\ - "expires": "2015-03-01T14:09:00Z",\ - "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb",\ - "notBefore": "2016-01-01T00:00:00Z",\ - "notAfter": "2016-01-08T00:00:00Z",\ - "authorizations": [\ - "https://example.com/acme/authz/1234",\ - "https://example.com/acme/authz/2345"\ - ],\ - "certificate": "https://example.com/acme/cert/1234"\ - } - -triggerHttpChallenge = \ - {\ - "type": "http-01",\ - "status":"pending",\ - "uri": "https://example.com/acme/some-resource",\ - "token": "IlirfxKKXAsHtmzK29Pj8A"\ - } - -triggerHttpChallengeRequest = \ - {\ - "resource": "challenge",\ - "type": "http-01",\ - "token": "IlirfxKKXAsHtmzK29Pj8A",\ - "keyAuthorization":"IlirfxKKXAsHtmzK29Pj8A.HnWjTDnyqlCrm6tZ-6wX-TrEXgRdeNu9G71gqxSO6o0"\ - } - -triggerHttpChallengeResponse = \ - {\ - "type":"http-01",\ - "status":"pending",\ - "uri":"https://example.com/acme/some-location",\ - "token": "IlirfxKKXAsHtmzK29Pj8A"\ - "keyAuthorization":"XbmEGDDc2AMDArHLt5x7GxZfIRv0aScknUKlyf5S4KU.KMH_h8aGAKlY3VQqBUczm1cfo9kaovivy59rSY1xZ0E"\ - } - -updateHttpChallengeResponse = \ - {\ - "type":"http-01",\ - "status":"valid",\ - "uri":"https://example.com/acme/some-location",\ - "token": "IlirfxKKXAsHtmzK29Pj8A"\ - "keyAuthorization":"XbmEGDDc2AMDArHLt5x7GxZfIRv0aScknUKlyf5S4KU.KMH_h8aGAKlY3VQqBUczm1cfo9kaovivy59rSY1xZ0E"\ - } - -requestCertificateRequest = \ - {\ - "csr":"MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb",\ - "resource":"new-cert"\ - } - -requestCertificateRequestWithDate = \ - {\ - "csr":"MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb",\ - "notBefore": "2016-01-01T00:00:00Z",\ - "notAfter": "2016-01-08T00:00:00Z",\ - "resource":"new-cert"\ - } - -revokeCertificateRequest = \ - {\ - "certificate": "MIIDVzCCAj-gAwIBAgIJAM4KDTzb0Y7NMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQwHhcNMTUxMjEwMDAxMTA4WhcNMjUxMjA3MDAxMTA4WjBCMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr0g3w4C8xbj_5lzJiDxk0HkEJeZeyruq-0AzOPMigJZ7zxZtX_KUxOIHrQ4qjcFhl0DmQImoM0wESU-kcsjAHCx8E1lgRVlVsMfLAQPHkg5UybqfadzKT3ALcSD-9F9mVIP6liC_6KzLTASmx6zM7j92KTl1ArObZr5mh0jvSNORrMhEC4Byn3-NTxjuHON1rWppCMwpeNNhFzaAig3O8PY8IyaLXNP2Ac5pXn0iW16S-Im9by7751UeW5a7DznmuMEM-WY640ffJDQ4-I64H403uAgvvSu-BGw8SEEZGuBCxoCnG1g6y6OvJyN5TgqFdGosAfm1u-_MP1seoPdpBQIDAQABo1AwTjAdBgNVHQ4EFgQUrie5ZLOrA_HuhW1b_CHjzEvj34swHwYDVR0jBBgwFoAUrie5ZLOrA_HuhW1b_CHjzEvj34swDAYDVR0TBAUwAwEB_zANBgkqhkiG9w0BAQsFAAOCAQEAkSOP0FUgIIUeJTObgXrenHzZpLAkqXi37dgdYuPhNveo3agueP51N7yIoh6YGShiJ73Rvr-lVYTwFXStrLih1Wh3tWvksMxnvocgd7l6USRb5_AgH7eHeFK4DoCAak2hUAcCLDRJN3XMhNLpyJhw7GJxowVIGUlxcW5Asrmh9qflfyMyjripTP3CdHobmNcNHyScjNncKj37m8vomel9acekTtDl2Ci7nLdE-3VqQCXMIfLiF3PO0gGpKei0RuVCSOG6W83zVInCPd_l3aluSR-f_VZlk8KGQ4As4uTQi89j-J1YepzG0ASMZpjVbXeIg5QBAywVxBh5XVTz37KN8A",\ - "resource":"revoke-cert"\ - } - -revokeCertificateWithReasonRequest = \ - {\ - "certificate": "MIIDVzCCAj-gAwIBAgIJAM4KDTzb0Y7NMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQwHhcNMTUxMjEwMDAxMTA4WhcNMjUxMjA3MDAxMTA4WjBCMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr0g3w4C8xbj_5lzJiDxk0HkEJeZeyruq-0AzOPMigJZ7zxZtX_KUxOIHrQ4qjcFhl0DmQImoM0wESU-kcsjAHCx8E1lgRVlVsMfLAQPHkg5UybqfadzKT3ALcSD-9F9mVIP6liC_6KzLTASmx6zM7j92KTl1ArObZr5mh0jvSNORrMhEC4Byn3-NTxjuHON1rWppCMwpeNNhFzaAig3O8PY8IyaLXNP2Ac5pXn0iW16S-Im9by7751UeW5a7DznmuMEM-WY640ffJDQ4-I64H403uAgvvSu-BGw8SEEZGuBCxoCnG1g6y6OvJyN5TgqFdGosAfm1u-_MP1seoPdpBQIDAQABo1AwTjAdBgNVHQ4EFgQUrie5ZLOrA_HuhW1b_CHjzEvj34swHwYDVR0jBBgwFoAUrie5ZLOrA_HuhW1b_CHjzEvj34swDAYDVR0TBAUwAwEB_zANBgkqhkiG9w0BAQsFAAOCAQEAkSOP0FUgIIUeJTObgXrenHzZpLAkqXi37dgdYuPhNveo3agueP51N7yIoh6YGShiJ73Rvr-lVYTwFXStrLih1Wh3tWvksMxnvocgd7l6USRb5_AgH7eHeFK4DoCAak2hUAcCLDRJN3XMhNLpyJhw7GJxowVIGUlxcW5Asrmh9qflfyMyjripTP3CdHobmNcNHyScjNncKj37m8vomel9acekTtDl2Ci7nLdE-3VqQCXMIfLiF3PO0gGpKei0RuVCSOG6W83zVInCPd_l3aluSR-f_VZlk8KGQ4As4uTQi89j-J1YepzG0ASMZpjVbXeIg5QBAywVxBh5XVTz37KN8A",\ - "resource":"revoke-cert",\ - "reason": 1\ - } - -authorizationChallenges = \ - {\ - "challenges": [\ - {\ - "type": "http-01",\ - "uri": "https://example.com/authz/asdf/0",\ - "token": "IlirfxKKXAsHtmzK29Pj8A"\ - },\ - {\ - "type": "dns-01",\ - "uri": "https://example.com/authz/asdf/1",\ - "token": "DGyRejmCefe7v4NfDGDKfA"\ - },\ - {\ - "type": "tls-sni-02",\ - "uri": "https://example.com/authz/asdf/2",\ - "token": "VNLBdSiZ3LppU2CRG8bilqlwq4DuApJMg3ZJowU6JhQ"\ - },\ - {\ - "type": "duplicate-01",\ - "uri": "https://example.com/authz/asdf/3"\ - },\ - {\ - "type": "duplicate-01",\ - "uri": "https://example.com/authz/asdf/4"\ - }\ - ]\ - } - - - -dnsChallenge = \ - { \ - "type":"dns-01", \ - "status":"pending", \ - "token": "pNvmJivs0WCko2suV7fhe-59oFqyYx_yB7tx6kIMAyE" \ - } - -genericChallenge = \ - { \ - "type":"generic-01", \ - "status":"valid", \ - "uri":"http://example.com/challenge/123", \ - "validated":"2015-12-12T17:19:36.336785823Z" \ - } - -httpChallenge = \ - { \ - "type":"http-01", \ - "status":"pending", \ - "token": "rSoI9JpyvFi-ltdnBW0W1DjKstzG7cHixjzcOjwzAEQ" \ - } - -httpNoTokenChallenge = \ - { \ - "type":"http-01", \ - "status":"pending" \ - } - -tlsSni02Challenge = \ - { \ - "type":"tls-sni-02", \ - "status":"pending", \ - "token": "VNLBdSiZ3LppU2CRG8bilqlwq4DuApJMg3ZJowU6JhQ" \ - } - -oobChallenge = \ - { \ - "type": "oob-01", \ - "href": "https://example.com/validate/evaGxfADs6pSRb2LAv9IZ" \ - } - -# \ No newline at end of file diff --git a/acme4j-client/src/test/resources/json/authorizationChallenges.json b/acme4j-client/src/test/resources/json/authorizationChallenges.json new file mode 100644 index 00000000..3bc173e7 --- /dev/null +++ b/acme4j-client/src/test/resources/json/authorizationChallenges.json @@ -0,0 +1,27 @@ +{ + "challenges": [ + { + "type": "http-01", + "uri": "https://example.com/authz/asdf/0", + "token": "IlirfxKKXAsHtmzK29Pj8A" + }, + { + "type": "dns-01", + "uri": "https://example.com/authz/asdf/1", + "token": "DGyRejmCefe7v4NfDGDKfA" + }, + { + "type": "tls-sni-02", + "uri": "https://example.com/authz/asdf/2", + "token": "VNLBdSiZ3LppU2CRG8bilqlwq4DuApJMg3ZJowU6JhQ" + }, + { + "type": "duplicate-01", + "uri": "https://example.com/authz/asdf/3" + }, + { + "type": "duplicate-01", + "uri": "https://example.com/authz/asdf/4" + } + ] +} diff --git a/acme4j-client/src/test/resources/json/datatypes.json b/acme4j-client/src/test/resources/json/datatypes.json new file mode 100644 index 00000000..467becd2 --- /dev/null +++ b/acme4j-client/src/test/resources/json/datatypes.json @@ -0,0 +1,12 @@ +{ + "text": "lorem ipsum", + "number": 123, + "boolean": true, + "uri": "mailto:foo@example.com", + "url": "http://example.com", + "date": "2016-01-08T00:00:00Z", + "array": ["foo", 987, [1, 2, 3], {"test": "ok"}], + "collect": ["foo", "bar", "barfoo"], + "status": "VALID", + "binary": "Q2hhaW5zYXc" +} diff --git a/acme4j-client/src/test/resources/json/directory.json b/acme4j-client/src/test/resources/json/directory.json new file mode 100644 index 00000000..86377617 --- /dev/null +++ b/acme4j-client/src/test/resources/json/directory.json @@ -0,0 +1,20 @@ +{ + "new-reg": "https://example.com/acme/new-reg", + "new-authz": "https://example.com/acme/new-authz", + "new-cert": "https://example.com/acme/new-cert", + "new-nonce": "https://example.com/acme/new-nonce", + "meta": { + "terms-of-service": "https://example.com/acme/terms", + "website": "https://www.example.com/", + "caa-identities": [ + "example.com" + ], + "x-test-string": "foobar", + "x-test-uri": "https://www.example.org", + "x-test-array": [ + "foo", + "bar", + "barfoo" + ] + } +} diff --git a/acme4j-client/src/test/resources/json/directoryNoMeta.json b/acme4j-client/src/test/resources/json/directoryNoMeta.json new file mode 100644 index 00000000..42aca4e3 --- /dev/null +++ b/acme4j-client/src/test/resources/json/directoryNoMeta.json @@ -0,0 +1,5 @@ +{ + "new-reg": "https://example.com/acme/new-reg", + "new-authz": "https://example.com/acme/new-authz", + "new-cert": "https://example.com/acme/new-cert" +} diff --git a/acme4j-client/src/test/resources/json/dnsChallenge.json b/acme4j-client/src/test/resources/json/dnsChallenge.json new file mode 100644 index 00000000..361698b7 --- /dev/null +++ b/acme4j-client/src/test/resources/json/dnsChallenge.json @@ -0,0 +1,5 @@ +{ + "type": "dns-01", + "status": "pending", + "token": "pNvmJivs0WCko2suV7fhe-59oFqyYx_yB7tx6kIMAyE" +} diff --git a/acme4j-client/src/test/resources/json/genericChallenge.json b/acme4j-client/src/test/resources/json/genericChallenge.json new file mode 100644 index 00000000..c2a9536b --- /dev/null +++ b/acme4j-client/src/test/resources/json/genericChallenge.json @@ -0,0 +1,6 @@ +{ + "type": "generic-01", + "status": "valid", + "uri": "http://example.com/challenge/123", + "validated": "2015-12-12T17:19:36.336785823Z" +} diff --git a/acme4j-client/src/test/resources/json/httpChallenge.json b/acme4j-client/src/test/resources/json/httpChallenge.json new file mode 100644 index 00000000..7431e9f5 --- /dev/null +++ b/acme4j-client/src/test/resources/json/httpChallenge.json @@ -0,0 +1,5 @@ +{ + "type": "http-01", + "status": "pending", + "token": "rSoI9JpyvFi-ltdnBW0W1DjKstzG7cHixjzcOjwzAEQ" +} diff --git a/acme4j-client/src/test/resources/json/httpNoTokenChallenge.json b/acme4j-client/src/test/resources/json/httpNoTokenChallenge.json new file mode 100644 index 00000000..c6685a2f --- /dev/null +++ b/acme4j-client/src/test/resources/json/httpNoTokenChallenge.json @@ -0,0 +1,4 @@ +{ + "type": "http-01", + "status": "pending" +} diff --git a/acme4j-client/src/test/resources/json/modifyRegistration.json b/acme4j-client/src/test/resources/json/modifyRegistration.json new file mode 100644 index 00000000..c0e899c0 --- /dev/null +++ b/acme4j-client/src/test/resources/json/modifyRegistration.json @@ -0,0 +1,7 @@ +{ + "resource": "reg", + "contact": [ + "mailto:foo2@example.com", + "mailto:foo3@example.com" + ] +} diff --git a/acme4j-client/src/test/resources/json/modifyRegistrationResponse.json b/acme4j-client/src/test/resources/json/modifyRegistrationResponse.json new file mode 100644 index 00000000..1d8b9a53 --- /dev/null +++ b/acme4j-client/src/test/resources/json/modifyRegistrationResponse.json @@ -0,0 +1,7 @@ +{ + "terms-of-service-agreed": true, + "contact": [ + "mailto:foo2@example.com", + "mailto:foo3@example.com" + ] +} diff --git a/acme4j-client/src/test/resources/json/newAuthorizationRequest.json b/acme4j-client/src/test/resources/json/newAuthorizationRequest.json new file mode 100644 index 00000000..2cb1f3f1 --- /dev/null +++ b/acme4j-client/src/test/resources/json/newAuthorizationRequest.json @@ -0,0 +1,7 @@ +{ + "resource": "new-authz", + "identifier": { + "type": "dns", + "value": "example.org" + } +} diff --git a/acme4j-client/src/test/resources/json/newAuthorizationResponse.json b/acme4j-client/src/test/resources/json/newAuthorizationResponse.json new file mode 100644 index 00000000..49471166 --- /dev/null +++ b/acme4j-client/src/test/resources/json/newAuthorizationResponse.json @@ -0,0 +1,21 @@ +{ + "status": "pending", + "identifier": { + "type": "dns", + "value": "example.org" + }, + "challenges": [ + { + "type": "http-01", + "status": "pending", + "uri": "https://example.com/authz/asdf/0", + "token": "IlirfxKKXAsHtmzK29Pj8A" + }, + { + "type": "dns-01", + "status": "pending", + "uri": "https://example.com/authz/asdf/1", + "token": "DGyRejmCefe7v4NfDGDKfA" + } + ] +} diff --git a/acme4j-client/src/test/resources/json/newRegistration.json b/acme4j-client/src/test/resources/json/newRegistration.json new file mode 100644 index 00000000..dcc77e84 --- /dev/null +++ b/acme4j-client/src/test/resources/json/newRegistration.json @@ -0,0 +1,7 @@ +{ + "resource": "new-reg", + "terms-of-service-agreed": true, + "contact": [ + "mailto:foo@example.com" + ] +} diff --git a/acme4j-client/src/test/resources/json/newRegistrationResponse.json b/acme4j-client/src/test/resources/json/newRegistrationResponse.json new file mode 100644 index 00000000..8f018b6c --- /dev/null +++ b/acme4j-client/src/test/resources/json/newRegistrationResponse.json @@ -0,0 +1,6 @@ +{ + "terms-of-service-agreed": true, + "contact": [ + "mailto:foo@example.com" + ] +} diff --git a/acme4j-client/src/test/resources/json/oobChallenge.json b/acme4j-client/src/test/resources/json/oobChallenge.json new file mode 100644 index 00000000..31b55cc5 --- /dev/null +++ b/acme4j-client/src/test/resources/json/oobChallenge.json @@ -0,0 +1,4 @@ +{ + "type": "oob-01", + "href": "https://example.com/validate/evaGxfADs6pSRb2LAv9IZ" +} diff --git a/acme4j-client/src/test/resources/json/requestCertificateRequest.json b/acme4j-client/src/test/resources/json/requestCertificateRequest.json new file mode 100644 index 00000000..034942de --- /dev/null +++ b/acme4j-client/src/test/resources/json/requestCertificateRequest.json @@ -0,0 +1,4 @@ +{ + "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb", + "resource": "new-cert" +} diff --git a/acme4j-client/src/test/resources/json/requestCertificateRequestWithDate.json b/acme4j-client/src/test/resources/json/requestCertificateRequestWithDate.json new file mode 100644 index 00000000..5813dd9b --- /dev/null +++ b/acme4j-client/src/test/resources/json/requestCertificateRequestWithDate.json @@ -0,0 +1,6 @@ +{ + "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb", + "notBefore": "2016-01-01T00:00:00Z", + "notAfter": "2016-01-08T00:00:00Z", + "resource": "new-cert" +} diff --git a/acme4j-client/src/test/resources/json/requestOrderRequest.json b/acme4j-client/src/test/resources/json/requestOrderRequest.json new file mode 100644 index 00000000..c6666c54 --- /dev/null +++ b/acme4j-client/src/test/resources/json/requestOrderRequest.json @@ -0,0 +1,5 @@ +{ + "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb", + "notBefore": "2016-01-01T00:00:00Z", + "notAfter": "2016-01-08T00:00:00Z" +} diff --git a/acme4j-client/src/test/resources/json/requestOrderResponse.json b/acme4j-client/src/test/resources/json/requestOrderResponse.json new file mode 100644 index 00000000..8445e004 --- /dev/null +++ b/acme4j-client/src/test/resources/json/requestOrderResponse.json @@ -0,0 +1,11 @@ +{ + "status": "pending", + "expires": "2016-01-01T00:00:00Z", + "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb", + "notBefore": "2016-01-01T00:00:00Z", + "notAfter": "2016-01-08T00:00:00Z", + "authorizations": [ + "https://example.com/acme/authz/1234", + "https://example.com/acme/authz/2345" + ] +} diff --git a/acme4j-client/src/test/resources/json/revokeCertificateRequest.json b/acme4j-client/src/test/resources/json/revokeCertificateRequest.json new file mode 100644 index 00000000..89873cf5 --- /dev/null +++ b/acme4j-client/src/test/resources/json/revokeCertificateRequest.json @@ -0,0 +1,4 @@ +{ + "certificate": "MIIDVzCCAj-gAwIBAgIJAM4KDTzb0Y7NMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQwHhcNMTUxMjEwMDAxMTA4WhcNMjUxMjA3MDAxMTA4WjBCMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr0g3w4C8xbj_5lzJiDxk0HkEJeZeyruq-0AzOPMigJZ7zxZtX_KUxOIHrQ4qjcFhl0DmQImoM0wESU-kcsjAHCx8E1lgRVlVsMfLAQPHkg5UybqfadzKT3ALcSD-9F9mVIP6liC_6KzLTASmx6zM7j92KTl1ArObZr5mh0jvSNORrMhEC4Byn3-NTxjuHON1rWppCMwpeNNhFzaAig3O8PY8IyaLXNP2Ac5pXn0iW16S-Im9by7751UeW5a7DznmuMEM-WY640ffJDQ4-I64H403uAgvvSu-BGw8SEEZGuBCxoCnG1g6y6OvJyN5TgqFdGosAfm1u-_MP1seoPdpBQIDAQABo1AwTjAdBgNVHQ4EFgQUrie5ZLOrA_HuhW1b_CHjzEvj34swHwYDVR0jBBgwFoAUrie5ZLOrA_HuhW1b_CHjzEvj34swDAYDVR0TBAUwAwEB_zANBgkqhkiG9w0BAQsFAAOCAQEAkSOP0FUgIIUeJTObgXrenHzZpLAkqXi37dgdYuPhNveo3agueP51N7yIoh6YGShiJ73Rvr-lVYTwFXStrLih1Wh3tWvksMxnvocgd7l6USRb5_AgH7eHeFK4DoCAak2hUAcCLDRJN3XMhNLpyJhw7GJxowVIGUlxcW5Asrmh9qflfyMyjripTP3CdHobmNcNHyScjNncKj37m8vomel9acekTtDl2Ci7nLdE-3VqQCXMIfLiF3PO0gGpKei0RuVCSOG6W83zVInCPd_l3aluSR-f_VZlk8KGQ4As4uTQi89j-J1YepzG0ASMZpjVbXeIg5QBAywVxBh5XVTz37KN8A", + "resource": "revoke-cert" +} diff --git a/acme4j-client/src/test/resources/json/revokeCertificateWithReasonRequest.json b/acme4j-client/src/test/resources/json/revokeCertificateWithReasonRequest.json new file mode 100644 index 00000000..abc7b6ba --- /dev/null +++ b/acme4j-client/src/test/resources/json/revokeCertificateWithReasonRequest.json @@ -0,0 +1,5 @@ +{ + "certificate": "MIIDVzCCAj-gAwIBAgIJAM4KDTzb0Y7NMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQgQ29tcGFueSBMdGQwHhcNMTUxMjEwMDAxMTA4WhcNMjUxMjA3MDAxMTA4WjBCMQswCQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZhdWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr0g3w4C8xbj_5lzJiDxk0HkEJeZeyruq-0AzOPMigJZ7zxZtX_KUxOIHrQ4qjcFhl0DmQImoM0wESU-kcsjAHCx8E1lgRVlVsMfLAQPHkg5UybqfadzKT3ALcSD-9F9mVIP6liC_6KzLTASmx6zM7j92KTl1ArObZr5mh0jvSNORrMhEC4Byn3-NTxjuHON1rWppCMwpeNNhFzaAig3O8PY8IyaLXNP2Ac5pXn0iW16S-Im9by7751UeW5a7DznmuMEM-WY640ffJDQ4-I64H403uAgvvSu-BGw8SEEZGuBCxoCnG1g6y6OvJyN5TgqFdGosAfm1u-_MP1seoPdpBQIDAQABo1AwTjAdBgNVHQ4EFgQUrie5ZLOrA_HuhW1b_CHjzEvj34swHwYDVR0jBBgwFoAUrie5ZLOrA_HuhW1b_CHjzEvj34swDAYDVR0TBAUwAwEB_zANBgkqhkiG9w0BAQsFAAOCAQEAkSOP0FUgIIUeJTObgXrenHzZpLAkqXi37dgdYuPhNveo3agueP51N7yIoh6YGShiJ73Rvr-lVYTwFXStrLih1Wh3tWvksMxnvocgd7l6USRb5_AgH7eHeFK4DoCAak2hUAcCLDRJN3XMhNLpyJhw7GJxowVIGUlxcW5Asrmh9qflfyMyjripTP3CdHobmNcNHyScjNncKj37m8vomel9acekTtDl2Ci7nLdE-3VqQCXMIfLiF3PO0gGpKei0RuVCSOG6W83zVInCPd_l3aluSR-f_VZlk8KGQ4As4uTQi89j-J1YepzG0ASMZpjVbXeIg5QBAywVxBh5XVTz37KN8A", + "resource": "revoke-cert", + "reason": 1 +} diff --git a/acme4j-client/src/test/resources/json/tlsSni02Challenge.json b/acme4j-client/src/test/resources/json/tlsSni02Challenge.json new file mode 100644 index 00000000..750c7f92 --- /dev/null +++ b/acme4j-client/src/test/resources/json/tlsSni02Challenge.json @@ -0,0 +1,5 @@ +{ + "type": "tls-sni-02", + "status": "pending", + "token": "VNLBdSiZ3LppU2CRG8bilqlwq4DuApJMg3ZJowU6JhQ" +} diff --git a/acme4j-client/src/test/resources/json/triggerHttpChallenge.json b/acme4j-client/src/test/resources/json/triggerHttpChallenge.json new file mode 100644 index 00000000..a4884947 --- /dev/null +++ b/acme4j-client/src/test/resources/json/triggerHttpChallenge.json @@ -0,0 +1,6 @@ +{ + "type": "http-01", + "status": "pending", + "uri": "https://example.com/acme/some-resource", + "token": "IlirfxKKXAsHtmzK29Pj8A" +} diff --git a/acme4j-client/src/test/resources/json/triggerHttpChallengeRequest.json b/acme4j-client/src/test/resources/json/triggerHttpChallengeRequest.json new file mode 100644 index 00000000..4c0cffe3 --- /dev/null +++ b/acme4j-client/src/test/resources/json/triggerHttpChallengeRequest.json @@ -0,0 +1,6 @@ +{ + "resource": "challenge", + "type": "http-01", + "token": "IlirfxKKXAsHtmzK29Pj8A", + "keyAuthorization": "IlirfxKKXAsHtmzK29Pj8A.HnWjTDnyqlCrm6tZ-6wX-TrEXgRdeNu9G71gqxSO6o0" +} diff --git a/acme4j-client/src/test/resources/json/triggerHttpChallengeResponse.json b/acme4j-client/src/test/resources/json/triggerHttpChallengeResponse.json new file mode 100644 index 00000000..9a5de2ed --- /dev/null +++ b/acme4j-client/src/test/resources/json/triggerHttpChallengeResponse.json @@ -0,0 +1,7 @@ +{ + "type": "http-01", + "status": "pending", + "uri": "https://example.com/acme/some-location", + "token": "IlirfxKKXAsHtmzK29Pj8A", + "keyAuthorization": "XbmEGDDc2AMDArHLt5x7GxZfIRv0aScknUKlyf5S4KU.KMH_h8aGAKlY3VQqBUczm1cfo9kaovivy59rSY1xZ0E" +} diff --git a/acme4j-client/src/test/resources/json/updateAuthorizationResponse.json b/acme4j-client/src/test/resources/json/updateAuthorizationResponse.json new file mode 100644 index 00000000..543f0b54 --- /dev/null +++ b/acme4j-client/src/test/resources/json/updateAuthorizationResponse.json @@ -0,0 +1,22 @@ +{ + "status": "valid", + "expires": "2016-01-02T17:12:40Z", + "identifier": { + "type": "dns", + "value": "example.org" + }, + "challenges": [ + { + "type": "http-01", + "status": "pending", + "uri": "https://example.com/authz/asdf/0", + "token": "IlirfxKKXAsHtmzK29Pj8A" + }, + { + "type": "dns-01", + "status": "pending", + "uri": "https://example.com/authz/asdf/1", + "token": "DGyRejmCefe7v4NfDGDKfA" + } + ] +} diff --git a/acme4j-client/src/test/resources/json/updateHttpChallengeResponse.json b/acme4j-client/src/test/resources/json/updateHttpChallengeResponse.json new file mode 100644 index 00000000..0e077165 --- /dev/null +++ b/acme4j-client/src/test/resources/json/updateHttpChallengeResponse.json @@ -0,0 +1,7 @@ +{ + "type": "http-01", + "status": "valid", + "uri": "https://example.com/acme/some-location", + "token": "IlirfxKKXAsHtmzK29Pj8A", + "keyAuthorization": "XbmEGDDc2AMDArHLt5x7GxZfIRv0aScknUKlyf5S4KU.KMH_h8aGAKlY3VQqBUczm1cfo9kaovivy59rSY1xZ0E" +} diff --git a/acme4j-client/src/test/resources/json/updateOrderResponse.json b/acme4j-client/src/test/resources/json/updateOrderResponse.json new file mode 100644 index 00000000..5718f002 --- /dev/null +++ b/acme4j-client/src/test/resources/json/updateOrderResponse.json @@ -0,0 +1,12 @@ +{ + "status": "pending", + "expires": "2015-03-01T14:09:00Z", + "csr": "MIIChDCCAWwCAQAwFjEUMBIGA1UEAwwLZXhhbXBsZS5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCPemmumcNGR0hsPo-2N6nkJ0FcEMdb0_MlucHR0dNeHEvn8vmcQHlYRjkDVX0aypnfKQI3tvhTBKLdlNvbVIW1TQ_Wbqh9TQlC8G3Hog8nRQ2vAzO4sH6nhvdrAFUmq6hkATpU3iQuDvtYu03ExaYHKsItLocl1OndaQizBn5udBv1baOW3Kd790k6lEWGrD-TXo6uwuMha2k_YBGNKd4S4UuPmbPV9SUVW8JSylBSgDhvY3BHv-dfdIMhVwRMZDFaa0mHDIYUiwcEaU5x4P6Q5bGP2wxcUPCLwFsbAK5K6B2T2P3A2fNjGBAlHwEkg6VMvi7jax8MD-oRnku2M2JLAgMBAAGgKTAnBgkqhkiG9w0BCQ4xGjAYMBYGA1UdEQQPMA2CC2V4YW1wbGUuY29tMA0GCSqGSIb3DQEBCwUAA4IBAQACnMZdjE1jVqnkHkEeGrMXujWuwuiKLZVa4YZ9fL0UIGOqqf4b9-3JmtEiLB9ycQO5N9rW4V-6_DBMeoeRBLu-wranHnxU4ds6GzNzBxKfI86_8t5pdQK4Cglv7yfseseZRdQtvcR2ejkW0F3SL1DF5Sk3T46aRYiUXxeoNC4Uh3zoIHOv8YGUa-DuZQ6OnHMhPrdsfU09L7KVAMTq1bodjGWmgoIJm4x5JSm19GbhYAm9Q9XWnN56YHqgS3FtS9n3wDxz7Dvo24whto1tUU5hnjrp31rTvyxG3kydoEZf2Ciq_82bQDb40kwnoO6RytPYJVMRIBsP2mCfaFtIt9Eb", + "notBefore": "2016-01-01T00:00:00Z", + "notAfter": "2016-01-08T00:00:00Z", + "authorizations": [ + "https://example.com/acme/authz/1234", + "https://example.com/acme/authz/2345" + ], + "certificate": "https://example.com/acme/cert/1234" +} diff --git a/acme4j-client/src/test/resources/json/updateRegistration.json b/acme4j-client/src/test/resources/json/updateRegistration.json new file mode 100644 index 00000000..b39d7f32 --- /dev/null +++ b/acme4j-client/src/test/resources/json/updateRegistration.json @@ -0,0 +1,3 @@ +{ + "resource": "reg" +} diff --git a/acme4j-client/src/test/resources/json/updateRegistrationResponse.json b/acme4j-client/src/test/resources/json/updateRegistrationResponse.json new file mode 100644 index 00000000..c3eccbb9 --- /dev/null +++ b/acme4j-client/src/test/resources/json/updateRegistrationResponse.json @@ -0,0 +1,9 @@ +{ + "contact": [ + "mailto:foo2@example.com" + ], + "status": "good", + "terms-of-service-agreed": true, + "authorizations": "https://example.com/acme/reg/1/authz", + "certificates": "https://example.com/acme/reg/1/cert" +}