mirror of https://github.com/shred/acme4j
Rename ClaimBuilder to JSONBuilder
parent
e6e5211755
commit
0ee546da8b
|
@ -29,7 +29,7 @@ import org.shredzone.acme4j.connector.Connection;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -200,7 +200,7 @@ public class Authorization extends AcmeResource {
|
|||
public void deactivate() throws AcmeException {
|
||||
LOG.debug("deactivate");
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource("authz");
|
||||
claims.put("status", "deactivated");
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.shredzone.acme4j.connector.Resource;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -176,7 +176,7 @@ public class Certificate extends AcmeResource {
|
|||
}
|
||||
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource(Resource.REVOKE_CERT);
|
||||
claims.putBase64("certificate", cert.getEncoded());
|
||||
if (reason != null) {
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.shredzone.acme4j.connector.ResourceIterator;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class Registration extends AcmeResource {
|
|||
public void update() throws AcmeException {
|
||||
LOG.debug("update");
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource("reg");
|
||||
|
||||
conn.sendSignedRequest(getLocation(), claims, getSession());
|
||||
|
@ -184,7 +184,7 @@ public class Registration extends AcmeResource {
|
|||
|
||||
LOG.debug("authorizeDomain {}", domain);
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource(Resource.NEW_AUTHZ);
|
||||
claims.object("identifier")
|
||||
.put("type", "dns")
|
||||
|
@ -235,7 +235,7 @@ public class Registration extends AcmeResource {
|
|||
|
||||
LOG.debug("requestCertificate");
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource(Resource.NEW_CERT);
|
||||
claims.putBase64("csr", csr);
|
||||
if (notBefore != null) {
|
||||
|
@ -281,7 +281,7 @@ public class Registration extends AcmeResource {
|
|||
URI keyChangeUri = getSession().resourceUri(Resource.KEY_CHANGE);
|
||||
PublicJsonWebKey newKeyJwk = PublicJsonWebKey.Factory.newPublicJwk(newKeyPair.getPublic());
|
||||
|
||||
ClaimBuilder payloadClaim = new ClaimBuilder();
|
||||
JSONBuilder payloadClaim = new JSONBuilder();
|
||||
payloadClaim.put("account", getLocation());
|
||||
payloadClaim.putKey("newKey", newKeyPair.getPublic());
|
||||
|
||||
|
@ -293,7 +293,7 @@ public class Registration extends AcmeResource {
|
|||
innerJws.setKey(newKeyPair.getPrivate());
|
||||
innerJws.sign();
|
||||
|
||||
ClaimBuilder outerClaim = new ClaimBuilder();
|
||||
JSONBuilder outerClaim = new JSONBuilder();
|
||||
outerClaim.putResource(Resource.KEY_CHANGE); // Let's Encrypt needs the resource here
|
||||
outerClaim.put("protected", innerJws.getHeaders().getEncodedHeader());
|
||||
outerClaim.put("signature", innerJws.getEncodedSignature());
|
||||
|
@ -317,7 +317,7 @@ public class Registration extends AcmeResource {
|
|||
public void deactivate() throws AcmeException {
|
||||
LOG.debug("deactivate");
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource("reg");
|
||||
claims.put("status", "deactivated");
|
||||
|
||||
|
@ -478,7 +478,7 @@ public class Registration extends AcmeResource {
|
|||
public void commit() throws AcmeException {
|
||||
LOG.debug("modify/commit");
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource("reg");
|
||||
if (!editContacts.isEmpty()) {
|
||||
claims.put("contact", editContacts);
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.shredzone.acme4j.connector.Connection;
|
|||
import org.shredzone.acme4j.connector.Resource;
|
||||
import org.shredzone.acme4j.exception.AcmeConflictException;
|
||||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -75,7 +75,7 @@ public class RegistrationBuilder {
|
|||
LOG.debug("create");
|
||||
|
||||
try (Connection conn = session.provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource(Resource.NEW_REG);
|
||||
if (!contacts.isEmpty()) {
|
||||
claims.put("contact", contacts);
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.shredzone.acme4j.connector.Connection;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
|
|||
* that is unknown to acme4j.
|
||||
* <p>
|
||||
* Subclasses must override {@link Challenge#acceptable(String)} so it only accepts the
|
||||
* own type. {@link Challenge#respond(ClaimBuilder)} should be overridden to put all
|
||||
* own type. {@link Challenge#respond(JSONBuilder)} should be overridden to put all
|
||||
* required data to the response.
|
||||
*/
|
||||
public class Challenge extends AcmeResource {
|
||||
|
@ -141,9 +141,9 @@ public class Challenge extends AcmeResource {
|
|||
* Exports the response state, as preparation for triggering the challenge.
|
||||
*
|
||||
* @param cb
|
||||
* {@link ClaimBuilder} to copy the response to
|
||||
* {@link JSONBuilder} to copy the response to
|
||||
*/
|
||||
protected void respond(ClaimBuilder cb) {
|
||||
protected void respond(JSONBuilder cb) {
|
||||
cb.put(KEY_TYPE, getType());
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ public class Challenge extends AcmeResource {
|
|||
public void trigger() throws AcmeException {
|
||||
LOG.debug("trigger");
|
||||
try (Connection conn = getSession().provider().connect()) {
|
||||
ClaimBuilder claims = new ClaimBuilder();
|
||||
JSONBuilder claims = new JSONBuilder();
|
||||
claims.putResource("challenge");
|
||||
respond(claims);
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
package org.shredzone.acme4j.challenge;
|
||||
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* Implements the {@value TYPE} challenge.
|
||||
|
@ -58,7 +58,7 @@ public class Http01Challenge extends TokenChallenge {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void respond(ClaimBuilder cb) {
|
||||
protected void respond(JSONBuilder cb) {
|
||||
super.respond(cb);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.jose4j.jwk.PublicJsonWebKey;
|
|||
import org.jose4j.lang.JoseException;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* An extension of {@link Challenge} that handles challenges with a {@code token} and
|
||||
|
@ -46,7 +46,7 @@ public class TokenChallenge extends Challenge {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void respond(ClaimBuilder cb) {
|
||||
protected void respond(JSONBuilder cb) {
|
||||
super.respond(cb);
|
||||
cb.put(KEY_TOKEN, getToken());
|
||||
cb.put(KEY_KEY_AUTHORIZATION, getAuthorization());
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Map;
|
|||
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* Connects to the ACME server and offers different methods for invoking the API.
|
||||
|
@ -44,11 +44,11 @@ public interface Connection extends AutoCloseable {
|
|||
* @param uri
|
||||
* {@link URI} to send the request to.
|
||||
* @param claims
|
||||
* {@link ClaimBuilder} containing claims. Must not be {@code null}.
|
||||
* {@link JSONBuilder} containing claims. Must not be {@code null}.
|
||||
* @param session
|
||||
* {@link Session} instance to be used for signing and tracking
|
||||
*/
|
||||
void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) throws AcmeException;
|
||||
void sendSignedRequest(URI uri, JSONBuilder claims, Session session) throws AcmeException;
|
||||
|
||||
/**
|
||||
* Checks if the HTTP response status is in the given list of acceptable HTTP states,
|
||||
|
|
|
@ -52,7 +52,7 @@ import org.shredzone.acme4j.exception.AcmeProtocolException;
|
|||
import org.shredzone.acme4j.exception.AcmeRateLimitExceededException;
|
||||
import org.shredzone.acme4j.exception.AcmeServerException;
|
||||
import org.shredzone.acme4j.exception.AcmeUnauthorizedException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -100,7 +100,7 @@ public class DefaultConnection implements Connection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) throws AcmeException {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) throws AcmeException {
|
||||
Objects.requireNonNull(uri, "uri");
|
||||
Objects.requireNonNull(claims, "claims");
|
||||
Objects.requireNonNull(session, "session");
|
||||
|
|
|
@ -33,45 +33,45 @@ import org.shredzone.acme4j.connector.Resource;
|
|||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
|
||||
/**
|
||||
* Builder for claim structures.
|
||||
* Builder for JSON structures.
|
||||
* <p>
|
||||
* Example:
|
||||
* <pre>
|
||||
* ClaimBuilder cb = new ClaimBuilder();
|
||||
* JSONBuilder cb = new JSONBuilder();
|
||||
* cb.put("foo", 123).put("bar", "hello world");
|
||||
* cb.object("sub").put("data", "subdata");
|
||||
* cb.array("array", 123, 456, 789);
|
||||
* </pre>
|
||||
*/
|
||||
public class ClaimBuilder {
|
||||
public class JSONBuilder {
|
||||
|
||||
private final Map<String, Object> data = new TreeMap<>();
|
||||
|
||||
/**
|
||||
* Puts a claim. If a claim with the key exists, it will be replaced.
|
||||
* Puts a property. If a property with the key exists, it will be replaced.
|
||||
*
|
||||
* @param key
|
||||
* Claim key
|
||||
* Property key
|
||||
* @param value
|
||||
* Claim value
|
||||
* Property value
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder put(String key, Object value) {
|
||||
public JSONBuilder put(String key, Object value) {
|
||||
data.put(Objects.requireNonNull(key, "key"), value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a {@link Date} to the claim. If a claim with the key exists, it will be
|
||||
* Puts a {@link Date} to the JSON. If a property with the key exists, it will be
|
||||
* replaced.
|
||||
*
|
||||
* @param key
|
||||
* Claim key
|
||||
* Property key
|
||||
* @param value
|
||||
* Claim {@link Date} value
|
||||
* Property {@link Date} value
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder put(String key, Date value) {
|
||||
public JSONBuilder put(String key, Date value) {
|
||||
if (value == null) {
|
||||
put(key, (Object) null);
|
||||
return this;
|
||||
|
@ -85,49 +85,37 @@ public class ClaimBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Puts a resource claim.
|
||||
* Puts a resource.
|
||||
*
|
||||
* @param resource
|
||||
* Resource name
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder putResource(String resource) {
|
||||
public JSONBuilder putResource(String resource) {
|
||||
return put("resource", resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a resource claim.
|
||||
* Puts a resource.
|
||||
*
|
||||
* @param resource
|
||||
* {@link Resource}
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder putResource(Resource resource) {
|
||||
public JSONBuilder putResource(Resource resource) {
|
||||
return putResource(resource.path());
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an entire map into the claim.
|
||||
*
|
||||
* @param map
|
||||
* Map to put
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder putAll(Map<String, Object> map) {
|
||||
data.putAll(map);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts binary data to the claim. The data is base64 url encoded.
|
||||
* Puts binary data to the JSON. The data is base64 url encoded.
|
||||
*
|
||||
* @param key
|
||||
* Claim key
|
||||
* Property key
|
||||
* @param data
|
||||
* Claim data
|
||||
* Property data
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder putBase64(String key, byte[] data) {
|
||||
public JSONBuilder putBase64(String key, byte[] data) {
|
||||
return put(key, base64UrlEncode(data));
|
||||
}
|
||||
|
||||
|
@ -135,18 +123,18 @@ public class ClaimBuilder {
|
|||
* Puts a {@link Key} into the claim. The key is serializied as JWK.
|
||||
*
|
||||
* @param key
|
||||
* Claim key
|
||||
* Property key
|
||||
* @param publickey
|
||||
* {@link PublicKey} to serialize
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder putKey(String key, PublicKey publickey) {
|
||||
public JSONBuilder putKey(String key, PublicKey publickey) {
|
||||
Objects.requireNonNull(publickey, "publickey");
|
||||
|
||||
try {
|
||||
final PublicJsonWebKey jwk = PublicJsonWebKey.Factory.newPublicJwk(publickey);
|
||||
Map<String, Object> jwkParams = jwk.toParams(JsonWebKey.OutputControlLevel.PUBLIC_ONLY);
|
||||
object(key).putAll(jwkParams);
|
||||
object(key).data.putAll(jwkParams);
|
||||
return this;
|
||||
} catch (JoseException ex) {
|
||||
throw new AcmeProtocolException("Invalid key", ex);
|
||||
|
@ -154,41 +142,41 @@ public class ClaimBuilder {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a sub-claim for the given key.
|
||||
* Creates an object for the given key.
|
||||
*
|
||||
* @param key
|
||||
* Key of the sub-claim
|
||||
* @return Newly created {@link ClaimBuilder} for the sub-claim.
|
||||
* Key of the object
|
||||
* @return Newly created {@link JSONBuilder} for the object.
|
||||
*/
|
||||
public ClaimBuilder object(String key) {
|
||||
ClaimBuilder subBuilder = new ClaimBuilder();
|
||||
public JSONBuilder object(String key) {
|
||||
JSONBuilder subBuilder = new JSONBuilder();
|
||||
data.put(key, subBuilder.data);
|
||||
return subBuilder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts an array claim.
|
||||
* Puts an array.
|
||||
*
|
||||
* @param key
|
||||
* Claim key
|
||||
* Property key
|
||||
* @param values
|
||||
* Array of claim values
|
||||
* Array of property values
|
||||
* @return {@code this}
|
||||
*/
|
||||
public ClaimBuilder array(String key, Object... values) {
|
||||
public JSONBuilder array(String key, Object... values) {
|
||||
data.put(key, values);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@link Map} representation of the claims.
|
||||
* Returns a {@link Map} representation of the current state.
|
||||
*/
|
||||
public Map<String, Object> toMap() {
|
||||
return Collections.unmodifiableMap(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a JSON representation of the claims.
|
||||
* Returns a JSON string representation of the current state.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
|
@ -34,7 +34,7 @@ import org.shredzone.acme4j.challenge.TlsSni02Challenge;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.provider.TestableConnectionProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Authorization}.
|
||||
|
@ -284,7 +284,7 @@ public class AuthorizationTest {
|
|||
public void testDeactivate() throws Exception {
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
Map<String, Object> claimMap = claims.toMap();
|
||||
assertThat(claimMap.get("resource"), is((Object) "authz"));
|
||||
assertThat(claimMap.get("status"), is((Object) "deactivated"));
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.shredzone.acme4j.connector.Resource;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.provider.TestableConnectionProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ public class CertificateTest {
|
|||
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("revokeCertificateRequest")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
@ -174,7 +174,7 @@ public class CertificateTest {
|
|||
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("revokeCertificateWithReasonRequest")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.Test;
|
|||
import org.shredzone.acme4j.connector.Resource;
|
||||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.provider.TestableConnectionProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link RegistrationBuilder}.
|
||||
|
@ -43,7 +43,7 @@ public class RegistrationBuilderTest {
|
|||
public void testRegistration() throws Exception {
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("newRegistration")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.shredzone.acme4j.connector.Resource;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.provider.AcmeProvider;
|
||||
import org.shredzone.acme4j.provider.TestableConnectionProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -66,7 +66,7 @@ public class RegistrationTest {
|
|||
private Integer response;
|
||||
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(locationUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("updateRegistration")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
@ -154,7 +154,7 @@ public class RegistrationTest {
|
|||
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
requestWasSent.set(true);
|
||||
assertThat(uri, is(locationUri));
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ public class RegistrationTest {
|
|||
public void testAuthorizeDomain() throws Exception {
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("newAuthorizationRequest")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
@ -302,7 +302,7 @@ public class RegistrationTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("requestCertificateRequestWithDate")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
@ -361,7 +361,7 @@ public class RegistrationTest {
|
|||
public void testRequestCertificateAsync() throws AcmeException, IOException {
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("requestCertificateRequest")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
@ -411,7 +411,7 @@ public class RegistrationTest {
|
|||
|
||||
final TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder payload, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder payload, Session session) {
|
||||
try {
|
||||
assertThat(uri, is(locationUri));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
@ -496,7 +496,7 @@ public class RegistrationTest {
|
|||
public void testDeactivate() throws Exception {
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
Map<String, Object> claimMap = claims.toMap();
|
||||
assertThat(claimMap.get("resource"), is((Object) "reg"));
|
||||
assertThat(claimMap.get("status"), is((Object) "deactivated"));
|
||||
|
@ -527,7 +527,7 @@ public class RegistrationTest {
|
|||
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(locationUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("modifyRegistration")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.shredzone.acme4j.challenge.Http01Challenge;
|
|||
import org.shredzone.acme4j.connector.Resource;
|
||||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.provider.AcmeProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -117,7 +117,7 @@ public class SessionTest {
|
|||
URI serverUri = URI.create(TestUtils.ACME_SERVER_URI);
|
||||
String challengeType = Http01Challenge.TYPE;
|
||||
|
||||
Map<String, Object> data = new ClaimBuilder()
|
||||
Map<String, Object> data = new JSONBuilder()
|
||||
.put("type", challengeType)
|
||||
.toMap();
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ import org.shredzone.acme4j.exception.AcmeException;
|
|||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.exception.AcmeRetryAfterException;
|
||||
import org.shredzone.acme4j.provider.TestableConnectionProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -131,7 +131,7 @@ public class ChallengeTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Test that {@link Challenge#respond(ClaimBuilder)} contains the type.
|
||||
* Test that {@link Challenge#respond(JSONBuilder)} contains the type.
|
||||
*/
|
||||
@Test
|
||||
public void testRespond() throws JoseException {
|
||||
|
@ -140,7 +140,7 @@ public class ChallengeTest {
|
|||
Challenge challenge = new Challenge(session);
|
||||
challenge.unmarshall(JsonUtil.parseJson(json));
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
challenge.respond(cb);
|
||||
|
||||
assertThat(cb.toString(), sameJSONAs("{\"type\"=\"generic-01\"}"));
|
||||
|
@ -162,7 +162,7 @@ public class ChallengeTest {
|
|||
public void testTrigger() throws Exception {
|
||||
TestableConnectionProvider provider = new TestableConnectionProvider() {
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
assertThat(uri, is(resourceUri));
|
||||
assertThat(claims.toString(), sameJSONAs(getJson("triggerHttpChallengeRequest")));
|
||||
assertThat(session, is(notNullValue()));
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +52,7 @@ public class DnsChallengeTest {
|
|||
assertThat(challenge.getStatus(), is(Status.PENDING));
|
||||
assertThat(challenge.getDigest(), is("rzMmotrIgsithyBYc0vgiLUEEKYx0WetQRgEF2JIozA"));
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
challenge.respond(cb);
|
||||
|
||||
assertThat(cb.toString(), sameJSONAs("{\"keyAuthorization\"=\""
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.junit.Test;
|
|||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -56,7 +56,7 @@ public class HttpChallengeTest {
|
|||
assertThat(challenge.getToken(), is(TOKEN));
|
||||
assertThat(challenge.getAuthorization(), is(KEY_AUTHORIZATION));
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
challenge.respond(cb);
|
||||
|
||||
assertThat(cb.toString(), sameJSONAs("{\"keyAuthorization\"=\""
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -51,7 +51,7 @@ public class OutOfBandChallengeTest {
|
|||
assertThat(challenge.getValidationUrl(),
|
||||
is(new URL("https://example.com/validate/evaGxfADs6pSRb2LAv9IZ")));
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
challenge.respond(cb);
|
||||
|
||||
assertThat(cb.toString(), sameJSONAs("{\"type\": \"oob-01\"}"));
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public class TlsSni01ChallengeTest {
|
|||
assertThat(challenge.getStatus(), is(Status.PENDING));
|
||||
assertThat(challenge.getSubject(), is("14e2350a04434f93c2e0b6012968d99d.ed459b6a7a019d9695609b8514f9d63d.acme.invalid"));
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
challenge.respond(cb);
|
||||
|
||||
assertThat(cb.toString(), sameJSONAs("{\"keyAuthorization\"=\""
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.Status;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +53,7 @@ public class TlsSni02ChallengeTest {
|
|||
assertThat(challenge.getSubject(), is("5bf0b9908ed73bc53ed3327afa52f76b.0a4bea00520f0753f42abe0bb39e3ea8.token.acme.invalid"));
|
||||
assertThat(challenge.getSanB(), is("14e2350a04434f93c2e0b6012968d99d.ed459b6a7a019d9695609b8514f9d63d.ka.acme.invalid"));
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
challenge.respond(cb);
|
||||
|
||||
assertThat(cb.toString(), sameJSONAs("{\"keyAuthorization\"=\""
|
||||
|
|
|
@ -44,7 +44,7 @@ import org.shredzone.acme4j.exception.AcmeException;
|
|||
import org.shredzone.acme4j.exception.AcmeNetworkException;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.exception.AcmeServerException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -483,7 +483,7 @@ public class DefaultConnectionTest {
|
|||
}
|
||||
};
|
||||
}) {
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
cb.put("foo", 123).put("bar", "a-string");
|
||||
conn.sendSignedRequest(requestUri, cb, DefaultConnectionTest.this.session);
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ public class DefaultConnectionTest {
|
|||
@Test(expected = AcmeProtocolException.class)
|
||||
public void testSendSignedRequestNoNonce() throws Exception {
|
||||
try (DefaultConnection conn = new DefaultConnection(mockHttpConnection)) {
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
conn.sendSignedRequest(requestUri, cb, DefaultConnectionTest.this.session);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.Map;
|
|||
|
||||
import org.shredzone.acme4j.Session;
|
||||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* Dummy implementation of {@link Connection} that always fails. Single methods are
|
||||
|
@ -35,7 +35,7 @@ public class DummyConnection implements Connection {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendSignedRequest(URI uri, ClaimBuilder claims, Session session) {
|
||||
public void sendSignedRequest(URI uri, JSONBuilder claims, Session session) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.shredzone.acme4j.Session;
|
|||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.exception.AcmeProtocolException;
|
||||
import org.shredzone.acme4j.provider.TestableConnectionProvider;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
|
||||
/**
|
||||
* Unit test for {@link ResourceIterator}.
|
||||
|
@ -152,7 +152,7 @@ public class ResourceIteratorTest {
|
|||
int start = ix * RESOURCES_PER_PAGE;
|
||||
int end = (ix + 1) * RESOURCES_PER_PAGE;
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
cb.array(TYPE, resourceURIs.subList(start, end).toArray());
|
||||
|
||||
// Make sure to use the JSON parser
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.shredzone.acme4j.connector.Connection;
|
|||
import org.shredzone.acme4j.connector.DummyConnection;
|
||||
import org.shredzone.acme4j.connector.Resource;
|
||||
import org.shredzone.acme4j.exception.AcmeException;
|
||||
import org.shredzone.acme4j.util.ClaimBuilder;
|
||||
import org.shredzone.acme4j.util.JSONBuilder;
|
||||
import org.shredzone.acme4j.util.TestUtils;
|
||||
|
||||
/**
|
||||
|
@ -33,7 +33,7 @@ import org.shredzone.acme4j.util.TestUtils;
|
|||
*/
|
||||
public class TestableConnectionProvider extends DummyConnection implements AcmeProvider {
|
||||
private final Map<String, Challenge> challengeMap = new HashMap<>();
|
||||
private final ClaimBuilder directory = new ClaimBuilder();
|
||||
private final JSONBuilder directory = new JSONBuilder();
|
||||
|
||||
/**
|
||||
* Register a {@link Resource} mapping.
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.security.KeyPair;
|
|||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TimeZone;
|
||||
|
||||
|
@ -31,16 +30,16 @@ import org.junit.Test;
|
|||
import org.shredzone.acme4j.connector.Resource;
|
||||
|
||||
/**
|
||||
* Unit test for {@link ClaimBuilder}.
|
||||
* Unit test for {@link JSONBuilder}.
|
||||
*/
|
||||
public class ClaimBuilderTest {
|
||||
public class JSONBuilderTest {
|
||||
|
||||
/**
|
||||
* Test that an empty claimbuilder is empty.
|
||||
* Test that an empty JSON builder is empty.
|
||||
*/
|
||||
@Test
|
||||
public void testEmpty() {
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
assertThat(cb.toString(), is("{}"));
|
||||
}
|
||||
|
||||
|
@ -50,9 +49,9 @@ public class ClaimBuilderTest {
|
|||
*/
|
||||
@Test
|
||||
public void testBasics() {
|
||||
ClaimBuilder res;
|
||||
JSONBuilder res;
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
res = cb.put("fooStr", "String");
|
||||
assertThat(res, is(sameInstance(cb)));
|
||||
|
||||
|
@ -81,7 +80,7 @@ public class ClaimBuilderTest {
|
|||
cal.clear();
|
||||
cal.set(2016, Calendar.JUNE, 1, 5, 13, 46);
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
cb.put("fooDate", cal.getTime());
|
||||
cb.put("fooNull", (Date) null);
|
||||
|
||||
|
@ -93,9 +92,9 @@ public class ClaimBuilderTest {
|
|||
*/
|
||||
@Test
|
||||
public void testResource() {
|
||||
ClaimBuilder res;
|
||||
JSONBuilder res;
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
res = cb.putResource("new-reg");
|
||||
assertThat(res, is(sameInstance(cb)));
|
||||
assertThat(cb.toString(), is("{\"resource\":\"new-reg\"}"));
|
||||
|
@ -105,23 +104,6 @@ public class ClaimBuilderTest {
|
|||
assertThat(cb.toString(), is("{\"resource\":\"new-authz\"}"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method to add maps.
|
||||
*/
|
||||
@Test
|
||||
public void testMap() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("fooStr", "String");
|
||||
map.put("fooInt", 123);
|
||||
|
||||
ClaimBuilder res;
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
res = cb.putAll(map);
|
||||
assertThat(res, is(sameInstance(cb)));
|
||||
assertThat(cb.toString(), is("{\"fooInt\":123,\"fooStr\":\"String\"}"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test base64 encoding.
|
||||
*/
|
||||
|
@ -129,9 +111,9 @@ public class ClaimBuilderTest {
|
|||
public void testBase64() {
|
||||
byte[] data = "abc123".getBytes();
|
||||
|
||||
ClaimBuilder res;
|
||||
JSONBuilder res;
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
res = cb.putBase64("foo", data);
|
||||
assertThat(res, is(sameInstance(cb)));
|
||||
assertThat(cb.toString(), is("{\"foo\":\"YWJjMTIz\"}"));
|
||||
|
@ -145,9 +127,9 @@ public class ClaimBuilderTest {
|
|||
public void testKey() throws IOException, NoSuchAlgorithmException, JoseException {
|
||||
KeyPair keyPair = TestUtils.createKeyPair();
|
||||
|
||||
ClaimBuilder res;
|
||||
JSONBuilder res;
|
||||
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
res = cb.putKey("foo", keyPair.getPublic());
|
||||
assertThat(res, is(sameInstance(cb)));
|
||||
|
||||
|
@ -166,8 +148,8 @@ public class ClaimBuilderTest {
|
|||
*/
|
||||
@Test
|
||||
public void testObject() {
|
||||
ClaimBuilder cb = new ClaimBuilder();
|
||||
ClaimBuilder sub = cb.object("sub");
|
||||
JSONBuilder cb = new JSONBuilder();
|
||||
JSONBuilder sub = cb.object("sub");
|
||||
assertThat(sub, not(sameInstance(cb)));
|
||||
|
||||
assertThat(cb.toString(), is("{\"sub\":{}}"));
|
||||
|
@ -183,19 +165,19 @@ public class ClaimBuilderTest {
|
|||
*/
|
||||
@Test
|
||||
public void testArray() {
|
||||
ClaimBuilder res;
|
||||
JSONBuilder res;
|
||||
|
||||
ClaimBuilder cb1 = new ClaimBuilder();
|
||||
JSONBuilder cb1 = new JSONBuilder();
|
||||
res = cb1.array("ar", new Object[0]);
|
||||
assertThat(res, is(sameInstance(cb1)));
|
||||
assertThat(cb1.toString(), is("{\"ar\":[]}"));
|
||||
|
||||
ClaimBuilder cb2 = new ClaimBuilder();
|
||||
JSONBuilder cb2 = new JSONBuilder();
|
||||
res = cb2.array("ar", 123);
|
||||
assertThat(res, is(sameInstance(cb2)));
|
||||
assertThat(cb2.toString(), is("{\"ar\":[123]}"));
|
||||
|
||||
ClaimBuilder cb3 = new ClaimBuilder();
|
||||
JSONBuilder cb3 = new JSONBuilder();
|
||||
res = cb3.array("ar", 123, "foo", 456);
|
||||
assertThat(res, is(sameInstance(cb3)));
|
||||
assertThat(cb3.toString(), is("{\"ar\":[123,\"foo\",456]}"));
|
Loading…
Reference in New Issue