[jboss-cvs] JBoss Messaging SVN: r4578 - in trunk: src/main/org/jboss/messaging/core/version/impl and 9 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jun 25 09:36:21 EDT 2008
Author: timfox
Date: 2008-06-25 09:36:21 -0400 (Wed, 25 Jun 2008)
New Revision: 4578
Added:
trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/XidImplTest.java
Removed:
trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/MessagingXidTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionTest.java
Modified:
trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java
trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java
trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java
trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java
trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java
trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ConnectionParamsImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LocationImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/core/version/impl/VersionImplTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossSessionTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java
trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JMSMessageListenerWrapperTest.java
Log:
More test stuff
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/ConfigurationImpl.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -465,6 +465,55 @@
{
return this.defaultConnectionParams;
}
+
+ public boolean equals(Object other)
+ {
+ if (this == other)
+ {
+ return true;
+ }
+
+ if (other instanceof Configuration == false)
+ {
+ return false;
+ }
+
+ Configuration cother = (Configuration)other;
+
+ return cother.isClustered() == this.isClustered() &&
+ cother.isCreateBindingsDir() == this.isCreateBindingsDir() &&
+ cother.isCreateJournalDir() == this.isCreateJournalDir() &&
+ cother.isJournalSyncNonTransactional() == this.isJournalSyncNonTransactional() &&
+ cother.isJournalSyncTransactional() == this.isJournalSyncTransactional() &&
+ cother.isRequireDestinations() == this.isRequireDestinations() &&
+ cother.isSecurityEnabled() == this.isSecurityEnabled() &&
+ cother.isSSLEnabled() == this.isSSLEnabled() &&
+ cother.getBindingsDirectory().equals(this.getBindingsDirectory()) &&
+ cother.getConnectionParams().equals(this.getConnectionParams()) &&
+ cother.getHost().equals(this.getHost()) &&
+ cother.getJournalAIOTimeout() == this.getJournalAIOTimeout() &&
+ cother.getJournalDirectory().equals(this.getJournalDirectory()) &&
+ cother.getJournalFileSize() == this.getJournalFileSize() &&
+ cother.getJournalMaxAIO() == this.getJournalMaxAIO() &&
+ cother.getJournalMinFiles() == this.getJournalMinFiles() &&
+ cother.getJournalTaskPeriod() == this.getJournalTaskPeriod() &&
+ cother.getJournalType() == this.getJournalType() &&
+ cother.getKeyStorePassword() == null ?
+ this.getKeyStorePassword() == null : cother.getKeyStorePassword().equals(this.getKeyStorePassword()) &&
+ cother.getKeyStorePath() == null ?
+ this.getKeyStorePath() == null : cother.getKeyStorePath().equals(this.getKeyStorePath()) &&
+ cother.getLocation().equals(this.getLocation()) &&
+ cother.getPort() == this.getPort() &&
+ cother.getScheduledThreadPoolMaxSize() == this.getScheduledThreadPoolMaxSize() &&
+ cother.getSecurityInvalidationInterval() == this.getSecurityInvalidationInterval() &&
+ cother.getServerID() == this.getServerID() &&
+ cother.getThreadPoolMaxSize() == this.getThreadPoolMaxSize() &&
+ cother.getTransport() == this.getTransport() &&
+ cother.getTrustStorePassword() == null ?
+ this.getTrustStorePassword() == null : cother.getTrustStorePassword().equals(this.getTrustStorePassword()) &&
+ cother.getTrustStorePath() == null ?
+ this.getTrustStorePath() == null : cother.getTrustStorePath().equals(this.getTrustStorePath());
+ }
}
Modified: trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/core/config/impl/FileConfiguration.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -24,7 +24,6 @@
import java.io.InputStreamReader;
import java.io.Reader;
-import java.io.Serializable;
import java.net.URL;
import java.util.ArrayList;
@@ -42,7 +41,7 @@
*
* @author <a href="ataylor at redhat.com">Andy Taylor</a>
*/
-public class FileConfiguration extends ConfigurationImpl implements Serializable
+public class FileConfiguration extends ConfigurationImpl
{
private static final long serialVersionUID = -4766689627675039596L;
Modified: trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/core/version/impl/VersionImpl.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -36,6 +36,8 @@
{
// Constants -----------------------------------------------------
+ private static final long serialVersionUID = -5271227256591080403L;
+
private static final Logger log = Logger.getLogger(VersionImpl.class);
// Static --------------------------------------------------------
Modified: trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -912,7 +912,7 @@
{
JBossSession jsession = (JBossSession)sourceSession;
- ClientSession clientSession = jsession.getDelegate();
+ ClientSession clientSession = jsession.getCoreSession();
//clientSession.setTreatAsNonTransactedWhenNotEnlisted(false);
}
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossConnectionFactory.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -240,7 +240,7 @@
return "JBossConnectionFactory->" + connectionFactory;
}
- public synchronized ClientConnectionFactory getDelegate()
+ public synchronized ClientConnectionFactory getCoreConnection()
{
if (connectionFactory == null)
{
@@ -270,7 +270,7 @@
{
try
{
- getDelegate();
+ getCoreConnection();
ClientConnection res = connectionFactory.createConnection(username, password);
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessage.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -872,7 +872,7 @@
// Public --------------------------------------------------------
- public ClientMessage getDelegate()
+ public ClientMessage getCoreMessage()
{
return message;
}
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageConsumer.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -183,7 +183,7 @@
private void checkClosed() throws JMSException
{
- if (session.getDelegate().isClosed())
+ if (session.getCoreSession().isClosed())
{
throw new IllegalStateException("Consumer is closed");
}
@@ -199,9 +199,9 @@
if (message != null)
{
- session.getDelegate().acknowledge();
+ session.getCoreSession().acknowledge();
- jbm = JBossMessage.createMessage(message, session.getDelegate());
+ jbm = JBossMessage.createMessage(message, session.getCoreSession());
try
{
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossMessageProducer.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -429,7 +429,7 @@
try
{
- producer.send(address, jbm.getDelegate());
+ producer.send(address, jbm.getCoreMessage());
}
catch (MessagingException e)
{
Modified: trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/client/JBossSession.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -763,7 +763,7 @@
return "JBossSession->" + session;
}
- public ClientSession getDelegate()
+ public ClientSession getCoreSession()
{
return session;
}
Modified: trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/src/main/org/jboss/messaging/jms/client/JMSMessageListenerWrapper.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -62,7 +62,7 @@
*/
public void onMessage(final ClientMessage message)
{
- JBossMessage jbm = JBossMessage.createMessage(message, session.getDelegate());
+ JBossMessage jbm = JBossMessage.createMessage(message, session.getCoreSession());
try
{
@@ -79,7 +79,7 @@
{
try
{
- session.getDelegate().acknowledge();
+ session.getCoreSession().acknowledge();
}
catch (MessagingException e)
{
@@ -101,7 +101,7 @@
{
try
{
- session.getDelegate().rollback();
+ session.getCoreSession().rollback();
session.setRecoverCalled(true);
}
@@ -117,9 +117,9 @@
try
{
//We don't want to call this if the connection/session was closed from inside onMessage
- if (!session.getDelegate().isClosed())
+ if (!session.getCoreSession().isClosed())
{
- session.getDelegate().acknowledge();
+ session.getCoreSession().acknowledge();
}
}
catch (MessagingException e)
Modified: trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/jms-tests/src/org/jboss/test/messaging/jms/message/JMSExpirationHeaderTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -193,7 +193,7 @@
JBossMessage jbm = (JBossMessage)m;
- if (!jbm.getDelegate().isExpired())
+ if (!jbm.getCoreMessage().isExpired())
{
log.error("The message " + m + " should have expired");
testFailed = true;
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/jms/server/impl/JMSServerManagerimplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -232,7 +232,7 @@
jmsServerManager.createConnectionFactory("newtestcf", "anid", 100, 1000, -1, 1000, -1, false, false, true, "newtestcf");
JBossConnectionFactory jbcf = (JBossConnectionFactory) initialContext.lookup("newtestcf");
assertNotNull(jbcf);
- assertNotNull(jbcf.getDelegate());
+ assertNotNull(jbcf.getCoreConnection());
jmsServerManager.destroyConnectionFactory("newtestcf");
try
{
@@ -249,10 +249,10 @@
jmsServerManager.createConnectionFactory("newtestcf", "anid", 100, 1000, -1, 1000, -1, false, false, true, bindings);
jbcf = (JBossConnectionFactory) initialContext.lookup("newtestcf");
assertNotNull(jbcf);
- assertNotNull(jbcf.getDelegate());
+ assertNotNull(jbcf.getCoreConnection());
jbcf = (JBossConnectionFactory) initialContext.lookup("oranewtestcf");
assertNotNull(jbcf);
- assertNotNull(jbcf.getDelegate());
+ assertNotNull(jbcf.getCoreConnection());
jmsServerManager.destroyConnectionFactory("newtestcf");
try
{
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ConnectionParamsImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ConnectionParamsImplTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/ConnectionParamsImplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -22,6 +22,11 @@
package org.jboss.messaging.tests.unit.core.client.impl;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
import org.jboss.messaging.core.client.ConnectionParams;
import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
import org.jboss.messaging.tests.util.RandomUtil;
@@ -151,6 +156,58 @@
}
}
+ public void testSerialize() throws Exception
+ {
+ ConnectionParams cp = new ConnectionParamsImpl();
+
+ boolean b = RandomUtil.randomBoolean();
+ cp.setInVMOptimisationEnabled(b);
+
+ b = RandomUtil.randomBoolean();
+ cp.setSSLEnabled(b);
+
+ b = RandomUtil.randomBoolean();
+ cp.setTcpNoDelay(b);
+
+ int i = RandomUtil.randomInt();
+ cp.setCallTimeout(i);
+
+ long l = RandomUtil.randomLong();
+ cp.setPingInterval(l);
+
+ l = RandomUtil.randomLong();
+ cp.setPingTimeout(l);
+
+ i = RandomUtil.randomInt();
+ cp.setTcpReceiveBufferSize(i);
+
+ i = RandomUtil.randomInt();
+ cp.setTcpSendBufferSize(i);
+
+ String s = RandomUtil.randomString();
+ cp.setKeyStorePath(s);
+
+ s = RandomUtil.randomString();
+ cp.setKeyStorePassword(s);
+
+ s = RandomUtil.randomString();
+ cp.setTrustStorePath(s);
+
+ s = RandomUtil.randomString();
+ cp.setTrustStorePassword(s);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(cp);
+ oos.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ ConnectionParamsImpl cp2 = (ConnectionParamsImpl)ois.readObject();
+
+ assertTrue(cp.equals(cp2));
+ }
+
// Private -----------------------------------------------------------------------------------------------------------
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LocationImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LocationImplTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/client/impl/LocationImplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -25,9 +25,16 @@
import static org.jboss.messaging.core.remoting.TransportType.HTTP;
import static org.jboss.messaging.core.remoting.TransportType.INVM;
import static org.jboss.messaging.core.remoting.TransportType.TCP;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
import junit.framework.TestCase;
import org.jboss.messaging.core.client.Location;
+import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
import org.jboss.messaging.core.client.impl.LocationImpl;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.remoting.TransportType;
@@ -93,6 +100,22 @@
assertNotSame(new LocationImpl(HTTP, "localhost", 9000), new LocationImpl(TCP, "localhost", 9000));
assertNotSame(new LocationImpl(HTTP, "localhost", 9000), new LocationImpl(43));
}
+
+ public void testSerialize() throws Exception
+ {
+ Location location = new LocationImpl(HTTP, "blahblah", 65126512);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(location);
+ oos.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ LocationImpl location2 = (LocationImpl)ois.readObject();
+
+ assertTrue(location.equals(location2));
+ }
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/config/impl/ConfigurationImplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -27,12 +27,17 @@
import static org.jboss.messaging.tests.util.RandomUtil.randomLong;
import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
import java.util.List;
import junit.framework.TestCase;
import org.jboss.messaging.core.client.ConnectionParams;
import org.jboss.messaging.core.client.impl.ConnectionParamsImpl;
+import org.jboss.messaging.core.client.impl.LocationImpl;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.remoting.TransportType;
@@ -234,6 +239,103 @@
testOverrideWithSystemProperties(true);
}
+ public void testSerialize() throws Exception
+ {
+ boolean b = randomBoolean();
+ conf.setClustered(b);
+
+ int i = randomInt();
+ conf.setScheduledThreadPoolMaxSize(i);
+
+ i = randomInt();
+ conf.setThreadPoolMaxSize(i);
+
+ String s = randomString();
+ conf.setHost(s);
+
+ i = randomInt() % 3;
+ TransportType transport = i == 0 ? TransportType.TCP : i == 1 ? TransportType.HTTP : i == 2 ? TransportType.INVM : TransportType.INVM;
+ conf.setTransport(transport);
+
+ i = randomInt();
+ conf.setPort(i);
+
+ long l = randomLong();
+ conf.setSecurityInvalidationInterval(l);
+
+ b = randomBoolean();
+ conf.setRequireDestinations(b);
+
+ b = randomBoolean();
+ conf.setSecurityEnabled(b);
+
+ b = randomBoolean();
+ conf.setSSLEnabled(b);
+
+ s = randomString();
+ conf.setKeyStorePath(s);
+
+ s = randomString();
+ conf.setKeyStorePassword(s);
+
+ s = randomString();
+ conf.setTrustStorePath(s);
+
+ s = randomString();
+ conf.setTrustStorePassword(s);
+
+ s = randomString();
+ conf.setBindingsDirectory(s);
+
+ b = randomBoolean();
+ conf.setCreateBindingsDir(b);
+
+ s = randomString();
+ conf.setJournalDirectory(s);
+
+ b = randomBoolean();
+ conf.setCreateJournalDir(b);
+
+ i = randomInt() % 3;
+ JournalType journal = i == 0 ? JournalType.ASYNCIO : i == 1 ? JournalType.JDBC : i == 2 ? JournalType.NIO : JournalType.NIO;
+ conf.setJournalType(journal);
+
+ b = randomBoolean();
+ conf.setJournalSyncTransactional(b);
+
+ b = randomBoolean();
+ conf.setJournalSyncNonTransactional(b);
+
+ i = randomInt();
+ conf.setJournalFileSize(i);
+
+ i = randomInt();
+ conf.setJournalMinFiles(i);
+
+ i = randomInt();
+ conf.setJournalMaxAIO(i);
+
+ l = randomLong();
+ conf.setJournalAIOTimeout(l);
+
+ l = randomLong();
+ conf.setJournalTaskPeriod(l);
+
+ i = randomInt();
+ conf.setServerID(i);
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(conf);
+ oos.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ Configuration conf2 = (Configuration)ois.readObject();
+
+ assertTrue(conf.equals(conf2));
+ }
+
// Protected ----------------------------------------------------------------------------------------
protected void setUp() throws Exception
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/MessagingXidTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/MessagingXidTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/MessagingXidTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.tests.unit.core.transaction.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import javax.transaction.xa.Xid;
-
-import org.jboss.messaging.core.transaction.impl.XidImpl;
-import org.jboss.messaging.tests.util.RandomUtil;
-import org.jboss.messaging.tests.util.UnitTestCase;
-
-/**
- *
- * A MessagingXidTest
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class MessagingXidTest extends UnitTestCase
-{
- public void testSerialize() throws Exception
- {
- XidImpl xid = new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(),
- RandomUtil.randomBytes());
-
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- ObjectOutputStream oos = new ObjectOutputStream(baos);
-
- oos.writeObject(xid);
-
- oos.flush();
-
- ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
-
- Object obj = ois.readObject();
-
- assertTrue(obj instanceof XidImpl);
-
- XidImpl xid2 = (XidImpl)obj;
-
- assertXidsEquivalent(xid, xid2);
-
- assertEquals(xid, xid2);
- }
-
- public void testStandardConstructor()
- {
- byte[] bq = RandomUtil.randomBytes();
-
- byte[] globalTXID = RandomUtil.randomBytes();
-
- int formatID = RandomUtil.randomInt();
-
- XidImpl xid1 = new XidImpl(bq, formatID, globalTXID);
-
- assertByteArraysEquivalent(bq, xid1.getBranchQualifier());
-
- assertByteArraysEquivalent(globalTXID, xid1.getGlobalTransactionId());
-
- assertEquals(formatID, xid1.getFormatId());
- }
-
- public void testCopyConstructor()
- {
- XidImpl xid1 = new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(),
- RandomUtil.randomBytes());
-
- XidImpl xid2 = new XidImpl(xid1);
-
- assertXidsEquivalent(xid1, xid2);
-
- assertEquals(xid2, xid2);
- }
-
- public void testEqualsWithForeign()
- {
- XidImpl xid1 = new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(),
- RandomUtil.randomBytes());
-
- Xid foreign = new ForeignXid(xid1.getBranchQualifier(), xid1.getFormatId(), xid1.getGlobalTransactionId());
-
- assertTrue(xid1.equals(foreign));
-
- foreign = new ForeignXid(RandomUtil.randomBytes(), RandomUtil.randomInt(),
- RandomUtil.randomBytes());
-
- assertFalse(xid1.equals(foreign));
-
- }
-
- // Private ---------------------------------------------------------------------------------
-
- private void assertXidsEquivalent(Xid xid1, Xid xid2)
- {
- assertByteArraysEquivalent(xid1.getBranchQualifier(), xid2.getBranchQualifier());
-
- assertEquals(xid1.getFormatId(), xid2.getFormatId());
-
- assertByteArraysEquivalent(xid1.getGlobalTransactionId(), xid2.getGlobalTransactionId());
- }
-
- // Inner classes ---------------------------------------------------------------------------
-
- class ForeignXid implements Xid
- {
- private byte[] branchQualifier;
-
- private int formatId;
-
- private byte[] globalTransactionId;
-
- public ForeignXid(byte[] branchQualifier, int formatId, byte[] globalTransactionId)
- {
- this.branchQualifier = branchQualifier;
- this.formatId = formatId;
- this.globalTransactionId = globalTransactionId;
- }
-
- public byte[] getBranchQualifier()
- {
- return this.branchQualifier;
- }
-
- public int getFormatId()
- {
- return this.formatId;
- }
-
- public byte[] getGlobalTransactionId()
- {
- return this.globalTransactionId;
- }
-
- }
-
-
-}
Copied: trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java (from rev 4574, trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionImplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -0,0 +1,665 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.unit.core.transaction.impl;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomXid;
+
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+
+import javax.transaction.xa.Xid;
+
+import org.easymock.EasyMock;
+import org.jboss.messaging.core.persistence.StorageManager;
+import org.jboss.messaging.core.postoffice.PostOffice;
+import org.jboss.messaging.core.server.MessageReference;
+import org.jboss.messaging.core.server.Queue;
+import org.jboss.messaging.core.server.ServerMessage;
+import org.jboss.messaging.core.server.impl.QueueImpl;
+import org.jboss.messaging.core.settings.HierarchicalRepository;
+import org.jboss.messaging.core.settings.impl.HierarchicalObjectRepository;
+import org.jboss.messaging.core.settings.impl.QueueSettings;
+import org.jboss.messaging.core.transaction.Transaction;
+import org.jboss.messaging.core.transaction.impl.TransactionImpl;
+import org.jboss.messaging.tests.util.UnitTestCase;
+import org.jboss.messaging.util.SimpleString;
+
+/**
+ *
+ * A TransactionImplTest
+ *
+ * TODO test with persistent and non persistent
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class TransactionImplTest extends UnitTestCase
+{
+ private final ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
+
+ private final HierarchicalRepository<QueueSettings> queueSettings =
+ new HierarchicalObjectRepository<QueueSettings>();
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ queueSettings.setDefault(new QueueSettings());
+ }
+
+ public void testNonXAConstructor() throws Exception
+ {
+ StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
+
+ PostOffice po = EasyMock.createStrictMock(PostOffice.class);
+
+ final long txID = 123L;
+
+ EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
+
+ EasyMock.replay(sm);
+
+ Transaction tx = new TransactionImpl(sm, po);
+
+ EasyMock.verify(sm);
+
+ assertEquals(txID, tx.getID());
+
+ assertNull(tx.getXid());
+
+ assertEquals(0, tx.getAcknowledgementsCount());
+
+ assertTrue(tx.isEmpty());
+ }
+
+ public void testXAConstructor() throws Exception
+ {
+ StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
+
+ PostOffice po = EasyMock.createStrictMock(PostOffice.class);
+
+ final long txID = 123L;
+
+ EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
+
+ EasyMock.replay(sm);
+
+ Xid xid = randomXid();
+
+ Transaction tx = new TransactionImpl(xid, sm, po);
+
+ EasyMock.verify(sm);
+
+ assertEquals(txID, tx.getID());
+
+ assertEquals(xid, tx.getXid());
+
+ assertEquals(0, tx.getAcknowledgementsCount());
+
+ assertTrue(tx.isEmpty());
+ }
+
+ public void testState() throws Exception
+ {
+ Transaction tx = createTransaction();
+
+ assertEquals(Transaction.State.ACTIVE, tx.getState());
+
+ tx.suspend();
+
+ assertEquals(Transaction.State.SUSPENDED, tx.getState());
+
+ tx.resume();
+
+ assertEquals(Transaction.State.ACTIVE, tx.getState());
+
+ tx.commit();
+
+ assertEquals(Transaction.State.COMMITTED, tx.getState());
+
+ HierarchicalRepository<QueueSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
+
+ try
+ {
+ tx.rollback(repos);
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.commit();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.prepare();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.suspend();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.resume();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ tx = createTransaction();
+
+ assertEquals(Transaction.State.ACTIVE, tx.getState());
+
+ tx.rollback(repos);
+
+ try
+ {
+ tx.rollback(repos);
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.commit();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.prepare();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.suspend();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.resume();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ tx = createTransaction();
+
+ assertEquals(Transaction.State.ACTIVE, tx.getState());
+
+ try
+ {
+ tx.prepare();
+
+ fail("Should throw exception");
+ }
+ catch (Exception e)
+ {
+ //OK
+ }
+
+
+ tx = createTransactionXA();
+
+ assertEquals(Transaction.State.ACTIVE, tx.getState());
+
+ tx.prepare();
+
+ tx.commit();
+
+ try
+ {
+ tx.rollback(repos);
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.commit();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.prepare();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.suspend();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.resume();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ tx = createTransactionXA();
+
+ assertEquals(Transaction.State.ACTIVE, tx.getState());
+
+ tx.prepare();
+
+ tx.rollback(repos);
+
+ try
+ {
+ tx.rollback(repos);
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.commit();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.prepare();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.suspend();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+
+ try
+ {
+ tx.resume();
+
+ fail("Should throw exception");
+ }
+ catch (IllegalStateException e)
+ {
+ //OK
+ }
+ }
+
+// public void testSendCommit() throws Exception
+// {
+// //Durable queue
+// Queue queue1 = new QueueImpl(12, new SimpleString("queue1"), null, false, true, false, -1, scheduledExecutor);
+//
+// //Durable queue
+// Queue queue2 = new QueueImpl(34, new SimpleString("queue2"), null, false, true, false, -1, scheduledExecutor);
+//
+// //Non durable queue
+// Queue queue3 = new QueueImpl(65, new SimpleString("queue3"), null, false, false, false, -1, scheduledExecutor);
+//
+// //Durable message to send
+//
+// Message message1 = this.generateMessage(1);
+//
+// // Non durable message to send
+//
+// Message message2 = this.generateMessage(2);
+//
+// message2.setDurable(false);
+//
+//
+// StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
+//
+// PostOffice po= EasyMock.createStrictMock(PostOffice.class);
+//
+// final long txID = 123;
+//
+// EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
+//
+// EasyMock.replay(sm);
+//
+// Transaction tx = new TransactionImpl(sm, po);
+//
+// assertTrue(tx.isEmpty());
+// assertFalse(tx.isContainsPersistent());
+//
+// EasyMock.verify(sm);
+//
+// EasyMock.reset(sm);
+//
+// final SimpleString address1 = new SimpleString("topic1");
+//
+// //Expect:
+//
+// MessageReference ref5 = message1.createReference(queue1);
+// MessageReference ref6 = message1.createReference(queue2);
+// List<MessageReference> message1Refs = new ArrayList<MessageReference>();
+// message1Refs.add(ref5);
+// message1Refs.add(ref6);
+//
+// EasyMock.expect(po.route(address1, message1)).andReturn(message1Refs);
+//
+// sm.storeMessageTransactional(txID, address1, message1);
+//
+// EasyMock.replay(po);
+//
+// EasyMock.replay(sm);
+//
+// tx.addMessage(address1, message1);
+//
+// assertFalse(tx.isEmpty());
+// assertTrue(tx.isContainsPersistent());
+//
+//
+// EasyMock.verify(po);
+//
+// EasyMock.verify(sm);
+//
+// EasyMock.reset(po);
+//
+// EasyMock.reset(sm);
+//
+//
+// //Expect:
+//
+// final SimpleString address2 = new SimpleString("queue3");
+//
+// MessageReference ref7 = message2.createReference(queue3);
+// List<MessageReference> message2Refs = new ArrayList<MessageReference>();
+// message2Refs.add(ref7);
+//
+// EasyMock.expect(po.route(address2, message2)).andReturn(message1Refs);
+//
+// EasyMock.replay(po);
+//
+// EasyMock.replay(sm);
+//
+// tx.addMessage(address2, message2);
+//
+// EasyMock.verify(po);
+//
+// EasyMock.verify(sm);
+//
+// EasyMock.reset(po);
+//
+// EasyMock.reset(sm);
+//
+// //Expect :
+//
+// sm.commit(txID);
+//
+// EasyMock.replay(sm);
+//
+// tx.commit();
+//
+// EasyMock.verify(sm);
+//
+// //TODO test messages are routed and refs count reduced
+// }
+
+
+
+ public void testAckCommit() throws Exception
+ {
+ //Durable queue
+ Queue queue1 = new QueueImpl(12, new SimpleString("queue1"), null, false, true, false, -1, scheduledExecutor);
+
+ //Durable queue
+ Queue queue2 = new QueueImpl(34, new SimpleString("queue2"), null, false, true, false, -1, scheduledExecutor);
+
+ //Non durable queue
+ Queue queue3 = new QueueImpl(65, new SimpleString("queue3"), null, false, false, false, -1, scheduledExecutor);
+
+ //Some refs to ack
+
+ ServerMessage message1 = this.generateMessage(12);
+
+ MessageReference ref1 = message1.createReference(queue1);
+
+ MessageReference ref2 = message1.createReference(queue2);
+
+ MessageReference ref3 = message1.createReference(queue3);
+
+
+ //Non durable message to ack
+ ServerMessage message2 = this.generateMessage(23);
+
+ message2.setDurable(false);
+
+ MessageReference ref4 = message2.createReference(queue1);
+
+
+ StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
+
+ PostOffice po= EasyMock.createStrictMock(PostOffice.class);
+
+ final long txID = 123;
+
+ EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
+
+ EasyMock.replay(sm);
+
+ Transaction tx = new TransactionImpl(sm, po);
+
+ assertTrue(tx.isEmpty());
+
+ assertFalse(tx.isContainsPersistent());
+
+ EasyMock.verify(sm);
+
+ EasyMock.reset(sm);
+
+ //Expect:
+
+ sm.storeAcknowledgeTransactional(txID, queue1.getPersistenceID(), message1.getMessageID());
+ sm.storeDeleteTransactional(txID, message1.getMessageID());
+
+ EasyMock.replay(sm);
+
+ tx.addAcknowledgement(ref3);
+
+ assertFalse(tx.isEmpty());
+ assertFalse(tx.isContainsPersistent());
+
+ tx.addAcknowledgement(ref1);
+
+ assertTrue(tx.isContainsPersistent());
+
+ tx.addAcknowledgement(ref2);
+
+ assertTrue(tx.isContainsPersistent());
+
+
+ assertEquals(3, tx.getAcknowledgementsCount());
+
+ EasyMock.verify(sm);
+
+ EasyMock.reset(sm);
+
+ //Expect:
+
+ //Nothing
+
+ EasyMock.replay(sm);
+
+ tx.addAcknowledgement(ref4);
+
+ assertEquals(4, tx.getAcknowledgementsCount());
+
+ EasyMock.verify(sm);
+
+ EasyMock.reset(sm);
+
+ //Expect:
+
+ sm.commit(txID);
+
+ EasyMock.replay(sm);
+
+ tx.commit();
+
+ EasyMock.verify(sm);
+
+ EasyMock.reset(sm);
+
+ //TODO test messages are routed and refs count reduced
+ }
+
+ // Private -------------------------------------------------------------------------
+
+ private Transaction createTransaction()
+ {
+ StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
+
+ PostOffice po = EasyMock.createStrictMock(PostOffice.class);
+
+ final long txID = 123L;
+
+ EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
+
+ EasyMock.replay(sm);
+
+ Transaction tx = new TransactionImpl(sm, po);
+
+ EasyMock.verify(sm);
+
+ return tx;
+ }
+
+ private Transaction createTransactionXA()
+ {
+ StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
+
+ PostOffice po = EasyMock.createStrictMock(PostOffice.class);
+
+ final long txID = 123L;
+
+ EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
+
+ EasyMock.replay(sm);
+
+ Xid xid = randomXid();
+
+ Transaction tx = new TransactionImpl(xid, sm, po);
+
+ EasyMock.verify(sm);
+
+ return tx;
+ }
+
+
+ // Inner classes -----------------------------------------------------------------------
+
+}
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/TransactionTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -1,665 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.tests.unit.core.transaction.impl;
-
-import static org.jboss.messaging.tests.util.RandomUtil.randomXid;
-
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-
-import javax.transaction.xa.Xid;
-
-import org.easymock.EasyMock;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.MessageReference;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.server.ServerMessage;
-import org.jboss.messaging.core.server.impl.QueueImpl;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.HierarchicalObjectRepository;
-import org.jboss.messaging.core.settings.impl.QueueSettings;
-import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.core.transaction.impl.TransactionImpl;
-import org.jboss.messaging.tests.util.UnitTestCase;
-import org.jboss.messaging.util.SimpleString;
-
-/**
- *
- * A TransactionTest
- *
- * TODO test with persistent and non persistent
- *
- * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
- *
- */
-public class TransactionTest extends UnitTestCase
-{
- private final ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
-
- private final HierarchicalRepository<QueueSettings> queueSettings =
- new HierarchicalObjectRepository<QueueSettings>();
-
- protected void setUp() throws Exception
- {
- super.setUp();
-
- queueSettings.setDefault(new QueueSettings());
- }
-
- public void testNonXAConstructor() throws Exception
- {
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-
- PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-
- final long txID = 123L;
-
- EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
-
- EasyMock.replay(sm);
-
- Transaction tx = new TransactionImpl(sm, po);
-
- EasyMock.verify(sm);
-
- assertEquals(txID, tx.getID());
-
- assertNull(tx.getXid());
-
- assertEquals(0, tx.getAcknowledgementsCount());
-
- assertTrue(tx.isEmpty());
- }
-
- public void testXAConstructor() throws Exception
- {
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-
- PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-
- final long txID = 123L;
-
- EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
-
- EasyMock.replay(sm);
-
- Xid xid = randomXid();
-
- Transaction tx = new TransactionImpl(xid, sm, po);
-
- EasyMock.verify(sm);
-
- assertEquals(txID, tx.getID());
-
- assertEquals(xid, tx.getXid());
-
- assertEquals(0, tx.getAcknowledgementsCount());
-
- assertTrue(tx.isEmpty());
- }
-
- public void testState() throws Exception
- {
- Transaction tx = createTransaction();
-
- assertEquals(Transaction.State.ACTIVE, tx.getState());
-
- tx.suspend();
-
- assertEquals(Transaction.State.SUSPENDED, tx.getState());
-
- tx.resume();
-
- assertEquals(Transaction.State.ACTIVE, tx.getState());
-
- tx.commit();
-
- assertEquals(Transaction.State.COMMITTED, tx.getState());
-
- HierarchicalRepository<QueueSettings> repos = EasyMock.createStrictMock(HierarchicalRepository.class);
-
- try
- {
- tx.rollback(repos);
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.commit();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.prepare();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.suspend();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.resume();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- tx = createTransaction();
-
- assertEquals(Transaction.State.ACTIVE, tx.getState());
-
- tx.rollback(repos);
-
- try
- {
- tx.rollback(repos);
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.commit();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.prepare();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.suspend();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.resume();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- tx = createTransaction();
-
- assertEquals(Transaction.State.ACTIVE, tx.getState());
-
- try
- {
- tx.prepare();
-
- fail("Should throw exception");
- }
- catch (Exception e)
- {
- //OK
- }
-
-
- tx = createTransactionXA();
-
- assertEquals(Transaction.State.ACTIVE, tx.getState());
-
- tx.prepare();
-
- tx.commit();
-
- try
- {
- tx.rollback(repos);
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.commit();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.prepare();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.suspend();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.resume();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- tx = createTransactionXA();
-
- assertEquals(Transaction.State.ACTIVE, tx.getState());
-
- tx.prepare();
-
- tx.rollback(repos);
-
- try
- {
- tx.rollback(repos);
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.commit();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.prepare();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.suspend();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
-
- try
- {
- tx.resume();
-
- fail("Should throw exception");
- }
- catch (IllegalStateException e)
- {
- //OK
- }
- }
-
-// public void testSendCommit() throws Exception
-// {
-// //Durable queue
-// Queue queue1 = new QueueImpl(12, new SimpleString("queue1"), null, false, true, false, -1, scheduledExecutor);
-//
-// //Durable queue
-// Queue queue2 = new QueueImpl(34, new SimpleString("queue2"), null, false, true, false, -1, scheduledExecutor);
-//
-// //Non durable queue
-// Queue queue3 = new QueueImpl(65, new SimpleString("queue3"), null, false, false, false, -1, scheduledExecutor);
-//
-// //Durable message to send
-//
-// Message message1 = this.generateMessage(1);
-//
-// // Non durable message to send
-//
-// Message message2 = this.generateMessage(2);
-//
-// message2.setDurable(false);
-//
-//
-// StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-//
-// PostOffice po= EasyMock.createStrictMock(PostOffice.class);
-//
-// final long txID = 123;
-//
-// EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
-//
-// EasyMock.replay(sm);
-//
-// Transaction tx = new TransactionImpl(sm, po);
-//
-// assertTrue(tx.isEmpty());
-// assertFalse(tx.isContainsPersistent());
-//
-// EasyMock.verify(sm);
-//
-// EasyMock.reset(sm);
-//
-// final SimpleString address1 = new SimpleString("topic1");
-//
-// //Expect:
-//
-// MessageReference ref5 = message1.createReference(queue1);
-// MessageReference ref6 = message1.createReference(queue2);
-// List<MessageReference> message1Refs = new ArrayList<MessageReference>();
-// message1Refs.add(ref5);
-// message1Refs.add(ref6);
-//
-// EasyMock.expect(po.route(address1, message1)).andReturn(message1Refs);
-//
-// sm.storeMessageTransactional(txID, address1, message1);
-//
-// EasyMock.replay(po);
-//
-// EasyMock.replay(sm);
-//
-// tx.addMessage(address1, message1);
-//
-// assertFalse(tx.isEmpty());
-// assertTrue(tx.isContainsPersistent());
-//
-//
-// EasyMock.verify(po);
-//
-// EasyMock.verify(sm);
-//
-// EasyMock.reset(po);
-//
-// EasyMock.reset(sm);
-//
-//
-// //Expect:
-//
-// final SimpleString address2 = new SimpleString("queue3");
-//
-// MessageReference ref7 = message2.createReference(queue3);
-// List<MessageReference> message2Refs = new ArrayList<MessageReference>();
-// message2Refs.add(ref7);
-//
-// EasyMock.expect(po.route(address2, message2)).andReturn(message1Refs);
-//
-// EasyMock.replay(po);
-//
-// EasyMock.replay(sm);
-//
-// tx.addMessage(address2, message2);
-//
-// EasyMock.verify(po);
-//
-// EasyMock.verify(sm);
-//
-// EasyMock.reset(po);
-//
-// EasyMock.reset(sm);
-//
-// //Expect :
-//
-// sm.commit(txID);
-//
-// EasyMock.replay(sm);
-//
-// tx.commit();
-//
-// EasyMock.verify(sm);
-//
-// //TODO test messages are routed and refs count reduced
-// }
-
-
-
- public void testAckCommit() throws Exception
- {
- //Durable queue
- Queue queue1 = new QueueImpl(12, new SimpleString("queue1"), null, false, true, false, -1, scheduledExecutor);
-
- //Durable queue
- Queue queue2 = new QueueImpl(34, new SimpleString("queue2"), null, false, true, false, -1, scheduledExecutor);
-
- //Non durable queue
- Queue queue3 = new QueueImpl(65, new SimpleString("queue3"), null, false, false, false, -1, scheduledExecutor);
-
- //Some refs to ack
-
- ServerMessage message1 = this.generateMessage(12);
-
- MessageReference ref1 = message1.createReference(queue1);
-
- MessageReference ref2 = message1.createReference(queue2);
-
- MessageReference ref3 = message1.createReference(queue3);
-
-
- //Non durable message to ack
- ServerMessage message2 = this.generateMessage(23);
-
- message2.setDurable(false);
-
- MessageReference ref4 = message2.createReference(queue1);
-
-
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-
- PostOffice po= EasyMock.createStrictMock(PostOffice.class);
-
- final long txID = 123;
-
- EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
-
- EasyMock.replay(sm);
-
- Transaction tx = new TransactionImpl(sm, po);
-
- assertTrue(tx.isEmpty());
-
- assertFalse(tx.isContainsPersistent());
-
- EasyMock.verify(sm);
-
- EasyMock.reset(sm);
-
- //Expect:
-
- sm.storeAcknowledgeTransactional(txID, queue1.getPersistenceID(), message1.getMessageID());
- sm.storeDeleteTransactional(txID, message1.getMessageID());
-
- EasyMock.replay(sm);
-
- tx.addAcknowledgement(ref3);
-
- assertFalse(tx.isEmpty());
- assertFalse(tx.isContainsPersistent());
-
- tx.addAcknowledgement(ref1);
-
- assertTrue(tx.isContainsPersistent());
-
- tx.addAcknowledgement(ref2);
-
- assertTrue(tx.isContainsPersistent());
-
-
- assertEquals(3, tx.getAcknowledgementsCount());
-
- EasyMock.verify(sm);
-
- EasyMock.reset(sm);
-
- //Expect:
-
- //Nothing
-
- EasyMock.replay(sm);
-
- tx.addAcknowledgement(ref4);
-
- assertEquals(4, tx.getAcknowledgementsCount());
-
- EasyMock.verify(sm);
-
- EasyMock.reset(sm);
-
- //Expect:
-
- sm.commit(txID);
-
- EasyMock.replay(sm);
-
- tx.commit();
-
- EasyMock.verify(sm);
-
- EasyMock.reset(sm);
-
- //TODO test messages are routed and refs count reduced
- }
-
- // Private -------------------------------------------------------------------------
-
- private Transaction createTransaction()
- {
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-
- PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-
- final long txID = 123L;
-
- EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
-
- EasyMock.replay(sm);
-
- Transaction tx = new TransactionImpl(sm, po);
-
- EasyMock.verify(sm);
-
- return tx;
- }
-
- private Transaction createTransactionXA()
- {
- StorageManager sm = EasyMock.createStrictMock(StorageManager.class);
-
- PostOffice po = EasyMock.createStrictMock(PostOffice.class);
-
- final long txID = 123L;
-
- EasyMock.expect(sm.generateTransactionID()).andReturn(txID);
-
- EasyMock.replay(sm);
-
- Xid xid = randomXid();
-
- Transaction tx = new TransactionImpl(xid, sm, po);
-
- EasyMock.verify(sm);
-
- return tx;
- }
-
-
- // Inner classes -----------------------------------------------------------------------
-
-}
Copied: trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/XidImplTest.java (from rev 4574, trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/MessagingXidTest.java)
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/XidImplTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/transaction/impl/XidImplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -0,0 +1,162 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.unit.core.transaction.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import javax.transaction.xa.Xid;
+
+import org.jboss.messaging.core.transaction.impl.XidImpl;
+import org.jboss.messaging.tests.util.RandomUtil;
+import org.jboss.messaging.tests.util.UnitTestCase;
+
+/**
+ *
+ * A XidImplTest
+ *
+ * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ *
+ */
+public class XidImplTest extends UnitTestCase
+{
+ public void testSerialize() throws Exception
+ {
+ XidImpl xid = new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(),
+ RandomUtil.randomBytes());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+
+ oos.writeObject(xid);
+
+ oos.flush();
+
+ ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray()));
+
+ Object obj = ois.readObject();
+
+ assertTrue(obj instanceof XidImpl);
+
+ XidImpl xid2 = (XidImpl)obj;
+
+ assertXidsEquivalent(xid, xid2);
+
+ assertEquals(xid, xid2);
+ }
+
+ public void testStandardConstructor()
+ {
+ byte[] bq = RandomUtil.randomBytes();
+
+ byte[] globalTXID = RandomUtil.randomBytes();
+
+ int formatID = RandomUtil.randomInt();
+
+ XidImpl xid1 = new XidImpl(bq, formatID, globalTXID);
+
+ assertByteArraysEquivalent(bq, xid1.getBranchQualifier());
+
+ assertByteArraysEquivalent(globalTXID, xid1.getGlobalTransactionId());
+
+ assertEquals(formatID, xid1.getFormatId());
+ }
+
+ public void testCopyConstructor()
+ {
+ XidImpl xid1 = new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(),
+ RandomUtil.randomBytes());
+
+ XidImpl xid2 = new XidImpl(xid1);
+
+ assertXidsEquivalent(xid1, xid2);
+
+ assertEquals(xid2, xid2);
+ }
+
+ public void testEqualsWithForeign()
+ {
+ XidImpl xid1 = new XidImpl(RandomUtil.randomBytes(), RandomUtil.randomInt(),
+ RandomUtil.randomBytes());
+
+ Xid foreign = new ForeignXid(xid1.getBranchQualifier(), xid1.getFormatId(), xid1.getGlobalTransactionId());
+
+ assertTrue(xid1.equals(foreign));
+
+ foreign = new ForeignXid(RandomUtil.randomBytes(), RandomUtil.randomInt(),
+ RandomUtil.randomBytes());
+
+ assertFalse(xid1.equals(foreign));
+
+ }
+
+ // Private ---------------------------------------------------------------------------------
+
+ private void assertXidsEquivalent(Xid xid1, Xid xid2)
+ {
+ assertByteArraysEquivalent(xid1.getBranchQualifier(), xid2.getBranchQualifier());
+
+ assertEquals(xid1.getFormatId(), xid2.getFormatId());
+
+ assertByteArraysEquivalent(xid1.getGlobalTransactionId(), xid2.getGlobalTransactionId());
+ }
+
+ // Inner classes ---------------------------------------------------------------------------
+
+ class ForeignXid implements Xid
+ {
+ private byte[] branchQualifier;
+
+ private int formatId;
+
+ private byte[] globalTransactionId;
+
+ public ForeignXid(byte[] branchQualifier, int formatId, byte[] globalTransactionId)
+ {
+ this.branchQualifier = branchQualifier;
+ this.formatId = formatId;
+ this.globalTransactionId = globalTransactionId;
+ }
+
+ public byte[] getBranchQualifier()
+ {
+ return this.branchQualifier;
+ }
+
+ public int getFormatId()
+ {
+ return this.formatId;
+ }
+
+ public byte[] getGlobalTransactionId()
+ {
+ return this.globalTransactionId;
+ }
+
+ }
+
+
+}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/core/version/impl/VersionImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/core/version/impl/VersionImplTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/core/version/impl/VersionImplTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -22,6 +22,11 @@
package org.jboss.messaging.tests.unit.core.version.impl;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
import junit.framework.TestCase;
import org.jboss.messaging.core.version.impl.VersionImpl;
@@ -65,16 +70,31 @@
public void testEquals() throws Exception
{
- VersionImpl version = new VersionImpl("JBM", 2, 0, 1, 10, "suffix");
- VersionImpl sameVersion = new VersionImpl("JBM", 2, 0, 1, 10, "suffix");
- VersionImpl differentVersion = new VersionImpl("JBM", 2, 0, 1, 11, "suffix");
-
- assertFalse(version.equals(new Object()));
-
- assertTrue(version.equals(version));
- assertTrue(version.equals(sameVersion));
- assertFalse(version.equals(differentVersion));
+ VersionImpl version = new VersionImpl("JBM", 2, 0, 1, 10, "suffix");
+ VersionImpl sameVersion = new VersionImpl("JBM", 2, 0, 1, 10, "suffix");
+ VersionImpl differentVersion = new VersionImpl("JBM", 2, 0, 1, 11, "suffix");
+
+ assertFalse(version.equals(new Object()));
+
+ assertTrue(version.equals(version));
+ assertTrue(version.equals(sameVersion));
+ assertFalse(version.equals(differentVersion));
}
+
+ public void testSerialize() throws Exception
+ {
+ VersionImpl version = new VersionImpl("uyiuy", 3, 7, 6, 12, "uhuhuh");
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(version);
+ oos.flush();
+
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ VersionImpl version2 = (VersionImpl)ois.readObject();
+
+ assertTrue(version.equals(version2));
+ }
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossBytesMessageTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -115,7 +115,7 @@
boolean value = randomBoolean();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putBoolean(value);
message.reset();
@@ -149,7 +149,7 @@
byte value = randomByte();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putByte(value);
message.reset();
@@ -185,7 +185,7 @@
byte[] value = randomBytes();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putBytes(value);
message.reset();
@@ -220,7 +220,7 @@
short value = randomShort();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putShort(value);
message.reset();
@@ -254,7 +254,7 @@
char value = randomChar();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putChar(value);
message.reset();
@@ -288,7 +288,7 @@
int value = randomInt();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putInt(value);
message.reset();
@@ -322,7 +322,7 @@
long value = randomLong();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putLong(value);
message.reset();
@@ -356,7 +356,7 @@
float value = randomFloat();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putFloat(value);
message.reset();
@@ -390,7 +390,7 @@
double value = randomDouble();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putDouble(value);
message.reset();
@@ -424,7 +424,7 @@
String value = randomString();
JBossBytesMessage message = new JBossBytesMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putUTF(value);
message.reset();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageConsumerTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -122,7 +122,7 @@
expect(clientSession.isClosed()).andReturn(true);
- expect(session.getDelegate()).andReturn(clientSession);
+ expect(session.getCoreSession()).andReturn(clientSession);
ClientConsumer clientConsumer = createStrictMock(ClientConsumer.class);
replay(session, clientSession, clientConsumer);
@@ -149,7 +149,7 @@
ClientSession clientSession = createStrictMock(ClientSession.class);
expect(session.getAcknowledgeMode()).andReturn(Session.AUTO_ACKNOWLEDGE);
expect(clientSession.isClosed()).andReturn(false);
- expect(session.getDelegate()).andReturn(clientSession);
+ expect(session.getCoreSession()).andReturn(clientSession);
ClientConsumer clientConsumer = createStrictMock(ClientConsumer.class);
replay(session, clientSession, clientConsumer);
@@ -221,7 +221,7 @@
ClientSession clientSession = createStrictMock(ClientSession.class);
expect(session.getAcknowledgeMode()).andReturn(Session.AUTO_ACKNOWLEDGE);
expect(clientSession.isClosed()).andReturn(false);
- expect(session.getDelegate()).andReturn(clientSession);
+ expect(session.getCoreSession()).andReturn(clientSession);
ClientConsumer clientConsumer = createStrictMock(ClientConsumer.class);
replay(session, clientSession, clientConsumer);
@@ -240,7 +240,7 @@
ClientSession clientSession = createStrictMock(ClientSession.class);
expect(session.getAcknowledgeMode()).andReturn(Session.AUTO_ACKNOWLEDGE);
expect(clientSession.isClosed()).andReturn(false);
- expect(session.getDelegate()).andReturn(clientSession);
+ expect(session.getCoreSession()).andReturn(clientSession);
ClientConsumer clientConsumer = createStrictMock(ClientConsumer.class);
clientConsumer.setMessageHandler(isA(MessageHandler.class));
MessageListener listener = createStrictMock(MessageListener.class);
@@ -346,7 +346,7 @@
ClientSession clientSession = createStrictMock(ClientSession.class);
expect(session.getAcknowledgeMode()).andReturn(Session.AUTO_ACKNOWLEDGE);
clientSession.acknowledge();
- expect(session.getDelegate()).andStubReturn(clientSession);
+ expect(session.getCoreSession()).andStubReturn(clientSession);
ClientConsumer clientConsumer = createStrictMock(ClientConsumer.class);
ClientMessage clientMessage = createStrictMock(ClientMessage.class);
expect(clientMessage.getType()).andReturn(JBossMessage.TYPE);
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossMessageTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -144,7 +144,7 @@
public void testGetJMSDeliveryModeAsPersistent() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().setDurable(true);
+ message.getCoreMessage().setDurable(true);
assertEquals(DeliveryMode.PERSISTENT, message.getJMSDeliveryMode());
}
@@ -152,7 +152,7 @@
public void testGetJMSDeliveryModeAsNonPersistent() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().setDurable(false);
+ message.getCoreMessage().setDurable(false);
assertEquals(DeliveryMode.NON_PERSISTENT, message.getJMSDeliveryMode());
}
@@ -162,7 +162,7 @@
JBossMessage message = new JBossMessage();
message.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
- assertTrue(message.getDelegate().isDurable());
+ assertTrue(message.getCoreMessage().isDurable());
}
public void testSetJMSDeliveryModeWithNonPersistent() throws Exception
@@ -170,7 +170,7 @@
JBossMessage message = new JBossMessage();
message.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
- assertFalse(message.getDelegate().isDurable());
+ assertFalse(message.getCoreMessage().isDurable());
}
public void testSetJMSDeliveryModeWithInvalidValue() throws Exception
@@ -190,13 +190,13 @@
{
JBossMessage message = new JBossMessage();
- message.getDelegate().setDeliveryCount(0);
+ message.getCoreMessage().setDeliveryCount(0);
assertFalse(message.getJMSRedelivered());
- message.getDelegate().setDeliveryCount(1);
+ message.getCoreMessage().setDeliveryCount(1);
assertFalse(message.getJMSRedelivered());
- message.getDelegate().setDeliveryCount(2);
+ message.getCoreMessage().setDeliveryCount(2);
assertTrue(message.getJMSRedelivered());
}
@@ -205,7 +205,7 @@
JBossMessage message = new JBossMessage();
message.setJMSRedelivered(true);
- assertEquals(2, message.getDelegate().getDeliveryCount());
+ assertEquals(2, message.getCoreMessage().getDeliveryCount());
}
public void testSetJMSRedeliveredToFalse() throws Exception
@@ -213,7 +213,7 @@
JBossMessage message = new JBossMessage();
message.setJMSRedelivered(false);
- assertEquals(1, message.getDelegate().getDeliveryCount());
+ assertEquals(1, message.getCoreMessage().getDeliveryCount());
}
public void testSetJMSType() throws Exception
@@ -222,7 +222,7 @@
JBossMessage message = new JBossMessage();
message.setJMSType(type);
- SimpleString t = (SimpleString) message.getDelegate().getProperty(JBossMessage.TYPE_HEADER_NAME);
+ SimpleString t = (SimpleString) message.getCoreMessage().getProperty(JBossMessage.TYPE_HEADER_NAME);
assertEquals(type, t.toString());
}
@@ -233,7 +233,7 @@
assertNull(message.getJMSType());
- message.getDelegate().putStringProperty(JBossMessage.TYPE_HEADER_NAME, new SimpleString(type));
+ message.getCoreMessage().putStringProperty(JBossMessage.TYPE_HEADER_NAME, new SimpleString(type));
assertEquals(type, message.getJMSType());
}
@@ -243,14 +243,14 @@
JBossMessage message = new JBossMessage();
message.setJMSTimestamp(timestamp);
- assertEquals(timestamp, message.getDelegate().getTimestamp());
+ assertEquals(timestamp, message.getCoreMessage().getTimestamp());
}
public void testGetJMSTimestamp() throws Exception
{
long timestamp = randomLong();
JBossMessage message = new JBossMessage();
- message.getDelegate().setTimestamp(timestamp);
+ message.getCoreMessage().setTimestamp(timestamp);
assertEquals(timestamp, message.getJMSTimestamp());
}
@@ -262,7 +262,7 @@
message.setJMSCorrelationID(correlationID);
- SimpleString value = (SimpleString) message.getDelegate().getProperty(JBossMessage.CORRELATIONID_HEADER_NAME);
+ SimpleString value = (SimpleString) message.getCoreMessage().getProperty(JBossMessage.CORRELATIONID_HEADER_NAME);
assertEquals(correlationID, value.toString());
}
@@ -272,7 +272,7 @@
JBossMessage message = new JBossMessage();
message.setJMSCorrelationID(null);
- assertFalse(message.getDelegate().containsProperty(JBossMessage.CORRELATIONID_HEADER_NAME));
+ assertFalse(message.getCoreMessage().containsProperty(JBossMessage.CORRELATIONID_HEADER_NAME));
}
public void testGetJMSCorrelationID() throws Exception
@@ -280,7 +280,7 @@
String correlationID = randomString();
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(JBossMessage.CORRELATIONID_HEADER_NAME, new SimpleString(correlationID));
+ message.getCoreMessage().putStringProperty(JBossMessage.CORRELATIONID_HEADER_NAME, new SimpleString(correlationID));
assertEquals(correlationID, message.getJMSCorrelationID());
}
@@ -293,7 +293,7 @@
message.setJMSCorrelationIDAsBytes(correlationID);
- byte[] value = (byte[]) message.getDelegate().getProperty(JBossMessage.CORRELATIONID_HEADER_NAME);
+ byte[] value = (byte[]) message.getCoreMessage().getProperty(JBossMessage.CORRELATIONID_HEADER_NAME);
assertEquals(correlationID, value);
}
@@ -303,7 +303,7 @@
byte[] correlationID = randomBytes();
JBossMessage message = new JBossMessage();
- message.getDelegate().putBytesProperty(JBossMessage.CORRELATIONID_HEADER_NAME, correlationID);
+ message.getCoreMessage().putBytesProperty(JBossMessage.CORRELATIONID_HEADER_NAME, correlationID);
assertEquals(correlationID, message.getJMSCorrelationIDAsBytes());
}
@@ -314,7 +314,7 @@
JBossMessage message = new JBossMessage();
message.setJMSPriority(priority);
- assertEquals(priority, message.getDelegate().getPriority());
+ assertEquals(priority, message.getCoreMessage().getPriority());
}
public void testSetInvalidPriority() throws Exception
@@ -337,7 +337,7 @@
int priority = 9;
JBossMessage message = new JBossMessage();
- message.getDelegate().setPriority((byte) priority);
+ message.getCoreMessage().setPriority((byte) priority);
assertEquals(priority, message.getJMSPriority());
}
@@ -347,7 +347,7 @@
JBossMessage message = new JBossMessage();
message.setJMSExpiration(expiration);
- assertEquals(expiration, message.getDelegate().getExpiration());
+ assertEquals(expiration, message.getCoreMessage().getExpiration());
}
public void testGetJMSExpiration() throws Exception
@@ -355,7 +355,7 @@
long expiration = randomLong();
JBossMessage message = new JBossMessage();
- message.getDelegate().setExpiration(expiration);
+ message.getCoreMessage().setExpiration(expiration);
assertEquals(expiration, message.getJMSExpiration());
}
@@ -490,7 +490,7 @@
JBossMessage message = new JBossMessage();
message.setBooleanProperty(propertyName, value);
- boolean v = (Boolean) message.getDelegate().getProperty(
+ boolean v = (Boolean) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -500,7 +500,7 @@
boolean value = true;
JBossMessage message = new JBossMessage();
- message.getDelegate().putBooleanProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putBooleanProperty(new SimpleString(propertyName), value);
boolean v = message.getBooleanProperty(propertyName);
assertEquals(value, v);
@@ -519,7 +519,7 @@
SimpleString value = new SimpleString("true");
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
boolean v = message.getBooleanProperty(propertyName);
assertEquals(true, v);
@@ -528,7 +528,7 @@
public void testGetBooleanPropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), randomFloat());
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), randomFloat());
try
{
@@ -546,7 +546,7 @@
JBossMessage message = new JBossMessage();
message.setByteProperty(propertyName, value);
- byte v = (Byte) message.getDelegate().getProperty(
+ byte v = (Byte) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -556,7 +556,7 @@
byte value = randomByte();
JBossMessage message = new JBossMessage();
- message.getDelegate().putByteProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putByteProperty(new SimpleString(propertyName), value);
byte v = message.getByteProperty(propertyName);
assertEquals(value, v);
@@ -581,7 +581,7 @@
SimpleString value = new SimpleString(Byte.toString(b));
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
byte v = message.getByteProperty(propertyName);
assertEquals(b, v);
@@ -590,7 +590,7 @@
public void testGetBytePropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), randomFloat());
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), randomFloat());
try
{
@@ -608,7 +608,7 @@
JBossMessage message = new JBossMessage();
message.setShortProperty(propertyName, value);
- short v = (Short) message.getDelegate().getProperty(
+ short v = (Short) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -618,7 +618,7 @@
short value = randomShort();
JBossMessage message = new JBossMessage();
- message.getDelegate().putShortProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putShortProperty(new SimpleString(propertyName), value);
short v = message.getShortProperty(propertyName);
assertEquals(value, v);
@@ -642,7 +642,7 @@
byte value = randomByte();
JBossMessage message = new JBossMessage();
- message.getDelegate().putByteProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putByteProperty(new SimpleString(propertyName), value);
short v = message.getShortProperty(propertyName);
assertEquals(value, v);
@@ -654,7 +654,7 @@
SimpleString value = new SimpleString(Short.toString(s));
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
short v = message.getShortProperty(propertyName);
assertEquals(s, v);
@@ -663,7 +663,7 @@
public void testGetShortPropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), randomFloat());
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), randomFloat());
try
{
@@ -681,7 +681,7 @@
JBossMessage message = new JBossMessage();
message.setIntProperty(propertyName, value);
- int v = (Integer) message.getDelegate().getProperty(
+ int v = (Integer) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -691,7 +691,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().putIntProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putIntProperty(new SimpleString(propertyName), value);
int v = message.getIntProperty(propertyName);
assertEquals(value, v);
@@ -702,7 +702,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().setDeliveryCount(value);
+ message.getCoreMessage().setDeliveryCount(value);
int v = message.getIntProperty(JBossMessage.JMSXDELIVERYCOUNT);
assertEquals(value, v);
@@ -725,7 +725,7 @@
byte value = randomByte();
JBossMessage message = new JBossMessage();
- message.getDelegate().putByteProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putByteProperty(new SimpleString(propertyName), value);
int v = message.getIntProperty(propertyName);
assertEquals(value, v);
@@ -736,7 +736,7 @@
short value = randomShort();
JBossMessage message = new JBossMessage();
- message.getDelegate().putShortProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putShortProperty(new SimpleString(propertyName), value);
int v = message.getIntProperty(propertyName);
assertEquals(value, v);
@@ -748,7 +748,7 @@
SimpleString value = new SimpleString(Integer.toString(i));
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
int v = message.getIntProperty(propertyName);
assertEquals(i, v);
@@ -757,7 +757,7 @@
public void testGetIntPropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), randomFloat());
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), randomFloat());
try
{
@@ -775,7 +775,7 @@
JBossMessage message = new JBossMessage();
message.setLongProperty(propertyName, value);
- long v = (Long) message.getDelegate().getProperty(
+ long v = (Long) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -785,7 +785,7 @@
long value = randomLong();
JBossMessage message = new JBossMessage();
- message.getDelegate().putLongProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putLongProperty(new SimpleString(propertyName), value);
long v = message.getLongProperty(propertyName);
assertEquals(value, v);
@@ -796,7 +796,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().setDeliveryCount(value);
+ message.getCoreMessage().setDeliveryCount(value);
long v = message.getLongProperty(JBossMessage.JMSXDELIVERYCOUNT);
assertEquals(value, v);
@@ -820,7 +820,7 @@
byte value = randomByte();
JBossMessage message = new JBossMessage();
- message.getDelegate().putByteProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putByteProperty(new SimpleString(propertyName), value);
long v = message.getLongProperty(propertyName);
assertEquals(value, v);
@@ -831,7 +831,7 @@
short value = randomShort();
JBossMessage message = new JBossMessage();
- message.getDelegate().putShortProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putShortProperty(new SimpleString(propertyName), value);
long v = message.getLongProperty(propertyName);
assertEquals(value, v);
@@ -842,7 +842,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().putIntProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putIntProperty(new SimpleString(propertyName), value);
long v = message.getLongProperty(propertyName);
assertEquals(value, v);
@@ -854,7 +854,7 @@
SimpleString value = new SimpleString(Long.toString(l));
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
long v = message.getLongProperty(propertyName);
assertEquals(l, v);
@@ -863,7 +863,7 @@
public void testGetLongPropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), randomFloat());
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), randomFloat());
try
{
@@ -881,7 +881,7 @@
JBossMessage message = new JBossMessage();
message.setFloatProperty(propertyName, value);
- float v = (Float) message.getDelegate().getProperty(
+ float v = (Float) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -891,7 +891,7 @@
float value = randomFloat();
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), value);
float v = message.getFloatProperty(propertyName);
assertEquals(value, v);
@@ -916,7 +916,7 @@
SimpleString value = new SimpleString(Float.toString(f));
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
float v = message.getFloatProperty(propertyName);
assertEquals(f, v);
@@ -925,7 +925,7 @@
public void testGetFloatPropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putBooleanProperty(new SimpleString(propertyName), true);
+ message.getCoreMessage().putBooleanProperty(new SimpleString(propertyName), true);
try
{
@@ -943,7 +943,7 @@
JBossMessage message = new JBossMessage();
message.setDoubleProperty(propertyName, value);
- double v = (Double) message.getDelegate().getProperty(
+ double v = (Double) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -953,7 +953,7 @@
double value = randomDouble();
JBossMessage message = new JBossMessage();
- message.getDelegate().putDoubleProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putDoubleProperty(new SimpleString(propertyName), value);
double v = message.getDoubleProperty(propertyName);
assertEquals(value, v);
@@ -977,7 +977,7 @@
float value = randomFloat();
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), value);
double v = message.getDoubleProperty(propertyName);
assertEquals(Float.valueOf(value).doubleValue(), v);
@@ -989,7 +989,7 @@
SimpleString value = new SimpleString(Double.toString(d));
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), value);
double v = message.getDoubleProperty(propertyName);
assertEquals(d, v);
@@ -998,7 +998,7 @@
public void testGetDoublePropertyWithInvalidType() throws Exception
{
JBossMessage message = new JBossMessage();
- message.getDelegate().putBooleanProperty(new SimpleString(propertyName), true);
+ message.getCoreMessage().putBooleanProperty(new SimpleString(propertyName), true);
try
{
@@ -1016,7 +1016,7 @@
JBossMessage message = new JBossMessage();
message.setStringProperty(propertyName, value);
- SimpleString v = (SimpleString) message.getDelegate().getProperty(
+ SimpleString v = (SimpleString) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v.toString());
}
@@ -1026,7 +1026,7 @@
String value = randomString();
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), new SimpleString(value));
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), new SimpleString(value));
String v = message.getStringProperty(propertyName);
assertEquals(value, v);
@@ -1037,7 +1037,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().setDeliveryCount(value);
+ message.getCoreMessage().setDeliveryCount(value);
String v = message.getStringProperty(JBossMessage.JMSXDELIVERYCOUNT);
assertEquals(Integer.toString(value), v);
@@ -1056,7 +1056,7 @@
boolean value = true;
JBossMessage message = new JBossMessage();
- message.getDelegate().putBooleanProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putBooleanProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Boolean.toString(value), v);
@@ -1067,7 +1067,7 @@
byte value = randomByte();
JBossMessage message = new JBossMessage();
- message.getDelegate().putByteProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putByteProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Byte.toString(value), v);
@@ -1078,7 +1078,7 @@
short value = randomShort();
JBossMessage message = new JBossMessage();
- message.getDelegate().putShortProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putShortProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Short.toString(value), v);
@@ -1089,7 +1089,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().putIntProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putIntProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Integer.toString(value), v);
@@ -1100,7 +1100,7 @@
long value = randomLong();
JBossMessage message = new JBossMessage();
- message.getDelegate().putLongProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putLongProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Long.toString(value), v);
@@ -1111,7 +1111,7 @@
float value = randomFloat();
JBossMessage message = new JBossMessage();
- message.getDelegate().putFloatProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putFloatProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Float.toString(value), v);
@@ -1122,7 +1122,7 @@
double value = randomDouble();
JBossMessage message = new JBossMessage();
- message.getDelegate().putDoubleProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putDoubleProperty(new SimpleString(propertyName), value);
String v = message.getStringProperty(propertyName);
assertEquals(Double.toString(value), v);
@@ -1135,7 +1135,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- boolean v = (Boolean) message.getDelegate().getProperty(
+ boolean v = (Boolean) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1147,7 +1147,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- byte v = (Byte) message.getDelegate().getProperty(
+ byte v = (Byte) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1159,7 +1159,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- short v = (Short) message.getDelegate().getProperty(
+ short v = (Short) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1171,7 +1171,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- int v = (Integer) message.getDelegate().getProperty(
+ int v = (Integer) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1183,7 +1183,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- long v = (Long) message.getDelegate().getProperty(
+ long v = (Long) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1195,7 +1195,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- float v = (Float) message.getDelegate().getProperty(
+ float v = (Float) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1207,7 +1207,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- double v = (Double) message.getDelegate().getProperty(
+ double v = (Double) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v);
}
@@ -1219,7 +1219,7 @@
JBossMessage message = new JBossMessage();
message.setObjectProperty(propertyName, value);
- SimpleString v = (SimpleString) message.getDelegate().getProperty(
+ SimpleString v = (SimpleString) message.getCoreMessage().getProperty(
new SimpleString(propertyName));
assertEquals(value, v.toString());
}
@@ -1242,7 +1242,7 @@
double value = randomDouble();
JBossMessage message = new JBossMessage();
- message.getDelegate().putDoubleProperty(new SimpleString(propertyName), value);
+ message.getCoreMessage().putDoubleProperty(new SimpleString(propertyName), value);
Object v = message.getObjectProperty(propertyName);
assertTrue(v instanceof Double);
@@ -1254,7 +1254,7 @@
String value = randomString();
JBossMessage message = new JBossMessage();
- message.getDelegate().putStringProperty(new SimpleString(propertyName), new SimpleString(value));
+ message.getCoreMessage().putStringProperty(new SimpleString(propertyName), new SimpleString(value));
Object v = message.getObjectProperty(propertyName);
assertTrue(v instanceof String);
@@ -1266,7 +1266,7 @@
int value = randomInt();
JBossMessage message = new JBossMessage();
- message.getDelegate().setDeliveryCount(value);
+ message.getCoreMessage().setDeliveryCount(value);
Object v = message.getObjectProperty(JBossMessage.JMSXDELIVERYCOUNT);
assertTrue(v instanceof String);
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossObjectMessageTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -124,7 +124,7 @@
msg.doBeforeSend();
- MessagingBuffer body = msg.getDelegate().getBody();
+ MessagingBuffer body = msg.getCoreMessage().getBody();
assertEquals(data.length, body.getInt());
byte[] bytes = new byte[data.length];
body.getBytes(bytes);
@@ -141,7 +141,7 @@
byte[] data = baos.toByteArray();
JBossObjectMessage message = new JBossObjectMessage();
- MessagingBuffer body = message.getDelegate().getBody();
+ MessagingBuffer body = message.getCoreMessage().getBody();
body.putInt(data.length);
body.putBytes(data);
body.flip();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossSessionTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossSessionTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossSessionTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -1892,7 +1892,7 @@
Session.AUTO_ACKNOWLEDGE, mockClientSession,
JBossSession.TYPE_QUEUE_SESSION);
- ClientSession clientSession = session.getDelegate();
+ ClientSession clientSession = session.getCoreSession();
assertNotNull(clientSession);
assertSame(mockClientSession, clientSession);
}
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JBossTextMessageTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -114,7 +114,7 @@
msg.doBeforeSend();
- MessagingBuffer body = msg.getDelegate().getBody();
+ MessagingBuffer body = msg.getCoreMessage().getBody();
String s = body.getNullableString();
assertEquals(text, s);
}
@@ -123,7 +123,7 @@
{
JBossTextMessage msg = new JBossTextMessage();
assertNull(msg.getText());
- MessagingBuffer body = msg.getDelegate().getBody();
+ MessagingBuffer body = msg.getCoreMessage().getBody();
body.putNullableString(text);
body.flip();
Modified: trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JMSMessageListenerWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JMSMessageListenerWrapperTest.java 2008-06-25 13:09:52 UTC (rev 4577)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/client/JMSMessageListenerWrapperTest.java 2008-06-25 13:36:21 UTC (rev 4578)
@@ -65,7 +65,7 @@
expect(clientSession.isClosed()).andReturn(false);
clientSession.acknowledge();
JBossSession session = createStrictMock(JBossSession.class);
- expect(session.getDelegate()).andStubReturn(clientSession);
+ expect(session.getCoreSession()).andStubReturn(clientSession);
expect(session.isRecoverCalled()).andReturn(false);
session.setRecoverCalled(false);
MessageListener listener = createStrictMock(MessageListener.class);
@@ -85,7 +85,7 @@
ClientSession clientSession = createStrictMock(ClientSession.class);
clientSession.acknowledge();
JBossSession session = createStrictMock(JBossSession.class);
- expect(session.getDelegate()).andStubReturn(clientSession);
+ expect(session.getCoreSession()).andStubReturn(clientSession);
expect(session.isRecoverCalled()).andReturn(false);
session.setRecoverCalled(false);
@@ -106,7 +106,7 @@
ClientSession clientSession = createStrictMock(ClientSession.class);
clientSession.rollback();
JBossSession session = createStrictMock(JBossSession.class);
- expect(session.getDelegate()).andStubReturn(clientSession);
+ expect(session.getCoreSession()).andStubReturn(clientSession);
session.setRecoverCalled(true);
expect(session.isRecoverCalled()).andReturn(true);
session.setRecoverCalled(false);
More information about the jboss-cvs-commits
mailing list