You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oltu.apache.org by si...@apache.org on 2017/10/25 12:37:17 UTC

svn commit: r1813271 - in /oltu/trunk: commons/json/ commons/json/src/main/java/org/apache/oltu/commons/json/ oauth-2.0/ oauth-2.0/authzserver/ oauth-2.0/authzserver/src/test/java/org/apache/oltu/oauth2/as/response/ oauth-2.0/client/ oauth-2.0/client/s...

Author: simonetripodi
Date: Wed Oct 25 12:37:17 2017
New Revision: 1813271

URL: http://svn.apache.org/viewvc?rev=1813271&view=rev
Log:
OLTU-209 - remove org.json

Modified:
    oltu/trunk/commons/json/pom.xml
    oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityReader.java
    oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityWriter.java
    oltu/trunk/oauth-2.0/authzserver/pom.xml
    oltu/trunk/oauth-2.0/authzserver/src/test/java/org/apache/oltu/oauth2/as/response/OAuthASResponseTest.java
    oltu/trunk/oauth-2.0/client/pom.xml
    oltu/trunk/oauth-2.0/client/src/test/java/org/apache/oltu/oauth2/client/response/OAuthClientResponseFactoryTest.java
    oltu/trunk/oauth-2.0/common/pom.xml
    oltu/trunk/oauth-2.0/common/src/main/java/org/apache/oltu/oauth2/common/utils/JSONUtils.java
    oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/message/OAuthResponseTest.java
    oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/JSONBodyParametersApplierTest.java
    oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java
    oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/utils/JSONUtilsTest.java
    oltu/trunk/oauth-2.0/dynamicreg-server/pom.xml
    oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/JSONHttpServletRequestWrapper.java
    oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/validator/PushPullValidator.java
    oltu/trunk/oauth-2.0/dynamicreg-server/src/test/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/OAuthServerRegistrationRequestTest.java
    oltu/trunk/oauth-2.0/integration-tests/pom.xml
    oltu/trunk/oauth-2.0/pom.xml

Modified: oltu/trunk/commons/json/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/commons/json/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/commons/json/pom.xml (original)
+++ oltu/trunk/commons/json/pom.xml Wed Oct 25 12:37:17 2017
@@ -33,9 +33,9 @@
 
   <dependencies>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
-      <version>20160212</version>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-json_1.1_spec</artifactId>
+      <version>1.0</version>
     </dependency>
   </dependencies>
 

Modified: oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityReader.java
URL: http://svn.apache.org/viewvc/oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityReader.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityReader.java (original)
+++ oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityReader.java Wed Oct 25 12:37:17 2017
@@ -18,8 +18,10 @@ package org.apache.oltu.commons.json;
 
 import static java.lang.String.format;
 
-import org.json.JSONArray;
-import org.json.JSONTokener;
+import java.io.StringReader;
+import java.util.Map.Entry;
+
+import javax.json.*;
 
 /**
  * TODO
@@ -42,75 +44,83 @@ public abstract class CustomizableEntity
      * @param jsonString
      */
     public void read(String jsonString) {
-        final JSONTokener x = new JSONTokener(jsonString);
-        char c;
-        String key;
+        if (jsonString == null) {
+            throw new IllegalArgumentException("Null string does not represent a valid JSON object");
+        }
 
-        if (x.nextClean() != '{') {
-            throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, a JSON object text must begin with '{'",
+        StringReader reader = new StringReader(jsonString);
+        JsonReader jsonReader = Json.createReader(reader);
+        JsonStructure structure = jsonReader.read();
+
+        if (structure == null || structure instanceof JsonArray) {
+            throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation",
                                                       jsonString));
         }
-        for (;;) {
-            c = x.nextClean();
-            switch (c) {
-            case 0:
-                throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, a JSON object text must end with '}'",
-                                                          jsonString));
-            case '}':
-                return;
-            default:
-                x.back();
-                key = x.nextValue().toString();
-            }
 
-            /*
-             * The key is followed by ':'. We will also tolerate '=' or '=>'.
-             */
-            c = x.nextClean();
-            if (c == '=') {
-                if (x.next() != '>') {
-                    x.back();
-                }
-            } else if (c != ':') {
-                throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'",
-                                                          jsonString, key));
-            }
-            Object value = x.nextValue();
+        JsonObject object = (JsonObject) structure;
+        for (Entry<String, JsonValue> entry : object.entrySet()) {
+            String key = entry.getKey();
+            JsonValue jsonValue = entry.getValue();
 
             // guard from null values
-            if (value != null) {
-                if (value instanceof JSONArray) { // only plain simple arrays in this version
-                    JSONArray array = (JSONArray) value;
-                    Object[] values = new Object[array.length()];
-                    for (int i = 0; i < array.length(); i++) {
-                        values[i] = array.get(i);
-                    }
-                    value = values;
-                }
+            if (jsonValue != null) {
+                Object value = toJavaObject(jsonValue);
 
                 // if the concrete implementation is not able to handle the property, set the custom field
                 if (!handleProperty(key, value)) {
                     builder.setCustomField(key, value);
                 }
             }
+        }
+
+        jsonReader.close();
+    }
 
-            /*
-             * Pairs are separated by ','. We will also tolerate ';'.
-             */
-            switch (x.nextClean()) {
-            case ';':
-            case ',':
-                if (x.nextClean() == '}') {
-                    return;
+    private static Object toJavaObject(JsonValue jsonValue) {
+        Object value = null;
+
+        switch (jsonValue.getValueType()) {
+            case ARRAY:
+                JsonArray array = (JsonArray) jsonValue;
+                Object[] values = new Object[array.size()];
+                for (int i = 0; i < array.size(); i++) {
+                    JsonValue current = array.get(i);
+                    values[i] = toJavaObject(current);
                 }
-                x.back();
+                value = values;
+                break;
+
+            case FALSE:
+                value = false;
                 break;
-            case '}':
-                return;
+
+            case NULL:
+                value = null;
+                break;
+
+            case NUMBER:
+                JsonNumber jsonNumber = (JsonNumber) jsonValue;
+                value = jsonNumber.numberValue();
+                break;
+
+            case OBJECT:
+                // not supported in this version
+                break;
+
+            case STRING:
+                JsonString jsonString = (JsonString) jsonValue;
+                value = jsonString.getString();
+                break;
+
+            case TRUE:
+                value = true;
+                break;
+
             default:
-                throw new IllegalArgumentException("Expected a ',' or '}'");
-            }
+                break;
         }
+
+        return value;
     }
 
     protected abstract <T> boolean handleProperty(String key, T value);

Modified: oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityWriter.java
URL: http://svn.apache.org/viewvc/oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityWriter.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityWriter.java (original)
+++ oltu/trunk/commons/json/src/main/java/org/apache/oltu/commons/json/CustomizableEntityWriter.java Wed Oct 25 12:37:17 2017
@@ -16,16 +16,22 @@
  */
 package org.apache.oltu.commons.json;
 
+import java.io.StringWriter;
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.util.Map.Entry;
 
-import org.json.JSONStringer;
+import javax.json.Json;
+import javax.json.stream.JsonGenerator;
 
 public abstract class CustomizableEntityWriter<CE extends CustomizableEntity> {
 
-    private final JSONStringer jsonWriter = new JSONStringer();
+    private final StringWriter stringWriter = new StringWriter();
+
+    private final JsonGenerator generator = Json.createGenerator(stringWriter);
 
     public final String write(CE customizableEntity) {
-        jsonWriter.object();
+        generator.writeStartObject();
 
         handleProperties(customizableEntity);
 
@@ -33,15 +39,33 @@ public abstract class CustomizableEntity
             set(customFields.getKey(), customFields.getValue());
         }
 
-        jsonWriter.endObject();
-        return jsonWriter.toString();
+        generator.writeEnd().close();
+
+        return stringWriter.toString();
     }
 
     protected abstract void handleProperties(CE customizableEntity);
 
     protected final <T> void set(String key, T value) {
-        if (value != null) {
-            jsonWriter.key(key).value(value);
+        if (key != null && value != null) {
+            if (value instanceof Boolean) {
+                generator.write(key, (Boolean) value);
+            } else if (value instanceof Double) {
+                generator.write(key, (Double) value);
+            } else if (value instanceof Integer) {
+                generator.write(key, (Integer) value);
+            } else if (value instanceof BigDecimal) {
+                generator.write(key, (BigDecimal) value);
+            } else if (value instanceof BigInteger) {
+                generator.write(key, (BigInteger) value);
+            } else if (value instanceof Long) {
+                generator.write(key, (Long) value);
+            } else if (value instanceof String) {
+                String string = (String) value;
+                if (!string.isEmpty()) {
+                    generator.write(key, string);
+                }
+            }
         }
     }
 
@@ -50,15 +74,29 @@ public abstract class CustomizableEntity
             return;
         }
 
-        jsonWriter.key(key).array();
+        generator.writeStartArray(key);
 
         for (T item : value) {
             if (item != null) {
-                jsonWriter.value(item);
+                if (item instanceof Boolean) {
+                    generator.write((Boolean) item);
+                } else if (item instanceof Double) {
+                    generator.write((Double) item);
+                } else if (item instanceof Integer) {
+                    generator.write((Integer) item);
+                } else if (item instanceof BigDecimal) {
+                    generator.write((BigDecimal) item);
+                } else if (item instanceof BigInteger) {
+                    generator.write((BigInteger) item);
+                } else if (item instanceof Long) {
+                    generator.write((Long) item);
+                } else if (item instanceof String) {
+                    generator.write((String) item);
+                }
             }
         }
 
-        jsonWriter.endArray();
+        generator.writeEnd();
     }
 
 }

Modified: oltu/trunk/oauth-2.0/authzserver/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/authzserver/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/authzserver/pom.xml (original)
+++ oltu/trunk/oauth-2.0/authzserver/pom.xml Wed Oct 25 12:37:17 2017
@@ -37,8 +37,8 @@
     </dependency>
 
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
+      <groupId>org.apache.johnzon</groupId>
+      <artifactId>johnzon-core</artifactId>
     </dependency>
 
     <dependency>

Modified: oltu/trunk/oauth-2.0/authzserver/src/test/java/org/apache/oltu/oauth2/as/response/OAuthASResponseTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/authzserver/src/test/java/org/apache/oltu/oauth2/as/response/OAuthASResponseTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/authzserver/src/test/java/org/apache/oltu/oauth2/as/response/OAuthASResponseTest.java (original)
+++ oltu/trunk/oauth-2.0/authzserver/src/test/java/org/apache/oltu/oauth2/as/response/OAuthASResponseTest.java Wed Oct 25 12:37:17 2017
@@ -24,6 +24,7 @@ package org.apache.oltu.oauth2.as.respon
 import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
+import static org.junit.Assert.assertEquals;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -31,7 +32,6 @@ import org.apache.oltu.oauth2.common.OAu
 import org.apache.oltu.oauth2.common.error.OAuthError;
 import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
 import org.apache.oltu.oauth2.common.message.OAuthResponse;
-import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -53,8 +53,8 @@ public class OAuthASResponseTest {
 
         String url = oAuthResponse.getLocationUri();
 
-        Assert.assertEquals("http://www.example.com?testValue=value2&state=ok&code=code", url);
-        Assert.assertEquals(200, oAuthResponse.getResponseStatus());
+        assertEquals("http://www.example.com?code=code&state=ok&testValue=value2", url);
+        assertEquals(200, oAuthResponse.getResponseStatus());
 
     }
 
@@ -71,8 +71,8 @@ public class OAuthASResponseTest {
 
         String url = oAuthResponse.getLocationUri();
 
-        Assert.assertEquals("http://www.example.com?testValue=value2&state=ok&code=code", url);
-        Assert.assertEquals(200, oAuthResponse.getResponseStatus());
+        assertEquals("http://www.example.com?code=code&state=ok&testValue=value2", url);
+        assertEquals(200, oAuthResponse.getResponseStatus());
 
     }
 
@@ -90,8 +90,8 @@ public class OAuthASResponseTest {
                 .buildQueryMessage();
 
         String url = oAuthResponse.getLocationUri();
-        Assert.assertEquals("http://www.example.com#testValue=value2&state=ok&expires_in=400&token_type=bearer&access_token=access_111", url);
-        Assert.assertEquals(200, oAuthResponse.getResponseStatus());
+        assertEquals("http://www.example.com#access_token=access_111&state=ok&token_type=bearer&expires_in=400&testValue=value2", url);
+        assertEquals(200, oAuthResponse.getResponseStatus());
     }
 
     @Test
@@ -102,8 +102,8 @@ public class OAuthASResponseTest {
             .buildBodyMessage();
 
         String body = oAuthResponse.getBody();
-        Assert.assertEquals(
-            "expires_in=200&token_type=bearer&refresh_token=refresh_token2&access_token=access_token",
+        assertEquals(
+            "access_token=access_token&refresh_token=refresh_token2&token_type=bearer&expires_in=200",
             body);
 
     }
@@ -116,8 +116,9 @@ public class OAuthASResponseTest {
             .buildBodyMessage();
 
         String body = oAuthResponse.getBody();
-        Assert.assertEquals(
-            "some_param=new_param&expires_in=200&token_type=bearer&refresh_token=refresh_token2&access_token=access_token",
+
+        assertEquals(
+            "access_token=access_token&refresh_token=refresh_token2&some_param=new_param&token_type=bearer&expires_in=200",
             body);
 
     }
@@ -132,17 +133,15 @@ public class OAuthASResponseTest {
             .uri("http://www.example.com/error");
 
         OAuthResponse oAuthResponse = OAuthResponse.errorResponse(400).error(ex).buildJSONMessage();
-
-        Assert.assertEquals(
-            "{\"error_uri\":\"http://www.example.com/error\",\"error\":\"access_denied\",\"error_description\":\"Access denied\"}",
+        assertEquals(
+            "{\"error_description\":\"Access denied\",\"error\":\"access_denied\",\"error_uri\":\"http://www.example.com/error\"}",
             oAuthResponse.getBody());
 
 
         oAuthResponse = OAuthResponse.errorResponse(500)
             .location("http://www.example.com/redirect?param2=true").error(ex).buildQueryMessage();
-        Assert.assertEquals(
-            "http://www.example.com/redirect?param2=true&error_uri=http%3A%2F%2Fwww.example.com%2Ferror"
-                + "&error=access_denied&error_description=Access+denied",
+        assertEquals(
+            "http://www.example.com/redirect?param2=true&error_description=Access+denied&error=access_denied&error_uri=http%3A%2F%2Fwww.example.com%2Ferror",
             oAuthResponse.getLocationUri());
     }
 
@@ -156,9 +155,9 @@ public class OAuthASResponseTest {
 
         OAuthResponse oAuthResponse = OAuthResponse.errorResponse(500)
             .location("http://www.example.com/redirect?param2=true").error(ex).buildQueryMessage();
-        Assert.assertEquals(
-            "http://www.example.com/redirect?param2=true&error_uri=http%3A%2F%2Fwww.example.com%2Ferror"
-                + "&error=access_denied&error_description=Access+denied",
+
+        assertEquals(
+            "http://www.example.com/redirect?param2=true&error_description=Access+denied&error=access_denied&error_uri=http%3A%2F%2Fwww.example.com%2Ferror",
             oAuthResponse.getLocationUri());
     }
 
@@ -170,10 +169,10 @@ public class OAuthASResponseTest {
             .buildHeaderMessage();
 
         String header = oAuthResponse.getHeader(OAuth.HeaderType.WWW_AUTHENTICATE);
-        Assert.assertEquals("Bearer state=\"state_ok\",code=\"oauth_code\"", header);
+        assertEquals("Bearer code=\"oauth_code\",state=\"state_ok\"", header);
 
         header = oAuthResponse.getHeaders().get(OAuth.HeaderType.WWW_AUTHENTICATE);
-        Assert.assertEquals("Bearer state=\"state_ok\",code=\"oauth_code\"", header);
+        assertEquals("Bearer code=\"oauth_code\",state=\"state_ok\"", header);
     }
 
 }

Modified: oltu/trunk/oauth-2.0/client/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/client/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/client/pom.xml (original)
+++ oltu/trunk/oauth-2.0/client/pom.xml Wed Oct 25 12:37:17 2017
@@ -42,6 +42,10 @@
       <version>2.4</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.johnzon</groupId>
+      <artifactId>johnzon-core</artifactId>
+    </dependency>
   </dependencies>
 
   <build>

Modified: oltu/trunk/oauth-2.0/client/src/test/java/org/apache/oltu/oauth2/client/response/OAuthClientResponseFactoryTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/client/src/test/java/org/apache/oltu/oauth2/client/response/OAuthClientResponseFactoryTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/client/src/test/java/org/apache/oltu/oauth2/client/response/OAuthClientResponseFactoryTest.java (original)
+++ oltu/trunk/oauth-2.0/client/src/test/java/org/apache/oltu/oauth2/client/response/OAuthClientResponseFactoryTest.java Wed Oct 25 12:37:17 2017
@@ -21,9 +21,10 @@
 
 package org.apache.oltu.oauth2.client.response;
 
-import org.junit.Assert;
-import org.junit.Test;
+import static org.junit.Assert.assertNotNull;
+
 import org.apache.oltu.oauth2.common.OAuth;
+import org.junit.Test;
 
 
 /**
@@ -37,14 +38,14 @@ public class OAuthClientResponseFactoryT
     public void testCreateGitHubTokenResponse() throws Exception {
         OAuthClientResponse gitHubTokenResponse = OAuthClientResponseFactory
             .createGitHubTokenResponse("access_token=123", OAuth.ContentType.URL_ENCODED, 200);
-        Assert.assertNotNull(gitHubTokenResponse);
+        assertNotNull(gitHubTokenResponse);
     }
 
     @Test
     public void testCreateJSONTokenResponse() throws Exception {
         OAuthClientResponse jsonTokenResponse = OAuthClientResponseFactory
-            .createJSONTokenResponse("{'access_token':'123'}", OAuth.ContentType.JSON, 200);
-        Assert.assertNotNull(jsonTokenResponse);
+            .createJSONTokenResponse("{\"access_token\":\"123\"}", OAuth.ContentType.JSON, 200);
+        assertNotNull(jsonTokenResponse);
     }
 
     @Test

Modified: oltu/trunk/oauth-2.0/common/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/common/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/common/pom.xml (original)
+++ oltu/trunk/oauth-2.0/common/pom.xml Wed Oct 25 12:37:17 2017
@@ -32,14 +32,20 @@
 
   <dependencies>
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-json_1.1_spec</artifactId>
     </dependency>
 
     <dependency>
       <groupId>commons-codec</groupId>
       <artifactId>commons-codec</artifactId>
     </dependency>
+
+    <!-- test -->
+    <dependency>
+      <groupId>org.apache.johnzon</groupId>
+      <artifactId>johnzon-core</artifactId>
+    </dependency>
   </dependencies>
 
   <build>

Modified: oltu/trunk/oauth-2.0/common/src/main/java/org/apache/oltu/oauth2/common/utils/JSONUtils.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/common/src/main/java/org/apache/oltu/oauth2/common/utils/JSONUtils.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/common/src/main/java/org/apache/oltu/oauth2/common/utils/JSONUtils.java (original)
+++ oltu/trunk/oauth-2.0/common/src/main/java/org/apache/oltu/oauth2/common/utils/JSONUtils.java Wed Oct 25 12:37:17 2017
@@ -23,12 +23,26 @@ package org.apache.oltu.oauth2.common.ut
 
 import static java.lang.String.format;
 
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.Array;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 
-import org.json.JSONArray;
-import org.json.JSONStringer;
-import org.json.JSONTokener;
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonNumber;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+import javax.json.JsonString;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+import javax.json.stream.JsonGenerator;
+import javax.json.stream.JsonGeneratorFactory;
 
 /**
  *
@@ -37,89 +51,157 @@ import org.json.JSONTokener;
  */
 public final class JSONUtils {
 
+    private static final JsonGeneratorFactory GENERATOR_FACTORY = Json.createGeneratorFactory(null);
+
     public static String buildJSON(Map<String, Object> params) {
-        final JSONStringer stringer = new JSONStringer();
-        stringer.object();
+        final StringWriter stringWriter = new StringWriter();
+        final JsonGenerator generator = GENERATOR_FACTORY.createGenerator(stringWriter);
+
+        generator.writeStartObject();
 
         for (Map.Entry<String, Object> param : params.entrySet()) {
-            if (param.getKey() != null && !"".equals(param.getKey()) && param.getValue() != null && !""
-                .equals(param.getValue())) {
-                stringer.key(param.getKey()).value(param.getValue());
+            String key = param.getKey();
+            Object value = param.getValue();
+            if (key != null && value != null) {
+                if (value instanceof Boolean) {
+                    generator.write(key, (Boolean) value);
+                } else if (value instanceof Double) {
+                    generator.write(key, (Double) value);
+                } else if (value instanceof Integer) {
+                    generator.write(key, (Integer) value);
+                } else if (value instanceof BigDecimal) {
+                    generator.write(key, (BigDecimal) value);
+                } else if (value instanceof BigInteger) {
+                    generator.write(key, (BigInteger) value);
+                } else if (value instanceof Long) {
+                    generator.write(key, (Long) value);
+                } else if (value instanceof String) {
+                    String string = (String) value;
+                    if (!string.isEmpty()) {
+                        generator.write(key, string);
+                    }
+                } else if (value.getClass().isArray()) {
+                    generator.writeStartArray(key);
+
+                    for (int i = 0; i < Array.getLength(value); i++) {
+                        witeItem(generator, Array.get(value, i));
+                    }
+
+                    generator.writeEnd();
+                } else if (value instanceof Collection) {
+                    generator.writeStartArray(key);
+
+                    Collection<?> collection = (Collection<?>) value;
+                    for (Object item : collection) {
+                        witeItem(generator, item);
+                    }
+
+                    generator.writeEnd();
+                }
             }
         }
 
-        return stringer.endObject().toString();
+        generator.writeEnd().close();
+
+        return stringWriter.toString();
+    }
+
+    private static <T> void witeItem(JsonGenerator generator, T item) {
+        if (item != null) {
+            if (item instanceof Boolean) {
+                generator.write((Boolean) item);
+            } else if (item instanceof Double) {
+                generator.write((Double) item);
+            } else if (item instanceof Integer) {
+                generator.write((Integer) item);
+            } else if (item instanceof BigDecimal) {
+                generator.write((BigDecimal) item);
+            } else if (item instanceof BigInteger) {
+                generator.write((BigInteger) item);
+            } else if (item instanceof Long) {
+                generator.write((Long) item);
+            } else if (item instanceof String) {
+                generator.write((String) item);
+            }
+        }
     }
 
     public static Map<String, Object> parseJSON(String jsonBody) {
         final Map<String, Object> params = new HashMap<String, Object>();
 
-        final JSONTokener x = new JSONTokener(jsonBody);
-        char c;
-        String key;
+        StringReader reader = new StringReader(jsonBody);
+        JsonReader jsonReader = Json.createReader(reader);
+        JsonStructure structure = jsonReader.read();
 
-        if (x.nextClean() != '{') {
-            throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, a JSON object text must begin with '{'",
+        if (structure == null || structure instanceof JsonArray) {
+            throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation",
                                                       jsonBody));
         }
-        for (;;) {
-            c = x.nextClean();
-            switch (c) {
-            case 0:
-                throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, a JSON object text must end with '}'",
-                                                          jsonBody));
-            case '}':
-                return params;
-            default:
-                x.back();
-                key = x.nextValue().toString();
-            }
 
-            /*
-             * The key is followed by ':'. We will also tolerate '=' or '=>'.
-             */
-            c = x.nextClean();
-            if (c == '=') {
-                if (x.next() != '>') {
-                    x.back();
+        JsonObject object = (JsonObject) structure;
+        for (Entry<String, JsonValue> entry : object.entrySet()) {
+            String key = entry.getKey();
+            if (key != null && !key.isEmpty()) {
+                JsonValue jsonValue = entry.getValue();
+
+                // guard from null values
+                if (jsonValue != null) {
+                    Object value = toJavaObject(jsonValue);
+
+                    params.put(key, value);
                 }
-            } else if (c != ':') {
-                throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'",
-                                                          jsonBody, key));
             }
-            Object value = x.nextValue();
+        }
 
-            // guard from null values
-            if (value != null) {
-                if (value instanceof JSONArray) { // only plain simple arrays in this version
-                    JSONArray array = (JSONArray) value;
-                    Object[] values = new Object[array.length()];
-                    for (int i = 0; i < array.length(); i++) {
-                        values[i] = array.get(i);
-                    }
-                    value = values;
-                }
+        jsonReader.close();
+        return params;
+    }
 
-                params.put(key, value);
-            }
+    private static Object toJavaObject(JsonValue jsonValue) {
+        Object value = null;
 
-            /*
-             * Pairs are separated by ','. We will also tolerate ';'.
-             */
-            switch (x.nextClean()) {
-            case ';':
-            case ',':
-                if (x.nextClean() == '}') {
-                    return params;
+        switch (jsonValue.getValueType()) {
+            case ARRAY:
+                JsonArray array = (JsonArray) jsonValue;
+                Object[] values = new Object[array.size()];
+                for (int i = 0; i < array.size(); i++) {
+                    JsonValue current = array.get(i);
+                    values[i] = toJavaObject(current);
                 }
-                x.back();
+                value = values;
+                break;
+
+            case FALSE:
+                value = false;
                 break;
-            case '}':
-                return params;
+
+            case NULL:
+                value = null;
+                break;
+
+            case NUMBER:
+                JsonNumber jsonNumber = (JsonNumber) jsonValue;
+                value = jsonNumber.numberValue();
+                break;
+
+            case OBJECT:
+                // not supported in this version
+                break;
+
+            case STRING:
+                JsonString jsonString = (JsonString) jsonValue;
+                value = jsonString.getString();
+                break;
+
+            case TRUE:
+                value = true;
+                break;
+
             default:
-                throw new IllegalArgumentException("Expected a ',' or '}'");
-            }
+                break;
         }
+
+        return value;
     }
 
 }

Modified: oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/message/OAuthResponseTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/message/OAuthResponseTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/message/OAuthResponseTest.java (original)
+++ oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/message/OAuthResponseTest.java Wed Oct 25 12:37:17 2017
@@ -45,7 +45,7 @@ public class OAuthResponseTest {
 
         String body = oAuthResponse.getBody();
         assertEquals(
-            "{\"error_uri\":\"http://example-uri\",\"error\":\"error\",\"param\":\"value\",\"realm\":\"album\",\"state\":\"ok\",\"error_description\":\"error_description\"}",
+            "{\"param\":\"value\",\"error_description\":\"error_description\",\"realm\":\"album\",\"state\":\"ok\",\"error\":\"error\",\"error_uri\":\"http://example-uri\"}",
             body);
     }
 

Modified: oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/JSONBodyParametersApplierTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/JSONBodyParametersApplierTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/JSONBodyParametersApplierTest.java (original)
+++ oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/JSONBodyParametersApplierTest.java Wed Oct 25 12:37:17 2017
@@ -21,16 +21,16 @@
 
 package org.apache.oltu.oauth2.common.parameters;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.oltu.oauth2.common.OAuth;
 import org.apache.oltu.oauth2.common.message.OAuthMessage;
-import org.apache.oltu.oauth2.common.parameters.JSONBodyParametersApplier;
-import org.apache.oltu.oauth2.common.parameters.OAuthParametersApplier;
 import org.apache.oltu.oauth2.common.utils.DummyOAuthMessage;
 import org.apache.oltu.oauth2.common.utils.JSONUtils;
-import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -61,14 +61,14 @@ public class JSONBodyParametersApplierTe
 
         String msgBody = message.getBody();
         Map<String, Object> map = JSONUtils.parseJSON(msgBody);
-        Assert.assertEquals(3600, map.get(OAuth.OAUTH_EXPIRES_IN));
-        Assert.assertEquals("token_authz", map.get(OAuth.OAUTH_ACCESS_TOKEN));
-        Assert.assertEquals("code_", map.get(OAuth.OAUTH_CODE));
-        Assert.assertEquals("read", map.get(OAuth.OAUTH_SCOPE));
-        Assert.assertEquals("state", map.get(OAuth.OAUTH_STATE));
-        Assert.assertNull(map.get("empty_param"));
-        Assert.assertNull(map.get("null_param"));
-        Assert.assertNull(map.get(""));
-        Assert.assertNull(map.get(null));
+        assertEquals(3600L, map.get(OAuth.OAUTH_EXPIRES_IN));
+        assertEquals("token_authz", map.get(OAuth.OAUTH_ACCESS_TOKEN));
+        assertEquals("code_", map.get(OAuth.OAUTH_CODE));
+        assertEquals("read", map.get(OAuth.OAUTH_SCOPE));
+        assertEquals("state", map.get(OAuth.OAUTH_STATE));
+        assertNull(map.get("empty_param"));
+        assertNull(map.get("null_param"));
+        assertNull(map.get(""));
+        assertNull(map.get(null));
     }
 }

Modified: oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java (original)
+++ oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/parameters/WWWAuthHeaderParametersApplierTest.java Wed Oct 25 12:37:17 2017
@@ -21,14 +21,14 @@
 
 package org.apache.oltu.oauth2.common.parameters;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.oltu.oauth2.common.OAuth;
 import org.apache.oltu.oauth2.common.message.OAuthResponse;
-import org.apache.oltu.oauth2.common.parameters.OAuthParametersApplier;
-import org.apache.oltu.oauth2.common.parameters.WWWAuthHeaderParametersApplier;
-import org.junit.Assert;
 import org.junit.Test;
 
 /**
@@ -54,14 +54,12 @@ public class WWWAuthHeaderParametersAppl
 
         OAuthParametersApplier applier = new WWWAuthHeaderParametersApplier();
         res = (OAuthResponse)applier.applyOAuthParameters(res, params);
-        Assert.assertNotNull(res);
+        assertNotNull(res);
         String header = res.getHeader(OAuth.HeaderType.WWW_AUTHENTICATE);
-        Assert.assertNotNull(header);
-        Assert.assertEquals(OAuth.OAUTH_HEADER_NAME
-            + " scope=\"s1 s2 s3\",error_uri=\"http://www.example.com/error\",error=\"invalid_token\"",
+        assertNotNull(header);
+        assertEquals(OAuth.OAUTH_HEADER_NAME
+            + " scope=\"s1 s2 s3\",error=\"invalid_token\",error_uri=\"http://www.example.com/error\"",
             header);
-
-
     }
 
 }

Modified: oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/utils/JSONUtilsTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/utils/JSONUtilsTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/utils/JSONUtilsTest.java (original)
+++ oltu/trunk/oauth-2.0/common/src/test/java/org/apache/oltu/oauth2/common/utils/JSONUtilsTest.java Wed Oct 25 12:37:17 2017
@@ -21,12 +21,12 @@
 
 package org.apache.oltu.oauth2.common.utils;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.oltu.oauth2.common.error.OAuthError;
-import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -37,26 +37,13 @@ import org.junit.Test;
 public class JSONUtilsTest {
 
     @Test
-    @Ignore
-    // TODO what are testing here?
     public void testBuildJSON() throws Exception {
-
         Map<String, Object> params = new HashMap<String, Object>();
         params.put(OAuthError.OAUTH_ERROR, OAuthError.TokenResponse.INVALID_REQUEST);
 
         String json = JSONUtils.buildJSON(params);
 
-        /* JSONObject obj = new JSONObject(json);
-
-        AbstractXMLStreamReader reader = new MappedXMLStreamReader(obj);
-
-        Assert.assertEquals(XMLStreamReader.START_ELEMENT, reader.next());
-        Assert.assertEquals(OAuthError.OAUTH_ERROR, reader.getName().getLocalPart());
-
-        Assert.assertEquals(OAuthError.TokenResponse.INVALID_REQUEST, reader.getText());
-        Assert.assertEquals(XMLStreamReader.CHARACTERS, reader.next());
-        Assert.assertEquals(XMLStreamReader.END_ELEMENT, reader.next());
-        Assert.assertEquals(XMLStreamReader.END_DOCUMENT, reader.next()); */
+        assertEquals("{\"error\":\"invalid_request\"}", json);
     }
 
     @Test
@@ -67,8 +54,8 @@ public class JSONUtilsTest {
 
         String s = JSONUtils.buildJSON(jsonParams);
         Map<String, Object> map = JSONUtils.parseJSON(s);
-        Assert.assertEquals("John B. Smith", map.get("author"));
-        Assert.assertEquals("2000", map.get("year"));
+        assertEquals("John B. Smith", map.get("author"));
+        assertEquals("2000", map.get("year"));
     }
 
 }

Modified: oltu/trunk/oauth-2.0/dynamicreg-server/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/dynamicreg-server/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/dynamicreg-server/pom.xml (original)
+++ oltu/trunk/oauth-2.0/dynamicreg-server/pom.xml Wed Oct 25 12:37:17 2017
@@ -49,8 +49,8 @@
     </dependency>
 
     <dependency>
-      <groupId>org.json</groupId>
-      <artifactId>json</artifactId>
+      <groupId>org.apache.johnzon</groupId>
+      <artifactId>johnzon-core</artifactId>
     </dependency>
 
     <dependency>

Modified: oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/JSONHttpServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/JSONHttpServletRequestWrapper.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/JSONHttpServletRequestWrapper.java (original)
+++ oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/JSONHttpServletRequestWrapper.java Wed Oct 25 12:37:17 2017
@@ -22,11 +22,22 @@ package org.apache.oltu.oauth2.ext.dynam
 
 import static java.lang.String.format;
 
+import java.io.StringReader;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Map.Entry;
 
+import javax.json.Json;
+import javax.json.JsonArray;
+import javax.json.JsonNumber;
+import javax.json.JsonObject;
+import javax.json.JsonReader;
+import javax.json.JsonString;
+import javax.json.JsonStructure;
+import javax.json.JsonValue;
+import javax.json.JsonValue.ValueType;
 import javax.servlet.ServletInputStream;
 import javax.servlet.ServletRequest;
 import javax.servlet.http.HttpServletRequest;
@@ -36,8 +47,6 @@ import org.apache.oltu.oauth2.common.OAu
 import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
 import org.apache.oltu.oauth2.common.exception.OAuthRuntimeException;
 import org.apache.oltu.oauth2.common.utils.OAuthUtils;
-import org.json.JSONArray;
-import org.json.JSONTokener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -68,78 +77,84 @@ public class JSONHttpServletRequestWrapp
         if (!bodyRead) {
             String body = readJsonBody();
 
-            final JSONTokener x = new JSONTokener(body);
-            char c;
-            String key;
-
-            if (x.nextClean() != '{') {
-                throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, a JSON object text must begin with '{'",
-                                                       body));
+            StringReader reader = new StringReader(body);
+            JsonReader jsonReader = Json.createReader(reader);
+            JsonStructure structure = jsonReader.read();
+
+            if (structure == null || structure instanceof JsonArray) {
+                throw new IllegalArgumentException(format("String '%s' is not a valid JSON object representation",
+                                                          body));
             }
-            for (;;) {
-                c = x.nextClean();
-                switch (c) {
-                case 0:
-                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, a JSON object text must end with '}'",
-                                                           body));
-                case '}':
-                    return Collections.unmodifiableMap(parameters);
-                default:
-                    x.back();
-                    key = x.nextValue().toString();
-                }
-
-                /*
-                 * The key is followed by ':'. We will also tolerate '=' or '=>'.
-                 */
-                c = x.nextClean();
-                if (c == '=') {
-                    if (x.next() != '>') {
-                        x.back();
-                    }
-                } else if (c != ':') {
-                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'",
-                                                           body, key));
-                }
-                Object value = x.nextValue();
 
-                // guard from null values
-                if (value != null) {
-                    if (value instanceof JSONArray) { // only plain simple arrays in this version
-                        JSONArray array = (JSONArray) value;
-                        String[] values = new String[array.length()];
-                        for (int i = 0; i < array.length(); i++) {
-                            values[i] = String.valueOf(array.get(i));
+            JsonObject object = (JsonObject) structure;
+            for (Entry<String, JsonValue> entry : object.entrySet()) {
+                String key = entry.getKey();
+                if (key != null) {
+                    JsonValue jsonValue = entry.getValue();
+
+                    // guard from null values
+                    if (jsonValue != null) {
+                        String[] values;
+
+                        if (ValueType.ARRAY == jsonValue.getValueType()) {
+                            JsonArray array = (JsonArray) jsonValue;
+                            values = new String[array.size()];
+                            for (int i = 0; i < array.size(); i++) {
+                                JsonValue current = array.get(i);
+                                values[i] = toJavaObject(current);
+                            }
+                        } else {
+                            values = new String[]{ toJavaObject(jsonValue) };
                         }
-                        parameters.put(key, values);
-                    } else {
-                        parameters.put(key, new String[]{ String.valueOf(value) });
-                    }
-                }
 
-                /*
-                 * Pairs are separated by ','. We will also tolerate ';'.
-                 */
-                switch (x.nextClean()) {
-                case ';':
-                case ',':
-                    if (x.nextClean() == '}') {
-                        return Collections.unmodifiableMap(parameters);
+                        parameters.put(key, values);
                     }
-                    x.back();
-                    break;
-                case '}':
-                    return Collections.unmodifiableMap(parameters);
-                default:
-                    throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, Expected a ',' or '}",
-                                                           body));
                 }
             }
+
+            jsonReader.close();
         }
 
         return Collections.unmodifiableMap(parameters);
     }
 
+    private static String toJavaObject(JsonValue jsonValue) {
+        String value = null;
+
+        switch (jsonValue.getValueType()) {
+            case FALSE:
+                value = Boolean.FALSE.toString();
+                break;
+
+            case NULL:
+                value = null;
+                break;
+
+            case NUMBER:
+                JsonNumber jsonNumber = (JsonNumber) jsonValue;
+                value = jsonNumber.numberValue().toString();
+                break;
+
+            case OBJECT:
+                // not supported in this version
+                break;
+
+            case STRING:
+                JsonString jsonString = (JsonString) jsonValue;
+                value = jsonString.getString();
+                break;
+
+            case TRUE:
+                value = Boolean.TRUE.toString();
+                break;
+
+            default:
+                break;
+        }
+
+        return value;
+    }
+
     public Enumeration<String> getParameterNames() {
         return Collections.enumeration(getParameterMap().keySet());
     }

Modified: oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/validator/PushPullValidator.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/validator/PushPullValidator.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/validator/PushPullValidator.java (original)
+++ oltu/trunk/oauth-2.0/dynamicreg-server/src/main/java/org/apache/oltu/oauth2/ext/dynamicreg/server/validator/PushPullValidator.java Wed Oct 25 12:37:17 2017
@@ -78,7 +78,7 @@ public class PushPullValidator extends A
         }
 
         if (log.isDebugEnabled()) {
-            log.debug("OAuth dynamic client registration type is: {}", new String[] {requestType});
+            log.debug("OAuth dynamic client registration type is: {}", new Object[] {requestType});
         }
     }
 }

Modified: oltu/trunk/oauth-2.0/dynamicreg-server/src/test/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/OAuthServerRegistrationRequestTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/dynamicreg-server/src/test/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/OAuthServerRegistrationRequestTest.java?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/dynamicreg-server/src/test/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/OAuthServerRegistrationRequestTest.java (original)
+++ oltu/trunk/oauth-2.0/dynamicreg-server/src/test/java/org/apache/oltu/oauth2/ext/dynamicreg/server/request/OAuthServerRegistrationRequestTest.java Wed Oct 25 12:37:17 2017
@@ -20,12 +20,11 @@
  */
 package org.apache.oltu.oauth2.ext.dynamicreg.server.request;
 
+import static org.junit.Assert.assertEquals;
+
 import org.apache.oltu.oauth2.common.OAuth;
 import org.apache.oltu.oauth2.common.exception.OAuthProblemException;
-import org.apache.oltu.oauth2.ext.dynamicreg.server.request.JSONHttpServletRequestWrapper;
-import org.apache.oltu.oauth2.ext.dynamicreg.server.request.OAuthServerRegistrationRequest;
 import org.apache.oltu.oauth2.utils.test.FileUtils;
-import org.junit.Assert;
 import org.junit.Test;
 import org.springframework.mock.web.MockHttpServletRequest;
 
@@ -45,14 +44,13 @@ public class OAuthServerRegistrationRequ
         final JSONHttpServletRequestWrapper jsonWrapper = new JSONHttpServletRequestWrapper(request);
         OAuthServerRegistrationRequest registrationRequest = new OAuthServerRegistrationRequest(jsonWrapper);
 
-        Assert.assertEquals("Uploading and also editing capabilities!",
+        assertEquals("Uploading and also editing capabilities!",
             registrationRequest.getClientDescription());
-        Assert.assertEquals("http://onlinephotogallery.com/icon.png", registrationRequest.getClientIcon());
-        Assert.assertEquals("Online Photo Gallery", registrationRequest.getClientName());
-        Assert
-            .assertEquals("https://onlinephotogallery.com/client_reg", registrationRequest.getRedirectURI());
-        Assert.assertEquals("push", registrationRequest.getType());
-        Assert.assertEquals("http://onlinephotogallery.com", registrationRequest.getClientUrl());
+        assertEquals("http://onlinephotogallery.com/icon.png", registrationRequest.getClientIcon());
+        assertEquals("Online Photo Gallery", registrationRequest.getClientName());
+        assertEquals("https://onlinephotogallery.com/client_reg", registrationRequest.getRedirectURI());
+        assertEquals("push", registrationRequest.getType());
+        assertEquals("http://onlinephotogallery.com", registrationRequest.getClientUrl());
     }
 
     @Test(expected = OAuthProblemException.class)

Modified: oltu/trunk/oauth-2.0/integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/integration-tests/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/integration-tests/pom.xml (original)
+++ oltu/trunk/oauth-2.0/integration-tests/pom.xml Wed Oct 25 12:37:17 2017
@@ -119,6 +119,11 @@
       <version>${org.springframework.version}</version>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.apache.johnzon</groupId>
+      <artifactId>johnzon-core</artifactId>
+    </dependency>
   </dependencies>
 
   <build>

Modified: oltu/trunk/oauth-2.0/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/pom.xml?rev=1813271&r1=1813270&r2=1813271&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/pom.xml (original)
+++ oltu/trunk/oauth-2.0/pom.xml Wed Oct 25 12:37:17 2017
@@ -88,9 +88,16 @@
   <dependencyManagement>
     <dependencies>
       <dependency>
-        <groupId>org.json</groupId>
-        <artifactId>json</artifactId>
-        <version>20140107</version>
+        <groupId>org.apache.geronimo.specs</groupId>
+        <artifactId>geronimo-json_1.1_spec</artifactId>
+        <version>1.0</version>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.johnzon</groupId>
+        <artifactId>johnzon-core</artifactId>
+        <version>1.1.4</version>
+        <scope>test</scope>
       </dependency>
 
       <dependency>