Author: clebert.suconic(a)jboss.com
Date: 2009-11-18 10:11:45 -0500 (Wed, 18 Nov 2009)
New Revision: 8310
Removed:
trunk/tests/src/org/hornetq/tests/integration/persistence/JournalStorageManagerIntegrationTest.java
Modified:
trunk/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java
Log:
just a clean up (duplicated tests)
Modified:
trunk/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java 2009-11-18
15:05:07 UTC (rev 8309)
+++
trunk/tests/src/org/hornetq/tests/integration/largemessage/ServerLargeMessageTest.java 2009-11-18
15:11:45 UTC (rev 8310)
@@ -13,15 +13,13 @@
package org.hornetq.tests.integration.largemessage;
-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.client.impl.ClientSessionFactoryImpl;
-import org.hornetq.core.persistence.impl.journal.FileLargeServerMessage;
+import java.util.concurrent.Executors;
+
+import org.hornetq.core.config.Configuration;
import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
-import org.hornetq.core.server.HornetQServer;
+import org.hornetq.core.server.JournalType;
+import org.hornetq.core.server.LargeServerMessage;
+import org.hornetq.core.server.ServerMessage;
import org.hornetq.tests.util.ServiceTestBase;
/**
@@ -44,65 +42,34 @@
// Public --------------------------------------------------------
- // The ClientConsumer should be able to also send ServerLargeMessages as that's
done by the CoreBridge
- public void testSendServerMessage() throws Exception
+ public void testLargeMessageCopy() throws Exception
{
- HornetQServer server = createServer(true);
-
- server.start();
-
- ClientSessionFactory sf = createFactory(false);
-
- ClientSession session = sf.createSession(false, false);
-
- try
+ clearData();
+
+ Configuration configuration = createDefaultConfig();
+
+ configuration.start();
+
+ configuration.setJournalType(JournalType.ASYNCIO);
+
+ final JournalStorageManager journal = new JournalStorageManager(configuration,
Executors.newCachedThreadPool());
+ journal.start();
+
+ LargeServerMessage msg = journal.createLargeMessage();
+ msg.setMessageID(1);
+
+ byte[] data = new byte[1024];
+
+ for (int i = 0; i < 110; i++)
{
- FileLargeServerMessage fileMessage = new
FileLargeServerMessage((JournalStorageManager)server.getStorageManager());
-
- fileMessage.setMessageID(1005);
-
- for (int i = 0 ; i < 2 *
ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE; i++)
- {
- fileMessage.addBytes(new byte[]{getSamplebyte(i)});
- }
-
- fileMessage.releaseResources();
-
- session.createQueue("A", "A");
-
- ClientProducer prod = session.createProducer("A");
-
- prod.send(fileMessage);
-
- fileMessage.deleteFile();
-
- session.commit();
-
- session.start();
-
- ClientConsumer cons = session.createConsumer("A");
-
- ClientMessage msg = cons.receive(5000);
-
- assertNotNull(msg);
-
- assertEquals(msg.getBodySize(), 2 *
ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE);
-
- for (int i = 0 ; i < 2 *
ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE; i++)
- {
- assertEquals(getSamplebyte(i), msg.getBody().readByte());
- }
-
- msg.acknowledge();
-
- session.commit();
-
+ msg.addBytes(data);
}
- finally
- {
- sf.close();
- server.stop();
- }
+
+ ServerMessage msg2 = msg.copy(2);
+
+ assertEquals(110 * 1024, msg.getBodySize());
+ assertEquals(110 * 1024, msg2.getBodySize());
+
}
// Package protected ---------------------------------------------
Deleted:
trunk/tests/src/org/hornetq/tests/integration/persistence/JournalStorageManagerIntegrationTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/persistence/JournalStorageManagerIntegrationTest.java 2009-11-18
15:05:07 UTC (rev 8309)
+++
trunk/tests/src/org/hornetq/tests/integration/persistence/JournalStorageManagerIntegrationTest.java 2009-11-18
15:11:45 UTC (rev 8310)
@@ -1,85 +0,0 @@
-/*
- * 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.persistence;
-
-import java.util.concurrent.Executors;
-
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
-import org.hornetq.core.server.JournalType;
-import org.hornetq.core.server.LargeServerMessage;
-import org.hornetq.core.server.ServerMessage;
-import org.hornetq.tests.util.ServiceTestBase;
-
-/**
- * A JournalStorageManagerIntegrationTest
- *
- * @author <a href="mailto:clebert.suconic@jboss.org">Clebert
Suconic</a>
- *
- * Created Jan 24, 2009 11:14:13 PM
- *
- *
- */
-public class JournalStorageManagerIntegrationTest extends ServiceTestBase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testLargeMessageCopy() throws Exception
- {
- clearData();
-
- Configuration configuration = createDefaultConfig();
-
- configuration.start();
-
- configuration.setJournalType(JournalType.ASYNCIO);
-
- final JournalStorageManager journal = new JournalStorageManager(configuration,
Executors.newCachedThreadPool());
- journal.start();
-
- LargeServerMessage msg = journal.createLargeMessage();
- msg.setMessageID(1);
-
- byte[] data = new byte[1024];
-
- for (int i = 0; i < 110; i++)
- {
- msg.addBytes(data);
- }
-
- ServerMessage msg2 = msg.copy(2);
-
- assertEquals(110 * 1024, msg.getBodySize());
- assertEquals(110 * 1024, msg2.getBodySize());
-
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}