Some basic @ServerEndpoint scanning tests

This commit is contained in:
Joakim Erdfelt 2013-03-25 09:56:04 -07:00
parent 725887620c
commit 3c59f15a5c
27 changed files with 97 additions and 60 deletions

View File

@ -1,3 +1,21 @@
//
// ========================================================================
// 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.annotations;
public class Param

View File

@ -1,3 +1,21 @@
//
// ========================================================================
// 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.decoders;
import java.nio.ByteBuffer;

View File

@ -32,6 +32,7 @@ import javax.websocket.Session;
import org.eclipse.jetty.websocket.common.events.annotated.CallableMethod;
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
import org.eclipse.jetty.websocket.jsr356.annotations.ParameterizedMethod;
import org.eclipse.jetty.websocket.jsr356.endpoints.JsrAnnotatedMetadata;
import org.eclipse.jetty.websocket.jsr356.server.samples.BasicBinaryMessageByteBufferSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.BasicCloseReasonSessionSocket;
@ -86,12 +87,12 @@ public class ServerAnnotatedEndpointScanner_GoodSignaturesTest
public static Collection<Case[]> data() throws Exception
{
List<Case[]> data = new ArrayList<>();
Field fOpen = findFieldRef(JsrAnnotatedMetadata.class,"onOpen");
Field fClose = findFieldRef(JsrAnnotatedMetadata.class,"onClose");
Field fError = findFieldRef(JsrAnnotatedMetadata.class,"onError");
Field fText = findFieldRef(JsrAnnotatedMetadata.class,"onText");
Field fBinary = findFieldRef(JsrAnnotatedMetadata.class,"onBinary");
Field fPong = findFieldRef(JsrAnnotatedMetadata.class,"onPong");
Field fOpen = findFieldRef(JsrServerMetadata.class,"onOpen");
Field fClose = findFieldRef(JsrServerMetadata.class,"onClose");
Field fError = findFieldRef(JsrServerMetadata.class,"onError");
Field fText = findFieldRef(JsrServerMetadata.class,"onText");
Field fBinary = findFieldRef(JsrServerMetadata.class,"onBinary");
Field fPong = findFieldRef(JsrServerMetadata.class,"onPong");
// @formatter:off
// -- Open Events
@ -142,7 +143,7 @@ public class ServerAnnotatedEndpointScanner_GoodSignaturesTest
Assert.assertThat("Metadata",metadata,notNullValue());
CallableMethod cm = (CallableMethod)testcase.metadataField.get(metadata);
ParameterizedMethod cm = (ParameterizedMethod)testcase.metadataField.get(metadata);
Assert.assertThat(testcase.metadataField.toString(),cm,notNullValue());
int len = testcase.expectedParameters.length;
for (int i = 0; i < len; i++)

View File

@ -33,13 +33,13 @@ import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.common.events.annotated.InvalidSignatureException;
import org.eclipse.jetty.websocket.jsr356.annotations.AnnotatedEndpointScanner;
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidCloseIntSocket;
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidErrorErrorSocket;
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidErrorExceptionSocket;
import org.eclipse.jetty.websocket.jsr356.endpoints.samples.InvalidErrorIntSocket;
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.eclipse.jetty.websocket.jsr356.server.samples.InvalidCloseIntSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.InvalidErrorErrorSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.InvalidErrorExceptionSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.InvalidErrorIntSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.InvalidOpenCloseReasonSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.InvalidOpenIntSocket;
import org.eclipse.jetty.websocket.jsr356.server.samples.InvalidOpenSessionIntSocket;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -20,12 +20,12 @@ package org.eclipse.jetty.websocket.jsr356.server.samples;
import java.nio.ByteBuffer;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnMessage;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicBinaryMessageByteBufferSocket extends TrackingSocket
{
@OnMessage

View File

@ -18,14 +18,14 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicCloseReasonSessionSocket extends TrackingSocket
{
@OnClose

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicCloseReasonSocket extends TrackingSocket
{
@OnClose

View File

@ -18,14 +18,14 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicCloseSessionReasonSocket extends TrackingSocket
{
@OnClose

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnClose;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicCloseSocket extends TrackingSocket
{
@OnClose

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicErrorSessionSocket extends TrackingSocket
{
@OnError

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicErrorSessionThrowableSocket extends TrackingSocket
{
@OnError

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicErrorSocket extends TrackingSocket
{
@OnError

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicErrorThrowableSessionSocket extends TrackingSocket
{
@OnError

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicErrorThrowableSocket extends TrackingSocket
{
@OnError

View File

@ -18,15 +18,15 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicOpenCloseSessionSocket extends TrackingSocket
{
@OnClose

View File

@ -18,14 +18,14 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.OnClose;
import javax.websocket.OnOpen;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicOpenCloseSocket extends TrackingSocket
{
@OnOpen

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicOpenSessionSocket extends TrackingSocket
{
@OnOpen

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnOpen;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicOpenSocket extends TrackingSocket
{
@OnOpen

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnMessage;
import javax.websocket.PongMessage;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicPongMessageSocket extends TrackingSocket
{
@OnMessage

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnMessage;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/basic")
public class BasicTextMessageStringSocket extends TrackingSocket
{
@OnMessage

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnClose;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidCloseIntSocket extends TrackingSocket
{
/**

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidErrorErrorSocket extends TrackingSocket
{
/**

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidErrorExceptionSocket extends TrackingSocket
{
/**

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnError;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidErrorIntSocket extends TrackingSocket
{
/**

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.OnOpen;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidOpenCloseReasonSocket extends TrackingSocket
{
/**

View File

@ -18,12 +18,12 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnOpen;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidOpenIntSocket extends TrackingSocket
{
/**

View File

@ -18,13 +18,13 @@
package org.eclipse.jetty.websocket.jsr356.server.samples;
import javax.websocket.ClientEndpoint;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.eclipse.jetty.websocket.jsr356.server.TrackingSocket;
@ClientEndpoint
@ServerEndpoint(value="/invalid")
public class InvalidOpenSessionIntSocket extends TrackingSocket
{
/**