Author: david.lloyd(a)jboss.com
Date: 2010-02-26 18:45:04 -0500 (Fri, 26 Feb 2010)
New Revision: 5760
Added:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestObject.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java
Removed:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/InvocationTestObject.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/CloseableTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/stream/StreamsTestCase.java
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
Log:
Consolodate test stuff into test pkg
Deleted:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/InvocationTestObject.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/InvocationTestObject.java 2010-02-26
23:42:28 UTC (rev 5759)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/InvocationTestObject.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -1,29 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3;
-
-import java.io.Serializable;
-
-public final class InvocationTestObject implements Serializable {
- private static final long serialVersionUID = 7228470862155215008L;
-}
Deleted:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/CloseableTestCase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/CloseableTestCase.java 2010-02-26
23:42:28 UTC (rev 5759)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/CloseableTestCase.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3.spi;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-import junit.framework.TestCase;
-import org.jboss.remoting3.CloseHandler;
-import org.jboss.xnio.IoUtils;
-import org.jboss.xnio.log.Logger;
-
-/**
- *
- */
-public final class CloseableTestCase extends TestCase {
-
- public static final Logger log = Logger.getLogger(CloseableTestCase.class);
-
- public void testBasic() throws Throwable {
- final ExecutorService executorService = Executors.newCachedThreadPool();
- try {
- final AtomicBoolean closed = new AtomicBoolean();
- final CountDownLatch latch = new CountDownLatch(1);
- final AbstractHandleableCloseable<?> closeable = new
AbstractHandleableCloseable(executorService) {
- // empty
- };
- try {
- closeable.addCloseHandler(new CloseHandler<Object>() {
- public void handleClose(final Object x) {
- closed.set(true);
- latch.countDown();
- }
- });
- assertTrue(closeable.isOpen());
- assertFalse(closed.get());
- closeable.close();
- assertTrue(latch.await(500L, TimeUnit.MILLISECONDS));
- assertFalse(closeable.isOpen());
- assertTrue(closed.get());
- } finally {
- IoUtils.safeClose(closeable);
- }
- } finally {
- executorService.shutdownNow();
- }
- }
-}
Deleted:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/stream/StreamsTestCase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/stream/StreamsTestCase.java 2010-02-26
23:42:28 UTC (rev 5759)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/stream/StreamsTestCase.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3.stream;
-
-import junit.framework.TestCase;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Arrays;
-import java.util.Vector;
-import java.io.EOFException;
-
-/**
- *
- */
-public final class StreamsTestCase extends TestCase {
-
- public void testCollectionObjectSink() throws Throwable {
- final ArrayList<String> strings = new ArrayList<String>();
- final ObjectSink<String> sink = Streams.getCollectionObjectSink(strings);
- sink.accept("Instance 1");
- sink.accept("Instance 2");
- sink.accept("Instance 3");
- sink.accept("Instance 4");
- sink.accept("Instance 5");
- sink.close();
- final Iterator<String> i = strings.iterator();
- assertEquals(i.next(), "Instance 1");
- assertEquals(i.next(), "Instance 2");
- assertEquals(i.next(), "Instance 3");
- assertEquals(i.next(), "Instance 4");
- assertEquals(i.next(), "Instance 5");
- assertFalse(i.hasNext());
- }
-
- public void testIteratorObjectSource() throws Throwable {
- final ObjectSource<String> source =
Streams.getIteratorObjectSource(Arrays.asList("One", "Two",
"Three", "Four", "Five").iterator());
- assertTrue(source.hasNext());
- assertEquals(source.next(), "One");
- assertTrue(source.hasNext());
- assertEquals(source.next(), "Two");
- assertTrue(source.hasNext());
- assertEquals(source.next(), "Three");
- assertTrue(source.hasNext());
- assertEquals(source.next(), "Four");
- assertTrue(source.hasNext());
- assertTrue(source.hasNext()); // tricky!
- assertEquals(source.next(), "Five");
- assertFalse(source.hasNext());
- assertFalse(source.hasNext()); // also tricky!
- source.close();
- assertFalse(source.hasNext()); // also also tricky!
- assertFalse(source.hasNext()); // also also also tricky!
- try {
- source.next();
- } catch (EOFException t) {
- return;
- }
- fail("No exception thrown at end of iterator");
- }
-
- public void testEnumerationObjectSource() throws Throwable {
- final ObjectSource<String> source = Streams.getEnumerationObjectSource(new
Vector<String>(Arrays.asList("One", "Two", "Three",
"Four", "Five")).elements());
- assertTrue(source.hasNext());
- assertEquals(source.next(), "One");
- assertTrue(source.hasNext());
- assertEquals(source.next(), "Two");
- assertTrue(source.hasNext());
- assertEquals(source.next(), "Three");
- assertTrue(source.hasNext());
- assertEquals(source.next(), "Four");
- assertTrue(source.hasNext());
- assertTrue(source.hasNext()); // tricky!
- assertEquals(source.next(), "Five");
- assertFalse(source.hasNext());
- assertFalse(source.hasNext()); // also tricky!
- source.close();
- assertFalse(source.hasNext()); // also also tricky!
- assertFalse(source.hasNext()); // also also also tricky!
- try {
- source.next();
- } catch (EOFException t) {
- return;
- }
- fail("No exception thrown at end of iterator");
- }
-}
Copied:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java
(from rev 5755,
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/spi/CloseableTestCase.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/CloseableTestCase.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.test;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import junit.framework.TestCase;
+import org.jboss.remoting3.CloseHandler;
+import org.jboss.remoting3.spi.AbstractHandleableCloseable;
+import org.jboss.xnio.IoUtils;
+import org.jboss.xnio.log.Logger;
+
+/**
+ *
+ */
+public final class CloseableTestCase extends TestCase {
+
+ public static final Logger log = Logger.getLogger(CloseableTestCase.class);
+
+ public void testBasic() throws Throwable {
+ final ExecutorService executorService = Executors.newCachedThreadPool();
+ try {
+ final AtomicBoolean closed = new AtomicBoolean();
+ final CountDownLatch latch = new CountDownLatch(1);
+ final AbstractHandleableCloseable<?> closeable = new
AbstractHandleableCloseable(executorService) {
+ // empty
+ };
+ try {
+ closeable.addCloseHandler(new CloseHandler<Object>() {
+ public void handleClose(final Object x) {
+ closed.set(true);
+ latch.countDown();
+ }
+ });
+ assertFalse(closed.get());
+ closeable.close();
+ assertTrue(latch.await(500L, TimeUnit.MILLISECONDS));
+ assertTrue(closed.get());
+ } finally {
+ IoUtils.safeClose(closeable);
+ }
+ } finally {
+ executorService.shutdownNow();
+ }
+ }
+}
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java 2010-02-26
23:42:28 UTC (rev 5759)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/EndpointTestCase.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -22,10 +22,10 @@
package org.jboss.remoting3.test;
+import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import java.io.IOException;
import junit.framework.TestCase;
import org.jboss.remoting3.Client;
import org.jboss.remoting3.Endpoint;
Modified:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-02-26
23:42:28 UTC (rev 5759)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestBase.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -30,7 +30,6 @@
import org.jboss.remoting3.ClientListener;
import org.jboss.remoting3.Connection;
import org.jboss.remoting3.Endpoint;
-import org.jboss.remoting3.InvocationTestObject;
import org.jboss.remoting3.Registration;
import org.jboss.remoting3.RemoteExecutionException;
import org.jboss.remoting3.Remoting;
Copied:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestObject.java
(from rev 5758,
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/InvocationTestObject.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestObject.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/InvocationTestObject.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.test;
+
+import java.io.Serializable;
+
+public final class InvocationTestObject implements Serializable {
+ private static final long serialVersionUID = 7228470862155215008L;
+}
Copied:
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java
(from rev 5754,
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/stream/StreamsTestCase.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/test/java/org/jboss/remoting3/test/StreamsTestCase.java 2010-02-26
23:45:04 UTC (rev 5760)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.test;
+
+import java.io.EOFException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Vector;
+import junit.framework.TestCase;
+import org.jboss.remoting3.stream.ObjectSink;
+import org.jboss.remoting3.stream.ObjectSource;
+import org.jboss.remoting3.stream.Streams;
+
+/**
+ *
+ */
+public final class StreamsTestCase extends TestCase {
+
+ public void testCollectionObjectSink() throws Throwable {
+ final ArrayList<String> strings = new ArrayList<String>();
+ final ObjectSink<String> sink = Streams.getCollectionObjectSink(strings);
+ sink.accept("Instance 1");
+ sink.accept("Instance 2");
+ sink.accept("Instance 3");
+ sink.accept("Instance 4");
+ sink.accept("Instance 5");
+ sink.close();
+ final Iterator<String> i = strings.iterator();
+ assertEquals(i.next(), "Instance 1");
+ assertEquals(i.next(), "Instance 2");
+ assertEquals(i.next(), "Instance 3");
+ assertEquals(i.next(), "Instance 4");
+ assertEquals(i.next(), "Instance 5");
+ assertFalse(i.hasNext());
+ }
+
+ public void testIteratorObjectSource() throws Throwable {
+ final ObjectSource<String> source =
Streams.getIteratorObjectSource(Arrays.asList("One", "Two",
"Three", "Four", "Five").iterator());
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "One");
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "Two");
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "Three");
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "Four");
+ assertTrue(source.hasNext());
+ assertTrue(source.hasNext()); // tricky!
+ assertEquals(source.next(), "Five");
+ assertFalse(source.hasNext());
+ assertFalse(source.hasNext()); // also tricky!
+ source.close();
+ assertFalse(source.hasNext()); // also also tricky!
+ assertFalse(source.hasNext()); // also also also tricky!
+ try {
+ source.next();
+ } catch (EOFException t) {
+ return;
+ }
+ fail("No exception thrown at end of iterator");
+ }
+
+ public void testEnumerationObjectSource() throws Throwable {
+ final ObjectSource<String> source = Streams.getEnumerationObjectSource(new
Vector<String>(Arrays.asList("One", "Two", "Three",
"Four", "Five")).elements());
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "One");
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "Two");
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "Three");
+ assertTrue(source.hasNext());
+ assertEquals(source.next(), "Four");
+ assertTrue(source.hasNext());
+ assertTrue(source.hasNext()); // tricky!
+ assertEquals(source.next(), "Five");
+ assertFalse(source.hasNext());
+ assertFalse(source.hasNext()); // also tricky!
+ source.close();
+ assertFalse(source.hasNext()); // also also tricky!
+ assertFalse(source.hasNext()); // also also also tricky!
+ try {
+ source.next();
+ } catch (EOFException t) {
+ return;
+ }
+ fail("No exception thrown at end of iterator");
+ }
+}