[jboss-cvs] JBoss Messaging SVN: r5501 - in trunk: src/main/org/jboss/messaging/core/server and 8 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Dec 10 08:38:26 EST 2008
Author: timfox
Date: 2008-12-10 08:38:25 -0500 (Wed, 10 Dec 2008)
New Revision: 5501
Modified:
trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
trunk/src/main/org/jboss/messaging/core/server/Queue.java
trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/jboss/messaging/core/transaction/Transaction.java
trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java
Log:
Mainly more duplicate detection stuff
Modified: trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/src/main/org/jboss/messaging/core/client/impl/ClientSessionImpl.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -879,6 +879,8 @@
{
SessionXAResponseMessage response = (SessionXAResponseMessage)channel.sendBlocking(packet);
+ log.error(response.getMessage() + " code " + response.getResponseCode());
+
if (response.isError())
{
throw new XAException(response.getResponseCode());
Modified: trunk/src/main/org/jboss/messaging/core/server/Queue.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/Queue.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/src/main/org/jboss/messaging/core/server/Queue.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -100,7 +100,7 @@
int getMessagesAdded();
- MessageReference removeReferenceWithID(long id);
+ MessageReference removeReferenceWithID(long id) throws Exception;
/** Remove message from queue, add it to the scheduled delivery list without affect reference counting */
void rescheduleDelivery(long id, long scheduledDeliveryTime);
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/QueueImpl.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -163,7 +163,7 @@
}
public HandleStatus addLast(final MessageReference ref)
- {
+ {
HandleStatus status = add(ref, false);
return status;
@@ -253,7 +253,7 @@
}
}
- public synchronized MessageReference removeReferenceWithID(final long id)
+ public synchronized MessageReference removeReferenceWithID(final long id) throws Exception
{
Iterator<MessageReference> iterator = messageReferences.iterator();
@@ -269,14 +269,7 @@
removed = ref;
- try
- {
- referenceRemoved(removed);
- }
- catch (Exception e)
- {
- log.warn(e.getMessage(), e);
- }
+ referenceRemoved(removed);
break;
}
@@ -401,7 +394,7 @@
{
return deleteMatchingReferences(null, storageManager);
}
-
+
public synchronized int deleteMatchingReferences(final Filter filter, final StorageManager storageManager) throws Exception
{
int count = 0;
@@ -422,7 +415,7 @@
count++;
}
}
-
+
List<MessageReference> cancelled = scheduledDeliveryHandler.cancel();
for (MessageReference messageReference : cancelled)
{
@@ -435,7 +428,7 @@
}
tx.commit();
-
+
return count;
}
@@ -507,12 +500,12 @@
count++;
}
}
-
+
tx.commit();
return count;
}
-
+
public void expireMessages(final StorageManager storageManager,
final PostOffice postOffice,
final HierarchicalRepository<QueueSettings> queueSettingsRepository) throws Exception
@@ -521,7 +514,10 @@
{
if (expiringMessageReference.getMessage().isExpired())
{
- expireMessage(expiringMessageReference.getMessage().getMessageID(), storageManager, postOffice, queueSettingsRepository);
+ expireMessage(expiringMessageReference.getMessage().getMessageID(),
+ storageManager,
+ postOffice,
+ queueSettingsRepository);
}
}
}
@@ -567,8 +563,11 @@
}
return false;
}
-
- public synchronized int moveMessages(final Filter filter, final SimpleString toAddress, final StorageManager storageManager, final PostOffice postOffice) throws Exception
+
+ public synchronized int moveMessages(final Filter filter,
+ final SimpleString toAddress,
+ final StorageManager storageManager,
+ final PostOffice postOffice) throws Exception
{
Transaction tx = new TransactionImpl(storageManager, postOffice);
@@ -586,7 +585,7 @@
count++;
}
}
-
+
List<MessageReference> cancelled = scheduledDeliveryHandler.cancel();
for (MessageReference ref : cancelled)
{
@@ -600,7 +599,7 @@
}
tx.commit();
-
+
return count;
}
@@ -727,7 +726,7 @@
// because it's async and could get out of step
// with the live node. Instead, when we replicate the delivery we remove
// the ref from the queue
-
+
if (backup)
{
return;
@@ -905,7 +904,10 @@
if (ref.getMessage().decrementRefCount() == 0)
{
- pagingManager.messageDone(ref.getMessage());
+ if (pagingManager != null)
+ {
+ pagingManager.messageDone(ref.getMessage());
+ }
}
}
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/ServerSessionImpl.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -1602,6 +1602,7 @@
public void handleXAPrepare(final SessionXAPrepareMessage packet)
{
+ log.info("handling xa prepare");
DelayedResult result = channel.replicatePacket(packet);
if (result == null)
@@ -1654,17 +1655,10 @@
"Cannot prepare transaction, it is suspended " + xid);
}
else
- {
- if (theTx.isEmpty())
- {
- response = new SessionXAResponseMessage(false, XAResource.XA_RDONLY, null);
- }
- else
- {
- theTx.prepare();
+ {
+ theTx.prepare();
- response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
- }
+ response = new SessionXAResponseMessage(false, XAResource.XA_OK, null);
}
}
}
@@ -2632,36 +2626,30 @@
}
}
- if (autoCommitSends)
+ Transaction theTx = null;
+ boolean startedTx = false;
+
+ if (!autoCommitSends)
{
+ theTx = tx;
+ }
+ else if (cache != null)
+ {
+ theTx = new TransactionImpl(storageManager, postOffice);
+
+ startedTx = true;
+ }
+
+ if (theTx == null)
+ {
if (!pager.page(msg))
{
List<MessageReference> refs = postOffice.route(msg);
if (msg.getDurableRefCount() != 0)
{
- if (cache == null)
- {
- storageManager.storeMessage(msg);
- }
- else
- {
- //TODO - We need to store both message and duplicate id entry in a tx -
- //otherwise if crash occurs message may be persisted but dupl id not!
-
- storageManager.storeMessage(msg);
-
- cache.addToCache(duplicateID);
- }
+ storageManager.storeMessage(msg);
}
- else
- {
- //No message to persist - we still add to cache though
- if (cache != null)
- {
- cache.addToCache(duplicateID);
- }
- }
// TODO - this code is also duplicated in transactionimpl and in depaging
// it should all be centralised
@@ -2684,13 +2672,18 @@
}
else
{
- tx.addMessage(msg);
+ theTx.addMessage(msg);
//Add to cache in same transaction
if (cache != null)
{
- cache.addToCache(duplicateID, tx);
+ cache.addToCache(duplicateID, theTx);
}
+
+ if (startedTx)
+ {
+ theTx.commit();
+ }
}
}
Modified: trunk/src/main/org/jboss/messaging/core/transaction/Transaction.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/transaction/Transaction.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/src/main/org/jboss/messaging/core/transaction/Transaction.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -60,8 +60,6 @@
Xid getXid();
- boolean isEmpty();
-
void suspend();
void resume();
Modified: trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/src/main/org/jboss/messaging/core/transaction/impl/TransactionImpl.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -76,7 +76,7 @@
private final Object timeoutLock = new Object();
private final long createTime;
-
+
public TransactionImpl(final StorageManager storageManager, final PostOffice postOffice)
{
this.storageManager = storageManager;
@@ -414,10 +414,6 @@
return xid;
}
- public boolean isEmpty()
- {
- return refsToAdd.isEmpty() && acknowledgements.isEmpty();
- }
public boolean isContainsPersistent()
{
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/OpenCloseStressTest.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -35,8 +35,8 @@
import javax.naming.InitialContext;
import org.jboss.messaging.jms.client.JBossConnectionFactory;
+import org.jboss.messaging.util.UUIDGenerator;
import org.jboss.test.messaging.JBMServerTestCase;
-import org.jboss.util.id.GUID;
/**
*
@@ -375,9 +375,9 @@
if (durable)
{
- conn.setClientID(new GUID().toString());
+ conn.setClientID(UUIDGenerator.getInstance().generateStringUUID());
- this.subname = new GUID().toString();
+ this.subname = UUIDGenerator.getInstance().generateStringUUID();
}
}
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCReceiver.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.util.id.GUID;
+import org.jboss.messaging.util.UUIDGenerator;
/**
*
@@ -86,7 +86,7 @@
XidImpl xid = null;
- xid = new XidImpl("bq1".getBytes(), 1, new GUID().toString().getBytes());
+ xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
xaResource.start(xid, XAResource.TMNOFLAGS);
for (int outerCount = 0; outerCount < iterations; outerCount++)
@@ -141,7 +141,7 @@
xaResource.commit(xid, false);
//Starting new tx
- xid = new XidImpl("bq1".getBytes(), 1, new GUID().toString().getBytes());
+ xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
xaResource.start(xid, XAResource.TMNOFLAGS);
}
@@ -201,7 +201,7 @@
xaResource.prepare(xid);
xaResource.rollback(xid);
- xid = new XidImpl("bq1".getBytes(), 1, new GUID().toString().getBytes());
+ xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
xaResource.start(xid, XAResource.TMNOFLAGS);
}
processingDone();
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/stress/Transactional2PCSender.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -28,7 +28,7 @@
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.util.id.GUID;
+import org.jboss.messaging.util.UUIDGenerator;
/**
*
@@ -78,7 +78,7 @@
XidImpl xid = null;
if (commitSize > 0)
{
- xid = new XidImpl("bq1".getBytes(), 1, new GUID().toString().getBytes());
+ xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
xaResource.start(xid, XAResource.TMNOFLAGS);
}
for (int innerCount = 0; innerCount < commitSize; innerCount++)
@@ -96,7 +96,7 @@
}
if (rollbackSize > 0)
{
- xid = new XidImpl("bq1".getBytes(), 1, new GUID().toString().getBytes());
+ xid = new XidImpl("bq1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
xaResource.start(xid, XAResource.TMNOFLAGS);
}
for (int innerCount = 0; innerCount < rollbackSize; innerCount++)
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/DuplicateDetectionTest.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -22,6 +22,9 @@
package org.jboss.messaging.tests.integration;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.ClientProducer;
@@ -35,8 +38,10 @@
import org.jboss.messaging.core.postoffice.impl.DuplicateIDCacheImpl;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.transaction.impl.XidImpl;
import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.util.SimpleString;
+import org.jboss.messaging.util.UUIDGenerator;
/**
* A DuplicateDetectionTest
@@ -423,7 +428,313 @@
sf.close();
}
+
+ public void testXADuplicateDetection1() throws Exception
+ {
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientMessage message = createMessage(session, 0);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.close();
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session = sf.createSession(true, false, false);
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ // Should be able to resend it and not get rejected since transaction didn't commit
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+
+ session.prepare(xid2);
+
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ message = consumer.receive(250);
+ assertEquals(1, message.getProperty(propKey));
+
+ message = consumer.receive(250);
+ assertNull(message);
+
+ log.info("ending session");
+ session.end(xid3, XAResource.TMSUCCESS);
+
+ log.info("preparing session");
+ session.prepare(xid3);
+
+ log.info("committing session");
+ session.commit(xid3, false);
+
+ session.close();
+
+ sf.close();
+ }
+
+ public void testXADuplicateDetection2() throws Exception
+ {
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientMessage message = createMessage(session, 0);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.rollback(xid);
+
+ session.close();
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session = sf.createSession(true, false, false);
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ // Should be able to resend it and not get rejected since transaction didn't commit
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+
+ session.prepare(xid2);
+
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ message = consumer.receive(250);
+ assertEquals(1, message.getProperty(propKey));
+
+ message = consumer.receive(250);
+ assertNull(message);
+
+ log.info("ending session");
+ session.end(xid3, XAResource.TMSUCCESS);
+
+ log.info("preparing session");
+ session.prepare(xid3);
+
+ log.info("committing session");
+ session.commit(xid3, false);
+
+ session.close();
+
+ sf.close();
+ }
+
+ public void testXADuplicateDetection3() throws Exception
+ {
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientMessage message = createMessage(session, 0);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.prepare(xid);
+
+ session.close();
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session = sf.createSession(true, false, false);
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ // Should NOT be able to resend it
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+
+ session.prepare(xid2);
+
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ message = consumer.receive(250);
+
+ message = consumer.receive(250);
+ assertNull(message);
+
+ log.info("ending session");
+ session.end(xid3, XAResource.TMSUCCESS);
+
+ log.info("preparing session");
+ session.prepare(xid3);
+
+ log.info("committing session");
+ session.commit(xid3, false);
+
+ session.close();
+
+ sf.close();
+ }
+
+ public void testXADuplicateDetection4() throws Exception
+ {
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientMessage message = createMessage(session, 0);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.prepare(xid);
+
+ session.commit(xid, false);
+
+ session.close();
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session = sf.createSession(true, false, false);
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ // Should NOT be able to resend it
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+
+ session.prepare(xid2);
+
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ message = consumer.receive(250);
+
+ message = consumer.receive(250);
+ assertNull(message);
+
+ log.info("ending session");
+ session.end(xid3, XAResource.TMSUCCESS);
+
+ log.info("preparing session");
+ session.prepare(xid3);
+
+ log.info("committing session");
+ session.commit(xid3, false);
+
+ session.close();
+
+ sf.close();
+ }
+
private ClientMessage createMessage(final ClientSession session, final int i)
{
ClientMessage message = session.createClientMessage(false);
@@ -1039,7 +1350,402 @@
messagingService2.stop();
}
-
+ public void testNoPersistXA1() throws Exception
+ {
+ messagingService.stop();
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setIDCacheSize(cacheSize);
+
+ conf.setPersistIDCache(false);
+
+ MessagingService messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ ClientMessage message = createMessage(session, 1);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ SimpleString dupID2 = new SimpleString("hijklmnopqr");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+ session.prepare(xid);
+ session.commit(xid, false);
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+
+ messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ session = sf.createSession(true, false, false);
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ producer = session.createProducer(queueName);
+
+ consumer = session.createConsumer(queueName);
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+ session.prepare(xid2);
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ ClientMessage message2 = consumer.receive(200);
+ assertEquals(1, message2.getProperty(propKey));
+
+ message2 = consumer.receive(200);
+ assertEquals(2, message2.getProperty(propKey));
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+ }
+
+ public void testNoPersistXA2() throws Exception
+ {
+ messagingService.stop();
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setIDCacheSize(cacheSize);
+
+ MessagingService messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ ClientMessage message = createMessage(session, 1);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ SimpleString dupID2 = new SimpleString("hijklmnopqr");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+
+ messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ session = sf.createSession(true, false, false);
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ producer = session.createProducer(queueName);
+
+ consumer = session.createConsumer(queueName);
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+ session.prepare(xid2);
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ ClientMessage message2 = consumer.receive(200);
+ assertEquals(1, message2.getProperty(propKey));
+
+ message2 = consumer.receive(200);
+ assertEquals(2, message2.getProperty(propKey));
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+ }
+
+ public void testPersistXA1() throws Exception
+ {
+ messagingService.stop();
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setIDCacheSize(cacheSize);
+
+ MessagingService messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ ClientMessage message = createMessage(session, 1);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ SimpleString dupID2 = new SimpleString("hijklmnopqr");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+ session.prepare(xid);
+ session.commit(xid, false);
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+
+ messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ session = sf.createSession(true, false, false);
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ producer = session.createProducer(queueName);
+
+ consumer = session.createConsumer(queueName);
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+ session.prepare(xid2);
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ ClientMessage message2 = consumer.receive(200);
+ assertNull(message2);
+
+ message2 = consumer.receive(200);
+ assertNull(message2);
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+ }
+
+ public void testPersistXA2() throws Exception
+ {
+ messagingService.stop();
+
+ Configuration conf = createDefaultConfig();
+
+ conf.setIDCacheSize(cacheSize);
+
+ MessagingService messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ ClientSession session = sf.createSession(true, false, false);
+
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ final SimpleString queueName = new SimpleString("DuplicateDetectionTestQueue");
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ ClientProducer producer = session.createProducer(queueName);
+
+ ClientConsumer consumer = session.createConsumer(queueName);
+
+ ClientMessage message = createMessage(session, 1);
+ SimpleString dupID = new SimpleString("abcdefg");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ SimpleString dupID2 = new SimpleString("hijklmnopqr");
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid, XAResource.TMSUCCESS);
+ session.prepare(xid);
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+
+ messagingService2 = MessagingServiceImpl.newMessagingService(conf);
+
+ messagingService2.start();
+
+ sf = new ClientSessionFactoryImpl(new TransportConfiguration("org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory"));
+
+ session = sf.createSession(true, false, false);
+
+ Xid xid2 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid2, XAResource.TMNOFLAGS);
+
+ session.start();
+
+ session.createQueue(queueName, queueName, null, false, false, true);
+
+ producer = session.createProducer(queueName);
+
+ consumer = session.createConsumer(queueName);
+
+ message = createMessage(session, 1);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
+ producer.send(message);
+
+ message = createMessage(session, 2);
+ message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
+ producer.send(message);
+
+ session.end(xid2, XAResource.TMSUCCESS);
+ session.prepare(xid2);
+ session.commit(xid2, false);
+
+ Xid xid3 = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+
+ session.start(xid3, XAResource.TMNOFLAGS);
+
+ ClientMessage message2 = consumer.receive(200);
+ assertNull(message2);
+
+ message2 = consumer.receive(200);
+ assertNull(message2);
+
+ session.close();
+
+ sf.close();
+
+ messagingService2.stop();
+ }
+
+// TODO - how does dup ids work with paging? on depaging need to check again?
@Override
protected void setUp() throws Exception
{
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/scheduling/ScheduledMessageTest.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -40,7 +40,7 @@
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.util.SimpleString;
-import org.jboss.util.id.GUID;
+import org.jboss.messaging.util.UUIDGenerator;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
@@ -560,8 +560,8 @@
public void testTxMessageDeliveredCorrectly(boolean recover) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
- Xid xid2 = new XidImpl("xa2".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientSessionFactory sessionFactory = createInVMFactory();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/BasicXaRecoveryTest.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -42,7 +42,7 @@
import org.jboss.messaging.jms.client.JBossTextMessage;
import org.jboss.messaging.tests.util.ServiceTestBase;
import org.jboss.messaging.util.SimpleString;
-import org.jboss.util.id.GUID;
+import org.jboss.messaging.util.UUIDGenerator;
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
@@ -239,7 +239,7 @@
public void testPaging(final boolean restartServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
SimpleString pageQueue = new SimpleString("pagequeue");
@@ -315,7 +315,7 @@
public void testRollbackPaging(final boolean restartServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
SimpleString pageQueue = new SimpleString("pagequeue");
@@ -375,7 +375,7 @@
public void testNonPersistent(final boolean commit) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", false);
ClientMessage m2 = createTextMessage("m2", false);
@@ -414,7 +414,7 @@
{
for (int i = 0; i < 10; i++)
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", false);
ClientMessage m2 = createTextMessage("m2", false);
@@ -447,7 +447,7 @@
public void testBasicSendWithCommit(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
@@ -498,7 +498,7 @@
public void testBasicSendWithRollback(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
@@ -538,7 +538,7 @@
public void testMultipleBeforeSendWithCommit(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -597,8 +597,8 @@
public void testMultipleTxSendWithCommit(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
- Xid xid2 = new XidImpl("xa2".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -671,8 +671,8 @@
public void testMultipleTxSendWithRollback(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
- Xid xid2 = new XidImpl("xa2".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -723,8 +723,8 @@
public void testMultipleTxSendWithCommitAndRollback(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
- Xid xid2 = new XidImpl("xa2".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -787,7 +787,7 @@
public void testMultipleTxSameXidSendWithCommit(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -860,7 +860,7 @@
public void testBasicReceiveWithCommit(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -918,7 +918,7 @@
public void testBasicReceiveWithRollback(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -986,8 +986,8 @@
public void testMultipleTxReceiveWithCommit(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
- Xid xid2 = new XidImpl("xa2".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
@@ -1076,8 +1076,8 @@
public void testMultipleTxReceiveWithRollback(final boolean stopServer) throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
- Xid xid2 = new XidImpl("xa2".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
+ Xid xid2 = new XidImpl("xa2".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1");
ClientMessage m2 = createTextMessage("m2");
ClientMessage m3 = createTextMessage("m3");
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/xa/XaTimeoutTest.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -21,30 +21,30 @@
*/
package org.jboss.messaging.tests.integration.xa;
-import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.core.server.MessagingService;
-import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.client.ClientConsumer;
+import org.jboss.messaging.core.client.ClientMessage;
+import org.jboss.messaging.core.client.ClientProducer;
import org.jboss.messaging.core.client.ClientSession;
-import org.jboss.messaging.core.client.ClientProducer;
-import org.jboss.messaging.core.client.ClientConsumer;
import org.jboss.messaging.core.client.ClientSessionFactory;
-import org.jboss.messaging.core.client.ClientMessage;
import org.jboss.messaging.core.client.impl.ClientSessionFactoryImpl;
+import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
-import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.exception.MessagingException;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.core.settings.impl.QueueSettings;
import org.jboss.messaging.core.transaction.impl.XidImpl;
+import org.jboss.messaging.tests.util.UnitTestCase;
import org.jboss.messaging.util.SimpleString;
-import org.jboss.messaging.jms.client.JBossTextMessage;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.util.id.GUID;
+import org.jboss.messaging.util.UUIDGenerator;
-import javax.transaction.xa.Xid;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.XAException;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* @author <a href="mailto:andy.taylor at jboss.org">Andy Taylor</a>
*/
@@ -116,7 +116,7 @@
public void testSimpleTimeoutOnSendOnCommit() throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", clientSession);
ClientMessage m2 = createTextMessage("m2", clientSession);
@@ -145,7 +145,7 @@
public void testSimpleTimeoutOnReceive() throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", clientSession);
ClientMessage m2 = createTextMessage("m2", clientSession);
@@ -213,7 +213,7 @@
public void testSimpleTimeoutOnSendAndReceive() throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", clientSession);
ClientMessage m2 = createTextMessage("m2", clientSession);
@@ -291,7 +291,7 @@
public void testPreparedTransactionNotTimedOut() throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", clientSession);
ClientMessage m2 = createTextMessage("m2", clientSession);
@@ -364,7 +364,7 @@
public void testChangingTimeoutGetsPickedUp() throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", clientSession);
ClientMessage m2 = createTextMessage("m2", clientSession);
@@ -394,7 +394,7 @@
public void testChangingTimeoutGetsPickedUpCommit() throws Exception
{
- Xid xid = new XidImpl("xa1".getBytes(), 1, new GUID().toString().getBytes());
+ Xid xid = new XidImpl("xa1".getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
ClientMessage m1 = createTextMessage("m1", clientSession);
ClientMessage m2 = createTextMessage("m2", clientSession);
@@ -437,7 +437,7 @@
Xid[] xids = new XidImpl[100];
for (int i = 0; i < xids.length; i++)
{
- xids[i] = new XidImpl(("xa" + i).getBytes(), 1, new GUID().toString().getBytes());
+ xids[i] = new XidImpl(("xa" + i).getBytes(), 1, UUIDGenerator.getInstance().generateStringUUID().getBytes());
}
ClientSession[] clientSessions = new ClientSession[xids.length];
for (int i = 0; i < clientSessions.length; i++)
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java 2008-12-10 13:18:52 UTC (rev 5500)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java 2008-12-10 13:38:25 UTC (rev 5501)
@@ -88,8 +88,6 @@
assertNull(tx.getXid());
assertEquals(0, tx.getAcknowledgementsCount());
-
- assertTrue(tx.isEmpty());
}
public void testXAConstructor() throws Exception
@@ -115,8 +113,6 @@
assertEquals(xid, tx.getXid());
assertEquals(0, tx.getAcknowledgementsCount());
-
- assertTrue(tx.isEmpty());
}
public void testState() throws Exception
@@ -588,8 +584,6 @@
Transaction tx = new TransactionImpl(sm, po);
- assertTrue(tx.isEmpty());
-
assertFalse(tx.isContainsPersistent());
EasyMock.verify(sm, postOffice, pagingManager, pagingStore);
@@ -605,7 +599,6 @@
tx.addAcknowledgement(ref3);
- assertFalse(tx.isEmpty());
assertFalse(tx.isContainsPersistent());
tx.addAcknowledgement(ref1);
More information about the jboss-cvs-commits
mailing list