Post-Merge build fixes

This commit is contained in:
Joakim Erdfelt 2018-06-12 12:54:41 -05:00
parent 0cd4dacbac
commit 591b0a2e37
9 changed files with 55 additions and 98 deletions

View File

@ -25,28 +25,11 @@
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>javax.mail.*;resolution:=optional,*</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/config.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
<configuration>
<instructions>
<Import-Package>javax.mail.*;resolution:=optional,*</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>

View File

@ -1,4 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-project</artifactId>
@ -36,32 +38,15 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/config.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Import-Package>javax.transaction*;version="[1.1,1.3)",*</Import-Package>
</instructions>
</configuration>
<configuration>
<instructions>
<Import-Package>javax.transaction*;version="[1.1,1.3)",*</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>

View File

@ -117,8 +117,7 @@ public class ServerContainer extends ClientContainer implements javax.websocket.
if (anno != null)
{
// Overwrite Config from Annotation
// TODO: should we merge with provided config?
return new AnnotatedServerEndpointConfig(this, endpoint.getClass(), anno, config);
return new AnnotatedServerEndpointConfig(this, endpoint.getClass(), anno, (ServerEndpointConfig) config);
}
return config;
}

View File

@ -182,7 +182,7 @@ public abstract class AbstractExtension extends AbstractLifeCycle implements Dum
catch (Throwable t)
{
if (callback != null)
callback.writeFailed(t);
callback.fail(t);
else
log.warn(t);
}

View File

@ -20,33 +20,21 @@ package org.eclipse.jetty.websocket.common.io;
import static java.nio.charset.StandardCharsets.UTF_8;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.ReadPendingException;
import java.nio.channels.WritePendingException;
import java.util.Arrays;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.FutureCallback;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.api.extensions.Frame;
import org.eclipse.jetty.websocket.api.extensions.IncomingFrames;
import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames;
import org.eclipse.jetty.websocket.common.Generator;
import org.eclipse.jetty.websocket.common.Parser;
import org.eclipse.jetty.websocket.common.SaneFrameOrderingAssertion;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.junit.Rule;
import org.junit.Test;
@ -112,7 +100,7 @@ public class FrameFlusherTest
System.out.printf("Received: %,d frames / %,d errors%n", endPoint.incomingFrames, endPoint.incomingErrors);
}
public static class SaneFrameOrderingEndPoint extends MockEndPoint implements IncomingFrames
public static class SaneFrameOrderingEndPoint extends MockEndPoint implements Parser.Handler
{
public Parser parser;
public int incomingFrames;
@ -120,20 +108,13 @@ public class FrameFlusherTest
public SaneFrameOrderingEndPoint(WebSocketPolicy policy, ByteBufferPool bufferPool)
{
parser = new Parser(policy, bufferPool);
parser.setIncomingFramesHandler(this);
parser = new Parser(policy, bufferPool, this);
}
@Override
public void incomingError(Throwable t)
public boolean onFrame(Frame frame)
{
incomingErrors++;
}
@Override
public void incomingFrame(Frame frame)
{
incomingFrames++;
return true;
}
@Override

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.common;
package org.eclipse.jetty.websocket.tests;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
@ -24,9 +24,11 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.FrameCallback;
import org.eclipse.jetty.websocket.api.WriteCallback;
import org.eclipse.jetty.websocket.api.extensions.Frame;
import org.eclipse.jetty.websocket.api.extensions.OutgoingFrames;
import org.eclipse.jetty.websocket.common.OpCode;
/**
* Useful for testing the production of sane frame ordering from various components.
@ -37,7 +39,7 @@ public class SaneFrameOrderingAssertion implements OutgoingFrames
public int frameCount = 0;
@Override
public void outgoingFrame(Frame frame, WriteCallback callback, BatchMode batchMode)
public void outgoingFrame(Frame frame, FrameCallback callback, BatchMode batchMode)
{
byte opcode = frame.getOpCode();
assertThat("OpCode.isKnown(" + opcode + ")", OpCode.isKnown(opcode), is(true));
@ -72,6 +74,6 @@ public class SaneFrameOrderingAssertion implements OutgoingFrames
frameCount++;
if (callback != null)
callback.writeSuccess();
callback.succeed();
}
}

View File

@ -16,7 +16,7 @@
// ========================================================================
//
package org.eclipse.jetty.websocket.common.extensions.compress;
package org.eclipse.jetty.websocket.tests.extensions;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.hamcrest.CoreMatchers.containsString;
@ -27,6 +27,7 @@ import java.nio.ByteBuffer;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.websocket.api.MessageTooLargeException;
import org.eclipse.jetty.websocket.common.extensions.compress.ByteAccumulator;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

View File

@ -36,15 +36,14 @@ import org.eclipse.jetty.io.LeakTrackingByteBufferPool;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.toolchain.test.ByteBufferAssert;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.BatchMode;
import org.eclipse.jetty.websocket.api.FrameCallback;
import org.eclipse.jetty.websocket.api.WebSocketPolicy;
import org.eclipse.jetty.websocket.api.extensions.ExtensionConfig;
import org.eclipse.jetty.websocket.api.extensions.Frame;
import org.eclipse.jetty.websocket.common.OpCode;
import org.eclipse.jetty.websocket.common.SaneFrameOrderingAssertion;
import org.eclipse.jetty.websocket.common.io.FutureWriteCallback;
import org.eclipse.jetty.websocket.tests.SaneFrameOrderingAssertion;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.extensions.fragment.FragmentExtension;
import org.eclipse.jetty.websocket.common.frames.ContinuationFrame;

View File

@ -36,6 +36,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@ -62,6 +63,8 @@ import org.eclipse.jetty.websocket.api.util.QuoteUtil;
import org.eclipse.jetty.websocket.api.util.WSURI;
import org.eclipse.jetty.websocket.client.ClientUpgradeRequest;
import org.eclipse.jetty.websocket.client.WebSocketClient;
import org.eclipse.jetty.websocket.common.WebSocketFrame;
import org.eclipse.jetty.websocket.common.frames.TextFrame;
import org.eclipse.jetty.websocket.jsr356.server.JsrCreator;
import org.eclipse.jetty.websocket.jsr356.server.ServerContainer;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
@ -69,6 +72,7 @@ import org.eclipse.jetty.websocket.tests.Defaults;
import org.eclipse.jetty.websocket.tests.TrackingEndpoint;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Rule;
@ -719,17 +723,19 @@ public class ConfiguratorTest
@Test
public void testAnnotationConfigurator() throws Exception
{
URI uri = baseServerUri.resolve("/config-normal");
BlockheadClientRequest request = client.newWsRequest(uri);
Future<BlockheadConnection> connFut = request.sendAsync();
URI wsUri = baseServerUri.resolve("/config-normal");
try (BlockheadConnection clientConn = connFut.get(Timeouts.CONNECT, Timeouts.CONNECT_UNIT))
{
clientConn.write(new TextFrame().setPayload("tellme"));
LinkedBlockingQueue<WebSocketFrame> frames = clientConn.getFrameQueue();
WebSocketFrame frame = frames.poll(Timeouts.POLL_EVENT, Timeouts.POLL_EVENT_UNIT);
Assert.assertThat("Frame Response", frame.getPayloadAsUTF8(), is("UserProperties[self.configurator] = " + ConfigNormalConfigurator.class.getName()));
}
TrackingEndpoint clientSocket = new TrackingEndpoint(testname.getMethodName());
ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest();
Future<org.eclipse.jetty.websocket.api.Session> clientConnectFuture = client.connect(clientSocket, wsUri, upgradeRequest);
org.eclipse.jetty.websocket.api.Session clientSession = clientConnectFuture.get(Defaults.CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
clientSession.getRemote().sendString("tellme");
String incomingMessage = clientSocket.messageQueue.poll(5, TimeUnit.SECONDS);
assertThat("Incoming message", incomingMessage, is("UserProperties[self.configurator] = " + ConfigNormalConfigurator.class.getName()));
}
/**
@ -739,16 +745,17 @@ public class ConfiguratorTest
@Test
public void testOverrideConfigurator() throws Exception
{
URI uri = baseServerUri.resolve("/config-override");
BlockheadClientRequest request = client.newWsRequest(uri);
Future<BlockheadConnection> connFut = request.sendAsync();
URI wsUri = baseServerUri.resolve("/config-override");
TrackingEndpoint clientSocket = new TrackingEndpoint(testname.getMethodName());
ClientUpgradeRequest upgradeRequest = new ClientUpgradeRequest();
try (BlockheadConnection clientConn = connFut.get(Timeouts.CONNECT, Timeouts.CONNECT_UNIT))
{
clientConn.write(new TextFrame().setPayload("tellme"));
LinkedBlockingQueue<WebSocketFrame> frames = clientConn.getFrameQueue();
WebSocketFrame frame = frames.poll(Timeouts.POLL_EVENT, Timeouts.POLL_EVENT_UNIT);
Assert.assertThat("Frame Response", frame.getPayloadAsUTF8(), is("UserProperties[self.configurator] = " + ConfigOverrideConfigurator.class.getName()));
}
Future<org.eclipse.jetty.websocket.api.Session> clientConnectFuture = client.connect(clientSocket, wsUri, upgradeRequest);
org.eclipse.jetty.websocket.api.Session clientSession = clientConnectFuture.get(Defaults.CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
clientSession.getRemote().sendString("tellme");
String incomingMessage = clientSocket.messageQueue.poll(5, TimeUnit.SECONDS);
assertThat("Incoming message", incomingMessage, is("UserProperties[self.configurator] = " + ConfigOverrideConfigurator.class.getName()));
}
}