[jboss-cvs] JBoss Messaging SVN: r4554 - in trunk/tests/src/org/jboss/messaging/tests: unit/core/util and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 23 09:28:30 EDT 2008


Author: jmesnil
Date: 2008-06-23 09:28:30 -0400 (Mon, 23 Jun 2008)
New Revision: 4554

Added:
   trunk/tests/src/org/jboss/messaging/tests/unit/core/util/MessagingBufferTestBase.java
Removed:
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/MessagingBufferTestBase.java
Modified:
   trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/IoBufferWrapperTest.java
   trunk/tests/src/org/jboss/messaging/tests/unit/core/util/ByteBufferWrapperTest.java
Log:
moved MessagingBufferTestBase to o.j.m.tests.unit.core.util

Modified: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/IoBufferWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/IoBufferWrapperTest.java	2008-06-23 13:10:38 UTC (rev 4553)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/IoBufferWrapperTest.java	2008-06-23 13:28:30 UTC (rev 4554)
@@ -24,6 +24,7 @@
 
 import org.apache.mina.common.IoBuffer;
 import org.jboss.messaging.core.remoting.impl.mina.IoBufferWrapper;
+import org.jboss.messaging.tests.unit.core.util.MessagingBufferTestBase;
 import org.jboss.messaging.util.MessagingBuffer;
 
 /**

Deleted: trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/MessagingBufferTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/MessagingBufferTestBase.java	2008-06-23 13:10:38 UTC (rev 4553)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/MessagingBufferTestBase.java	2008-06-23 13:28:30 UTC (rev 4554)
@@ -1,267 +0,0 @@
-/*
- * 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.integration.core.remoting.mina;
-
-import static org.jboss.messaging.tests.util.RandomUtil.randomByte;
-import static org.jboss.messaging.tests.util.RandomUtil.randomBytes;
-import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
-import static org.jboss.messaging.tests.util.RandomUtil.randomFloat;
-import static org.jboss.messaging.tests.util.RandomUtil.randomInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-import static org.jboss.messaging.tests.util.UnitTestCase.assertEqualsByteArrays;
-import junit.framework.TestCase;
-
-import org.jboss.messaging.tests.util.RandomUtil;
-import org.jboss.messaging.util.MessagingBuffer;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
- * 
- * @version <tt>$Revision$</tt>
- */
-public abstract class MessagingBufferTestBase extends TestCase
-{
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   // Static --------------------------------------------------------
-
-   // Constructors --------------------------------------------------
-
-   // Public --------------------------------------------------------
-
-   private MessagingBuffer wrapper;
-
-   @Override
-   protected void setUp() throws Exception
-   {
-      wrapper = createBuffer();
-   }
-
-   @Override
-   protected void tearDown() throws Exception
-   {
-      wrapper = null;
-   }
-
-   protected abstract MessagingBuffer createBuffer();
-
-   public void testNullString() throws Exception
-   {
-      assertNull(putAndGetNullableString(null));
-   }
-   
-   public void testEmptyString() throws Exception
-   {
-      String result = putAndGetNullableString("");
-
-      assertNotNull(result);
-      assertEquals("", result);
-   }
-
-   public void testNonEmptyString() throws Exception
-   {
-      String junk = randomString();
-      
-      String result = putAndGetNullableString(junk);
-
-      assertNotNull(result);
-      assertEquals(junk, result);
-   }
-
-   public void testNullSimpleString() throws Exception
-   {
-      assertNull(putAndGetNullableSimpleString(null));
-   }
-   
-   public void testEmptySimpleString() throws Exception
-   {
-      SimpleString emptySimpleString = new SimpleString("");
-      SimpleString result = putAndGetNullableSimpleString(emptySimpleString);
-
-      assertNotNull(result);
-      assertEqualsByteArrays(emptySimpleString.getData(), result.getData());
-   }
-
-   public void testNonEmptySimpleString() throws Exception
-   {
-      SimpleString junk = RandomUtil.randomSimpleString();
-      SimpleString result = putAndGetNullableSimpleString(junk);
-
-      assertNotNull(result);
-      assertEqualsByteArrays(junk.getData(), result.getData());
-   }
-
-   public void testByte() throws Exception
-   {
-      byte b = randomByte();
-      wrapper.putByte(b);
-      
-      wrapper.flip();
-      
-      assertEquals(b, wrapper.getByte());
-   }
-   
-   public void testBytes() throws Exception
-   {
-      byte[] bytes = randomBytes();
-      wrapper.putBytes(bytes);
-      
-      wrapper.flip();
-      
-      byte[] b = new byte[bytes.length];
-      wrapper.getBytes(b);
-      assertEqualsByteArrays(bytes, b);
-   }
-
-   public void testPutTrueBoolean() throws Exception
-   {
-      wrapper.putBoolean(true);
-      
-      wrapper.flip();
-      
-      assertTrue(wrapper.getBoolean());
-   }
-
-   public void testPutFalseBoolean() throws Exception
-   {
-      wrapper.putBoolean(false);
-      
-      wrapper.flip();
-      
-      assertFalse(wrapper.getBoolean());
-   }
-      
-   public void testChar() throws Exception
-   {
-      wrapper.putChar('a');
-      
-      wrapper.flip();
-      
-      assertEquals('a', wrapper.getChar());
-   }
-   
-   public void testInt() throws Exception
-   {
-      int i = randomInt();
-      wrapper.putInt(i);
-      
-      wrapper.flip();
-      
-      assertEquals(i, wrapper.getInt());
-   }
-   
-   public void testIntAtPosition() throws Exception
-   {
-      int firstInt = randomInt();
-      int secondInt = randomInt();
-      
-      wrapper.putInt(secondInt);
-      wrapper.putInt(secondInt);
-      // rewrite firstInt at the beginning
-      wrapper.putInt(0, firstInt);
-
-      wrapper.flip();
-      
-      assertEquals(firstInt, wrapper.getInt());
-      assertEquals(secondInt, wrapper.getInt());
-   }
-   
-   public void testLong() throws Exception
-   {
-      long l = randomLong();
-      wrapper.putLong(l);
-      
-      wrapper.flip();
-      
-      assertEquals(l, wrapper.getLong());
-   }
-   
-   public void testShort() throws Exception
-   {
-      wrapper.putShort((short) 1);
-      
-      wrapper.flip();
-      
-      assertEquals((short)1, wrapper.getShort());
-   }
-      
-   public void testDouble() throws Exception
-   {
-      double d = randomDouble();
-      wrapper.putDouble(d);
-      
-      wrapper.flip();
-      
-      assertEquals(d, wrapper.getDouble());
-   }
-   
-   public void testFloat() throws Exception
-   {
-      float f = randomFloat();
-      wrapper.putFloat(f);
-      
-      wrapper.flip();
-      
-      assertEquals(f, wrapper.getFloat());
-   }
-   
-   public void testUTF() throws Exception
-   {
-      String str = randomString();
-      wrapper.putUTF(str);
-      
-      wrapper.flip();
-      
-      assertEquals(str, wrapper.getUTF());
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   private String putAndGetNullableString(String nullableString) throws Exception
-   {
-      wrapper.putNullableString(nullableString);
-
-      wrapper.flip();
-      
-      return wrapper.getNullableString();
-   }
-   
-   private SimpleString putAndGetNullableSimpleString(SimpleString nullableSimpleString) throws Exception
-   {
-      wrapper.putNullableSimpleString(nullableSimpleString);
-
-      wrapper.flip();
-      
-      return wrapper.getNullableSimpleString();
-   }
-   
-   // Inner classes -------------------------------------------------
-}

Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/util/ByteBufferWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/util/ByteBufferWrapperTest.java	2008-06-23 13:10:38 UTC (rev 4553)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/util/ByteBufferWrapperTest.java	2008-06-23 13:28:30 UTC (rev 4554)
@@ -24,7 +24,6 @@
 
 import java.nio.ByteBuffer;
 
-import org.jboss.messaging.tests.integration.core.remoting.mina.MessagingBufferTestBase;
 import org.jboss.messaging.util.ByteBufferWrapper;
 import org.jboss.messaging.util.MessagingBuffer;
 

Copied: trunk/tests/src/org/jboss/messaging/tests/unit/core/util/MessagingBufferTestBase.java (from rev 4547, trunk/tests/src/org/jboss/messaging/tests/integration/core/remoting/mina/MessagingBufferTestBase.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/util/MessagingBufferTestBase.java	                        (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/util/MessagingBufferTestBase.java	2008-06-23 13:28:30 UTC (rev 4554)
@@ -0,0 +1,267 @@
+/*
+ * 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.unit.core.util;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomByte;
+import static org.jboss.messaging.tests.util.RandomUtil.randomBytes;
+import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
+import static org.jboss.messaging.tests.util.RandomUtil.randomFloat;
+import static org.jboss.messaging.tests.util.RandomUtil.randomInt;
+import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+import static org.jboss.messaging.tests.util.UnitTestCase.assertEqualsByteArrays;
+import junit.framework.TestCase;
+
+import org.jboss.messaging.tests.util.RandomUtil;
+import org.jboss.messaging.util.MessagingBuffer;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>.
+ * 
+ * @version <tt>$Revision$</tt>
+ */
+public abstract class MessagingBufferTestBase extends TestCase
+{
+   // Constants -----------------------------------------------------
+
+   // Attributes ----------------------------------------------------
+
+   // Static --------------------------------------------------------
+
+   // Constructors --------------------------------------------------
+
+   // Public --------------------------------------------------------
+
+   private MessagingBuffer wrapper;
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      wrapper = createBuffer();
+   }
+
+   @Override
+   protected void tearDown() throws Exception
+   {
+      wrapper = null;
+   }
+
+   protected abstract MessagingBuffer createBuffer();
+
+   public void testNullString() throws Exception
+   {
+      assertNull(putAndGetNullableString(null));
+   }
+   
+   public void testEmptyString() throws Exception
+   {
+      String result = putAndGetNullableString("");
+
+      assertNotNull(result);
+      assertEquals("", result);
+   }
+
+   public void testNonEmptyString() throws Exception
+   {
+      String junk = randomString();
+      
+      String result = putAndGetNullableString(junk);
+
+      assertNotNull(result);
+      assertEquals(junk, result);
+   }
+
+   public void testNullSimpleString() throws Exception
+   {
+      assertNull(putAndGetNullableSimpleString(null));
+   }
+   
+   public void testEmptySimpleString() throws Exception
+   {
+      SimpleString emptySimpleString = new SimpleString("");
+      SimpleString result = putAndGetNullableSimpleString(emptySimpleString);
+
+      assertNotNull(result);
+      assertEqualsByteArrays(emptySimpleString.getData(), result.getData());
+   }
+
+   public void testNonEmptySimpleString() throws Exception
+   {
+      SimpleString junk = RandomUtil.randomSimpleString();
+      SimpleString result = putAndGetNullableSimpleString(junk);
+
+      assertNotNull(result);
+      assertEqualsByteArrays(junk.getData(), result.getData());
+   }
+
+   public void testByte() throws Exception
+   {
+      byte b = randomByte();
+      wrapper.putByte(b);
+      
+      wrapper.flip();
+      
+      assertEquals(b, wrapper.getByte());
+   }
+   
+   public void testBytes() throws Exception
+   {
+      byte[] bytes = randomBytes();
+      wrapper.putBytes(bytes);
+      
+      wrapper.flip();
+      
+      byte[] b = new byte[bytes.length];
+      wrapper.getBytes(b);
+      assertEqualsByteArrays(bytes, b);
+   }
+
+   public void testPutTrueBoolean() throws Exception
+   {
+      wrapper.putBoolean(true);
+      
+      wrapper.flip();
+      
+      assertTrue(wrapper.getBoolean());
+   }
+
+   public void testPutFalseBoolean() throws Exception
+   {
+      wrapper.putBoolean(false);
+      
+      wrapper.flip();
+      
+      assertFalse(wrapper.getBoolean());
+   }
+      
+   public void testChar() throws Exception
+   {
+      wrapper.putChar('a');
+      
+      wrapper.flip();
+      
+      assertEquals('a', wrapper.getChar());
+   }
+   
+   public void testInt() throws Exception
+   {
+      int i = randomInt();
+      wrapper.putInt(i);
+      
+      wrapper.flip();
+      
+      assertEquals(i, wrapper.getInt());
+   }
+   
+   public void testIntAtPosition() throws Exception
+   {
+      int firstInt = randomInt();
+      int secondInt = randomInt();
+      
+      wrapper.putInt(secondInt);
+      wrapper.putInt(secondInt);
+      // rewrite firstInt at the beginning
+      wrapper.putInt(0, firstInt);
+
+      wrapper.flip();
+      
+      assertEquals(firstInt, wrapper.getInt());
+      assertEquals(secondInt, wrapper.getInt());
+   }
+   
+   public void testLong() throws Exception
+   {
+      long l = randomLong();
+      wrapper.putLong(l);
+      
+      wrapper.flip();
+      
+      assertEquals(l, wrapper.getLong());
+   }
+   
+   public void testShort() throws Exception
+   {
+      wrapper.putShort((short) 1);
+      
+      wrapper.flip();
+      
+      assertEquals((short)1, wrapper.getShort());
+   }
+      
+   public void testDouble() throws Exception
+   {
+      double d = randomDouble();
+      wrapper.putDouble(d);
+      
+      wrapper.flip();
+      
+      assertEquals(d, wrapper.getDouble());
+   }
+   
+   public void testFloat() throws Exception
+   {
+      float f = randomFloat();
+      wrapper.putFloat(f);
+      
+      wrapper.flip();
+      
+      assertEquals(f, wrapper.getFloat());
+   }
+   
+   public void testUTF() throws Exception
+   {
+      String str = randomString();
+      wrapper.putUTF(str);
+      
+      wrapper.flip();
+      
+      assertEquals(str, wrapper.getUTF());
+   }
+
+   // Package protected ---------------------------------------------
+
+   // Protected -----------------------------------------------------
+
+   // Private -------------------------------------------------------
+
+   private String putAndGetNullableString(String nullableString) throws Exception
+   {
+      wrapper.putNullableString(nullableString);
+
+      wrapper.flip();
+      
+      return wrapper.getNullableString();
+   }
+   
+   private SimpleString putAndGetNullableSimpleString(SimpleString nullableSimpleString) throws Exception
+   {
+      wrapper.putNullableSimpleString(nullableSimpleString);
+
+      wrapper.flip();
+      
+      return wrapper.getNullableSimpleString();
+   }
+   
+   // Inner classes -------------------------------------------------
+}




More information about the jboss-cvs-commits mailing list