wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From el...@apache.org
Subject svn commit: r815270 - in /incubator/wink/trunk: ./ wink-common/ wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/ wink-common/src/main/java/org/apache/wink/common/model/json/ wink-examples/apps/QADefect/src/main/java/org/...
Date Tue, 15 Sep 2009 11:02:51 GMT
Author: elman
Date: Tue Sep 15 11:02:48 2009
New Revision: 815270

URL: http://svn.apache.org/viewvc?rev=815270&view=rev
Log:
move json.org providers to a separate module. See [WINK-182]

Added:
    incubator/wink/trunk/wink-providers/wink-json-provider/
    incubator/wink/trunk/wink-providers/wink-json-provider/pom.xml   (with props)
    incubator/wink/trunk/wink-providers/wink-json-provider/src/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/internal/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/internal/json/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JSONUtils.java
      - copied, changed from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/json/JSONUtils.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java
      - copied, changed from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonArrayProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java
      - copied, changed from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonJAXBProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java
      - copied, changed from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonProvider.java
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/java/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/org/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/org/apache/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/org/apache/wink/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/org/apache/wink/providers/
    incubator/wink/trunk/wink-providers/wink-json-provider/src/test/org/apache/wink/providers/json
      - copied unchanged from r815207, incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/JsonProviderTest.java
Removed:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/AbstractJsonXmlProvider.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonArrayProvider.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonJAXBProvider.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonProvider.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/json/JSONUtils.java
    incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/JsonProviderTest.java
Modified:
    incubator/wink/trunk/pom.xml
    incubator/wink/trunk/wink-common/pom.xml
    incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/legacy/DataStore.java
    incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectAsset.java
    incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectsResource.java
    incubator/wink/trunk/wink-examples/client/GoogleDocs-client/src/main/java/org/apache/wink/example/googledocs/GoogleDocsClient.java
    incubator/wink/trunk/wink-providers/pom.xml
    incubator/wink/trunk/wink-providers/wink-abdera-provider/pom.xml
    incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomEntryProviderTest.java
    incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomFeedProviderTest.java
    incubator/wink/trunk/wink-providers/wink-jackson-provider/pom.xml
    incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jackson/JacksonJAXBTest.java
    incubator/wink/trunk/wink-providers/wink-jettison-provider/pom.xml
    incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBBadgerFishTest.java
    incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBMappedTest.java
    incubator/wink/trunk/wink-server/pom.xml
    incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/AssetProviderTest.java

Modified: incubator/wink/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/pom.xml (original)
+++ incubator/wink/trunk/pom.xml Tue Sep 15 11:02:48 2009
@@ -363,6 +363,11 @@
                 <artifactId>wink-client</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.wink</groupId>
+                <artifactId>wink-json-provider</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
             <!-- 3rd party dependencies -->
             <dependency>

Modified: incubator/wink/trunk/wink-common/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/pom.xml (original)
+++ incubator/wink/trunk/wink-common/pom.xml Tue Sep 15 11:02:48 2009
@@ -46,10 +46,6 @@
             <artifactId>slf4j-simple</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.json</groupId>
-            <artifactId>json</artifactId>
-        </dependency>
-        <dependency>
             <groupId>xmlunit</groupId>
             <artifactId>xmlunit</artifactId>
         </dependency>

Modified: incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/legacy/DataStore.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/legacy/DataStore.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/legacy/DataStore.java (original)
+++ incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/legacy/DataStore.java Tue Sep 15 11:02:48 2009
@@ -23,10 +23,13 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
 import java.util.Map.Entry;
 
 import org.slf4j.Logger;
@@ -303,7 +306,12 @@
         // in real world there should have been a sql query, but for example
         // purpose
         // we'll do search manually
-        HashSet<DefectBean> hashSet = new HashSet<DefectBean>();
+        Set<DefectBean> hashSet = new TreeSet<DefectBean>(new Comparator<DefectBean>() {
+
+            public int compare(DefectBean o1, DefectBean o2) {
+                return o1.getId().compareTo(o2.getId());
+            }
+        });
         synchronized (defects) {
             l_defects: for (DefectBean defect : defects.values()) {
                 for (Entry<String, String> entry : searchParameters.entrySet()) {

Modified: incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectAsset.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectAsset.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectAsset.java (original)
+++ incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectAsset.java Tue Sep 15 11:02:48 2009
@@ -69,7 +69,7 @@
         this.child = child;
     }
 
-    @Produces( {MediaType.APPLICATION_XML})
+    @Produces( {MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
     public DefectBean getDefect() {
         return defect;
     }
@@ -79,7 +79,7 @@
         return new HtmlDescriptor(defect, CUSTOMIZED_JSP_PATH, CUSTOMIZED_JSP_ATTR);
     }
 
-    @Produces( {MediaType.WILDCARD, MediaType.APPLICATION_JSON})
+    @Produces( {MediaType.WILDCARD})
     public SyndEntry getSyndEntry(@Context Providers providers,
                                   @Context UriInfo uriInfo,
                                   @Context LinkBuilders linkProcessor) throws IOException {
@@ -128,7 +128,7 @@
         return entry;
     }
 
-    @Consumes(MediaType.APPLICATION_XML)
+    @Consumes( {MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
     public void setDefect(DefectBean defect) {
         this.defect = defect;
     }

Modified: incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectsResource.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectsResource.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectsResource.java (original)
+++ incubator/wink/trunk/wink-examples/apps/QADefect/src/main/java/org/apache/wink/example/qadefect/resources/DefectsResource.java Tue Sep 15 11:02:48 2009
@@ -162,7 +162,7 @@
     }
 
     @POST
-    @Consumes("text/csv")
+    @Consumes({"text/csv"})
     @Produces( {MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON,
         MediaType.APPLICATION_XML})
     public Response createDefects(DefectsAsset defects,
@@ -184,7 +184,7 @@
     }
 
     @POST
-    @Consumes( {MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_XML})
+    @Consumes( {MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
     @Produces( {MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON,
         MediaType.APPLICATION_XML})
     public Response createDefect(DefectAsset asset, @Context UriInfo uriInfo) throws IOException,

Modified: incubator/wink/trunk/wink-examples/client/GoogleDocs-client/src/main/java/org/apache/wink/example/googledocs/GoogleDocsClient.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-examples/client/GoogleDocs-client/src/main/java/org/apache/wink/example/googledocs/GoogleDocsClient.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-examples/client/GoogleDocs-client/src/main/java/org/apache/wink/example/googledocs/GoogleDocsClient.java (original)
+++ incubator/wink/trunk/wink-examples/client/GoogleDocs-client/src/main/java/org/apache/wink/example/googledocs/GoogleDocsClient.java Tue Sep 15 11:02:48 2009
@@ -78,7 +78,10 @@
         }
 
         // add google authentication handler
-        config.handlers(new GoogleAuthHandler(cliHelper.getEmail(), cliHelper.getPassword()));
+//        config.handlers(new GoogleAuthHandler(cliHelper.getEmail(), cliHelper.getPassword()));
+        APSHandler apsHandler = new APSHandler();
+        apsHandler.setChallenge("GoogleLogin");
+        config.handlers(apsHandler);
         restClient = new RestClient(config);
         this.cliHelper = cliHelper;
     }

Modified: incubator/wink/trunk/wink-providers/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/pom.xml (original)
+++ incubator/wink/trunk/wink-providers/pom.xml Tue Sep 15 11:02:48 2009
@@ -30,6 +30,7 @@
 		<version>0.2-incubating-SNAPSHOT</version>
 	</parent>
 	<modules>
+		<module>wink-json-provider</module>
 		<module>wink-jettison-provider</module>
 		<module>wink-abdera-provider</module>
 		<module>wink-jackson-provider</module>

Modified: incubator/wink/trunk/wink-providers/wink-abdera-provider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-abdera-provider/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-abdera-provider/pom.xml (original)
+++ incubator/wink/trunk/wink-providers/wink-abdera-provider/pom.xml Tue Sep 15 11:02:48 2009
@@ -1,72 +1,76 @@
 <?xml version="1.0" encoding="UTF-8"?>
-    <!--
-        Licensed to the Apache Software Foundation (ASF) under one or
-        more contributor license agreements. See the NOTICE file
-        distributed with this work for additional information regarding
-        copyright ownership. The ASF licenses this file to you under the
-        Apache License, Version 2.0 (the "License"); you may not use
-        this file except in compliance with the License. You may obtain
-        a copy of the License at
+	<!--
+		Licensed to the Apache Software Foundation (ASF) under one or more
+		contributor license agreements. See the NOTICE file distributed with
+		this work for additional information regarding copyright ownership.
+		The ASF licenses this file to you under the Apache License, Version
+		2.0 (the "License"); you may not use this file except in compliance
+		with the License. You may obtain a copy of the License at
 
-        http://www.apache.org/licenses/LICENSE-2.0 Unless required by
-        applicable law or agreed to in writing, software distributed
-        under the License is distributed on an "AS IS" BASIS, WITHOUT
-        WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-        See the License for the specific language governing permissions
-        and limitations under the License.
-    -->
+		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+		applicable law or agreed to in writing, software distributed under the
+		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+		CONDITIONS OF ANY KIND, either express or implied. See the License for
+		the specific language governing permissions and limitations under the
+		License.
+	-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <parent>
-        <artifactId>wink-providers</artifactId>
-        <groupId>org.apache.wink</groupId>
-        <version>0.2-incubating-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.apache.wink</groupId>
-    <artifactId>wink-abdera-provider</artifactId>
-    <name>Apache Wink Providers :: Abdera Provider</name>
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.abdera</groupId>
-            <artifactId>abdera-core</artifactId>
-            <version>0.4.0-incubating</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.abdera</groupId>
-            <artifactId>abdera-extensions-json</artifactId>
-            <version>0.4.0-incubating</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.wink</groupId>
-            <artifactId>wink-component-test-support</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.springframework</groupId>
-            <artifactId>spring-test</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-j2ee_1.4_spec</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.wink</groupId>
-            <artifactId>wink-server</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<artifactId>wink-providers</artifactId>
+		<groupId>org.apache.wink</groupId>
+		<version>0.2-incubating-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.apache.wink</groupId>
+	<artifactId>wink-abdera-provider</artifactId>
+	<name>Apache Wink Providers :: Abdera Provider</name>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.abdera</groupId>
+			<artifactId>abdera-core</artifactId>
+			<version>0.4.0-incubating</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.abdera</groupId>
+			<artifactId>abdera-extensions-json</artifactId>
+			<version>0.4.0-incubating</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-component-test-support</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-json-provider</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-test</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-j2ee_1.4_spec</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-server</artifactId>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
 
-    <repositories>
-        <repository>
-            <id>apache-incubating</id>
-            <name>Apache Incubating Repository</name>
-            <url>http://people.apache.org/repo/m2-incubating-repository/</url>
-        </repository>
-    </repositories>
+	<repositories>
+		<repository>
+			<id>apache-incubating</id>
+			<name>Apache Incubating Repository</name>
+			<url>http://people.apache.org/repo/m2-incubating-repository/</url>
+		</repository>
+	</repositories>
 </project>
\ No newline at end of file

Modified: incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomEntryProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomEntryProviderTest.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomEntryProviderTest.java (original)
+++ incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomEntryProviderTest.java Tue Sep 15 11:02:48 2009
@@ -35,7 +35,7 @@
 import org.apache.abdera.Abdera;
 import org.apache.abdera.model.Entry;
 import org.apache.wink.common.model.atom.AtomEntry;
-import org.apache.wink.common.model.json.JSONUtils;
+import org.apache.wink.providers.json.JSONUtils;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;
 import org.springframework.mock.web.MockHttpServletRequest;

Modified: incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomFeedProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomFeedProviderTest.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomFeedProviderTest.java (original)
+++ incubator/wink/trunk/wink-providers/wink-abdera-provider/src/test/java/org/apache/wink/common/internal/providers/entity/abdera/AbderaAtomFeedProviderTest.java Tue Sep 15 11:02:48 2009
@@ -37,7 +37,7 @@
 import org.apache.abdera.model.Feed;
 import org.apache.wink.common.model.atom.AtomEntry;
 import org.apache.wink.common.model.atom.AtomFeed;
-import org.apache.wink.common.model.json.JSONUtils;
+import org.apache.wink.providers.json.JSONUtils;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;
 import org.springframework.mock.web.MockHttpServletRequest;

Modified: incubator/wink/trunk/wink-providers/wink-jackson-provider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jackson-provider/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jackson-provider/pom.xml (original)
+++ incubator/wink/trunk/wink-providers/wink-jackson-provider/pom.xml Tue Sep 15 11:02:48 2009
@@ -55,6 +55,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.wink</groupId>
+            <artifactId>wink-json-provider</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.wink</groupId>
             <artifactId>wink-component-test-support</artifactId>
         </dependency>
         <dependency>

Modified: incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jackson/JacksonJAXBTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jackson/JacksonJAXBTest.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jackson/JacksonJAXBTest.java (original)
+++ incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jackson/JacksonJAXBTest.java Tue Sep 15 11:02:48 2009
@@ -35,8 +35,8 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.apache.wink.common.model.atom.AtomEntry;
-import org.apache.wink.common.model.json.JSONUtils;
 import org.apache.wink.common.model.synd.SyndEntry;
+import org.apache.wink.providers.json.JSONUtils;
 import org.apache.wink.server.internal.providers.entity.jackson.jaxb.Person;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;

Modified: incubator/wink/trunk/wink-providers/wink-jettison-provider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jettison-provider/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jettison-provider/pom.xml (original)
+++ incubator/wink/trunk/wink-providers/wink-jettison-provider/pom.xml Tue Sep 15 11:02:48 2009
@@ -1,22 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-    
-     http://www.apache.org/licenses/LICENSE-2.0
-    
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
+	<!--
+		Licensed to the Apache Software Foundation (ASF) under one or more
+		contributor license agreements. See the NOTICE file distributed with
+		this work for additional information regarding copyright ownership.
+		The ASF licenses this file to you under the Apache License, Version
+		2.0 (the "License"); you may not use this file except in compliance
+		with the License. You may obtain a copy of the License at
+
+		http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+		applicable law or agreed to in writing, software distributed under the
+		License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+		CONDITIONS OF ANY KIND, either express or implied. See the License for
+		the specific language governing permissions and limitations under the
+		License.
+	-->
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<parent>
@@ -42,6 +39,11 @@
 			<artifactId>wink-component-test-support</artifactId>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-json-provider</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
 			<groupId>org.springframework</groupId>
 			<artifactId>spring</artifactId>
 			<scope>test</scope>
@@ -50,11 +52,11 @@
 			<groupId>org.springframework</groupId>
 			<artifactId>spring-test</artifactId>
 		</dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-j2ee_1.4_spec</artifactId>
-            <scope>test</scope>
-        </dependency>
+		<dependency>
+			<groupId>org.apache.geronimo.specs</groupId>
+			<artifactId>geronimo-j2ee_1.4_spec</artifactId>
+			<scope>test</scope>
+		</dependency>
 		<dependency>
 			<groupId>org.apache.wink</groupId>
 			<artifactId>wink-server</artifactId>

Modified: incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBBadgerFishTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBBadgerFishTest.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBBadgerFishTest.java (original)
+++ incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBBadgerFishTest.java Tue Sep 15 11:02:48 2009
@@ -35,8 +35,8 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.apache.wink.common.model.atom.AtomEntry;
-import org.apache.wink.common.model.json.JSONUtils;
 import org.apache.wink.common.model.synd.SyndEntry;
+import org.apache.wink.providers.json.JSONUtils;
 import org.apache.wink.server.internal.providers.entity.jettison.jaxb.Person;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;

Modified: incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBMappedTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBMappedTest.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBMappedTest.java (original)
+++ incubator/wink/trunk/wink-providers/wink-jettison-provider/src/test/java/org/apache/wink/server/internal/providers/entity/jettison/JettisonJAXBMappedTest.java Tue Sep 15 11:02:48 2009
@@ -38,8 +38,8 @@
 import javax.xml.datatype.XMLGregorianCalendar;
 
 import org.apache.wink.common.model.atom.AtomEntry;
-import org.apache.wink.common.model.json.JSONUtils;
 import org.apache.wink.common.model.synd.SyndEntry;
+import org.apache.wink.providers.json.JSONUtils;
 import org.apache.wink.server.internal.providers.entity.jettison.jaxb.Person;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;

Added: incubator/wink/trunk/wink-providers/wink-json-provider/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/pom.xml?rev=815270&view=auto
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-json-provider/pom.xml (added)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/pom.xml Tue Sep 15 11:02:48 2009
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<parent>
+		<artifactId>wink-providers</artifactId>
+		<groupId>org.apache.wink</groupId>
+		<version>0.2-incubating-SNAPSHOT</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<artifactId>wink-json-provider</artifactId>
+	<name>Apache Wink Providers :: Json Provider</name>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-common</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-component-test-support</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-test</artifactId>
+		</dependency>
+            <dependency>
+                <groupId>org.json</groupId>
+                <artifactId>json</artifactId>
+            </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-j2ee_1.4_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
+		<dependency>
+			<groupId>org.apache.wink</groupId>
+			<artifactId>wink-server</artifactId>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>
\ No newline at end of file

Propchange: incubator/wink/trunk/wink-providers/wink-json-provider/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JSONUtils.java (from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/json/JSONUtils.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JSONUtils.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JSONUtils.java&p1=incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/json/JSONUtils.java&r1=815207&r2=815270&rev=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/json/JSONUtils.java (original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/JSONUtils.java Tue Sep 15 11:02:48 2009
@@ -18,7 +18,7 @@
  *  
  *******************************************************************************/
 
-package org.apache.wink.common.model.json;
+package org.apache.wink.providers.json;
 
 import java.util.Iterator;
 

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java (from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonArrayProvider.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java&p1=incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonArrayProvider.java&r1=815207&r2=815270&rev=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonArrayProvider.java (original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonArrayProvider.java Tue Sep 15 11:02:48 2009
@@ -17,7 +17,7 @@
  *  under the License.
  *  
  *******************************************************************************/
-package org.apache.wink.common.internal.providers.entity.json;
+package org.apache.wink.providers.json.internal;
 
 import java.io.IOException;
 import java.io.InputStream;

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java (from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonJAXBProvider.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java&p1=incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonJAXBProvider.java&r1=815207&r2=815270&rev=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonJAXBProvider.java (original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonJAXBProvider.java Tue Sep 15 11:02:48 2009
@@ -18,44 +18,47 @@
  *  
  *******************************************************************************/
 
-package org.apache.wink.common.internal.providers.entity.json;
+package org.apache.wink.providers.json.internal;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 
+import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response.Status;
+import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.MessageBodyWriter;
 import javax.ws.rs.ext.Provider;
 import javax.ws.rs.ext.Providers;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Marshaller;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.wink.common.annotations.Scope;
 import org.apache.wink.common.annotations.Scope.ScopeType;
-import org.apache.wink.common.internal.i18n.Messages;
+import org.apache.wink.common.internal.providers.entity.xml.JAXBXmlProvider;
 import org.apache.wink.common.internal.utils.MediaTypeUtils;
+import org.json.JSONException;
 import org.json.JSONObject;
+import org.json.XML;
 
 @Scope(ScopeType.PROTOTYPE)
 @Provider
 @Produces( {MediaType.APPLICATION_JSON, MediaTypeUtils.JAVASCRIPT})
-public class JsonJAXBProvider extends AbstractJsonXmlProvider implements MessageBodyWriter<Object> {
-
-    private static final Logger           logger = LoggerFactory.getLogger(JsonJAXBProvider.class);
+@Consumes( {MediaType.APPLICATION_JSON, MediaTypeUtils.JAVASCRIPT})
+public class JsonJAXBProvider implements MessageBodyWriter<Object>, MessageBodyReader<Object> {
 
     @Context
     private Providers                     providers;
 
     private MessageBodyWriter<JSONObject> bodyWriter;
+    private MessageBodyReader<JSONObject> bodyReader;
 
     public long getSize(Object t,
                         Class<?> type,
@@ -70,7 +73,8 @@
                                Annotation[] annotations,
                                MediaType mediaType) {
         // we can handle only JAXB objects
-        if (!isJAXBObject(type, genericType) && !isJAXBElement(type, genericType)) {
+        if (!JAXBXmlProvider.isJAXBObject(type, genericType) && !JAXBXmlProvider
+            .isJAXBElement(type, genericType)) {
             return false;
         }
         // verify we have a writer for JSONObject
@@ -92,31 +96,104 @@
                         MediaType mediaType,
                         MultivaluedMap<String, Object> httpHeaders,
                         OutputStream entityStream) throws IOException, WebApplicationException {
-        Object jaxb = super.getEntityToMarshal(t, type);
-        JSONObject json = jaxbToJson(jaxb, type, mediaType);
-        bodyWriter.writeTo(json,
-                           JSONObject.class,
-                           JSONObject.class,
-                           annotations,
-                           mediaType,
-                           httpHeaders,
-                           entityStream);
-    }
 
-    private JSONObject jaxbToJson(Object jaxbObject, Class<?> type, MediaType mediaType) {
         try {
-            if (type == JAXBElement.class) {
-                type = ((JAXBElement<?>)jaxbObject).getDeclaredType();
-            }
-            Marshaller marshaller = super.getMarshaller(type, mediaType);
-            JsonContentHandler handler = new JsonContentHandler();
-            marshaller.setListener(handler);
-            marshaller.marshal(jaxbObject, handler);
-            return handler.getJsonResult();
-        } catch (JAXBException e) {
-            logger.error(Messages.getMessage("jsonFailConvertJAXBToJSON"), type.getName());
+            @SuppressWarnings("unchecked")
+            MessageBodyWriter<Object> jaxbWriter =
+                (MessageBodyWriter<Object>)providers
+                    .getMessageBodyWriter(type,
+                                          genericType,
+                                          annotations,
+                                          MediaType.APPLICATION_XML_TYPE);
+            ByteArrayOutputStream os = new ByteArrayOutputStream();
+            jaxbWriter.writeTo(t,
+                               type,
+                               genericType,
+                               annotations,
+                               MediaType.APPLICATION_XML_TYPE,
+                               httpHeaders,
+                               os);
+            JSONObject json = XML.toJSONObject(os.toString());
+            bodyWriter.writeTo(json,
+                               JSONObject.class,
+                               JSONObject.class,
+                               annotations,
+                               mediaType,
+                               httpHeaders,
+                               entityStream);
+        } catch (JSONException e) {
             throw new WebApplicationException(e);
         }
     }
 
+    // private JSONObject jaxbToJson(Object jaxbObject, Class<?> type, MediaType
+    // mediaType) {
+    // try {
+    // if (type == JAXBElement.class) {
+    // type = ((JAXBElement<?>)jaxbObject).getDeclaredType();
+    // }
+    // Marshaller marshaller = super.getMarshaller(type, mediaType);
+    // JsonContentHandler handler = new JsonContentHandler();
+    // marshaller.setListener(handler);
+    // marshaller.marshal(jaxbObject, handler);
+    // return handler.getJsonResult();
+    // } catch (JAXBException e) {
+    // logger.error(Messages.getMessage("jsonFailConvertJAXBToJSON"),
+    // type.getName());
+    // throw new WebApplicationException(e);
+    // }
+    // }
+
+    public boolean isReadable(Class<?> type,
+                              Type genericType,
+                              Annotation[] annotations,
+                              MediaType mediaType) {
+        // we can handle only JAXB objects
+        if (!JAXBXmlProvider.isJAXBObject(type, genericType) && !JAXBXmlProvider
+            .isJAXBElement(type, genericType)) {
+            return false;
+        }
+        // verify we have a reader for JSONObject
+        bodyReader =
+            providers.getMessageBodyReader(JSONObject.class,
+                                           JSONObject.class,
+                                           annotations,
+                                           mediaType);
+        if (bodyReader == null) {
+            return false;
+        }
+        return true;
+    }
+
+    public Object readFrom(Class<Object> type,
+                           Type genericType,
+                           Annotation[] annotations,
+                           MediaType mediaType,
+                           MultivaluedMap<String, String> httpHeaders,
+                           InputStream entityStream) throws IOException, WebApplicationException {
+
+        try {
+            JSONObject json =
+                bodyReader.readFrom(JSONObject.class,
+                                    JSONObject.class,
+                                    annotations,
+                                    mediaType,
+                                    httpHeaders,
+                                    entityStream);
+            String xml = XML.toString(json);
+            MessageBodyReader<Object> jaxbReader =
+                providers.getMessageBodyReader(type,
+                                               genericType,
+                                               annotations,
+                                               MediaType.APPLICATION_XML_TYPE);
+            return jaxbReader.readFrom(type,
+                                       genericType,
+                                       annotations,
+                                       MediaType.APPLICATION_XML_TYPE,
+                                       httpHeaders,
+                                       new ByteArrayInputStream(xml.getBytes()));
+        } catch (JSONException e) {
+            throw new WebApplicationException(e, Status.BAD_REQUEST);
+        }
+    }
 }

Copied: incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java (from r815207, incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonProvider.java)
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java?p2=incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java&p1=incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonProvider.java&r1=815207&r2=815270&rev=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/internal/providers/entity/json/JsonProvider.java (original)
+++ incubator/wink/trunk/wink-providers/wink-json-provider/src/main/java/org/apache/wink/providers/json/internal/JsonProvider.java Tue Sep 15 11:02:48 2009
@@ -18,7 +18,7 @@
  *  
  *******************************************************************************/
 
-package org.apache.wink.common.internal.providers.entity.json;
+package org.apache.wink.providers.json.internal;
 
 import java.io.IOException;
 import java.io.InputStream;

Modified: incubator/wink/trunk/wink-server/pom.xml
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/pom.xml?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/pom.xml (original)
+++ incubator/wink/trunk/wink-server/pom.xml Tue Sep 15 11:02:48 2009
@@ -91,10 +91,6 @@
             <artifactId>activation</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.json</groupId>
-            <artifactId>json</artifactId>
-        </dependency>
-        <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
         </dependency>

Modified: incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/AssetProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/AssetProviderTest.java?rev=815270&r1=815269&r2=815270&view=diff
==============================================================================
--- incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/AssetProviderTest.java (original)
+++ incubator/wink/trunk/wink-server/src/test/java/org/apache/wink/server/internal/providers/entity/AssetProviderTest.java Tue Sep 15 11:02:48 2009
@@ -27,7 +27,6 @@
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.Providers;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
@@ -39,12 +38,9 @@
 import javax.xml.bind.annotation.XmlValue;
 
 import org.apache.wink.common.annotations.Asset;
-import org.apache.wink.common.model.json.JSONUtils;
 import org.apache.wink.server.internal.servlet.MockServletInvocationTest;
 import org.apache.wink.test.mock.MockRequestConstructor;
 import org.apache.wink.test.mock.TestUtils;
-import org.json.JSONException;
-import org.json.JSONObject;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.mock.web.MockHttpServletResponse;
 
@@ -57,11 +53,10 @@
 
     private static final String STRING = "hello message";
     private static final String XML    =
-                                           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + 
-                                           "<entry>\r\n" + 
-                                           "    <id>entry:id</id>\r\n" + 
-                                           "    <title type=\"text\">entry title</title>\r\n" + 
-                                           "</entry>\r\n";
+                                           "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n" + "<entry>\r\n"
+                                               + "    <id>entry:id</id>\r\n"
+                                               + "    <title type=\"text\">entry title</title>\r\n"
+                                               + "</entry>\r\n";
     private static final String JSON   =
                                            "{\"entry\": {\n" + "  \"id\": {\"$\": \"entry:id\"},\n"
                                                + "  \"title\": {\n"
@@ -93,15 +88,6 @@
     @Asset
     public static class TestAsset {
 
-        @Produces(MediaType.APPLICATION_JSON)
-        public JSONObject getJSONObject(@Context UriInfo info) {
-            assertNotNull(info);
-            try {
-                return new JSONObject(JSON);
-            } catch (JSONException e) {
-                throw new RuntimeException(e);
-            }
-        }
 
         @Produces(MediaType.APPLICATION_XML)
         public Entry getJAXBEntry() {
@@ -140,29 +126,19 @@
     @Path("test")
     public static class TestResource {
         @GET
-        @Produces( {"application/json", "application/xml", "text/plain"})
+        @Produces( {"application/xml", "text/plain"})
         public TestAsset getAsset() {
             return new TestAsset();
         }
 
         @POST
-        @Produces( {"application/json", "application/xml", "text/plain"})
+        @Produces( {"application/xml", "text/plain"})
         @Consumes( {"application/xml", "text/plain"})
         public TestAsset postAsset(TestAsset asset) {
             return asset;
         }
     }
 
-    public void testAssetGetJson() throws Exception {
-        MockHttpServletRequest request =
-            MockRequestConstructor.constructMockRequest("GET", "/test", "application/json");
-        MockHttpServletResponse response = invoke(request);
-        assertEquals(200, response.getStatus());
-        JSONObject result = JSONUtils.objectForString(response.getContentAsString());
-        JSONObject expected = JSONUtils.objectForString(JSON);
-        assertTrue(JSONUtils.equals(expected, result));
-    }
-
     public void testAssetGetXml() throws Exception {
         MockHttpServletRequest request =
             MockRequestConstructor.constructMockRequest("GET", "/test", "application/xml");



Mime
View raw message