[jboss-cvs] JBoss Messaging SVN: r7495 - branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 29 10:55:19 EDT 2009
Author: clebert.suconic at jboss.com
Date: 2009-06-29 10:55:19 -0400 (Mon, 29 Jun 2009)
New Revision: 7495
Added:
branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/AIOJournalCompactTest.java
Modified:
branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/JournalCompactTest.java
Log:
Adding tests
Added: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/AIOJournalCompactTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/AIOJournalCompactTest.java (rev 0)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/AIOJournalCompactTest.java 2009-06-29 14:55:19 UTC (rev 7495)
@@ -0,0 +1,79 @@
+/*
+ * 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.journal;
+
+import java.io.File;
+
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.journal.SequentialFileFactory;
+import org.jboss.messaging.core.journal.impl.AIOSequentialFileFactory;
+
+/**
+ * A AIOJournalCompactTest
+ *
+ * @author clebert
+ *
+ *
+ */
+public class AIOJournalCompactTest extends JournalCompactTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected SequentialFileFactory getFileFactory() throws Exception
+ {
+ File file = new File(getTestDir());
+
+ deleteDirectory(file);
+
+ file.mkdir();
+
+ return new AIOSequentialFileFactory(getTestDir(),
+ ConfigurationImpl.DEFAULT_JOURNAL_AIO_BUFFER_SIZE,
+ 1000000,
+ true,
+ false
+ );
+ }
+
+
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/JournalCompactTest.java
===================================================================
--- branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/JournalCompactTest.java 2009-06-29 12:52:23 UTC (rev 7494)
+++ branches/clebert_temp_expirement/tests/src/org/jboss/messaging/tests/integration/journal/JournalCompactTest.java 2009-06-29 14:55:19 UTC (rev 7495)
@@ -64,34 +64,37 @@
public void testCompactwithPendingCommit() throws Exception
{
+ InternalCompactTest(false, false, false, true);
}
public void testCompactwithConcurrentUpdateAndDeletes() throws Exception
{
- InternalCompactTest(false, true, true);
+ InternalCompactTest(false, true, true, true);
}
public void testCompactwithConcurrentDeletes() throws Exception
{
- InternalCompactTest(false, false, true);
+ InternalCompactTest(false, false, true, true);
}
public void testCompactwithConcurrentUpdates() throws Exception
{
- InternalCompactTest(false, true, false);
+ InternalCompactTest(false, true, false, true);
}
public void testCompactWithConcurrentAppend() throws Exception
{
- InternalCompactTest(true, false, false);
+ InternalCompactTest(true, false, false, true);
}
- private void InternalCompactTest(final boolean performAppend, final boolean performUpdate, final boolean performDelete) throws Exception
+ private void InternalCompactTest(final boolean performAppend, final boolean performUpdate, final boolean performDelete, final boolean pendingTransactions) throws Exception
{
setup(50, 60 * 1024, true);
ArrayList<Long> liveIDs = new ArrayList<Long>();
+
+ ArrayList<Long> listPendingTransactions = new ArrayList<Long>();
final CountDownLatch latchDone = new CountDownLatch(1);
final CountDownLatch latchWait = new CountDownLatch(1);
@@ -140,6 +143,16 @@
commit(transactionID++);
update(i);
}
+
+ if (pendingTransactions)
+ {
+ for (long i = 0; i < 100 ; i++)
+ {
+ addTx(transactionID, idGenerator.generateID());
+ updateTx(transactionID, idGenerator.generateID());
+ listPendingTransactions.add(transactionID++);
+ }
+ }
System.out.println("Number of Files: " + journal.getDataFilesCount());
@@ -206,6 +219,21 @@
delete(liveID);
}
}
+
+ if (pendingTransactions)
+ {
+ for (long tx : listPendingTransactions)
+ {
+ if (tx % 2 == 0)
+ {
+ commit(tx);
+ }
+ else
+ {
+ rollback(tx);
+ }
+ }
+ }
/** Some independent adds and updates */
for (int i = 0; i < 1000; i++)
@@ -357,18 +385,13 @@
file.mkdir();
}
- protected SequentialFileFactory createFactory()
- {
- return new NIOSequentialFileFactory(journalDir);
- }
-
/* (non-Javadoc)
* @see org.jboss.messaging.tests.unit.core.journal.impl.JournalImplTestBase#getFileFactory()
*/
@Override
protected SequentialFileFactory getFileFactory() throws Exception
{
- return createFactory();
+ return new NIOSequentialFileFactory(journalDir);
}
}
More information about the jboss-cvs-commits
mailing list