Author: ron.sigal(a)jboss.com
Date: 2010-11-13 11:54:03 -0500 (Sat, 13 Nov 2010)
New Revision: 6160
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/stream/PrimaryExternalizerFactoryTestCase.java
Log:
JBREM-1256: (1) Uses Random from RemotingRootTestBase to create unique XNIO name; (2)
changed writer.close() to writer.flush() in TestRequestListener.
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/stream/PrimaryExternalizerFactoryTestCase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/stream/PrimaryExternalizerFactoryTestCase.java 2010-11-13
16:52:27 UTC (rev 6159)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/stream/PrimaryExternalizerFactoryTestCase.java 2010-11-13
16:54:03 UTC (rev 6160)
@@ -39,9 +39,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Date;
import java.util.List;
-import java.util.Random;
import org.jboss.remoting3.Client;
import org.jboss.remoting3.Connection;
@@ -72,8 +70,6 @@
private static final String INSTANCE_NAME = "test";
private static final String READER_TEST_STRING = "reader test string";
private static final String WRITER_TEST_STRING = "writer test string";
-
- private static int counter = new Random(new Date().getTime()).nextInt();
@BeforeMethod
public void setUp() {
@@ -93,8 +89,8 @@
Client<Object, Object> client = null;
try {
- int id0 = counter++;
- int id1 = counter++;
+ int id0 = Math.abs(random.nextInt());
+ int id1 = Math.abs(random.nextInt());
// Set up services.
sp0 = setupServer(null, id0, new TestRequestListener(), SERVICE_TYPE,
INSTANCE_NAME);
@@ -178,8 +174,8 @@
Client<Object, Object> client = null;
try {
- int id0 = counter++;
- int id1 = counter++;
+ int id0 = Math.abs(random.nextInt());
+ int id1 = Math.abs(random.nextInt());
// Set up services.
sp0 = setupServer(null, id0, new TestRequestListener(), SERVICE_TYPE,
INSTANCE_NAME);
@@ -224,8 +220,8 @@
Client<Object, Object> client = null;
try {
- int id0 = counter++;
- int id1 = counter++;
+ int id0 = Math.abs(random.nextInt());
+ int id1 = Math.abs(random.nextInt());
// Set up services.
sp0 = setupServer(null, id0, new TestRequestListener(), SERVICE_TYPE,
INSTANCE_NAME);
@@ -269,8 +265,8 @@
Client<Object, Object> client = null;
try {
- int id0 = counter++;
- int id1 = counter++;
+ int id0 = Math.abs(random.nextInt());
+ int id1 = Math.abs(random.nextInt());
// Set up services.
sp0 = setupServer(null, id0, new TestRequestListener(), SERVICE_TYPE,
INSTANCE_NAME);
@@ -320,8 +316,8 @@
Client<Object, Object> client = null;
try {
- int id0 = counter++;
- int id1 = counter++;
+ int id0 = Math.abs(random.nextInt());
+ int id1 = Math.abs(random.nextInt());
// Set up services.
sp0 = setupServer(null, id0, new TestRequestListener(), SERVICE_TYPE,
INSTANCE_NAME);
@@ -378,8 +374,8 @@
Client<Object, Object> client = null;
try {
- int id0 = counter++;
- int id1 = counter++;
+ int id0 = Math.abs(random.nextInt());
+ int id1 = Math.abs(random.nextInt());
// Set up services.
sp0 = setupServer(null, id0, new TestRequestListener(), SERVICE_TYPE,
INSTANCE_NAME);
@@ -481,7 +477,8 @@
log.info(this + " got Writer: " + request);
Writer writer = (Writer) request;
writer.write(WRITER_TEST_STRING);
- writer.close();
+// writer.close();
+ writer.flush();
log.info(this + " sending reply: " + WRITER_TEST_STRING);
context.sendReply(WRITER_TEST_STRING);
}