wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r816948 - in /incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter: ./ root/ specificurl/
Date Sat, 19 Sep 2009 19:38:39 GMT
Author: bluk
Date: Sat Sep 19 19:38:38 2009
New Revision: 816948

URL: http://svn.apache.org/viewvc?rev=816948&view=rev
Log:
Port wink-itest-filter to use RestClient

See [WINK-99]

Added:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkApacheFilterPassThroughTest.java
  (with props)
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkFilterPassThroughTest.java
      - copied, changed from r816947, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkApachePersonAppTest.java
  (with props)
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
  (with props)
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkApacheFilterSpecificURLPatternTest.java
  (with props)
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkFilterSpecificURLPatternTest.java
  (with props)
Modified:
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.java
    incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/PersonAppTest.java

Modified: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.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/FilterPassThroughTest.java?rev=816948&r1=816947&r2=816948&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.java
Sat Sep 19 19:38:38 2009
@@ -34,12 +34,13 @@
  */
 public class FilterPassThroughTest extends TestCase {
 
-    public String getBaseURI() {
+    private static String getBaseURI() {
         return ServerEnvironmentInfo.getBaseURI();
     }
 
     private HttpClient client;
 
+    @Override
     public void setUp() {
         client = new HttpClient();
     }

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkApacheFilterPassThroughTest.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/WinkApacheFilterPassThroughTest.java?rev=816948&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkApacheFilterPassThroughTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkApacheFilterPassThroughTest.java
Sat Sep 19 19:38:38 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.    
+ */
+
+package org.apache.wink.test.filter;
+
+import org.apache.wink.client.ApacheHttpClientConfig;
+import org.apache.wink.client.RestClient;
+
+public class WinkApacheFilterPassThroughTest extends WinkFilterPassThroughTest {
+
+    @Override
+    public void setUp() {
+        client = new RestClient(new ApacheHttpClientConfig());
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkApacheFilterPassThroughTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkFilterPassThroughTest.java
(from r816947, incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.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/WinkFilterPassThroughTest.java?p2=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkFilterPassThroughTest.java&p1=incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.java&r1=816947&r2=816948&rev=816948&view=diff
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/FilterPassThroughTest.java
(original)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/WinkFilterPassThroughTest.java
Sat Sep 19 19:38:38 2009
@@ -23,49 +23,36 @@
 
 import junit.framework.TestCase;
 
-import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.wink.client.ClientResponse;
+import org.apache.wink.client.RestClient;
 import org.apache.wink.test.integration.ServerEnvironmentInfo;
 
-/**
- * Tests that requests not filtered through the RestFilter pass through so that
- * JSPs can be used.
- */
-public class FilterPassThroughTest extends TestCase {
+public class WinkFilterPassThroughTest extends TestCase {
 
-    public String getBaseURI() {
+    private static String getBaseURI() {
         return ServerEnvironmentInfo.getBaseURI();
     }
 
-    private HttpClient client;
+    protected RestClient client;
 
+    @Override
     public void setUp() {
-        client = new HttpClient();
+        client = new RestClient();
     }
 
     public void testGetJSPPage() throws HttpException, IOException {
-        GetMethod getMethod = new GetMethod(getBaseURI() + "/testpage.jsp");
-        try {
-            client.executeMethod(getMethod);
-            assertEquals(200, getMethod.getStatusCode());
-            assertTrue(getMethod.getResponseBodyAsString(), getMethod.getResponseBodyAsString()
-                .contains("<html><body><h2>Hit the test page!</h2></body></html>"));
-        } finally {
-            getMethod.releaseConnection();
-        }
+        ClientResponse response = client.resource(getBaseURI() + "/testpage.jsp").get();
+        assertEquals(200, response.getStatusCode());
+        assertTrue(response.getEntity(String.class), response.getEntity(String.class)
+            .contains("<html><body><h2>Hit the test page!</h2></body></html>"));
     }
 
     public void testGetSubdirectoryJSPPage() throws HttpException, IOException {
-        GetMethod getMethod = new GetMethod(getBaseURI() + "/testing/index.jsp");
-        try {
-            client.executeMethod(getMethod);
-            assertEquals(200, getMethod.getStatusCode());
-            assertTrue(getMethod.getResponseBodyAsString(), getMethod.getResponseBodyAsString()
-                .contains("<html><body><h2>Hit the testing test page!</h2></body></html>"));
-        } finally {
-            getMethod.releaseConnection();
-        }
+        ClientResponse response = client.resource(getBaseURI() + "/testing/index.jsp").get();
+        assertEquals(200, response.getStatusCode());
+        assertTrue(response.getEntity(String.class), response.getEntity(String.class)
+            .contains("<html><body><h2>Hit the testing test page!</h2></body></html>"));
     }
 
 }

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=816948&r1=816947&r2=816948&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 Sep 19 19:38:38 2009
@@ -43,6 +43,7 @@
 
     private HttpClient client;
 
+    @Override
     public void setUp() {
         client = new HttpClient();
     }

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkApachePersonAppTest.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/WinkApachePersonAppTest.java?rev=816948&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkApachePersonAppTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkApachePersonAppTest.java
Sat Sep 19 19:38:38 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.    
+ */
+
+package org.apache.wink.test.filter.root;
+
+import org.apache.wink.client.ApacheHttpClientConfig;
+import org.apache.wink.client.RestClient;
+
+public class WinkApachePersonAppTest extends WinkPersonAppTest {
+
+    @Override
+    public void setUp() {
+        client = new RestClient(new ApacheHttpClientConfig());
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkApachePersonAppTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=816948&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
Sat Sep 19 19:38:38 2009
@@ -0,0 +1,66 @@
+/*
+ * 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.    
+ */
+
+package org.apache.wink.test.filter.root;
+
+import java.io.IOException;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.wink.client.ClientResponse;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class WinkPersonAppTest extends TestCase {
+
+    protected static String getBaseURI() {
+        return ServerEnvironmentInfo.getBaseURI();
+    }
+
+    protected RestClient client;
+
+    @Override
+    public void setUp() {
+        client = new RestClient();
+    }
+
+    public void testPostPerson() throws HttpException, IOException {
+        ClientResponse response =
+            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("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix
entity: Hello",
+                     response.getEntity(String.class));
+    }
+
+    public void testPostPersonInXML() throws HttpException, IOException {
+        ClientResponse response =
+            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("Person: abcd query parameter: defaultQuery matrix parameter: defaultMatrix
entity: Hello",
+                     response.getEntity(String.class));
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/root/WinkPersonAppTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkApacheFilterSpecificURLPatternTest.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/specificurl/WinkApacheFilterSpecificURLPatternTest.java?rev=816948&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkApacheFilterSpecificURLPatternTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkApacheFilterSpecificURLPatternTest.java
Sat Sep 19 19:38:38 2009
@@ -0,0 +1,31 @@
+/*
+ * 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.    
+ */
+
+package org.apache.wink.test.filter.specificurl;
+
+import org.apache.wink.client.ApacheHttpClientConfig;
+import org.apache.wink.client.RestClient;
+
+public class WinkApacheFilterSpecificURLPatternTest extends WinkFilterSpecificURLPatternTest
{
+
+    @Override
+    public void setUp() {
+        client = new RestClient(new ApacheHttpClientConfig());
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkApacheFilterSpecificURLPatternTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkFilterSpecificURLPatternTest.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/specificurl/WinkFilterSpecificURLPatternTest.java?rev=816948&view=auto
==============================================================================
--- incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkFilterSpecificURLPatternTest.java
(added)
+++ incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkFilterSpecificURLPatternTest.java
Sat Sep 19 19:38:38 2009
@@ -0,0 +1,49 @@
+/*
+ * 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.    
+ */
+
+package org.apache.wink.test.filter.specificurl;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpException;
+import org.apache.wink.client.ClientResponse;
+import org.apache.wink.client.RestClient;
+import org.apache.wink.test.integration.ServerEnvironmentInfo;
+
+public class WinkFilterSpecificURLPatternTest extends TestCase {
+
+    public String getBaseURI() {
+        return ServerEnvironmentInfo.getBaseURI();
+    }
+
+    protected RestClient client;
+
+    public void setUp() {
+        client = new RestClient();
+    }
+
+    public void testGetBook() throws HttpException, IOException {
+        ClientResponse response = client.resource(getBaseURI() + "/book/book1").get();
+        assertEquals(200, response.getStatusCode());
+        assertTrue(response.getEntity(String.class), response.getEntity(String.class)
+            .contains("book resource hit"));
+    }
+}

Propchange: incubator/wink/trunk/wink-itests/wink-itest/wink-itest-filter/src/test/java/org/apache/wink/test/filter/specificurl/WinkFilterSpecificURLPatternTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message