[jboss-cvs] JBoss Messaging SVN: r5670 - in branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration: cluster/failover and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Jan 20 13:08:58 EST 2009
Author: clebert.suconic at jboss.com
Date: 2009-01-20 13:08:57 -0500 (Tue, 20 Jan 2009)
New Revision: 5670
Added:
branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageMuliThreadFailoverTest.java
Modified:
branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
Log:
Commit on tests..
Modified: branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
===================================================================
--- branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2009-01-20 12:56:21 UTC (rev 5669)
+++ branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2009-01-20 18:08:57 UTC (rev 5670)
@@ -523,6 +523,87 @@
}
+ public void testRollback() throws Exception
+ {
+ // there are two bindings.. one is ACKed, the other is not, the server is restarted
+ // The other binding is acked... The file must be deleted
+
+ clearData();
+
+ try
+ {
+
+ messagingService = createService(true);
+
+ messagingService.start();
+
+ ClientSessionFactory sf = createInVMFactory();
+
+ ClientSession session = sf.createSession(false, false, false);
+
+ session.createQueue(ADDRESS, ADDRESS, null, true, false);
+
+ int numberOfIntegers = 100000;
+
+ Message clientFile = createLargeClientMessage(session, numberOfIntegers);
+
+ session.start();
+
+ ClientProducer producer = session.createProducer(ADDRESS);
+
+ ClientConsumer consumer = session.createConsumer(ADDRESS);
+
+ long lastTime = System.currentTimeMillis();
+
+ for (int n = 0; n < 1000; n++)
+ {
+ lastTime = System.currentTimeMillis();
+
+ producer.send(clientFile);
+
+ assertNull(consumer.receiveImmediate());
+
+ session.commit();
+
+ for (int i = 0; i < 2; i++)
+ {
+
+ ClientMessage clientMessage = consumer.receive(5000);
+
+ assertNotNull(clientMessage);
+
+ assertEquals(numberOfIntegers * 4, clientMessage.getBody().limit());
+
+ clientMessage.acknowledge();
+
+ if (i == 0)
+ {
+ session.rollback();
+ }
+ else
+ {
+ session.commit();
+ }
+ }
+ }
+
+ session.close();
+
+ validateNoFilesOnLargeDir();
+ }
+ finally
+ {
+ try
+ {
+ messagingService.stop();
+ }
+ catch (Throwable ignored)
+ {
+ }
+ }
+
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified: branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java
===================================================================
--- branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-01-20 12:56:21 UTC (rev 5669)
+++ branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/MultiThreadRandomFailoverTestBase.java 2009-01-20 18:08:57 UTC (rev 5670)
@@ -267,6 +267,11 @@
protected abstract void checkSize(ClientMessage message);
+ protected ClientSession createAutoCommitSession(ClientSessionFactory sf) throws Exception
+ {
+ return sf.createSession(false, true, true);
+ }
+
protected void doTestA(final ClientSessionFactory sf, final int threadNum) throws Exception
{
long start = System.currentTimeMillis();
@@ -284,7 +289,7 @@
{
SimpleString subName = new SimpleString(threadNum + "sub" + i);
- ClientSession sessConsume = sf.createSession(false, true, true);
+ ClientSession sessConsume = createAutoCommitSession(sf);
sessConsume.start();
@@ -316,7 +321,7 @@
for (MyHandler handler : handlers)
{
- boolean ok = handler.latch.await(5000, TimeUnit.MILLISECONDS);
+ boolean ok = handler.latch.await(10000, TimeUnit.MILLISECONDS);
if (!ok)
{
@@ -645,7 +650,7 @@
for (MyHandler handler : handlers)
{
- boolean ok = handler.latch.await(10000, TimeUnit.MILLISECONDS);
+ boolean ok = handler.latch.await(50000, TimeUnit.MILLISECONDS);
if (!ok)
{
@@ -1356,7 +1361,7 @@
{
Failer failer = new Failer(session);
- timer.schedule(failer, (long)(time * Math.random()), 100);
+ //timer.schedule(failer, (long)(time * Math.random()), 100);
return failer;
}
Added: branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageMuliThreadFailoverTest.java
===================================================================
--- branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageMuliThreadFailoverTest.java (rev 0)
+++ branches/Branch_Failover_Page/tests/src/org/jboss/messaging/tests/integration/cluster/failover/PageMuliThreadFailoverTest.java 2009-01-20 18:08:57 UTC (rev 5670)
@@ -0,0 +1,169 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * 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.messaging.tests.integration.cluster.failover;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientSession;
+import org.jboss.messaging.core.client.ClientSessionFactory;
+import org.jboss.messaging.core.client.impl.ClientSessionFactoryInternal;
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.remoting.impl.ByteBufferWrapper;
+import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.jboss.messaging.core.remoting.impl.invm.TransportConstants;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+
+/**
+ * A LargeMessageMuliThreadFailoverTest
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ * Created Jan 18, 2009 4:52:09 PM
+ *
+ *
+ */
+public class PageMuliThreadFailoverTest extends MultiThreadRandomFailoverTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ private static final int PAGE_SIZE = 10 * 1024;
+
+ private static final int PAGE_MAX_GLOBAL_SIZE = 100 * 1024;
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected ClientSessionFactoryInternal createSessionFactory()
+ {
+ ClientSessionFactoryInternal sf = super.createSessionFactory();
+
+ return sf;
+
+ }
+
+ @Override
+ protected void start() throws Exception
+ {
+
+ deleteDirectory(new File(getTestDir()));
+
+ Configuration backupConf = new ConfigurationImpl();
+
+ backupConf.setJournalDirectory(getJournalDir(getTestDir() + "/backup"));
+ backupConf.setLargeMessagesDirectory(getLargeMessagesDir(getTestDir() + "/backup"));
+ backupConf.setBindingsDirectory(getBindingsDir(getTestDir() + "/backup"));
+ backupConf.setPagingDirectory(getPageDir(getTestDir() + "/backup"));
+
+ backupConf.setPagingMaxGlobalSizeBytes(PAGE_MAX_GLOBAL_SIZE);
+ backupConf.setPagingDefaultSize(PAGE_SIZE);
+
+ backupConf.setJournalSyncNonTransactional(true);
+
+ backupConf.setJournalFileSize(100 * 1024);
+
+ backupConf.setSecurityEnabled(false);
+ backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
+
+ backupConf.getAcceptorConfigurations()
+ .add(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName(), backupParams));
+ backupConf.setBackup(true);
+
+ backupService = MessagingServiceImpl.newMessagingService(backupConf);
+ backupService.start();
+
+ Configuration liveConf = new ConfigurationImpl();
+
+ liveConf.setJournalDirectory(getJournalDir(getTestDir() + "/live"));
+ liveConf.setLargeMessagesDirectory(getLargeMessagesDir(getTestDir() + "/live"));
+ liveConf.setBindingsDirectory(getBindingsDir(getTestDir() + "/live"));
+ liveConf.setPagingDirectory(getPageDir(getTestDir() + "/live"));
+
+ liveConf.setJournalFileSize(100 * 1024);
+ liveConf.setPagingMaxGlobalSizeBytes(PAGE_MAX_GLOBAL_SIZE);
+ liveConf.setPagingDefaultSize(PAGE_SIZE);
+
+ liveConf.setJournalSyncNonTransactional(true);
+
+ liveConf.setSecurityEnabled(false);
+ liveConf.getAcceptorConfigurations()
+ .add(new TransportConfiguration(InVMAcceptorFactory.class.getCanonicalName()));
+
+ Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
+
+ TransportConfiguration backupTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY,
+ backupParams,
+ "backup-connector");
+ connectors.put(backupTC.getName(), backupTC);
+ liveConf.setConnectorConfigurations(connectors);
+ liveConf.setBackupConnectorName(backupTC.getName());
+ liveService = MessagingServiceImpl.newMessagingService(liveConf);
+
+ liveService.start();
+
+ }
+
+ @Override
+ protected ClientSession createAutoCommitSession(final ClientSessionFactory sf) throws Exception
+ {
+ return sf.createSession(null, null, false, true, true, false, 0);
+
+ }
+
+ @Override
+ protected void setBody(final ClientMessage message) throws Exception
+ {
+ message.setBody(new ByteBufferWrapper(ByteBuffer.allocate(1024)));
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.messaging.tests.integration.cluster.failover.MultiThreadRandomFailoverTestBase#checkSize(org.jboss.messaging.core.client.ClientMessage)
+ */
+ @Override
+ protected void checkSize(final ClientMessage message)
+ {
+ assertEquals(1024, message.getBodySize());
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
More information about the jboss-cvs-commits
mailing list