activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r378642 - in /incubator/activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ test/java/org/apache/activemq/xbean/ test/resources/org/apache/activemq/xbean/
Date Fri, 17 Feb 2006 22:31:02 GMT
Author: chirino
Date: Fri Feb 17 14:30:59 2006
New Revision: 378642

URL: http://svn.apache.org/viewcvs?rev=378642&view=rev
Log:
http://jira.activemq.org/jira//browse/AMQ-568

Added:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
    incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java?rev=378642&r1=378641&r2=378642&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/BrokerService.java
Fri Feb 17 14:30:59 2006
@@ -151,14 +151,14 @@
      */
     public TransportConnector addConnector(TransportConnector connector) throws Exception
{
         
-        if (isUseJmx()) {
-            connector = connector.asManagedConnector(getManagementContext().getMBeanServer(),
getBrokerObjectName());
-            registerConnectorMBean(connector);
-        }
-        
         connector.setBroker(getBroker());
         connector.setBrokerName(getBrokerName());
         connector.setTaskRunnerFactory(getTaskRunnerFactory());
+
+        if (isUseJmx()) {
+            connector = connector.asManagedConnector(getManagementContext().getMBeanServer(),
getBrokerObjectName());
+            registerConnectorMBean(connector);
+        }        
         transportConnectors.add(connector);
 
         return connector;

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java?rev=378642&r1=378641&r2=378642&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnector.java
Fri Feb 17 14:30:59 2006
@@ -83,7 +83,13 @@
      * Factory method to create a JMX managed version of this transport connector
      */
     public ManagedTransportConnector asManagedConnector(MBeanServer mbeanServer, ObjectName
connectorName) throws IOException, URISyntaxException {
-        return new ManagedTransportConnector(mbeanServer,connectorName,  getBroker(), getServer());
   
+        ManagedTransportConnector rc = new ManagedTransportConnector(mbeanServer,connectorName,
 getBroker(), getServer());
+        rc.setTaskRunnerFactory(getTaskRunnerFactory());
+        rc.setUri(uri);
+        rc.setConnectUri(connectUri);
+        rc.setDiscoveryAgent(discoveryAgent);
+        rc.setDiscoveryUri(discoveryUri);
+        return rc;
     }
     
     public BrokerInfo getBrokerInfo() {

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java?rev=378642&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/xbean/ConnectorXBeanConfigTest.java
Fri Feb 17 14:30:59 2006
@@ -0,0 +1,59 @@
+/**
+ *
+ * Copyright 2005-2006 The Apache Software Foundation
+ *
+ * Licensed 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.apache.activemq.xbean;
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.broker.TransportConnector;
+
+/**
+ * 
+ * @version $Revision: 1.1 $
+ */
+public class ConnectorXBeanConfigTest extends TestCase {
+
+    protected BrokerService brokerService;
+
+    public void testConnectorConfiguredCorrectly() throws Throwable {
+        
+        TransportConnector connector = (TransportConnector) brokerService.getTransportConnectors().get(0);
+        
+        assertEquals( new URI("tcp://localhost:61636"), connector.getUri() );
+        assertTrue( connector.getTaskRunnerFactory() == brokerService.getTaskRunnerFactory()
);
+    }
+
+    protected void setUp() throws Exception {
+        brokerService = createBroker();
+        brokerService.start();
+    }
+
+    protected void tearDown() throws Exception {
+        if (brokerService != null) {
+            brokerService.stop();
+        }
+    }
+
+    protected BrokerService createBroker() throws Exception {
+        String uri = "org/apache/activemq/xbean/connector-test.xml";
+        return BrokerFactory.createBroker(new URI("xbean:"+uri));
+    }
+
+}

Added: incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml?rev=378642&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/apache/activemq/xbean/connector-test.xml
Fri Feb 17 14:30:59 2006
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright 2005-2006 The Apache Software Foundation
+   
+    Licensed 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.
+-->
+
+<!-- this file can only be parsed using the xbean-spring library -->
+<!-- START SNIPPET: xbean -->
+<beans xmlns="http://activemq.org/config/1.0">
+
+  <broker useJmx="true">
+
+    <transportConnectors>
+      <transportConnector uri="tcp://localhost:61636" />
+    </transportConnectors>
+
+  </broker>
+
+</beans>
+<!-- END SNIPPET: xbean -->



Mime
View raw message