Author: timfox
Date: 2009-08-20 13:26:39 -0400 (Thu, 20 Aug 2009)
New Revision: 7839
Added:
trunk/src/main/org/hornetq/core/management/HornetQComponentControl.java
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareHornetQServerControlWrapper.java
trunk/src/main/org/hornetq/core/server/HornetQComponent.java
trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceRecovery.java
trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareHornetQServerControlWrapperTest.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/HornetQBufferTestBase.java
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/HornetQXAResourceRecoveryTest.java
Removed:
trunk/src/main/org/hornetq/core/management/MessagingComponentControl.java
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
trunk/src/main/org/hornetq/core/server/MessagingComponent.java
trunk/src/main/org/hornetq/integration/transports/netty/MessagingFrameDecoder.java
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceRecovery.java
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceWrapper.java
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlUsingCoreTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/MessagingBufferTestBase.java
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/MessagingXAResourceRecoveryTest.java
Modified:
trunk/docs/user-manual/en/appserver-integration.xml
trunk/examples/javaee/xarecovery/server/jbossts-properties.xml
trunk/src/main/org/hornetq/core/cluster/DiscoveryGroup.java
trunk/src/main/org/hornetq/core/config/Configuration.java
trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/hornetq/core/deployers/Deployer.java
trunk/src/main/org/hornetq/core/deployers/DeploymentManager.java
trunk/src/main/org/hornetq/core/deployers/impl/XmlDeployer.java
trunk/src/main/org/hornetq/core/journal/Journal.java
trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
trunk/src/main/org/hornetq/core/management/AcceptorControl.java
trunk/src/main/org/hornetq/core/management/BridgeControl.java
trunk/src/main/org/hornetq/core/management/BroadcastGroupControl.java
trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java
trunk/src/main/org/hornetq/core/management/DiscoveryGroupControl.java
trunk/src/main/org/hornetq/core/management/ManagementService.java
trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/hornetq/core/paging/PagingManager.java
trunk/src/main/org/hornetq/core/paging/PagingStore.java
trunk/src/main/org/hornetq/core/paging/impl/PagingManagerImpl.java
trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
trunk/src/main/org/hornetq/core/persistence/StorageManager.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/postoffice/PostOffice.java
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java
trunk/src/main/org/hornetq/core/remoting/spi/Acceptor.java
trunk/src/main/org/hornetq/core/security/HornetQSecurityManager.java
trunk/src/main/org/hornetq/core/security/impl/HornetQSecurityManagerImpl.java
trunk/src/main/org/hornetq/core/security/impl/JAASSecurityManager.java
trunk/src/main/org/hornetq/core/server/HornetQServer.java
trunk/src/main/org/hornetq/core/server/MemoryManager.java
trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
trunk/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java
trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
trunk/src/main/org/hornetq/core/server/cluster/ClusterManager.java
trunk/src/main/org/hornetq/core/transaction/ResourceManager.java
trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
trunk/src/main/org/hornetq/integration/security/JBossASSecurityManager.java
trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
trunk/src/main/org/hornetq/jms/bridge/BridgeService.java
trunk/src/main/org/hornetq/jms/bridge/JMSBridge.java
trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
trunk/tests/jms-tests/config/jbossjta-properties.xml
trunk/tests/src/org/hornetq/tests/integration/client/ConsumerCloseTest.java
trunk/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java
trunk/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java
trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseTest.java
trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
trunk/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java
trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/ByteBufferWrapperTest.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java
trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java
trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
Log:
renamed more Messaging* classes
Modified: trunk/docs/user-manual/en/appserver-integration.xml
===================================================================
--- trunk/docs/user-manual/en/appserver-integration.xml 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/docs/user-manual/en/appserver-integration.xml 2009-08-20 17:26:39 UTC (rev
7839)
@@ -1009,7 +1009,7 @@
...
<property
name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
-
value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;[connection
configuration]"/>
+
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;[connection
configuration]"/>
</properties>
</programlisting>
<para>The <literal>[connection configuration]</literal>
contains all the information
@@ -1055,7 +1055,7 @@
conf/jbossts-properties.xml</literal> is:</para>
<programlisting>
<property
name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
-
value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"/>
+
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"/>
</programlisting>
<para>If it is now configured with a netty acceptor on a
non-default port:</para>
<programlisting>
@@ -1068,7 +1068,7 @@
conf/jbossts-properties.xml</literal> is:</para>
<programlisting>
<property
name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
-
value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;org.hornetq.integration.transports.netty.NettyConnectorFactory,
, , hornetq.remoting.netty.port=8888"/>
+
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.integration.transports.netty.NettyConnectorFactory,
, , hornetq.remoting.netty.port=8888"/>
</programlisting>
<note>
<para>Note the additional commas to skip the user and password
before connector
@@ -1078,7 +1078,7 @@
configuration would have been:</para>
<programlisting>
<property
name="com.arjuna.ats.jta.recovery.XAResourceRecovery.JBMESSAGING1"
-
value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;org.hornetq.integration.transports.netty.NettyConnectorFactory,
admin, adminpass, hornetq.remoting.netty.port=8888"/>
+
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.integration.transports.netty.NettyConnectorFactory,
admin, adminpass, hornetq.remoting.netty.port=8888"/>
</programlisting>
<para>Configuring HornetQ with an invm acceptor and configuring the
Recovery Manager
with an invm connector is the recommended way to enable XA
Recovery.</para>
Modified: trunk/examples/javaee/xarecovery/server/jbossts-properties.xml
===================================================================
--- trunk/examples/javaee/xarecovery/server/jbossts-properties.xml 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/examples/javaee/xarecovery/server/jbossts-properties.xml 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -240,7 +240,7 @@
com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple
-->
<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ1"
-
value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"/>
+
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;org.hornetq.core.remoting.impl.invm.InVMConnectorFactory"/>
</properties>
<properties depends="arjuna,txoj,jta"
name="recoverymanager">
<!--
Modified: trunk/src/main/org/hornetq/core/cluster/DiscoveryGroup.java
===================================================================
--- trunk/src/main/org/hornetq/core/cluster/DiscoveryGroup.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/cluster/DiscoveryGroup.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -17,7 +17,7 @@
import java.util.Map;
import org.hornetq.core.management.NotificationService;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
* A DiscoveryGroup
@@ -28,7 +28,7 @@
*
*
*/
-public interface DiscoveryGroup extends MessagingComponent
+public interface DiscoveryGroup extends HornetQComponent
{
void setNotificationService(NotificationService notificationService);
Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -25,7 +25,7 @@
import org.hornetq.core.config.cluster.DivertConfiguration;
import org.hornetq.core.config.cluster.QueueConfiguration;
import org.hornetq.core.server.JournalType;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.SimpleString;
/**
@@ -35,7 +35,7 @@
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
*/
-public interface Configuration extends Serializable, MessagingComponent
+public interface Configuration extends Serializable, HornetQComponent
{
// General attributes
-------------------------------------------------------------------
Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -283,7 +283,7 @@
protected long serverDumpInterval = DEFAULT_SERVER_DUMP_INTERVAL;
- // MessagingComponent implementation ----------------------------------------------
+ // HornetQComponent implementation ----------------------------------------------
public void start() throws Exception
{
Modified: trunk/src/main/org/hornetq/core/deployers/Deployer.java
===================================================================
--- trunk/src/main/org/hornetq/core/deployers/Deployer.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/deployers/Deployer.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -15,14 +15,14 @@
import java.net.URL;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
* abstract class that helps with deployment of messaging components.
*
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
-public interface Deployer extends MessagingComponent
+public interface Deployer extends HornetQComponent
{
/**
* The name of the configuration files to look for for deployment
Modified: trunk/src/main/org/hornetq/core/deployers/DeploymentManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/deployers/DeploymentManager.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/deployers/DeploymentManager.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -15,7 +15,7 @@
import java.util.List;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
@@ -23,7 +23,7 @@
*
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
-public interface DeploymentManager extends MessagingComponent
+public interface DeploymentManager extends HornetQComponent
{
/**
* registers a deployable object which will handle the deployment of URL's
Modified: trunk/src/main/org/hornetq/core/deployers/impl/XmlDeployer.java
===================================================================
--- trunk/src/main/org/hornetq/core/deployers/impl/XmlDeployer.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/deployers/impl/XmlDeployer.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -16,7 +16,7 @@
import org.hornetq.core.deployers.Deployer;
import org.hornetq.core.deployers.DeploymentManager;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -34,7 +34,7 @@
/**
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
-public abstract class XmlDeployer implements Deployer, MessagingComponent
+public abstract class XmlDeployer implements Deployer, HornetQComponent
{
private static Logger log = Logger.getLogger(XmlDeployer.class);
Modified: trunk/src/main/org/hornetq/core/journal/Journal.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/Journal.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/journal/Journal.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -16,7 +16,7 @@
import java.util.List;
import org.hornetq.core.journal.impl.JournalFile;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
*
@@ -26,7 +26,7 @@
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
*
*/
-public interface Journal extends MessagingComponent
+public interface Journal extends HornetQComponent
{
// Non transactional operations
Modified: trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/journal/impl/JournalImpl.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -2259,7 +2259,7 @@
new PerfBlast(pages).start();
}
- // MessagingComponent implementation
+ // HornetQComponent implementation
// ---------------------------------------------------
public synchronized boolean isStarted()
Modified: trunk/src/main/org/hornetq/core/management/AcceptorControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/AcceptorControl.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/AcceptorControl.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -21,7 +21,7 @@
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
*
*/
-public interface AcceptorControl extends MessagingComponentControl
+public interface AcceptorControl extends HornetQComponentControl
{
String getName();
Modified: trunk/src/main/org/hornetq/core/management/BridgeControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/BridgeControl.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/management/BridgeControl.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -20,7 +20,7 @@
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
*
*/
-public interface BridgeControl extends MessagingComponentControl
+public interface BridgeControl extends HornetQComponentControl
{
String getName();
Modified: trunk/src/main/org/hornetq/core/management/BroadcastGroupControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/BroadcastGroupControl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/BroadcastGroupControl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -20,7 +20,7 @@
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
*
*/
-public interface BroadcastGroupControl extends MessagingComponentControl
+public interface BroadcastGroupControl extends HornetQComponentControl
{
String getName();
Modified: trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/ClusterConnectionControl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -21,7 +21,7 @@
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
*
*/
-public interface ClusterConnectionControl extends MessagingComponentControl
+public interface ClusterConnectionControl extends HornetQComponentControl
{
String getName();
Modified: trunk/src/main/org/hornetq/core/management/DiscoveryGroupControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/DiscoveryGroupControl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/DiscoveryGroupControl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -19,7 +19,7 @@
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
*
*/
-public interface DiscoveryGroupControl extends MessagingComponentControl
+public interface DiscoveryGroupControl extends HornetQComponentControl
{
String getName();
Copied: trunk/src/main/org/hornetq/core/management/HornetQComponentControl.java (from rev
7828, trunk/src/main/org/hornetq/core/management/MessagingComponentControl.java)
===================================================================
--- trunk/src/main/org/hornetq/core/management/HornetQComponentControl.java
(rev 0)
+++ trunk/src/main/org/hornetq/core/management/HornetQComponentControl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,29 @@
+/*
+ * 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.core.management;
+
+/**
+ * A HornetQComponentControl
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+public interface HornetQComponentControl
+{
+ boolean isStarted();
+
+ void start() throws Exception;
+
+ void stop() throws Exception;
+}
Modified: trunk/src/main/org/hornetq/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/ManagementService.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/ManagementService.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -34,7 +34,7 @@
import org.hornetq.core.remoting.spi.Acceptor;
import org.hornetq.core.security.Role;
import org.hornetq.core.server.Divert;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.QueueFactory;
@@ -53,7 +53,7 @@
* @version <tt>$Revision$</tt>
*
*/
-public interface ManagementService extends NotificationService, MessagingComponent
+public interface ManagementService extends NotificationService, HornetQComponent
{
// Configuration
Deleted: trunk/src/main/org/hornetq/core/management/MessagingComponentControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/MessagingComponentControl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/MessagingComponentControl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,29 +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.core.management;
-
-/**
- * A MessagingComponentControl
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- */
-public interface MessagingComponentControl
-{
- boolean isStarted();
-
- void start() throws Exception;
-
- void stop() throws Exception;
-}
Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -53,7 +53,7 @@
import org.hornetq.core.management.ReplicationOperationInvoker;
import org.hornetq.core.management.ResourceNames;
import org.hornetq.core.management.jmx.impl.ReplicationAwareAddressControlWrapper;
-import
org.hornetq.core.management.jmx.impl.ReplicationAwareMessagingServerControlWrapper;
+import org.hornetq.core.management.jmx.impl.ReplicationAwareHornetQServerControlWrapper;
import org.hornetq.core.management.jmx.impl.ReplicationAwareQueueControlWrapper;
import org.hornetq.core.messagecounter.MessageCounter;
import org.hornetq.core.messagecounter.MessageCounterManager;
@@ -210,7 +210,7 @@
messageCounterManager,
broadcaster);
ObjectName objectName = ObjectNames.getMessagingServerObjectName();
- registerInJMX(objectName, new
ReplicationAwareMessagingServerControlWrapper(messagingServerControl,
+ registerInJMX(objectName, new
ReplicationAwareHornetQServerControlWrapper(messagingServerControl,
replicationInvoker));
registerInRegistry(ResourceNames.CORE_SERVER, messagingServerControl);
@@ -577,7 +577,7 @@
return replicationInvoker;
}
- // MessagingComponent implementation -----------------------------
+ // HornetQComponent implementation -----------------------------
public void start() throws Exception
{
Copied:
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareHornetQServerControlWrapper.java
(from rev 7831,
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java)
===================================================================
---
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareHornetQServerControlWrapper.java
(rev 0)
+++
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareHornetQServerControlWrapper.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,409 @@
+/*
+ * 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.core.management.jmx.impl;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.management.HornetQServerControl;
+import org.hornetq.core.management.ReplicationOperationInvoker;
+import org.hornetq.core.management.ResourceNames;
+import org.hornetq.core.management.impl.MBeanInfoHelper;
+import org.hornetq.core.management.impl.HornetQServerControlImpl;
+
+import javax.management.MBeanInfo;
+
+/**
+ * A ReplicationAwareHornetQServerControlWrapper
+ *
+ * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ReplicationAwareHornetQServerControlWrapper extends
ReplicationAwareStandardMBeanWrapper implements
+ HornetQServerControl
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final HornetQServerControlImpl localControl;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ReplicationAwareHornetQServerControlWrapper(final HornetQServerControlImpl
localControl,
+ final ReplicationOperationInvoker
replicationInvoker) throws Exception
+ {
+ super(ResourceNames.CORE_SERVER, HornetQServerControl.class, replicationInvoker);
+
+ this.localControl = localControl;
+ }
+
+ // MessagingServerControlMBean implementation ------------------------------
+
+ public String getBackupConnectorName()
+ {
+ return localControl.getBackupConnectorName();
+ }
+
+ public String getBindingsDirectory()
+ {
+ return localControl.getBindingsDirectory();
+ }
+
+ public Configuration getConfiguration()
+ {
+ return localControl.getConfiguration();
+ }
+
+ public int getConnectionCount()
+ {
+ return localControl.getConnectionCount();
+ }
+
+ public String[] getInterceptorClassNames()
+ {
+ return localControl.getInterceptorClassNames();
+ }
+
+ public int getAIOBufferSize()
+ {
+ return localControl.getAIOBufferSize();
+ }
+
+ public int getAIOBufferTimeout()
+ {
+ return localControl.getAIOBufferTimeout();
+ }
+
+ public String getJournalDirectory()
+ {
+ return localControl.getJournalDirectory();
+ }
+
+ public int getJournalFileSize()
+ {
+ return localControl.getJournalFileSize();
+ }
+
+ public int getJournalMaxAIO()
+ {
+ return localControl.getJournalMaxAIO();
+ }
+
+ public int getJournalMinFiles()
+ {
+ return localControl.getJournalMinFiles();
+ }
+
+ public String getJournalType()
+ {
+ return localControl.getJournalType();
+ }
+
+ public int getMessageCounterMaxDayCount()
+ {
+ return localControl.getMessageCounterMaxDayCount();
+ }
+
+ public long getMessageCounterSamplePeriod()
+ {
+ return localControl.getMessageCounterSamplePeriod();
+ }
+
+ public String getPagingDirectory()
+ {
+ return localControl.getPagingDirectory();
+ }
+
+ public int getScheduledThreadPoolMaxSize()
+ {
+ return localControl.getScheduledThreadPoolMaxSize();
+ }
+
+ public int getThreadPoolMaxSize()
+ {
+ return localControl.getThreadPoolMaxSize();
+ }
+
+ public long getSecurityInvalidationInterval()
+ {
+ return localControl.getSecurityInvalidationInterval();
+ }
+
+ public String getVersion()
+ {
+ return localControl.getVersion();
+ }
+
+ public boolean isBackup()
+ {
+ return localControl.isBackup();
+ }
+
+ public boolean isClustered()
+ {
+ return localControl.isClustered();
+ }
+
+ public boolean isCreateBindingsDir()
+ {
+ return localControl.isCreateBindingsDir();
+ }
+
+ public boolean isCreateJournalDir()
+ {
+ return localControl.isCreateJournalDir();
+ }
+
+ public boolean isJournalSyncNonTransactional()
+ {
+ return localControl.isJournalSyncNonTransactional();
+ }
+
+ public boolean isJournalSyncTransactional()
+ {
+ return localControl.isJournalSyncTransactional();
+ }
+
+ public boolean isMessageCounterEnabled()
+ {
+ return localControl.isMessageCounterEnabled();
+ }
+
+ public boolean isSecurityEnabled()
+ {
+ return localControl.isSecurityEnabled();
+ }
+
+ public boolean isStarted()
+ {
+ return localControl.isStarted();
+ }
+
+ public String[] listConnectionIDs()
+ {
+ return localControl.listConnectionIDs();
+ }
+
+ public String[] listPreparedTransactions()
+ {
+ return localControl.listPreparedTransactions();
+ }
+
+ public String[] listRemoteAddresses()
+ {
+ return localControl.listRemoteAddresses();
+ }
+
+ public String[] listRemoteAddresses(String ipAddress)
+ {
+ return localControl.listRemoteAddresses(ipAddress);
+ }
+
+ public String[] listSessions(String connectionID)
+ {
+ return localControl.listSessions(connectionID);
+ }
+
+ public Object[] getConnectors() throws Exception
+ {
+ return localControl.getConnectors();
+ }
+
+ public String getConnectorsAsJSON() throws Exception
+ {
+ return localControl.getConnectorsAsJSON();
+ }
+
+ public void sendQueueInfoToQueue(final String queueName, final String address) throws
Exception
+ {
+ replicationAwareInvoke("sendQueueInfoToQueue", queueName, address);
+ }
+
+ public boolean addAddress(String address) throws Exception
+ {
+ return (Boolean)replicationAwareInvoke("addAddress", address);
+ }
+
+ public boolean closeConnectionsForAddress(final String ipAddress) throws Exception
+ {
+ return localControl.closeConnectionsForAddress(ipAddress);
+ }
+
+ public boolean commitPreparedTransaction(final String transactionAsBase64) throws
Exception
+ {
+ return (Boolean)replicationAwareInvoke("commitPreparedTransaction",
transactionAsBase64);
+ }
+
+ public void createQueue(final String address, final String name) throws Exception
+ {
+ replicationAwareInvoke("createQueue", address, name);
+ }
+
+ public void createQueue(final String address, final String name, final String filter,
final boolean durable) throws Exception
+ {
+ replicationAwareInvoke("createQueue", address, name, filter, durable);
+ }
+
+ public void deployQueue(String address, String name, String filter, boolean durable)
throws Exception
+ {
+ replicationAwareInvoke("deployQueue", address, name, filter, durable);
+ }
+
+ public void deployQueue(String address, String name, String filterString) throws
Exception
+ {
+ replicationAwareInvoke("deployQueue", address, name);
+ }
+
+ public void destroyQueue(final String name) throws Exception
+ {
+ replicationAwareInvoke("destroyQueue", name);
+ }
+
+ public void disableMessageCounters() throws Exception
+ {
+ replicationAwareInvoke("disableMessageCounters");
+ }
+
+ public void enableMessageCounters() throws Exception
+ {
+ replicationAwareInvoke("enableMessageCounters");
+ }
+
+ public boolean removeAddress(final String address) throws Exception
+ {
+ return (Boolean)replicationAwareInvoke("removeAddress", address);
+ }
+
+ public void resetAllMessageCounterHistories() throws Exception
+ {
+ replicationAwareInvoke("resetAllMessageCounterHistories");
+ }
+
+ public void resetAllMessageCounters() throws Exception
+ {
+ replicationAwareInvoke("resetAllMessageCounters");
+ }
+
+ public boolean rollbackPreparedTransaction(final String transactionAsBase64) throws
Exception
+ {
+ return (Boolean)replicationAwareInvoke("rollbackPreparedTransaction",
transactionAsBase64);
+ }
+
+ public void setMessageCounterMaxDayCount(final int count) throws Exception
+ {
+ replicationAwareInvoke("setMessageCounterMaxDayCount", count);
+ }
+
+ public void setMessageCounterSamplePeriod(final long newPeriod) throws Exception
+ {
+ replicationAwareInvoke("setMessageCounterSamplePeriod", newPeriod);
+ }
+
+ public long getConnectionTTLOverride()
+ {
+ return localControl.getConnectionTTLOverride();
+ }
+
+ public int getIDCacheSize()
+ {
+ return localControl.getIDCacheSize();
+ }
+
+ public String getLargeMessagesDirectory()
+ {
+ return localControl.getLargeMessagesDirectory();
+ }
+
+ public String getManagementAddress()
+ {
+ return localControl.getManagementAddress().toString();
+ }
+
+ public String getManagementNotificationAddress()
+ {
+ return localControl.getManagementNotificationAddress().toString();
+ }
+
+ public long getManagementRequestTimeout()
+ {
+ return localControl.getManagementRequestTimeout();
+ }
+
+ public long getMessageExpiryScanPeriod()
+ {
+ return localControl.getMessageExpiryScanPeriod();
+ }
+
+ public long getMessageExpiryThreadPriority()
+ {
+ return localControl.getMessageExpiryThreadPriority();
+ }
+
+ public long getQueueActivationTimeout()
+ {
+ return localControl.getQueueActivationTimeout();
+ }
+
+ public long getTransactionTimeout()
+ {
+ return localControl.getTransactionTimeout();
+ }
+
+ public long getTransactionTimeoutScanPeriod()
+ {
+ return localControl.getTransactionTimeoutScanPeriod();
+ }
+
+ public boolean isPersistDeliveryCountBeforeDelivery()
+ {
+ return localControl.isPersistDeliveryCountBeforeDelivery();
+ }
+
+ public boolean isPersistIDCache()
+ {
+ return localControl.isPersistIDCache();
+ }
+
+ public boolean isWildcardRoutingEnabled()
+ {
+ return localControl.isWildcardRoutingEnabled();
+ }
+
+ // StandardMBean overrides ---------------------------------------
+
+ @Override
+ public MBeanInfo getMBeanInfo()
+ {
+ MBeanInfo info = super.getMBeanInfo();
+ return new MBeanInfo(info.getClassName(),
+ info.getDescription(),
+ info.getAttributes(),
+ info.getConstructors(),
+
MBeanInfoHelper.getMBeanOperationsInfo(HornetQServerControl.class),
+ localControl.getNotificationInfo());
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted:
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java
===================================================================
---
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/core/management/jmx/impl/ReplicationAwareMessagingServerControlWrapper.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,409 +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.core.management.jmx.impl;
-
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ReplicationOperationInvoker;
-import org.hornetq.core.management.ResourceNames;
-import org.hornetq.core.management.impl.MBeanInfoHelper;
-import org.hornetq.core.management.impl.HornetQServerControlImpl;
-
-import javax.management.MBeanInfo;
-
-/**
- * A ReplicationAwareMessagingServerControlWrapper
- *
- * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
- *
- */
-public class ReplicationAwareMessagingServerControlWrapper extends
ReplicationAwareStandardMBeanWrapper implements
- HornetQServerControl
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private final HornetQServerControlImpl localControl;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- public ReplicationAwareMessagingServerControlWrapper(final HornetQServerControlImpl
localControl,
- final ReplicationOperationInvoker
replicationInvoker) throws Exception
- {
- super(ResourceNames.CORE_SERVER, HornetQServerControl.class, replicationInvoker);
-
- this.localControl = localControl;
- }
-
- // MessagingServerControlMBean implementation ------------------------------
-
- public String getBackupConnectorName()
- {
- return localControl.getBackupConnectorName();
- }
-
- public String getBindingsDirectory()
- {
- return localControl.getBindingsDirectory();
- }
-
- public Configuration getConfiguration()
- {
- return localControl.getConfiguration();
- }
-
- public int getConnectionCount()
- {
- return localControl.getConnectionCount();
- }
-
- public String[] getInterceptorClassNames()
- {
- return localControl.getInterceptorClassNames();
- }
-
- public int getAIOBufferSize()
- {
- return localControl.getAIOBufferSize();
- }
-
- public int getAIOBufferTimeout()
- {
- return localControl.getAIOBufferTimeout();
- }
-
- public String getJournalDirectory()
- {
- return localControl.getJournalDirectory();
- }
-
- public int getJournalFileSize()
- {
- return localControl.getJournalFileSize();
- }
-
- public int getJournalMaxAIO()
- {
- return localControl.getJournalMaxAIO();
- }
-
- public int getJournalMinFiles()
- {
- return localControl.getJournalMinFiles();
- }
-
- public String getJournalType()
- {
- return localControl.getJournalType();
- }
-
- public int getMessageCounterMaxDayCount()
- {
- return localControl.getMessageCounterMaxDayCount();
- }
-
- public long getMessageCounterSamplePeriod()
- {
- return localControl.getMessageCounterSamplePeriod();
- }
-
- public String getPagingDirectory()
- {
- return localControl.getPagingDirectory();
- }
-
- public int getScheduledThreadPoolMaxSize()
- {
- return localControl.getScheduledThreadPoolMaxSize();
- }
-
- public int getThreadPoolMaxSize()
- {
- return localControl.getThreadPoolMaxSize();
- }
-
- public long getSecurityInvalidationInterval()
- {
- return localControl.getSecurityInvalidationInterval();
- }
-
- public String getVersion()
- {
- return localControl.getVersion();
- }
-
- public boolean isBackup()
- {
- return localControl.isBackup();
- }
-
- public boolean isClustered()
- {
- return localControl.isClustered();
- }
-
- public boolean isCreateBindingsDir()
- {
- return localControl.isCreateBindingsDir();
- }
-
- public boolean isCreateJournalDir()
- {
- return localControl.isCreateJournalDir();
- }
-
- public boolean isJournalSyncNonTransactional()
- {
- return localControl.isJournalSyncNonTransactional();
- }
-
- public boolean isJournalSyncTransactional()
- {
- return localControl.isJournalSyncTransactional();
- }
-
- public boolean isMessageCounterEnabled()
- {
- return localControl.isMessageCounterEnabled();
- }
-
- public boolean isSecurityEnabled()
- {
- return localControl.isSecurityEnabled();
- }
-
- public boolean isStarted()
- {
- return localControl.isStarted();
- }
-
- public String[] listConnectionIDs()
- {
- return localControl.listConnectionIDs();
- }
-
- public String[] listPreparedTransactions()
- {
- return localControl.listPreparedTransactions();
- }
-
- public String[] listRemoteAddresses()
- {
- return localControl.listRemoteAddresses();
- }
-
- public String[] listRemoteAddresses(String ipAddress)
- {
- return localControl.listRemoteAddresses(ipAddress);
- }
-
- public String[] listSessions(String connectionID)
- {
- return localControl.listSessions(connectionID);
- }
-
- public Object[] getConnectors() throws Exception
- {
- return localControl.getConnectors();
- }
-
- public String getConnectorsAsJSON() throws Exception
- {
- return localControl.getConnectorsAsJSON();
- }
-
- public void sendQueueInfoToQueue(final String queueName, final String address) throws
Exception
- {
- replicationAwareInvoke("sendQueueInfoToQueue", queueName, address);
- }
-
- public boolean addAddress(String address) throws Exception
- {
- return (Boolean)replicationAwareInvoke("addAddress", address);
- }
-
- public boolean closeConnectionsForAddress(final String ipAddress) throws Exception
- {
- return localControl.closeConnectionsForAddress(ipAddress);
- }
-
- public boolean commitPreparedTransaction(final String transactionAsBase64) throws
Exception
- {
- return (Boolean)replicationAwareInvoke("commitPreparedTransaction",
transactionAsBase64);
- }
-
- public void createQueue(final String address, final String name) throws Exception
- {
- replicationAwareInvoke("createQueue", address, name);
- }
-
- public void createQueue(final String address, final String name, final String filter,
final boolean durable) throws Exception
- {
- replicationAwareInvoke("createQueue", address, name, filter, durable);
- }
-
- public void deployQueue(String address, String name, String filter, boolean durable)
throws Exception
- {
- replicationAwareInvoke("deployQueue", address, name, filter, durable);
- }
-
- public void deployQueue(String address, String name, String filterString) throws
Exception
- {
- replicationAwareInvoke("deployQueue", address, name);
- }
-
- public void destroyQueue(final String name) throws Exception
- {
- replicationAwareInvoke("destroyQueue", name);
- }
-
- public void disableMessageCounters() throws Exception
- {
- replicationAwareInvoke("disableMessageCounters");
- }
-
- public void enableMessageCounters() throws Exception
- {
- replicationAwareInvoke("enableMessageCounters");
- }
-
- public boolean removeAddress(final String address) throws Exception
- {
- return (Boolean)replicationAwareInvoke("removeAddress", address);
- }
-
- public void resetAllMessageCounterHistories() throws Exception
- {
- replicationAwareInvoke("resetAllMessageCounterHistories");
- }
-
- public void resetAllMessageCounters() throws Exception
- {
- replicationAwareInvoke("resetAllMessageCounters");
- }
-
- public boolean rollbackPreparedTransaction(final String transactionAsBase64) throws
Exception
- {
- return (Boolean)replicationAwareInvoke("rollbackPreparedTransaction",
transactionAsBase64);
- }
-
- public void setMessageCounterMaxDayCount(final int count) throws Exception
- {
- replicationAwareInvoke("setMessageCounterMaxDayCount", count);
- }
-
- public void setMessageCounterSamplePeriod(final long newPeriod) throws Exception
- {
- replicationAwareInvoke("setMessageCounterSamplePeriod", newPeriod);
- }
-
- public long getConnectionTTLOverride()
- {
- return localControl.getConnectionTTLOverride();
- }
-
- public int getIDCacheSize()
- {
- return localControl.getIDCacheSize();
- }
-
- public String getLargeMessagesDirectory()
- {
- return localControl.getLargeMessagesDirectory();
- }
-
- public String getManagementAddress()
- {
- return localControl.getManagementAddress().toString();
- }
-
- public String getManagementNotificationAddress()
- {
- return localControl.getManagementNotificationAddress().toString();
- }
-
- public long getManagementRequestTimeout()
- {
- return localControl.getManagementRequestTimeout();
- }
-
- public long getMessageExpiryScanPeriod()
- {
- return localControl.getMessageExpiryScanPeriod();
- }
-
- public long getMessageExpiryThreadPriority()
- {
- return localControl.getMessageExpiryThreadPriority();
- }
-
- public long getQueueActivationTimeout()
- {
- return localControl.getQueueActivationTimeout();
- }
-
- public long getTransactionTimeout()
- {
- return localControl.getTransactionTimeout();
- }
-
- public long getTransactionTimeoutScanPeriod()
- {
- return localControl.getTransactionTimeoutScanPeriod();
- }
-
- public boolean isPersistDeliveryCountBeforeDelivery()
- {
- return localControl.isPersistDeliveryCountBeforeDelivery();
- }
-
- public boolean isPersistIDCache()
- {
- return localControl.isPersistIDCache();
- }
-
- public boolean isWildcardRoutingEnabled()
- {
- return localControl.isWildcardRoutingEnabled();
- }
-
- // StandardMBean overrides ---------------------------------------
-
- @Override
- public MBeanInfo getMBeanInfo()
- {
- MBeanInfo info = super.getMBeanInfo();
- return new MBeanInfo(info.getClassName(),
- info.getDescription(),
- info.getAttributes(),
- info.getConstructors(),
-
MBeanInfoHelper.getMBeanOperationsInfo(HornetQServerControl.class),
- localControl.getNotificationInfo());
- }
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified: trunk/src/main/org/hornetq/core/paging/PagingManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/paging/PagingManager.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/paging/PagingManager.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -17,7 +17,7 @@
import org.hornetq.core.journal.SequentialFile;
import org.hornetq.core.postoffice.PostOffice;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.utils.SimpleString;
@@ -46,7 +46,7 @@
* @author <a href="mailto:andy.taylor@jboss.org>Andy Taylor</a>
*
*/
-public interface PagingManager extends MessagingComponent
+public interface PagingManager extends HornetQComponent
{
void activate();
Modified: trunk/src/main/org/hornetq/core/paging/PagingStore.java
===================================================================
--- trunk/src/main/org/hornetq/core/paging/PagingStore.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/paging/PagingStore.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -13,7 +13,7 @@
package org.hornetq.core.paging;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.SimpleString;
/**
@@ -28,7 +28,7 @@
* @author <a href="mailto:clebert.suconic@jboss.com">Clebert
Suconic</a>
*
*/
-public interface PagingStore extends MessagingComponent
+public interface PagingStore extends HornetQComponent
{
int getNumberOfPages();
Modified: trunk/src/main/org/hornetq/core/paging/impl/PagingManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/paging/impl/PagingManagerImpl.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/paging/impl/PagingManagerImpl.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -216,7 +216,7 @@
}
}
- // MessagingComponent implementation
+ // HornetQComponent implementation
//
------------------------------------------------------------------------------------------------
public boolean isStarted()
Modified: trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/paging/impl/PagingStoreImpl.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -441,7 +441,7 @@
}
}
- // MessagingComponent implementation
+ // HornetQComponent implementation
public synchronized boolean isStarted()
{
Modified: trunk/src/main/org/hornetq/core/persistence/StorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/persistence/StorageManager.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -23,7 +23,7 @@
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.server.LargeServerMessage;
import org.hornetq.core.server.MessageReference;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.transaction.ResourceManager;
@@ -40,7 +40,7 @@
* @author <a href="mailto:andy.taylor@jboss.org>Andy Taylor</a>
*
*/
-public interface StorageManager extends MessagingComponent
+public interface StorageManager extends HornetQComponent
{
// Message related operations
Modified:
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
---
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -986,7 +986,7 @@
idGenerator.setID(lastID + 1);
}
- // MessagingComponent implementation
+ // HornetQComponent implementation
// ------------------------------------------------------
public synchronized void start() throws Exception
Modified: trunk/src/main/org/hornetq/core/postoffice/PostOffice.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/PostOffice.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/postoffice/PostOffice.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -16,7 +16,7 @@
import java.util.List;
import org.hornetq.core.paging.PagingManager;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.Queue;
import org.hornetq.core.server.ServerMessage;
import org.hornetq.core.transaction.Transaction;
@@ -40,7 +40,7 @@
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
*/
-public interface PostOffice extends MessagingComponent
+public interface PostOffice extends HornetQComponent
{
void addBinding(Binding binding) throws Exception;
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -172,7 +172,7 @@
this.addressSettingsRepository = addressSettingsRepository;
}
- // MessagingComponent implementation ---------------------------------------
+ // HornetQComponent implementation ---------------------------------------
public synchronized void start() throws Exception
{
Modified: trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/remoting/server/RemotingService.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -17,7 +17,7 @@
import org.hornetq.core.remoting.Interceptor;
import org.hornetq.core.remoting.RemotingConnection;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -25,7 +25,7 @@
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
* @version <tt>$Revision$</tt>
*/
-public interface RemotingService extends MessagingComponent
+public interface RemotingService extends HornetQComponent
{
/**
* Remove a connection from the connections held by the remoting service.
Modified: trunk/src/main/org/hornetq/core/remoting/spi/Acceptor.java
===================================================================
--- trunk/src/main/org/hornetq/core/remoting/spi/Acceptor.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/remoting/spi/Acceptor.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -13,7 +13,7 @@
package org.hornetq.core.remoting.spi;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
* An Acceptor is used tby the Remoting Service to allow clients to connect. It should
take care of dispatchin client requests
@@ -22,7 +22,7 @@
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
*/
-public interface Acceptor extends MessagingComponent
+public interface Acceptor extends HornetQComponent
{
void pause();
Modified: trunk/src/main/org/hornetq/core/security/HornetQSecurityManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/security/HornetQSecurityManager.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/security/HornetQSecurityManager.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -15,13 +15,13 @@
import java.util.Set;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
* USe to validate whether a user has is valid to connect to the server and perform
certain functions
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
-public interface HornetQSecurityManager extends MessagingComponent
+public interface HornetQSecurityManager extends HornetQComponent
{
/**
* is this a valid user.
Modified: trunk/src/main/org/hornetq/core/security/impl/HornetQSecurityManagerImpl.java
===================================================================
---
trunk/src/main/org/hornetq/core/security/impl/HornetQSecurityManagerImpl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/core/security/impl/HornetQSecurityManagerImpl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -50,7 +50,7 @@
*/
private Map<String, List<String>> roles = new HashMap<String,
List<String>>();
- // MessagingComponent implementation ------------------------------------------
+ // HornetQComponent implementation ------------------------------------------
public void start()
{
Modified: trunk/src/main/org/hornetq/core/security/impl/JAASSecurityManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/security/impl/JAASSecurityManager.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/security/impl/JAASSecurityManager.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -17,7 +17,7 @@
import org.hornetq.core.security.CheckType;
import org.hornetq.core.security.HornetQSecurityManager;
import org.hornetq.core.security.Role;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import javax.security.auth.Subject;
import javax.security.auth.callback.CallbackHandler;
@@ -40,7 +40,7 @@
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
*/
-public class JAASSecurityManager implements HornetQSecurityManager, MessagingComponent
+public class JAASSecurityManager implements HornetQSecurityManager, HornetQComponent
{
private static final Logger log = Logger.getLogger(JAASSecurityManager.class);
@@ -146,7 +146,7 @@
// NO-OP
}
- // MessagingComponent implementation -----------------------------
+ // HornetQComponent implementation -----------------------------
/**
* lifecycle method, needs to be called
Copied: trunk/src/main/org/hornetq/core/server/HornetQComponent.java (from rev 7828,
trunk/src/main/org/hornetq/core/server/MessagingComponent.java)
===================================================================
--- trunk/src/main/org/hornetq/core/server/HornetQComponent.java
(rev 0)
+++ trunk/src/main/org/hornetq/core/server/HornetQComponent.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -0,0 +1,32 @@
+/*
+ * 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.core.server;
+
+/**
+ * A HornetQComponent
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 2796 $</tt>
+ *
+ * $Id: HornetQComponent.java 2796 2007-06-25 22:24:41Z timfox $
+ *
+ */
+public interface HornetQComponent
+{
+ void start() throws Exception;
+
+ void stop() throws Exception;
+
+ boolean isStarted();
+}
Modified: trunk/src/main/org/hornetq/core/server/HornetQServer.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/HornetQServer.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/server/HornetQServer.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -47,7 +47,7 @@
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
*/
-public interface HornetQServer extends MessagingComponent
+public interface HornetQServer extends HornetQComponent
{
Configuration getConfiguration();
Modified: trunk/src/main/org/hornetq/core/server/MemoryManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/MemoryManager.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/core/server/MemoryManager.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -22,7 +22,7 @@
* $Id: MemoryManager.java 2796 2007-06-25 22:24:41Z timfox $
*
*/
-public interface MemoryManager extends MessagingComponent
+public interface MemoryManager extends HornetQComponent
{
boolean isMemoryLow();
}
Deleted: trunk/src/main/org/hornetq/core/server/MessagingComponent.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/MessagingComponent.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/server/MessagingComponent.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -1,32 +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.core.server;
-
-/**
- * A MessagingComponent
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 2796 $</tt>
- *
- * $Id: MessagingComponent.java 2796 2007-06-25 22:24:41Z timfox $
- *
- */
-public interface MessagingComponent
-{
- void start() throws Exception;
-
- void stop() throws Exception;
-
- boolean isStarted();
-}
Modified: trunk/src/main/org/hornetq/core/server/cluster/Bridge.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/Bridge.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/core/server/cluster/Bridge.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -16,7 +16,7 @@
import org.hornetq.core.management.NotificationService;
import org.hornetq.core.server.Consumer;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.server.Queue;
import org.hornetq.utils.SimpleString;
@@ -31,7 +31,7 @@
*
*
*/
-public interface Bridge extends Consumer, MessagingComponent
+public interface Bridge extends Consumer, HornetQComponent
{
SimpleString getName();
Modified: trunk/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/server/cluster/BroadcastGroup.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -16,7 +16,7 @@
import org.hornetq.core.config.TransportConfiguration;
import org.hornetq.core.management.NotificationService;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.Pair;
/**
@@ -29,7 +29,7 @@
*
*
*/
-public interface BroadcastGroup extends MessagingComponent
+public interface BroadcastGroup extends HornetQComponent
{
void setNotificationService(NotificationService notificationService);
Modified: trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -13,7 +13,7 @@
package org.hornetq.core.server.cluster;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.SimpleString;
/**
@@ -25,7 +25,7 @@
*
*
*/
-public interface ClusterConnection extends MessagingComponent
+public interface ClusterConnection extends HornetQComponent
{
SimpleString getName();
Modified: trunk/src/main/org/hornetq/core/server/cluster/ClusterManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/ClusterManager.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/server/cluster/ClusterManager.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -16,7 +16,7 @@
import java.util.Map;
import java.util.Set;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.SimpleString;
/**
@@ -27,7 +27,7 @@
* Created 18 Nov 2008 09:23:26
*
*/
-public interface ClusterManager extends MessagingComponent
+public interface ClusterManager extends HornetQComponent
{
Map<String, Bridge> getBridges();
Modified: trunk/src/main/org/hornetq/core/transaction/ResourceManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/transaction/ResourceManager.java 2009-08-20 17:08:06
UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/transaction/ResourceManager.java 2009-08-20 17:26:39
UTC (rev 7839)
@@ -18,7 +18,7 @@
import javax.transaction.xa.Xid;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
@@ -28,7 +28,7 @@
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*
*/
-public interface ResourceManager extends MessagingComponent
+public interface ResourceManager extends HornetQComponent
{
boolean putTransaction(Xid xid, Transaction tx);
Modified: trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/core/transaction/impl/ResourceManagerImpl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -28,7 +28,7 @@
import javax.transaction.xa.Xid;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.core.transaction.ResourceManager;
import org.hornetq.core.transaction.Transaction;
@@ -38,7 +38,7 @@
*
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*/
-public class ResourceManagerImpl implements ResourceManager, MessagingComponent
+public class ResourceManagerImpl implements ResourceManager, HornetQComponent
{
private static final Logger log = Logger.getLogger(ResourceManagerImpl.class);
@@ -66,7 +66,7 @@
this.scheduledThreadPool = scheduledThreadPool;
}
- // MessagingComponent implementation
+ // HornetQComponent implementation
public void start() throws Exception
{
Modified: trunk/src/main/org/hornetq/integration/security/JBossASSecurityManager.java
===================================================================
--- trunk/src/main/org/hornetq/integration/security/JBossASSecurityManager.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/integration/security/JBossASSecurityManager.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -17,7 +17,7 @@
import org.hornetq.core.security.CheckType;
import org.hornetq.core.security.HornetQSecurityManager;
import org.hornetq.core.security.Role;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.jboss.security.AuthenticationManager;
import org.jboss.security.RealmMapping;
import org.jboss.security.SimplePrincipal;
@@ -35,7 +35,7 @@
* @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
* @author <a href="tim.fox(a)jboss.com">Tim Fox</a>
*/
-public class JBossASSecurityManager implements HornetQSecurityManager,
MessagingComponent
+public class JBossASSecurityManager implements HornetQSecurityManager, HornetQComponent
{
private static final Logger log = Logger.getLogger(JBossASSecurityManager.class);
Modified:
trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java
===================================================================
---
trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/integration/transports/netty/ChannelPipelineSupport.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -47,7 +47,7 @@
public static void addCodecFilter(final ChannelPipeline pipeline, final BufferHandler
handler)
{
assert pipeline != null;
- pipeline.addLast("decoder", new MessagingFrameDecoder(handler));
+ pipeline.addLast("decoder", new HornetQFrameDecoder(handler));
}
public static void addSSLFilter(final ChannelPipeline pipeline, final SSLContext
context, final boolean client) throws Exception
Copied: trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
(from rev 7828,
trunk/src/main/org/hornetq/integration/transports/netty/MessagingFrameDecoder.java)
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java
(rev 0)
+++
trunk/src/main/org/hornetq/integration/transports/netty/HornetQFrameDecoder.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,64 @@
+/*
+ * 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.integration.transports.netty;
+
+import static org.hornetq.utils.DataConstants.SIZE_INT;
+
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.spi.BufferHandler;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.frame.FrameDecoder;
+
+/**
+ * A Netty FrameDecoder used to decode messages.
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
+ * @author <a href="tlee(a)redhat.com">Trustin Lee</a>
+ *
+ * @version $Revision$, $Date$
+ */
+public class HornetQFrameDecoder extends FrameDecoder
+{
+ private static final Logger log = Logger.getLogger(HornetQFrameDecoder.class);
+
+ private final BufferHandler handler;
+
+ public HornetQFrameDecoder(final BufferHandler handler)
+ {
+ this.handler = handler;
+ }
+
+ // FrameDecoder overrides
+ //
-------------------------------------------------------------------------------------
+
+ @Override
+ protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer in)
throws Exception
+ {
+ // TODO - we can avoid this entirely if we maintain fragmented packets in the
handler
+ int start = in.readerIndex();
+
+ int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
+ if (length == -1)
+ {
+ in.readerIndex(start);
+ return null;
+ }
+
+ in.readerIndex(start + SIZE_INT);
+ return in.readBytes(length);
+ }
+}
Deleted:
trunk/src/main/org/hornetq/integration/transports/netty/MessagingFrameDecoder.java
===================================================================
---
trunk/src/main/org/hornetq/integration/transports/netty/MessagingFrameDecoder.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/integration/transports/netty/MessagingFrameDecoder.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,64 +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.integration.transports.netty;
-
-import static org.hornetq.utils.DataConstants.SIZE_INT;
-
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.spi.BufferHandler;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.channel.Channel;
-import org.jboss.netty.channel.ChannelHandlerContext;
-import org.jboss.netty.handler.codec.frame.FrameDecoder;
-
-/**
- * A Netty FrameDecoder used to decode messages.
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @author <a href="ataylor(a)redhat.com">Andy Taylor</a>
- * @author <a href="tlee(a)redhat.com">Trustin Lee</a>
- *
- * @version $Revision$, $Date$
- */
-public class MessagingFrameDecoder extends FrameDecoder
-{
- private static final Logger log = Logger.getLogger(MessagingFrameDecoder.class);
-
- private final BufferHandler handler;
-
- public MessagingFrameDecoder(final BufferHandler handler)
- {
- this.handler = handler;
- }
-
- // FrameDecoder overrides
- //
-------------------------------------------------------------------------------------
-
- @Override
- protected Object decode(ChannelHandlerContext ctx, Channel channel, ChannelBuffer in)
throws Exception
- {
- // TODO - we can avoid this entirely if we maintain fragmented packets in the
handler
- int start = in.readerIndex();
-
- int length = handler.isReadyToHandle(new ChannelBufferWrapper(in));
- if (length == -1)
- {
- in.readerIndex(start);
- return null;
- }
-
- in.readerIndex(start + SIZE_INT);
- return in.readBytes(length);
- }
-}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyAcceptor.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -268,7 +268,7 @@
}
ChannelPipelineSupport.addCodecFilter(pipeline, handler);
- pipeline.addLast("handler", new
MessagingServerChannelHandler(channelGroup, handler, new Listener()));
+ pipeline.addLast("handler", new
HornetQServerChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
};
@@ -408,9 +408,9 @@
// Inner classes
-----------------------------------------------------------------------------
@ChannelPipelineCoverage("one")
- private final class MessagingServerChannelHandler extends HornetQChannelHandler
+ private final class HornetQServerChannelHandler extends HornetQChannelHandler
{
- MessagingServerChannelHandler(ChannelGroup group, BufferHandler handler,
ConnectionLifeCycleListener listener)
+ HornetQServerChannelHandler(ChannelGroup group, BufferHandler handler,
ConnectionLifeCycleListener listener)
{
super(group, handler, listener);
}
Modified: trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java
===================================================================
--- trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/integration/transports/netty/NettyConnector.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -304,7 +304,7 @@
pipeline.addLast("httphandler", new HttpHandler());
}
ChannelPipelineSupport.addCodecFilter(pipeline, handler);
- pipeline.addLast("handler", new
MessagingClientChannelHandler(channelGroup, handler, new Listener()));
+ pipeline.addLast("handler", new
HornetQClientChannelHandler(channelGroup, handler, new Listener()));
return pipeline;
}
});
@@ -420,9 +420,9 @@
// Inner classes -------------------------------------------------
@ChannelPipelineCoverage("one")
- private final class MessagingClientChannelHandler extends HornetQChannelHandler
+ private final class HornetQClientChannelHandler extends HornetQChannelHandler
{
- MessagingClientChannelHandler(ChannelGroup group, BufferHandler handler,
ConnectionLifeCycleListener listener)
+ HornetQClientChannelHandler(ChannelGroup group, BufferHandler handler,
ConnectionLifeCycleListener listener)
{
super(group, handler, listener);
}
Modified: trunk/src/main/org/hornetq/jms/bridge/BridgeService.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/BridgeService.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/jms/bridge/BridgeService.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -16,7 +16,7 @@
import javax.management.ObjectName;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.jms.bridge.impl.JMSBridgeImpl;
/**
@@ -255,7 +255,7 @@
return bridge.isStarted();
}
- public MessagingComponent getInstance()
+ public HornetQComponent getInstance()
{
return bridge;
}
Modified: trunk/src/main/org/hornetq/jms/bridge/JMSBridge.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/JMSBridge.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/src/main/org/hornetq/jms/bridge/JMSBridge.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -15,7 +15,7 @@
import javax.transaction.TransactionManager;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
/**
*
@@ -25,7 +25,7 @@
* @version <tt>$Revision$</tt>
*
*/
-public interface JMSBridge extends MessagingComponent
+public interface JMSBridge extends HornetQComponent
{
void pause() throws Exception;
Modified: trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/jms/bridge/impl/JMSBridgeImpl.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -39,7 +39,7 @@
import org.hornetq.core.client.ClientSession;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.jms.bridge.ConnectionFactoryFactory;
import org.hornetq.jms.bridge.DestinationFactory;
import org.hornetq.jms.bridge.JMSBridge;
@@ -58,7 +58,7 @@
* $Id:JMSBridge.java 4566 2008-06-24 08:01:35Z jmesnil $
*
*/
-public class JMSBridgeImpl implements MessagingComponent, JMSBridge
+public class JMSBridgeImpl implements HornetQComponent, JMSBridge
{
private static final Logger log;
@@ -214,7 +214,7 @@
}
}
- // MessagingComponent overrides --------------------------------------------------
+ // HornetQComponent overrides --------------------------------------------------
public synchronized void start() throws Exception
{
Modified: trunk/src/main/org/hornetq/jms/server/JMSServerManager.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2009-08-20 17:08:06 UTC
(rev 7838)
+++ trunk/src/main/org/hornetq/jms/server/JMSServerManager.java 2009-08-20 17:26:39 UTC
(rev 7839)
@@ -14,7 +14,7 @@
package org.hornetq.jms.server;
import org.hornetq.core.config.TransportConfiguration;
-import org.hornetq.core.server.MessagingComponent;
+import org.hornetq.core.server.HornetQComponent;
import org.hornetq.utils.Pair;
import javax.naming.Context;
@@ -27,7 +27,7 @@
* @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
* @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
*/
-public interface JMSServerManager extends MessagingComponent
+public interface JMSServerManager extends HornetQComponent
{
String getVersion();
Modified: trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/src/main/org/hornetq/jms/server/impl/JMSServerManagerImpl.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -125,7 +125,7 @@
}
}
- // MessagingComponent implementation -----------------------------------
+ // HornetQComponent implementation -----------------------------------
public synchronized void start() throws Exception
{
Copied: trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceRecovery.java
(from rev 7828,
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceRecovery.java)
===================================================================
--- trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceRecovery.java
(rev 0)
+++
trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceRecovery.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,195 @@
+/*
+ * 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.server.recovery;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.transaction.xa.XAResource;
+
+import com.arjuna.ats.jta.recovery.XAResourceRecovery;
+
+import org.hornetq.core.logging.Logger;
+
+/**
+ *
+ * A XAResourceRecovery instance that can be used to recover any JMS provider.
+ *
+ *
+ * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
+ * @version <tt>$Revision: 1.1 $</tt>
+ *
+ * $Id$
+ *
+ */
+public class HornetQXAResourceRecovery implements XAResourceRecovery
+{
+ private boolean trace = log.isTraceEnabled();
+
+ private static final Logger log = Logger.getLogger(HornetQXAResourceRecovery.class);
+
+ private boolean hasMore;
+
+ private HornetQXAResourceWrapper res;
+
+ public HornetQXAResourceRecovery()
+ {
+ if(trace) log.trace("Constructing HornetQXAResourceRecovery");
+ }
+
+ public boolean initialise(String config)
+ {
+ if (log.isTraceEnabled()) { log.trace(this + " intialise: " + config); }
+
+ ConfigParser parser = new ConfigParser(config);
+ String connectorFactoryClassName = parser.getConnectorFactoryClassName();
+ Map<String, Object> connectorParams = parser.getConnectorParameters();
+ String username = parser.getUsername();
+ String password = parser.getPassword();
+
+ res = new HornetQXAResourceWrapper(connectorFactoryClassName, connectorParams,
username, password);
+
+ if (log.isTraceEnabled()) { log.trace(this + " initialised"); }
+
+ return true;
+ }
+
+ public boolean hasMoreResources()
+ {
+ if (log.isTraceEnabled()) { log.trace(this + " hasMoreResources"); }
+
+ /*
+ * The way hasMoreResources is supposed to work is as follows:
+ * For each "sweep" the recovery manager will call hasMoreResources, then
if it returns
+ * true it will call getXAResource.
+ * It will repeat that until hasMoreResources returns false.
+ * Then the sweep is over.
+ * For the next sweep hasMoreResources should return true, etc.
+ *
+ * In our case where we only need to return one XAResource per sweep,
+ * hasMoreResources should basically alternate between true and false.
+ *
+ *
+ */
+
+ hasMore = !hasMore;
+
+ return hasMore;
+ }
+
+ public XAResource getXAResource()
+ {
+ if (log.isTraceEnabled()) { log.trace(this + " getXAResource"); }
+
+ return res;
+ }
+
+ public XAResource[] getXAResources()
+ {
+ return new XAResource[]{res};
+ }
+
+ protected void finalize()
+ {
+ res.close();
+ }
+
+ public static class ConfigParser
+ {
+ private String connectorFactoryClassName;
+
+ private Map<String, Object> connectorParameters;
+
+ private String username;
+
+ private String password;
+
+ public ConfigParser(String config)
+ {
+ if (config == null || config.length() == 0)
+ {
+ throw new IllegalArgumentException("Must specify provider connector
factory class name in config");
+ }
+
+ String[] strings = config.split(",");
+
+ //First (mandatory) param is the connector factory class name
+ if (strings.length < 1)
+ {
+ throw new IllegalArgumentException("Must specify provider connector
factory class name in config");
+ }
+
+ connectorFactoryClassName = strings[0].trim();
+
+ //Next two (optional) parameters are the username and password to use for
creating the session for recovery
+
+ if (strings.length >= 2)
+ {
+
+ username = strings[1].trim();
+ if (username.length() == 0)
+ {
+ username = null;
+ }
+
+ if (strings.length == 2)
+ {
+ throw new IllegalArgumentException("If username is specified,
password must be specified too");
+ }
+
+ password = strings[2].trim();
+ if (password.length() == 0)
+ {
+ password = null;
+ }
+ }
+
+
+ // other tokens are for connector configurations
+ connectorParameters = new HashMap<String, Object>();
+ if (strings.length >= 3)
+ {
+ for (int i = 3; i < strings.length; i++)
+ {
+ String[] str = strings[i].split("=");
+ if (str.length == 2)
+ {
+ connectorParameters.put(str[0].trim(), str[1].trim());
+ }
+ }
+ }
+ }
+
+ public String getConnectorFactoryClassName()
+ {
+ return connectorFactoryClassName;
+ }
+
+ public Map<String, Object> getConnectorParameters()
+ {
+ return connectorParameters;
+ }
+
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public String getPassword()
+ {
+ return password;
+ }
+ }
+}
+
Copied: trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java (from
rev 7831, trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceWrapper.java)
===================================================================
--- trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java
(rev 0)
+++
trunk/src/main/org/hornetq/jms/server/recovery/HornetQXAResourceWrapper.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,335 @@
+/*
+ * 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.server.recovery;
+
+import java.util.Map;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.XAResource;
+import javax.transaction.xa.Xid;
+
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.exception.HornetQException;
+import org.hornetq.core.logging.Logger;
+import org.hornetq.core.remoting.FailureListener;
+
+/**
+ * XAResourceWrapper.
+ *
+ * Mainly from org.jboss.server.XAResourceWrapper from the JBoss AS server module
+ *
+ * The reason why we don't use that class directly is that it assumes on failure of
connection
+ * the RM_FAIL or RM_ERR is thrown, but in HornetQ we throw XA_RETRY since we want the
recovery manager to be able
+ * to retry on failure without having to manually retry
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author <a href="tim.fox(a)jboss.com">Tim Fox/a>
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ * @version $Revision: 45341 $
+ */
+public class HornetQXAResourceWrapper implements XAResource, FailureListener
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(HornetQXAResourceWrapper.class);
+
+ /** The state lock */
+ private static final Object lock = new Object();
+
+ /** The JNDI lookup for the XA connection factory */
+ private final String connectorFactoryClassName;
+
+ private Map<String, Object> connectorConfig;
+
+ private final String username;
+
+ private final String password;
+
+ private ClientSessionFactory csf;
+
+ private XAResource delegate;
+
+ public HornetQXAResourceWrapper(final String connectorFactoryClassName,
+ final Map<String, Object> connectorConfig,
+ final String username,
+ final String password)
+ {
+ this.connectorFactoryClassName = connectorFactoryClassName;
+ this.connectorConfig = connectorConfig;
+ this.username = username;
+ this.password = password;
+ }
+
+ public Xid[] recover(int flag) throws XAException
+ {
+ log.debug("Recover " + connectorFactoryClassName);
+ XAResource xaResource = getDelegate();
+ try
+ {
+ return xaResource.recover(flag);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public void commit(Xid xid, boolean onePhase) throws XAException
+ {
+ log.debug("Commit " + connectorFactoryClassName + " xid " +
" onePhase=" + onePhase);
+ XAResource xaResource = getDelegate();
+ try
+ {
+ xaResource.commit(xid, onePhase);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public void rollback(Xid xid) throws XAException
+ {
+ log.debug("Rollback " + connectorFactoryClassName + " xid ");
+ XAResource xaResource = getDelegate();
+ try
+ {
+ xaResource.rollback(xid);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public void forget(Xid xid) throws XAException
+ {
+ log.debug("Forget " + connectorFactoryClassName + " xid ");
+ XAResource xaResource = getDelegate();
+ try
+ {
+ xaResource.forget(xid);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public boolean isSameRM(XAResource xaRes) throws XAException
+ {
+ if (xaRes instanceof HornetQXAResourceWrapper)
+ xaRes = ((HornetQXAResourceWrapper)xaRes).getDelegate();
+
+ XAResource xaResource = getDelegate();
+ try
+ {
+ return xaResource.isSameRM(xaRes);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public int prepare(Xid xid) throws XAException
+ {
+ XAResource xaResource = getDelegate();
+ try
+ {
+ return xaResource.prepare(xid);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public void start(Xid xid, int flags) throws XAException
+ {
+ XAResource xaResource = getDelegate();
+ try
+ {
+ xaResource.start(xid, flags);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public void end(Xid xid, int flags) throws XAException
+ {
+ XAResource xaResource = getDelegate();
+ try
+ {
+ xaResource.end(xid, flags);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public int getTransactionTimeout() throws XAException
+ {
+ XAResource xaResource = getDelegate();
+ try
+ {
+ return xaResource.getTransactionTimeout();
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public boolean setTransactionTimeout(int seconds) throws XAException
+ {
+ XAResource xaResource = getDelegate();
+ try
+ {
+ return xaResource.setTransactionTimeout(seconds);
+ }
+ catch (XAException e)
+ {
+ throw check(e);
+ }
+ }
+
+ public void connectionFailed(HornetQException me)
+ {
+ log.warn("Notified of connection failure in recovery connectionFactory for
provider " + connectorFactoryClassName, me);
+ close();
+ }
+
+ /**
+ * Get the connectionFactory XAResource
+ *
+ * @return the connectionFactory
+ * @throws XAException for any problem
+ */
+ public XAResource getDelegate() throws XAException
+ {
+ XAResource result = null;
+ Exception error = null;
+ try
+ {
+ result = connect();
+ }
+ catch (Exception e)
+ {
+ log.error("********************************Failed to connect to
server", e);
+ error = e;
+ }
+
+ if (result == null)
+ {
+ XAException xae = new XAException("Error trying to connect to provider
" + connectorFactoryClassName);
+ xae.errorCode = XAException.XAER_RMERR;
+ if (error != null)
+ xae.initCause(error);
+ log.debug("Cannot get connectionFactory XAResource", xae);
+ throw xae;
+ }
+
+ return result;
+ }
+
+ /**
+ * Connect to the server if not already done so
+ *
+ * @return the connectionFactory XAResource
+ * @throws Exception for any problem
+ */
+ protected XAResource connect() throws Exception
+ {
+ // Do we already have a valid connectionFactory?
+ synchronized (lock)
+ {
+ if (delegate != null)
+ return delegate;
+ }
+
+ TransportConfiguration config = new
TransportConfiguration(connectorFactoryClassName, connectorConfig);
+ csf = new ClientSessionFactoryImpl(config);
+ ClientSession cs = null;
+
+ if (username == null)
+ {
+ cs = csf.createSession(true, false, false);
+ }
+ else
+ {
+ cs = csf.createSession(username, password, true, false, false, false, 1);
+ }
+ cs.addFailureListener(this);
+
+ synchronized (lock)
+ {
+ delegate = cs;
+ }
+
+ return delegate;
+ }
+
+ /**
+ * Close the connection
+ */
+ public void close()
+ {
+ try
+ {
+ ClientSessionFactory oldCSF = null;
+ synchronized (lock)
+ {
+ oldCSF = csf;
+ csf = null;
+ delegate = null;
+ }
+ if (oldCSF != null)
+ oldCSF.close();
+ }
+ catch (Exception ignored)
+ {
+ log.trace("Ignored error during close", ignored);
+ }
+ }
+
+ /**
+ * Check whether an XAException is fatal. If it is an RM problem
+ * we close the connection so the next call will reconnect.
+ *
+ * @param e the xa exception
+ * @return never
+ * @throws XAException always
+ */
+ protected XAException check(XAException e) throws XAException
+ {
+ if (e.errorCode == XAException.XA_RETRY)
+ {
+ log.debug("Fatal error in provider " + connectorFactoryClassName, e);
+ close();
+ }
+ throw new XAException(XAException.XAER_RMFAIL);
+ }
+
+ protected void finalize() throws Throwable
+ {
+ close();
+ }
+}
Deleted: trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceRecovery.java
===================================================================
---
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceRecovery.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceRecovery.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,195 +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.server.recovery;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.transaction.xa.XAResource;
-
-import com.arjuna.ats.jta.recovery.XAResourceRecovery;
-
-import org.hornetq.core.logging.Logger;
-
-/**
- *
- * A XAResourceRecovery instance that can be used to recover any JMS provider.
- *
- *
- * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
- * @version <tt>$Revision: 1.1 $</tt>
- *
- * $Id$
- *
- */
-public class MessagingXAResourceRecovery implements XAResourceRecovery
-{
- private boolean trace = log.isTraceEnabled();
-
- private static final Logger log =
Logger.getLogger(MessagingXAResourceRecovery.class);
-
- private boolean hasMore;
-
- private MessagingXAResourceWrapper res;
-
- public MessagingXAResourceRecovery()
- {
- if(trace) log.trace("Constructing MessagingXAResourceRecovery");
- }
-
- public boolean initialise(String config)
- {
- if (log.isTraceEnabled()) { log.trace(this + " intialise: " + config); }
-
- ConfigParser parser = new ConfigParser(config);
- String connectorFactoryClassName = parser.getConnectorFactoryClassName();
- Map<String, Object> connectorParams = parser.getConnectorParameters();
- String username = parser.getUsername();
- String password = parser.getPassword();
-
- res = new MessagingXAResourceWrapper(connectorFactoryClassName, connectorParams,
username, password);
-
- if (log.isTraceEnabled()) { log.trace(this + " initialised"); }
-
- return true;
- }
-
- public boolean hasMoreResources()
- {
- if (log.isTraceEnabled()) { log.trace(this + " hasMoreResources"); }
-
- /*
- * The way hasMoreResources is supposed to work is as follows:
- * For each "sweep" the recovery manager will call hasMoreResources, then
if it returns
- * true it will call getXAResource.
- * It will repeat that until hasMoreResources returns false.
- * Then the sweep is over.
- * For the next sweep hasMoreResources should return true, etc.
- *
- * In our case where we only need to return one XAResource per sweep,
- * hasMoreResources should basically alternate between true and false.
- *
- *
- */
-
- hasMore = !hasMore;
-
- return hasMore;
- }
-
- public XAResource getXAResource()
- {
- if (log.isTraceEnabled()) { log.trace(this + " getXAResource"); }
-
- return res;
- }
-
- public XAResource[] getXAResources()
- {
- return new XAResource[]{res};
- }
-
- protected void finalize()
- {
- res.close();
- }
-
- public static class ConfigParser
- {
- private String connectorFactoryClassName;
-
- private Map<String, Object> connectorParameters;
-
- private String username;
-
- private String password;
-
- public ConfigParser(String config)
- {
- if (config == null || config.length() == 0)
- {
- throw new IllegalArgumentException("Must specify provider connector
factory class name in config");
- }
-
- String[] strings = config.split(",");
-
- //First (mandatory) param is the connector factory class name
- if (strings.length < 1)
- {
- throw new IllegalArgumentException("Must specify provider connector
factory class name in config");
- }
-
- connectorFactoryClassName = strings[0].trim();
-
- //Next two (optional) parameters are the username and password to use for
creating the session for recovery
-
- if (strings.length >= 2)
- {
-
- username = strings[1].trim();
- if (username.length() == 0)
- {
- username = null;
- }
-
- if (strings.length == 2)
- {
- throw new IllegalArgumentException("If username is specified,
password must be specified too");
- }
-
- password = strings[2].trim();
- if (password.length() == 0)
- {
- password = null;
- }
- }
-
-
- // other tokens are for connector configurations
- connectorParameters = new HashMap<String, Object>();
- if (strings.length >= 3)
- {
- for (int i = 3; i < strings.length; i++)
- {
- String[] str = strings[i].split("=");
- if (str.length == 2)
- {
- connectorParameters.put(str[0].trim(), str[1].trim());
- }
- }
- }
- }
-
- public String getConnectorFactoryClassName()
- {
- return connectorFactoryClassName;
- }
-
- public Map<String, Object> getConnectorParameters()
- {
- return connectorParameters;
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public String getPassword()
- {
- return password;
- }
- }
-}
-
Deleted: trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceWrapper.java
===================================================================
---
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceWrapper.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/src/main/org/hornetq/jms/server/recovery/MessagingXAResourceWrapper.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,335 +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.server.recovery;
-
-import java.util.Map;
-
-import javax.transaction.xa.XAException;
-import javax.transaction.xa.XAResource;
-import javax.transaction.xa.Xid;
-
-import org.hornetq.core.client.ClientSession;
-import org.hornetq.core.client.ClientSessionFactory;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
-import org.hornetq.core.config.TransportConfiguration;
-import org.hornetq.core.exception.HornetQException;
-import org.hornetq.core.logging.Logger;
-import org.hornetq.core.remoting.FailureListener;
-
-/**
- * XAResourceWrapper.
- *
- * Mainly from org.jboss.server.XAResourceWrapper from the JBoss AS server module
- *
- * The reason why we don't use that class directly is that it assumes on failure of
connection
- * the RM_FAIL or RM_ERR is thrown, but in HornetQ we throw XA_RETRY since we want the
recovery manager to be able
- * to retry on failure without having to manually retry
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author <a href="tim.fox(a)jboss.com">Tim Fox/a>
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- *
- * @version $Revision: 45341 $
- */
-public class MessagingXAResourceWrapper implements XAResource, FailureListener
-{
- /** The log */
- private static final Logger log = Logger.getLogger(MessagingXAResourceWrapper.class);
-
- /** The state lock */
- private static final Object lock = new Object();
-
- /** The JNDI lookup for the XA connection factory */
- private final String connectorFactoryClassName;
-
- private Map<String, Object> connectorConfig;
-
- private final String username;
-
- private final String password;
-
- private ClientSessionFactory csf;
-
- private XAResource delegate;
-
- public MessagingXAResourceWrapper(final String connectorFactoryClassName,
- final Map<String, Object> connectorConfig,
- final String username,
- final String password)
- {
- this.connectorFactoryClassName = connectorFactoryClassName;
- this.connectorConfig = connectorConfig;
- this.username = username;
- this.password = password;
- }
-
- public Xid[] recover(int flag) throws XAException
- {
- log.debug("Recover " + connectorFactoryClassName);
- XAResource xaResource = getDelegate();
- try
- {
- return xaResource.recover(flag);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public void commit(Xid xid, boolean onePhase) throws XAException
- {
- log.debug("Commit " + connectorFactoryClassName + " xid " +
" onePhase=" + onePhase);
- XAResource xaResource = getDelegate();
- try
- {
- xaResource.commit(xid, onePhase);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public void rollback(Xid xid) throws XAException
- {
- log.debug("Rollback " + connectorFactoryClassName + " xid ");
- XAResource xaResource = getDelegate();
- try
- {
- xaResource.rollback(xid);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public void forget(Xid xid) throws XAException
- {
- log.debug("Forget " + connectorFactoryClassName + " xid ");
- XAResource xaResource = getDelegate();
- try
- {
- xaResource.forget(xid);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public boolean isSameRM(XAResource xaRes) throws XAException
- {
- if (xaRes instanceof MessagingXAResourceWrapper)
- xaRes = ((MessagingXAResourceWrapper)xaRes).getDelegate();
-
- XAResource xaResource = getDelegate();
- try
- {
- return xaResource.isSameRM(xaRes);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public int prepare(Xid xid) throws XAException
- {
- XAResource xaResource = getDelegate();
- try
- {
- return xaResource.prepare(xid);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public void start(Xid xid, int flags) throws XAException
- {
- XAResource xaResource = getDelegate();
- try
- {
- xaResource.start(xid, flags);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public void end(Xid xid, int flags) throws XAException
- {
- XAResource xaResource = getDelegate();
- try
- {
- xaResource.end(xid, flags);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public int getTransactionTimeout() throws XAException
- {
- XAResource xaResource = getDelegate();
- try
- {
- return xaResource.getTransactionTimeout();
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public boolean setTransactionTimeout(int seconds) throws XAException
- {
- XAResource xaResource = getDelegate();
- try
- {
- return xaResource.setTransactionTimeout(seconds);
- }
- catch (XAException e)
- {
- throw check(e);
- }
- }
-
- public void connectionFailed(HornetQException me)
- {
- log.warn("Notified of connection failure in recovery connectionFactory for
provider " + connectorFactoryClassName, me);
- close();
- }
-
- /**
- * Get the connectionFactory XAResource
- *
- * @return the connectionFactory
- * @throws XAException for any problem
- */
- public XAResource getDelegate() throws XAException
- {
- XAResource result = null;
- Exception error = null;
- try
- {
- result = connect();
- }
- catch (Exception e)
- {
- log.error("********************************Failed to connect to
server", e);
- error = e;
- }
-
- if (result == null)
- {
- XAException xae = new XAException("Error trying to connect to provider
" + connectorFactoryClassName);
- xae.errorCode = XAException.XAER_RMERR;
- if (error != null)
- xae.initCause(error);
- log.debug("Cannot get connectionFactory XAResource", xae);
- throw xae;
- }
-
- return result;
- }
-
- /**
- * Connect to the server if not already done so
- *
- * @return the connectionFactory XAResource
- * @throws Exception for any problem
- */
- protected XAResource connect() throws Exception
- {
- // Do we already have a valid connectionFactory?
- synchronized (lock)
- {
- if (delegate != null)
- return delegate;
- }
-
- TransportConfiguration config = new
TransportConfiguration(connectorFactoryClassName, connectorConfig);
- csf = new ClientSessionFactoryImpl(config);
- ClientSession cs = null;
-
- if (username == null)
- {
- cs = csf.createSession(true, false, false);
- }
- else
- {
- cs = csf.createSession(username, password, true, false, false, false, 1);
- }
- cs.addFailureListener(this);
-
- synchronized (lock)
- {
- delegate = cs;
- }
-
- return delegate;
- }
-
- /**
- * Close the connection
- */
- public void close()
- {
- try
- {
- ClientSessionFactory oldCSF = null;
- synchronized (lock)
- {
- oldCSF = csf;
- csf = null;
- delegate = null;
- }
- if (oldCSF != null)
- oldCSF.close();
- }
- catch (Exception ignored)
- {
- log.trace("Ignored error during close", ignored);
- }
- }
-
- /**
- * Check whether an XAException is fatal. If it is an RM problem
- * we close the connection so the next call will reconnect.
- *
- * @param e the xa exception
- * @return never
- * @throws XAException always
- */
- protected XAException check(XAException e) throws XAException
- {
- if (e.errorCode == XAException.XA_RETRY)
- {
- log.debug("Fatal error in provider " + connectorFactoryClassName, e);
- close();
- }
- throw new XAException(XAException.XAER_RMFAIL);
- }
-
- protected void finalize() throws Throwable
- {
- close();
- }
-}
Modified: trunk/tests/jms-tests/config/jbossjta-properties.xml
===================================================================
--- trunk/tests/jms-tests/config/jbossjta-properties.xml 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/tests/jms-tests/config/jbossjta-properties.xml 2009-08-20 17:26:39 UTC (rev
7839)
@@ -156,7 +156,7 @@
<!--
com.arjuna.ats.internal.jta.transaction.jts.UserTransactionImple
-->
-<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ"
value="org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;adaptor1"/>
+<property name="com.arjuna.ats.jta.recovery.XAResourceRecovery.HORNETQ"
value="org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;adaptor1"/>
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ConsumerCloseTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ConsumerCloseTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ConsumerCloseTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -68,7 +68,7 @@
assertTrue(consumer.isClosed());
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -76,7 +76,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -84,7 +84,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
Modified: trunk/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/integration/client/MessageDurabilityTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -138,7 +138,7 @@
session.start();
- expectHornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, new
MessagingAction()
+ expectHornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -165,7 +165,7 @@
restart();
session.start();
- expectHornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, new
MessagingAction()
+ expectHornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, new HornetQAction()
{
public void run() throws HornetQException
{
Modified: trunk/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/tests/src/org/hornetq/tests/integration/client/ProducerCloseTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -59,7 +59,7 @@
assertTrue(producer.isClosed());
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
Modified: trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/tests/src/org/hornetq/tests/integration/client/RequestorTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -160,7 +160,7 @@
session.close();
- expectHornetQException("ClientRequestor's session must not be
closed", HornetQException.OBJECT_CLOSED, new MessagingAction(){
+ expectHornetQException("ClientRequestor's session must not be
closed", HornetQException.OBJECT_CLOSED, new HornetQAction(){
public void run() throws Exception
{
new ClientRequestor(session, requestAddress);
@@ -198,7 +198,7 @@
requestor.close();
- expectHornetQException("can not send a request on a closed
ClientRequestor", HornetQException.OBJECT_CLOSED, new MessagingAction(){
+ expectHornetQException("can not send a request on a closed
ClientRequestor", HornetQException.OBJECT_CLOSED, new HornetQAction(){
public void run() throws Exception
{
Modified: trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/tests/src/org/hornetq/tests/integration/client/SessionCloseTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -69,7 +69,7 @@
assertTrue(session.isClosed());
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -77,7 +77,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -85,7 +85,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -93,7 +93,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -101,7 +101,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -109,7 +109,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -117,7 +117,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -125,7 +125,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -133,7 +133,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -141,7 +141,7 @@
}
});
- expectHornetQException(HornetQException.OBJECT_CLOSED, new MessagingAction()
+ expectHornetQException(HornetQException.OBJECT_CLOSED, new HornetQAction()
{
public void run() throws HornetQException
{
@@ -161,7 +161,7 @@
assertTrue(session.isXA());
assertTrue(session.isClosed());
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
@@ -169,7 +169,7 @@
}
});
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
@@ -177,7 +177,7 @@
}
});
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
@@ -185,7 +185,7 @@
}
});
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
@@ -193,7 +193,7 @@
}
});
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
@@ -201,7 +201,7 @@
}
});
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
@@ -209,7 +209,7 @@
}
});
- expectXAException(XAException.XAER_RMERR, new MessagingAction()
+ expectXAException(XAException.XAER_RMERR, new HornetQAction()
{
public void run() throws XAException
{
Modified: trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/integration/client/TemporaryQueueTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -207,7 +207,7 @@
session = sf.createSession(false, true, true);
session.start();
- expectHornetQException("temp queue must not exist after the server detected
the client crash", HornetQException.QUEUE_DOES_NOT_EXIST, new MessagingAction()
+ expectHornetQException("temp queue must not exist after the server detected
the client crash", HornetQException.QUEUE_DOES_NOT_EXIST, new HornetQAction()
{
public void run() throws HornetQException
{
Copied:
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareHornetQServerControlWrapperTest.java
(from rev 7831,
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java)
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareHornetQServerControlWrapperTest.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareHornetQServerControlWrapperTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,239 @@
+/*
+ * 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.integration.cluster.management;
+
+import static
org.hornetq.tests.integration.management.ManagementControlHelper.createMessagingServerControl;
+import static
org.hornetq.tests.integration.management.ManagementControlHelper.createQueueControl;
+import static org.hornetq.tests.util.RandomUtil.randomLong;
+import static org.hornetq.tests.util.RandomUtil.randomPositiveLong;
+import static org.hornetq.tests.util.RandomUtil.randomSimpleString;
+
+import javax.management.ObjectName;
+
+import org.hornetq.core.client.ClientMessage;
+import org.hornetq.core.client.ClientProducer;
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.management.MessageCounterInfo;
+import org.hornetq.core.management.HornetQServerControl;
+import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.QueueControl;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.utils.SimpleString;
+
+/**
+ * A ReplicationAwareQueueControlWrapperTest
+ *
+ * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
+ */
+public class ReplicationAwareHornetQServerControlWrapperTest extends
ReplicationAwareTestBase
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ private SimpleString address;
+
+ private ClientSession session;
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testCreateQueue() throws Exception
+ {
+ SimpleString address = randomSimpleString();
+ SimpleString name = randomSimpleString();
+
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ ObjectName queueON = ObjectNames.getQueueObjectName(address, name);
+
+ assertResourceNotExists(liveMBeanServer, queueON);
+ assertResourceNotExists(backupMBeanServer, queueON);
+
+ liveServerControl.createQueue(address.toString(), name.toString());
+
+ assertResourceExists(liveMBeanServer, queueON);
+ assertResourceExists(backupMBeanServer, queueON);
+ }
+
+ public void testDestroyQueue() throws Exception
+ {
+ SimpleString address = randomSimpleString();
+ SimpleString name = randomSimpleString();
+
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ ObjectName queueON = ObjectNames.getQueueObjectName(address, name);
+
+ assertResourceNotExists(liveMBeanServer, queueON);
+ assertResourceNotExists(backupMBeanServer, queueON);
+
+ // create the queue...
+ liveServerControl.createQueue(address.toString(), name.toString());
+
+ assertResourceExists(liveMBeanServer, queueON);
+ assertResourceExists(backupMBeanServer, queueON);
+
+ // ... and destroy it
+ liveServerControl.destroyQueue(name.toString());
+
+ assertResourceNotExists(liveMBeanServer, queueON);
+ assertResourceNotExists(backupMBeanServer, queueON);
+ }
+
+ public void testEnableMessageCounters() throws Exception
+ {
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
+
+ assertFalse(liveServerControl.isMessageCounterEnabled());
+ assertFalse(backupServerControl.isMessageCounterEnabled());
+
+ liveServerControl.enableMessageCounters();
+
+ assertTrue(liveServerControl.isMessageCounterEnabled());
+ assertTrue(backupServerControl.isMessageCounterEnabled());
+ }
+
+ public void testDisableMessageCounters() throws Exception
+ {
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
+
+ assertFalse(liveServerControl.isMessageCounterEnabled());
+ assertFalse(backupServerControl.isMessageCounterEnabled());
+
+ // enable the counters...
+ liveServerControl.enableMessageCounters();
+
+ assertTrue(liveServerControl.isMessageCounterEnabled());
+ assertTrue(backupServerControl.isMessageCounterEnabled());
+
+ // and disable them
+ liveServerControl.disableMessageCounters();
+
+ assertFalse(liveServerControl.isMessageCounterEnabled());
+ assertFalse(backupServerControl.isMessageCounterEnabled());
+ }
+
+ public void testResetAllMessageCounters() throws Exception
+ {
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ liveServerControl.enableMessageCounters();
+ liveServerControl.setMessageCounterSamplePeriod(2000);
+
+ QueueControl liveQueueControl = createQueueControl(address, address,
liveMBeanServer);
+ QueueControl backupQueueControl = createQueueControl(address, address,
backupMBeanServer);
+
+ // send on queue
+ ClientProducer producer = session.createProducer(address);
+ ClientMessage message = session.createClientMessage(false);
+ SimpleString key = randomSimpleString();
+ long value = randomLong();
+ message.putLongProperty(key, value);
+ producer.send(message);
+
+ Thread.sleep(liveServerControl.getMessageCounterSamplePeriod() * 2);
+
+ // check the count is to 1 on both live & backup nodes
+ String jsonString = liveQueueControl.listMessageCounter();
+ MessageCounterInfo counter = MessageCounterInfo.fromJSON(jsonString);
+
+ assertEquals(1, counter.getCount());
+ counter = MessageCounterInfo.fromJSON(backupQueueControl.listMessageCounter());
+ assertEquals(1, counter.getCount());
+
+ liveServerControl.resetAllMessageCounters();
+ Thread.sleep(liveServerControl.getMessageCounterSamplePeriod() * 2);
+
+ // check the count has been reset to 0 on both live & backup nodes
+ counter = MessageCounterInfo.fromJSON(liveQueueControl.listMessageCounter());
+ assertEquals(0, counter.getCount());
+ counter = MessageCounterInfo.fromJSON(backupQueueControl.listMessageCounter());
+ assertEquals(0, counter.getCount());
+ }
+
+ public void testSetMessageCounterSamplePeriod() throws Exception
+ {
+ long newPeriod = randomPositiveLong();
+
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
+
+ assertEquals(liveServerControl.getMessageCounterSamplePeriod(),
+ backupServerControl.getMessageCounterSamplePeriod());
+
+ liveServerControl.setMessageCounterSamplePeriod(newPeriod);
+
+ assertEquals(newPeriod, liveServerControl.getMessageCounterSamplePeriod());
+ assertEquals(newPeriod, backupServerControl.getMessageCounterSamplePeriod());
+ }
+
+ public void testSetMessageCounterMaxDayCount() throws Exception
+ {
+ int newCount = RandomUtil.randomPositiveInt();
+
+ HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
+ HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
+
+ assertEquals(liveServerControl.getMessageCounterMaxDayCount(),
backupServerControl.getMessageCounterMaxDayCount());
+
+ liveServerControl.setMessageCounterMaxDayCount(newCount);
+
+ assertEquals(newCount, liveServerControl.getMessageCounterMaxDayCount());
+ assertEquals(newCount, backupServerControl.getMessageCounterMaxDayCount());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ address = RandomUtil.randomSimpleString();
+
+ ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName()),
+ new
TransportConfiguration(InVMConnectorFactory.class.getName(),
+
backupParams));
+
+ session = sf.createSession(false, true, true);
+
+ session.createQueue(address, address, null, false);
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ session.close();
+
+ session = null;
+
+ address = null;
+
+ super.tearDown();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted:
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/integration/cluster/management/ReplicationAwareMessagingServerControlWrapperTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,239 +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.integration.cluster.management;
-
-import static
org.hornetq.tests.integration.management.ManagementControlHelper.createMessagingServerControl;
-import static
org.hornetq.tests.integration.management.ManagementControlHelper.createQueueControl;
-import static org.hornetq.tests.util.RandomUtil.randomLong;
-import static org.hornetq.tests.util.RandomUtil.randomPositiveLong;
-import static org.hornetq.tests.util.RandomUtil.randomSimpleString;
-
-import javax.management.ObjectName;
-
-import org.hornetq.core.client.ClientMessage;
-import org.hornetq.core.client.ClientProducer;
-import org.hornetq.core.client.ClientSession;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
-import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
-import org.hornetq.core.config.TransportConfiguration;
-import org.hornetq.core.management.MessageCounterInfo;
-import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ObjectNames;
-import org.hornetq.core.management.QueueControl;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.utils.SimpleString;
-
-/**
- * A ReplicationAwareQueueControlWrapperTest
- *
- * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
- */
-public class ReplicationAwareMessagingServerControlWrapperTest extends
ReplicationAwareTestBase
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- private SimpleString address;
-
- private ClientSession session;
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testCreateQueue() throws Exception
- {
- SimpleString address = randomSimpleString();
- SimpleString name = randomSimpleString();
-
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- ObjectName queueON = ObjectNames.getQueueObjectName(address, name);
-
- assertResourceNotExists(liveMBeanServer, queueON);
- assertResourceNotExists(backupMBeanServer, queueON);
-
- liveServerControl.createQueue(address.toString(), name.toString());
-
- assertResourceExists(liveMBeanServer, queueON);
- assertResourceExists(backupMBeanServer, queueON);
- }
-
- public void testDestroyQueue() throws Exception
- {
- SimpleString address = randomSimpleString();
- SimpleString name = randomSimpleString();
-
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- ObjectName queueON = ObjectNames.getQueueObjectName(address, name);
-
- assertResourceNotExists(liveMBeanServer, queueON);
- assertResourceNotExists(backupMBeanServer, queueON);
-
- // create the queue...
- liveServerControl.createQueue(address.toString(), name.toString());
-
- assertResourceExists(liveMBeanServer, queueON);
- assertResourceExists(backupMBeanServer, queueON);
-
- // ... and destroy it
- liveServerControl.destroyQueue(name.toString());
-
- assertResourceNotExists(liveMBeanServer, queueON);
- assertResourceNotExists(backupMBeanServer, queueON);
- }
-
- public void testEnableMessageCounters() throws Exception
- {
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
-
- assertFalse(liveServerControl.isMessageCounterEnabled());
- assertFalse(backupServerControl.isMessageCounterEnabled());
-
- liveServerControl.enableMessageCounters();
-
- assertTrue(liveServerControl.isMessageCounterEnabled());
- assertTrue(backupServerControl.isMessageCounterEnabled());
- }
-
- public void testDisableMessageCounters() throws Exception
- {
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
-
- assertFalse(liveServerControl.isMessageCounterEnabled());
- assertFalse(backupServerControl.isMessageCounterEnabled());
-
- // enable the counters...
- liveServerControl.enableMessageCounters();
-
- assertTrue(liveServerControl.isMessageCounterEnabled());
- assertTrue(backupServerControl.isMessageCounterEnabled());
-
- // and disable them
- liveServerControl.disableMessageCounters();
-
- assertFalse(liveServerControl.isMessageCounterEnabled());
- assertFalse(backupServerControl.isMessageCounterEnabled());
- }
-
- public void testResetAllMessageCounters() throws Exception
- {
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- liveServerControl.enableMessageCounters();
- liveServerControl.setMessageCounterSamplePeriod(2000);
-
- QueueControl liveQueueControl = createQueueControl(address, address,
liveMBeanServer);
- QueueControl backupQueueControl = createQueueControl(address, address,
backupMBeanServer);
-
- // send on queue
- ClientProducer producer = session.createProducer(address);
- ClientMessage message = session.createClientMessage(false);
- SimpleString key = randomSimpleString();
- long value = randomLong();
- message.putLongProperty(key, value);
- producer.send(message);
-
- Thread.sleep(liveServerControl.getMessageCounterSamplePeriod() * 2);
-
- // check the count is to 1 on both live & backup nodes
- String jsonString = liveQueueControl.listMessageCounter();
- MessageCounterInfo counter = MessageCounterInfo.fromJSON(jsonString);
-
- assertEquals(1, counter.getCount());
- counter = MessageCounterInfo.fromJSON(backupQueueControl.listMessageCounter());
- assertEquals(1, counter.getCount());
-
- liveServerControl.resetAllMessageCounters();
- Thread.sleep(liveServerControl.getMessageCounterSamplePeriod() * 2);
-
- // check the count has been reset to 0 on both live & backup nodes
- counter = MessageCounterInfo.fromJSON(liveQueueControl.listMessageCounter());
- assertEquals(0, counter.getCount());
- counter = MessageCounterInfo.fromJSON(backupQueueControl.listMessageCounter());
- assertEquals(0, counter.getCount());
- }
-
- public void testSetMessageCounterSamplePeriod() throws Exception
- {
- long newPeriod = randomPositiveLong();
-
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
-
- assertEquals(liveServerControl.getMessageCounterSamplePeriod(),
- backupServerControl.getMessageCounterSamplePeriod());
-
- liveServerControl.setMessageCounterSamplePeriod(newPeriod);
-
- assertEquals(newPeriod, liveServerControl.getMessageCounterSamplePeriod());
- assertEquals(newPeriod, backupServerControl.getMessageCounterSamplePeriod());
- }
-
- public void testSetMessageCounterMaxDayCount() throws Exception
- {
- int newCount = RandomUtil.randomPositiveInt();
-
- HornetQServerControl liveServerControl =
createMessagingServerControl(liveMBeanServer);
- HornetQServerControl backupServerControl =
createMessagingServerControl(backupMBeanServer);
-
- assertEquals(liveServerControl.getMessageCounterMaxDayCount(),
backupServerControl.getMessageCounterMaxDayCount());
-
- liveServerControl.setMessageCounterMaxDayCount(newCount);
-
- assertEquals(newCount, liveServerControl.getMessageCounterMaxDayCount());
- assertEquals(newCount, backupServerControl.getMessageCounterMaxDayCount());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- address = RandomUtil.randomSimpleString();
-
- ClientSessionFactoryInternal sf = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName()),
- new
TransportConfiguration(InVMConnectorFactory.class.getName(),
-
backupParams));
-
- session = sf.createSession(false, true, true);
-
- session.createQueue(address, address, null, false);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- session.close();
-
- session = null;
-
- address = null;
-
- super.tearDown();
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Copied:
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
(from rev 7831,
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlTest.java)
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,335 @@
+/*
+ * 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.integration.management;
+
+import static org.hornetq.tests.util.RandomUtil.randomBoolean;
+import static org.hornetq.tests.util.RandomUtil.randomString;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.management.HornetQServerControl;
+import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.QueueControl;
+import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.server.HornetQ;
+import org.hornetq.core.server.HornetQServer;
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.utils.SimpleString;
+import org.hornetq.utils.json.JSONArray;
+import org.hornetq.utils.json.JSONObject;
+
+/**
+ * A QueueControlTest
+ *
+ * @author jmesnil
+ *
+ * Created 26 nov. 2008 14:18:48
+ *
+ *
+ */
+public class HornetQServerControlTest extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private HornetQServer server;
+
+ private Configuration conf;
+
+ private TransportConfiguration connectorConfig;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testGetAttributes() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+
+ assertEquals(server.getVersion().getFullVersion(), serverControl.getVersion());
+
+ assertEquals(conf.isClustered(), serverControl.isClustered());
+ assertEquals(conf.isPersistDeliveryCountBeforeDelivery(),
serverControl.isPersistDeliveryCountBeforeDelivery());
+ assertEquals(conf.isBackup(), serverControl.isBackup());
+ assertEquals(conf.getQueueActivationTimeout(),
serverControl.getQueueActivationTimeout());
+ assertEquals(conf.getScheduledThreadPoolMaxSize(),
serverControl.getScheduledThreadPoolMaxSize());
+ assertEquals(conf.getThreadPoolMaxSize(), serverControl.getThreadPoolMaxSize());
+ assertEquals(conf.getSecurityInvalidationInterval(),
serverControl.getSecurityInvalidationInterval());
+ assertEquals(conf.isSecurityEnabled(), serverControl.isSecurityEnabled());
+ assertEquals(conf.getInterceptorClassNames().size(),
serverControl.getInterceptorClassNames().length);
+ assertEquals(conf.getConnectionTTLOverride(),
serverControl.getConnectionTTLOverride());
+ assertEquals(conf.getBackupConnectorName(),
serverControl.getBackupConnectorName());
+ assertEquals(conf.getManagementAddress().toString(),
serverControl.getManagementAddress());
+ assertEquals(conf.getManagementNotificationAddress().toString(),
serverControl.getManagementNotificationAddress());
+ assertEquals(conf.getManagementRequestTimeout(),
serverControl.getManagementRequestTimeout());
+ assertEquals(conf.getIDCacheSize(), serverControl.getIDCacheSize());
+ assertEquals(conf.isPersistIDCache(), serverControl.isPersistIDCache());
+ assertEquals(conf.getBindingsDirectory(), serverControl.getBindingsDirectory());
+ assertEquals(conf.getJournalDirectory(), serverControl.getJournalDirectory());
+ assertEquals(conf.getJournalType().toString(), serverControl.getJournalType());
+ assertEquals(conf.isJournalSyncTransactional(),
serverControl.isJournalSyncTransactional());
+ assertEquals(conf.isJournalSyncNonTransactional(),
serverControl.isJournalSyncNonTransactional());
+ assertEquals(conf.getJournalFileSize(), serverControl.getJournalFileSize());
+ assertEquals(conf.getJournalMinFiles(), serverControl.getJournalMinFiles());
+ assertEquals(conf.getJournalMaxAIO(), serverControl.getJournalMaxAIO());
+ assertEquals(conf.getAIOBufferSize(), serverControl.getAIOBufferSize());
+ assertEquals(conf.getAIOBufferTimeout(), serverControl.getAIOBufferTimeout());
+ assertEquals(conf.isCreateBindingsDir(), serverControl.isCreateBindingsDir());
+ assertEquals(conf.isCreateJournalDir(), serverControl.isCreateJournalDir());
+ assertEquals(conf.getPagingDirectory(), serverControl.getPagingDirectory());
+ assertEquals(conf.getLargeMessagesDirectory(),
serverControl.getLargeMessagesDirectory());
+ assertEquals(conf.isWildcardRoutingEnabled(),
serverControl.isWildcardRoutingEnabled());
+ assertEquals(conf.getTransactionTimeout(), serverControl.getTransactionTimeout());
+ assertEquals(conf.isMessageCounterEnabled(),
serverControl.isMessageCounterEnabled());
+ assertEquals(conf.getTransactionTimeoutScanPeriod(),
serverControl.getTransactionTimeoutScanPeriod());
+ assertEquals(conf.getMessageExpiryScanPeriod(),
serverControl.getMessageExpiryScanPeriod());
+ assertEquals(conf.getMessageExpiryThreadPriority(),
serverControl.getMessageExpiryThreadPriority());
+ }
+
+ public void testGetConnectors() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+
+ Object[] connectorData = serverControl.getConnectors();
+ assertNotNull(connectorData);
+ assertEquals(1, connectorData.length);
+
+ Object[] config = (Object[])connectorData[0];
+
+ assertEquals(connectorConfig.getName(), config[0]);
+ }
+
+ public void testGetConnectorsAsJSON() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+
+ String jsonString = serverControl.getConnectorsAsJSON();
+ assertNotNull(jsonString);
+ JSONArray array = new JSONArray(jsonString);
+ assertEquals(1, array.length());
+ JSONObject data = array.getJSONObject(0);
+ assertEquals(connectorConfig.getName(), data.optString("name"));
+ assertEquals(connectorConfig.getFactoryClassName(),
data.optString("factoryClassName"));
+ assertEquals(connectorConfig.getParams().size(),
data.getJSONObject("params").length());
+ }
+
+ public void testCreateAndDestroyQueue() throws Exception
+ {
+ SimpleString address = RandomUtil.randomSimpleString();
+ SimpleString name = RandomUtil.randomSimpleString();
+
+ HornetQServerControl serverControl = createManagementControl();
+
+ checkNoResource(ObjectNames.getQueueObjectName(address, name));
+
+ serverControl.createQueue(address.toString(), name.toString());
+
+ checkResource(ObjectNames.getQueueObjectName(address, name));
+ QueueControl queueControl = ManagementControlHelper.createQueueControl(address,
name, mbeanServer);
+ assertEquals(address.toString(), queueControl.getAddress());
+ assertEquals(name.toString(), queueControl.getName());
+ assertNull(queueControl.getFilter());
+ assertEquals(true, queueControl.isDurable());
+ assertEquals(false, queueControl.isTemporary());
+
+ serverControl.destroyQueue(name.toString());
+
+ checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ }
+
+ public void testCreateAndDestroyQueue_2() throws Exception
+ {
+ SimpleString address = RandomUtil.randomSimpleString();
+ SimpleString name = RandomUtil.randomSimpleString();
+ String filter = "color = 'green'";
+ boolean durable = true;
+
+ HornetQServerControl serverControl = createManagementControl();
+
+ checkNoResource(ObjectNames.getQueueObjectName(address, name));
+
+ serverControl.createQueue(address.toString(), name.toString(), filter, durable);
+
+ checkResource(ObjectNames.getQueueObjectName(address, name));
+ QueueControl queueControl = ManagementControlHelper.createQueueControl(address,
name, mbeanServer);
+ assertEquals(address.toString(), queueControl.getAddress());
+ assertEquals(name.toString(), queueControl.getName());
+ assertEquals(filter, queueControl.getFilter());
+ assertEquals(durable, queueControl.isDurable());
+ assertEquals(false, queueControl.isTemporary());
+
+ serverControl.destroyQueue(name.toString());
+
+ checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ }
+
+ public void testCreateAndDestroyQueueWithNullFilter() throws Exception
+ {
+ SimpleString address = RandomUtil.randomSimpleString();
+ SimpleString name = RandomUtil.randomSimpleString();
+ String filter = null;
+ boolean durable = true;
+
+ HornetQServerControl serverControl = createManagementControl();
+
+ checkNoResource(ObjectNames.getQueueObjectName(address, name));
+
+ serverControl.createQueue(address.toString(), name.toString(), filter, durable);
+
+ checkResource(ObjectNames.getQueueObjectName(address, name));
+ QueueControl queueControl = ManagementControlHelper.createQueueControl(address,
name, mbeanServer);
+ assertEquals(address.toString(), queueControl.getAddress());
+ assertEquals(name.toString(), queueControl.getName());
+ assertNull(queueControl.getFilter());
+ assertEquals(durable, queueControl.isDurable());
+ assertEquals(false, queueControl.isTemporary());
+
+ serverControl.destroyQueue(name.toString());
+
+ checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ }
+
+ public void testMessageCounterMaxDayCount() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+
+ assertEquals(MessageCounterManagerImpl.DEFAULT_MAX_DAY_COUNT,
serverControl.getMessageCounterMaxDayCount());
+
+ int newCount = 100;
+ serverControl.setMessageCounterMaxDayCount(newCount);
+
+ assertEquals(newCount, serverControl.getMessageCounterMaxDayCount());
+
+ try
+ {
+ serverControl.setMessageCounterMaxDayCount(-1);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+
+ try
+ {
+ serverControl.setMessageCounterMaxDayCount(0);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+
+ assertEquals(newCount, serverControl.getMessageCounterMaxDayCount());
+ }
+
+ public void testGetMessageCounterSamplePeriod() throws Exception
+ {
+ HornetQServerControl serverControl = createManagementControl();
+
+ assertEquals(MessageCounterManagerImpl.DEFAULT_SAMPLE_PERIOD,
serverControl.getMessageCounterSamplePeriod());
+
+ long newSample = 20000;
+ serverControl.setMessageCounterSamplePeriod(newSample);
+
+ assertEquals(newSample, serverControl.getMessageCounterSamplePeriod());
+
+ try
+ {
+ serverControl.setMessageCounterSamplePeriod(-1);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+
+ try
+ {
+ serverControl.setMessageCounterSamplePeriod(0);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+
+ try
+ {
+
serverControl.setMessageCounterSamplePeriod(MessageCounterManagerImpl.MIN_SAMPLE_PERIOD -
1);
+ fail();
+ }
+ catch (Exception e)
+ {
+ }
+
+ assertEquals(newSample, serverControl.getMessageCounterSamplePeriod());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put(randomString(), randomBoolean());
+ connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
+ params,
+
randomString());
+
+ conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getName()));
+
+ server = HornetQ.newMessagingServer(conf, mbeanServer, false);
+ conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
+ server.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ if (server != null)
+ {
+ server.stop();
+ }
+
+ server = null;
+
+ connectorConfig = null;
+
+ super.tearDown();
+ }
+
+ protected HornetQServerControl createManagementControl() throws Exception
+ {
+ return ManagementControlHelper.createMessagingServerControl(mbeanServer);
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Copied:
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
(from rev 7831,
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlUsingCoreTest.java)
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlUsingCoreTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,423 @@
+/*
+ * 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.integration.management;
+
+import org.hornetq.core.client.ClientSession;
+import org.hornetq.core.client.ClientSessionFactory;
+import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.management.HornetQServerControl;
+import org.hornetq.core.management.ResourceNames;
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+
+/**
+ * A HornetQServerControlUsingCoreTest
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ */
+public class HornetQServerControlUsingCoreTest extends HornetQServerControlTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // HornetQServerControlTest overrides --------------------------
+
+ private ClientSession session;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ ClientSessionFactory sf = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName()));
+ session = sf.createSession(false, true, true);
+ session.start();
+
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ session.close();
+
+ session = null;
+
+ super.tearDown();
+ }
+
+ @Override
+ protected HornetQServerControl createManagementControl() throws Exception
+ {
+
+ return new HornetQServerControl()
+ {
+ private final CoreMessagingProxy proxy = new CoreMessagingProxy(session,
+
ResourceNames.CORE_SERVER);
+
+ public boolean closeConnectionsForAddress(String ipAddress) throws Exception
+ {
+ return (Boolean)proxy.invokeOperation("closeConnectionsForAddress",
ipAddress);
+ }
+
+ public boolean commitPreparedTransaction(String transactionAsBase64) throws
Exception
+ {
+ return (Boolean)proxy.invokeOperation("commitPreparedTransaction",
transactionAsBase64);
+ }
+
+ public void createQueue(String address, String name) throws Exception
+ {
+ proxy.invokeOperation("createQueue", address, name);
+ }
+
+ public void createQueue(String address, String name, String filter, boolean
durable) throws Exception
+ {
+ proxy.invokeOperation("createQueue", address, name, filter,
durable);
+ }
+
+ public void deployQueue(String address, String name, String filter, boolean
durable) throws Exception
+ {
+ proxy.invokeOperation("deployQueue", address, name, filter,
durable);
+ }
+
+ public void deployQueue(String address, String name, String filterString) throws
Exception
+ {
+ proxy.invokeOperation("deployQueue", address, name);
+ }
+
+ public void destroyQueue(String name) throws Exception
+ {
+ proxy.invokeOperation("destroyQueue", name);
+ }
+
+ public void disableMessageCounters() throws Exception
+ {
+ proxy.invokeOperation("disableMessageCounters");
+ }
+
+ public void enableMessageCounters() throws Exception
+ {
+ proxy.invokeOperation("enableMessageCounters");
+ }
+
+ public String getBackupConnectorName()
+ {
+ return
(String)proxy.retrieveAttributeValue("backupConnectorName");
+ }
+
+ public String getBindingsDirectory()
+ {
+ return (String)proxy.retrieveAttributeValue("bindingsDirectory");
+ }
+
+ public Configuration getConfiguration()
+ {
+ return
(Configuration)proxy.retrieveAttributeValue("configuration");
+ }
+
+ public int getConnectionCount()
+ {
+ return (Integer)proxy.retrieveAttributeValue("connectionCount");
+ }
+
+ public long getConnectionTTLOverride()
+ {
+ return (Long)proxy.retrieveAttributeValue("connectionTTLOverride",
Long.class);
+ }
+
+ public Object[] getConnectors() throws Exception
+ {
+ return (Object[])proxy.retrieveAttributeValue("connectors");
+ }
+
+ public String getConnectorsAsJSON() throws Exception
+ {
+ return (String)proxy.retrieveAttributeValue("connectorsAsJSON");
+ }
+
+ public int getIDCacheSize()
+ {
+ return (Integer)proxy.retrieveAttributeValue("IDCacheSize");
+ }
+
+ public String[] getInterceptorClassNames()
+ {
+ Object[] res =
(Object[])proxy.retrieveAttributeValue("interceptorClassNames");
+ String[] names = new String[res.length];
+ for (int i = 0; i < res.length; i++)
+ {
+ names[i] = res[i].toString();
+ }
+ return names;
+ }
+
+ public String getJournalDirectory()
+ {
+ return (String)proxy.retrieveAttributeValue("journalDirectory");
+ }
+
+ public int getJournalFileSize()
+ {
+ return (Integer)proxy.retrieveAttributeValue("journalFileSize");
+ }
+
+ public int getJournalMaxAIO()
+ {
+ return (Integer)proxy.retrieveAttributeValue("journalMaxAIO");
+ }
+
+ public int getJournalMinFiles()
+ {
+ return (Integer)proxy.retrieveAttributeValue("journalMinFiles");
+ }
+
+ public String getJournalType()
+ {
+ return (String)proxy.retrieveAttributeValue("journalType");
+ }
+
+ public String getLargeMessagesDirectory()
+ {
+ return
(String)proxy.retrieveAttributeValue("largeMessagesDirectory");
+ }
+
+ public String getManagementAddress()
+ {
+ return (String)proxy.retrieveAttributeValue("managementAddress");
+ }
+
+ public String getManagementNotificationAddress()
+ {
+ return
(String)proxy.retrieveAttributeValue("managementNotificationAddress");
+ }
+
+ public long getManagementRequestTimeout()
+ {
+ return
(Long)proxy.retrieveAttributeValue("managementRequestTimeout", Long.class);
+ }
+
+ public int getMessageCounterMaxDayCount()
+ {
+ return
(Integer)proxy.retrieveAttributeValue("messageCounterMaxDayCount");
+ }
+
+ public long getMessageCounterSamplePeriod()
+ {
+ return
(Long)proxy.retrieveAttributeValue("messageCounterSamplePeriod", Long.class);
+ }
+
+ public long getMessageExpiryScanPeriod()
+ {
+ return
(Long)proxy.retrieveAttributeValue("messageExpiryScanPeriod", Long.class);
+ }
+
+ public long getMessageExpiryThreadPriority()
+ {
+ return
(Long)proxy.retrieveAttributeValue("messageExpiryThreadPriority", Long.class);
+ }
+
+ public String getPagingDirectory()
+ {
+ return (String)proxy.retrieveAttributeValue("pagingDirectory");
+ }
+
+ public int getGlobalPageSize()
+ {
+ return (Integer)proxy.retrieveAttributeValue("globalPageSize");
+ }
+
+ public long getPagingMaxGlobalSizeBytes()
+ {
+ return
(Long)proxy.retrieveAttributeValue("pagingMaxGlobalSizeBytes", Long.class);
+ }
+
+ public long getQueueActivationTimeout()
+ {
+ return (Long)proxy.retrieveAttributeValue("queueActivationTimeout",
Long.class);
+ }
+
+ public int getScheduledThreadPoolMaxSize()
+ {
+ return
(Integer)proxy.retrieveAttributeValue("scheduledThreadPoolMaxSize");
+ }
+
+ public int getThreadPoolMaxSize()
+ {
+ return (Integer)proxy.retrieveAttributeValue("threadPoolMaxSize");
+ }
+
+ public long getSecurityInvalidationInterval()
+ {
+ return
(Long)proxy.retrieveAttributeValue("securityInvalidationInterval", Long.class);
+ }
+
+ public long getTransactionTimeout()
+ {
+ return (Long)proxy.retrieveAttributeValue("transactionTimeout",
Long.class);
+ }
+
+ public long getTransactionTimeoutScanPeriod()
+ {
+ return
(Long)proxy.retrieveAttributeValue("transactionTimeoutScanPeriod", Long.class);
+ }
+
+ public String getVersion()
+ {
+ return (String)proxy.retrieveAttributeValue("version");
+ }
+
+ public boolean isBackup()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("backup");
+ }
+
+ public boolean isClustered()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("clustered");
+ }
+
+ public boolean isCreateBindingsDir()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("createBindingsDir");
+ }
+
+ public boolean isCreateJournalDir()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("createJournalDir");
+ }
+
+ public boolean isJournalSyncNonTransactional()
+ {
+ return
(Boolean)proxy.retrieveAttributeValue("journalSyncNonTransactional");
+ }
+
+ public boolean isJournalSyncTransactional()
+ {
+ return
(Boolean)proxy.retrieveAttributeValue("journalSyncTransactional");
+ }
+
+ public boolean isMessageCounterEnabled()
+ {
+ return
(Boolean)proxy.retrieveAttributeValue("messageCounterEnabled");
+ }
+
+ public boolean isPersistDeliveryCountBeforeDelivery()
+ {
+ return
(Boolean)proxy.retrieveAttributeValue("persistDeliveryCountBeforeDelivery");
+ }
+
+ public boolean isPersistIDCache()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("persistIDCache");
+ }
+
+ public boolean isSecurityEnabled()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("securityEnabled");
+ }
+
+ public boolean isStarted()
+ {
+ return (Boolean)proxy.retrieveAttributeValue("started");
+ }
+
+ public boolean isWildcardRoutingEnabled()
+ {
+ return
(Boolean)proxy.retrieveAttributeValue("wildcardRoutingEnabled");
+ }
+
+ public String[] listConnectionIDs() throws Exception
+ {
+ return (String[])proxy.invokeOperation("listConnectionIDs");
+ }
+
+ public String[] listPreparedTransactions() throws Exception
+ {
+ return
(String[])proxy.invokeOperation("listPreparedTransactions");
+ }
+
+ public String[] listRemoteAddresses() throws Exception
+ {
+ return (String[])proxy.invokeOperation("listRemoteAddresses");
+ }
+
+ public String[] listRemoteAddresses(String ipAddress) throws Exception
+ {
+ return (String[])proxy.invokeOperation("listRemoteAddresses",
ipAddress);
+ }
+
+ public String[] listSessions(String connectionID) throws Exception
+ {
+ return (String[])proxy.invokeOperation("listSessions",
connectionID);
+ }
+
+ public void resetAllMessageCounterHistories() throws Exception
+ {
+ proxy.invokeOperation("resetAllMessageCounterHistories");
+ }
+
+ public void resetAllMessageCounters() throws Exception
+ {
+ proxy.invokeOperation("resetAllMessageCounters");
+ }
+
+ public boolean rollbackPreparedTransaction(String transactionAsBase64) throws
Exception
+ {
+ return
(Boolean)proxy.invokeOperation("rollbackPreparedTransaction",
transactionAsBase64);
+ }
+
+ public void sendQueueInfoToQueue(String queueName, String address) throws
Exception
+ {
+ proxy.invokeOperation("sendQueueInfoToQueue", queueName, address);
+ }
+
+ public void setMessageCounterMaxDayCount(int count) throws Exception
+ {
+ proxy.invokeOperation("setMessageCounterMaxDayCount", count);
+ }
+
+ public void setMessageCounterSamplePeriod(long newPeriod) throws Exception
+ {
+ proxy.invokeOperation("setMessageCounterSamplePeriod", newPeriod);
+ }
+
+ public int getAIOBufferSize()
+ {
+ return (Integer)proxy.retrieveAttributeValue("AIOBufferSize");
+ }
+
+ public int getAIOBufferTimeout()
+ {
+ return (Integer)proxy.retrieveAttributeValue("AIOBufferTimeout");
+ }
+
+ };
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted:
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,335 +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.integration.management;
-
-import static org.hornetq.tests.util.RandomUtil.randomBoolean;
-import static org.hornetq.tests.util.RandomUtil.randomString;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.TransportConfiguration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ObjectNames;
-import org.hornetq.core.management.QueueControl;
-import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
-import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-import org.hornetq.core.server.HornetQ;
-import org.hornetq.core.server.HornetQServer;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.utils.SimpleString;
-import org.hornetq.utils.json.JSONArray;
-import org.hornetq.utils.json.JSONObject;
-
-/**
- * A QueueControlTest
- *
- * @author jmesnil
- *
- * Created 26 nov. 2008 14:18:48
- *
- *
- */
-public class MessagingServerControlTest extends ManagementTestBase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- private HornetQServer server;
-
- private Configuration conf;
-
- private TransportConfiguration connectorConfig;
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testGetAttributes() throws Exception
- {
- HornetQServerControl serverControl = createManagementControl();
-
- assertEquals(server.getVersion().getFullVersion(), serverControl.getVersion());
-
- assertEquals(conf.isClustered(), serverControl.isClustered());
- assertEquals(conf.isPersistDeliveryCountBeforeDelivery(),
serverControl.isPersistDeliveryCountBeforeDelivery());
- assertEquals(conf.isBackup(), serverControl.isBackup());
- assertEquals(conf.getQueueActivationTimeout(),
serverControl.getQueueActivationTimeout());
- assertEquals(conf.getScheduledThreadPoolMaxSize(),
serverControl.getScheduledThreadPoolMaxSize());
- assertEquals(conf.getThreadPoolMaxSize(), serverControl.getThreadPoolMaxSize());
- assertEquals(conf.getSecurityInvalidationInterval(),
serverControl.getSecurityInvalidationInterval());
- assertEquals(conf.isSecurityEnabled(), serverControl.isSecurityEnabled());
- assertEquals(conf.getInterceptorClassNames().size(),
serverControl.getInterceptorClassNames().length);
- assertEquals(conf.getConnectionTTLOverride(),
serverControl.getConnectionTTLOverride());
- assertEquals(conf.getBackupConnectorName(),
serverControl.getBackupConnectorName());
- assertEquals(conf.getManagementAddress().toString(),
serverControl.getManagementAddress());
- assertEquals(conf.getManagementNotificationAddress().toString(),
serverControl.getManagementNotificationAddress());
- assertEquals(conf.getManagementRequestTimeout(),
serverControl.getManagementRequestTimeout());
- assertEquals(conf.getIDCacheSize(), serverControl.getIDCacheSize());
- assertEquals(conf.isPersistIDCache(), serverControl.isPersistIDCache());
- assertEquals(conf.getBindingsDirectory(), serverControl.getBindingsDirectory());
- assertEquals(conf.getJournalDirectory(), serverControl.getJournalDirectory());
- assertEquals(conf.getJournalType().toString(), serverControl.getJournalType());
- assertEquals(conf.isJournalSyncTransactional(),
serverControl.isJournalSyncTransactional());
- assertEquals(conf.isJournalSyncNonTransactional(),
serverControl.isJournalSyncNonTransactional());
- assertEquals(conf.getJournalFileSize(), serverControl.getJournalFileSize());
- assertEquals(conf.getJournalMinFiles(), serverControl.getJournalMinFiles());
- assertEquals(conf.getJournalMaxAIO(), serverControl.getJournalMaxAIO());
- assertEquals(conf.getAIOBufferSize(), serverControl.getAIOBufferSize());
- assertEquals(conf.getAIOBufferTimeout(), serverControl.getAIOBufferTimeout());
- assertEquals(conf.isCreateBindingsDir(), serverControl.isCreateBindingsDir());
- assertEquals(conf.isCreateJournalDir(), serverControl.isCreateJournalDir());
- assertEquals(conf.getPagingDirectory(), serverControl.getPagingDirectory());
- assertEquals(conf.getLargeMessagesDirectory(),
serverControl.getLargeMessagesDirectory());
- assertEquals(conf.isWildcardRoutingEnabled(),
serverControl.isWildcardRoutingEnabled());
- assertEquals(conf.getTransactionTimeout(), serverControl.getTransactionTimeout());
- assertEquals(conf.isMessageCounterEnabled(),
serverControl.isMessageCounterEnabled());
- assertEquals(conf.getTransactionTimeoutScanPeriod(),
serverControl.getTransactionTimeoutScanPeriod());
- assertEquals(conf.getMessageExpiryScanPeriod(),
serverControl.getMessageExpiryScanPeriod());
- assertEquals(conf.getMessageExpiryThreadPriority(),
serverControl.getMessageExpiryThreadPriority());
- }
-
- public void testGetConnectors() throws Exception
- {
- HornetQServerControl serverControl = createManagementControl();
-
- Object[] connectorData = serverControl.getConnectors();
- assertNotNull(connectorData);
- assertEquals(1, connectorData.length);
-
- Object[] config = (Object[])connectorData[0];
-
- assertEquals(connectorConfig.getName(), config[0]);
- }
-
- public void testGetConnectorsAsJSON() throws Exception
- {
- HornetQServerControl serverControl = createManagementControl();
-
- String jsonString = serverControl.getConnectorsAsJSON();
- assertNotNull(jsonString);
- JSONArray array = new JSONArray(jsonString);
- assertEquals(1, array.length());
- JSONObject data = array.getJSONObject(0);
- assertEquals(connectorConfig.getName(), data.optString("name"));
- assertEquals(connectorConfig.getFactoryClassName(),
data.optString("factoryClassName"));
- assertEquals(connectorConfig.getParams().size(),
data.getJSONObject("params").length());
- }
-
- public void testCreateAndDestroyQueue() throws Exception
- {
- SimpleString address = RandomUtil.randomSimpleString();
- SimpleString name = RandomUtil.randomSimpleString();
-
- HornetQServerControl serverControl = createManagementControl();
-
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
-
- serverControl.createQueue(address.toString(), name.toString());
-
- checkResource(ObjectNames.getQueueObjectName(address, name));
- QueueControl queueControl = ManagementControlHelper.createQueueControl(address,
name, mbeanServer);
- assertEquals(address.toString(), queueControl.getAddress());
- assertEquals(name.toString(), queueControl.getName());
- assertNull(queueControl.getFilter());
- assertEquals(true, queueControl.isDurable());
- assertEquals(false, queueControl.isTemporary());
-
- serverControl.destroyQueue(name.toString());
-
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
- }
-
- public void testCreateAndDestroyQueue_2() throws Exception
- {
- SimpleString address = RandomUtil.randomSimpleString();
- SimpleString name = RandomUtil.randomSimpleString();
- String filter = "color = 'green'";
- boolean durable = true;
-
- HornetQServerControl serverControl = createManagementControl();
-
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
-
- serverControl.createQueue(address.toString(), name.toString(), filter, durable);
-
- checkResource(ObjectNames.getQueueObjectName(address, name));
- QueueControl queueControl = ManagementControlHelper.createQueueControl(address,
name, mbeanServer);
- assertEquals(address.toString(), queueControl.getAddress());
- assertEquals(name.toString(), queueControl.getName());
- assertEquals(filter, queueControl.getFilter());
- assertEquals(durable, queueControl.isDurable());
- assertEquals(false, queueControl.isTemporary());
-
- serverControl.destroyQueue(name.toString());
-
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
- }
-
- public void testCreateAndDestroyQueueWithNullFilter() throws Exception
- {
- SimpleString address = RandomUtil.randomSimpleString();
- SimpleString name = RandomUtil.randomSimpleString();
- String filter = null;
- boolean durable = true;
-
- HornetQServerControl serverControl = createManagementControl();
-
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
-
- serverControl.createQueue(address.toString(), name.toString(), filter, durable);
-
- checkResource(ObjectNames.getQueueObjectName(address, name));
- QueueControl queueControl = ManagementControlHelper.createQueueControl(address,
name, mbeanServer);
- assertEquals(address.toString(), queueControl.getAddress());
- assertEquals(name.toString(), queueControl.getName());
- assertNull(queueControl.getFilter());
- assertEquals(durable, queueControl.isDurable());
- assertEquals(false, queueControl.isTemporary());
-
- serverControl.destroyQueue(name.toString());
-
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
- }
-
- public void testMessageCounterMaxDayCount() throws Exception
- {
- HornetQServerControl serverControl = createManagementControl();
-
- assertEquals(MessageCounterManagerImpl.DEFAULT_MAX_DAY_COUNT,
serverControl.getMessageCounterMaxDayCount());
-
- int newCount = 100;
- serverControl.setMessageCounterMaxDayCount(newCount);
-
- assertEquals(newCount, serverControl.getMessageCounterMaxDayCount());
-
- try
- {
- serverControl.setMessageCounterMaxDayCount(-1);
- fail();
- }
- catch (Exception e)
- {
- }
-
- try
- {
- serverControl.setMessageCounterMaxDayCount(0);
- fail();
- }
- catch (Exception e)
- {
- }
-
- assertEquals(newCount, serverControl.getMessageCounterMaxDayCount());
- }
-
- public void testGetMessageCounterSamplePeriod() throws Exception
- {
- HornetQServerControl serverControl = createManagementControl();
-
- assertEquals(MessageCounterManagerImpl.DEFAULT_SAMPLE_PERIOD,
serverControl.getMessageCounterSamplePeriod());
-
- long newSample = 20000;
- serverControl.setMessageCounterSamplePeriod(newSample);
-
- assertEquals(newSample, serverControl.getMessageCounterSamplePeriod());
-
- try
- {
- serverControl.setMessageCounterSamplePeriod(-1);
- fail();
- }
- catch (Exception e)
- {
- }
-
- try
- {
- serverControl.setMessageCounterSamplePeriod(0);
- fail();
- }
- catch (Exception e)
- {
- }
-
- try
- {
-
serverControl.setMessageCounterSamplePeriod(MessageCounterManagerImpl.MIN_SAMPLE_PERIOD -
1);
- fail();
- }
- catch (Exception e)
- {
- }
-
- assertEquals(newSample, serverControl.getMessageCounterSamplePeriod());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- Map<String, Object> params = new HashMap<String, Object>();
- params.put(randomString(), randomBoolean());
- connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
- params,
-
randomString());
-
- conf = new ConfigurationImpl();
- conf.setSecurityEnabled(false);
- conf.setJMXManagementEnabled(true);
- conf.getAcceptorConfigurations().add(new
TransportConfiguration(InVMAcceptorFactory.class.getName()));
-
- server = HornetQ.newMessagingServer(conf, mbeanServer, false);
- conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
- server.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- if (server != null)
- {
- server.stop();
- }
-
- server = null;
-
- connectorConfig = null;
-
- super.tearDown();
- }
-
- protected HornetQServerControl createManagementControl() throws Exception
- {
- return ManagementControlHelper.createMessagingServerControl(mbeanServer);
- }
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Deleted:
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlUsingCoreTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlUsingCoreTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/integration/management/MessagingServerControlUsingCoreTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,423 +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.integration.management;
-
-import org.hornetq.core.client.ClientSession;
-import org.hornetq.core.client.ClientSessionFactory;
-import org.hornetq.core.client.impl.ClientSessionFactoryImpl;
-import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.TransportConfiguration;
-import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ResourceNames;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-
-/**
- * A MessagingServerControlUsingCoreTest
- *
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
- */
-public class MessagingServerControlUsingCoreTest extends MessagingServerControlTest
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // MessagingServerControlTest overrides --------------------------
-
- private ClientSession session;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- ClientSessionFactory sf = new ClientSessionFactoryImpl(new
TransportConfiguration(InVMConnectorFactory.class.getName()));
- session = sf.createSession(false, true, true);
- session.start();
-
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- session.close();
-
- session = null;
-
- super.tearDown();
- }
-
- @Override
- protected HornetQServerControl createManagementControl() throws Exception
- {
-
- return new HornetQServerControl()
- {
- private final CoreMessagingProxy proxy = new CoreMessagingProxy(session,
-
ResourceNames.CORE_SERVER);
-
- public boolean closeConnectionsForAddress(String ipAddress) throws Exception
- {
- return (Boolean)proxy.invokeOperation("closeConnectionsForAddress",
ipAddress);
- }
-
- public boolean commitPreparedTransaction(String transactionAsBase64) throws
Exception
- {
- return (Boolean)proxy.invokeOperation("commitPreparedTransaction",
transactionAsBase64);
- }
-
- public void createQueue(String address, String name) throws Exception
- {
- proxy.invokeOperation("createQueue", address, name);
- }
-
- public void createQueue(String address, String name, String filter, boolean
durable) throws Exception
- {
- proxy.invokeOperation("createQueue", address, name, filter,
durable);
- }
-
- public void deployQueue(String address, String name, String filter, boolean
durable) throws Exception
- {
- proxy.invokeOperation("deployQueue", address, name, filter,
durable);
- }
-
- public void deployQueue(String address, String name, String filterString) throws
Exception
- {
- proxy.invokeOperation("deployQueue", address, name);
- }
-
- public void destroyQueue(String name) throws Exception
- {
- proxy.invokeOperation("destroyQueue", name);
- }
-
- public void disableMessageCounters() throws Exception
- {
- proxy.invokeOperation("disableMessageCounters");
- }
-
- public void enableMessageCounters() throws Exception
- {
- proxy.invokeOperation("enableMessageCounters");
- }
-
- public String getBackupConnectorName()
- {
- return
(String)proxy.retrieveAttributeValue("backupConnectorName");
- }
-
- public String getBindingsDirectory()
- {
- return (String)proxy.retrieveAttributeValue("bindingsDirectory");
- }
-
- public Configuration getConfiguration()
- {
- return
(Configuration)proxy.retrieveAttributeValue("configuration");
- }
-
- public int getConnectionCount()
- {
- return (Integer)proxy.retrieveAttributeValue("connectionCount");
- }
-
- public long getConnectionTTLOverride()
- {
- return (Long)proxy.retrieveAttributeValue("connectionTTLOverride",
Long.class);
- }
-
- public Object[] getConnectors() throws Exception
- {
- return (Object[])proxy.retrieveAttributeValue("connectors");
- }
-
- public String getConnectorsAsJSON() throws Exception
- {
- return (String)proxy.retrieveAttributeValue("connectorsAsJSON");
- }
-
- public int getIDCacheSize()
- {
- return (Integer)proxy.retrieveAttributeValue("IDCacheSize");
- }
-
- public String[] getInterceptorClassNames()
- {
- Object[] res =
(Object[])proxy.retrieveAttributeValue("interceptorClassNames");
- String[] names = new String[res.length];
- for (int i = 0; i < res.length; i++)
- {
- names[i] = res[i].toString();
- }
- return names;
- }
-
- public String getJournalDirectory()
- {
- return (String)proxy.retrieveAttributeValue("journalDirectory");
- }
-
- public int getJournalFileSize()
- {
- return (Integer)proxy.retrieveAttributeValue("journalFileSize");
- }
-
- public int getJournalMaxAIO()
- {
- return (Integer)proxy.retrieveAttributeValue("journalMaxAIO");
- }
-
- public int getJournalMinFiles()
- {
- return (Integer)proxy.retrieveAttributeValue("journalMinFiles");
- }
-
- public String getJournalType()
- {
- return (String)proxy.retrieveAttributeValue("journalType");
- }
-
- public String getLargeMessagesDirectory()
- {
- return
(String)proxy.retrieveAttributeValue("largeMessagesDirectory");
- }
-
- public String getManagementAddress()
- {
- return (String)proxy.retrieveAttributeValue("managementAddress");
- }
-
- public String getManagementNotificationAddress()
- {
- return
(String)proxy.retrieveAttributeValue("managementNotificationAddress");
- }
-
- public long getManagementRequestTimeout()
- {
- return
(Long)proxy.retrieveAttributeValue("managementRequestTimeout", Long.class);
- }
-
- public int getMessageCounterMaxDayCount()
- {
- return
(Integer)proxy.retrieveAttributeValue("messageCounterMaxDayCount");
- }
-
- public long getMessageCounterSamplePeriod()
- {
- return
(Long)proxy.retrieveAttributeValue("messageCounterSamplePeriod", Long.class);
- }
-
- public long getMessageExpiryScanPeriod()
- {
- return
(Long)proxy.retrieveAttributeValue("messageExpiryScanPeriod", Long.class);
- }
-
- public long getMessageExpiryThreadPriority()
- {
- return
(Long)proxy.retrieveAttributeValue("messageExpiryThreadPriority", Long.class);
- }
-
- public String getPagingDirectory()
- {
- return (String)proxy.retrieveAttributeValue("pagingDirectory");
- }
-
- public int getGlobalPageSize()
- {
- return (Integer)proxy.retrieveAttributeValue("globalPageSize");
- }
-
- public long getPagingMaxGlobalSizeBytes()
- {
- return
(Long)proxy.retrieveAttributeValue("pagingMaxGlobalSizeBytes", Long.class);
- }
-
- public long getQueueActivationTimeout()
- {
- return (Long)proxy.retrieveAttributeValue("queueActivationTimeout",
Long.class);
- }
-
- public int getScheduledThreadPoolMaxSize()
- {
- return
(Integer)proxy.retrieveAttributeValue("scheduledThreadPoolMaxSize");
- }
-
- public int getThreadPoolMaxSize()
- {
- return (Integer)proxy.retrieveAttributeValue("threadPoolMaxSize");
- }
-
- public long getSecurityInvalidationInterval()
- {
- return
(Long)proxy.retrieveAttributeValue("securityInvalidationInterval", Long.class);
- }
-
- public long getTransactionTimeout()
- {
- return (Long)proxy.retrieveAttributeValue("transactionTimeout",
Long.class);
- }
-
- public long getTransactionTimeoutScanPeriod()
- {
- return
(Long)proxy.retrieveAttributeValue("transactionTimeoutScanPeriod", Long.class);
- }
-
- public String getVersion()
- {
- return (String)proxy.retrieveAttributeValue("version");
- }
-
- public boolean isBackup()
- {
- return (Boolean)proxy.retrieveAttributeValue("backup");
- }
-
- public boolean isClustered()
- {
- return (Boolean)proxy.retrieveAttributeValue("clustered");
- }
-
- public boolean isCreateBindingsDir()
- {
- return (Boolean)proxy.retrieveAttributeValue("createBindingsDir");
- }
-
- public boolean isCreateJournalDir()
- {
- return (Boolean)proxy.retrieveAttributeValue("createJournalDir");
- }
-
- public boolean isJournalSyncNonTransactional()
- {
- return
(Boolean)proxy.retrieveAttributeValue("journalSyncNonTransactional");
- }
-
- public boolean isJournalSyncTransactional()
- {
- return
(Boolean)proxy.retrieveAttributeValue("journalSyncTransactional");
- }
-
- public boolean isMessageCounterEnabled()
- {
- return
(Boolean)proxy.retrieveAttributeValue("messageCounterEnabled");
- }
-
- public boolean isPersistDeliveryCountBeforeDelivery()
- {
- return
(Boolean)proxy.retrieveAttributeValue("persistDeliveryCountBeforeDelivery");
- }
-
- public boolean isPersistIDCache()
- {
- return (Boolean)proxy.retrieveAttributeValue("persistIDCache");
- }
-
- public boolean isSecurityEnabled()
- {
- return (Boolean)proxy.retrieveAttributeValue("securityEnabled");
- }
-
- public boolean isStarted()
- {
- return (Boolean)proxy.retrieveAttributeValue("started");
- }
-
- public boolean isWildcardRoutingEnabled()
- {
- return
(Boolean)proxy.retrieveAttributeValue("wildcardRoutingEnabled");
- }
-
- public String[] listConnectionIDs() throws Exception
- {
- return (String[])proxy.invokeOperation("listConnectionIDs");
- }
-
- public String[] listPreparedTransactions() throws Exception
- {
- return
(String[])proxy.invokeOperation("listPreparedTransactions");
- }
-
- public String[] listRemoteAddresses() throws Exception
- {
- return (String[])proxy.invokeOperation("listRemoteAddresses");
- }
-
- public String[] listRemoteAddresses(String ipAddress) throws Exception
- {
- return (String[])proxy.invokeOperation("listRemoteAddresses",
ipAddress);
- }
-
- public String[] listSessions(String connectionID) throws Exception
- {
- return (String[])proxy.invokeOperation("listSessions",
connectionID);
- }
-
- public void resetAllMessageCounterHistories() throws Exception
- {
- proxy.invokeOperation("resetAllMessageCounterHistories");
- }
-
- public void resetAllMessageCounters() throws Exception
- {
- proxy.invokeOperation("resetAllMessageCounters");
- }
-
- public boolean rollbackPreparedTransaction(String transactionAsBase64) throws
Exception
- {
- return
(Boolean)proxy.invokeOperation("rollbackPreparedTransaction",
transactionAsBase64);
- }
-
- public void sendQueueInfoToQueue(String queueName, String address) throws
Exception
- {
- proxy.invokeOperation("sendQueueInfoToQueue", queueName, address);
- }
-
- public void setMessageCounterMaxDayCount(int count) throws Exception
- {
- proxy.invokeOperation("setMessageCounterMaxDayCount", count);
- }
-
- public void setMessageCounterSamplePeriod(long newPeriod) throws Exception
- {
- proxy.invokeOperation("setMessageCounterSamplePeriod", newPeriod);
- }
-
- public int getAIOBufferSize()
- {
- return (Integer)proxy.retrieveAttributeValue("AIOBufferSize");
- }
-
- public int getAIOBufferTimeout()
- {
- return (Integer)proxy.retrieveAttributeValue("AIOBufferTimeout");
- }
-
- };
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified: trunk/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++ trunk/tests/src/org/hornetq/tests/integration/paging/PageCrashTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -212,7 +212,7 @@
{
HornetQSecurityManager securityManager = new HornetQSecurityManagerImpl();
- HornetQServer server = new FailingMessagingServerImpl(configuration,
securityManager);
+ HornetQServer server = new FailingHornetQServer(configuration, securityManager);
AddressSettings defaultSetting = new AddressSettings();
defaultSetting.setPageSizeBytes(10 * 1024);
@@ -228,9 +228,9 @@
/** This is hacking HornetQServerImpl,
* to make sure the server will fail right
* before the page-file was removed */
- class FailingMessagingServerImpl extends HornetQServerImpl
+ class FailingHornetQServer extends HornetQServerImpl
{
- FailingMessagingServerImpl(final Configuration config, final HornetQSecurityManager
securityManager)
+ FailingHornetQServer(final Configuration config, final HornetQSecurityManager
securityManager)
{
super(config, ManagementFactory.getPlatformMBeanServer(), securityManager);
}
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/core/paging/impl/PagingStoreImplTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1074,7 +1074,7 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.MessagingComponent#isStarted()
+ * @see org.hornetq.core.server.HornetQComponent#isStarted()
*/
public boolean isStarted()
{
@@ -1082,7 +1082,7 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.MessagingComponent#start()
+ * @see org.hornetq.core.server.HornetQComponent#start()
*/
public void start() throws Exception
{
@@ -1090,7 +1090,7 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.MessagingComponent#stop()
+ * @see org.hornetq.core.server.HornetQComponent#stop()
*/
public void stop() throws Exception
{
Copied: trunk/tests/src/org/hornetq/tests/unit/core/remoting/HornetQBufferTestBase.java
(from rev 7831,
trunk/tests/src/org/hornetq/tests/unit/core/remoting/MessagingBufferTestBase.java)
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/remoting/HornetQBufferTestBase.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/unit/core/remoting/HornetQBufferTestBase.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,336 @@
+/*
+ * 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.remoting;
+
+import static org.hornetq.tests.util.RandomUtil.randomByte;
+import static org.hornetq.tests.util.RandomUtil.randomBytes;
+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.randomLong;
+import static org.hornetq.tests.util.RandomUtil.randomString;
+
+import org.hornetq.core.remoting.spi.HornetQBuffer;
+import org.hornetq.tests.util.RandomUtil;
+import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.utils.SimpleString;
+
+/**
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
+ *
+ * @version <tt>$Revision$</tt>
+ */
+public abstract class HornetQBufferTestBase extends UnitTestCase
+{
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ private HornetQBuffer wrapper;
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ wrapper = createBuffer();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ wrapper = null;
+
+ super.tearDown();
+ }
+
+ protected abstract HornetQBuffer createBuffer();
+
+ public void testNullString() throws Exception
+ {
+ assertNull(putAndGetNullableString(null));
+ }
+
+ public void testEmptyString() throws Exception
+ {
+ String result = putAndGetNullableString("");
+
+ assertNotNull(result);
+ assertEquals("", result);
+ }
+
+ public void testNonEmptyString() throws Exception
+ {
+ String junk = randomString();
+
+ String result = putAndGetNullableString(junk);
+
+ assertNotNull(result);
+ assertEquals(junk, result);
+ }
+
+ public void testNullSimpleString() throws Exception
+ {
+ assertNull(putAndGetNullableSimpleString(null));
+ }
+
+ public void testEmptySimpleString() throws Exception
+ {
+ SimpleString emptySimpleString = new SimpleString("");
+ SimpleString result = putAndGetNullableSimpleString(emptySimpleString);
+
+ assertNotNull(result);
+ assertEqualsByteArrays(emptySimpleString.getData(), result.getData());
+ }
+
+ public void testNonEmptySimpleString() throws Exception
+ {
+ SimpleString junk = RandomUtil.randomSimpleString();
+ SimpleString result = putAndGetNullableSimpleString(junk);
+
+ assertNotNull(result);
+ assertEqualsByteArrays(junk.getData(), result.getData());
+ }
+
+ public void testByte() throws Exception
+ {
+ byte b = randomByte();
+ wrapper.writeByte(b);
+
+ assertEquals(b, wrapper.readByte());
+ }
+
+ public void testUnsignedByte() throws Exception
+ {
+ byte b = (byte) 0xff;
+ wrapper.writeByte(b);
+
+ assertEquals(255, wrapper.readUnsignedByte());
+
+ b = (byte) 0xf;
+ wrapper.writeByte(b);
+
+ assertEquals(b, wrapper.readUnsignedByte());
+ }
+
+
+
+ public void testBytes() throws Exception
+ {
+ byte[] bytes = randomBytes();
+ wrapper.writeBytes(bytes);
+
+ byte[] b = new byte[bytes.length];
+ wrapper.readBytes(b);
+ assertEqualsByteArrays(bytes, b);
+ }
+
+ public void testBytesWithLength() throws Exception
+ {
+ byte[] bytes = randomBytes();
+ // put only half of the bytes
+ wrapper.writeBytes(bytes, 0, bytes.length / 2);
+
+ byte[] b = new byte[bytes.length / 2];
+ wrapper.readBytes(b, 0, b.length);
+ assertEqualsByteArrays(b.length, bytes, b);
+ }
+
+ public void testPutTrueBoolean() throws Exception
+ {
+ wrapper.writeBoolean(true);
+
+ assertTrue(wrapper.readBoolean());
+ }
+
+ public void testPutFalseBoolean() throws Exception
+ {
+ wrapper.writeBoolean(false);
+
+ assertFalse(wrapper.readBoolean());
+ }
+
+ public void testChar() throws Exception
+ {
+ wrapper.writeChar('a');
+
+ assertEquals('a', wrapper.readChar());
+ }
+
+ public void testInt() throws Exception
+ {
+ int i = randomInt();
+ wrapper.writeInt(i);
+
+ assertEquals(i, wrapper.readInt());
+ }
+
+ public void testIntAtPosition() throws Exception
+ {
+ int firstInt = randomInt();
+ int secondInt = randomInt();
+
+ wrapper.writeInt(secondInt);
+ wrapper.writeInt(secondInt);
+ // rewrite firstInt at the beginning
+ wrapper.setInt(0, firstInt);
+
+ assertEquals(firstInt, wrapper.readInt());
+ assertEquals(secondInt, wrapper.readInt());
+ }
+
+ public void testLong() throws Exception
+ {
+ long l = randomLong();
+ wrapper.writeLong(l);
+
+ assertEquals(l, wrapper.readLong());
+ }
+
+ public void testUnsignedShort() throws Exception
+ {
+ short s1 = Short.MAX_VALUE;
+
+ wrapper.writeShort(s1);
+
+ int s2 = wrapper.readUnsignedShort();
+
+ assertEquals(s1, s2);
+
+ s1 = Short.MIN_VALUE;
+
+ wrapper.writeShort(s1);
+
+ s2 = wrapper.readUnsignedShort();
+
+ assertEquals(s1 * -1, s2);
+
+ s1 = -1;
+
+ wrapper.writeShort(s1);
+
+ s2 = wrapper.readUnsignedShort();
+
+ // / The max of an unsigned short
+ // (
http://en.wikipedia.org/wiki/Unsigned_short)
+ assertEquals(s2, 65535);
+ }
+
+ public void testShort() throws Exception
+ {
+ wrapper.writeShort((short) 1);
+
+ assertEquals((short)1, wrapper.readShort());
+ }
+
+ public void testDouble() throws Exception
+ {
+ double d = randomDouble();
+ wrapper.writeDouble(d);
+
+ assertEquals(d, wrapper.readDouble());
+ }
+
+ public void testFloat() throws Exception
+ {
+ float f = randomFloat();
+ wrapper.writeFloat(f);
+
+ assertEquals(f, wrapper.readFloat());
+ }
+
+ public void testUTF() throws Exception
+ {
+ String str = randomString();
+ wrapper.writeUTF(str);
+
+ assertEquals(str, wrapper.readUTF());
+ }
+
+ public void testArray() throws Exception
+ {
+ byte[] bytes = randomBytes(128);
+ wrapper.writeBytes(bytes);
+
+ byte[] array = wrapper.array();
+ assertEquals(wrapper.capacity(), array.length);
+ assertEqualsByteArrays(128, bytes, wrapper.array());
+ }
+
+ public void testRewind() throws Exception
+ {
+ int i = randomInt();
+ wrapper.writeInt(i);
+
+ assertEquals(i, wrapper.readInt());
+
+ wrapper.resetReaderIndex();
+
+ assertEquals(i, wrapper.readInt());
+ }
+
+ public void testRemaining() throws Exception
+ {
+ int capacity = wrapper.capacity();
+
+ // fill 1/3 of the buffer
+ int fill = capacity / 3;
+ byte[] bytes = randomBytes(fill);
+ wrapper.writeBytes(bytes);
+
+ // check the remaining is 2/3
+ assertEquals(capacity - fill, wrapper.writableBytes());
+ }
+
+ public void testPosition() throws Exception
+ {
+ assertEquals(0, wrapper.writerIndex());
+
+ byte[] bytes = randomBytes(128);
+ wrapper.writeBytes(bytes);
+
+ assertEquals(bytes.length, wrapper.writerIndex());
+
+ wrapper.writerIndex(0);
+ assertEquals(0, wrapper.writerIndex());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private String putAndGetNullableString(String nullableString) throws Exception
+ {
+ wrapper.writeNullableString(nullableString);
+
+ return wrapper.readNullableString();
+ }
+
+ private SimpleString putAndGetNullableSimpleString(SimpleString nullableSimpleString)
throws Exception
+ {
+ wrapper.writeNullableSimpleString(nullableSimpleString);
+
+ return wrapper.readNullableSimpleString();
+ }
+
+ // Inner classes -------------------------------------------------
+}
Deleted:
trunk/tests/src/org/hornetq/tests/unit/core/remoting/MessagingBufferTestBase.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/remoting/MessagingBufferTestBase.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/core/remoting/MessagingBufferTestBase.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,336 +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.remoting;
-
-import static org.hornetq.tests.util.RandomUtil.randomByte;
-import static org.hornetq.tests.util.RandomUtil.randomBytes;
-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.randomLong;
-import static org.hornetq.tests.util.RandomUtil.randomString;
-
-import org.hornetq.core.remoting.spi.HornetQBuffer;
-import org.hornetq.tests.util.RandomUtil;
-import org.hornetq.tests.util.UnitTestCase;
-import org.hornetq.utils.SimpleString;
-
-/**
- * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>.
- *
- * @version <tt>$Revision$</tt>
- */
-public abstract class MessagingBufferTestBase extends UnitTestCase
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- private HornetQBuffer wrapper;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- wrapper = createBuffer();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- wrapper = null;
-
- super.tearDown();
- }
-
- protected abstract HornetQBuffer createBuffer();
-
- public void testNullString() throws Exception
- {
- assertNull(putAndGetNullableString(null));
- }
-
- public void testEmptyString() throws Exception
- {
- String result = putAndGetNullableString("");
-
- assertNotNull(result);
- assertEquals("", result);
- }
-
- public void testNonEmptyString() throws Exception
- {
- String junk = randomString();
-
- String result = putAndGetNullableString(junk);
-
- assertNotNull(result);
- assertEquals(junk, result);
- }
-
- public void testNullSimpleString() throws Exception
- {
- assertNull(putAndGetNullableSimpleString(null));
- }
-
- public void testEmptySimpleString() throws Exception
- {
- SimpleString emptySimpleString = new SimpleString("");
- SimpleString result = putAndGetNullableSimpleString(emptySimpleString);
-
- assertNotNull(result);
- assertEqualsByteArrays(emptySimpleString.getData(), result.getData());
- }
-
- public void testNonEmptySimpleString() throws Exception
- {
- SimpleString junk = RandomUtil.randomSimpleString();
- SimpleString result = putAndGetNullableSimpleString(junk);
-
- assertNotNull(result);
- assertEqualsByteArrays(junk.getData(), result.getData());
- }
-
- public void testByte() throws Exception
- {
- byte b = randomByte();
- wrapper.writeByte(b);
-
- assertEquals(b, wrapper.readByte());
- }
-
- public void testUnsignedByte() throws Exception
- {
- byte b = (byte) 0xff;
- wrapper.writeByte(b);
-
- assertEquals(255, wrapper.readUnsignedByte());
-
- b = (byte) 0xf;
- wrapper.writeByte(b);
-
- assertEquals(b, wrapper.readUnsignedByte());
- }
-
-
-
- public void testBytes() throws Exception
- {
- byte[] bytes = randomBytes();
- wrapper.writeBytes(bytes);
-
- byte[] b = new byte[bytes.length];
- wrapper.readBytes(b);
- assertEqualsByteArrays(bytes, b);
- }
-
- public void testBytesWithLength() throws Exception
- {
- byte[] bytes = randomBytes();
- // put only half of the bytes
- wrapper.writeBytes(bytes, 0, bytes.length / 2);
-
- byte[] b = new byte[bytes.length / 2];
- wrapper.readBytes(b, 0, b.length);
- assertEqualsByteArrays(b.length, bytes, b);
- }
-
- public void testPutTrueBoolean() throws Exception
- {
- wrapper.writeBoolean(true);
-
- assertTrue(wrapper.readBoolean());
- }
-
- public void testPutFalseBoolean() throws Exception
- {
- wrapper.writeBoolean(false);
-
- assertFalse(wrapper.readBoolean());
- }
-
- public void testChar() throws Exception
- {
- wrapper.writeChar('a');
-
- assertEquals('a', wrapper.readChar());
- }
-
- public void testInt() throws Exception
- {
- int i = randomInt();
- wrapper.writeInt(i);
-
- assertEquals(i, wrapper.readInt());
- }
-
- public void testIntAtPosition() throws Exception
- {
- int firstInt = randomInt();
- int secondInt = randomInt();
-
- wrapper.writeInt(secondInt);
- wrapper.writeInt(secondInt);
- // rewrite firstInt at the beginning
- wrapper.setInt(0, firstInt);
-
- assertEquals(firstInt, wrapper.readInt());
- assertEquals(secondInt, wrapper.readInt());
- }
-
- public void testLong() throws Exception
- {
- long l = randomLong();
- wrapper.writeLong(l);
-
- assertEquals(l, wrapper.readLong());
- }
-
- public void testUnsignedShort() throws Exception
- {
- short s1 = Short.MAX_VALUE;
-
- wrapper.writeShort(s1);
-
- int s2 = wrapper.readUnsignedShort();
-
- assertEquals(s1, s2);
-
- s1 = Short.MIN_VALUE;
-
- wrapper.writeShort(s1);
-
- s2 = wrapper.readUnsignedShort();
-
- assertEquals(s1 * -1, s2);
-
- s1 = -1;
-
- wrapper.writeShort(s1);
-
- s2 = wrapper.readUnsignedShort();
-
- // / The max of an unsigned short
- // (
http://en.wikipedia.org/wiki/Unsigned_short)
- assertEquals(s2, 65535);
- }
-
- public void testShort() throws Exception
- {
- wrapper.writeShort((short) 1);
-
- assertEquals((short)1, wrapper.readShort());
- }
-
- public void testDouble() throws Exception
- {
- double d = randomDouble();
- wrapper.writeDouble(d);
-
- assertEquals(d, wrapper.readDouble());
- }
-
- public void testFloat() throws Exception
- {
- float f = randomFloat();
- wrapper.writeFloat(f);
-
- assertEquals(f, wrapper.readFloat());
- }
-
- public void testUTF() throws Exception
- {
- String str = randomString();
- wrapper.writeUTF(str);
-
- assertEquals(str, wrapper.readUTF());
- }
-
- public void testArray() throws Exception
- {
- byte[] bytes = randomBytes(128);
- wrapper.writeBytes(bytes);
-
- byte[] array = wrapper.array();
- assertEquals(wrapper.capacity(), array.length);
- assertEqualsByteArrays(128, bytes, wrapper.array());
- }
-
- public void testRewind() throws Exception
- {
- int i = randomInt();
- wrapper.writeInt(i);
-
- assertEquals(i, wrapper.readInt());
-
- wrapper.resetReaderIndex();
-
- assertEquals(i, wrapper.readInt());
- }
-
- public void testRemaining() throws Exception
- {
- int capacity = wrapper.capacity();
-
- // fill 1/3 of the buffer
- int fill = capacity / 3;
- byte[] bytes = randomBytes(fill);
- wrapper.writeBytes(bytes);
-
- // check the remaining is 2/3
- assertEquals(capacity - fill, wrapper.writableBytes());
- }
-
- public void testPosition() throws Exception
- {
- assertEquals(0, wrapper.writerIndex());
-
- byte[] bytes = randomBytes(128);
- wrapper.writeBytes(bytes);
-
- assertEquals(bytes.length, wrapper.writerIndex());
-
- wrapper.writerIndex(0);
- assertEquals(0, wrapper.writerIndex());
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private String putAndGetNullableString(String nullableString) throws Exception
- {
- wrapper.writeNullableString(nullableString);
-
- return wrapper.readNullableString();
- }
-
- private SimpleString putAndGetNullableSimpleString(SimpleString nullableSimpleString)
throws Exception
- {
- wrapper.writeNullableSimpleString(nullableSimpleString);
-
- return wrapper.readNullableSimpleString();
- }
-
- // Inner classes -------------------------------------------------
-}
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/ByteBufferWrapperTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/ByteBufferWrapperTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/ByteBufferWrapperTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -17,7 +17,7 @@
import org.hornetq.core.buffers.ChannelBuffers;
import org.hornetq.core.remoting.spi.HornetQBuffer;
-import org.hornetq.tests.unit.core.remoting.MessagingBufferTestBase;
+import org.hornetq.tests.unit.core.remoting.HornetQBufferTestBase;
/**
* @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
@@ -25,7 +25,7 @@
* @version <tt>$Revision$</tt>
*
*/
-public class ByteBufferWrapperTest extends MessagingBufferTestBase
+public class ByteBufferWrapperTest extends HornetQBufferTestBase
{
// Constants -----------------------------------------------------
@@ -38,7 +38,7 @@
// Public --------------------------------------------------------
- // MessagingBufferTestBase overrides -----------------------------
+ // HornetQBufferTestBase overrides -----------------------------
@Override
protected HornetQBuffer createBuffer()
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapper2Test.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -15,7 +15,7 @@
import org.hornetq.core.buffers.ChannelBuffers;
import org.hornetq.core.remoting.spi.HornetQBuffer;
-import org.hornetq.tests.unit.core.remoting.MessagingBufferTestBase;
+import org.hornetq.tests.unit.core.remoting.HornetQBufferTestBase;
/**
* Same as ChannelBufferWrapperTest, but using a different constructor
@@ -25,7 +25,7 @@
* @version <tt>$Revision$</tt>
*
*/
-public class ChannelBufferWrapper2Test extends MessagingBufferTestBase
+public class ChannelBufferWrapper2Test extends HornetQBufferTestBase
{
// Constants -----------------------------------------------------
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/core/remoting/impl/netty/ChannelBufferWrapperTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -15,7 +15,7 @@
import org.hornetq.core.remoting.spi.HornetQBuffer;
import org.hornetq.integration.transports.netty.ChannelBufferWrapper;
-import org.hornetq.tests.unit.core.remoting.MessagingBufferTestBase;
+import org.hornetq.tests.unit.core.remoting.HornetQBufferTestBase;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.buffer.ChannelBuffers;
@@ -25,7 +25,7 @@
* @version <tt>$Revision$</tt>
*
*/
-public class ChannelBufferWrapperTest extends MessagingBufferTestBase
+public class ChannelBufferWrapperTest extends HornetQBufferTestBase
{
// Constants -----------------------------------------------------
Modified:
trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/core/server/impl/fakes/FakePostOffice.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -127,7 +127,7 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.MessagingComponent#isStarted()
+ * @see org.hornetq.core.server.HornetQComponent#isStarted()
*/
public boolean isStarted()
{
@@ -135,7 +135,7 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.MessagingComponent#start()
+ * @see org.hornetq.core.server.HornetQComponent#start()
*/
public void start() throws Exception
{
@@ -143,7 +143,7 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.MessagingComponent#stop()
+ * @see org.hornetq.core.server.HornetQComponent#stop()
*/
public void stop() throws Exception
{
Copied:
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/HornetQXAResourceRecoveryTest.java
(from rev 7829,
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/MessagingXAResourceRecoveryTest.java)
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/HornetQXAResourceRecoveryTest.java
(rev 0)
+++
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/HornetQXAResourceRecoveryTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -0,0 +1,122 @@
+/*
+ * 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.jms.server.recovery;
+
+import junit.framework.TestCase;
+
+import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
+import org.hornetq.core.remoting.impl.invm.TransportConstants;
+import org.hornetq.jms.server.recovery.HornetQXAResourceRecovery;
+
+/**
+ * A HornetQXAResourceRecoveryTest
+ *
+ * @author jmesnil
+ *
+ *
+ */
+public class HornetQXAResourceRecoveryTest extends TestCase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testConfigWithOnlyConnectorFactoryClassName() throws Exception
+ {
+ String config =
"org.hornetq.core.remoting.impl.invm.InVMConnectorFactory";
+ HornetQXAResourceRecovery.ConfigParser parser = new
HornetQXAResourceRecovery.ConfigParser(config);
+
+ assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
+ assertEquals(0, parser.getConnectorParameters().size());
+ assertNull(parser.getUsername());
+ assertNull(parser.getPassword());
+ }
+
+ public void testConfigWithConnectorFactoryClassNameAndParamsWithoutUserCredentials()
throws Exception
+ {
+ String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory, , ,
hornetq.remoting.invm.serverid=99";
+ HornetQXAResourceRecovery.ConfigParser parser = new
HornetQXAResourceRecovery.ConfigParser(config);
+
+ assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
+ assertEquals(1, parser.getConnectorParameters().size());
+ assertEquals("99",
parser.getConnectorParameters().get(TransportConstants.SERVER_ID_PROP_NAME));
+ assertNull(parser.getUsername());
+ assertNull(parser.getPassword());
+ }
+
+ public void testConfigWithConnectorFactoryClassNameAndParamsAndUserCredentials()
throws Exception
+ {
+ String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,
foo, bar, hornetq.remoting.invm.serverid=99, key=val";
+ HornetQXAResourceRecovery.ConfigParser parser = new
HornetQXAResourceRecovery.ConfigParser(config);
+
+ assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
+ assertEquals(2, parser.getConnectorParameters().size());
+ assertEquals("99",
parser.getConnectorParameters().get(TransportConstants.SERVER_ID_PROP_NAME));
+ assertEquals("val",
parser.getConnectorParameters().get("key"));
+ assertEquals("foo", parser.getUsername());
+ assertEquals("bar", parser.getPassword());
+ }
+
+ public void testConfigWithConnectorFactoryClassNameAndUserCredentialsWithoutParams()
throws Exception
+ {
+ String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,
foo, bar";
+ HornetQXAResourceRecovery.ConfigParser parser = new
HornetQXAResourceRecovery.ConfigParser(config);
+
+ assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
+ assertEquals(0, parser.getConnectorParameters().size());
+ assertEquals("foo", parser.getUsername());
+ assertEquals("bar", parser.getPassword());
+ }
+
+ public void testEmptyString() throws Exception
+ {
+ try
+ {
+ String config = "";
+ new HornetQXAResourceRecovery.ConfigParser(config);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testUserNameWithoutPassword() throws Exception
+ {
+ try
+ {
+ String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,
foo";
+ new HornetQXAResourceRecovery.ConfigParser(config);
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Deleted:
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/MessagingXAResourceRecoveryTest.java
===================================================================
---
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/MessagingXAResourceRecoveryTest.java 2009-08-20
17:08:06 UTC (rev 7838)
+++
trunk/tests/src/org/hornetq/tests/unit/jms/server/recovery/MessagingXAResourceRecoveryTest.java 2009-08-20
17:26:39 UTC (rev 7839)
@@ -1,122 +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.jms.server.recovery;
-
-import junit.framework.TestCase;
-
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
-import org.hornetq.core.remoting.impl.invm.TransportConstants;
-import org.hornetq.jms.server.recovery.MessagingXAResourceRecovery;
-
-/**
- * A MessagingXAResourceRecoveryTest
- *
- * @author jmesnil
- *
- *
- */
-public class MessagingXAResourceRecoveryTest extends TestCase
-{
-
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testConfigWithOnlyConnectorFactoryClassName() throws Exception
- {
- String config =
"org.hornetq.core.remoting.impl.invm.InVMConnectorFactory";
- MessagingXAResourceRecovery.ConfigParser parser = new
MessagingXAResourceRecovery.ConfigParser(config);
-
- assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
- assertEquals(0, parser.getConnectorParameters().size());
- assertNull(parser.getUsername());
- assertNull(parser.getPassword());
- }
-
- public void testConfigWithConnectorFactoryClassNameAndParamsWithoutUserCredentials()
throws Exception
- {
- String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory, , ,
hornetq.remoting.invm.serverid=99";
- MessagingXAResourceRecovery.ConfigParser parser = new
MessagingXAResourceRecovery.ConfigParser(config);
-
- assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
- assertEquals(1, parser.getConnectorParameters().size());
- assertEquals("99",
parser.getConnectorParameters().get(TransportConstants.SERVER_ID_PROP_NAME));
- assertNull(parser.getUsername());
- assertNull(parser.getPassword());
- }
-
- public void testConfigWithConnectorFactoryClassNameAndParamsAndUserCredentials()
throws Exception
- {
- String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,
foo, bar, hornetq.remoting.invm.serverid=99, key=val";
- MessagingXAResourceRecovery.ConfigParser parser = new
MessagingXAResourceRecovery.ConfigParser(config);
-
- assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
- assertEquals(2, parser.getConnectorParameters().size());
- assertEquals("99",
parser.getConnectorParameters().get(TransportConstants.SERVER_ID_PROP_NAME));
- assertEquals("val",
parser.getConnectorParameters().get("key"));
- assertEquals("foo", parser.getUsername());
- assertEquals("bar", parser.getPassword());
- }
-
- public void testConfigWithConnectorFactoryClassNameAndUserCredentialsWithoutParams()
throws Exception
- {
- String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,
foo, bar";
- MessagingXAResourceRecovery.ConfigParser parser = new
MessagingXAResourceRecovery.ConfigParser(config);
-
- assertEquals(InVMConnectorFactory.class.getName(),
parser.getConnectorFactoryClassName());
- assertEquals(0, parser.getConnectorParameters().size());
- assertEquals("foo", parser.getUsername());
- assertEquals("bar", parser.getPassword());
- }
-
- public void testEmptyString() throws Exception
- {
- try
- {
- String config = "";
- new MessagingXAResourceRecovery.ConfigParser(config);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
- }
-
- public void testUserNameWithoutPassword() throws Exception
- {
- try
- {
- String config = "org.hornetq.core.remoting.impl.invm.InVMConnectorFactory,
foo";
- new MessagingXAResourceRecovery.ConfigParser(config);
- fail();
- }
- catch (IllegalArgumentException e)
- {
- }
- }
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-
-}
Modified: trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2009-08-20 17:08:06 UTC (rev
7838)
+++ trunk/tests/src/org/hornetq/tests/util/UnitTestCase.java 2009-08-20 17:26:39 UTC (rev
7839)
@@ -405,7 +405,7 @@
return testDir + "/temp";
}
- protected static void expectHornetQException(String message, int errorCode,
MessagingAction action)
+ protected static void expectHornetQException(String message, int errorCode,
HornetQAction action)
{
try
{
@@ -419,12 +419,12 @@
}
}
- protected static void expectHornetQException(int errorCode, MessagingAction action)
+ protected static void expectHornetQException(int errorCode, HornetQAction action)
{
expectHornetQException("must throw a HornetQException with the expected
errorCode: " + errorCode, errorCode, action);
}
- protected static void expectXAException(int errorCode, MessagingAction action)
+ protected static void expectXAException(int errorCode, HornetQAction action)
{
try
{
@@ -844,7 +844,7 @@
// Inner classes -------------------------------------------------
- protected static interface MessagingAction
+ protected static interface HornetQAction
{
void run() throws Exception;
}