cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5339] Adding a couple of negative tests, disabled for now
Date Thu, 27 Feb 2014 17:01:47 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 249c25bdd -> 30a9e0570


[CXF-5339] Adding a couple of negative tests, disabled for now


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/30a9e057
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/30a9e057
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/30a9e057

Branch: refs/heads/master
Commit: 30a9e0570a5c649e25a5212ab075f46c391496a5
Parents: 249c25b
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Thu Feb 27 17:01:29 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Thu Feb 27 17:01:29 2014 +0000

----------------------------------------------------------------------
 .../jaxrs/websocket/BookServerWebSocket.java    |  3 +-
 .../JAXRSClientServerWebSocketTest.java         | 37 +++++++++++++++++---
 2 files changed, 34 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/30a9e057/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/BookServerWebSocket.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/BookServerWebSocket.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/BookServerWebSocket.java
index 7084406..e5275df 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/BookServerWebSocket.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/BookServerWebSocket.java
@@ -26,6 +26,7 @@ import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
+import org.apache.cxf.systest.jaxrs.BookStorePerRequest;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
 import org.apache.cxf.transport.http_jetty.JettyHTTPDestination;
     
@@ -51,7 +52,7 @@ public class BookServerWebSocket extends AbstractBusTestServerBase {
         setBus(bus);
         JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
         sf.setBus(bus);
-        sf.setResourceClasses(BookStoreWebSocket.class);
+        sf.setResourceClasses(BookStoreWebSocket.class, BookStorePerRequest.class);
         sf.setResourceProvider(BookStoreWebSocket.class,
                                new SingletonResourceProvider(new BookStoreWebSocket(), true));
         sf.setAddress("http://localhost:" + PORT + "/");

http://git-wip-us.apache.org/repos/asf/cxf/blob/30a9e057/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketTest.java
----------------------------------------------------------------------
diff --git a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketTest.java
b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketTest.java
index 9b3b69e..fea4898 100644
--- a/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketTest.java
+++ b/systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/websocket/JAXRSClientServerWebSocketTest.java
@@ -27,6 +27,7 @@ import org.apache.cxf.jaxrs.model.AbstractResourceInfo;
 import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
 
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class JAXRSClientServerWebSocketTest extends AbstractBusClientServerTestBase {
@@ -65,11 +66,6 @@ public class JAXRSClientServerWebSocketTest extends AbstractBusClientServerTestB
             value = new String(received.get(0));
             assertTrue(value.startsWith("<?xml ") && value.endsWith("</Book>"));
             
-            // call the GET service using POST
-            wsclient.reset(1);
-            wsclient.sendMessage("POST /web/bookstore/booknames\r\n\r\n123".getBytes());
-            assertFalse("wrong method, no response expected", wsclient.await(3));
-            
             // call the POST service
             wsclient.reset(1);
             wsclient.sendMessage("POST /web/bookstore/booksplain\r\nContent-Type: text/plain\r\n\r\n123".getBytes());
@@ -92,4 +88,35 @@ public class JAXRSClientServerWebSocketTest extends AbstractBusClientServerTestB
             wsclient.close();
         }
     }
+    
+    @Test
+    @Ignore
+    public void testWrongMethod() throws Exception {
+        String address = "ws://localhost:" + PORT + "/web/bookstore";
+
+        WebSocketTestClient wsclient = new WebSocketTestClient(address, 1);
+        wsclient.connect();
+        try {
+            // call the GET service using POST
+            wsclient.sendMessage("POST /web/bookstore/booknames".getBytes());
+        } finally {
+            wsclient.close();
+        }
+    }
+    
+    @Test
+    @Ignore
+    public void testPathRestriction() throws Exception {
+        String address = "ws://localhost:" + PORT + "/web/bookstore";
+
+        WebSocketTestClient wsclient = new WebSocketTestClient(address, 1);
+        wsclient.connect();
+        try {
+            // call the GET service over the different path
+            wsclient.sendMessage("GET /bookstore2".getBytes());
+        } finally {
+            wsclient.close();
+        }
+    }
+        
 }


Mime
View raw message