Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Erdfelt2013-02-14 23:24:07 +0000
committerJoakim Erdfelt2013-02-14 23:24:07 +0000
commit2faba0bf4be87e81f81ca12e376dee137f78d649 (patch)
tree0d45f459d0e693c0a60019d58dd98dc494d49d50 /jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse
parente27ad8ef5c0dd2f4772810133e83c6b9f49d25f1 (diff)
downloadorg.eclipse.jetty.project-2faba0bf4be87e81f81ca12e376dee137f78d649.tar.gz
org.eclipse.jetty.project-2faba0bf4be87e81f81ca12e376dee137f78d649.tar.xz
org.eclipse.jetty.project-2faba0bf4be87e81f81ca12e376dee137f78d649.zip
393473 - Add support for JSR-356 (javax.websocket) draft
+ Start of @WebSocketClient class/method scanning with tests
Diffstat (limited to 'jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse')
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedClientScannerTest.java134
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java125
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSessionSocket.java46
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSocket.java41
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSessionSocket.java35
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSocket.java34
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenCloseReasonSocket.java37
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenIntSocket.java38
-rw-r--r--jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenSessionIntSocket.java38
9 files changed, 528 insertions, 0 deletions
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedClientScannerTest.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedClientScannerTest.java
new file mode 100644
index 0000000000..5576cd7950
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/JsrAnnotatedClientScannerTest.java
@@ -0,0 +1,134 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints;
+
+import static org.hamcrest.Matchers.*;
+
+import java.lang.annotation.Annotation;
+
+import javax.websocket.CloseReason;
+import javax.websocket.Session;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.util.log.Log;
+import org.eclipse.jetty.util.log.Logger;
+import org.eclipse.jetty.websocket.common.events.annotated.CallableMethod;
+import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenCloseSessionSocket;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenCloseSocket;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenSessionSocket;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.BasicOpenSocket;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidOpenCloseReasonSocket;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidOpenIntSocket;
+import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidOpenSessionIntSocket;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JsrAnnotatedClientScannerTest
+{
+ private static final Logger LOG = Log.getLogger(JsrAnnotatedClientScannerTest.class);
+
+ private void assertHasCallable(String msg, CallableMethod callable, Class<?>... expectedParameters)
+ {
+ Assert.assertThat(msg,notNullValue());
+ int len = expectedParameters.length;
+ for (int i = 0; i < len; i++)
+ {
+ Class<?> expectedParam = expectedParameters[i];
+ Class<?> actualParam = callable.getParamTypes()[i];
+
+ Assert.assertTrue("Parameter[" + i + "] - expected:[" + expectedParam + "], actual:[" + actualParam + "]",actualParam.equals(expectedParam));
+ }
+ }
+
+ private void assertInvalidAnnotationSignature(Class<?> pojo, Class<? extends Annotation> expectedAnnoClass)
+ {
+ JsrAnnotatedClientScanner scanner = new JsrAnnotatedClientScanner(pojo);
+ try
+ {
+ scanner.scan();
+ Assert.fail("Expected " + InvalidSignatureException.class + " with message that references " + expectedAnnoClass + " annotation");
+ }
+ catch (InvalidSignatureException e)
+ {
+ LOG.debug("{}:{}",e.getClass(),e.getMessage());
+ Assert.assertThat("Message",e.getMessage(),containsString(expectedAnnoClass.getSimpleName()));
+ }
+ }
+
+ @Test
+ public void testScan_BasicOpen()
+ {
+ JsrAnnotatedClientScanner scanner = new JsrAnnotatedClientScanner(BasicOpenSocket.class);
+ JsrAnnotatedMetadata metadata = scanner.scan();
+ Assert.assertThat("Metadata",metadata,notNullValue());
+ assertHasCallable("Metadata.onOpen",metadata.onOpen);
+ }
+
+ @Test
+ public void testScan_BasicOpenClose()
+ {
+ JsrAnnotatedClientScanner scanner = new JsrAnnotatedClientScanner(BasicOpenCloseSocket.class);
+ JsrAnnotatedMetadata metadata = scanner.scan();
+
+ Assert.assertThat("Metadata",metadata,notNullValue());
+
+ assertHasCallable("Metadata.onOpen",metadata.onOpen);
+ assertHasCallable("Metadata.onClose",metadata.onClose,CloseReason.class);
+ }
+
+ @Test
+ public void testScan_BasicOpenSession()
+ {
+ JsrAnnotatedClientScanner scanner = new JsrAnnotatedClientScanner(BasicOpenSessionSocket.class);
+ JsrAnnotatedMetadata metadata = scanner.scan();
+ Assert.assertThat("Metadata",metadata,notNullValue());
+ assertHasCallable("Metadata.onOpen",metadata.onOpen,Session.class);
+ }
+
+ @Test
+ public void testScan_BasicSessionOpenClose()
+ {
+ JsrAnnotatedClientScanner scanner = new JsrAnnotatedClientScanner(BasicOpenCloseSessionSocket.class);
+ JsrAnnotatedMetadata metadata = scanner.scan();
+
+ Assert.assertThat("Metadata",metadata,notNullValue());
+
+ assertHasCallable("Metadata.onOpen",metadata.onOpen);
+ assertHasCallable("Metadata.onClose",metadata.onClose,CloseReason.class);
+ }
+
+ @Test
+ public void testScan_InvalidOpenCloseReason()
+ {
+ assertInvalidAnnotationSignature(InvalidOpenCloseReasonSocket.class,WebSocketOpen.class);
+ }
+
+ @Test
+ public void testScan_InvalidOpenInt()
+ {
+ assertInvalidAnnotationSignature(InvalidOpenIntSocket.class,WebSocketOpen.class);
+ }
+
+ @Test
+ public void testScan_InvalidOpenSessionInt()
+ {
+ assertInvalidAnnotationSignature(InvalidOpenSessionIntSocket.class,WebSocketOpen.class);
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java
new file mode 100644
index 0000000000..64db37e578
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/TrackingSocket.java
@@ -0,0 +1,125 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints;
+
+import static org.hamcrest.Matchers.*;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.websocket.CloseReason;
+import javax.websocket.CloseReason.CloseCode;
+
+import org.eclipse.jetty.util.BlockingArrayQueue;
+import org.eclipse.jetty.util.log.Log;
+import org.eclipse.jetty.util.log.Logger;
+import org.junit.Assert;
+
+/**
+ * Abstract base socket used for tracking state and events within the socket for testing reasons.
+ */
+public abstract class TrackingSocket
+{
+ private static final Logger LOG = Log.getLogger(TrackingSocket.class);
+
+ public CloseReason closeReason;
+ public BlockingQueue<String> eventQueue = new BlockingArrayQueue<String>();
+ public BlockingQueue<Throwable> errorQueue = new BlockingArrayQueue<>();
+ public CountDownLatch openLatch = new CountDownLatch(1);
+ public CountDownLatch closeLatch = new CountDownLatch(1);
+ public CountDownLatch dataLatch = new CountDownLatch(1);
+
+ public void assertClose(CloseCode expectedCode, String expectedReason) throws InterruptedException
+ {
+ assertCloseCode(expectedCode);
+ assertCloseReason(expectedReason);
+ }
+
+ public void assertCloseCode(CloseCode expectedCode) throws InterruptedException
+ {
+ Assert.assertThat("Was Closed",closeLatch.await(50,TimeUnit.MILLISECONDS),is(true));
+ Assert.assertThat("CloseReason",closeReason,notNullValue());
+ Assert.assertThat("Close Code",closeReason.getCloseCode(),is(expectedCode));
+ }
+
+ private void assertCloseReason(String expectedReason)
+ {
+ Assert.assertThat("Close Reason",closeReason.getReasonPhrase(),is(expectedReason));
+ }
+
+ protected void addEvent(String format, Object... args)
+ {
+ eventQueue.add(String.format(format,args));
+ }
+
+ protected void addError(Throwable t)
+ {
+ errorQueue.add(t);
+ }
+
+ public void assertIsOpen() throws InterruptedException
+ {
+ assertWasOpened();
+ assertNotClosed();
+ }
+
+ public void assertEvent(String expected)
+ {
+ String actual = eventQueue.poll();
+ Assert.assertEquals("Event",expected,actual);
+ }
+
+ public void assertNotClosed()
+ {
+ Assert.assertThat("Closed Latch",closeLatch.getCount(),greaterThanOrEqualTo(1L));
+ }
+
+ public void assertNotOpened()
+ {
+ Assert.assertThat("Open Latch",openLatch.getCount(),greaterThanOrEqualTo(1L));
+ }
+
+ public void assertWasOpened() throws InterruptedException
+ {
+ Assert.assertThat("Was Opened",openLatch.await(500,TimeUnit.MILLISECONDS),is(true));
+ }
+
+ public void clear()
+ {
+ eventQueue.clear();
+ errorQueue.clear();
+ }
+
+ public void waitForClose(int timeoutDuration, TimeUnit timeoutUnit) throws InterruptedException
+ {
+ Assert.assertThat("Client Socket Closed",closeLatch.await(timeoutDuration,timeoutUnit),is(true));
+ }
+
+ public void waitForConnected(int timeoutDuration, TimeUnit timeoutUnit) throws InterruptedException
+ {
+ Assert.assertThat("Client Socket Connected",openLatch.await(timeoutDuration,timeoutUnit),is(true));
+ }
+
+ public void waitForData(int timeoutDuration, TimeUnit timeoutUnit) throws InterruptedException
+ {
+ LOG.debug("Waiting for message");
+ Assert.assertThat("Data Received",dataLatch.await(timeoutDuration,timeoutUnit),is(true));
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSessionSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSessionSocket.java
new file mode 100644
index 0000000000..617bb36240
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSessionSocket.java
@@ -0,0 +1,46 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.CloseReason;
+import javax.websocket.Session;
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketClose;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class BasicOpenCloseSessionSocket extends TrackingSocket
+{
+ @WebSocketClose
+ public void onClose(CloseReason close, Session session)
+ {
+ addEvent("onClose(%s, %s)",close,session);
+ this.closeReason = close;
+ closeLatch.countDown();
+ }
+
+ @WebSocketOpen
+ public void onOpen(Session session)
+ {
+ addEvent("onOpen(%s)",session);
+ openLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSocket.java
new file mode 100644
index 0000000000..f9cd8235f0
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenCloseSocket.java
@@ -0,0 +1,41 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.CloseReason;
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketClose;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class BasicOpenCloseSocket extends TrackingSocket
+{
+ @WebSocketOpen
+ public void onOpen() {
+ openLatch.countDown();
+ }
+
+ @WebSocketClose
+ public void onClose(CloseReason close) {
+ this.closeReason = close;
+ closeLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSessionSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSessionSocket.java
new file mode 100644
index 0000000000..776eba05ea
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSessionSocket.java
@@ -0,0 +1,35 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.Session;
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class BasicOpenSessionSocket extends TrackingSocket
+{
+ @WebSocketOpen
+ public void onOpen(Session session)
+ {
+ openLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSocket.java
new file mode 100644
index 0000000000..c1ec92e2ff
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/BasicOpenSocket.java
@@ -0,0 +1,34 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class BasicOpenSocket extends TrackingSocket
+{
+ @WebSocketOpen
+ public void onOpen()
+ {
+ openLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenCloseReasonSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenCloseReasonSocket.java
new file mode 100644
index 0000000000..8dd3290ffd
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenCloseReasonSocket.java
@@ -0,0 +1,37 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class InvalidOpenCloseReasonSocket extends TrackingSocket
+{
+ /**
+ * Invalid Open Method Declaration (parameter type int)
+ */
+ @WebSocketOpen
+ public void onOpen(int count)
+ {
+ openLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenIntSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenIntSocket.java
new file mode 100644
index 0000000000..5535c74a44
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenIntSocket.java
@@ -0,0 +1,38 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.CloseReason;
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class InvalidOpenIntSocket extends TrackingSocket
+{
+ /**
+ * Invalid Open Method Declaration (parameter type CloseReason)
+ */
+ @WebSocketOpen
+ public void onOpen(CloseReason close)
+ {
+ openLatch.countDown();
+ }
+}
diff --git a/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenSessionIntSocket.java b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenSessionIntSocket.java
new file mode 100644
index 0000000000..a8d8bfeda7
--- /dev/null
+++ b/jetty-websocket/javax-websocket-client-impl/src/test/java/org/eclipse/jetty/websocket/jsr356/endpoints/samples/InvalidOpenSessionIntSocket.java
@@ -0,0 +1,38 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.jsr356.endpoints.samples;
+
+import javax.websocket.Session;
+import javax.websocket.WebSocketClient;
+import javax.websocket.WebSocketOpen;
+
+import org.eclipse.jetty.websocket.jsr356.endpoints.TrackingSocket;
+
+@WebSocketClient
+public class InvalidOpenSessionIntSocket extends TrackingSocket
+{
+ /**
+ * Invalid Open Method Declaration (parameter of type int)
+ */
+ @WebSocketOpen
+ public void onOpen(Session session, int count)
+ {
+ openLatch.countDown();
+ }
+}

Back to the top