activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r357018 - in /incubator/activemq/trunk/activemq-core/src: main/java/org/activemq/xbean/ test/java/org/activemq/ test/java/org/activemq/test/retroactive/ test/java/org/activemq/xbean/ test/resources/org/activemq/xbean/
Date Thu, 15 Dec 2005 14:15:35 GMT
Author: jstrachan
Date: Thu Dec 15 06:15:18 2005
New Revision: 357018

URL: http://svn.apache.org/viewcvs?rev=357018&view=rev
Log:
tidied up the XBean factory bean to avoid it owning and closing the contained context.
also by default the broker is started when using the XML file

Added:
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
  (with props)
    incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
  (with props)
Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/BrokerFactoryBean.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerFactory.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerService.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/EmbeddedBrokerTestSupport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/XBeanConfigTest.java
    incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq.xml
    incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring.xml

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/BrokerFactoryBean.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/BrokerFactoryBean.java?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/BrokerFactoryBean.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/BrokerFactoryBean.java
Thu Dec 15 06:15:18 2005
@@ -49,7 +49,8 @@
 
     private Resource config;
     private XBeanBrokerService broker;
-    private boolean start=false;
+    private boolean start = false;
+    private ResourceXmlApplicationContext context;
 
     public BrokerFactoryBean() {
     }
@@ -74,7 +75,7 @@
         if (config == null) {
             throw new IllegalArgumentException("config property must be set");
         }
-        ResourceXmlApplicationContext context = new ResourceXmlApplicationContext(config);
+        context = new ResourceXmlApplicationContext(config);
 
         try {
             broker = (XBeanBrokerService) context.getBean("broker");
@@ -96,12 +97,15 @@
         if (broker == null) {
             throw new IllegalArgumentException("The configuration has no BrokerService instance
for resource: " + config);
         }
-        broker.setAbstractApplicationContext(context);
-        if( start )
+        if (start) {
             broker.start();
+        }
     }
 
     public void destroy() throws Exception {
+        if (context != null) {
+            context.close();
+        }
         if (broker != null) {
             broker.stop();
         }
@@ -126,6 +130,5 @@
     public void setStart(boolean start) {
         this.start = start;
     }
-    
-    
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerFactory.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerFactory.java?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerFactory.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerFactory.java
Thu Dec 15 06:15:18 2005
@@ -63,7 +63,8 @@
             throw new IllegalArgumentException("The configuration has no BrokerService instance
for resource: " + config);
         }
         
-        broker.setAbstractApplicationContext(context);
+        // TODO warning resources from the context may not be closed down!
+        
         return broker;
     }
 

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerService.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerService.java?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerService.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/activemq/xbean/XBeanBrokerService.java
Thu Dec 15 06:15:18 2005
@@ -1,9 +1,8 @@
 package org.activemq.xbean;
 
 import org.activemq.broker.BrokerService;
-import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.InitializingBean;
-import org.springframework.context.support.AbstractApplicationContext;
 
 /**
  * Represents a running broker service which consists of a number of transport
@@ -16,37 +15,33 @@
  * 
  * @version $Revision: 1.1 $
  */
-public class XBeanBrokerService extends BrokerService implements InitializingBean {
+public class XBeanBrokerService extends BrokerService implements InitializingBean, DisposableBean
{
 
-    private boolean start=false;
-    private AbstractApplicationContext applicationContext;
+    private boolean start = true;
 
-    public XBeanBrokerService() {        
+    public XBeanBrokerService() {
     }
-    
-    public void setAbstractApplicationContext(AbstractApplicationContext applicationContext)
throws BeansException {
-        this.applicationContext = applicationContext;
-    }
-    
+
     public void afterPropertiesSet() throws Exception {
-        if( start ) {  
+        if (start) {
             start();
         }
     }
 
-    public void stop() throws Exception {
-        super.stop();
-        if( applicationContext!=null ) {
-            applicationContext.destroy();
-            applicationContext=null;
-        }
+    public void destroy() throws Exception {
+        stop();
     }
 
     public boolean isStart() {
         return start;
     }
+
+    /**
+     * Sets whether or not the broker is started along with the ApplicationContext it is
defined within.
+     * Normally you would want the broker to start up along with the ApplicationContext but
sometimes when working
+     * with JUnit tests you may wish to start and stop the broker explicitly yourself.
+     */
     public void setStart(boolean start) {
         this.start = start;
     }
-    
 }

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/EmbeddedBrokerTestSupport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/EmbeddedBrokerTestSupport.java?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/EmbeddedBrokerTestSupport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/EmbeddedBrokerTestSupport.java
Thu Dec 15 06:15:18 2005
@@ -50,7 +50,7 @@
         if (broker == null) {
             broker = createBroker();
         }
-        broker.start();
+        startBroker();
 
         connectionFactory = createConnectionFactory();
 
@@ -131,6 +131,10 @@
         answer.setPersistent(isPersistent());
         answer.addConnector(bindAddress);
         return answer;
+    }
+
+    protected void startBroker() throws Exception {
+        broker.start();
     }
 
     /**

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/test/retroactive/RetroactiveConsumerTestWithSimpleMessageListTest.java
Thu Dec 15 06:15:18 2005
@@ -45,8 +45,8 @@
     public void testSendThenConsume() throws Exception {
 
         // lets some messages
-         connection = createConnection();
-         session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        connection = createConnection();
+        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer producer = session.createProducer(destination);
         for (int i = 0; i < messageCount; i++) {
             TextMessage message = session.createTextMessage("Message: " + i + " sent at:
" + new Date());
@@ -65,7 +65,7 @@
         consumer.setMessageListener(listener);
         listener.waitForMessagesToArrive(messageCount);
         listener.assertMessagesReceived(messageCount);
-        
+
     }
 
     protected void setUp() throws Exception {
@@ -74,7 +74,6 @@
         super.setUp();
     }
 
-    
     protected void tearDown() throws Exception {
         if (session != null) {
             session.close();
@@ -98,6 +97,10 @@
         BrokerFactoryBean factory = new BrokerFactoryBean(new ClassPathResource(uri));
         factory.afterPropertiesSet();
         return factory.getBroker();
+    }
+
+    protected void startBroker() throws Exception {
+        // broker already started by XBean
     }
 
     protected String getBrokerXml() {

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,30 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * 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.activemq.xbean;
+
+/**
+ *
+ * @version $Revision$
+ */
+public class MultipleTestsWithEmbeddedBrokerAndPersistenceTest extends MultipleTestsWithEmbeddedBrokerTest
{
+
+    protected boolean isPersistent() {
+        return true;
+    }
+
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerAndPersistenceTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,55 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * 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.activemq.xbean;
+
+import org.activemq.EmbeddedBrokerTestSupport;
+
+import javax.jms.Connection;
+
+/**
+ * 
+ * @author Neil Clayton
+ * @version $Revision$
+ */
+public class MultipleTestsWithEmbeddedBrokerTest extends EmbeddedBrokerTestSupport {
+    protected Connection connection;
+
+    public void test1() throws Exception {
+    }
+
+    public void test2() throws Exception {
+    }
+
+    protected void setUp() throws Exception {
+        System.out.println("### starting up the test case: " + getName());
+
+        super.setUp();
+        connection = connectionFactory.createConnection();
+        connection.start();
+        System.out.println("### started up the test case: " + getName());
+    }
+
+    protected void tearDown() throws Exception {
+        connection.close();
+
+        super.tearDown();
+
+        System.out.println("### closed down the test case: " + getName());
+        System.out.println();
+    }
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithEmbeddedBrokerTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,78 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * 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.activemq.xbean;
+
+import org.activemq.ActiveMQConnectionFactory;
+import org.activemq.broker.BrokerService;
+import org.springframework.context.support.AbstractApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+
+import junit.framework.TestCase;
+
+/**
+ * 
+ * @author Neil Clayton
+ * @version $Revision$
+ */
+public class MultipleTestsWithSpringFactoryBeanTest extends TestCase {
+    protected AbstractApplicationContext context;
+    protected BrokerService service;
+    private Connection connection;
+
+    public void test1() throws Exception {
+    }
+    
+    public void test2() throws Exception {
+    }
+    
+    protected void setUp() throws Exception {
+        System.out.println("### starting up the test case: " + getName());
+        
+        super.setUp();
+        context = new ClassPathXmlApplicationContext("org/activemq/xbean/spring2.xml");
+        service = (BrokerService) context.getBean("broker");
+        
+        // already started
+        service.start();
+        
+        connection = createConnectionFactory().createConnection();
+        connection.start();
+        System.out.println("### started up the test case: " + getName());
+    }
+
+    protected void tearDown() throws Exception {
+        connection.close();
+        
+        // stopped as part of the context
+        service.stop();
+        context.close();
+        super.tearDown();
+        
+        System.out.println("### closed down the test case: " + getName());
+        System.out.println();
+    }
+
+    protected ConnectionFactory createConnectionFactory() {
+        ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory();
+        factory.setBrokerURL("vm://localhost");
+        return factory;
+    }
+}

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,45 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * 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.activemq.xbean;
+
+import org.activemq.broker.BrokerService;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class MultipleTestsWithSpringXBeanFactoryBeanTest extends MultipleTestsWithEmbeddedBrokerTest
{
+
+    private ClassPathXmlApplicationContext context;
+
+    protected BrokerService createBroker() throws Exception {
+        context = new ClassPathXmlApplicationContext("org/activemq/xbean/spring2.xml");
+        return  (BrokerService) context.getBean("broker");
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        if (context != null) {
+            context.destroy();
+        }
+    }
+
+    
+
+}
+

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithSpringXBeanFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,37 @@
+/**
+ * 
+ * Copyright 2005 LogicBlaze, Inc. http://www.logicblaze.com
+ * 
+ * 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.activemq.xbean;
+
+import org.activemq.broker.BrokerService;
+import org.springframework.core.io.ClassPathResource;
+
+/**
+ * @version $Revision$
+ */
+public class MultipleTestsWithXBeanFactoryBeanTest extends MultipleTestsWithEmbeddedBrokerTest
{
+
+    protected BrokerService createBroker() throws Exception {
+        BrokerFactoryBean factory = new BrokerFactoryBean();
+        factory.setConfig(new ClassPathResource("org/activemq/xbean/activemq2.xml"));
+        factory.afterPropertiesSet();
+        return factory.getBroker();
+    }
+
+
+}
+

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/MultipleTestsWithXBeanFactoryBeanTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/XBeanConfigTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/XBeanConfigTest.java?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/XBeanConfigTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/activemq/xbean/XBeanConfigTest.java
Thu Dec 15 06:15:18 2005
@@ -79,7 +79,8 @@
         brokerService = createBroker();
         broker = brokerService.getBroker();
 
-        brokerService.start();
+        // started automatically
+        //brokerService.start();
 
         context = new ConnectionContext();
         context.setBroker(broker);

Modified: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq.xml?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq.xml
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq.xml
Thu Dec 15 06:15:18 2005
@@ -15,7 +15,10 @@
     </transportConnectors>
 
     <networkConnectors>
+      <!-- 
+      <networkConnector uri="multicast://default?initialReconnectDelay=100" />
       <networkConnector uri="static://(tcp://localhost:61616)" />
+       -->
     </networkConnectors>
   </broker>
 

Added: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,37 @@
+<beans xmlns="http://activemq.org/config/1.0">
+
+  <!-- for easier integration with the JUnit tests, lets not start the broker when the
ApplicationContext starts -->
+  <broker useJmx="true" start="false">
+    <destinationPolicy>
+      <policyMap>
+        <policyEntries>
+
+          <policyEntry topic="FOO.>">
+            <dispatchPolicy>
+              <strictOrderDispatchPolicy />
+            </dispatchPolicy>
+            <subscriptionRecoveryPolicy>
+              <lastImageSubscriptionRecoveryPolicy />
+            </subscriptionRecoveryPolicy>
+          </policyEntry>
+        </policyEntries>
+      </policyMap>
+    </destinationPolicy>
+
+
+    <persistenceAdapter>
+      <journaledJDBC journalLogFiles="5" dataDirectory="../data" />
+    </persistenceAdapter>
+
+    <transportConnectors>
+      <transportConnector uri="tcp://localhost:61616" />
+    </transportConnectors>
+
+<!-- 
+    <networkConnectors>
+      <networkConnector
+        uri="multicast://default?initialReconnectDelay=100" />
+    </networkConnectors>
+ -->
+  </broker>
+</beans>
\ No newline at end of file

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/activemq2.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring.xml?rev=357018&r1=357017&r2=357018&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring.xml
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring.xml
Thu Dec 15 06:15:18 2005
@@ -8,7 +8,6 @@
 
   <bean id="broker" class="org.activemq.xbean.BrokerFactoryBean">
     <property name="config" value="classpath:org/activemq/xbean/activemq.xml" />
-    <property name="start" value="true" />
   </bean>
 
   <!-- JMS ConnectionFactory to use -->

Added: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml?rev=357018&view=auto
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
(added)
+++ incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
Thu Dec 15 06:15:18 2005
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans default-autowire="autodetect">
+  <bean id="broker" class="org.activemq.xbean.BrokerFactoryBean">
+    <property name="config" value="classpath:org/activemq/xbean/activemq2.xml" />
+  </bean>
+</beans>

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: incubator/activemq/trunk/activemq-core/src/test/resources/org/activemq/xbean/spring2.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message