[hornetq-commits] JBoss hornetq SVN: r7836 - in trunk: native/bin and 3 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Thu Aug 20 12:45:14 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-08-20 12:45:14 -0400 (Thu, 20 Aug 2009)
New Revision: 7836

Added:
   trunk/native/bin/libHornetQAIO32.so
   trunk/native/bin/libHornetQAIO64.so
Removed:
   trunk/native/bin/libHornetQnative32.so
   trunk/native/bin/libHornetQnative64.so
Modified:
   trunk/docs/user-manual/en/appserver-integration.xml
   trunk/docs/user-manual/en/libaio.xml
   trunk/src/main/org/hornetq/core/asyncio/impl/AsynchronousFileImpl.java
   trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java
   trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
A few tweaks + renaming native libraries

Modified: trunk/docs/user-manual/en/appserver-integration.xml
===================================================================
--- trunk/docs/user-manual/en/appserver-integration.xml	2009-08-20 16:43:27 UTC (rev 7835)
+++ trunk/docs/user-manual/en/appserver-integration.xml	2009-08-20 16:45:14 UTC (rev 7836)
@@ -1,25 +1,23 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <chapter id="appserver-integration">
     <title>Application Server Integration and Java EE</title>
-    <para>HornetQ can be easily installed in JBoss Application Server 5.1 or later. For
-        details on installing HornetQ in the JBoss Application Server refer to quick-start
-        guide.</para>
-    <para>Since HornetQ also provides a JCA adaptor, it should also be possible to integrate
-        HornetQ as a JMS provider in other JEE compliant app servers. For instructions on
-        how to integrate a remote JCA adaptor into another application sever, please consult that
-        application server's instructions.</para>
+    <para>HornetQ can be easily installed in JBoss Application Server 5.1 or later. For details on
+        installing HornetQ in the JBoss Application Server refer to quick-start guide.</para>
+    <para>Since HornetQ also provides a JCA adaptor, it should also be possible to integrate HornetQ
+        as a JMS provider in other JEE compliant app servers. For instructions on how to integrate a
+        remote JCA adaptor into another application sever, please consult that application server's
+        instructions.</para>
     <para>A JCA Adapter basically controls the incoming of messages to Message Driven Beans and the
         outgoing of messages from other JEE components.</para>
     <para>This section explains the basics behind configuring the different JEE components in the
         AS.</para>
     <section>
         <title>Configuring Message Driven Beans</title>
-        <para>The delivery of messages to an MDB using HornetQ is configured on the JCA
-            Adapter via a configuration file <literal>ra.xml</literal> which can be found under in
-            the <literal>jms-ra.rar</literal> archive of directory. By default this is configured to
-            consume messages using an InVM connector from the instance of HornetQ running
-            within the application server. A full list of what is configurable is found later in
-            this chapter. </para>
+        <para>The delivery of messages to an MDB using HornetQ is configured on the JCA Adapter via
+            a configuration file <literal>ra.xml</literal> which can be found under in the <literal
+                >jms-ra.rar</literal> archive of directory. By default this is configured to consume
+            messages using an InVM connector from the instance of HornetQ running within the
+            application server. A full list of what is configurable is found later in this chapter. </para>
         <para>All MDB's however need to have the destination type and the destination configured.
             The following example shows how this can be done via annotations.</para>
         <programlisting>@MessageDriven(name = "MDBExample",
@@ -244,7 +242,7 @@
             configuration of the Adapter is found in this archive under <literal
                 >META-INF/ra.xml</literal>.</para>
         <para>The configuration will look something like the following:</para>
-        <programlisting><![CDATA[<![CDATA[<![CDATA[<![CDATA[<![CDATA[&lt;resourceadapter>
+        <programlisting>&lt;resourceadapter>
       &lt;resourceadapter-class>org.hornetq.ra.HornetQResourceAdapter&lt;/resourceadapter-class>
       &lt;config-property>
          &lt;description>The transport type&lt;/description>
@@ -312,7 +310,7 @@
          &lt;/messageadapter>
       &lt;/inbound-resourceadapter>
 
-   &lt;/resourceadapter>]]>]]>]]>]]>]]></programlisting>
+   &lt;/resourceadapter></programlisting>
         <para>There are 3 main parts to this configuration.</para>
         <orderedlist>
             <listitem>
@@ -616,13 +614,13 @@
         <para>A bridge is deployed inside a JBoss AS instance. The instance can be the same instance
             as either the source or target server. Or could be on a third, separate JBoss AS
             instance.</para>
-        <para>The bridge can also be used to bridge messages from other non HornetQ JMS
-            servers, as long as they are JMS 1.1 compliant.<note>
+        <para>The bridge can also be used to bridge messages from other non HornetQ JMS servers, as
+            long as they are JMS 1.1 compliant.<note>
                 <para>Don't confuse a JMS bridge with a core bridge. A JMS bridge can be used to
                     bridge any two JMS 1.1 compliant JMS providers and uses the JMS API. A core
                     bridge (described in <xref linkend="core-bridges"/>) is used to bridge any two
-                    HornetQ instances and uses the core API. Always use a core bridge if you
-                    can in preference to a JMS bridge. The core bridge will typically provide better
+                    HornetQ instances and uses the core API. Always use a core bridge if you can in
+                    preference to a JMS bridge. The core bridge will typically provide better
                     performance than a JMS bridge. Also the core bridge can provide <emphasis>once
                         and only once</emphasis> delivery guarantees without using XA.</para>
             </note></para>
@@ -899,8 +897,8 @@
                     <para>Add MessageID In Header</para>
                     <para>If <literal>true</literal>, then the original message's message ID will be
                         appended in the message sent to the destination in the header <literal
-                            >HORNETQ_BRIDGE_MSG_ID_LIST</literal>. If the message is bridged more than
-                        once, each message ID will be appended. This enables a distributed
+                            >HORNETQ_BRIDGE_MSG_ID_LIST</literal>. If the message is bridged more
+                        than once, each message ID will be appended. This enables a distributed
                         request-response pattern to be used</para>
                     <note>
                         <para>when you receive the message you can send back a response using the
@@ -956,8 +954,8 @@
                 <title>ONCE_AND_ONLY_ONCE</title>
                 <para>This QoS mode ensures messages will reach the destination from the source once
                     and only once. (Sometimes this mode is known as "exactly once"). If both the
-                    source and the destination are on the same HornetQ server instance then
-                    this can be achieved by sending and acknowledging the messages in the same local
+                    source and the destination are on the same HornetQ server instance then this can
+                    be achieved by sending and acknowledging the messages in the same local
                     transaction. If the source and destination are on different servers this is
                     achieved by enlisting the sending and consuming sessions in a JTA transaction.
                     The JTA transaction is controlled by JBoss Transactions JTA * implementation
@@ -995,17 +993,17 @@
             or lose network connectivity. For more information on XA Recovery,please refer to <ulink
                 url="http://www.jboss.org/community/wiki/JBossTransactions">JBoss
                 Transactions</ulink>.</para>
-        <para>When HornetQ is integrated with JBoss AS, it can take advantage of JBoss
-            Transactions to provide recovery of messaging resources. If messages are involved in a
-            XA transaction, in the event of a server crash, the recovery manager will ensure that
-            the transactions are recovered and the messages will either be committed or rolled back
+        <para>When HornetQ is integrated with JBoss AS, it can take advantage of JBoss Transactions
+            to provide recovery of messaging resources. If messages are involved in a XA
+            transaction, in the event of a server crash, the recovery manager will ensure that the
+            transactions are recovered and the messages will either be committed or rolled back
             (depending on the transaction outcome) when the server is restarted.</para>
         <section>
             <title>XA Recovery Configuration</title>
-            <para>To enable HornetQs XA Recovery, the Recovery Manager must be configured to
-                connect to HornetQ to recover its resources. The following property must be
-                added to the <literal>jta</literal> section of <literal
-                    >conf/jbossts-properties.xml</literal> of JBoss AS profiles:</para>
+            <para>To enable HornetQs XA Recovery, the Recovery Manager must be configured to connect
+                to HornetQ to recover its resources. The following property must be added to the
+                    <literal>jta</literal> section of <literal>conf/jbossts-properties.xml</literal>
+                of JBoss AS profiles:</para>
             <programlisting>
 &lt;properties depends="arjuna" name="jta"&gt;
    ...
@@ -1015,15 +1013,15 @@
 &lt;/properties&gt;
             </programlisting>
             <para>The <literal>[connection configuration]</literal> contains all the information
-                required to connect to HornetQ node under the form <literal>[connector
-                    factory class name],[user name], [password], [connector parameters]</literal>. </para>
+                required to connect to HornetQ node under the form <literal>[connector factory class
+                    name],[user name], [password], [connector parameters]</literal>. </para>
             <itemizedlist>
                 <listitem>
                     <para><literal>[connector factory class name]</literal> corresponds to the name
                         of the <literal>ConnectorFactory</literal> used to connect to JBoss
                         Messaging. Values can be <literal
-                            >org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</literal>
-                        or <literal
+                            >org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</literal> or
+                            <literal
                             >org.hornetq.integration.transports.netty.NettyConnectorFactory</literal></para>
                 </listitem>
                 <listitem>
@@ -1082,9 +1080,8 @@
                     &lt;property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
                            value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;org.hornetq.integration.transports.netty.NettyConnectorFactory, admin, adminpass, hornetq.remoting.netty.port=8888"/>        			                    
                 </programlisting>
-                <para>Configuring HornetQ with an invm acceptor and configuring the Recovery
-                    Manager with an invm connector is the recommended way to enable XA
-                    Recovery.</para>
+                <para>Configuring HornetQ with an invm acceptor and configuring the Recovery Manager
+                    with an invm connector is the recommended way to enable XA Recovery.</para>
             </section>
         </section>
         <section>

Modified: trunk/docs/user-manual/en/libaio.xml
===================================================================
--- trunk/docs/user-manual/en/libaio.xml	2009-08-20 16:43:27 UTC (rev 7835)
+++ trunk/docs/user-manual/en/libaio.xml	2009-08-20 16:45:14 UTC (rev 7836)
@@ -10,13 +10,13 @@
     <para>These are the native libraries distributed by HornetQ:</para>
     <itemizedlist>
         <listitem>
-            <para>libHornetQLibAIO32.so - x86 32 bits</para>
+            <para>libHornetQAIO32.so - x86 32 bits</para>
         </listitem>
         <listitem>
-            <para>libHornetQLibAIO64.so - x86 64 bits</para>
+            <para>libHornetQAIO64.so - x86 64 bits</para>
         </listitem>
         <listitem>
-            <para>libHornetQLibAIO_ia64.so - Itanium 64 bits</para>
+            <para>libHornetQAIO_ia64.so - Itanium 64 bits</para>
         </listitem>
     </itemizedlist>
     <para>When using libaio, HornetQ will aways try loading these files as long as they are

Copied: trunk/native/bin/libHornetQAIO32.so (from rev 7829, trunk/native/bin/libHornetQnative32.so)
===================================================================
(Binary files differ)

Copied: trunk/native/bin/libHornetQAIO64.so (from rev 7829, trunk/native/bin/libHornetQnative64.so)
===================================================================
(Binary files differ)

Deleted: trunk/native/bin/libHornetQnative32.so
===================================================================
(Binary files differ)

Deleted: trunk/native/bin/libHornetQnative64.so
===================================================================
(Binary files differ)

Modified: trunk/src/main/org/hornetq/core/asyncio/impl/AsynchronousFileImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/asyncio/impl/AsynchronousFileImpl.java	2009-08-20 16:43:27 UTC (rev 7835)
+++ trunk/src/main/org/hornetq/core/asyncio/impl/AsynchronousFileImpl.java	2009-08-20 16:45:14 UTC (rev 7836)
@@ -92,7 +92,7 @@
 
    static
    {
-      String libraries[] = new String[] { "HornetQnative", "HornetQnative64", "HornetQnative32", "HornetQnative_ia64" };
+      String libraries[] = new String[] { "HornetQAIO", "HornetQAIO64", "HornetQAIO32", "HornetQAIO_ia64" };
 
       for (String library : libraries)
       {

Modified: trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java	2009-08-20 16:43:27 UTC (rev 7835)
+++ trunk/tests/src/org/hornetq/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java	2009-08-20 16:45:14 UTC (rev 7836)
@@ -40,9 +40,6 @@
    {
       super.setUp();
       
-      //reset
-      AsynchronousFileImpl.resetMaxAIO();
-
       factory = createFactory();
    }
 
@@ -200,185 +197,199 @@
 
    }
    
-   // TODO: RE-ENABLE THIS
-//   public void testWriteandRead() throws Exception
-//   {
-//      SequentialFile sf = factory.createSequentialFile("write.hq", 1);
-//
-//      sf.open();
-//
-//      String s1 = "aardvark";
-//      byte[] bytes1 = s1.getBytes("UTF-8");
-//      ByteBuffer bb1 = factory.wrapBuffer(bytes1);
-//
-//      String s2 = "hippopotamus";
-//      byte[] bytes2 = s2.getBytes("UTF-8");
-//      ByteBuffer bb2 = factory.wrapBuffer(bytes2);
-//
-//      String s3 = "echidna";
-//      byte[] bytes3 = s3.getBytes("UTF-8");
-//      ByteBuffer bb3 = factory.wrapBuffer(bytes3);
-//
-//      int bytesWritten = sf.write(bb1, true);
-//
-//      assertEquals(calculateRecordSize(bytes1.length, sf.getAlignment()), bytesWritten);
-//
-//      bytesWritten = sf.write(bb2, true);
-//
-//      assertEquals(calculateRecordSize(bytes2.length, sf.getAlignment()), bytesWritten);
-//
-//      bytesWritten = sf.write(bb3, true);
-//
-//      assertEquals(calculateRecordSize(bytes3.length, sf.getAlignment()), bytesWritten);
-//
-//      sf.position(0);
-//
-//      ByteBuffer rb1 = factory.newBuffer(bytes1.length);
-//      ByteBuffer rb2 = factory.newBuffer(bytes2.length);
-//      ByteBuffer rb3 = factory.newBuffer(bytes3.length);
-//
-//      int bytesRead = sf.read(rb1);
-//      assertEquals(calculateRecordSize(bytes1.length, sf.getAlignment()), bytesRead);
-//
-//      for (int i = 0; i < bytes1.length; i++)
-//      {
-//         assertEquals(bytes1[i], rb1.get(i));
-//      }
-//
-//      bytesRead = sf.read(rb2);
-//      assertEquals(calculateRecordSize(bytes2.length, sf.getAlignment()), bytesRead);
-//      for (int i = 0; i < bytes2.length; i++)
-//      {
-//         assertEquals(bytes2[i], rb2.get(i));
-//      }
-//
-//      bytesRead = sf.read(rb3);
-//      assertEquals(calculateRecordSize(bytes3.length, sf.getAlignment()), bytesRead);
-//      for (int i = 0; i < bytes3.length; i++)
-//      {
-//         assertEquals(bytes3[i], rb3.get(i));
-//      }
-//
-//      sf.close();
-//
-//   }
-//
-//   public void testPosition() throws Exception
-//   {
-//      SequentialFile sf = factory.createSequentialFile("position.hq", 1);
-//
-//      sf.open();
-//
-//      try
-//      {
-//
-//         sf.fill(0, 3 * 512, (byte)0);
-//
-//         String s1 = "orange";
-//         byte[] bytes1 = s1.getBytes("UTF-8");
-//         ByteBuffer bb1 = factory.wrapBuffer(bytes1);
-//
-//         byte[] bytes2 = s1.getBytes("UTF-8");
-//         ByteBuffer bb2 = factory.wrapBuffer(bytes2);
-//
-//         String s3 = "lemon";
-//         byte[] bytes3 = s3.getBytes("UTF-8");
-//         ByteBuffer bb3 = factory.wrapBuffer(bytes3);
-//
-//         int bytesWritten = sf.write(bb1, true);
-//
-//         assertEquals(bb1.limit(), bytesWritten);
-//
-//         bytesWritten = sf.write(bb2, true);
-//
-//         assertEquals(bb2.limit(), bytesWritten);
-//
-//         bytesWritten = sf.write(bb3, true);
-//
-//         assertEquals(bb3.limit(), bytesWritten);
-//
-//         byte[] rbytes1 = new byte[bytes1.length];
-//
-//         byte[] rbytes2 = new byte[bytes2.length];
-//
-//         byte[] rbytes3 = new byte[bytes3.length];
-//
-//         ByteBuffer rb1 = factory.newBuffer(rbytes1.length);
-//         ByteBuffer rb2 = factory.newBuffer(rbytes2.length);
-//         ByteBuffer rb3 = factory.newBuffer(rbytes3.length);
-//
-//         sf.position(bb1.limit() + bb2.limit());
-//
-//         int bytesRead = sf.read(rb3);
-//         assertEquals(rb3.limit(), bytesRead);
-//         rb3.rewind();
-//         rb3.get(rbytes3);
-//         assertEqualsByteArrays(bytes3, rbytes3);
-//
-//         sf.position(rb1.limit());
-//
-//         bytesRead = sf.read(rb2);
-//         assertEquals(rb2.limit(), bytesRead);
-//         rb2.get(rbytes2);
-//         assertEqualsByteArrays(bytes2, rbytes2);
-//
-//         sf.position(0);
-//
-//         bytesRead = sf.read(rb1);
-//         assertEquals(rb1.limit(), bytesRead);
-//         rb1.get(rbytes1);
-//
-//         assertEqualsByteArrays(bytes1, rbytes1);
-//
-//      }
-//      finally
-//      {
-//         try
-//         {
-//            sf.close();
-//         }
-//         catch (Exception ignored)
-//         {
-//         }
-//      }
-//   }
-//
-//   public void testOpenClose() throws Exception
-//   {
-//      SequentialFile sf = factory.createSequentialFile("openclose.hq", 1);
-//
-//      sf.open();
-//
-//      sf.fill(0, 512, (byte)0);
-//
-//      String s1 = "cheesecake";
-//      byte[] bytes1 = s1.getBytes("UTF-8");
-//      ByteBuffer bb1 = factory.wrapBuffer(bytes1);
-//
-//      int bytesWritten = sf.write(bb1, true);
-//
-//      assertEquals(bb1.limit(), bytesWritten);
-//
-//      sf.close();
-//
-//      try
-//      {
-//         sf.write(bb1, true);
-//
-//         fail("Should throw exception");
-//      }
-//      catch (Exception e)
-//      {
-//         // OK
-//      }
-//
-//      sf.open();
-//
-//      sf.write(bb1, true);
-//
-//      sf.close();
-//   }
+   public void testWriteandRead() throws Exception
+   {
+      SequentialFile sf = factory.createSequentialFile("write.hq", 1);
 
+      sf.open();
+
+      String s1 = "aardvark";
+      byte[] bytes1 = s1.getBytes("UTF-8");
+      ByteBuffer bb1 = factory.wrapBuffer(bytes1);
+
+      String s2 = "hippopotamus";
+      byte[] bytes2 = s2.getBytes("UTF-8");
+      ByteBuffer bb2 = factory.wrapBuffer(bytes2);
+
+      String s3 = "echidna";
+      byte[] bytes3 = s3.getBytes("UTF-8");
+      ByteBuffer bb3 = factory.wrapBuffer(bytes3);
+      
+      long initialPos = sf.position();
+      sf.write(bb1, true);
+      long bytesWritten = sf.position() - initialPos;
+
+      assertEquals(calculateRecordSize(bytes1.length, sf.getAlignment()), bytesWritten);
+
+      initialPos = sf.position();
+      sf.write(bb2, true);
+      bytesWritten = sf.position() - initialPos;
+
+      assertEquals(calculateRecordSize(bytes2.length, sf.getAlignment()), bytesWritten);
+
+      initialPos = sf.position();
+      sf.write(bb3, true);
+      bytesWritten = sf.position() - initialPos;
+
+      assertEquals(calculateRecordSize(bytes3.length, sf.getAlignment()), bytesWritten);
+
+      sf.position(0);
+
+      ByteBuffer rb1 = factory.newBuffer(bytes1.length);
+      ByteBuffer rb2 = factory.newBuffer(bytes2.length);
+      ByteBuffer rb3 = factory.newBuffer(bytes3.length);
+
+      int bytesRead = sf.read(rb1);
+      assertEquals(calculateRecordSize(bytes1.length, sf.getAlignment()), bytesRead);
+
+      for (int i = 0; i < bytes1.length; i++)
+      {
+         assertEquals(bytes1[i], rb1.get(i));
+      }
+
+      bytesRead = sf.read(rb2);
+      assertEquals(calculateRecordSize(bytes2.length, sf.getAlignment()), bytesRead);
+      for (int i = 0; i < bytes2.length; i++)
+      {
+         assertEquals(bytes2[i], rb2.get(i));
+      }
+
+      bytesRead = sf.read(rb3);
+      assertEquals(calculateRecordSize(bytes3.length, sf.getAlignment()), bytesRead);
+      for (int i = 0; i < bytes3.length; i++)
+      {
+         assertEquals(bytes3[i], rb3.get(i));
+      }
+
+      sf.close();
+
+   }
+
+   public void testPosition() throws Exception
+   {
+      SequentialFile sf = factory.createSequentialFile("position.hq", 1);
+
+      sf.open();
+
+      try
+      {
+
+         sf.fill(0, 3 * 512, (byte)0);
+
+         String s1 = "orange";
+         byte[] bytes1 = s1.getBytes("UTF-8");
+         ByteBuffer bb1 = factory.wrapBuffer(bytes1);
+
+         byte[] bytes2 = s1.getBytes("UTF-8");
+         ByteBuffer bb2 = factory.wrapBuffer(bytes2);
+
+         String s3 = "lemon";
+         byte[] bytes3 = s3.getBytes("UTF-8");
+         ByteBuffer bb3 = factory.wrapBuffer(bytes3);
+
+         long initialPos = sf.position();
+         sf.write(bb1, true);
+         long bytesWritten = sf.position() - initialPos;
+
+         assertEquals(bb1.limit(), bytesWritten);
+
+         initialPos = sf.position();
+         sf.write(bb2, true);
+         bytesWritten = sf.position() - initialPos;
+
+         
+         assertEquals(bb2.limit(), bytesWritten);
+
+         initialPos = sf.position();
+         sf.write(bb3, true);
+         bytesWritten = sf.position() - initialPos;
+
+         assertEquals(bb3.limit(), bytesWritten);
+
+         byte[] rbytes1 = new byte[bytes1.length];
+
+         byte[] rbytes2 = new byte[bytes2.length];
+
+         byte[] rbytes3 = new byte[bytes3.length];
+
+         ByteBuffer rb1 = factory.newBuffer(rbytes1.length);
+         ByteBuffer rb2 = factory.newBuffer(rbytes2.length);
+         ByteBuffer rb3 = factory.newBuffer(rbytes3.length);
+
+         sf.position(bb1.limit() + bb2.limit());
+
+         int bytesRead = sf.read(rb3);
+         assertEquals(rb3.limit(), bytesRead);
+         rb3.rewind();
+         rb3.get(rbytes3);
+         assertEqualsByteArrays(bytes3, rbytes3);
+
+         sf.position(rb1.limit());
+
+         bytesRead = sf.read(rb2);
+         assertEquals(rb2.limit(), bytesRead);
+         rb2.get(rbytes2);
+         assertEqualsByteArrays(bytes2, rbytes2);
+
+         sf.position(0);
+
+         bytesRead = sf.read(rb1);
+         assertEquals(rb1.limit(), bytesRead);
+         rb1.get(rbytes1);
+
+         assertEqualsByteArrays(bytes1, rbytes1);
+
+      }
+      finally
+      {
+         try
+         {
+            sf.close();
+         }
+         catch (Exception ignored)
+         {
+         }
+      }
+   }
+
+   public void testOpenClose() throws Exception
+   {
+      SequentialFile sf = factory.createSequentialFile("openclose.hq", 1);
+
+      sf.open();
+
+      sf.fill(0, 512, (byte)0);
+
+      String s1 = "cheesecake";
+      byte[] bytes1 = s1.getBytes("UTF-8");
+      ByteBuffer bb1 = factory.wrapBuffer(bytes1);
+
+      long initialPos = sf.position();
+      sf.write(bb1, true);
+      long bytesWritten = sf.position() - initialPos;
+
+      assertEquals(bb1.limit(), bytesWritten);
+
+      sf.close();
+
+      try
+      {
+         sf.write(bb1, true);
+
+         fail("Should throw exception");
+      }
+      catch (Exception e)
+      {
+         // OK
+      }
+
+      sf.open();
+
+      sf.write(bb1, true);
+
+      sf.close();
+   }
+
    // Private ---------------------------------
 
    protected void checkFill(final SequentialFile file, final int pos, final int size, final byte fillChar) throws Exception

Modified: trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java	2009-08-20 16:43:27 UTC (rev 7835)
+++ trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java	2009-08-20 16:45:14 UTC (rev 7836)
@@ -566,7 +566,8 @@
       
       if (AsynchronousFileImpl.getTotalMaxIO() != 0)
       {
-         log.warn("test did not close all its files " + AsynchronousFileImpl.getTotalMaxIO());
+         AsynchronousFileImpl.resetMaxAIO();
+         fail("test did not close all its files " + AsynchronousFileImpl.getTotalMaxIO());
       }
 
       super.tearDown();



More information about the hornetq-commits mailing list