Move the reusable classes in netty-testsuite to main/java/src and deploy them
This commit is contained in:
parent
f05a20029b
commit
2338bc52cb
37
pom.xml
37
pom.xml
@ -214,6 +214,38 @@
|
||||
<version>2.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Common test dependencies -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymockclassextension</artifactId>
|
||||
<version>3.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jmock</groupId>
|
||||
<artifactId>jmock-junit4</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test dependencies for jboss marshalling encoder/decoder -->
|
||||
<dependency>
|
||||
<groupId>org.jboss.marshalling</groupId>
|
||||
@ -250,31 +282,26 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<version>3.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymockclassextension</artifactId>
|
||||
<version>3.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jmock</groupId>
|
||||
<artifactId>jmock-junit4</artifactId>
|
||||
<version>2.6.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.0.13</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
@ -29,6 +29,31 @@
|
||||
<name>Netty/Testsuite</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymock</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.easymock</groupId>
|
||||
<artifactId>easymockclassextension</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jmock</groupId>
|
||||
<artifactId>jmock-junit4</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
<artifactId>netty-transport-sctp</artifactId>
|
||||
@ -53,12 +78,6 @@
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>me.normanmaurer.maven.autobahntestsuite</groupId>
|
||||
|
@ -57,8 +57,7 @@ public abstract class AbstractSctpTest {
|
||||
currentBootstrap = e.getValue();
|
||||
sb = e.getKey().newInstance();
|
||||
cb = e.getValue().newInstance();
|
||||
addr = new InetSocketAddress(
|
||||
NetUtil.LOCALHOST, TestUtils.getFreePort());
|
||||
addr = new InetSocketAddress(NetUtil.LOCALHOST, TestUtils.getFreePort());
|
||||
sb.localAddress(addr);
|
||||
sb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
sb.childOption(ChannelOption.ALLOCATOR, allocator);
|
||||
@ -69,7 +68,7 @@ public abstract class AbstractSctpTest {
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), ServerBootstrap.class, Bootstrap.class);
|
||||
TestUtils.testMethodName(testName), ServerBootstrap.class, Bootstrap.class);
|
||||
m.invoke(this, sb, cb);
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw ex.getCause();
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reusable classes that help testing the code that uses SCTP transport.
|
||||
*/
|
||||
package io.netty.testsuite.transport.sctp;
|
@ -57,8 +57,7 @@ public abstract class AbstractClientSocketTest {
|
||||
"Running: %s %d of %d with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), Bootstrap.class);
|
||||
Method m = getClass().getDeclaredMethod(TestUtils.testMethodName(testName), Bootstrap.class);
|
||||
m.invoke(this, cb);
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw ex.getCause();
|
@ -53,8 +53,7 @@ public abstract class AbstractDatagramTest {
|
||||
for (Entry<Factory<Bootstrap>, Factory<Bootstrap>> e: COMBO) {
|
||||
sb = e.getKey().newInstance();
|
||||
cb = e.getValue().newInstance();
|
||||
addr = new InetSocketAddress(
|
||||
NetUtil.LOCALHOST4, TestUtils.getFreePort());
|
||||
addr = new InetSocketAddress(NetUtil.LOCALHOST4, TestUtils.getFreePort());
|
||||
sb.localAddress(addr);
|
||||
sb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
cb.localAddress(0).remoteAddress(addr);
|
||||
@ -64,7 +63,7 @@ public abstract class AbstractDatagramTest {
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), Bootstrap.class, Bootstrap.class);
|
||||
TestUtils.testMethodName(testName), Bootstrap.class, Bootstrap.class);
|
||||
m.invoke(this, sb, cb);
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw ex.getCause();
|
@ -50,8 +50,7 @@ public abstract class AbstractServerSocketTest {
|
||||
int i = 0;
|
||||
for (Factory<ServerBootstrap> e: COMBO) {
|
||||
sb = e.newInstance();
|
||||
addr = new InetSocketAddress(
|
||||
NetUtil.LOCALHOST, TestUtils.getFreePort());
|
||||
addr = new InetSocketAddress(NetUtil.LOCALHOST, TestUtils.getFreePort());
|
||||
sb.localAddress(addr);
|
||||
sb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
sb.childOption(ChannelOption.ALLOCATOR, allocator);
|
||||
@ -60,8 +59,7 @@ public abstract class AbstractServerSocketTest {
|
||||
"Running: %s %d of %d (%s) with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
testName.getMethodName(), ServerBootstrap.class);
|
||||
Method m = getClass().getDeclaredMethod(TestUtils.testMethodName(testName), ServerBootstrap.class);
|
||||
m.invoke(this, sb);
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw ex.getCause();
|
@ -58,8 +58,7 @@ public abstract class AbstractSocketTest {
|
||||
currentBootstrap = e.getValue();
|
||||
sb = e.getKey().newInstance();
|
||||
cb = e.getValue().newInstance();
|
||||
addr = new InetSocketAddress(
|
||||
NetUtil.LOCALHOST, TestUtils.getFreePort());
|
||||
addr = new InetSocketAddress(NetUtil.LOCALHOST, TestUtils.getFreePort());
|
||||
sb.localAddress(addr);
|
||||
sb.option(ChannelOption.ALLOCATOR, allocator);
|
||||
sb.childOption(ChannelOption.ALLOCATOR, allocator);
|
||||
@ -70,11 +69,8 @@ public abstract class AbstractSocketTest {
|
||||
"Running: %s %d of %d (%s + %s) with %s",
|
||||
testName.getMethodName(), ++ i, COMBO.size(), sb, cb, StringUtil.simpleClassName(allocator)));
|
||||
try {
|
||||
String testMethodName = testName.getMethodName();
|
||||
if (testMethodName.contains("[")) {
|
||||
testMethodName = testMethodName.substring(0, testMethodName.indexOf('['));
|
||||
}
|
||||
Method m = getClass().getDeclaredMethod(testMethodName, ServerBootstrap.class, Bootstrap.class);
|
||||
Method m = getClass().getDeclaredMethod(
|
||||
TestUtils.testMethodName(testName), ServerBootstrap.class, Bootstrap.class);
|
||||
m.invoke(this, sb, cb);
|
||||
} catch (InvocationTargetException ex) {
|
||||
throw ex.getCause();
|
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2012 The Netty Project
|
||||
*
|
||||
* The Netty Project licenses this file to you under the Apache License,
|
||||
* version 2.0 (the "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Reusable classes that help testing the code that uses socket and datagram transport.
|
||||
*/
|
||||
package io.netty.testsuite.transport.socket;
|
@ -16,6 +16,8 @@
|
||||
package io.netty.testsuite.util;
|
||||
|
||||
import io.netty.util.NetUtil;
|
||||
import org.junit.rules.TestName;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
@ -111,5 +113,16 @@ public final class TestUtils {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the method name of the current test.
|
||||
*/
|
||||
public static String testMethodName(TestName testName) {
|
||||
String testMethodName = testName.getMethodName();
|
||||
if (testMethodName.contains("[")) {
|
||||
testMethodName = testMethodName.substring(0, testMethodName.indexOf('['));
|
||||
}
|
||||
return testMethodName;
|
||||
}
|
||||
|
||||
private TestUtils() { }
|
||||
}
|
@ -15,6 +15,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Util Test suite classes
|
||||
* Utility classes that help testing a network application.
|
||||
*/
|
||||
package io.netty.testsuite.util;
|
Loading…
Reference in New Issue
Block a user