[jboss-cvs] JBoss Messaging SVN: r6139 - in trunk/tests/src/org/jboss/messaging/tests: unit/core/persistence/impl/journal and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Mar 23 07:32:28 EDT 2009


Author: ataylor
Date: 2009-03-23 07:32:28 -0400 (Mon, 23 Mar 2009)
New Revision: 6139

Modified:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java
   trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
removed easymock from testbase

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java	2009-03-23 10:46:23 UTC (rev 6138)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/journal/impl/EasyMockJournalTest.java	2009-03-23 11:32:28 UTC (rev 6139)
@@ -22,11 +22,9 @@
 
 package org.jboss.messaging.tests.unit.core.journal.impl;
 
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
+import org.easymock.IArgumentMatcher;
 import org.jboss.messaging.core.journal.BufferCallback;
 import org.jboss.messaging.core.journal.SequentialFile;
 import org.jboss.messaging.core.journal.SequentialFileFactory;
@@ -35,6 +33,9 @@
 import org.jboss.messaging.tests.unit.core.journal.impl.fakes.SimpleEncoding;
 import org.jboss.messaging.tests.util.UnitTestCase;
 
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
 public class EasyMockJournalTest extends UnitTestCase
 {
 
@@ -416,7 +417,46 @@
 
       return journalImpl;
    }
+   protected ByteBuffer compareByteBuffer(final byte expectedArray[])
+      {
 
+         EasyMock.reportMatcher(new IArgumentMatcher()
+         {
+
+            public void appendTo(StringBuffer buffer)
+            {
+               buffer.append("ByteArray");
+            }
+
+            public boolean matches(Object argument)
+            {
+               ByteBuffer buffer = (ByteBuffer)argument;
+
+               buffer.rewind();
+               byte[] compareArray = new byte[buffer.limit()];
+               buffer.get(compareArray);
+
+               if (compareArray.length != expectedArray.length)
+               {
+                  return false;
+               }
+
+               for (int i = 0; i < expectedArray.length; i++)
+               {
+                  if (expectedArray[i] != compareArray[i])
+                  {
+                     return false;
+                  }
+               }
+
+               return true;
+            }
+
+         });
+
+         return null;
+      }
+       
    private void stubValues() throws Exception
    {
       EasyMock.expect(mockFactory.getAlignment()).andStubReturn(1);

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java	2009-03-23 10:46:23 UTC (rev 6138)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/persistence/impl/journal/JournalStorageManagerTest.java	2009-03-23 11:32:28 UTC (rev 6139)
@@ -21,12 +21,6 @@
  */
 package org.jboss.messaging.tests.unit.core.persistence.impl.journal;
 
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.util.List;
-
-import javax.transaction.xa.Xid;
-
 import org.easymock.EasyMock;
 import org.easymock.IAnswer;
 import org.easymock.IArgumentMatcher;
@@ -48,6 +42,11 @@
 import org.jboss.messaging.tests.util.UnitTestCase;
 import org.jboss.messaging.utils.SimpleString;
 
+import javax.transaction.xa.Xid;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.util.List;
+
 /**
  * 
  * A JournalStorageManagerTest
@@ -238,6 +237,50 @@
       EasyMock.verify(messageJournal, bindingsJournal, ref, msg, queue);
    }
 
+    protected EncodingSupport compareEncodingSupport(final byte expectedArray[])
+   {
+
+      EasyMock.reportMatcher(new IArgumentMatcher()
+      {
+
+         public void appendTo(StringBuffer buffer)
+         {
+            buffer.append("EncodingSupport buffer didn't match");
+         }
+
+         public boolean matches(Object argument)
+         {
+            EncodingSupport encoding = (EncodingSupport)argument;
+
+            final int size = encoding.getEncodeSize();
+
+            if (size != expectedArray.length)
+            {
+               System.out.println(size + " != " + expectedArray.length);
+               return false;
+            }
+
+            final byte[] compareArray = new byte[size];
+
+            MessagingBuffer buffer = ChannelBuffers.wrappedBuffer(compareArray);
+            buffer.clear();
+            encoding.encode(buffer);
+
+            for (int i = 0; i < expectedArray.length; i++)
+            {
+               if (expectedArray[i] != compareArray[i])
+               {
+                  return false;
+               }
+            }
+
+            return true;
+         }
+
+      });
+
+      return null;
+   }
 //   public void testLoadMessages() throws Exception
 //   {
 //      Journal messageJournal = EasyMock.createStrictMock(Journal.class);

Modified: trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2009-03-23 10:46:23 UTC (rev 6138)
+++ trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2009-03-23 11:32:28 UTC (rev 6139)
@@ -22,35 +22,12 @@
 
 package org.jboss.messaging.tests.util;
 
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.transaction.xa.Xid;
-
 import junit.framework.TestCase;
-
-import org.easymock.EasyMock;
-import org.easymock.IArgumentMatcher;
 import org.jboss.messaging.core.buffers.ChannelBuffers;
 import org.jboss.messaging.core.client.ClientMessage;
 import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.exception.MessagingException;
-import org.jboss.messaging.core.journal.EncodingSupport;
 import org.jboss.messaging.core.logging.Logger;
 import org.jboss.messaging.core.remoting.impl.invm.InVMRegistry;
-import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
 import org.jboss.messaging.core.server.MessageReference;
 import org.jboss.messaging.core.server.Queue;
 import org.jboss.messaging.core.server.ServerMessage;
@@ -60,6 +37,22 @@
 import org.jboss.messaging.utils.SimpleString;
 import org.jboss.messaging.utils.UUIDGenerator;
 
+import javax.transaction.xa.Xid;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
 /**
  *
  * Helper base class for our unit tests
@@ -201,28 +194,6 @@
       }
    }
 
-   public static MessagingException messagingExceptionMatch(final int errorID)
-   {
-      EasyMock.reportMatcher(new IArgumentMatcher()
-      {
-
-         public void appendTo(StringBuffer buffer)
-         {
-            buffer.append(errorID);
-         }
-
-         public boolean matches(Object argument)
-         {
-            MessagingException ex = (MessagingException)argument;
-
-            return ex.getCode() == errorID;
-         }
-
-      });
-
-      return null;
-   }
-
    // Constructors --------------------------------------------------
 
    // Protected -----------------------------------------------------
@@ -452,91 +423,9 @@
       return buffer.array();
    }
 
-   protected ByteBuffer compareByteBuffer(final byte expectedArray[])
-   {
+   
 
-      EasyMock.reportMatcher(new IArgumentMatcher()
-      {
 
-         public void appendTo(StringBuffer buffer)
-         {
-            buffer.append("ByteArray");
-         }
-
-         public boolean matches(Object argument)
-         {
-            ByteBuffer buffer = (ByteBuffer)argument;
-
-            buffer.rewind();
-            byte[] compareArray = new byte[buffer.limit()];
-            buffer.get(compareArray);
-
-            if (compareArray.length != expectedArray.length)
-            {
-               return false;
-            }
-
-            for (int i = 0; i < expectedArray.length; i++)
-            {
-               if (expectedArray[i] != compareArray[i])
-               {
-                  return false;
-               }
-            }
-
-            return true;
-         }
-
-      });
-
-      return null;
-   }
-
-   protected EncodingSupport compareEncodingSupport(final byte expectedArray[])
-   {
-
-      EasyMock.reportMatcher(new IArgumentMatcher()
-      {
-
-         public void appendTo(StringBuffer buffer)
-         {
-            buffer.append("EncodingSupport buffer didn't match");
-         }
-
-         public boolean matches(Object argument)
-         {
-            EncodingSupport encoding = (EncodingSupport)argument;
-
-            final int size = encoding.getEncodeSize();
-
-            if (size != expectedArray.length)
-            {
-               System.out.println(size + " != " + expectedArray.length);
-               return false;
-            }
-
-            final byte[] compareArray = new byte[size];
-
-            MessagingBuffer buffer = ChannelBuffers.wrappedBuffer(compareArray);
-            buffer.clear();
-            encoding.encode(buffer);
-
-            for (int i = 0; i < expectedArray.length; i++)
-            {
-               if (expectedArray[i] != compareArray[i])
-               {
-                  return false;
-               }
-            }
-
-            return true;
-         }
-
-      });
-
-      return null;
-   }
-
    protected boolean deleteDirectory(File directory)
    {
       if (directory.isDirectory())




More information about the jboss-cvs-commits mailing list