JBoss hornetq SVN: r8241 - in trunk: src/main/org/hornetq/jms/client and 3 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-11-06 10:32:46 -0500 (Fri, 06 Nov 2009)
New Revision: 8241
Modified:
trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
Log:
fixed HornetQConnectionFactory code + test
* added checkWrite() to every HornetQConnectionFactory setter methods now that the ClientSessionFactory
is copied for each created connection
* in ClientSessionFactory.close(), checked pool nullability before shutting them down (they are null
if useGlobalPools is false and no session was created)
* fixed HornetQConnectionFactoryTest & CloseConnectionOnGCTest assertions
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2009-11-06 14:34:10 UTC (rev 8240)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2009-11-06 15:32:46 UTC (rev 8241)
@@ -917,31 +917,37 @@
if (!useGlobalPools)
{
- threadPool.shutdown();
+ if (threadPool != null)
+ {
+ threadPool.shutdown();
- try
- {
- if (!threadPool.awaitTermination(10000, TimeUnit.MILLISECONDS))
+ try
{
- log.warn("Timed out waiting for pool to terminate");
+ if (!threadPool.awaitTermination(10000, TimeUnit.MILLISECONDS))
+ {
+ log.warn("Timed out waiting for pool to terminate");
+ }
}
+ catch (InterruptedException ignore)
+ {
+ }
}
- catch (InterruptedException ignore)
+
+ if (scheduledThreadPool != null)
{
- }
+ scheduledThreadPool.shutdown();
- scheduledThreadPool.shutdown();
-
- try
- {
- if (!scheduledThreadPool.awaitTermination(10000, TimeUnit.MILLISECONDS))
+ try
{
- log.warn("Timed out waiting for scheduled pool to terminate");
+ if (!scheduledThreadPool.awaitTermination(10000, TimeUnit.MILLISECONDS))
+ {
+ log.warn("Timed out waiting for scheduled pool to terminate");
+ }
}
+ catch (InterruptedException ignore)
+ {
+ }
}
- catch (InterruptedException ignore)
- {
- }
}
closed = true;
Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2009-11-06 14:34:10 UTC (rev 8240)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2009-11-06 15:32:46 UTC (rev 8241)
@@ -193,6 +193,7 @@
public synchronized void setConnectionLoadBalancingPolicyClassName(String connectionLoadBalancingPolicyClassName)
{
+ checkWrite();
sessionFactory.setConnectionLoadBalancingPolicyClassName(connectionLoadBalancingPolicyClassName);
}
@@ -203,6 +204,7 @@
public synchronized void setStaticConnectors(List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors)
{
+ checkWrite();
sessionFactory.setStaticConnectors(staticConnectors);
}
@@ -213,6 +215,7 @@
public synchronized void setDiscoveryAddress(String discoveryAddress)
{
+ checkWrite();
sessionFactory.setDiscoveryAddress(discoveryAddress);
}
@@ -223,6 +226,7 @@
public synchronized void setDiscoveryPort(int discoveryPort)
{
+ checkWrite();
sessionFactory.setDiscoveryPort(discoveryPort);
}
@@ -233,6 +237,7 @@
public synchronized void setDiscoveryRefreshTimeout(long discoveryRefreshTimeout)
{
+ checkWrite();
sessionFactory.setDiscoveryRefreshTimeout(discoveryRefreshTimeout);
}
@@ -243,6 +248,7 @@
public synchronized void setDiscoveryInitialWaitTimeout(long discoveryInitialWaitTimeout)
{
+ checkWrite();
sessionFactory.setDiscoveryInitialWaitTimeout(discoveryInitialWaitTimeout);
}
@@ -286,6 +292,7 @@
public synchronized void setClientFailureCheckPeriod(long clientFailureCheckPeriod)
{
+ checkWrite();
sessionFactory.setClientFailureCheckPeriod(clientFailureCheckPeriod);
}
@@ -296,6 +303,7 @@
public synchronized void setConnectionTTL(long connectionTTL)
{
+ checkWrite();
sessionFactory.setConnectionTTL(connectionTTL);
}
@@ -306,6 +314,7 @@
public synchronized void setCallTimeout(long callTimeout)
{
+ checkWrite();
sessionFactory.setCallTimeout(callTimeout);
}
@@ -316,6 +325,7 @@
public synchronized void setConsumerWindowSize(int consumerWindowSize)
{
+ checkWrite();
sessionFactory.setConsumerWindowSize(consumerWindowSize);
}
@@ -326,6 +336,7 @@
public synchronized void setConsumerMaxRate(int consumerMaxRate)
{
+ checkWrite();
sessionFactory.setConsumerMaxRate(consumerMaxRate);
}
@@ -336,6 +347,7 @@
public synchronized void setConfirmationWindowSize(int confirmationWindowSize)
{
+ checkWrite();
sessionFactory.setConfirmationWindowSize(confirmationWindowSize);
}
@@ -346,6 +358,7 @@
public synchronized void setProducerMaxRate(int producerMaxRate)
{
+ checkWrite();
sessionFactory.setProducerMaxRate(producerMaxRate);
}
@@ -354,6 +367,7 @@
*/
public synchronized void setCacheLargeMessagesClient(boolean cacheLargeMessagesClient)
{
+ checkWrite();
sessionFactory.setCacheLargeMessagesClient(cacheLargeMessagesClient);
}
@@ -369,6 +383,7 @@
public synchronized void setMinLargeMessageSize(int minLargeMessageSize)
{
+ checkWrite();
sessionFactory.setMinLargeMessageSize(minLargeMessageSize);
}
@@ -379,6 +394,7 @@
public synchronized void setBlockOnAcknowledge(boolean blockOnAcknowledge)
{
+ checkWrite();
sessionFactory.setBlockOnAcknowledge(blockOnAcknowledge);
}
@@ -389,6 +405,7 @@
public synchronized void setBlockOnNonPersistentSend(boolean blockOnNonPersistentSend)
{
+ checkWrite();
sessionFactory.setBlockOnNonPersistentSend(blockOnNonPersistentSend);
}
@@ -399,6 +416,7 @@
public synchronized void setBlockOnPersistentSend(boolean blockOnPersistentSend)
{
+ checkWrite();
sessionFactory.setBlockOnPersistentSend(blockOnPersistentSend);
}
@@ -409,6 +427,7 @@
public synchronized void setAutoGroup(boolean autoGroup)
{
+ checkWrite();
sessionFactory.setAutoGroup(autoGroup);
}
@@ -419,6 +438,7 @@
public synchronized void setPreAcknowledge(boolean preAcknowledge)
{
+ checkWrite();
sessionFactory.setPreAcknowledge(preAcknowledge);
}
@@ -429,6 +449,7 @@
public synchronized void setRetryInterval(long retryInterval)
{
+ checkWrite();
sessionFactory.setRetryInterval(retryInterval);
}
@@ -439,6 +460,7 @@
public synchronized void setMaxRetryInterval(long retryInterval)
{
+ checkWrite();
sessionFactory.setMaxRetryInterval(retryInterval);
}
@@ -449,6 +471,7 @@
public synchronized void setRetryIntervalMultiplier(double retryIntervalMultiplier)
{
+ checkWrite();
sessionFactory.setRetryIntervalMultiplier(retryIntervalMultiplier);
}
@@ -459,6 +482,7 @@
public synchronized void setReconnectAttempts(int reconnectAttempts)
{
+ checkWrite();
sessionFactory.setReconnectAttempts(reconnectAttempts);
}
@@ -469,6 +493,7 @@
public synchronized void setFailoverOnServerShutdown(boolean failoverOnServerShutdown)
{
+ checkWrite();
sessionFactory.setFailoverOnServerShutdown(failoverOnServerShutdown);
}
@@ -479,6 +504,7 @@
public synchronized void setUseGlobalPools(boolean useGlobalPools)
{
+ checkWrite();
sessionFactory.setUseGlobalPools(useGlobalPools);
}
@@ -489,6 +515,7 @@
public synchronized void setScheduledThreadPoolMaxSize(int scheduledThreadPoolMaxSize)
{
+ checkWrite();
sessionFactory.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
}
@@ -499,6 +526,7 @@
public synchronized void setThreadPoolMaxSize(int threadPoolMaxSize)
{
+ checkWrite();
sessionFactory.setThreadPoolMaxSize(threadPoolMaxSize);
}
@@ -560,7 +588,7 @@
{
if (readOnly)
{
- throw new IllegalStateException("Cannot set attribute on HornetQRAConnectionFactory after it has been used");
+ throw new IllegalStateException("Cannot set attribute on HornetQConnectionFactory after it has been used");
}
}
Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2009-11-06 14:34:10 UTC (rev 8240)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionFactoryTest.java 2009-11-06 15:32:46 UTC (rev 8241)
@@ -105,6 +105,13 @@
assertNotNull(csi);
}
+ public void testCloseUnusedClientSessionFactoryWithoutGlobalPools() throws Exception
+ {
+ ClientSessionFactoryImpl csf = new ClientSessionFactoryImpl();
+ csf.setUseGlobalPools(false);
+ csf.close();
+ }
+
public void testDefaultConstructor() throws Exception
{
try
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2009-11-06 14:34:10 UTC (rev 8240)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/HornetQConnectionFactoryTest.java 2009-11-06 15:32:46 UTC (rev 8241)
@@ -117,21 +117,58 @@
log.info("Got here");
+ testSettersThrowException(cf);
+ }
+
+ public void testDefaultConstructorAndSetConnectorPairs() throws Exception
+ {
+ HornetQConnectionFactory cf = new HornetQConnectionFactory();
final List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(this.liveTC,
this.backupTC);
staticConnectors.add(pair0);
cf.setStaticConnectors(staticConnectors);
+
+ assertFactoryParams(cf,
+ staticConnectors,
+ null,
+ 0,
+ ClientSessionFactoryImpl.DEFAULT_DISCOVERY_REFRESH_TIMEOUT,
+ null,
+ ClientSessionFactoryImpl.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD,
+ ClientSessionFactoryImpl.DEFAULT_CONNECTION_TTL,
+ ClientSessionFactoryImpl.DEFAULT_CALL_TIMEOUT,
+ ClientSessionFactoryImpl.DEFAULT_MIN_LARGE_MESSAGE_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_CONSUMER_WINDOW_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_CONSUMER_MAX_RATE,
+ ClientSessionFactoryImpl.DEFAULT_CONFIRMATION_WINDOW_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_PRODUCER_MAX_RATE,
+ ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_ACKNOWLEDGE,
+ ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_PERSISTENT_SEND,
+ ClientSessionFactoryImpl.DEFAULT_BLOCK_ON_NON_PERSISTENT_SEND,
+ ClientSessionFactoryImpl.DEFAULT_AUTO_GROUP,
+ ClientSessionFactoryImpl.DEFAULT_PRE_ACKNOWLEDGE,
+ ClientSessionFactoryImpl.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME,
+ ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_ACK_BATCH_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_DISCOVERY_INITIAL_WAIT_TIMEOUT,
+ ClientSessionFactoryImpl.DEFAULT_USE_GLOBAL_POOLS,
+ ClientSessionFactoryImpl.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_THREAD_POOL_MAX_SIZE,
+ ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL,
+ ClientSessionFactoryImpl.DEFAULT_RETRY_INTERVAL_MULTIPLIER,
+ ClientSessionFactoryImpl.DEFAULT_RECONNECT_ATTEMPTS,
+ ClientSessionFactoryImpl.DEFAULT_FAILOVER_ON_SERVER_SHUTDOWN);
- conn = cf.createConnection();
+ Connection conn = cf.createConnection();
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
testSettersThrowException(cf);
-
+
conn.close();
}
-
+
public void testDiscoveryConstructor() throws Exception
{
HornetQConnectionFactory cf = new HornetQConnectionFactory(groupAddress, groupPort);
@@ -319,12 +356,13 @@
public void testGettersAndSetters()
{
- ClientSessionFactory cf = new ClientSessionFactoryImpl();
+ ClientSessionFactory csf = new ClientSessionFactoryImpl();
List<Pair<TransportConfiguration, TransportConfiguration>> staticConnectors = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>();
Pair<TransportConfiguration, TransportConfiguration> pair0 = new Pair<TransportConfiguration, TransportConfiguration>(this.liveTC,
this.backupTC);
staticConnectors.add(pair0);
+ HornetQConnectionFactory cf = new HornetQConnectionFactory(csf);
String discoveryAddress = randomString();
int discoveryPort = RandomUtil.randomPositiveInt();
@@ -343,7 +381,6 @@
boolean autoGroup = RandomUtil.randomBoolean();
boolean preAcknowledge = RandomUtil.randomBoolean();
String loadBalancingPolicyClassName = RandomUtil.randomString();
- int ackBatchSize = RandomUtil.randomPositiveInt();
long initialWaitTimeout = RandomUtil.randomPositiveLong();
boolean useGlobalPools = RandomUtil.randomBoolean();
int scheduledThreadPoolMaxSize = RandomUtil.randomPositiveInt();
@@ -371,7 +408,6 @@
cf.setAutoGroup(autoGroup);
cf.setPreAcknowledge(preAcknowledge);
cf.setConnectionLoadBalancingPolicyClassName(loadBalancingPolicyClassName);
- cf.setAckBatchSize(ackBatchSize);
cf.setDiscoveryInitialWaitTimeout(initialWaitTimeout);
cf.setUseGlobalPools(useGlobalPools);
cf.setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize);
@@ -399,7 +435,6 @@
assertEquals(autoGroup, cf.isAutoGroup());
assertEquals(preAcknowledge, cf.isPreAcknowledge());
assertEquals(loadBalancingPolicyClassName, cf.getConnectionLoadBalancingPolicyClassName());
- assertEquals(ackBatchSize, cf.getAckBatchSize());
assertEquals(initialWaitTimeout, cf.getDiscoveryInitialWaitTimeout());
assertEquals(useGlobalPools, cf.isUseGlobalPools());
assertEquals(scheduledThreadPoolMaxSize, cf.getScheduledThreadPoolMaxSize());
@@ -409,6 +444,7 @@
assertEquals(reconnectAttempts, cf.getReconnectAttempts());
assertEquals(failoverOnServerShutdown, cf.isFailoverOnServerShutdown());
+ cf.close();
}
private void testSettersThrowException(HornetQConnectionFactory cf)
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java 2009-11-06 14:34:10 UTC (rev 8240)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/connection/CloseConnectionOnGCTest.java 2009-11-06 15:32:46 UTC (rev 8241)
@@ -54,16 +54,6 @@
super.tearDown();
}
- public void testFoo() throws Exception
- {
- for (int i = 0; i < 100; i++)
- {
- log.info("Iteration " + i);
-
- testCloseOneConnectionOnGC();
- }
- }
-
public void testCloseOneConnectionOnGC() throws Exception
{
//Debug - don't remove this until intermittent failure with this test is fixed
@@ -95,7 +85,7 @@
WeakReference<Connection> wr2 = new WeakReference<Connection>(conn2);
WeakReference<Connection> wr3 = new WeakReference<Connection>(conn3);
- assertEquals(1, server.getRemotingService().getConnections().size());
+ assertEquals(3, server.getRemotingService().getConnections().size());
conn1 = null;
conn2 = null;
16 years, 6 months
JBoss hornetq SVN: r8240 - trunk/tests/src/org/hornetq/tests/integration/cluster/distribution.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-11-06 09:34:10 -0500 (Fri, 06 Nov 2009)
New Revision: 8240
Modified:
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
Log:
small tweak
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-11-06 13:31:14 UTC (rev 8239)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-11-06 14:34:10 UTC (rev 8240)
@@ -88,6 +88,14 @@
checkFreePort(PORTS);
clearData();
+
+ consumers = new ConsumerHolder[MAX_CONSUMERS];
+
+ servers = new HornetQServer[MAX_SERVERS];
+
+ sfs = new ClientSessionFactory[MAX_SERVERS];
+
+
}
@Override
@@ -124,18 +132,18 @@
}
}
- private ConsumerHolder[] consumers = new ConsumerHolder[MAX_CONSUMERS];
-
private static final SimpleString COUNT_PROP = new SimpleString("count_prop");
protected static final SimpleString FILTER_PROP = new SimpleString("animal");
private static final int MAX_SERVERS = 10;
- protected HornetQServer[] servers = new HornetQServer[MAX_SERVERS];
+ private ConsumerHolder[] consumers;
- protected ClientSessionFactory[] sfs = new ClientSessionFactory[MAX_SERVERS];
+ protected HornetQServer[] servers;
+ protected ClientSessionFactory[] sfs;
+
protected void waitForMessages(int node, final String address, final int count) throws Exception
{
HornetQServer server = this.servers[node];
16 years, 6 months
JBoss hornetq SVN: r8239 - in trunk: src/main/org/hornetq/core/management/impl and 17 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-11-06 08:31:14 -0500 (Fri, 06 Nov 2009)
New Revision: 8239
Added:
trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java
Removed:
trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java
Modified:
trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java
trunk/src/main/org/hornetq/core/server/group/impl/RemoteGroupingHandler.java
trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java
trunk/src/main/org/hornetq/utils/TypedProperties.java
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
trunk/tests/src/org/hornetq/tests/integration/management/AcceptorControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-176: typed property getters on the core Message class
* moved type conversion to TypedProperties
* refactored HornetQMapMessage to used TypedProperties's typed getters
Modified: trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/cluster/impl/DiscoveryGroupImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -125,7 +125,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
Notification notification = new Notification(nodeID, NotificationType.DISCOVERY_GROUP_STARTED, props );
notificationService.sendNotification(notification );
}
@@ -160,7 +160,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
Notification notification = new Notification(nodeID, NotificationType.DISCOVERY_GROUP_STOPPED, props );
try
{
Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -720,14 +720,14 @@
notifProps = new TypedProperties();
}
- notifProps.putStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE,
+ notifProps.putSimpleStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE,
new SimpleString(notification.getType().toString()));
notifProps.putLongProperty(ManagementHelper.HDR_NOTIFICATION_TIMESTAMP, System.currentTimeMillis());
if (notification.getUID() != null)
{
- notifProps.putStringProperty(new SimpleString("foobar"), new SimpleString(notification.getUID()));
+ notifProps.putSimpleStringProperty(new SimpleString("foobar"), new SimpleString(notification.getUID()));
}
notificationMessage.putTypedProperties(notifProps);
Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -398,7 +398,7 @@
public void putStringProperty(final SimpleString key, final SimpleString value)
{
- properties.putStringProperty(key, value);
+ properties.putSimpleStringProperty(key, value);
}
public void putObjectProperty(SimpleString key, Object value) throws PropertyConversionException
@@ -439,7 +439,7 @@
}
else if (value instanceof String)
{
- properties.putStringProperty(key, new SimpleString((String)value));
+ properties.putSimpleStringProperty(key, new SimpleString((String)value));
}
else
{
@@ -494,7 +494,7 @@
public void putStringProperty(final String key, final String value)
{
- properties.putStringProperty(new SimpleString(key), new SimpleString(value));
+ properties.putSimpleStringProperty(new SimpleString(key), new SimpleString(value));
}
public void putTypedProperties(TypedProperties otherProps)
@@ -509,76 +509,27 @@
public Boolean getBooleanProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
- if (value == null)
- {
- return Boolean.valueOf(null);
- }
-
- if (value instanceof Boolean)
- {
- return (Boolean)value;
- }
- else if (value instanceof SimpleString)
- {
- return Boolean.valueOf(((SimpleString)value).toString()).booleanValue();
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getBooleanProperty(key);
}
public Boolean getBooleanProperty(String key) throws PropertyConversionException
{
- return getBooleanProperty(new SimpleString(key));
+ return properties.getBooleanProperty(new SimpleString(key));
}
public Byte getByteProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
-
- if (value == null)
- {
- return Byte.valueOf(null);
- }
-
- if (value instanceof Byte)
- {
- return (Byte)value;
- }
- else if (value instanceof SimpleString)
- {
- return Byte.parseByte(((SimpleString)value).toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getByteProperty(key);
}
public Byte getByteProperty(String key) throws PropertyConversionException
{
- return getByteProperty(new SimpleString(key));
+ return properties.getByteProperty(new SimpleString(key));
}
public byte[] getBytesProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
-
- if (value == null)
- {
- return null;
- }
-
- if (value instanceof byte[])
- {
- return (byte[])value;
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getBytesProperty(key);
}
public byte[] getBytesProperty(String key) throws PropertyConversionException
@@ -588,162 +539,52 @@
public Double getDoubleProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
- if (value == null)
- {
- return Double.valueOf(null);
- }
-
- if (value instanceof Float)
- {
- return ((Float)value).doubleValue();
- }
- else if (value instanceof Double)
- {
- return (Double)value;
- }
- else if (value instanceof SimpleString)
- {
- return Double.parseDouble(((SimpleString)value).toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getDoubleProperty(key);
}
public Double getDoubleProperty(String key) throws PropertyConversionException
{
- return getDoubleProperty(new SimpleString(key));
+ return properties.getDoubleProperty(new SimpleString(key));
}
public Integer getIntProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
- if (value == null)
- {
- return Integer.valueOf(null);
- }
- else if (value instanceof Integer)
- {
- return (Integer)value;
- }
- else if (value instanceof Byte)
- {
- return ((Byte)value).intValue();
- }
- else if (value instanceof Short)
- {
- return ((Short)value).intValue();
- }
- else if (value instanceof SimpleString)
- {
- return Integer.parseInt(((SimpleString)value).toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getIntProperty(key);
}
public Integer getIntProperty(String key) throws PropertyConversionException
{
- return getIntProperty(new SimpleString(key));
+ return properties.getIntProperty(new SimpleString(key));
}
public Long getLongProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
- if (value == null)
- {
- return Long.valueOf(null);
- }
- else if (value instanceof Long)
- {
- return (Long)value;
- }
- else if (value instanceof Byte)
- {
- return ((Byte)value).longValue();
- }
- else if (value instanceof Short)
- {
- return ((Short)value).longValue();
- }
- else if (value instanceof Integer)
- {
- return ((Integer)value).longValue();
- }
- else if (value instanceof SimpleString)
- {
- return Long.parseLong(((SimpleString)value).toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getLongProperty(key);
}
public Long getLongProperty(String key) throws PropertyConversionException
{
- return getLongProperty(new SimpleString(key));
+ return properties.getLongProperty(new SimpleString(key));
}
public Short getShortProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
- if (value == null)
- {
- return Short.valueOf(null);
- }
- else if (value instanceof Byte)
- {
- return ((Byte)value).shortValue();
- }
- else if (value instanceof Short)
- {
- return (Short)value;
- }
- else if (value instanceof SimpleString)
- {
- return Short.parseShort(((SimpleString)value).toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid Conversion.");
- }
+ return properties.getShortProperty(key);
}
public Short getShortProperty(String key) throws PropertyConversionException
{
- return getShortProperty(new SimpleString(key));
+ return properties.getShortProperty(new SimpleString(key));
}
public Float getFloatProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
- if (value == null)
- {
- return Float.valueOf(null);
- }
-
- if (value instanceof Float)
- {
- return ((Float)value).floatValue();
- }
- else if (value instanceof SimpleString)
- {
- return Float.parseFloat(((SimpleString)value).toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getFloatProperty(key);
}
public Float getFloatProperty(String key) throws PropertyConversionException
{
- return getFloatProperty(new SimpleString(key));
+ return properties.getFloatProperty(new SimpleString(key));
}
public String getStringProperty(SimpleString key) throws PropertyConversionException
@@ -767,54 +608,12 @@
public SimpleString getSimpleStringProperty(SimpleString key) throws PropertyConversionException
{
- Object value = properties.getProperty(key);
-
- if (value == null)
- {
- return null;
- }
-
- if (value instanceof SimpleString)
- {
- return (SimpleString)value;
- }
- else if (value instanceof Boolean)
- {
- return new SimpleString(value.toString());
- }
- else if (value instanceof Byte)
- {
- return new SimpleString(value.toString());
- }
- else if (value instanceof Short)
- {
- return new SimpleString(value.toString());
- }
- else if (value instanceof Integer)
- {
- return new SimpleString(value.toString());
- }
- else if (value instanceof Long)
- {
- return new SimpleString(value.toString());
- }
- else if (value instanceof Float)
- {
- return new SimpleString(value.toString());
- }
- else if (value instanceof Double)
- {
- return new SimpleString(value.toString());
- }
- else
- {
- throw new PropertyConversionException("Invalid conversion");
- }
+ return properties.getSimpleStringProperty(key);
}
public SimpleString getSimpleStringProperty(String key) throws PropertyConversionException
{
- return getSimpleStringProperty(new SimpleString(key));
+ return properties.getSimpleStringProperty(new SimpleString(key));
}
public Object getObjectProperty(final String key)
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -937,11 +937,10 @@
messageEncoding.decode(buff);
- Long originalMessageID = (Long)largeMessage.getProperties().getProperty(MessageImpl.HDR_ORIG_MESSAGE_ID);
-
- // Using the linked file by the original file
- if (originalMessageID != null)
+ if (largeMessage.getProperties().containsProperty(MessageImpl.HDR_ORIG_MESSAGE_ID))
{
+ long originalMessageID = largeMessage.getProperties().getLongProperty(MessageImpl.HDR_ORIG_MESSAGE_ID);
+
LargeServerMessage originalMessage = (LargeServerMessage)messages.get(originalMessageID);
if (originalMessage == null)
Modified: trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -48,8 +48,8 @@
private final int distance;
- public QueueInfo(final SimpleString routingName, final SimpleString clusterName, final SimpleString address, final SimpleString filterString, final Long id,
- final Integer distance)
+ public QueueInfo(final SimpleString routingName, final SimpleString clusterName, final SimpleString address, final SimpleString filterString, final long id,
+ final int distance)
{
if (routingName == null)
{
@@ -63,10 +63,7 @@
{
throw new IllegalArgumentException("Address is null");
}
- if (distance == null)
- {
- throw new IllegalArgumentException("Distance is null");
- }
+
this.routingName = routingName;
this.clusterName = clusterName;
this.address = address;
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -222,30 +222,40 @@
{
TypedProperties props = notification.getProperties();
- Integer bindingType = (Integer)props.getProperty(ManagementHelper.HDR_BINDING_TYPE);
-
- if (bindingType == null)
+ if (!props.containsProperty(ManagementHelper.HDR_BINDING_TYPE))
{
throw new IllegalArgumentException("Binding type not specified");
}
+ Integer bindingType = props.getIntProperty(ManagementHelper.HDR_BINDING_TYPE);
+
if (bindingType == BindingType.DIVERT_INDEX)
{
// We don't propagate diverts
return;
}
- SimpleString routingName = (SimpleString)props.getProperty(ManagementHelper.HDR_ROUTING_NAME);
+ SimpleString routingName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
- SimpleString clusterName = (SimpleString)props.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
+ SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
- SimpleString address = (SimpleString)props.getProperty(ManagementHelper.HDR_ADDRESS);
+ SimpleString address = props.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS);
- Long id = (Long)props.getProperty(ManagementHelper.HDR_BINDING_ID);
+ if (!props.containsProperty(ManagementHelper.HDR_BINDING_ID))
+ {
+ throw new IllegalArgumentException("ID is null");
+ }
+
+ long id = props.getLongProperty(ManagementHelper.HDR_BINDING_ID);
- SimpleString filterString = (SimpleString)props.getProperty(ManagementHelper.HDR_FILTERSTRING);
+ SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
- Integer distance = (Integer)props.getProperty(ManagementHelper.HDR_DISTANCE);
+ if (!props.containsProperty(ManagementHelper.HDR_DISTANCE))
+ {
+ throw new IllegalArgumentException("Distance is null");
+ }
+
+ int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
QueueInfo info = new QueueInfo(routingName, clusterName, address, filterString, id, distance);
@@ -257,12 +267,12 @@
{
TypedProperties props = notification.getProperties();
- SimpleString clusterName = (SimpleString)props.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
-
- if (clusterName == null)
+ if (!props.containsProperty(ManagementHelper.HDR_CLUSTER_NAME))
{
throw new IllegalStateException("No cluster name");
}
+
+ SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
QueueInfo info = queueInfos.remove(clusterName);
@@ -277,14 +287,14 @@
{
TypedProperties props = notification.getProperties();
- SimpleString clusterName = (SimpleString)props.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
-
- if (clusterName == null)
+ if (!props.containsProperty(ManagementHelper.HDR_CLUSTER_NAME))
{
throw new IllegalStateException("No cluster name");
}
+
+ SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
- SimpleString filterString = (SimpleString)props.getProperty(ManagementHelper.HDR_FILTERSTRING);
+ SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
QueueInfo info = queueInfos.get(clusterName);
@@ -309,16 +319,16 @@
filterStrings.add(filterString);
}
- Integer distance = (Integer)props.getProperty(ManagementHelper.HDR_DISTANCE);
-
- if (distance == null)
+ if (!props.containsProperty(ManagementHelper.HDR_DISTANCE))
{
throw new IllegalStateException("No distance");
}
+ int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
+
if (distance > 0)
{
- SimpleString queueName = (SimpleString)props.getProperty(ManagementHelper.HDR_ROUTING_NAME);
+ SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
if (queueName == null)
{
@@ -350,14 +360,14 @@
{
TypedProperties props = notification.getProperties();
- SimpleString clusterName = (SimpleString)props.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
+ SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
if (clusterName == null)
{
- throw new IllegalStateException("No distance");
+ throw new IllegalStateException("No cluster name");
}
- SimpleString filterString = (SimpleString)props.getProperty(ManagementHelper.HDR_FILTERSTRING);
+ SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
QueueInfo info = queueInfos.get(clusterName);
@@ -377,16 +387,16 @@
if (info.getNumberOfConsumers() == 0)
{
- Integer distance = (Integer)props.getProperty(ManagementHelper.HDR_DISTANCE);
-
- if (distance == null)
+ if (!props.containsProperty(ManagementHelper.HDR_DISTANCE))
{
throw new IllegalStateException("No cluster name");
}
+ int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
+
if (distance == 0)
{
- SimpleString queueName = (SimpleString)props.getProperty(ManagementHelper.HDR_ROUTING_NAME);
+ SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
if (queueName == null)
{
@@ -439,11 +449,11 @@
props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, binding.getType().toInt());
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
- props.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
- props.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
props.putLongProperty(ManagementHelper.HDR_BINDING_ID, binding.getID());
@@ -453,7 +463,7 @@
if (filter != null)
{
- props.putStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString());
+ props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filter.getFilterString());
}
String uid = UUIDGenerator.getInstance().generateStringUUID();
@@ -491,11 +501,11 @@
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
- props.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
- props.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance());
Modified: trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/remoting/impl/invm/InVMAcceptor.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -84,7 +84,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
+ props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
props.putIntProperty(new SimpleString("id"), id);
Notification notification = new Notification(null, NotificationType.ACCEPTOR_STARTED, props);
notificationService.sendNotification(notification);
@@ -117,7 +117,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
+ props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(InVMAcceptorFactory.class.getName()));
props.putIntProperty(new SimpleString("id"), id);
Notification notification = new Notification(null, NotificationType.ACCEPTOR_STOPPED, props);
try
Modified: trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/security/impl/SecurityStoreImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -127,7 +127,7 @@
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(user));
+ props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(user));
Notification notification = new Notification(null, SECURITY_AUTHENTICATION_VIOLATION, props);
@@ -168,9 +168,9 @@
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
- props.putStringProperty(ManagementHelper.HDR_CHECK_TYPE, new SimpleString(checkType.toString()));
- props.putStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(user));
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
+ props.putSimpleStringProperty(ManagementHelper.HDR_CHECK_TYPE, new SimpleString(checkType.toString()));
+ props.putSimpleStringProperty(ManagementHelper.HDR_USER, SimpleString.toSimpleString(user));
Notification notification = new Notification(null, NotificationType.SECURITY_PERMISSION_VIOLATION, props);
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -235,7 +235,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), name);
+ props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), NotificationType.BRIDGE_STARTED, props);
notificationService.sendNotification(notification);
}
@@ -281,7 +281,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), name);
+ props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), NotificationType.BRIDGE_STOPPED, props);
try
{
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/BroadcastGroupImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -127,7 +127,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
Notification notification = new Notification(nodeID, NotificationType.BROADCAST_GROUP_STARTED, props);
notificationService.sendNotification(notification );
}
@@ -152,7 +152,7 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ props.putSimpleStringProperty(new SimpleString("name"), new SimpleString(name));
Notification notification = new Notification(nodeID, NotificationType.BROADCAST_GROUP_STOPPED, props);
try
{
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -225,7 +225,7 @@
if (managementService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), name);
+ props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), NotificationType.CLUSTER_CONNECTION_STARTED, props);
managementService.sendNotification(notification);
}
@@ -257,7 +257,7 @@
if (managementService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("name"), name);
+ props.putSimpleStringProperty(new SimpleString("name"), name);
Notification notification = new Notification(nodeUUID.toString(), NotificationType.CLUSTER_CONNECTION_STOPPED, props);
managementService.sendNotification(notification);
}
Modified: trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/group/impl/LocalGroupingHandler.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -107,11 +107,11 @@
public void send(final Response response, final int distance) throws Exception
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, response.getGroupId());
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, response.getClusterName());
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE, response.getAlternativeClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, response.getGroupId());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, response.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE, response.getAlternativeClusterName());
props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
Notification notification = new Notification(null, NotificationType.PROPOSAL_RESPONSE, props);
managementService.sendNotification(notification);
@@ -145,8 +145,8 @@
{
if (notification.getType() == NotificationType.BINDING_REMOVED)
{
- SimpleString clusterName = (SimpleString)notification.getProperties()
- .getProperty(ManagementHelper.HDR_CLUSTER_NAME);
+ SimpleString clusterName = notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
+
List<GroupBinding> list = groupMap.remove(clusterName);
if (list != null)
{
Modified: trunk/src/main/org/hornetq/core/server/group/impl/RemoteGroupingHandler.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/group/impl/RemoteGroupingHandler.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/group/impl/RemoteGroupingHandler.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -89,13 +89,13 @@
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, proposal.getGroupId());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, proposal.getGroupId());
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, proposal.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, proposal.getClusterName());
props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
props.putIntProperty(ManagementHelper.HDR_DISTANCE, 0);
@@ -148,10 +148,10 @@
public Response receive(final Proposal proposal, final int distance) throws Exception
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, proposal.getGroupId());
- props.putStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, proposal.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID, proposal.getGroupId());
+ props.putSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE, proposal.getClusterName());
props.putIntProperty(ManagementHelper.HDR_BINDING_TYPE, BindingType.LOCAL_QUEUE_INDEX);
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, address);
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, address);
props.putIntProperty(ManagementHelper.HDR_DISTANCE, distance);
Notification notification = new Notification(null, NotificationType.PROPOSAL, props);
managementService.sendNotification(notification);
@@ -173,8 +173,7 @@
// removing the groupid if the binding has been removed
if (notification.getType() == NotificationType.BINDING_REMOVED)
{
- SimpleString clusterName = (SimpleString)notification.getProperties()
- .getProperty(ManagementHelper.HDR_CLUSTER_NAME);
+ SimpleString clusterName = notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
List<SimpleString> list = groupMap.remove(clusterName);
if (list != null)
{
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerConsumerImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -308,13 +308,13 @@
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
- props.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
- props.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
- props.putStringProperty(ManagementHelper.HDR_FILTERSTRING, filter == null ? null : filter.getFilterString());
+ props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filter == null ? null : filter.getFilterString());
props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance());
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -388,11 +388,11 @@
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ADDRESS, binding.getAddress());
- props.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME, binding.getClusterName());
- props.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
+ props.putSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance());
@@ -402,7 +402,7 @@
if (filterString != null)
{
- props.putStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString);
+ props.putSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString);
}
Notification notification = new Notification(null, CONSUMER_CREATED, props);
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -315,8 +315,8 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("factory"), new SimpleString(NettyAcceptorFactory.class.getName()));
- props.putStringProperty(new SimpleString("host"), new SimpleString(host));
+ props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(NettyAcceptorFactory.class.getName()));
+ props.putSimpleStringProperty(new SimpleString("host"), new SimpleString(host));
props.putIntProperty(new SimpleString("port"), port);
Notification notification = new Notification(null, NotificationType.ACCEPTOR_STARTED, props);
notificationService.sendNotification(notification);
@@ -387,8 +387,8 @@
if (notificationService != null)
{
TypedProperties props = new TypedProperties();
- props.putStringProperty(new SimpleString("factory"), new SimpleString(NettyAcceptorFactory.class.getName()));
- props.putStringProperty(new SimpleString("host"), new SimpleString(host));
+ props.putSimpleStringProperty(new SimpleString("factory"), new SimpleString(NettyAcceptorFactory.class.getName()));
+ props.putSimpleStringProperty(new SimpleString("host"), new SimpleString(host));
props.putIntProperty(new SimpleString("port"), port);
Notification notification = new Notification(null, NotificationType.ACCEPTOR_STOPPED, props);
try
Modified: trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/jms/client/HornetQMapMessage.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -25,6 +25,7 @@
import org.hornetq.core.client.ClientMessage;
import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.message.PropertyConversionException;
import org.hornetq.utils.SimpleString;
import org.hornetq.utils.TypedProperties;
@@ -153,7 +154,7 @@
public void setString(final String name, final String value) throws JMSException
{
checkName(name);
- map.putStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value));
+ map.putSimpleStringProperty(new SimpleString(name), value == null ? null : new SimpleString(value));
}
public void setBytes(final String name, final byte[] value) throws JMSException
@@ -195,7 +196,7 @@
else if (value instanceof Double)
map.putDoubleProperty(key, (Double)value);
else if (value instanceof String)
- map.putStringProperty(key, new SimpleString((String)value));
+ map.putSimpleStringProperty(key, new SimpleString((String)value));
else if (value instanceof byte[])
map.putBytesProperty(key, (byte[]) value);
else
@@ -204,197 +205,132 @@
public boolean getBoolean(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Boolean.valueOf(null).booleanValue();
-
- if (value instanceof Boolean)
- return ((Boolean) value).booleanValue();
- else if (value instanceof SimpleString)
- return Boolean.valueOf(((SimpleString) value).toString()).booleanValue();
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getBooleanProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public byte getByte(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Byte.parseByte(null);
-
- if (value instanceof Byte)
- return ((Byte) value).byteValue();
- else if (value instanceof SimpleString)
- return Byte.parseByte(((SimpleString) value).toString());
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getByteProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public short getShort(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Short.parseShort(null);
-
- if (value instanceof Byte)
- return ((Byte) value).shortValue();
- else if (value instanceof Short)
- return ((Short) value).shortValue();
- else if (value instanceof SimpleString)
- return Short.parseShort(((SimpleString) value).toString());
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getShortProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public char getChar(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- throw new NullPointerException("Invalid conversion");
-
- if (value instanceof Character)
- return ((Character) value).charValue();
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getCharProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public int getInt(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Integer.parseInt(null);
-
- if (value instanceof Byte)
- return ((Byte) value).intValue();
- else if (value instanceof Short)
- return ((Short) value).intValue();
- else if (value instanceof Integer)
- return ((Integer) value).intValue();
- else if (value instanceof SimpleString)
- return Integer.parseInt(((SimpleString) value).toString());
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getIntProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public long getLong(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Long.parseLong(null);
-
- if (value instanceof Byte)
- return ((Byte) value).longValue();
- else if (value instanceof Short)
- return ((Short) value).longValue();
- else if (value instanceof Integer)
- return ((Integer) value).longValue();
- else if (value instanceof Long)
- return ((Long) value).longValue();
- else if (value instanceof SimpleString)
- return Long.parseLong(((SimpleString) value).toString());
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getLongProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public float getFloat(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Float.parseFloat(null);
-
- if (value instanceof Float)
- return ((Float) value).floatValue();
- else if (value instanceof SimpleString)
- return Float.parseFloat(((SimpleString) value).toString());
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getFloatProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public double getDouble(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return Double.parseDouble(null);
-
- if (value instanceof Float)
- return ((Float) value).doubleValue();
- else if (value instanceof Double)
- return ((Double) value).doubleValue();
- else if (value instanceof SimpleString)
- return Double.parseDouble(((SimpleString) value).toString());
- else
- throw new MessageFormatException("Invalid conversion");
+ try
+ {
+ return map.getDoubleProperty(new SimpleString(name));
+ }
+ catch (PropertyConversionException e)
+ {
+ throw new MessageFormatException(e.getMessage());
+ }
}
public String getString(final String name) throws JMSException
{
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return null;
-
- if (value instanceof SimpleString)
+ try
{
- return ((SimpleString) value).toString();
- }
- else if (value instanceof Boolean)
- {
- return value.toString();
+ SimpleString str = map.getSimpleStringProperty(new SimpleString(name));
+ if (str == null)
+ {
+ return null;
+ }
+ else
+ {
+ return str.toString();
+ }
}
- else if (value instanceof Byte)
+ catch (PropertyConversionException e)
{
- return value.toString();
+ throw new MessageFormatException(e.getMessage());
}
- else if (value instanceof Short)
+ }
+
+ public byte[] getBytes(final String name) throws JMSException
+ {
+ try
{
- return value.toString();
+ return map.getBytesProperty(new SimpleString(name));
}
- else if (value instanceof Character)
+ catch (PropertyConversionException e)
{
- return value.toString();
+ throw new MessageFormatException(e.getMessage());
}
- else if (value instanceof Integer)
- {
- return value.toString();
- }
- else if (value instanceof Long)
- {
- return value.toString();
- }
- else if (value instanceof Float)
- {
- return value.toString();
- }
- else if (value instanceof Double)
- {
- return value.toString();
- }
- else
- {
- throw new MessageFormatException("Invalid conversion");
- }
}
- public byte[] getBytes(final String name) throws JMSException
- {
- Object value = map.getProperty(new SimpleString(name));
-
- if (value == null)
- return null;
- if (value instanceof byte[])
- return (byte[]) value;
- else
- throw new MessageFormatException("Invalid conversion");
- }
-
public Object getObject(final String name) throws JMSException
{
Object val = map.getProperty(new SimpleString(name));
Modified: trunk/src/main/org/hornetq/utils/TypedProperties.java
===================================================================
--- trunk/src/main/org/hornetq/utils/TypedProperties.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/src/main/org/hornetq/utils/TypedProperties.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -41,6 +41,7 @@
import java.util.Map.Entry;
import org.hornetq.core.logging.Logger;
+import org.hornetq.core.message.PropertyConversionException;
import org.hornetq.core.remoting.spi.HornetQBuffer;
/**
@@ -119,7 +120,7 @@
doPutValue(key, new DoubleValue(value));
}
- public void putStringProperty(final SimpleString key, final SimpleString value)
+ public void putSimpleStringProperty(final SimpleString key, final SimpleString value)
{
checkCreateProperties();
doPutValue(key, value == null ? new NullValue() : new StringValue(value));
@@ -151,6 +152,262 @@
return doGetProperty(key);
}
+ public Boolean getBooleanProperty(final SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Boolean.valueOf(null);
+ }
+ else if (value instanceof Boolean)
+ {
+ return (Boolean)value;
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Boolean.valueOf(((SimpleString)value).toString()).booleanValue();
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public Byte getByteProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Byte.valueOf(null);
+ }
+ else if (value instanceof Byte)
+ {
+ return (Byte)value;
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Byte.parseByte(((SimpleString)value).toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public Character getCharProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ throw new NullPointerException("Invalid conversion");
+
+ if (value instanceof Character)
+ return ((Character) value).charValue();
+ else
+ throw new PropertyConversionException("Invalid conversion");
+ }
+
+ public byte[] getBytesProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return null;
+ }
+ else if (value instanceof byte[])
+ {
+ return (byte[])value;
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public Double getDoubleProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Double.valueOf(null);
+ }
+ else if (value instanceof Float)
+ {
+ return ((Float)value).doubleValue();
+ }
+ else if (value instanceof Double)
+ {
+ return (Double)value;
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Double.parseDouble(((SimpleString)value).toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public Integer getIntProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Integer.valueOf(null);
+ }
+ else if (value instanceof Integer)
+ {
+ return (Integer)value;
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).intValue();
+ }
+ else if (value instanceof Short)
+ {
+ return ((Short)value).intValue();
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Integer.parseInt(((SimpleString)value).toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public Long getLongProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Long.valueOf(null);
+ }
+ else if (value instanceof Long)
+ {
+ return (Long)value;
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).longValue();
+ }
+ else if (value instanceof Short)
+ {
+ return ((Short)value).longValue();
+ }
+ else if (value instanceof Integer)
+ {
+ return ((Integer)value).longValue();
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Long.parseLong(((SimpleString)value).toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public Short getShortProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Short.valueOf(null);
+ }
+ else if (value instanceof Byte)
+ {
+ return ((Byte)value).shortValue();
+ }
+ else if (value instanceof Short)
+ {
+ return (Short)value;
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Short.parseShort(((SimpleString)value).toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid Conversion.");
+ }
+ }
+
+ public Float getFloatProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+ if (value == null)
+ {
+ return Float.valueOf(null);
+ }
+
+ if (value instanceof Float)
+ {
+ return ((Float)value).floatValue();
+ }
+ else if (value instanceof SimpleString)
+ {
+ return Float.parseFloat(((SimpleString)value).toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
+ public SimpleString getSimpleStringProperty(SimpleString key) throws PropertyConversionException
+ {
+ Object value = doGetProperty(key);
+
+ if (value == null)
+ {
+ return null;
+ }
+
+ if (value instanceof SimpleString)
+ {
+ return (SimpleString)value;
+ }
+ else if (value instanceof Boolean)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Character)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Byte)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Short)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Integer)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Long)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Float)
+ {
+ return new SimpleString(value.toString());
+ }
+ else if (value instanceof Double)
+ {
+ return new SimpleString(value.toString());
+ }
+ else
+ {
+ throw new PropertyConversionException("Invalid conversion");
+ }
+ }
+
public Object removeProperty(final SimpleString key)
{
return doRemoveProperty(key);
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -640,14 +640,14 @@
{
if(NotificationType.BINDING_REMOVED == notification.getType())
{
- if(notification.getProperties().getProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
+ if(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
{
latch.countDown();
}
}
else if(NotificationType.BINDING_ADDED == notification.getType())
{
- if(notification.getProperties().getProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
+ if(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
{
latch.countDown();
}
@@ -737,14 +737,14 @@
{
if(NotificationType.BINDING_REMOVED == notification.getType())
{
- if(notification.getProperties().getProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
+ if(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
{
latch.countDown();
}
}
else if(NotificationType.BINDING_ADDED == notification.getType())
{
- if(notification.getProperties().getProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
+ if(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
{
latch.countDown();
}
@@ -831,14 +831,14 @@
{
if(NotificationType.BINDING_REMOVED == notification.getType())
{
- if(notification.getProperties().getProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
+ if(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
{
latch.countDown();
}
}
else if(NotificationType.BINDING_ADDED == notification.getType())
{
- if(notification.getProperties().getProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
+ if(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_ADDRESS).toString().equals("queues.testaddress"))
{
latch.countDown();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -869,14 +869,14 @@
assertEquals(1, notifListener.getNotifications().size());
Notification notif = notifListener.getNotifications().get(0);
assertEquals(NotificationType.DISCOVERY_GROUP_STARTED, notif.getType());
- assertEquals(dg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(dg.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
dg.stop();
assertEquals(2, notifListener.getNotifications().size());
notif = notifListener.getNotifications().get(1);
assertEquals(NotificationType.DISCOVERY_GROUP_STOPPED, notif.getType());
- assertEquals(dg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(dg.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
}
public void testBroadcastGroupNotifications() throws Exception
@@ -898,14 +898,14 @@
assertEquals(1, notifListener.getNotifications().size());
Notification notif = notifListener.getNotifications().get(0);
assertEquals(NotificationType.BROADCAST_GROUP_STARTED, notif.getType());
- assertEquals(bg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(bg.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
bg.stop();
assertEquals(2, notifListener.getNotifications().size());
notif = notifListener.getNotifications().get(1);
assertEquals(NotificationType.BROADCAST_GROUP_STOPPED, notif.getType());
- assertEquals(bg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(bg.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
}
private TransportConfiguration generateTC()
Modified: trunk/tests/src/org/hornetq/tests/integration/management/AcceptorControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/AcceptorControlTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/integration/management/AcceptorControlTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -164,14 +164,14 @@
assertEquals(1, notifListener.getNotifications().size());
Notification notif = notifListener.getNotifications().get(0);
assertEquals(NotificationType.ACCEPTOR_STOPPED, notif.getType());
- assertEquals(InVMAcceptorFactory.class.getName(), (notif.getProperties().getProperty(new SimpleString("factory")).toString()));
+ assertEquals(InVMAcceptorFactory.class.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString()));
acceptorControl.start();
assertEquals(2, notifListener.getNotifications().size());
notif = notifListener.getNotifications().get(1);
assertEquals(NotificationType.ACCEPTOR_STARTED, notif.getType());
- assertEquals(InVMAcceptorFactory.class.getName(), (notif.getProperties().getProperty(new SimpleString("factory")).toString()));
+ assertEquals(InVMAcceptorFactory.class.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("factory")).toString()));
}
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -120,14 +120,14 @@
assertEquals(1, notifListener.getNotifications().size());
Notification notif = notifListener.getNotifications().get(0);
assertEquals(NotificationType.BRIDGE_STOPPED, notif.getType());
- assertEquals(bridgeControl.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(bridgeControl.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
bridgeControl.start();
assertEquals(2, notifListener.getNotifications().size());
notif = notifListener.getNotifications().get(1);
assertEquals(NotificationType.BRIDGE_STARTED, notif.getType());
- assertEquals(bridgeControl.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(bridgeControl.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
}
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -163,14 +163,14 @@
assertTrue(notifListener.getNotifications().size() > 0);
Notification notif = notifListener.getNotifications().get(notifListener.getNotifications().size() - 1);
assertEquals(NotificationType.CLUSTER_CONNECTION_STOPPED, notif.getType());
- assertEquals(clusterConnectionControl.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(clusterConnectionControl.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
clusterConnectionControl.start();
assertTrue(notifListener.getNotifications().size() > 0);
notif = notifListener.getNotifications().get(notifListener.getNotifications().size() - 1);
assertEquals(NotificationType.CLUSTER_CONNECTION_STARTED, notif.getType());
- assertEquals(clusterConnectionControl.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ assertEquals(clusterConnectionControl.getName(), (notif.getProperties().getSimpleStringProperty(new SimpleString("name")).toString()));
}
// Package protected ---------------------------------------------
Deleted: trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -1,343 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.tests.unit.core.message.impl;
-
-import static org.hornetq.tests.util.RandomUtil.randomBoolean;
-import static org.hornetq.tests.util.RandomUtil.randomByte;
-import static org.hornetq.tests.util.RandomUtil.randomDouble;
-import static org.hornetq.tests.util.RandomUtil.randomFloat;
-import static org.hornetq.tests.util.RandomUtil.randomInt;
-import static org.hornetq.tests.util.RandomUtil.randomShort;
-import static org.hornetq.tests.util.RandomUtil.randomSimpleString;
-import static org.hornetq.tests.util.UnitTestCase.assertEqualsByteArrays;
-import junit.framework.TestCase;
-
-import org.hornetq.core.client.impl.ClientMessageImpl;
-import org.hornetq.core.message.Message;
-import org.hornetq.core.message.PropertyConversionException;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.utils.SimpleString;
-
-/**
- * A MessagePropertyConversionTest
- *
- * @author jmesnil
- *
- *
- */
-public class MessagePropertyConversionTest extends TestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private Message msg;
-
- private SimpleString key;
-
- private SimpleString unknownKey = new SimpleString("this.key.is.never.used");
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- key = randomSimpleString();
- msg = new ClientMessageImpl(false);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- key = null;
- msg = null;
-
- super.tearDown();
- }
-
- public void testBooleanProperty() throws Exception
- {
- Boolean val = randomBoolean();
- msg.putBooleanProperty(key, val);
-
- assertEquals(val, msg.getBooleanProperty(key));
- assertEquals(Boolean.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Boolean.toString(val)));
- assertEquals(val, msg.getBooleanProperty(key));
-
- try
- {
- msg.putByteProperty(key, randomByte());
- msg.getBooleanProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- assertFalse(msg.getBooleanProperty(unknownKey));
- }
-
- public void testByteProperty() throws Exception
- {
- Byte val = randomByte();
- msg.putByteProperty(key, val);
-
- assertEquals(val, msg.getByteProperty(key));
- assertEquals(Byte.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Byte.toString(val)));
- assertEquals(val, msg.getByteProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getByteProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- msg.getByteProperty(unknownKey);
- fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testIntProperty() throws Exception
- {
- Integer val = randomInt();
- msg.putIntProperty(key, val);
-
- assertEquals(val, msg.getIntProperty(key));
- assertEquals(Integer.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Integer.toString(val)));
- assertEquals(val, msg.getIntProperty(key));
-
- Byte byteVal = randomByte();
- msg.putByteProperty(key, byteVal);
- assertEquals(Integer.valueOf(byteVal), msg.getIntProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getIntProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- msg.getIntProperty(unknownKey);
- fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testLongProperty() throws Exception
- {
- Long val = RandomUtil.randomLong();
- msg.putLongProperty(key, val);
-
- assertEquals(val, msg.getLongProperty(key));
- assertEquals(Long.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Long.toString(val)));
- assertEquals(val, msg.getLongProperty(key));
-
- Byte byteVal = randomByte();
- msg.putByteProperty(key, byteVal);
- assertEquals(Long.valueOf(byteVal), msg.getLongProperty(key));
-
- Short shortVal = randomShort();
- msg.putShortProperty(key, shortVal);
- assertEquals(Long.valueOf(shortVal), msg.getLongProperty(key));
-
- Integer intVal = randomInt();
- msg.putIntProperty(key, intVal);
- assertEquals(Long.valueOf(intVal), msg.getLongProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getLongProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- msg.getLongProperty(unknownKey);
- fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testDoubleProperty() throws Exception
- {
- Double val = randomDouble();
- msg.putDoubleProperty(key, val);
-
- assertEquals(val, msg.getDoubleProperty(key));
- assertEquals(Double.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Double.toString(val)));
- assertEquals(val, msg.getDoubleProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getDoubleProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- msg.getDoubleProperty(unknownKey);
- fail();
- }
- catch (Exception e)
- {
- }
- }
-
- public void testFloatProperty() throws Exception
- {
- Float val = randomFloat();
- msg.putFloatProperty(key, val);
-
- assertEquals(val, msg.getFloatProperty(key));
- assertEquals(Double.valueOf(val), msg.getDoubleProperty(key));
- assertEquals(Float.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Float.toString(val)));
- assertEquals(val, msg.getFloatProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getFloatProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- msg.getFloatProperty(unknownKey);
- fail();
- }
- catch (Exception e)
- {
- }
- }
-
- public void testShortProperty() throws Exception
- {
- Short val = randomShort();
- msg.putShortProperty(key, val);
-
- assertEquals(val, msg.getShortProperty(key));
- assertEquals(Integer.valueOf(val), msg.getIntProperty(key));
- assertEquals(Short.toString(val), msg.getStringProperty(key));
-
- msg.putStringProperty(key, new SimpleString(Short.toString(val)));
- assertEquals(val, msg.getShortProperty(key));
-
- Byte byteVal = randomByte();
- msg.putByteProperty(key, byteVal);
- assertEquals(Short.valueOf(byteVal), msg.getShortProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getShortProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- try
- {
- msg.getShortProperty(unknownKey);
- fail();
- }
- catch (NumberFormatException e)
- {
- }
- }
-
- public void testStringProperty() throws Exception
- {
- SimpleString strVal = randomSimpleString();
- msg.putStringProperty(key, strVal);
- assertEquals(strVal.toString(), msg.getStringProperty(key));
- }
-
- public void testBytesProperty() throws Exception
- {
- byte[] val = RandomUtil.randomBytes();
- msg.putBytesProperty(key, val);
-
- assertEqualsByteArrays(val, msg.getBytesProperty(key));
-
- try
- {
- msg.putBooleanProperty(key, randomBoolean());
- msg.getBytesProperty(key);
- fail();
- }
- catch (PropertyConversionException e)
- {
- }
-
- assertNull(msg.getBytesProperty(unknownKey));
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied: trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java (from rev 8234, trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java)
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesConversionTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -0,0 +1,370 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.unit.util;
+
+import static org.hornetq.tests.util.RandomUtil.randomBoolean;
+import static org.hornetq.tests.util.RandomUtil.randomByte;
+import static org.hornetq.tests.util.RandomUtil.randomDouble;
+import static org.hornetq.tests.util.RandomUtil.randomFloat;
+import static org.hornetq.tests.util.RandomUtil.randomInt;
+import static org.hornetq.tests.util.RandomUtil.randomShort;
+import static org.hornetq.tests.util.RandomUtil.randomSimpleString;
+import static org.hornetq.tests.util.UnitTestCase.assertEqualsByteArrays;
+import junit.framework.TestCase;
+
+import org.hornetq.core.message.PropertyConversionException;
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.utils.SimpleString;
+import org.hornetq.utils.TypedProperties;
+
+/**
+ * A TypedPropertiesConversionTest
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class TypedPropertiesConversionTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private TypedProperties props;
+
+ private SimpleString key;
+
+ private SimpleString unknownKey = new SimpleString("this.key.is.never.used");
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ key = randomSimpleString();
+ props = new TypedProperties();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ key = null;
+ props = null;
+
+ super.tearDown();
+ }
+
+ public void testBooleanProperty() throws Exception
+ {
+ Boolean val = randomBoolean();
+ props.putBooleanProperty(key, val);
+
+ assertEquals(val, props.getBooleanProperty(key));
+ assertEquals(new SimpleString(Boolean.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Boolean.toString(val)));
+ assertEquals(val, props.getBooleanProperty(key));
+
+ try
+ {
+ props.putByteProperty(key, randomByte());
+ props.getBooleanProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ assertFalse(props.getBooleanProperty(unknownKey));
+ }
+
+ public void testCharProperty() throws Exception
+ {
+ Character val = RandomUtil.randomChar();
+ props.putCharProperty(key, val);
+
+ assertEquals(val, props.getCharProperty(key));
+ assertEquals(new SimpleString(Character.toString(val)), props.getSimpleStringProperty(key));
+
+ try
+ {
+ props.putByteProperty(key, randomByte());
+ props.getCharProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getCharProperty(unknownKey);
+ fail();
+ }
+ catch (NullPointerException e)
+ {
+ }
+ }
+
+ public void testByteProperty() throws Exception
+ {
+ Byte val = randomByte();
+ props.putByteProperty(key, val);
+
+ assertEquals(val, props.getByteProperty(key));
+ assertEquals(new SimpleString(Byte.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Byte.toString(val)));
+ assertEquals(val, props.getByteProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getByteProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getByteProperty(unknownKey);
+ fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testIntProperty() throws Exception
+ {
+ Integer val = randomInt();
+ props.putIntProperty(key, val);
+
+ assertEquals(val, props.getIntProperty(key));
+ assertEquals(new SimpleString(Integer.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Integer.toString(val)));
+ assertEquals(val, props.getIntProperty(key));
+
+ Byte byteVal = randomByte();
+ props.putByteProperty(key, byteVal);
+ assertEquals(Integer.valueOf(byteVal), props.getIntProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getIntProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getIntProperty(unknownKey);
+ fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testLongProperty() throws Exception
+ {
+ Long val = RandomUtil.randomLong();
+ props.putLongProperty(key, val);
+
+ assertEquals(val, props.getLongProperty(key));
+ assertEquals(new SimpleString(Long.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Long.toString(val)));
+ assertEquals(val, props.getLongProperty(key));
+
+ Byte byteVal = randomByte();
+ props.putByteProperty(key, byteVal);
+ assertEquals(Long.valueOf(byteVal), props.getLongProperty(key));
+
+ Short shortVal = randomShort();
+ props.putShortProperty(key, shortVal);
+ assertEquals(Long.valueOf(shortVal), props.getLongProperty(key));
+
+ Integer intVal = randomInt();
+ props.putIntProperty(key, intVal);
+ assertEquals(Long.valueOf(intVal), props.getLongProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getLongProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getLongProperty(unknownKey);
+ fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testDoubleProperty() throws Exception
+ {
+ Double val = randomDouble();
+ props.putDoubleProperty(key, val);
+
+ assertEquals(val, props.getDoubleProperty(key));
+ assertEquals(new SimpleString(Double.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Double.toString(val)));
+ assertEquals(val, props.getDoubleProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getDoubleProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getDoubleProperty(unknownKey);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ public void testFloatProperty() throws Exception
+ {
+ Float val = randomFloat();
+ props.putFloatProperty(key, val);
+
+ assertEquals(val, props.getFloatProperty(key));
+ assertEquals(Double.valueOf(val), props.getDoubleProperty(key));
+ assertEquals(new SimpleString(Float.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Float.toString(val)));
+ assertEquals(val, props.getFloatProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getFloatProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getFloatProperty(unknownKey);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+ }
+
+ public void testShortProperty() throws Exception
+ {
+ Short val = randomShort();
+ props.putShortProperty(key, val);
+
+ assertEquals(val, props.getShortProperty(key));
+ assertEquals(Integer.valueOf(val), props.getIntProperty(key));
+ assertEquals(new SimpleString(Short.toString(val)), props.getSimpleStringProperty(key));
+
+ props.putSimpleStringProperty(key, new SimpleString(Short.toString(val)));
+ assertEquals(val, props.getShortProperty(key));
+
+ Byte byteVal = randomByte();
+ props.putByteProperty(key, byteVal);
+ assertEquals(Short.valueOf(byteVal), props.getShortProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getShortProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ try
+ {
+ props.getShortProperty(unknownKey);
+ fail();
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ }
+
+ public void testSimpleStringProperty() throws Exception
+ {
+ SimpleString strVal = randomSimpleString();
+ props.putSimpleStringProperty(key, strVal);
+ assertEquals(strVal, props.getSimpleStringProperty(key));
+ }
+
+ public void testBytesProperty() throws Exception
+ {
+ byte[] val = RandomUtil.randomBytes();
+ props.putBytesProperty(key, val);
+
+ assertEqualsByteArrays(val, props.getBytesProperty(key));
+
+ try
+ {
+ props.putBooleanProperty(key, randomBoolean());
+ props.getBytesProperty(key);
+ fail();
+ }
+ catch (PropertyConversionException e)
+ {
+ }
+
+ assertNull(props.getBytesProperty(unknownKey));
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesTest.java 2009-11-06 12:02:52 UTC (rev 8238)
+++ trunk/tests/src/org/hornetq/tests/unit/util/TypedPropertiesTest.java 2009-11-06 13:31:14 UTC (rev 8239)
@@ -81,7 +81,7 @@
public void testCopyContructor() throws Exception
{
- props.putStringProperty(key, randomSimpleString());
+ props.putSimpleStringProperty(key, randomSimpleString());
TypedProperties copy = new TypedProperties(props);
@@ -94,7 +94,7 @@
public void testRemove() throws Exception
{
- props.putStringProperty(key, randomSimpleString());
+ props.putSimpleStringProperty(key, randomSimpleString());
assertTrue(props.containsProperty(key));
assertNotNull(props.getProperty(key));
@@ -107,7 +107,7 @@
public void testClear() throws Exception
{
- props.putStringProperty(key, randomSimpleString());
+ props.putSimpleStringProperty(key, randomSimpleString());
assertTrue(props.containsProperty(key));
assertNotNull(props.getProperty(key));
@@ -143,38 +143,11 @@
public void testNullProperty() throws Exception
{
- props.putStringProperty(key, null);
+ props.putSimpleStringProperty(key, null);
assertTrue(props.containsProperty(key));
assertNull(props.getProperty(key));
}
- public void testBooleanProperty() throws Exception
- {
- props.putBooleanProperty(key, true);
- boolean bool = (Boolean) props.getProperty(key);
- assertEquals(true, bool);
-
- props.putBooleanProperty(key, false);
- bool = (Boolean) props.getProperty(key);
- assertEquals(false, bool);
- }
-
- public void testByteProperty() throws Exception
- {
- byte b = randomByte();
- props.putByteProperty(key, b);
- byte bb = (Byte) props.getProperty(key);
- assertEquals(b, bb);
- }
-
- public void testBytesProperty() throws Exception
- {
- byte[] b = randomBytes();
- props.putBytesProperty(key, b);
- byte[] bb = (byte[]) props.getProperty(key);
- assertEqualsByteArrays(b, bb);
- }
-
public void testBytesPropertyWithNull() throws Exception
{
props.putBytesProperty(key, null);
@@ -184,63 +157,6 @@
assertNull(bb);
}
- public void testFloatProperty() throws Exception
- {
- float f = randomFloat();
- props.putFloatProperty(key, f);
- float ff = (Float) props.getProperty(key);
- assertEquals(f, ff);
- }
-
- public void testDoubleProperty() throws Exception
- {
- double d = randomDouble();
- props.putDoubleProperty(key, d);
- double dd = (Double) props.getProperty(key);
- assertEquals(d, dd);
- }
-
- public void testShortProperty() throws Exception
- {
- short s = randomShort();
- props.putShortProperty(key, s);
- short ss = (Short) props.getProperty(key);
- assertEquals(s, ss);
- }
-
- public void testIntProperty() throws Exception
- {
- int i = randomInt();
- props.putIntProperty(key, i);
- int ii = (Integer) props.getProperty(key);
- assertEquals(i, ii);
- }
-
- public void testLongProperty() throws Exception
- {
- long l = randomLong();
- props.putLongProperty(key, l);
- long ll = (Long) props.getProperty(key);
- assertEquals(l, ll);
- }
-
- public void testCharProperty() throws Exception
- {
- char c = randomChar();
- props.putCharProperty(key, c);
- char cc = (Character) props.getProperty(key);
- assertEquals(c, cc);
- }
-
- public void testSimpleString() throws Exception
- {
- props = new TypedProperties();
- SimpleString value = randomSimpleString();
- props.putStringProperty(key, value);
- SimpleString vv = (SimpleString)props.getProperty(key);
- assertEquals(value, vv);
- }
-
public void testTypedProperties() throws Exception
{
SimpleString longKey = randomSimpleString();
@@ -249,13 +165,13 @@
SimpleString simpleStringValue = randomSimpleString();
TypedProperties otherProps = new TypedProperties();
otherProps.putLongProperty(longKey, longValue);
- otherProps.putStringProperty(simpleStringKey, simpleStringValue);
+ otherProps.putSimpleStringProperty(simpleStringKey, simpleStringValue);
props.putTypedProperties(otherProps);
- long ll = (Long) props.getProperty(longKey);
+ long ll = props.getLongProperty(longKey);
assertEquals(longValue, ll);
- SimpleString ss = (SimpleString) props.getProperty(simpleStringKey);
+ SimpleString ss = props.getSimpleStringProperty(simpleStringKey);
assertEquals(simpleStringValue, ss);
}
@@ -289,10 +205,10 @@
props.putFloatProperty(randomSimpleString(), randomFloat());
props.putDoubleProperty(randomSimpleString(), randomDouble());
props.putCharProperty(randomSimpleString(), randomChar());
- props.putStringProperty(randomSimpleString(), randomSimpleString());
- props.putStringProperty(randomSimpleString(), null);
+ props.putSimpleStringProperty(randomSimpleString(), randomSimpleString());
+ props.putSimpleStringProperty(randomSimpleString(), null);
SimpleString keyToRemove = randomSimpleString();
- props.putStringProperty(keyToRemove, randomSimpleString());
+ props.putSimpleStringProperty(keyToRemove, randomSimpleString());
HornetQBuffer buffer = ChannelBuffers.dynamicBuffer(1024);
props.encode(buffer);
16 years, 6 months
JBoss hornetq SVN: r8238 - trunk/src/main/org/hornetq/jms/server/impl.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-11-06 07:02:52 -0500 (Fri, 06 Nov 2009)
New Revision: 8238
Modified:
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
fixed bogus condition (from r8237)
* configFileName can be null => the file deployment manager will use default name (hornetq-jms.xml)
* checked instead if JMSConfiguration object is null
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-11-06 10:46:19 UTC (rev 8237)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-11-06 12:02:52 UTC (rev 8238)
@@ -132,19 +132,21 @@
{
jmsManagementService.registerJMSServer(this);
- // start the JMS deployer only if the configuration is using configuration files
- if (configFileName != null)
+ // start the JMS deployer only if the configuration is not done using the JMSConfiguration object
+ if (config == null)
{
jmsDeployer = new JMSServerDeployer(this, deploymentManager, server.getConfiguration());
- jmsDeployer.setConfigFileNames(new String[] { configFileName });
+ if (configFileName != null)
+ {
+ jmsDeployer.setConfigFileNames(new String[] { configFileName });
+ }
jmsDeployer.start();
deploymentManager.start();
- }
-
- if (config != null)
+ }
+ else
{
deploy();
}
@@ -169,10 +171,7 @@
context = new InitialContext();
}
- if (configFileName != null)
- {
- deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
- }
+ deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
server.registerActivateCallback(this);
16 years, 6 months
JBoss hornetq SVN: r8237 - trunk/src/main/org/hornetq/jms/server/impl.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-11-06 05:46:19 -0500 (Fri, 06 Nov 2009)
New Revision: 8237
Modified:
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
Log:
JMS Server configuration
* do not start the file deployment manager if the JMSServer does not use config files
(but a JMSConfiguration object instead)
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-11-06 10:34:51 UTC (rev 8236)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-11-06 10:46:19 UTC (rev 8237)
@@ -49,6 +49,14 @@
/**
* A Deployer used to create and add to JNDI queues, topics and connection
* factories. Typically this would only be used in an app server env.
+ *
+ * JMS Connection Factories & Destinations can be configured either
+ * using configuration files or using a JMSConfiguration object.
+ *
+ * If configuration files are used, JMS resources are redeployed if the
+ * files content is changed.
+ * If a JMSConfiguration object is used, the JMS resources can not be
+ * redeployed.
*
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
@@ -124,18 +132,22 @@
{
jmsManagementService.registerJMSServer(this);
- jmsDeployer = new JMSServerDeployer(this, deploymentManager, server.getConfiguration());
-
+ // start the JMS deployer only if the configuration is using configuration files
if (configFileName != null)
{
+ jmsDeployer = new JMSServerDeployer(this, deploymentManager, server.getConfiguration());
+
jmsDeployer.setConfigFileNames(new String[] { configFileName });
- }
- jmsDeployer.start();
+ jmsDeployer.start();
- deploymentManager.start();
+ deploymentManager.start();
+ }
- deploy();
+ if (config != null)
+ {
+ deploy();
+ }
}
catch (Exception e)
{
@@ -157,8 +169,11 @@
context = new InitialContext();
}
- deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
-
+ if (configFileName != null)
+ {
+ deploymentManager = new FileDeploymentManager(server.getConfiguration().getFileDeployerScanPeriod());
+ }
+
server.registerActivateCallback(this);
server.start();
@@ -178,7 +193,10 @@
jmsDeployer.stop();
}
- deploymentManager.stop();
+ if (deploymentManager != null)
+ {
+ deploymentManager.stop();
+ }
for (String destination : destinations.keySet())
{
16 years, 6 months
JBoss hornetq SVN: r8236 - in trunk: src/main/org/hornetq/core/client/impl and 2 other directories.
by do-not-reply@jboss.org
Author: timfox
Date: 2009-11-06 05:34:51 -0500 (Fri, 06 Nov 2009)
New Revision: 8236
Removed:
trunk/tests/jms-tests/src/org/hornetq/jms/tests/stress/ConnectionConsumerStressTest.java
Modified:
trunk/src/main/org/hornetq/core/client/ClientSessionFactory.java
trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
Log:
refactored so each jms connection maintains it's own session factory
Modified: trunk/src/main/org/hornetq/core/client/ClientSessionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/ClientSessionFactory.java 2009-11-06 10:25:52 UTC (rev 8235)
+++ trunk/src/main/org/hornetq/core/client/ClientSessionFactory.java 2009-11-06 10:34:51 UTC (rev 8236)
@@ -175,4 +175,6 @@
boolean removeInterceptor(Interceptor interceptor);
void close();
+
+ ClientSessionFactory copy();
}
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2009-11-06 10:25:52 UTC (rev 8235)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientSessionFactoryImpl.java 2009-11-06 10:34:51 UTC (rev 8236)
@@ -29,6 +29,7 @@
import java.util.concurrent.TimeUnit;
import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
import org.hornetq.core.client.ConnectionLoadBalancingPolicy;
import org.hornetq.core.cluster.DiscoveryEntry;
import org.hornetq.core.cluster.DiscoveryGroup;
@@ -313,6 +314,67 @@
// Constructors
// ---------------------------------------------------------------------------------
+ public ClientSessionFactoryImpl(final ClientSessionFactory other)
+ {
+ discoveryAddress = other.getDiscoveryAddress();
+
+ discoveryPort = other.getDiscoveryPort();
+
+ staticConnectors = other.getStaticConnectors();
+
+ discoveryRefreshTimeout = other.getDiscoveryRefreshTimeout();
+
+ clientFailureCheckPeriod = other.getClientFailureCheckPeriod();
+
+ connectionTTL = other.getConnectionTTL();
+
+ callTimeout = other.getCallTimeout();
+
+ minLargeMessageSize = other.getMinLargeMessageSize();
+
+ consumerWindowSize = other.getConsumerWindowSize();
+
+ consumerMaxRate = other.getConsumerMaxRate();
+
+ confirmationWindowSize = other.getConfirmationWindowSize();
+
+ producerWindowSize = other.getProducerWindowSize();
+
+ producerMaxRate = other.getProducerMaxRate();
+
+ blockOnAcknowledge = other.isBlockOnAcknowledge();
+
+ blockOnPersistentSend = other.isBlockOnPersistentSend();
+
+ blockOnNonPersistentSend = other.isBlockOnNonPersistentSend();
+
+ autoGroup = other.isAutoGroup();
+
+ preAcknowledge = other.isPreAcknowledge();
+
+ ackBatchSize = other.getAckBatchSize();
+
+ connectionLoadBalancingPolicyClassName = other.getConnectionLoadBalancingPolicyClassName();
+
+ discoveryInitialWaitTimeout = other.getDiscoveryInitialWaitTimeout();
+
+ useGlobalPools = other.isUseGlobalPools();
+
+ scheduledThreadPoolMaxSize = other.getScheduledThreadPoolMaxSize();
+
+ threadPoolMaxSize = other.getThreadPoolMaxSize();
+
+ retryInterval = other.getRetryInterval();
+
+ retryIntervalMultiplier = other.getRetryIntervalMultiplier();
+
+ maxRetryInterval = other.getMaxRetryInterval();
+
+ reconnectAttempts = other.getReconnectAttempts();
+
+ failoverOnServerShutdown = other.isFailoverOnServerShutdown();
+ }
+
public ClientSessionFactoryImpl()
{
discoveryRefreshTimeout = DEFAULT_DISCOVERY_REFRESH_TIMEOUT;
@@ -884,7 +946,12 @@
closed = true;
}
-
+
+ public ClientSessionFactory copy()
+ {
+ return new ClientSessionFactoryImpl(this);
+ }
+
// DiscoveryListener implementation --------------------------------------------------------
public synchronized void connectorsChanged()
Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnection.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnection.java 2009-11-06 10:25:52 UTC (rev 8235)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnection.java 2009-11-06 10:34:51 UTC (rev 8236)
@@ -281,6 +281,8 @@
initialSession.close();
}
}
+
+ sessionFactory.close();
closed = true;
}
Modified: trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2009-11-06 10:25:52 UTC (rev 8235)
+++ trunk/src/main/org/hornetq/jms/client/HornetQConnectionFactory.java 2009-11-06 10:34:51 UTC (rev 8236)
@@ -11,7 +11,6 @@
* permissions and limitations under the License.
*/
-
package org.hornetq.jms.client;
import java.io.Serializable;
@@ -48,7 +47,7 @@
* @version <tt>$Revision$</tt> $Id$
*/
public class HornetQConnectionFactory implements ConnectionFactory, QueueConnectionFactory, TopicConnectionFactory,
- XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory, Serializable, Referenceable
+ XAConnectionFactory, XAQueueConnectionFactory, XATopicConnectionFactory, Serializable, Referenceable
{
// Constants ------------------------------------------------------------------------------------
@@ -93,7 +92,7 @@
}
public HornetQConnectionFactory(final TransportConfiguration connectorConfig,
- final TransportConfiguration backupConnectorConfig)
+ final TransportConfiguration backupConnectorConfig)
{
sessionFactory = new ClientSessionFactoryImpl(connectorConfig, backupConnectorConfig);
}
@@ -432,7 +431,7 @@
{
sessionFactory.setRetryInterval(retryInterval);
}
-
+
public synchronized long getMaxRetryInterval()
{
return sessionFactory.getMaxRetryInterval();
@@ -462,7 +461,7 @@
{
sessionFactory.setReconnectAttempts(reconnectAttempts);
}
-
+
public synchronized boolean isFailoverOnServerShutdown()
{
return sessionFactory.isFailoverOnServerShutdown();
@@ -518,24 +517,28 @@
// Protected ------------------------------------------------------------------------------------
protected synchronized HornetQConnection createConnectionInternal(final String username,
- final String password,
- final boolean isXA,
- final int type) throws JMSException
+ final String password,
+ final boolean isXA,
+ final int type) throws JMSException
{
readOnly = true;
+
+ //Note that each JMS connection gets it's own copy of the connection factory
+ //This means there is one underlying remoting connection per jms connection (if not load balanced)
+ ClientSessionFactory factory = sessionFactory.copy();
HornetQConnection connection = new HornetQConnection(username,
- password,
- type,
- clientID,
- dupsOKBatchSize,
- transactionBatchSize,
- sessionFactory);
+ password,
+ type,
+ clientID,
+ dupsOKBatchSize,
+ transactionBatchSize,
+ factory);
-
- try {
+ try
+ {
connection.authorize();
- }
+ }
catch (JMSException e)
{
try
Deleted: trunk/tests/jms-tests/src/org/hornetq/jms/tests/stress/ConnectionConsumerStressTest.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/stress/ConnectionConsumerStressTest.java 2009-11-06 10:25:52 UTC (rev 8235)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/stress/ConnectionConsumerStressTest.java 2009-11-06 10:34:51 UTC (rev 8236)
@@ -1,54 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.jms.tests.stress;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-
-/**
- *
- * A ConnectionConsumerStressTest.
- *
- * @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 2349 $</tt>
- *
- * $Id: StressTest.java 2349 2007-02-19 14:15:53Z timfox $
- */
-public class ConnectionConsumerStressTest extends JMSStressTestBase
-{
-
- public void testConnectionConsumer() throws Exception
- {
- Connection conn = cf.createConnection();
- conn.start();
-
- Session sessSend = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- Session sessReceive = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
- MessageProducer prod = sessSend.createProducer(queue1);
- prod.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
-
- Runner[] runners = new Runner[] { new Sender("prod1", sessSend, prod, 100000),
- new Receiver(conn, sessReceive, 100000, queue1) };
-
- runRunners(runners);
-
- conn.close();
- }
-
-}
16 years, 6 months
JBoss hornetq SVN: r8235 - in trunk/src/main/org/hornetq: jms/server/impl and 2 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-11-06 05:25:52 -0500 (Fri, 06 Nov 2009)
New Revision: 8235
Modified:
trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java
trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
Log:
unregistered JMS management resources when the JMS server is stopped
Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-11-06 10:25:52 UTC (rev 8235)
@@ -624,7 +624,7 @@
if (!unexpectedResourceNames.isEmpty())
{
log.warn("On ManagementService stop, there are " + unexpectedResourceNames.size() +
- " unexpected registered MBeans");
+ " unexpected registered MBeans: " + unexpectedResourceNames);
}
for (ObjectName on : this.registeredNames)
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-11-06 10:25:52 UTC (rev 8235)
@@ -201,6 +201,8 @@
jmsManagementService.unregisterJMSServer();
+ jmsManagementService.stop();
+
server.stop();
started = false;
Modified: trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2009-11-06 10:16:01 UTC (rev 8234)
+++ trunk/src/main/org/hornetq/jms/server/management/JMSManagementService.java 2009-11-06 10:25:52 UTC (rev 8235)
@@ -45,4 +45,6 @@
void registerConnectionFactory(String name, HornetQConnectionFactory connectionFactory, List<String> bindings) throws Exception;
void unregisterConnectionFactory(String name) throws Exception;
+
+ void stop() throws Exception;
}
Modified: trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
+++ trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2009-11-06 10:25:52 UTC (rev 8235)
@@ -27,8 +27,11 @@
import org.hornetq.jms.HornetQTopic;
import org.hornetq.jms.client.HornetQConnectionFactory;
import org.hornetq.jms.server.JMSServerManager;
+import org.hornetq.jms.server.management.ConnectionFactoryControl;
import org.hornetq.jms.server.management.JMSManagementService;
+import org.hornetq.jms.server.management.JMSQueueControl;
import org.hornetq.jms.server.management.JMSServerControl;
+import org.hornetq.jms.server.management.TopicControl;
/*
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -127,6 +130,22 @@
managementService.unregisterFromJMX(objectName);
managementService.unregisterFromRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name);
}
+
+ public void stop() throws Exception
+ {
+ for (Object resource : managementService.getResources(ConnectionFactoryControl.class))
+ {
+ unregisterConnectionFactory(((ConnectionFactoryControl)resource).getName());
+ }
+ for (Object resource : managementService.getResources(JMSQueueControl.class))
+ {
+ unregisterQueue(((JMSQueueControl)resource).getName());
+ }
+ for (Object resource : managementService.getResources(TopicControl.class))
+ {
+ unregisterTopic(((TopicControl)resource).getName());
+ }
+ }
// Package protected ---------------------------------------------
16 years, 6 months
JBoss hornetq SVN: r8234 - in trunk: examples/core/embedded-remote/src/org/hornetq/core/example and 25 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-11-06 05:16:01 -0500 (Fri, 06 Nov 2009)
New Revision: 8234
Modified:
trunk/examples/core/embedded-remote/src/org/hornetq/core/example/EmbeddedRemoteExample.java
trunk/examples/core/embedded/src/org/hornetq/core/example/EmbeddedExample.java
trunk/examples/core/microcontainer/src/org/hornetq/core/example/EmbeddedMicroContainerExample.java
trunk/examples/jms/bridge/src/org/hornetq/jms/example/HatColourChangeTransformer.java
trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
trunk/src/main/org/hornetq/core/client/management/impl/ManagementHelper.java
trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/hornetq/core/message/Message.java
trunk/src/main/org/hornetq/core/message/PropertyConversionException.java
trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java
trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java
trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
trunk/src/main/org/hornetq/jms/client/HornetQMessage.java
trunk/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java
trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
trunk/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
trunk/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java
trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java
trunk/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java
trunk/tests/src/org/hornetq/tests/integration/client/PagingTest.java
trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/SimpleTransformer.java
trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistrubtionTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java
trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/RandomReattachTest.java
trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
trunk/tests/src/org/hornetq/tests/integration/divert/DivertTest.java
trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java
trunk/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java
trunk/tests/src/org/hornetq/tests/integration/management/NotificationTest.java
trunk/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/SecurityNotificationTest.java
trunk/tests/src/org/hornetq/tests/integration/server/PredefinedQueueTest.java
trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessageImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakeFilter.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-176: typed property getters on the core Message class
* renamed Message.getProperty() to Message.getObjectProperty()
* added typed getter methods with a String key (in addition to getter with a SimpleString key)
* used typed getter methods in HornetQ source instead of the untyped metod getObjectProperty()
Modified: trunk/examples/core/embedded/src/org/hornetq/core/example/EmbeddedExample.java
===================================================================
--- trunk/examples/core/embedded/src/org/hornetq/core/example/EmbeddedExample.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/examples/core/embedded/src/org/hornetq/core/example/EmbeddedExample.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -94,7 +94,7 @@
// Step 8. Receive the message.
ClientMessage messageReceived = messageConsumer.receive(1000);
- System.out.println("Received TextMessage:" + messageReceived.getObjectProperty(propName));
+ System.out.println("Received TextMessage:" + messageReceived.getStringProperty(propName));
}
finally
{
Modified: trunk/examples/core/embedded-remote/src/org/hornetq/core/example/EmbeddedRemoteExample.java
===================================================================
--- trunk/examples/core/embedded-remote/src/org/hornetq/core/example/EmbeddedRemoteExample.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/examples/core/embedded-remote/src/org/hornetq/core/example/EmbeddedRemoteExample.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -86,7 +86,7 @@
// Step 9. Receive the message.
ClientMessage messageReceived = messageConsumer.receive(1000);
- System.out.println("Received TextMessage:" + messageReceived.getObjectProperty(propName));
+ System.out.println("Received TextMessage:" + messageReceived.getStringProperty(propName));
}
finally
{
Modified: trunk/examples/core/microcontainer/src/org/hornetq/core/example/EmbeddedMicroContainerExample.java
===================================================================
--- trunk/examples/core/microcontainer/src/org/hornetq/core/example/EmbeddedMicroContainerExample.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/examples/core/microcontainer/src/org/hornetq/core/example/EmbeddedMicroContainerExample.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -87,7 +87,7 @@
// Step 7. Receive the message.
ClientMessage messageReceived = messageConsumer.receive(1000);
- System.out.println("Received TextMessage:" + messageReceived.getObjectProperty(propName));
+ System.out.println("Received TextMessage:" + messageReceived.getStringProperty(propName));
}
finally
{
Modified: trunk/examples/jms/bridge/src/org/hornetq/jms/example/HatColourChangeTransformer.java
===================================================================
--- trunk/examples/jms/bridge/src/org/hornetq/jms/example/HatColourChangeTransformer.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/examples/jms/bridge/src/org/hornetq/jms/example/HatColourChangeTransformer.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -31,7 +31,7 @@
{
SimpleString propName = new SimpleString("hat");
- SimpleString oldProp = (SimpleString)message.getProperty(propName);
+ SimpleString oldProp = message.getSimpleStringProperty(propName);
System.out.println("Old hat colour is " + oldProp);
Modified: trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/client/impl/ClientConsumerImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -248,7 +248,7 @@
if (m.containsProperty(FORCED_DELIVERY_MESSAGE))
{
- Long seq = (Long)m.getProperty(FORCED_DELIVERY_MESSAGE);
+ long seq = m.getLongProperty(FORCED_DELIVERY_MESSAGE);
if (seq >= forceDeliveryCount.longValue())
{
// forced delivery messages are discarded, nothing has been delivered by the queue
Modified: trunk/src/main/org/hornetq/core/client/management/impl/ManagementHelper.java
===================================================================
--- trunk/src/main/org/hornetq/core/client/management/impl/ManagementHelper.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/client/management/impl/ManagementHelper.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -357,7 +357,7 @@
}
if (message.containsProperty(HDR_OPERATION_SUCCEEDED))
{
- return (Boolean)message.getProperty(HDR_OPERATION_SUCCEEDED);
+ return message.getBooleanProperty(HDR_OPERATION_SUCCEEDED);
}
return false;
}
Modified: trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/filter/impl/FilterImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -155,7 +155,7 @@
if (val == null)
{
- val = message.getProperty(id.getName());
+ val = message.getObjectProperty(id.getName());
}
id.setValue(val);
Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -415,13 +415,13 @@
ServerMessageImpl reply = new ServerMessageImpl(storageManager.generateUniqueID());
reply.setBody(ChannelBuffers.dynamicBuffer(1024));
- SimpleString resourceName = (SimpleString)message.getProperty(ManagementHelper.HDR_RESOURCE_NAME);
+ String resourceName = message.getStringProperty(ManagementHelper.HDR_RESOURCE_NAME);
if (log.isDebugEnabled())
{
log.debug("handling management message for " + resourceName);
}
- SimpleString operation = (SimpleString)message.getProperty(ManagementHelper.HDR_OPERATION_NAME);
+ String operation = message.getStringProperty(ManagementHelper.HDR_OPERATION_NAME);
if (operation != null)
{
@@ -434,7 +434,7 @@
try
{
- Object result = invokeOperation(resourceName.toString(), operation.toString(), params);
+ Object result = invokeOperation(resourceName, operation, params);
ManagementHelper.storeResult(reply, result);
@@ -457,13 +457,13 @@
}
else
{
- SimpleString attribute = (SimpleString)message.getProperty(ManagementHelper.HDR_ATTRIBUTE);
+ String attribute = message.getStringProperty(ManagementHelper.HDR_ATTRIBUTE);
if (attribute != null)
{
try
{
- Object result = getAttribute(resourceName.toString(), attribute.toString());
+ Object result = getAttribute(resourceName, attribute);
ManagementHelper.storeResult(reply, result);
}
Modified: trunk/src/main/org/hornetq/core/message/Message.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/Message.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/message/Message.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -139,34 +139,54 @@
void putTypedProperties(TypedProperties properties);
- Object getProperty(SimpleString key);
-
Object removeProperty(SimpleString key);
boolean containsProperty(SimpleString key);
- Object getObjectProperty(String key);
-
Boolean getBooleanProperty(SimpleString key) throws PropertyConversionException;
+ Boolean getBooleanProperty(String key) throws PropertyConversionException;
+
Byte getByteProperty(SimpleString key) throws PropertyConversionException;
+ Byte getByteProperty(String key) throws PropertyConversionException;
+
Double getDoubleProperty(SimpleString key) throws PropertyConversionException;
+ Double getDoubleProperty(String key) throws PropertyConversionException;
+
Integer getIntProperty(SimpleString key) throws PropertyConversionException;
+ Integer getIntProperty(String key) throws PropertyConversionException;
+
Long getLongProperty(SimpleString key) throws PropertyConversionException;
+ Long getLongProperty(String key) throws PropertyConversionException;
+
Object getObjectProperty(SimpleString key);
+ Object getObjectProperty(String key);
+
Short getShortProperty(SimpleString key) throws PropertyConversionException;
+ Short getShortProperty(String key) throws PropertyConversionException;
+
Float getFloatProperty(SimpleString key) throws PropertyConversionException;
+ Float getFloatProperty(String key) throws PropertyConversionException;
+
String getStringProperty(SimpleString key) throws PropertyConversionException;
+ String getStringProperty(String key) throws PropertyConversionException;
+
+ SimpleString getSimpleStringProperty(SimpleString key) throws PropertyConversionException;
+
+ SimpleString getSimpleStringProperty(String key) throws PropertyConversionException;
+
byte[] getBytesProperty(SimpleString key) throws PropertyConversionException;
+ byte[] getBytesProperty(String key) throws PropertyConversionException;
+
Object removeProperty(String key);
boolean containsProperty(String key);
Modified: trunk/src/main/org/hornetq/core/message/PropertyConversionException.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/PropertyConversionException.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/message/PropertyConversionException.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -20,7 +20,7 @@
*
*
*/
-public class PropertyConversionException extends Exception
+public class PropertyConversionException extends RuntimeException
{
private static final long serialVersionUID = -3010008708334904332L;
Modified: trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/message/impl/MessageImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -502,14 +502,14 @@
properties.putTypedProperties(otherProps);
}
- public Object getProperty(final SimpleString key)
+ public Object getObjectProperty(final SimpleString key)
{
return properties.getProperty(key);
}
public Boolean getBooleanProperty(SimpleString key) throws PropertyConversionException
{
- final Object value = getObjectProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
return Boolean.valueOf(null);
@@ -528,10 +528,15 @@
throw new PropertyConversionException("Invalid conversion");
}
}
+
+ public Boolean getBooleanProperty(String key) throws PropertyConversionException
+ {
+ return getBooleanProperty(new SimpleString(key));
+ }
public Byte getByteProperty(SimpleString key) throws PropertyConversionException
{
- final Object value = properties.getProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
@@ -552,13 +557,18 @@
}
}
+ public Byte getByteProperty(String key) throws PropertyConversionException
+ {
+ return getByteProperty(new SimpleString(key));
+ }
+
public byte[] getBytesProperty(SimpleString key) throws PropertyConversionException
{
- final Object value = properties.getProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
- throw new IllegalArgumentException(key + " property is not defined");
+ return null;
}
if (value instanceof byte[])
@@ -570,10 +580,15 @@
throw new PropertyConversionException("Invalid conversion");
}
}
+
+ public byte[] getBytesProperty(String key) throws PropertyConversionException
+ {
+ return getBytesProperty(new SimpleString(key));
+ }
public Double getDoubleProperty(SimpleString key) throws PropertyConversionException
{
- Object value = getProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
return Double.valueOf(null);
@@ -597,9 +612,14 @@
}
}
+ public Double getDoubleProperty(String key) throws PropertyConversionException
+ {
+ return getDoubleProperty(new SimpleString(key));
+ }
+
public Integer getIntProperty(SimpleString key) throws PropertyConversionException
{
- Object value = getObjectProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
return Integer.valueOf(null);
@@ -626,9 +646,14 @@
}
}
+ public Integer getIntProperty(String key) throws PropertyConversionException
+ {
+ return getIntProperty(new SimpleString(key));
+ }
+
public Long getLongProperty(SimpleString key) throws PropertyConversionException
{
- Object value = getObjectProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
return Long.valueOf(null);
@@ -658,10 +683,15 @@
throw new PropertyConversionException("Invalid conversion");
}
}
+
+ public Long getLongProperty(String key) throws PropertyConversionException
+ {
+ return getLongProperty(new SimpleString(key));
+ }
public Short getShortProperty(SimpleString key) throws PropertyConversionException
{
- Object value = getObjectProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
return Short.valueOf(null);
@@ -682,12 +712,16 @@
{
throw new PropertyConversionException("Invalid Conversion.");
}
-
}
+
+ public Short getShortProperty(String key) throws PropertyConversionException
+ {
+ return getShortProperty(new SimpleString(key));
+ }
public Float getFloatProperty(SimpleString key) throws PropertyConversionException
{
- Object value = getProperty(key);
+ Object value = properties.getProperty(key);
if (value == null)
{
return Float.valueOf(null);
@@ -707,8 +741,32 @@
}
}
+ public Float getFloatProperty(String key) throws PropertyConversionException
+ {
+ return getFloatProperty(new SimpleString(key));
+ }
+
public String getStringProperty(SimpleString key) throws PropertyConversionException
{
+ SimpleString str = getSimpleStringProperty(key);
+
+ if (str == null)
+ {
+ return null;
+ }
+ else
+ {
+ return str.toString();
+ }
+ }
+
+ public String getStringProperty(String key) throws PropertyConversionException
+ {
+ return getStringProperty(new SimpleString(key));
+ }
+
+ public SimpleString getSimpleStringProperty(SimpleString key) throws PropertyConversionException
+ {
Object value = properties.getProperty(key);
if (value == null)
@@ -718,51 +776,51 @@
if (value instanceof SimpleString)
{
- return ((SimpleString)value).toString();
+ return (SimpleString)value;
}
else if (value instanceof Boolean)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else if (value instanceof Byte)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else if (value instanceof Short)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else if (value instanceof Integer)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else if (value instanceof Long)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else if (value instanceof Float)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else if (value instanceof Double)
{
- return value.toString();
+ return new SimpleString(value.toString());
}
else
{
throw new PropertyConversionException("Invalid conversion");
}
}
+
+ public SimpleString getSimpleStringProperty(String key) throws PropertyConversionException
+ {
+ return getSimpleStringProperty(new SimpleString(key));
+ }
public Object getObjectProperty(final String key)
{
return properties.getProperty(new SimpleString(key));
}
-
- public Object getObjectProperty(final SimpleString key)
- {
- return properties.getProperty(key);
- }
public Object removeProperty(final SimpleString key)
{
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -237,11 +237,11 @@
if (!routed)
{
- if (message.getProperty(MessageImpl.HDR_FROM_CLUSTER) != null)
+ if (message.containsProperty(MessageImpl.HDR_FROM_CLUSTER))
{
routeFromCluster(message, context);
}
- else if (groupingHandler != null && message.getProperty(MessageImpl.HDR_GROUP_ID) != null)
+ else if (groupingHandler != null && message.containsProperty(MessageImpl.HDR_GROUP_ID))
{
routeUsingStrictOrdering(message, context, groupingHandler);
}
@@ -374,7 +374,7 @@
final RoutingContext context,
final GroupingHandler groupingGroupingHandler) throws Exception
{
- SimpleString groupId = (SimpleString)message.getProperty(MessageImpl.HDR_GROUP_ID);
+ SimpleString groupId = message.getSimpleStringProperty(MessageImpl.HDR_GROUP_ID);
for (Map.Entry<SimpleString, List<Binding>> entry : routingNameBindingMap.entrySet())
{
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -543,7 +543,7 @@
SimpleString address = message.getDestination();
- Object duplicateID = message.getProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID);
+ Object duplicateID = message.getObjectProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID);
DuplicateIDCache cache = null;
@@ -672,10 +672,9 @@
MessageReference reference = message.createReference(queue);
- Long scheduledDeliveryTime = (Long)message.getProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
-
- if (scheduledDeliveryTime != null)
+ if (message.containsProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME))
{
+ Long scheduledDeliveryTime = message.getLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
reference.setScheduledDeliveryTime(scheduledDeliveryTime);
}
@@ -863,10 +862,9 @@
refs.add(reference);
- Long scheduledDeliveryTime = (Long)message.getProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
-
- if (scheduledDeliveryTime != null)
+ if (message.containsProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME))
{
+ Long scheduledDeliveryTime = message.getLongProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
reference.setScheduledDeliveryTime(scheduledDeliveryTime);
}
@@ -897,7 +895,7 @@
storageManager.storeReference(queue.getID(), message.getMessageID());
}
- if (scheduledDeliveryTime != null)
+ if (message.containsProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME))
{
if (tx != null)
{
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/BridgeImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -408,7 +408,7 @@
Set<SimpleString> propNames = new HashSet<SimpleString>(message.getPropertyNames());
- byte[] queueIds = (byte[])message.getProperty(idsHeaderName);
+ byte[] queueIds = message.getBytesProperty(idsHeaderName);
for (SimpleString propName : propNames)
{
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -495,7 +495,7 @@
try
{
// Reset the bindings
- if (message.getProperty(HDR_RESET_QUEUE_DATA) != null)
+ if (message.containsProperty(HDR_RESET_QUEUE_DATA))
{
clearBindings();
@@ -511,7 +511,7 @@
// TODO - optimised this by just passing int in header - but filter needs to be extended to support IN with
// a list of integers
- SimpleString type = (SimpleString)message.getProperty(ManagementHelper.HDR_NOTIFICATION_TYPE);
+ SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_NOTIFICATION_TYPE);
NotificationType ntype = NotificationType.valueOf(type.toString());
@@ -566,16 +566,16 @@
* */
private synchronized void doProposalReceived(final ClientMessage message) throws Exception
{
- SimpleString type = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID);
-
- if (type == null)
+ if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID))
{
throw new IllegalStateException("proposal type is null");
}
+
+ SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID);
- SimpleString val = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_VALUE);
+ SimpleString val = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE);
- Integer hops = (Integer) message.getProperty(ManagementHelper.HDR_DISTANCE);
+ Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE);
Response response = server.getGroupingHandler().receive(new Proposal(type, val), hops + 1);
@@ -591,14 +591,15 @@
* */
private synchronized void doProposalResponseReceived(final ClientMessage message) throws Exception
{
- SimpleString type = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID);
- if (type == null)
+ if (!message.containsProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID))
{
throw new IllegalStateException("proposal type is null");
}
- SimpleString val = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_VALUE);
- SimpleString alt = (SimpleString) message.getProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE);
- Integer hops = (Integer) message.getProperty(ManagementHelper.HDR_DISTANCE);
+
+ SimpleString type = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID);
+ SimpleString val = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_VALUE);
+ SimpleString alt = message.getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_ALT_VALUE);
+ Integer hops = message.getIntProperty(ManagementHelper.HDR_DISTANCE);
Response response = new Response(type, val, alt);
server.getGroupingHandler().proposed(response);
server.getGroupingHandler().send(response, hops + 1);
@@ -614,43 +615,43 @@
private synchronized void doBindingAdded(final ClientMessage message) throws Exception
{
- Integer distance = (Integer)message.getProperty(ManagementHelper.HDR_DISTANCE);
-
- if (distance == null)
+ if (!message.containsProperty(ManagementHelper.HDR_DISTANCE))
{
throw new IllegalStateException("distance is null");
}
- SimpleString queueAddress = (SimpleString)message.getProperty(ManagementHelper.HDR_ADDRESS);
-
- if (queueAddress == null)
+ if (!message.containsProperty(ManagementHelper.HDR_ADDRESS))
{
throw new IllegalStateException("queueAddress is null");
}
- SimpleString clusterName = (SimpleString)message.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
-
- if (clusterName == null)
+ if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME))
{
throw new IllegalStateException("clusterName is null");
}
- SimpleString routingName = (SimpleString)message.getProperty(ManagementHelper.HDR_ROUTING_NAME);
-
- if (routingName == null)
+ if (!message.containsProperty(ManagementHelper.HDR_ROUTING_NAME))
{
throw new IllegalStateException("routingName is null");
}
-
- SimpleString filterString = (SimpleString)message.getProperty(ManagementHelper.HDR_FILTERSTRING);
-
- Long queueID = (Long)message.getProperty(ManagementHelper.HDR_BINDING_ID);
-
- if (queueID == null)
+
+ if (!message.containsProperty(ManagementHelper.HDR_BINDING_ID))
{
throw new IllegalStateException("queueID is null");
}
+ Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE);
+
+ SimpleString queueAddress = message.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS);
+
+ SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
+
+ SimpleString routingName = message.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
+
+ SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
+
+ Long queueID = message.getLongProperty(ManagementHelper.HDR_BINDING_ID);
+
RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateUniqueID(),
queueAddress,
clusterName,
@@ -692,12 +693,12 @@
private void doBindingRemoved(final ClientMessage message) throws Exception
{
- SimpleString clusterName = (SimpleString)message.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
-
- if (clusterName == null)
+ if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME))
{
throw new IllegalStateException("clusterName is null");
}
+
+ SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
removeBinding(clusterName);
}
@@ -716,23 +717,23 @@
private synchronized void doConsumerCreated(final ClientMessage message) throws Exception
{
- Integer distance = (Integer)message.getProperty(ManagementHelper.HDR_DISTANCE);
-
- if (distance == null)
+ if (!message.containsProperty(ManagementHelper.HDR_DISTANCE))
{
throw new IllegalStateException("distance is null");
}
- SimpleString clusterName = (SimpleString)message.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
-
- if (clusterName == null)
+ if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME))
{
throw new IllegalStateException("clusterName is null");
}
+ Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE);
+
+ SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
+
message.putIntProperty(ManagementHelper.HDR_DISTANCE, distance + 1);
- SimpleString filterString = (SimpleString)message.getProperty(ManagementHelper.HDR_FILTERSTRING);
+ SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
RemoteQueueBinding binding = bindings.get(clusterName);
@@ -751,23 +752,23 @@
private synchronized void doConsumerClosed(final ClientMessage message) throws Exception
{
- Integer distance = (Integer)message.getProperty(ManagementHelper.HDR_DISTANCE);
-
- if (distance == null)
+ if (!message.containsProperty(ManagementHelper.HDR_DISTANCE))
{
throw new IllegalStateException("distance is null");
}
-
- SimpleString clusterName = (SimpleString)message.getProperty(ManagementHelper.HDR_CLUSTER_NAME);
-
- if (clusterName == null)
+
+ if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME))
{
throw new IllegalStateException("clusterName is null");
}
+ Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE);
+
+ SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
+
message.putIntProperty(ManagementHelper.HDR_DISTANCE, distance + 1);
- SimpleString filterString = (SimpleString)message.getProperty(ManagementHelper.HDR_FILTERSTRING);
+ SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
RemoteQueueBinding binding = bindings.get(clusterName);
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -179,7 +179,7 @@
public void route(final ServerMessage message, final RoutingContext context)
{
- byte[] ids = (byte[])message.getProperty(idsHeaderName);
+ byte[] ids = message.getBytesProperty(idsHeaderName);
if (ids == null)
{
Modified: trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -70,7 +70,7 @@
@Override
public synchronized void add(final MessageReference ref, final boolean first)
{
- SimpleString prop = (SimpleString)ref.getMessage().getProperty(MessageImpl.HDR_LAST_VALUE_NAME);
+ SimpleString prop = ref.getMessage().getSimpleStringProperty(MessageImpl.HDR_LAST_VALUE_NAME);
if (prop != null)
{
Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -1147,7 +1147,7 @@
initPagingStore(reference.getMessage().getDestination());
- final SimpleString groupID = (SimpleString)reference.getMessage().getProperty(MessageImpl.HDR_GROUP_ID);
+ final SimpleString groupID = reference.getMessage().getSimpleStringProperty(MessageImpl.HDR_GROUP_ID);
if (groupID != null)
{
@@ -1283,7 +1283,7 @@
Consumer consumer = distributionPolicy.getNextConsumer();
consumerCount++;
- final SimpleString groupId = (SimpleString)reference.getMessage().getProperty(MessageImpl.HDR_GROUP_ID);
+ final SimpleString groupId = reference.getMessage().getSimpleStringProperty(MessageImpl.HDR_GROUP_ID);
if (groupId != null)
{
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerMessageImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -208,11 +208,11 @@
public void setOriginalHeaders(final ServerMessage other, final boolean expiry)
{
- if (other.getProperty(HDR_ORIG_MESSAGE_ID) != null)
+ if (other.containsProperty(HDR_ORIG_MESSAGE_ID))
{
- putStringProperty(HDR_ORIGINAL_DESTINATION, (SimpleString)other.getProperty(HDR_ORIGINAL_DESTINATION));
+ putStringProperty(HDR_ORIGINAL_DESTINATION, other.getSimpleStringProperty(HDR_ORIGINAL_DESTINATION));
- putLongProperty(HDR_ORIG_MESSAGE_ID, (Long)other.getProperty(HDR_ORIG_MESSAGE_ID));
+ putLongProperty(HDR_ORIG_MESSAGE_ID, other.getLongProperty(HDR_ORIG_MESSAGE_ID));
}
else
{
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -1799,7 +1799,7 @@
ServerMessage reply = managementService.handleMessage(message);
- SimpleString replyTo = (SimpleString)message.getProperty(ClientMessageImpl.REPLYTO_HEADER_NAME);
+ SimpleString replyTo = message.getSimpleStringProperty(ClientMessageImpl.REPLYTO_HEADER_NAME);
if (replyTo != null)
{
Modified: trunk/src/main/org/hornetq/jms/client/HornetQMessage.java
===================================================================
--- trunk/src/main/org/hornetq/jms/client/HornetQMessage.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/src/main/org/hornetq/jms/client/HornetQMessage.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -338,7 +338,7 @@
{
if (msgID == null)
{
- SimpleString id = (SimpleString)message.getProperty(HORNETQ_MESSAGE_ID);
+ SimpleString id = message.getSimpleStringProperty(HORNETQ_MESSAGE_ID);
msgID = id == null ? null : id.toString();
}
@@ -374,7 +374,7 @@
public byte[] getJMSCorrelationIDAsBytes() throws JMSException
{
- Object obj = message.getProperty(CORRELATIONID_HEADER_NAME);
+ Object obj = message.getObjectProperty(CORRELATIONID_HEADER_NAME);
if (obj instanceof byte[])
{
@@ -415,12 +415,7 @@
{
if (jmsCorrelationID == null)
{
- Object obj = message.getProperty(CORRELATIONID_HEADER_NAME);
-
- if (obj != null)
- {
- jmsCorrelationID = ((SimpleString)obj).toString();
- }
+ jmsCorrelationID = message.getStringProperty(CORRELATIONID_HEADER_NAME);
}
return jmsCorrelationID;
@@ -430,7 +425,7 @@
{
if (replyTo == null)
{
- SimpleString repl = (SimpleString)message.getProperty(REPLYTO_HEADER_NAME);
+ SimpleString repl = message.getSimpleStringProperty(REPLYTO_HEADER_NAME);
if (repl != null)
{
@@ -539,7 +534,7 @@
{
if (jmsType == null)
{
- SimpleString ss = (SimpleString)message.getProperty(TYPE_HEADER_NAME);
+ SimpleString ss = message.getSimpleStringProperty(TYPE_HEADER_NAME);
if (ss != null)
{
@@ -732,7 +727,7 @@
return String.valueOf(message.getDeliveryCount());
}
- Object val = message.getProperty(new SimpleString(name));
+ Object val = message.getObjectProperty(name);
if (val instanceof SimpleString)
{
val = ((SimpleString)val).toString();
Modified: trunk/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/DuplicateDetectionTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -71,14 +71,14 @@
ClientMessage message = createMessage(session, 0);
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(0, message2.getProperty(propKey));
+ assertEquals(0, message2.getObjectProperty(propKey));
message = createMessage(session, 1);
SimpleString dupID = new SimpleString("abcdefg");
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
message2 = consumer.receive(1000);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
@@ -99,7 +99,7 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
producer.send(message);
message2 = consumer.receive(1000);
- assertEquals(4, message2.getProperty(propKey));
+ assertEquals(4, message2.getObjectProperty(propKey));
message = createMessage(session, 5);
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
@@ -137,14 +137,14 @@
ClientMessage message = createMessage(session, 0);
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(0, message2.getProperty(propKey));
+ assertEquals(0, message2.getObjectProperty(propKey));
message = createMessage(session, 1);
SimpleString dupID = new SimpleString("abcdefg");
message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
producer.send(message);
message2 = consumer.receive(1000);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID);
@@ -165,7 +165,7 @@
message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
producer.send(message);
message2 = consumer.receive(1000);
- assertEquals(4, message2.getProperty(propKey));
+ assertEquals(4, message2.getObjectProperty(propKey));
message = createMessage(session, 5);
message.putStringProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2);
@@ -230,13 +230,13 @@
{
ClientMessage message = consumer1.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
message = consumer2.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
message = consumer3.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
}
log.info("Now sending more");
@@ -277,13 +277,13 @@
{
message = consumer1.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
message = consumer2.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
message = consumer3.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
}
for (int i = 0; i < cacheSize; i++)
@@ -325,13 +325,13 @@
{
message = consumer1.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
message = consumer2.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
message = consumer3.receive(1000);
assertNotNull(message);
- assertEquals(i, message.getProperty(propKey));
+ assertEquals(i, message.getObjectProperty(propKey));
}
session.close();
@@ -377,7 +377,7 @@
session.commit();
message = consumer.receive(250);
- assertEquals(1, message.getProperty(propKey));
+ assertEquals(1, message.getObjectProperty(propKey));
message = consumer.receive(250);
assertNull(message);
@@ -419,7 +419,7 @@
session.commit();
message = consumer.receive(250);
- assertEquals(1, message.getProperty(propKey));
+ assertEquals(1, message.getObjectProperty(propKey));
message = consumer.receive(250);
assertNull(message);
@@ -470,10 +470,10 @@
session.commit();
message = consumer.receive(250);
- assertEquals(0, message.getProperty(propKey));
+ assertEquals(0, message.getObjectProperty(propKey));
message = consumer.receive(250);
- assertEquals(1, message.getProperty(propKey));
+ assertEquals(1, message.getObjectProperty(propKey));
message = consumer.receive(250);
assertNull(message);
@@ -534,7 +534,7 @@
ClientConsumer consumer = session.createConsumer(queueName);
message = consumer.receive(250);
- assertEquals(0, message.getProperty(propKey));
+ assertEquals(0, message.getObjectProperty(propKey));
message = consumer.receive(250);
assertNull(message);
@@ -600,7 +600,7 @@
session.start(xid3, XAResource.TMNOFLAGS);
message = consumer.receive(250);
- assertEquals(1, message.getProperty(propKey));
+ assertEquals(1, message.getObjectProperty(propKey));
message = consumer.receive(250);
assertNull(message);
@@ -677,7 +677,7 @@
session.start(xid3, XAResource.TMNOFLAGS);
message = consumer.receive(250);
- assertEquals(1, message.getProperty(propKey));
+ assertEquals(1, message.getObjectProperty(propKey));
message = consumer.receive(250);
assertNull(message);
@@ -890,14 +890,14 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
SimpleString dupID2 = new SimpleString("hijklmnopqr");
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
producer.send(message);
message2 = consumer.receive(1000);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -975,7 +975,7 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(i, message2.getProperty(propKey));
+ assertEquals(i, message2.getObjectProperty(propKey));
}
session.close();
@@ -1053,7 +1053,7 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(i, message2.getProperty(propKey));
+ assertEquals(i, message2.getObjectProperty(propKey));
}
session.close();
@@ -1090,7 +1090,7 @@
{
//Message should get through
ClientMessage message2 = consumer.receive(1000);
- assertEquals(i, message2.getProperty(propKey));
+ assertEquals(i, message2.getObjectProperty(propKey));
}
else
{
@@ -1142,7 +1142,7 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(i, message2.getProperty(propKey));
+ assertEquals(i, message2.getObjectProperty(propKey));
}
session.close();
@@ -1190,7 +1190,7 @@
{
//Message should get through
ClientMessage message2 = consumer.receive(1000);
- assertEquals(i, message2.getProperty(propKey));
+ assertEquals(i, message2.getObjectProperty(propKey));
}
else
{
@@ -1239,14 +1239,14 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
ClientMessage message2 = consumer.receive(1000);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
SimpleString dupID2 = new SimpleString("hijklmnopqr");
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
producer.send(message);
message2 = consumer.receive(1000);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -1274,13 +1274,13 @@
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID.getData());
producer.send(message);
message2 = consumer.receive(200);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
producer.send(message);
message2 = consumer.receive(200);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -1323,7 +1323,7 @@
producer.send(message);
session.commit();
ClientMessage message2 = consumer.receive(1000);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
SimpleString dupID2 = new SimpleString("hijklmnopqr");
@@ -1331,7 +1331,7 @@
producer.send(message);
session.commit();
message2 = consumer.receive(1000);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -1360,14 +1360,14 @@
producer.send(message);
session.commit();
message2 = consumer.receive(200);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
message.putBytesProperty(MessageImpl.HDR_DUPLICATE_DETECTION_ID, dupID2.getData());
producer.send(message);
session.commit();
message2 = consumer.receive(200);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -1410,7 +1410,7 @@
ClientMessage message2 = consumer.receive(1000);
message2.acknowledge();
session.commit();
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message = createMessage(session, 2);
SimpleString dupID2 = new SimpleString("hijklmnopqr");
@@ -1420,7 +1420,7 @@
message2 = consumer.receive(1000);
message2.acknowledge();
session.commit();
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -1554,10 +1554,10 @@
session.start(xid3, XAResource.TMNOFLAGS);
ClientMessage message2 = consumer.receive(200);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message2 = consumer.receive(200);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
@@ -1651,10 +1651,10 @@
session.start(xid3, XAResource.TMNOFLAGS);
ClientMessage message2 = consumer.receive(200);
- assertEquals(1, message2.getProperty(propKey));
+ assertEquals(1, message2.getObjectProperty(propKey));
message2 = consumer.receive(200);
- assertEquals(2, message2.getProperty(propKey));
+ assertEquals(2, message2.getObjectProperty(propKey));
session.close();
Modified: trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/InterceptorTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -272,7 +272,7 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals("orange", ((SimpleString)message.getObjectProperty(key)).toString());
+ assertEquals("orange", message.getStringProperty(key));
}
server.getRemotingService().removeInterceptor(interceptor);
@@ -290,7 +290,7 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals("apple", ((SimpleString)message.getObjectProperty(key)).toString());
+ assertEquals("apple", message.getStringProperty(key));
}
session.close();
@@ -365,7 +365,7 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals("orange", ((SimpleString)message.getObjectProperty(key)).toString());
+ assertEquals("orange", message.getStringProperty(key));
}
sf.removeInterceptor(interceptor);
@@ -383,7 +383,7 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals("apple", ((SimpleString)message.getObjectProperty(key)).toString());
+ assertEquals("apple", message.getStringProperty(key));
}
session.close();
@@ -460,10 +460,10 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals(1, ((Integer)message.getObjectProperty("a")).intValue());
- assertEquals(2, ((Integer)message.getObjectProperty("b")).intValue());
- assertEquals(3, ((Integer)message.getObjectProperty("c")).intValue());
- assertEquals(4, ((Integer)message.getObjectProperty("d")).intValue());
+ assertEquals(1, message.getIntProperty("a").intValue());
+ assertEquals(2, message.getIntProperty("b").intValue());
+ assertEquals(3, message.getIntProperty("c").intValue());
+ assertEquals(4, message.getIntProperty("d").intValue());
}
server.getRemotingService().removeInterceptor(interceptor2);
@@ -479,10 +479,10 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals(1, ((Integer)message.getObjectProperty("a")).intValue());
- assertNull(message.getObjectProperty("b"));
- assertEquals(3, ((Integer)message.getObjectProperty("c")).intValue());
- assertEquals(4, ((Integer)message.getObjectProperty("d")).intValue());
+ assertEquals(1, message.getIntProperty("a").intValue());
+ assertFalse(message.containsProperty("b"));
+ assertEquals(3, message.getIntProperty("c").intValue());
+ assertEquals(4, message.getIntProperty("d").intValue());
}
@@ -549,10 +549,10 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals(1, ((Integer)message.getObjectProperty("a")).intValue());
- assertEquals(2, ((Integer)message.getObjectProperty("b")).intValue());
- assertEquals(3, ((Integer)message.getObjectProperty("c")).intValue());
- assertEquals(4, ((Integer)message.getObjectProperty("d")).intValue());
+ assertEquals(1, message.getIntProperty("a").intValue());
+ assertEquals(2, message.getIntProperty("b").intValue());
+ assertEquals(3, message.getIntProperty("c").intValue());
+ assertEquals(4, message.getIntProperty("d").intValue());
}
sf.removeInterceptor(interceptor2);
@@ -568,10 +568,10 @@
{
ClientMessage message = consumer.receive(1000);
- assertEquals(1, ((Integer)message.getObjectProperty("a")).intValue());
- assertNull(message.getObjectProperty("b"));
- assertEquals(3, ((Integer)message.getObjectProperty("c")).intValue());
- assertEquals(4, ((Integer)message.getObjectProperty("d")).intValue());
+ assertEquals(1, message.getIntProperty("a").intValue());
+ assertFalse(message.containsProperty("b"));
+ assertEquals(3, message.getIntProperty("c").intValue());
+ assertEquals(4, message.getIntProperty("d").intValue());
}
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ConsumerTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -365,7 +365,7 @@
{
ClientMessage message = (ClientMessage)consumer.receive();
- int count = (Integer)message.getObjectProperty("count");
+ int count = message.getIntProperty("count");
boolean redelivered = message.getDeliveryCount() > 1;
@@ -425,7 +425,7 @@
{
ClientMessage message = (ClientMessage)consumer.receive();
- int count = (Integer)message.getObjectProperty("count");
+ int count = message.getIntProperty("count");
boolean redelivered = message.getDeliveryCount() > 1;
Modified: trunk/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/DeadLetterAddressTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -196,9 +196,9 @@
assertEquals("Message:" + i, text);
// Check the headers
- SimpleString origDest = (SimpleString)tm.getProperty(MessageImpl.HDR_ORIGINAL_DESTINATION);
+ SimpleString origDest = (SimpleString)tm.getObjectProperty(MessageImpl.HDR_ORIGINAL_DESTINATION);
- Long origMessageId = (Long)tm.getProperty(MessageImpl.HDR_ORIG_MESSAGE_ID);
+ Long origMessageId = (Long)tm.getObjectProperty(MessageImpl.HDR_ORIG_MESSAGE_ID);
assertEquals(qName, origDest);
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ExpiryAddressTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -201,7 +201,7 @@
assertEquals("Message:" + i, text);
// Check the headers
- Long actualExpiryTime = (Long)tm.getProperty(HDR_ACTUAL_EXPIRY_TIME);
+ Long actualExpiryTime = (Long)tm.getObjectProperty(HDR_ACTUAL_EXPIRY_TIME);
assertTrue(actualExpiryTime >= expiration);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -218,7 +218,7 @@
msg.acknowledge();
- assertEquals(i, msg.getProperty(new SimpleString("key")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("key")));
}
session.close();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/LargeMessageTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -2045,7 +2045,7 @@
ClientMessage msg = consumer.receive(50000);
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("key")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("key")));
msg.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/MessageExpirationTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -172,8 +172,8 @@
ClientConsumer expiryConsumer = session.createConsumer(expiryQueue);
ClientMessage expiredMessage = expiryConsumer.receive(500);
assertNotNull(expiredMessage);
- assertNotNull(expiredMessage.getProperty(MessageImpl.HDR_ACTUAL_EXPIRY_TIME));
- assertEquals(address, expiredMessage.getProperty(MessageImpl.HDR_ORIGINAL_DESTINATION));
+ assertNotNull(expiredMessage.getObjectProperty(MessageImpl.HDR_ACTUAL_EXPIRY_TIME));
+ assertEquals(address, expiredMessage.getObjectProperty(MessageImpl.HDR_ORIGINAL_DESTINATION));
consumer.close();
expiryConsumer.close();
session.deleteQueue(queue);
Modified: trunk/tests/src/org/hornetq/tests/integration/client/PagingTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/PagingTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -162,7 +162,7 @@
assertNotNull(message2);
- assertEquals(i, ((Integer)message2.getProperty(new SimpleString("id"))).intValue());
+ assertEquals(i, ((Integer)message2.getObjectProperty(new SimpleString("id"))).intValue());
message2.acknowledge();
@@ -283,7 +283,7 @@
consumer.close();
}
- Integer messageID = (Integer)message.getProperty(new SimpleString("id"));
+ Integer messageID = (Integer)message.getObjectProperty(new SimpleString("id"));
assertNotNull(messageID);
assertEquals(messageID.intValue(), i);
@@ -304,7 +304,7 @@
assertNotNull(message);
- Integer messageID = (Integer)message.getProperty(new SimpleString("id"));
+ Integer messageID = (Integer)message.getObjectProperty(new SimpleString("id"));
assertNotNull(messageID);
assertEquals("message received out of order", messageID.intValue(), i);
@@ -432,7 +432,7 @@
assertNotNull(message2);
- Long scheduled = (Long)message2.getProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
+ Long scheduled = (Long)message2.getObjectProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
if (scheduled != null)
{
assertTrue("Scheduling didn't work", System.currentTimeMillis() >= scheduledTime);
Modified: trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -80,7 +80,7 @@
ClientMessage reply = requestor.request(request, 500);
assertNotNull("reply was not received", reply);
- assertEquals(value, reply.getProperty(key));
+ assertEquals(value, reply.getObjectProperty(key));
session.close();
}
@@ -108,14 +108,14 @@
ClientMessage reply = requestor.request(request, 500);
assertNotNull("reply was not received", reply);
- assertEquals(value, reply.getProperty(key));
+ assertEquals(value, reply.getObjectProperty(key));
request = session.createClientMessage(false);
request.putLongProperty(key, value + 1);
reply = requestor.request(request, 500);
assertNotNull("reply was not received", reply);
- assertEquals(value + 1, reply.getProperty(key));
+ assertEquals(value + 1, reply.getObjectProperty(key));
session.close();
}
@@ -191,7 +191,7 @@
ClientMessage reply = requestor.request(request, 500);
assertNotNull("reply was not received", reply);
- assertEquals(value, reply.getProperty(key));
+ assertEquals(value, reply.getObjectProperty(key));
request = session.createClientMessage(false);
request.putLongProperty(key, value + 1);
@@ -260,8 +260,8 @@
try
{
ClientMessage reply = session.createClientMessage(false);
- SimpleString replyTo = (SimpleString)request.getProperty(ClientMessageImpl.REPLYTO_HEADER_NAME);
- long value = (Long)request.getProperty(key);
+ SimpleString replyTo = (SimpleString)request.getObjectProperty(ClientMessageImpl.REPLYTO_HEADER_NAME);
+ long value = (Long)request.getObjectProperty(key);
reply.putLongProperty(key, value);
ClientProducer replyProducer = session.createProducer(replyTo);
replyProducer.send(reply);
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeReconnectTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -161,7 +161,7 @@
{
ClientMessage r1 = cons2.receive(1500);
assertNotNull(r1);
- assertEquals(i, r1.getProperty(propKey));
+ assertEquals(i, r1.getObjectProperty(propKey));
}
session0.close();
@@ -291,7 +291,7 @@
{
ClientMessage r1 = cons2.receive(1500);
assertNotNull(r1);
- assertEquals(i, r1.getProperty(propKey));
+ assertEquals(i, r1.getObjectProperty(propKey));
}
session0.close();
@@ -408,7 +408,7 @@
{
ClientMessage r1 = cons1.receive(1500);
assertNotNull(r1);
- assertEquals(i, r1.getProperty(propKey));
+ assertEquals(i, r1.getObjectProperty(propKey));
}
session0.close();
@@ -520,8 +520,8 @@
{
ClientMessage r1 = cons1.receive(30000);
assertNotNull(r1);
- assertEquals(i, r1.getProperty(propKey));
- log.info("got message " + r1.getProperty(propKey));
+ assertEquals(i, r1.getObjectProperty(propKey));
+ log.info("got message " + r1.getObjectProperty(propKey));
}
log.info("got messages");
@@ -632,7 +632,7 @@
{
ClientMessage r1 = cons1.receive(1500);
assertNotNull(r1);
- assertEquals(i, r1.getProperty(propKey));
+ assertEquals(i, r1.getObjectProperty(propKey));
}
// Fail again - should reconnect
@@ -653,7 +653,7 @@
{
ClientMessage r1 = cons1.receive(1500);
assertNotNull(r1);
- assertEquals(i, r1.getProperty(propKey));
+ assertEquals(i, r1.getObjectProperty(propKey));
}
session0.close();
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeStartTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -138,7 +138,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -168,7 +168,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -289,7 +289,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -311,7 +311,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -359,7 +359,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -490,7 +490,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -600,7 +600,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -639,7 +639,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -667,7 +667,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -169,7 +169,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
if (largeMessage)
{
@@ -367,7 +367,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
@@ -509,7 +509,7 @@
assertNotNull(message);
- SimpleString val = (SimpleString)message.getProperty(propKey);
+ SimpleString val = (SimpleString)message.getObjectProperty(propKey);
assertEquals(new SimpleString("bong"), val);
@@ -639,7 +639,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -151,7 +151,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -181,7 +181,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/SimpleTransformer.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/SimpleTransformer.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/bridge/SimpleTransformer.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -35,7 +35,7 @@
public ServerMessage transform(final ServerMessage message)
{
- SimpleString oldProp = (SimpleString)message.getProperty(new SimpleString("wibble"));
+ SimpleString oldProp = (SimpleString)message.getObjectProperty(new SimpleString("wibble"));
if (!oldProp.equals(new SimpleString("bing")))
{
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -569,7 +569,7 @@
assertTrue("Message received too soon", System.currentTimeMillis() >= firstReceiveTime);
}
- SimpleString id = (SimpleString)message.getProperty(MessageImpl.HDR_GROUP_ID);
+ SimpleString id = (SimpleString)message.getObjectProperty(MessageImpl.HDR_GROUP_ID);
System.out.println("received " + id + " on consumer " + consumerIDs[i]);
if (groupIdsReceived.get(id) == null)
{
@@ -665,10 +665,10 @@
assertTrue("Message received too soon", System.currentTimeMillis() >= firstReceiveTime);
}
- if (j != (Integer)(message.getProperty(COUNT_PROP)))
+ if (j != (Integer)(message.getObjectProperty(COUNT_PROP)))
{
outOfOrder = true;
- System.out.println("Message j=" + j + " was received out of order = " + message.getProperty(COUNT_PROP));
+ System.out.println("Message j=" + j + " was received out of order = " + message.getObjectProperty(COUNT_PROP));
}
}
}
@@ -724,7 +724,7 @@
{
log.info("check receive Consumer " + consumerIDs[i] +
" received message " +
- message.getProperty(COUNT_PROP));
+ message.getObjectProperty(COUNT_PROP));
}
else
{
@@ -753,7 +753,7 @@
assertNotNull("consumer " + consumerIDs[count] + " did not receive message " + i, message);
- assertEquals("consumer " + consumerIDs[count] + " message " + i, i, message.getProperty(COUNT_PROP));
+ assertEquals("consumer " + consumerIDs[count] + " message " + i, i, message.getObjectProperty(COUNT_PROP));
count++;
@@ -795,7 +795,7 @@
if (message != null)
{
- int count = (Integer)message.getProperty(COUNT_PROP);
+ int count = (Integer)message.getObjectProperty(COUNT_PROP);
Integer prevCount = countMap.get(i);
@@ -857,7 +857,7 @@
if (message != null)
{
- int count = (Integer)message.getProperty(COUNT_PROP);
+ int count = (Integer)message.getObjectProperty(COUNT_PROP);
// log.info("consumer " + consumerIDs[i] + " received message " + count);
@@ -945,7 +945,7 @@
if (message != null)
{
- int count = (Integer)message.getProperty(COUNT_PROP);
+ int count = (Integer)message.getObjectProperty(COUNT_PROP);
ints.add(count);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -260,7 +260,7 @@
// messages must remain ordered but there could be a "jump" if messages
// are missing or duplicated
- int count = (Integer)message.getObjectProperty("counter");
+ int count = message.getIntProperty("counter");
counts.add(count);
if (count != lastCount + 1)
{
@@ -379,7 +379,7 @@
// There may be some missing or duplicate messages - but the order should be correct
- int count = (Integer)message.getObjectProperty("counter");
+ int count = message.getIntProperty("counter");
assertTrue("count:" + count + " last count:" + lastCount, count >= lastCount);
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -155,7 +155,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -227,7 +227,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -393,7 +393,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -482,7 +482,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -553,7 +553,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -636,7 +636,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -659,7 +659,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -964,7 +964,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1041,7 +1041,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1127,7 +1127,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1228,7 +1228,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1393,7 +1393,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1465,7 +1465,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
}
fail(session, latch);
@@ -1482,7 +1482,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1545,7 +1545,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
}
fail(session, latch);
@@ -1564,7 +1564,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1628,7 +1628,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1658,7 +1658,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -1882,7 +1882,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -2022,7 +2022,7 @@
assertMessageBody(i, message);
- assertEquals(i, message.getObjectProperty("counter"));
+ assertEquals(i, message.getIntProperty("counter").intValue());
message.acknowledge();
}
@@ -2129,7 +2129,7 @@
assertEquals("aardvarks", message2.getBody().readString());
- assertEquals(i, message2.getProperty(new SimpleString("count")));
+ assertEquals(i, message2.getObjectProperty(new SimpleString("count")));
message2.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/PagingFailoverTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -142,7 +142,7 @@
{
session.commit();
}
- assertEquals((Integer)i, (Integer)msg.getProperty(new SimpleString("key")));
+ assertEquals((Integer)i, (Integer)msg.getObjectProperty(new SimpleString("key")));
}
session.commit();
@@ -166,7 +166,7 @@
assertNotNull(msg);
msg.acknowledge();
- int result = (Integer)msg.getProperty(new SimpleString("key"));
+ int result = (Integer)msg.getObjectProperty(new SimpleString("key"));
assertEquals(i, result);
}
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistrubtionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistrubtionTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedDistrubtionTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -92,7 +92,7 @@
System.out.println(i + " msg = " + msg);
- int received = (Integer)msg.getProperty(new SimpleString("key"));
+ int received = (Integer)msg.getObjectProperty(new SimpleString("key"));
if (i != received)
{
@@ -130,7 +130,7 @@
System.out.println(i + " msg = " + msg);
- int received = (Integer)msg.getProperty(new SimpleString("key"));
+ int received = (Integer)msg.getObjectProperty(new SimpleString("key"));
if (i != received)
{
@@ -199,7 +199,7 @@
System.out.println(i + " msg = " + msg);
- int received = (Integer)msg.getProperty(new SimpleString("key"));
+ int received = (Integer)msg.getObjectProperty(new SimpleString("key"));
if (i != received)
{
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -1377,8 +1377,8 @@
assertNotNull(msg);
- int tn = (Integer)msg.getProperty(new SimpleString("threadnum"));
- int cnt = (Integer)msg.getProperty(new SimpleString("count"));
+ int tn = (Integer)msg.getObjectProperty(new SimpleString("threadnum"));
+ int cnt = (Integer)msg.getObjectProperty(new SimpleString("count"));
Integer c = consumerCounts.get(tn);
if (c == null)
@@ -1456,8 +1456,8 @@
return;
}
- int threadNum = (Integer)message.getProperty(new SimpleString("threadnum"));
- int cnt = (Integer)message.getProperty(new SimpleString("count"));
+ int threadNum = (Integer)message.getObjectProperty(new SimpleString("threadnum"));
+ int cnt = (Integer)message.getObjectProperty(new SimpleString("count"));
Integer c = counts.get(threadNum);
if (c == null)
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/RandomReattachTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/RandomReattachTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/RandomReattachTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -305,7 +305,7 @@
fail("Too many messages");
}
- assertEquals(count, message.getProperty(new SimpleString("count")));
+ assertEquals(count, message.getObjectProperty(new SimpleString("count")));
count++;
@@ -424,7 +424,7 @@
fail("Too many messages");
}
- assertEquals(count, message.getProperty(new SimpleString("count")));
+ assertEquals(count, message.getObjectProperty(new SimpleString("count")));
count++;
@@ -548,7 +548,7 @@
fail("Too many messages");
}
- assertEquals(count, message.getProperty(new SimpleString("count")));
+ assertEquals(count, message.getObjectProperty(new SimpleString("count")));
count++;
@@ -702,7 +702,7 @@
fail("Too many messages");
}
- assertEquals(count, message.getProperty(new SimpleString("count")));
+ assertEquals(count, message.getObjectProperty(new SimpleString("count")));
count++;
@@ -835,7 +835,7 @@
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("count")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("count")));
msg.acknowledge();
}
@@ -932,7 +932,7 @@
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("count")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("count")));
msg.acknowledge();
}
@@ -1038,7 +1038,7 @@
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("count")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("count")));
msg.acknowledge();
}
@@ -1064,7 +1064,7 @@
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("count")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("count")));
msg.acknowledge();
}
@@ -1176,7 +1176,7 @@
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("count")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("count")));
msg.acknowledge();
}
@@ -1205,7 +1205,7 @@
assertNotNull(msg);
- assertEquals(i, msg.getProperty(new SimpleString("count")));
+ assertEquals(i, msg.getObjectProperty(new SimpleString("count")));
msg.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/reattach/ReattachTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -121,7 +121,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getObjectProperty(new SimpleString("count")));
message.acknowledge();
}
@@ -215,7 +215,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getIntProperty("count").intValue());
message.acknowledge();
}
@@ -330,7 +330,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getIntProperty("count").intValue());
message.acknowledge();
}
@@ -479,7 +479,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getIntProperty("count").intValue());
message.acknowledge();
}
@@ -565,7 +565,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getIntProperty("count").intValue());
message.acknowledge();
}
@@ -641,7 +641,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getObjectProperty(new SimpleString("count")));
message.acknowledge();
}
@@ -720,7 +720,7 @@
assertEquals("aardvarks", message.getBody().readString());
- assertEquals(i, message.getProperty(new SimpleString("count")));
+ assertEquals(i, message.getIntProperty("count").intValue());
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/divert/DivertTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/divert/DivertTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/divert/DivertTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -111,7 +111,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -124,7 +124,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -217,7 +217,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -230,7 +230,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -243,7 +243,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -256,7 +256,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -331,7 +331,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -422,7 +422,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -541,7 +541,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -554,7 +554,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -567,7 +567,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -580,7 +580,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -693,7 +693,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -706,7 +706,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -719,7 +719,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -834,7 +834,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -847,7 +847,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -982,7 +982,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -995,7 +995,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1008,7 +1008,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1032,7 +1032,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1151,7 +1151,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
@@ -1166,7 +1166,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
@@ -1181,7 +1181,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
@@ -1198,7 +1198,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -1313,7 +1313,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -1328,7 +1328,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
@@ -1341,7 +1341,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals(i, message.getIntProperty(propKey).intValue());
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/divert/PersistentDivertTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -128,7 +128,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -141,7 +141,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -154,7 +154,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -167,7 +167,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -280,7 +280,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -293,7 +293,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -306,7 +306,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -319,7 +319,7 @@
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/largemessage/LargeMessageTestBase.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -290,7 +290,7 @@
{
if (delayDelivery > 0)
{
- long originalTime = (Long)message.getProperty(new SimpleString("original-time"));
+ long originalTime = (Long)message.getObjectProperty(new SimpleString("original-time"));
assertTrue(System.currentTimeMillis() - originalTime + "<" + delayDelivery,
System.currentTimeMillis() - originalTime >= delayDelivery);
}
@@ -308,7 +308,7 @@
// the same
// scheduled delivery time
assertEquals(msgCounter,
- ((Integer)message.getProperty(new SimpleString("counter-message"))).intValue());
+ ((Integer)message.getObjectProperty(new SimpleString("counter-message"))).intValue());
}
if (useStreamOnConsume)
@@ -403,7 +403,7 @@
if (delayDelivery > 0)
{
- long originalTime = (Long)message.getProperty(new SimpleString("original-time"));
+ long originalTime = (Long)message.getObjectProperty(new SimpleString("original-time"));
assertTrue(System.currentTimeMillis() - originalTime + "<" + delayDelivery,
System.currentTimeMillis() - originalTime >= delayDelivery);
}
@@ -419,7 +419,7 @@
{
// right now there is no guarantee of ordered delivered on multiple scheduledMessages with the same
// scheduled delivery time
- assertEquals(i, ((Integer)message.getProperty(new SimpleString("counter-message"))).intValue());
+ assertEquals(i, ((Integer)message.getObjectProperty(new SimpleString("counter-message"))).intValue());
}
HornetQBuffer buffer = message.getBody();
Modified: trunk/tests/src/org/hornetq/tests/integration/management/NotificationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/NotificationTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/management/NotificationTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -77,9 +77,9 @@
session.createQueue(address, queue, durable);
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(BINDING_ADDED.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals(queue.toString(), notifications[0].getProperty(HDR_ROUTING_NAME).toString());
- assertEquals(address.toString(), notifications[0].getProperty(HDR_ADDRESS).toString());
+ assertEquals(BINDING_ADDED.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals(queue.toString(), notifications[0].getObjectProperty(HDR_ROUTING_NAME).toString());
+ assertEquals(address.toString(), notifications[0].getObjectProperty(HDR_ADDRESS).toString());
session.deleteQueue(queue);
}
@@ -98,9 +98,9 @@
session.createQueue(address, queue, durable);
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(BINDING_ADDED.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals(queue.toString(), notifications[0].getProperty(HDR_ROUTING_NAME).toString());
- assertEquals(address.toString(), notifications[0].getProperty(HDR_ADDRESS).toString());
+ assertEquals(BINDING_ADDED.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals(queue.toString(), notifications[0].getObjectProperty(HDR_ROUTING_NAME).toString());
+ assertEquals(address.toString(), notifications[0].getObjectProperty(HDR_ADDRESS).toString());
session.deleteQueue(queue);
}
@@ -136,9 +136,9 @@
session.deleteQueue(queue);
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(BINDING_REMOVED.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals(queue.toString(), notifications[0].getProperty(HDR_ROUTING_NAME).toString());
- assertEquals(address.toString(), notifications[0].getProperty(HDR_ADDRESS).toString());
+ assertEquals(BINDING_REMOVED.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals(queue.toString(), notifications[0].getObjectProperty(HDR_ROUTING_NAME).toString());
+ assertEquals(address.toString(), notifications[0].getObjectProperty(HDR_ADDRESS).toString());
}
public void testCONSUMER_CREATED() throws Exception
@@ -154,10 +154,10 @@
ClientConsumer consumer = session.createConsumer(queue);
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(CONSUMER_CREATED.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals(queue.toString(), notifications[0].getProperty(HDR_ROUTING_NAME).toString());
- assertEquals(address.toString(), notifications[0].getProperty(HDR_ADDRESS).toString());
- assertEquals(1, notifications[0].getProperty(HDR_CONSUMER_COUNT));
+ assertEquals(CONSUMER_CREATED.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals(queue.toString(), notifications[0].getObjectProperty(HDR_ROUTING_NAME).toString());
+ assertEquals(address.toString(), notifications[0].getObjectProperty(HDR_ADDRESS).toString());
+ assertEquals(1, notifications[0].getObjectProperty(HDR_CONSUMER_COUNT));
consumer.close();
session.deleteQueue(queue);
@@ -177,10 +177,10 @@
consumer.close();
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(CONSUMER_CLOSED.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals(queue.toString(), notifications[0].getProperty(HDR_ROUTING_NAME).toString());
- assertEquals(address.toString(), notifications[0].getProperty(HDR_ADDRESS).toString());
- assertEquals(0, notifications[0].getProperty(HDR_CONSUMER_COUNT));
+ assertEquals(CONSUMER_CLOSED.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals(queue.toString(), notifications[0].getObjectProperty(HDR_ROUTING_NAME).toString());
+ assertEquals(address.toString(), notifications[0].getObjectProperty(HDR_ADDRESS).toString());
+ assertEquals(0, notifications[0].getObjectProperty(HDR_CONSUMER_COUNT));
session.deleteQueue(queue);
}
@@ -252,7 +252,7 @@
{
for (SimpleString key : m.getPropertyNames())
{
- System.out.println(key + "=" + m.getProperty(key));
+ System.out.println(key + "=" + m.getObjectProperty(key));
}
}
assertNotNull("expected to received " + expected + " messages, got only " + i, m);
@@ -265,7 +265,7 @@
for (SimpleString key : m.getPropertyNames())
{
- System.out.println(key + "=" + m.getProperty(key));
+ System.out.println(key + "=" + m.getObjectProperty(key));
}
}
assertNull("received one more message than expected (" + expected + ")", m);
Modified: trunk/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/management/QueueControlTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -556,7 +556,7 @@
// consume the message from otherQueue
ClientConsumer otherConsumer = session.createConsumer(otherQueue);
ClientMessage m = otherConsumer.receive(500);
- assertEquals(value, m.getProperty(key));
+ assertEquals(value, m.getObjectProperty(key));
m.acknowledge();
@@ -644,13 +644,13 @@
ClientConsumer consumer = session.createConsumer(queue);
ClientMessage m = consumer.receive(500);
assertNotNull(m);
- assertEquals(unmatchingValue, m.getProperty(key));
+ assertEquals(unmatchingValue, m.getObjectProperty(key));
// consume the matched message from otherQueue
ClientConsumer otherConsumer = session.createConsumer(otherQueue);
m = otherConsumer.receive(500);
assertNotNull(m);
- assertEquals(matchingValue, m.getProperty(key));
+ assertEquals(matchingValue, m.getObjectProperty(key));
m.acknowledge();
@@ -773,7 +773,7 @@
ClientConsumer consumer = session.createConsumer(queue);
ClientMessage m = consumer.receive(500);
assertNotNull(m);
- assertEquals(unmatchingValue, m.getProperty(key));
+ assertEquals(unmatchingValue, m.getObjectProperty(key));
m.acknowledge();
@@ -923,7 +923,7 @@
ClientConsumer consumer = session.createConsumer(queue);
ClientMessage m = consumer.receive(500);
assertNotNull(m);
- assertEquals(unmatchingValue, m.getProperty(key));
+ assertEquals(unmatchingValue, m.getObjectProperty(key));
m.acknowledge();
Modified: trunk/tests/src/org/hornetq/tests/integration/management/SecurityNotificationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/SecurityNotificationTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/management/SecurityNotificationTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -86,8 +86,8 @@
}
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(SECURITY_AUTHENTICATION_VIOLATION.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals(unknownUser, notifications[0].getProperty(ManagementHelper.HDR_USER).toString());
+ assertEquals(SECURITY_AUTHENTICATION_VIOLATION.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals(unknownUser, notifications[0].getObjectProperty(ManagementHelper.HDR_USER).toString());
}
public void testSECURITY_PERMISSION_VIOLATION() throws Exception
@@ -118,10 +118,10 @@
}
ClientMessage[] notifications = consumeMessages(1, notifConsumer);
- assertEquals(SECURITY_PERMISSION_VIOLATION.toString(), notifications[0].getProperty(HDR_NOTIFICATION_TYPE).toString());
- assertEquals("guest", notifications[0].getProperty(ManagementHelper.HDR_USER).toString());
- assertEquals(address.toString(), notifications[0].getProperty(ManagementHelper.HDR_ADDRESS).toString());
- assertEquals(CheckType.CREATE_DURABLE_QUEUE.toString(), notifications[0].getProperty(ManagementHelper.HDR_CHECK_TYPE).toString());
+ assertEquals(SECURITY_PERMISSION_VIOLATION.toString(), notifications[0].getObjectProperty(HDR_NOTIFICATION_TYPE).toString());
+ assertEquals("guest", notifications[0].getObjectProperty(ManagementHelper.HDR_USER).toString());
+ assertEquals(address.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_ADDRESS).toString());
+ assertEquals(CheckType.CREATE_DURABLE_QUEUE.toString(), notifications[0].getObjectProperty(ManagementHelper.HDR_CHECK_TYPE).toString());
guestSession.close();
}
@@ -205,7 +205,7 @@
{
for (SimpleString key : m.getPropertyNames())
{
- System.out.println(key + "=" + m.getProperty(key));
+ System.out.println(key + "=" + m.getObjectProperty(key));
}
}
assertNotNull("expected to received " + expected + " messages, got only " + i, m);
@@ -218,7 +218,7 @@
for (SimpleString key : m.getPropertyNames())
{
- System.out.println(key + "=" + m.getProperty(key));
+ System.out.println(key + "=" + m.getObjectProperty(key));
}
}
assertNull("received one more message than expected (" + expected + ")", m);
Modified: trunk/tests/src/org/hornetq/tests/integration/server/PredefinedQueueTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/server/PredefinedQueueTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/integration/server/PredefinedQueueTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -181,12 +181,12 @@
{
ClientMessage message = consumer1.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
message = consumer2.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -279,17 +279,17 @@
{
ClientMessage message = consumer1.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
message = consumer2.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
message = consumer3.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -378,7 +378,7 @@
{
message = consumer2.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
@@ -446,7 +446,7 @@
{
ClientMessage message = consumer1.receive(200);
assertNotNull(message);
- assertEquals((Integer)i, (Integer)message.getProperty(propKey));
+ assertEquals((Integer)i, (Integer)message.getObjectProperty(propKey));
message.acknowledge();
}
Modified: trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessageImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessageImplTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessageImplTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -227,24 +227,24 @@
assertTrue(msg.containsProperty(prop8));
assertTrue(msg.containsProperty(prop9));
- assertEquals(val1, msg.getProperty(prop1));
- assertEquals(val2, msg.getProperty(prop2));
- assertEquals(val3, msg.getProperty(prop3));
- assertEquals(val4, msg.getProperty(prop4));
- assertEquals(val5, msg.getProperty(prop5));
- assertEquals(val6, msg.getProperty(prop6));
- assertEquals(val7, msg.getProperty(prop7));
- assertEquals(val8, msg.getProperty(prop8));
- assertEquals(val9, msg.getProperty(prop9));
+ assertEquals(val1, msg.getObjectProperty(prop1));
+ assertEquals(val2, msg.getObjectProperty(prop2));
+ assertEquals(val3, msg.getObjectProperty(prop3));
+ assertEquals(val4, msg.getObjectProperty(prop4));
+ assertEquals(val5, msg.getObjectProperty(prop5));
+ assertEquals(val6, msg.getObjectProperty(prop6));
+ assertEquals(val7, msg.getObjectProperty(prop7));
+ assertEquals(val8, msg.getObjectProperty(prop8));
+ assertEquals(val9, msg.getObjectProperty(prop9));
SimpleString val10 = new SimpleString(randomString());
//test overwrite
msg.putStringProperty(prop9, val10);
- assertEquals(val10, msg.getProperty(prop9));
+ assertEquals(val10, msg.getObjectProperty(prop9));
int val11 = randomInt();
msg.putIntProperty(prop9, val11);
- assertEquals(val11, msg.getProperty(prop9));
+ assertEquals(val11, msg.getObjectProperty(prop9));
msg.removeProperty(prop1);
assertEquals(8, msg.getPropertyNames().size());
@@ -312,9 +312,9 @@
for (SimpleString propname: props1)
{
- Object val1 = msg1.getProperty(propname);
+ Object val1 = msg1.getObjectProperty(propname);
- Object val2 = msg2.getProperty(propname);
+ Object val2 = msg2.getObjectProperty(propname);
assertEquals(val1, val2);
}
Modified: trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/unit/core/message/impl/MessagePropertyConversionTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -329,14 +329,7 @@
{
}
- try
- {
- msg.getBytesProperty(unknownKey);
- fail();
- }
- catch (Exception e)
- {
- }
+ assertNull(msg.getBytesProperty(unknownKey));
}
// Package protected ---------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -561,15 +561,6 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.message.Message#getProperty(org.hornetq.utils.SimpleString)
- */
- public Object getProperty(final SimpleString key)
- {
-
- return null;
- }
-
- /* (non-Javadoc)
* @see org.hornetq.core.message.Message#getPropertyNames()
*/
public Set<SimpleString> getPropertyNames()
@@ -687,8 +678,24 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.message.Message#putObjectProperty(org.hornetq.utils.SimpleString, java.lang.Object)
+ * @see org.hornetq.core.message.Message#getSimpleStringProperty(org.hornetq.utils.SimpleString)
*/
+ public SimpleString getSimpleStringProperty(SimpleString key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getSimpleStringProperty(java.lang.String)
+ */
+ public SimpleString getSimpleStringProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
public void putObjectProperty(SimpleString key, Object value)
{
// TODO Auto-generated method stub
@@ -980,6 +987,86 @@
// TODO Auto-generated method stub
return 0;
}
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getBooleanProperty(java.lang.String)
+ */
+ public Boolean getBooleanProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getByteProperty(java.lang.String)
+ */
+ public Byte getByteProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getBytesProperty(java.lang.String)
+ */
+ public byte[] getBytesProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getDoubleProperty(java.lang.String)
+ */
+ public Double getDoubleProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getFloatProperty(java.lang.String)
+ */
+ public Float getFloatProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getIntProperty(java.lang.String)
+ */
+ public Integer getIntProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getLongProperty(java.lang.String)
+ */
+ public Long getLongProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getShortProperty(java.lang.String)
+ */
+ public Short getShortProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.hornetq.core.message.Message#getStringProperty(java.lang.String)
+ */
+ public String getStringProperty(String key) throws PropertyConversionException
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
/* (non-Javadoc)
* @see org.hornetq.core.server.ServerMessage#decrementRefCount(org.hornetq.core.paging.PagingStore, org.hornetq.core.server.MessageReference)
Modified: trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakeFilter.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakeFilter.java 2009-11-06 09:52:34 UTC (rev 8233)
+++ trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakeFilter.java 2009-11-06 10:16:01 UTC (rev 8234)
@@ -45,7 +45,7 @@
{
if (headerName != null)
{
- Object value = message.getProperty(new SimpleString(headerName));
+ Object value = message.getObjectProperty(new SimpleString(headerName));
if (value instanceof SimpleString)
{
16 years, 6 months
JBoss hornetq SVN: r8233 - in trunk/src/main/org/hornetq/core: server/impl and 1 other directory.
by do-not-reply@jboss.org
Author: timfox
Date: 2009-11-06 04:52:34 -0500 (Fri, 06 Nov 2009)
New Revision: 8233
Modified:
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
Log:
some tweaks to setting page store on message
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06 04:27:59 UTC (rev 8232)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
@@ -538,7 +538,7 @@
{
throw new IllegalStateException("Message cannot be routed more than once");
}
-
+
RoutingContext context = new RoutingContextImpl(tx);
SimpleString address = message.getDestination();
@@ -596,6 +596,8 @@
cache.addToCache(duplicateIDBytes, context.getTransaction());
}
+
+ setPagingStore(message);
if (context.getTransaction() == null)
{
@@ -665,7 +667,9 @@
}
public MessageReference reroute(final ServerMessage message, final Queue queue, final Transaction tx) throws Exception
- {
+ {
+ setPagingStore(message);
+
MessageReference reference = message.createReference(queue);
Long scheduledDeliveryTime = (Long)message.getProperty(MessageImpl.HDR_SCHEDULED_DELIVERY_TIME);
@@ -772,8 +776,6 @@
message.setBody(ChannelBuffers.EMPTY_BUFFER);
message.setDestination(queueName);
message.putBooleanProperty(HDR_RESET_QUEUE_DATA, true);
- // queue.preroute(message, null);
- // queue.route(message, null);
routeDirect(message, queue, false);
for (QueueInfo info : queueInfos.values())
@@ -828,6 +830,13 @@
// Private -----------------------------------------------------------------
+ private void setPagingStore(final ServerMessage message) throws Exception
+ {
+ PagingStore store = pagingManager.getPageStore(message.getDestination());
+
+ message.setPagingStore(store);
+ }
+
private void routeDirect(final ServerMessage message, final Queue queue, final boolean applyFilters) throws Exception
{
if (!applyFilters || queue.getFilter() == null || queue.getFilter().match(message))
@@ -860,11 +869,11 @@
{
reference.setScheduledDeliveryTime(scheduledDeliveryTime);
}
-
+
if (message.isDurable() && queue.isDurable())
{
int durableRefCount = message.incrementDurableRefCount();
-
+
if (durableRefCount == 1)
{
if (tx != null)
@@ -1180,7 +1189,7 @@
if (!pagingStoresToSync.isEmpty())
{
- for (PagingStore store: pagingStoresToSync)
+ for (PagingStore store : pagingStoresToSync)
{
store.sync();
}
@@ -1228,7 +1237,7 @@
public void beforeRollback(Transaction tx) throws Exception
{
// Reverse the ref counts, and paging sizes
-
+
for (MessageReference ref : refs)
{
ServerMessage message = ref.getMessage();
Modified: trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 04:27:59 UTC (rev 8232)
+++ trunk/src/main/org/hornetq/core/server/impl/ServerSessionImpl.java 2009-11-06 09:52:34 UTC (rev 8233)
@@ -1437,8 +1437,6 @@
try
{
- setPagingStore(message);
-
long id = storageManager.generateUniqueID();
message.setMessageID(id);
@@ -1768,8 +1766,6 @@
{
LargeServerMessage msg = createLargeMessageStorage(id, packet.getLargeMessageHeader());
- setPagingStore(msg);
-
return msg;
}
catch (Exception e)
@@ -1884,32 +1880,31 @@
holder.store.returnProducerCredits(credits);
}
- // TODO can we combine these two methods....
- private CreditManagerHolder getCreditManagerHolder(final SimpleString address) throws Exception
+ private CreditManagerHolder getCreditManagerHolder(final ServerMessage message) throws Exception
{
+ SimpleString address = message.getDestination();
+
CreditManagerHolder holder = creditManagerHolders.get(address);
if (holder == null)
{
- PagingStore store = postOffice.getPagingManager().getPageStore(address);
+ holder = new CreditManagerHolder(message.getPagingStore());
- holder = new CreditManagerHolder(store);
-
creditManagerHolders.put(address, holder);
}
return holder;
}
-
- private CreditManagerHolder getCreditManagerHolder(final ServerMessage message) throws Exception
+
+ private CreditManagerHolder getCreditManagerHolder(final SimpleString address) throws Exception
{
- SimpleString address = message.getDestination();
-
CreditManagerHolder holder = creditManagerHolders.get(address);
if (holder == null)
{
- holder = new CreditManagerHolder(message.getPagingStore());
+ PagingStore store = postOffice.getPagingManager().getPageStore(address);
+
+ holder = new CreditManagerHolder(store);
creditManagerHolders.put(address, holder);
}
@@ -1917,13 +1912,6 @@
return holder;
}
- private void setPagingStore(final ServerMessage message) throws Exception
- {
- PagingStore store = postOffice.getPagingManager().getPageStore(message.getDestination());
-
- message.setPagingStore(store);
- }
-
private void sendProducerCredits(final CreditManagerHolder holder, final int credits, final SimpleString address)
{
holder.outstandingCredits += credits;
16 years, 6 months
JBoss hornetq SVN: r8232 - trunk/examples/jms/large-message/server0.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-11-05 23:27:59 -0500 (Thu, 05 Nov 2009)
New Revision: 8232
Modified:
trunk/examples/jms/large-message/server0/hornetq-jms.xml
Log:
This connection-factory was supposed to use 10K on the min-large-message-size as documented on the readme
Modified: trunk/examples/jms/large-message/server0/hornetq-jms.xml
===================================================================
--- trunk/examples/jms/large-message/server0/hornetq-jms.xml 2009-11-06 03:16:44 UTC (rev 8231)
+++ trunk/examples/jms/large-message/server0/hornetq-jms.xml 2009-11-06 04:27:59 UTC (rev 8232)
@@ -4,6 +4,7 @@
<!--the connection factory used by the example-->
<connection-factory name="ConnectionFactory">
<connector-ref connector-name="netty-connector"/>
+ <min-large-message-size>10240</min-large-message-size>
<entries>
<entry name="ConnectionFactory"/>
</entries>
16 years, 6 months