[jboss-cvs] JBoss Messaging SVN: r5186 - in branches/Branch_Chunk_CRS2: tests/src/org/jboss/messaging/tests/integration/chunkmessage and 3 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Oct 27 18:08:35 EDT 2008
Author: clebert.suconic at jboss.com
Date: 2008-10-27 18:08:35 -0400 (Mon, 27 Oct 2008)
New Revision: 5186
Added:
branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/stress/chunk/
branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/stress/chunk/MessageChunkStressTest.java
Removed:
branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/soak/chunk/
Modified:
branches/Branch_Chunk_CRS2/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
Log:
Cleanup temporary aborted files during restart
Modified: branches/Branch_Chunk_CRS2/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Branch_Chunk_CRS2/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-10-27 21:12:24 UTC (rev 5185)
+++ branches/Branch_Chunk_CRS2/src/main/org/jboss/messaging/core/persistence/impl/journal/JournalStorageManager.java 2008-10-27 22:08:35 UTC (rev 5186)
@@ -29,7 +29,6 @@
import java.io.File;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -82,16 +81,6 @@
import org.jboss.messaging.util.SimpleString;
import org.jboss.messaging.util.TimeAndCounterIDGenerator;
-import javax.transaction.xa.Xid;
-import java.io.File;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicLong;
-
/**
*
* A JournalStorageManager
@@ -688,6 +677,8 @@
{
return;
}
+
+ cleanupIncompleteFiles();
bindingsJournal.start();
@@ -956,6 +947,20 @@
}
}
+ /**
+ * @throws Exception
+ */
+ private void cleanupIncompleteFiles() throws Exception
+ {
+ List<String> tmpFiles = this.largeMessagesFactory.listFiles("tmp");
+ for (String tmpFile: tmpFiles)
+ {
+ SequentialFile file = largeMessagesFactory.createSequentialFile(tmpFile, -1);
+ System.out.println("cleaning up file " + file);
+ file.delete();
+ }
+ }
+
// Inner Classes
// ----------------------------------------------------------------------------
Modified: branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java
===================================================================
--- branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2008-10-27 21:12:24 UTC (rev 5185)
+++ branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/integration/chunkmessage/MessageChunkTest.java 2008-10-27 22:08:35 UTC (rev 5186)
@@ -86,11 +86,36 @@
{
clearData();
- File file = createLargeFile("test.tst", 13333);
+ File file = createLargeFile(temporaryDir, "test.tst", 13333);
checkFileRead(file, 13333);
}
+ public void testCleanup() throws Exception
+ {
+ clearData();
+
+ createLargeFile(largeMessagesDir, "1234.tmp", 13333);
+
+ Configuration config = createDefaultConfig();
+
+ messagingService = createService(true, config, new HashMap<String, QueueSettings>());
+
+ messagingService.start();
+
+ try
+ {
+
+ File directoryLarge = new File(largeMessagesDir);
+
+ assertEquals(0, directoryLarge.list().length);
+ }
+ finally
+ {
+ messagingService.stop();
+ }
+ }
+
public void testFailureOnSendingFile() throws Exception
{
clearData();
@@ -536,7 +561,7 @@
if (useFile)
{
- File tmpData = createLargeFile("someFile.dat", numberOfIntegers);
+ File tmpData = createLargeFile(temporaryDir, "someFile.dat", numberOfIntegers);
for (int i = 0; i < numberOfMessages; i++)
{
@@ -671,7 +696,7 @@
FileClientMessage clientMessage = session.createFileMessage(true);
- File tmpFile = createLargeFile("tmpUpload.data", numberOfIntegers);
+ File tmpFile = createLargeFile(temporaryDir, "tmpUpload.data", numberOfIntegers);
clientMessage.setFile(tmpFile);
@@ -685,9 +710,9 @@
* @throws FileNotFoundException
* @throws IOException
*/
- protected File createLargeFile(String name, final int numberOfIntegers) throws FileNotFoundException, IOException
+ protected File createLargeFile(String directory, String name, final int numberOfIntegers) throws FileNotFoundException, IOException
{
- File tmpFile = new File(temporaryDir + "/" + name);
+ File tmpFile = new File(directory + "/" + name);
log.info("Creating file " + tmpFile);
Added: branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/stress/chunk/MessageChunkStressTest.java
===================================================================
--- branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/stress/chunk/MessageChunkStressTest.java (rev 0)
+++ branches/Branch_Chunk_CRS2/tests/src/org/jboss/messaging/tests/stress/chunk/MessageChunkStressTest.java 2008-10-27 22:08:35 UTC (rev 5186)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.stress.chunk;
+
+import org.jboss.messaging.tests.integration.chunkmessage.MessageChunkTest;
+
+/**
+ * A MessageChunkStressTest
+ *
+ * @author <a href="mailto:clebert.suconic at jboss.org">Clebert Suconic</a>
+ *
+ * Created Oct 27, 2008 5:07:05 PM
+ *
+ *
+ */
+public class MessageChunkStressTest extends MessageChunkTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testMessageChunkFilePersistence1G() throws Exception
+ {
+ testInternal(true, true, 2, 268435456, false, 0);
+ }
+
+ @Override
+ public void testMessageChunkFilePersistence100M() throws Exception
+ {
+ testInternal(true, true, 10, 26214400, false, 0);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
More information about the jboss-cvs-commits
mailing list