[jboss-cvs] JBoss Messaging SVN: r3031 - in trunk: src/main/org/jboss/messaging/core/impl and 4 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Aug 22 15:18:40 EDT 2007


Author: timfox
Date: 2007-08-22 15:18:40 -0400 (Wed, 22 Aug 2007)
New Revision: 3031

Modified:
   trunk/src/main/org/jboss/messaging/core/contract/Message.java
   trunk/src/main/org/jboss/messaging/core/contract/MessageStore.java
   trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
   trunk/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java
   trunk/src/main/org/jboss/messaging/core/impl/message/MessageSupport.java
   trunk/src/main/org/jboss/messaging/core/impl/message/SimpleMessageStore.java
   trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/PagingTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
   trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
   trunk/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java
Log:
Fixed some tests


Modified: trunk/src/main/org/jboss/messaging/core/contract/Message.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/contract/Message.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/src/main/org/jboss/messaging/core/contract/Message.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -151,5 +151,5 @@
    
    boolean isPersisted();
    
-   void setPersisted(boolean persisted);
+   void setPersisted(boolean persisted);   
 }

Modified: trunk/src/main/org/jboss/messaging/core/contract/MessageStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/contract/MessageStore.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/src/main/org/jboss/messaging/core/contract/MessageStore.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -23,4 +23,6 @@
 	 MessageReference reference(long messageID);
 	 
 	 MessageReference reference(Message message);
+	 
+	 void clear();
 }

Modified: trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/src/main/org/jboss/messaging/core/impl/JDBCPersistenceManager.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -536,13 +536,13 @@
    public void pageReferences(final long channelID, final List references, final boolean page) throws Exception
    {      
    	class PageReferencesRunner extends JDBCTxRunner
-      {
+      {	
       	public Object doTransaction() throws Exception
    		{
       		PreparedStatement psInsertReference = null;
       		PreparedStatement psInsertMessage = null;
       		
-      		List<Message> persistedMessages = new ArrayList<Message>();
+      		List<Message> pagedMessages = new ArrayList<Message>();
       		
       		try
       		{      		
@@ -578,18 +578,40 @@
 	         		{
 	         			if (!m.isPersisted())
 	         			{            	               
-	         				//The message might actually already exist due to it already being paged
+	         				//The message might actually still already exist (despite pagedcount=0) due to it already being paged
 	         				//so we insert and ignore key violations
 	
 	         				storeMessage(m, psInsertMessage); 
 	
-	         				rows = psInsertMessage.executeUpdate();
+	         				try
+	         				{
+	         					rows = psInsertMessage.executeUpdate();
+	         				}
+	         				catch (SQLException e)
+	         				{
+	         					if (e.getSQLState().equals("23000"))
+	         					{
+	         						//This is a primary key violation
+	         						//It might legitimately occur if the ref has been paged to two channels so it is not
+	         						//left in memory any more, then loaded by one channel
+	         						//The paged count would then be one, not two
+	         						if (trace) { log.trace("Primary key violation detected", e); }
+	         						
+	         						//When we retry we don't want to insert again, so set persisted to true
+	         						m.setPersisted(true);
+	         						
+	         						//Throw the exception so the tx is retried - the next time it won't try and insert the message
+	         						violationOk = true;
+	         						
+	         						throw e;
+	         					}
+	         				}
 	
 	         				if (trace) { log.trace("Inserted " + rows + " rows"); }	               
 	
 	         				m.setPersisted(true);
 	         				
-	         				persistedMessages.add(m);
+	         				pagedMessages.add(m);
 	         			}
 	         		}
 	         	} 
@@ -600,11 +622,11 @@
       		{
       			//The tx will be rolled back
       			//so we need to set the messages to not persisted
-      			for (Iterator iter = persistedMessages.iterator(); iter.hasNext(); )
+      			for (Iterator iter = pagedMessages.iterator(); iter.hasNext(); )
                {
                   Message msg = (Message)iter.next();
       			
-                  msg.setPersisted(false);      				
+                  msg.setPersisted(false);
       			}
       			
       			throw e;
@@ -632,7 +654,9 @@
       {
       	public Object doTransaction() throws Exception
    		{
-		      PreparedStatement psDeleteReference = null;  
+		      PreparedStatement psDeleteReference = null; 
+		      
+		      List<Message> depagedReferences = new ArrayList<Message>();
 		       
 		      try
 		      {	
@@ -654,11 +678,23 @@
 		            //and the tx is committed so the message be attempted to be inserted twice but this should be ok
 		            //since we ignore key violations on message insert		      
 		            
-		            ref.getMessage().setPersisted(false); 
+		            ref.getMessage().setPersisted(false);
+		            
+		            depagedReferences.add(ref.getMessage());
 		         }         
 		         
 		         return null;
 		      }
+		      catch (Exception e)
+		      {
+		      	for (Iterator iter = depagedReferences.iterator(); iter.hasNext(); )
+               {
+                  Message msg = (Message)iter.next();
+      			
+                  msg.setPersisted(true);
+      			}
+		      	throw e;
+		      }
 		      finally
 		      {
 		      	closeStatement(psDeleteReference);       
@@ -2397,6 +2433,8 @@
 
       TransactionWrapper wrap;
       
+      boolean violationOk;
+      
 		public Object execute() throws Exception
 		{
 	      wrap = new TransactionWrapper();
@@ -2437,17 +2475,25 @@
 	         }
 	         catch (SQLException e)
 	         {
-	            log.warn("SQLException caught, SQLState " + e.getSQLState() + " code:" + e.getErrorCode() + "- assuming deadlock detected, try:" + (tries + 1), e);
-	            
-	            tries++;
-	            if (tries == MAX_TRIES)
-	            {
-	               log.error("Retried " + tries + " times, now giving up");
-	               throw new IllegalStateException("Failed to excecute transaction");
-	            }
-	            log.warn("Trying again after a pause");
-	            //Now we wait for a random amount of time to minimise risk of deadlock
-	            Thread.sleep((long)(Math.random() * 500));
+	         	if (e.getSQLState().equals("23000") && violationOk)
+	         	{
+	         		//Primary key violation - this is ok - we retry immediately
+	         		violationOk = false;
+	         	}
+	         	else
+	         	{		         	
+		            log.warn("SQLException caught, SQLState " + e.getSQLState() + " code:" + e.getErrorCode() + "- assuming deadlock detected, try:" + (tries + 1), e);
+		            
+		            tries++;
+		            if (tries == MAX_TRIES)
+		            {
+		               log.error("Retried " + tries + " times, now giving up");
+		               throw new IllegalStateException("Failed to excecute transaction");
+		            }
+		            log.warn("Trying again after a pause");
+		            //Now we wait for a random amount of time to minimise risk of deadlock
+		            Thread.sleep((long)(Math.random() * 500));
+	         	}
 	         }  
 	      }
 		}

Modified: trunk/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/src/main/org/jboss/messaging/core/impl/PagingChannelSupport.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -247,8 +247,12 @@
       // Must flush the down cache first
       flushDownCache();
       
-      List refInfos = pm.getPagedReferenceInfos(channelID, firstPagingOrder, number);      
+      log.info("flushed down cache");
       
+      List refInfos = pm.getPagedReferenceInfos(channelID, firstPagingOrder, number);     
+      
+      log.info("Loaded " + refInfos.size() + " ref infos");
+      
       Map refMap = processReferences(refInfos);
 
       boolean loadedReliable = false;
@@ -264,12 +268,16 @@
          
          MessageReference ref = addFromRefInfo(info, refMap);
          
+         log.info("ref is " + ref + " recoverable " + recoverable);
+         
          if (recoverable && ref.getMessage().isReliable())
          {
+         	log.info("loaded reliable");
             loadedReliable = true;
          }
          else
          {
+         	log.info("Loaded not reliable");
             // We put the non reliable refs (or reliable in a non-recoverable store)
             // in a list to be removed
             toRemove.add(ref);
@@ -543,6 +551,7 @@
 
          if (ref != null)
          {
+         	log.info("Found ref in store, msg is " + ref.getMessage());
             refMap.put(msgId, ref);
          }
          else

Modified: trunk/src/main/org/jboss/messaging/core/impl/message/MessageSupport.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/message/MessageSupport.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/src/main/org/jboss/messaging/core/impl/message/MessageSupport.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -77,7 +77,7 @@
 	private byte[] payloadAsByteArray;
 	
 	private transient volatile boolean persisted;
-
+	
 	// Constructors --------------------------------------------------
 
 	/*

Modified: trunk/src/main/org/jboss/messaging/core/impl/message/SimpleMessageStore.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/impl/message/SimpleMessageStore.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/src/main/org/jboss/messaging/core/impl/message/SimpleMessageStore.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -91,6 +91,11 @@
    	}
    }
    
+   public synchronized void clear()
+   {
+   	messages.clear();
+   }
+   
    // MessagingComponent implementation --------------------------------
    
    public void start() throws Exception

Modified: trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -267,9 +267,21 @@
 
    protected void tearDown() throws Exception
    {
+      pm.reapUnreferencedMessages();
+      
+      if (this.checkNoMessageData())
+      {
+      	fail("Message data still exists");
+      }
+      
+      if (this.checkNoBindingData())
+      {
+      	fail("Binding data still exists");
+      }
       sc.stop();
       sc = null;
       
+      
       pm.stop();
       tr.stop();
       ms.stop();

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_2PCTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -80,11 +80,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
   
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -129,11 +129,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -178,11 +178,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
 
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -227,11 +227,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
             
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_NTTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -78,11 +78,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
             
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null);          
       }
@@ -124,11 +124,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }
@@ -171,11 +171,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }
@@ -219,11 +219,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_NP_TTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -80,11 +80,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -128,11 +128,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -177,11 +177,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -226,11 +226,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
 
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_2PCTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -74,11 +74,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -128,11 +128,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -184,11 +184,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -240,11 +240,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_NTTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -78,11 +78,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }
@@ -130,11 +130,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
 
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }
@@ -185,11 +185,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }
@@ -239,11 +239,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], null); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], null); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/ChannelShare_P_TTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -78,11 +78,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -131,11 +131,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
          
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -187,11 +187,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
 
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }
@@ -242,11 +242,11 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs1[i] = ms.reference(msgs[i]);
+         refs1[i] = msgs[i].createReference();
                 
          queue1.handle(null, refs1[i], tx); 
 
-         refs2[i] = ms.reference(msgs[i]);
+         refs2[i] = msgs[i].createReference();
          
          queue2.handle(null, refs2[i], tx); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/PagingStateTestBase.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -82,10 +82,6 @@
 
    // Public --------------------------------------------------------
    
-   public void testEmpty()
-   {
-      
-   }
 
    public void setUp() throws Exception
    {
@@ -109,11 +105,18 @@
       
       tr = new TransactionRepository(pm, ms, idm);
       tr.start();          
+      
+      ms.clear();
    }
    
    
    public void tearDown() throws Exception
    {
+   	pm.reapUnreferencedMessages(); 
+   	if (checkNoMessageData())
+   	{
+   		fail("Message data still exists");
+   	}  	
       pm.stop();
       tr.stop();
       ms.stop();

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/PagingTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/PagingTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/PagingTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -67,10 +67,10 @@
       CoreMessage m = null;
 
       m = CoreMessageFactory.createCoreMessage(0);
-      p.handle(null, ms.reference(m), null);
+      p.handle(null, m.createReference(), null);
 
       m = CoreMessageFactory.createCoreMessage(1);
-      p.handle(null, ms.reference(m), null);
+      p.handle(null, m.createReference(), null);
 
    }
 

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_2PCTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -52,13 +52,13 @@
 
    public void setUp() throws Exception
    {
-      super.setUp(); 
+      super.setUp();             
    }
    
    
    public void tearDown() throws Exception
    {
-      super.tearDown();
+      super.tearDown();          
    }
    
    public void test1() throws Throwable
@@ -77,7 +77,7 @@
       for (int i = 0; i < 99; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], tx); 
       }
@@ -146,7 +146,7 @@
       for (int i = 100; i < 109; i++)
       {         
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }
       tx.prepare();
@@ -250,7 +250,7 @@
       for (int i = 111; i < 120; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }      
       tx.prepare();
@@ -281,9 +281,9 @@
             
       //    Send 100 more refs then roll back
       tx = this.createXATx();
-      for (int i = 200; i < 300; i++)
+      for (int i = 300; i < 400; i++)
       {
-         Message m = CoreMessageFactory.createCoreMessage(i, true, null);
+         Message m = CoreMessageFactory.createCoreMessage(i, false, null);
          MessageReference ref = ms.reference(m);
          queue.handle(null, ref, tx);        
       }  
@@ -297,7 +297,7 @@
       for (int i = 120; i < 130; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);  
       }  
       tx.prepare();
@@ -335,7 +335,7 @@
       for (int i = 130; i < 140; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx); 
       }  
       tx.prepare();
@@ -620,7 +620,7 @@
       for (int i = 141; i < 161; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.prepare();
@@ -655,7 +655,7 @@
       for (int i = 161; i < 181; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.prepare();
@@ -689,12 +689,20 @@
       for (int i = 181; i < 241; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
+      
+      log.info("Sent messages***");
+      
       tx.prepare();
+      
+      log.info("Prepared ***");
+      
       tx.commit();
       
+      log.info("Committed ***");
+      
       //verify 20 ref in storage
       
       refIds = getReferenceIdsOrderedByPageOrd(queue.getChannelID());
@@ -725,6 +733,8 @@
       //remove 20 but don't ack them yet
       //this should cause a load to be triggered
       
+      log.info("Triggering load");
+      
       SimpleDelivery[] dels = this.getDeliveries(queue, 20);
                   
       //verify 0 ref in storage
@@ -790,7 +800,8 @@
       assertSameIds(refIds, refs, 231, 240);
       
       //Verify 10 msgs in storage
-      pm.reapUnreferencedMessages(); msgIds = getMessageIds();
+      pm.reapUnreferencedMessages();
+      msgIds = getMessageIds();
       assertEquals(10, msgIds.size()); 
       assertSameIds(msgIds, refs, 231, 240);
       

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_NTTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -74,7 +74,7 @@
       for (int i = 0; i < 99; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -132,7 +132,7 @@
       for (int i = 100; i < 109; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null); 
       }
       
@@ -227,7 +227,7 @@
       for (int i = 111; i < 120; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
       }      
       
@@ -262,7 +262,7 @@
       for (int i = 120; i < 130; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
       }  
       
@@ -297,7 +297,7 @@
       for (int i = 130; i < 140; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
       }  
       
@@ -579,7 +579,7 @@
       for (int i = 141; i < 161; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -611,7 +611,7 @@
       for (int i = 161; i < 181; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -642,7 +642,7 @@
       for (int i = 181; i < 241; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -669,15 +669,6 @@
       //Verify no deliveries
       assertEquals(0, queue.getDeliveringCount());;
       
-      
-       
-      //test cancellation
-      
-      //remove 20 but don't ack them yet
-      //this should cause a load to be triggered
-      
-//      CancellingReceiver r = new CancellingReceiver(20);
-//      queue.add(r);
       SimpleDelivery[] dels = getDeliveries(queue, 20);
       
       //verify 0 ref in storage
@@ -822,9 +813,6 @@
       
       
       
-      
-      
-      
       //Consume the rest
       
       consume(queue, consumeCount, refs, 70);

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_NP_TTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -77,7 +77,7 @@
       for (int i = 0; i < 99; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], tx); 
       }
@@ -143,7 +143,7 @@
       for (int i = 100; i < 109; i++)
       {         
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx); 
       }
       tx.commit();
@@ -244,7 +244,7 @@
       for (int i = 111; i < 120; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }      
       tx.commit();
@@ -275,9 +275,9 @@
       //Send 100 more refs then roll back
       tx = tr.createTransaction();
       
-      for (int i = 200; i < 300; i++)
+      for (int i = 400; i < 500; i++)
       {
-         Message m = CoreMessageFactory.createCoreMessage(i, true, null);
+         Message m = CoreMessageFactory.createCoreMessage(i, false, null);
          MessageReference ref = ms.reference(m);
          queue.handle(null, ref, tx);     
       }  
@@ -290,7 +290,7 @@
       for (int i = 120; i < 130; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }  
       tx.commit();
@@ -325,7 +325,7 @@
       for (int i = 130; i < 140; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);      
       }  
       tx.commit();
@@ -610,7 +610,7 @@
       for (int i = 141; i < 161; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();
@@ -644,7 +644,7 @@
       for (int i = 161; i < 181; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();
@@ -677,7 +677,7 @@
       for (int i = 181; i < 241; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_2PCTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -76,7 +76,7 @@
       for (int i = 0; i < 99; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.prepare();
@@ -153,7 +153,7 @@
       for (int i = 100; i < 109; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);  
       }
       tx.prepare();
@@ -271,7 +271,7 @@
       for (int i = 111; i < 120; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);   
       }     
       tx.prepare();
@@ -322,7 +322,7 @@
       for (int i = 120; i < 130; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
       }  
       tx.prepare();
@@ -364,7 +364,7 @@
       for (int i = 130; i < 140; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);      
       }  
       tx.prepare();
@@ -698,7 +698,7 @@
       for (int i = 141; i < 161; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       tx.prepare();
@@ -737,7 +737,7 @@
       for (int i = 161; i < 181; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       tx.prepare();
@@ -775,7 +775,7 @@
       for (int i = 181; i < 241; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       tx.prepare();

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_NTTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -74,7 +74,7 @@
       for (int i = 0; i < 99; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -145,7 +145,7 @@
       for (int i = 100; i < 109; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
       }
       
@@ -252,7 +252,7 @@
       for (int i = 111; i < 120; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);        
       }      
       
@@ -292,7 +292,7 @@
       for (int i = 120; i < 130; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
       }  
       
@@ -332,7 +332,7 @@
       for (int i = 130; i < 140; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);         
 
       }  
@@ -660,7 +660,7 @@
       for (int i = 141; i < 161; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -696,7 +696,7 @@
       for (int i = 161; i < 181; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       
@@ -731,7 +731,7 @@
       for (int i = 181; i < 241; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], null);
       }
       

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_P_TTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -76,7 +76,7 @@
       for (int i = 0; i < 99; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();
@@ -151,7 +151,7 @@
       for (int i = 100; i < 109; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }
       tx.commit();
@@ -266,7 +266,7 @@
       for (int i = 111; i < 120; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }      
       tx.commit();
@@ -307,7 +307,7 @@
       for (int i = 120; i < 130; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);         
       }  
       tx.commit();
@@ -356,7 +356,7 @@
       for (int i = 130; i < 140; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx); 
       }  
       tx.commit();
@@ -687,7 +687,7 @@
       for (int i = 141; i < 161; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();
@@ -725,7 +725,7 @@
       for (int i = 161; i < 181; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();
@@ -762,7 +762,7 @@
       for (int i = 181; i < 241; i++)
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
          queue.handle(null, refs[i], tx);
       }
       tx.commit();

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/SingleChannel_ReloadTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -76,7 +76,7 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], null); 
       }
@@ -86,7 +86,7 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], null); 
       }
@@ -169,7 +169,7 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], null); 
       }
@@ -179,7 +179,7 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], null); 
       }
@@ -257,7 +257,7 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, false, null);
          
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], null); 
       }
@@ -267,7 +267,7 @@
       {
          msgs[i] = CoreMessageFactory.createCoreMessage(i, true, null);
          
-         refs[i] = ms.reference(msgs[i]);
+         refs[i] = msgs[i].createReference();
                 
          queue.handle(null, refs[i], null); 
       }

Modified: trunk/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java	2007-08-22 14:50:40 UTC (rev 3030)
+++ trunk/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java	2007-08-22 19:18:40 UTC (rev 3031)
@@ -174,12 +174,7 @@
          queues = office3.getQueuesForCondition(condition2, true);
          assertNotNull(queues);
          assertTrue(queues.isEmpty());
-         
-         if (checkNoBindingData())
-         {
-            fail("Binding data still in database");
-         }
-                  
+                 
       }
       finally
       {
@@ -307,11 +302,6 @@
          assertTrue(queues.contains(queue7));
          assertTrue(queues.contains(queue8));
          
-         if (checkNoBindingData())
-         {
-            fail("Binding data still in database");
-         }
-         
       }
       finally
       {
@@ -387,10 +377,6 @@
          b3 = office.getBindingForQueueName("queue3");
          assertNull(b3);                     
                   
-         if (checkNoBindingData())
-         {
-            fail("Binding data still in database");
-         }
       }
       finally
       {
@@ -463,11 +449,7 @@
  
          b3 = office.getBindingForChannelID(queue3.getChannelID());
          assertNull(b3);                     
-         
-         if (checkNoBindingData())
-         {
-            fail("Binding data still in database");
-         }
+
       }
       finally
       {
@@ -651,11 +633,6 @@
          msgs = receiver6.getMessages();
          assertNotNull(msgs);
          assertTrue(msgs.isEmpty());
-         
-         if (checkNoMessageData())
-         {
-            fail("data still in database");
-         }
       }
       finally
       {
@@ -698,12 +675,6 @@
          List msgs = receiver1.getMessages();
          assertNotNull(msgs);
          assertTrue(msgs.isEmpty());  
-         
-         if (checkNoMessageData())
-         {
-            fail("data still in database");
-         }
-         
       }
       finally
       {
@@ -898,18 +869,20 @@
          assertNotNull(msgs);
          assertTrue(msgs.isEmpty());
          
+         postOffice.removeBinding("queue1", false);
+         postOffice.removeBinding("queue2", false);
+         postOffice.removeBinding("queue3", false);
+         postOffice.removeBinding("queue4", false);
+         postOffice.removeBinding("queue5", false);
+         postOffice.removeBinding("queue6", false);         
+         
       }
       finally
       {
          if (postOffice != null)
          {
             postOffice.stop();
-         }
-         
-         if (checkNoMessageData())
-         {
-            fail("data still in database");
-         }
+         }         
       }
    }
    
@@ -1149,12 +1122,10 @@
          
          
          receiver2.acknowledge(msgRec1, null);
-         receiver2.acknowledge(msgRec2, null);
+         receiver2.acknowledge(msgRec2, null);         
          
-         if (checkNoMessageData())
-         {
-            fail("data still in database");
-         }
+         postOffice.removeBinding("queue1", false);
+         postOffice.removeBinding("queue2", false);
       }
       finally
       {
@@ -1254,13 +1225,7 @@
          receiver3.acknowledge(msgRec3, null);
          msgs = queue3.browse(null);
          assertNotNull(msgs);
-         assertTrue(msgs.isEmpty()); 
-         
-         if (checkNoMessageData())
-         {
-            fail("data still in database");
-         }
-         
+         assertTrue(msgs.isEmpty());          
       }
       finally
       {




More information about the jboss-cvs-commits mailing list