wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r935193 - in /incubator/wink/trunk/wink-itests/wink-itest: wink-itest-client/src/test/java/org/apache/wink/itest/client/ wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/ wink-itest-filter/src/test/java/org/apache/wink/tes...
Date Sat, 17 Apr 2010 15:29:51 GMT
Author: bluk
Date: Sat Apr 17 15:29:50 2010
New Revision: 935193

URL: http://svn.apache.org/viewvc?rev=935193&view=rev
Log:
Update itests for charset output

Modified:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client/src/test/java/org/apache/wink/itest/client/NoAcceptHeaderHandlerTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client/src/test/java/org/apache/wink/itest/client/NoAcceptHeaderHandlerTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client/src/test/java/org/apache/wink/itest/client/NoAcceptHeaderHandlerTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client/src/test/java/org/apache/wink/itest/client/NoAcceptHeaderHandlerTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-client/src/test/java/org/apache/wink/itest/client/NoAcceptHeaderHandlerTest.java
Sat Apr 17 15:29:50 2010
@@ -33,6 +33,7 @@ import org.apache.wink.client.ClientConf
 import org.apache.wink.client.ClientResponse;
 import org.apache.wink.client.RestClient;
 import org.apache.wink.client.internal.handlers.AcceptHeaderHandler;
+import org.apache.wink.common.internal.i18n.Messages;
 import org.apache.wink.itest.client.jaxb.Echo;
 import org.apache.wink.providers.json.JsonProvider;
 import org.apache.wink.test.integration.ServerEnvironmentInfo;
@@ -145,7 +146,7 @@ public class NoAcceptHeaderHandlerTest e
         } catch (RuntimeException e) {
             assertEquals(e.getMessage(),
                          String
-                             .format("No javax.ws.rs.ext.MessageBodyReader found for type
class %s and media type %s .  Verify that all entity providers are correctly registered.",
+                             .format("No javax.ws.rs.ext.MessageBodyReader found for type
class %s and media type %s.  Verify that all entity providers are correctly registered.",
                                      Echo.class.getName(),
                                      MediaType.TEXT_PLAIN));
         }
@@ -163,9 +164,10 @@ public class NoAcceptHeaderHandlerTest e
             // assertTrue(value, value.contains(MediaType.APPLICATION_JSON));
             // assertTrue(value, value.contains("application/javascript"));
         } catch (RuntimeException e) {
+            e.printStackTrace();
             assertEquals(e.getMessage(),
                          String
-                             .format("No javax.ws.rs.ext.MessageBodyReader found for type
class %s and media type %s .  Verify that all entity providers are correctly registered.",
+                             .format("No javax.ws.rs.ext.MessageBodyReader found for type
class %s and media type %s.  Verify that all entity providers are correctly registered.",
                                      JSONObject.class.getName(),
                                      MediaType.TEXT_PLAIN));
         }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/JAXRSHttpHeadersTest.java
Sat Apr 17 15:29:50 2010
@@ -37,7 +37,7 @@ import org.apache.wink.test.integration.
 public class JAXRSHttpHeadersTest extends TestCase {
 
     private static String getBaseURI() {
-        if(ServerEnvironmentInfo.isRestFilterUsed()) {
+        if (ServerEnvironmentInfo.isRestFilterUsed()) {
             return ServerEnvironmentInfo.getBaseURI();
         }
         return ServerEnvironmentInfo.getBaseURI() + "/httpheaders";
@@ -170,7 +170,8 @@ public class JAXRSHttpHeadersTest extend
             assertEquals(200, getMethod.getStatusCode());
             String responseBody = getMethod.getResponseBodyAsString();
             assertEquals("acceptablemediatypes:text/plain:", responseBody);
-            assertEquals("text/plain", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -195,7 +196,8 @@ public class JAXRSHttpHeadersTest extend
             String responseBody = getMethod.getResponseBodyAsString();
             assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:",
                          responseBody);
-            assertEquals("text/plain;q=1.0", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain;q=1.0" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-context/src/test/java/org/apache/wink/itest/httpheaders/WinkHttpHeadersTest.java
Sat Apr 17 15:29:50 2010
@@ -162,7 +162,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         String responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:", responseBody);
-        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders().getFirst("Content-Type"));
+        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/context/httpheaders/acceptablemediatypes")
@@ -170,7 +171,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:", responseBody);
-        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders().getFirst("Content-Type"));
+        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/context/httpheaders//acceptablemediatypes")
@@ -178,7 +180,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:", responseBody);
-        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders().getFirst("Content-Type"));
+        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
     }
 
     /**
@@ -211,7 +214,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         String responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/context/httpheaders/acceptablemediatypes")
@@ -220,7 +224,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/context/httpheaders/acceptablemediatypes")
@@ -229,7 +234,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/context/httpheaders/acceptablemediatypes")
@@ -239,7 +245,8 @@ public class WinkHttpHeadersTest extends
         assertEquals(200, response.getStatusCode());
         responseBody = response.getEntity(String.class);
         assertEquals("acceptablemediatypes:text/plain:text/xml:application/json:*/*:", responseBody);
-        assertEquals("text/plain;q=1.0", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("text/plain;q=1.0" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
     }
 
     /**

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java
Sat Apr 17 15:29:50 2010
@@ -55,7 +55,7 @@ public class PersonAppTest extends TestC
         try {
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals(MediaType.TEXT_PLAIN, postMethod
+            assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", postMethod
                 .getResponseHeader(HttpHeaders.CONTENT_TYPE).getValue());
             assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix
entity: Hello",
                          postMethod.getResponseBodyAsString());
@@ -70,7 +70,7 @@ public class PersonAppTest extends TestC
         try {
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals(MediaType.TEXT_XML, postMethod.getResponseHeader(HttpHeaders.CONTENT_TYPE)
+            assertEquals(MediaType.TEXT_XML + ";charset=UTF-8", postMethod.getResponseHeader(HttpHeaders.CONTENT_TYPE)
                 .getValue());
             assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix
entity: Hello",
                          postMethod.getResponseBodyAsString());

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
Sat Apr 17 15:29:50 2010
@@ -49,7 +49,8 @@ public class WinkPersonAppTest extends T
             client.resource(getBaseURI() + "/person/abcd").contentType(MediaType.TEXT_PLAIN)
                 .post("Hello");
         assertEquals(200, response.getStatusCode());
-        assertEquals(MediaType.TEXT_PLAIN, response.getHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
+        assertEquals(MediaType.TEXT_PLAIN + ";charset=UTF-8", response.getHeaders()
+            .getFirst(HttpHeaders.CONTENT_TYPE));
         assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix
entity: Hello",
                      response.getEntity(String.class));
     }
@@ -59,7 +60,8 @@ public class WinkPersonAppTest extends T
             client.resource(getBaseURI() + "/person/abcd").contentType(MediaType.TEXT_XML)
                 .post("Hello");
         assertEquals(200, response.getStatusCode());
-        assertEquals(MediaType.TEXT_XML, response.getHeaders().getFirst(HttpHeaders.CONTENT_TYPE));
+        assertEquals(MediaType.TEXT_XML + ";charset=UTF-8", response.getHeaders()
+            .getFirst(HttpHeaders.CONTENT_TYPE));
         assertEquals("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix
entity: Hello",
                      response.getEntity(String.class));
     }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/readers/JAXRSMessageBodyReadersTest.java
Sat Apr 17 15:29:50 2010
@@ -293,7 +293,8 @@ public class JAXRSMessageBodyReadersTest
             client.executeMethod(postMethod);
 
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain" + ";charset=UTF-8", postMethod
+                .getResponseHeader("Content-Type").getValue());
             assertEquals("Hello thereWorld there", postMethod.getResponseBodyAsString());
         } finally {
             postMethod.releaseConnection();
@@ -322,7 +323,8 @@ public class JAXRSMessageBodyReadersTest
             client.executeMethod(postMethod);
 
             assertEquals(200, postMethod.getStatusCode());
-            assertEquals("text/plain", postMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain" + ";charset=UTF-8", postMethod
+                .getResponseHeader("Content-Type").getValue());
             assertEquals("Hello thereWorld there", postMethod.getResponseBodyAsString());
         } finally {
             postMethod.releaseConnection();

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-providers/src/test/java/org/apache/wink/itest/writers/JAXRSMessageBodyWritersTest.java
Sat Apr 17 15:29:50 2010
@@ -349,7 +349,8 @@ public class JAXRSMessageBodyWritersTest
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello there", getMethod.getResponseBodyAsString());
-            assertEquals("text/plain", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -362,7 +363,7 @@ public class JAXRSMessageBodyWritersTest
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello there", getMethod.getResponseBodyAsString());
-            assertEquals("text/xml", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/xml" + ";charset=UTF-8", getMethod.getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/NullValuesDuringTargettingTest.java
Sat Apr 17 15:29:50 2010
@@ -260,7 +260,7 @@ public class NullValuesDuringTargettingT
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
             assertEquals("calledWithProduces", postMethod.getResponseBodyAsString());
-            assertEquals("custom/type;q=0.8", postMethod.getResponseHeader("Content-Type")
+            assertEquals("custom/type;q=0.8" + ";charset=UTF-8", postMethod.getResponseHeader("Content-Type")
                 .getValue());
         } finally {
             postMethod.releaseConnection();
@@ -281,7 +281,7 @@ public class NullValuesDuringTargettingT
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
             assertEquals("calledWithoutProduces", postMethod.getResponseBodyAsString());
-            assertEquals("custom/type2;q=0.8", postMethod.getResponseHeader("Content-Type")
+            assertEquals("custom/type2;q=0.8" + ";charset=UTF-8", postMethod.getResponseHeader("Content-Type")
                 .getValue());
         } finally {
             postMethod.releaseConnection();
@@ -301,7 +301,7 @@ public class NullValuesDuringTargettingT
             client.executeMethod(postMethod);
             assertEquals(200, postMethod.getStatusCode());
             assertEquals("calledWithProduces", postMethod.getResponseBodyAsString());
-            assertEquals("custom/type", postMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("custom/type" + ";charset=UTF-8", postMethod.getResponseHeader("Content-Type").getValue());
         } finally {
             postMethod.releaseConnection();
         }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/ValidationDuringTargettingTest.java
Sat Apr 17 15:29:50 2010
@@ -21,6 +21,7 @@ package org.apache.wink.itest.exceptions
 
 import javax.ws.rs.Consumes;
 import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
 
 import junit.framework.TestCase;
 
@@ -59,7 +60,8 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/json", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("application/json" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -72,7 +74,8 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello XML Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/xml", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("application/xml" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -105,7 +108,8 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Consumes", getMethod.getResponseBodyAsString());
-            assertEquals("text/plain", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("text/plain", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -140,7 +144,8 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Consumes And Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/json", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("application/json" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -152,7 +157,8 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello JSON Consumes And Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/json", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("application/json" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -165,18 +171,18 @@ public class ValidationDuringTargettingT
         getMethod.setRequestHeader("Content-Type", "application/xml");
         try {
             client.executeMethod(getMethod);
-
-            if ("application/json".equals(getMethod.getResponseHeader("Content-Type").getValue()))
{
+            if (MediaType.APPLICATION_JSON_TYPE.isCompatible(MediaType.valueOf(getMethod
+                .getResponseHeader("Content-Type").getValue()))) {
                 assertEquals(200, getMethod.getStatusCode());
                 assertEquals("Hello XML Consumes And JSON Produces", getMethod
                     .getResponseBodyAsString());
-                assertEquals("application/json", getMethod.getResponseHeader("Content-Type")
-                    .getValue());
+                assertEquals("application/json" + ";charset=UTF-8", getMethod
+                    .getResponseHeader("Content-Type").getValue());
             } else {
                 assertEquals(200, getMethod.getStatusCode());
                 assertEquals("Hello XML Consumes And Produces", getMethod.getResponseBodyAsString());
-                assertEquals("application/xml", getMethod.getResponseHeader("Content-Type")
-                    .getValue());
+                assertEquals("application/xml" + ";charset=UTF-8", getMethod
+                    .getResponseHeader("Content-Type").getValue());
             }
         } finally {
             getMethod.releaseConnection();
@@ -190,7 +196,8 @@ public class ValidationDuringTargettingT
 
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello XML Consumes And Produces", getMethod.getResponseBodyAsString());
-            assertEquals("application/xml", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("application/xml" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }
@@ -204,7 +211,8 @@ public class ValidationDuringTargettingT
             assertEquals(200, getMethod.getStatusCode());
             assertEquals("Hello XML Consumes And JSON Produces", getMethod
                 .getResponseBodyAsString());
-            assertEquals("application/json", getMethod.getResponseHeader("Content-Type").getValue());
+            assertEquals("application/json" + ";charset=UTF-8", getMethod
+                .getResponseHeader("Content-Type").getValue());
         } finally {
             getMethod.releaseConnection();
         }

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkNullValuesDuringTargetingTest.java
Sat Apr 17 15:29:50 2010
@@ -226,7 +226,8 @@ public class WinkNullValuesDuringTargeti
                 .accept("custom/type; q=0.8").post(null);
         assertEquals(200, response.getStatusCode());
         assertEquals("calledWithProduces", response.getEntity(String.class));
-        assertEquals("custom/type;q=0.8", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("custom/type;q=0.8" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
     }
 
     /**
@@ -241,7 +242,8 @@ public class WinkNullValuesDuringTargeti
                 .accept("custom/type2; q=0.8").post(null);
         assertEquals(200, response.getStatusCode());
         assertEquals("calledWithoutProduces", response.getEntity(String.class));
-        assertEquals("custom/type2;q=0.8", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("custom/type2;q=0.8" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
     }
 
     /**
@@ -255,7 +257,8 @@ public class WinkNullValuesDuringTargeti
             client.resource(getBaseURI() + "/targeting/nullresource/withproduces").post(null);
         assertEquals(200, response.getStatusCode());
         assertEquals("calledWithProduces", response.getEntity(String.class));
-        assertEquals("custom/type", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("custom/type" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
     }
 
     /**

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java?rev=935193&r1=935192&r2=935193&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/exceptions/WinkValidationDuringTargetingTest.java
Sat Apr 17 15:29:50 2010
@@ -57,14 +57,16 @@ public class WinkValidationDuringTargeti
                 .accept(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello JSON Produces", response.getEntity(String.class));
-        assertEquals("application/json", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/targeting/resourceonlyproduces")
                 .accept(MediaType.APPLICATION_XML).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello XML Produces", response.getEntity(String.class));
-        assertEquals("application/xml", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("application/xml" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/targeting/resourceonlyproduces")
@@ -108,14 +110,16 @@ public class WinkValidationDuringTargeti
                 .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello JSON Consumes And Produces", response.getEntity(String.class));
-        assertEquals("application/json", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/targeting/resourceconsumesandproduces")
                 .contentType(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello JSON Consumes And Produces", response.getEntity(String.class));
-        assertEquals("application/json", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         /*
          * due to no request Accept header, this is actually undefined behavior
@@ -125,14 +129,17 @@ public class WinkValidationDuringTargeti
             client.resource(getBaseURI() + "/targeting/resourceconsumesandproduces")
                 .contentType(MediaType.APPLICATION_XML).get();
         assertEquals(200, response.getStatusCode());
-        if ("application/json".equals(response.getHeaders().getFirst("Content-Type"))) {
+        if (MediaType.APPLICATION_JSON_TYPE.isCompatible(MediaType.valueOf(response.getHeaders()
+            .getFirst("Content-Type")))) {
             assertEquals(200, response.getStatusCode());
             assertEquals("Hello XML Consumes And JSON Produces", response.getEntity(String.class));
-            assertEquals("application/json", response.getHeaders().getFirst("Content-Type"));
+            assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+                .getFirst("Content-Type"));
         } else {
             assertEquals(200, response.getStatusCode());
             assertEquals("Hello XML Consumes And Produces", response.getEntity(String.class));
-            assertEquals("application/xml", response.getHeaders().getFirst("Content-Type"));
+            assertEquals("application/xml" + ";charset=UTF-8", response.getHeaders()
+                .getFirst("Content-Type"));
         }
 
         response =
@@ -140,13 +147,15 @@ public class WinkValidationDuringTargeti
                 .contentType(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_XML).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello XML Consumes And Produces", response.getEntity(String.class));
-        assertEquals("application/xml", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("application/xml" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
 
         response =
             client.resource(getBaseURI() + "/targeting/resourceconsumesandproduces")
                 .contentType(MediaType.APPLICATION_XML).accept(MediaType.APPLICATION_JSON).get();
         assertEquals(200, response.getStatusCode());
         assertEquals("Hello XML Consumes And JSON Produces", response.getEntity(String.class));
-        assertEquals("application/json", response.getHeaders().getFirst("Content-Type"));
+        assertEquals("application/json" + ";charset=UTF-8", response.getHeaders()
+            .getFirst("Content-Type"));
     }
 }



Mime
View raw message