Author: clebert.suconic(a)jboss.com
Date: 2009-11-20 11:51:38 -0500 (Fri, 20 Nov 2009)
New Revision: 8347
Added:
branches/ClebertTemporary/tests/src/org/hornetq/tests/integration/client/SimpleClientTest.java
Modified:
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/AsynchronousFileTest.java
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java
Log:
AIO order
Added:
branches/ClebertTemporary/tests/src/org/hornetq/tests/integration/client/SimpleClientTest.java
===================================================================
---
branches/ClebertTemporary/tests/src/org/hornetq/tests/integration/client/SimpleClientTest.java
(rev 0)
+++
branches/ClebertTemporary/tests/src/org/hornetq/tests/integration/client/SimpleClientTest.java 2009-11-20
16:51:38 UTC (rev 8347)
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat 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.
+ */
+
+package org.hornetq.tests.integration.client;
+
+import org.hornetq.core.client.ClientConsumer;
+import org.hornetq.core.client.ClientMessage;
+import org.hornetq.core.client.ClientProducer;
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.tests.util.ServiceTestBase;
+
+/**
+ * The basic test possible. Useful to validate basic stuff.
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ * TODO: Don't commit this test on the main branch
+ */
+public class SimpleClientTest extends ServiceTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testSimpleTestNoTransacted() throws Exception
+ {
+ HornetQServer server = createServer(true);
+
+ server.start();
+
+ ClientSessionFactory factory = createInVMFactory();
+
+ ClientSession session = null;
+
+ try
+ {
+ session = factory.createSession(false, true, true);
+
+ session.createQueue("A", "A", true);
+ ClientProducer producer = session.createProducer("A");
+ producer.send(session.createClientMessage(true));
+
+ session.start();
+
+ ClientConsumer cons = session.createConsumer("A");
+
+ ClientMessage msg = cons.receive(10000);
+ assertNotNull(msg);
+ msg.acknowledge();
+
+ }
+ finally
+ {
+ session.close();
+ factory.close();
+ server.stop();
+ }
+
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified:
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/AsynchronousFileTest.java
===================================================================
---
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/AsynchronousFileTest.java 2009-11-20
16:50:48 UTC (rev 8346)
+++
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/AsynchronousFileTest.java 2009-11-20
16:51:38 UTC (rev 8347)
@@ -58,8 +58,6 @@
ExecutorService executor;
- ExecutorService callbackExecutor;
-
ExecutorService pollerExecutor;
@@ -74,7 +72,6 @@
{
super.setUp();
pollerExecutor = Executors.newCachedThreadPool(new
HornetQThreadFactory("HornetQ-AIO-poller-pool" + System.identityHashCode(this),
false));
- callbackExecutor = Executors.newSingleThreadExecutor();
executor = Executors.newSingleThreadExecutor();
}
@@ -82,7 +79,6 @@
{
executor.shutdown();
pollerExecutor.shutdown();
- callbackExecutor.shutdown();
super.tearDown();
}
@@ -92,7 +88,7 @@
* */
public void testOpenClose() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
for (int i = 0; i < 1000; i++)
{
controller.open(FILE_NAME, 10000);
@@ -103,7 +99,7 @@
public void testFileNonExistent() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
for (int i = 0; i < 1000; i++)
{
try
@@ -133,8 +129,8 @@
*/
public void testTwoFiles() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
- final AsynchronousFileImpl controller2 = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
+ final AsynchronousFileImpl controller2 = new AsynchronousFileImpl(executor,
pollerExecutor);
controller.open(FILE_NAME + ".1", 10000);
controller2.open(FILE_NAME + ".2", 10000);
@@ -246,7 +242,7 @@
}
}
- AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
ByteBuffer buffer = null;
try
{
@@ -256,7 +252,7 @@
controller.open(FILE_NAME, 10);
controller.close();
- controller = new AsynchronousFileImpl(executor, pollerExecutor,
callbackExecutor);
+ controller = new AsynchronousFileImpl(executor, pollerExecutor);
controller.open(FILE_NAME, 10);
@@ -339,7 +335,7 @@
public void testBufferCallbackUniqueBuffers() throws Exception
{
boolean closed = false;
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
try
{
final int NUMBER_LINES = 1000;
@@ -419,7 +415,7 @@
public void testBufferCallbackAwaysSameBuffer() throws Exception
{
boolean closed = false;
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
ByteBuffer buffer = null;
try
{
@@ -497,7 +493,7 @@
public void testRead() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
controller.setBufferCallback(new BufferCallback()
{
@@ -604,7 +600,7 @@
* The file is also read after being written to validate its correctness */
public void testConcurrentClose() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
try
{
@@ -708,7 +704,7 @@
private void asyncData(final int numberOfLines, final int size, final int aioLimit)
throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
controller.open(FILE_NAME, aioLimit);
ByteBuffer buffer = null;
@@ -790,7 +786,7 @@
final int NUMBER_LINES = 3000;
final int SIZE = 1024;
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
controller.open(FILE_NAME, 2000);
buffer = AsynchronousFileImpl.newBuffer(SIZE);
@@ -838,7 +834,7 @@
public void testInvalidWrite() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
controller.open(FILE_NAME, 2000);
ByteBuffer buffer = null;
@@ -939,7 +935,7 @@
public void testSize() throws Exception
{
- final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor, callbackExecutor);
+ final AsynchronousFileImpl controller = new AsynchronousFileImpl(executor,
pollerExecutor);
final int NUMBER_LINES = 10;
final int SIZE = 1024;
Modified:
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java
===================================================================
---
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java 2009-11-20
16:50:48 UTC (rev 8346)
+++
branches/ClebertTemporary/tests/src/org/hornetq/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java 2009-11-20
16:51:38 UTC (rev 8347)
@@ -58,8 +58,6 @@
ExecutorService executor;
- ExecutorService callbackExecutor;
-
ExecutorService pollerExecutor;
@@ -74,7 +72,6 @@
{
super.setUp();
pollerExecutor = Executors.newCachedThreadPool(new
HornetQThreadFactory("HornetQ-AIO-poller-pool" + System.identityHashCode(this),
false));
- callbackExecutor = Executors.newSingleThreadExecutor();
executor = Executors.newSingleThreadExecutor();
}
@@ -98,7 +95,7 @@
private void executeTest(final boolean sync) throws Throwable
{
debug(sync ? "Sync test:" : "Async test");
- AsynchronousFileImpl jlibAIO = new AsynchronousFileImpl(executor, pollerExecutor,
callbackExecutor);
+ AsynchronousFileImpl jlibAIO = new AsynchronousFileImpl(executor, pollerExecutor);
jlibAIO.open(FILE_NAME, 21000);
try
{