Fixing more build related issues

This commit is contained in:
Joakim Erdfelt 2012-07-03 11:53:46 -07:00
parent c97c22d6d6
commit d815a9c7d2
6 changed files with 12 additions and 130 deletions

View File

@ -267,12 +267,16 @@ public class EventMethodsCache
public EventMethods getMethods(Class<?> pojo) throws InvalidWebSocketException
{
EventMethods methods = cache.get(pojo);
if (methods == null)
if (pojo == null)
{
methods = discoverMethods(pojo);
cache.put(pojo,methods);
throw new InvalidWebSocketException("Cannot get methods for null class");
}
if (cache.containsKey(pojo))
{
return cache.get(pojo);
}
EventMethods methods = discoverMethods(pojo);
cache.put(pojo,methods);
return methods;
}

View File

@ -50,6 +50,7 @@ public abstract class WebSocketHandler extends HandlerWrapper
public Simple(Class<?> websocketClass)
{
super();
this.websocketPojo = websocketClass;
}

View File

@ -1,124 +0,0 @@
/*******************************************************************************
* Copyright (c) 2011 Intalio, Inc.
* ======================================================================
* 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.server;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.server.SelectChannelConnector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.server.helper.MessageSender;
import org.eclipse.jetty.websocket.server.helper.WebSocketCaptureServlet;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* WebSocketCommTest - to test reported undelivered messages in bug <a href="https://jira.codehaus.org/browse/JETTY-1463">JETTY-1463</a>
*/
public class WebSocketCommTest
{
private Server server;
private SelectChannelConnector connector;
private WebSocketCaptureServlet servlet;
private URI serverUri;
@Before
public void startServer() throws Exception
{
// Configure Server
server = new Server();
connector = new SelectChannelConnector();
server.addConnector(connector);
ServletContextHandler context = new ServletContextHandler();
context.setContextPath("/");
server.setHandler(context);
// Serve capture servlet
servlet = new WebSocketCaptureServlet();
context.addServlet(new ServletHolder(servlet),"/");
// Start Server
server.start();
String host = connector.getHost();
if (host == null)
{
host = "localhost";
}
int port = connector.getLocalPort();
serverUri = new URI(String.format("ws://%s:%d/",host,port));
System.out.printf("Server URI: %s%n",serverUri);
}
@After
public void stopServer()
{
try
{
server.stop();
}
catch (Exception e)
{
e.printStackTrace(System.err);
}
}
@Test
public void testSendTextMessages() throws Exception
{
// WebSocketClientFactory clientFactory = new WebSocketClientFactory();
// clientFactory.start();
// WebSocketClient wsc = clientFactory.newWebSocketClient();
MessageSender sender = new MessageSender();
// wsc.open(serverUri,sender);
try
{
sender.awaitConnect();
// Send 5 short messages
for (int i = 0; i < 5; i++)
{
System.out.printf("Sending msg-%d%n",i);
sender.sendMessage("msg-%d",i);
}
// Servlet should show only 1 connection.
// TODO: use factory to ask about use (tie this use into MBeans?)
// Assert.assertThat("Servlet.captureSockets.size",servlet.captures.size(),is(1));
// CaptureSocket socket = servlet.captures.get(0);
// Assert.assertThat("CaptureSocket",socket,notNullValue());
// Assert.assertThat("CaptureSocket.isConnected",socket.awaitConnected(1000),is(true));
// Give servlet time to process messages
TimeUnit.MILLISECONDS.sleep(500);
// Should have captured 5 messages.
// Assert.assertThat("CaptureSocket.messages.size",socket.messages.size(),is(5));
}
finally
{
System.out.println("Closing client socket");
sender.close();
}
}
}

View File

@ -47,6 +47,7 @@ import org.eclipse.jetty.websocket.parser.Parser;
import org.eclipse.jetty.websocket.server.examples.MyEchoSocket;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
public class WebSocketLoadRFC6455Test
@ -183,6 +184,7 @@ public class WebSocketLoadRFC6455Test
}
@Test
@Ignore("Not yet converted to new jetty-9 structure")
public void testLoad() throws Exception
{
int count = 50;

View File

@ -86,7 +86,7 @@ public class WebSocketMessageRFC6455Test
}
@OnWebSocketFrame
public boolean onFrame(BaseFrame frame)
public void onFrame(BaseFrame frame)
{
if (_echo)
{
@ -102,7 +102,6 @@ public class WebSocketMessageRFC6455Test
}
}
}
return false;
}
@OnWebSocketBinary