activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dej...@apache.org
Subject svn commit: r938343 - in /activemq/trunk: activemq-core/src/test/java/org/apache/activemq/spring/ activemq-core/src/test/resources/ activemq-spring/src/test/java/org/apache/activemq/spring/ activemq-spring/src/test/resources/
Date Tue, 27 Apr 2010 07:48:50 GMT
Author: dejanb
Date: Tue Apr 27 07:48:49 2010
New Revision: 938343

URL: http://svn.apache.org/viewvc?rev=938343&view=rev
Log:
moving a test to activemq-spring

Added:
    activemq/trunk/activemq-spring/src/test/java/org/apache/activemq/spring/
    activemq/trunk/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTest.java
    activemq/trunk/activemq-spring/src/test/resources/activemq.xml   (with props)
    activemq/trunk/activemq-spring/src/test/resources/spring-embedded-pooled.xml   (with props)
Removed:
    activemq/trunk/activemq-core/src/test/resources/spring-embedded-pooled.xml
Modified:
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/SpringTest.java

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/SpringTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/SpringTest.java?rev=938343&r1=938342&r2=938343&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/SpringTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/spring/SpringTest.java
Tue Apr 27 07:48:49 2010
@@ -20,48 +20,6 @@ import org.apache.activemq.broker.Broker
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
 public class SpringTest extends SpringTestSupport {
-    /**
-     * Make sure that brokers are being pooled properly.
-     *
-     * @throws Exception
-     */
-    public void testSenderWithSpringXmlEmbeddedPooledBrokerConfiguredViaXml() throws Exception
{
-        String config = "spring-embedded-pooled.xml";
-
-        Thread.currentThread().setContextClassLoader(SpringTest.class.getClassLoader());
-        ClassPathXmlApplicationContext context1 = new ClassPathXmlApplicationContext(config);
-
-        BrokerService bs1 = (BrokerService) context1.getBean("broker1");
-        assertNotNull(bs1);
-        BrokerService bs2 = (BrokerService) context1.getBean("broker2");
-        assertNotNull(bs1);
-
-        // It should be the same broker;
-        assertEquals(bs1, bs2);
-
-        // Even if we load up another context, it should still be the same broker.
-        ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext(config);
-
-        BrokerService bs3 = (BrokerService) context2.getBean("broker1");
-        assertNotNull(bs3);
-        BrokerService bs4 = (BrokerService) context2.getBean("broker2");
-        assertNotNull(bs4);
-
-        // It should be the same broker;
-        assertEquals(bs1, bs3);
-        assertEquals(bs1, bs4);
-
-        // And it should be started.
-        assertTrue(bs1.isStarted());
-
-        // should still be started asfter the 2nd context closes.
-        context2.close();
-        assertTrue(bs1.isStarted());
-
-        // Should stop once all contexts close.
-        context1.close();
-        assertFalse(bs1.isStarted());
-    }
 
     /**
      * Uses ActiveMQConnectionFactory to create the connection context.

Added: activemq/trunk/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTest.java?rev=938343&view=auto
==============================================================================
--- activemq/trunk/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTest.java
(added)
+++ activemq/trunk/activemq-spring/src/test/java/org/apache/activemq/spring/SpringTest.java
Tue Apr 27 07:48:49 2010
@@ -0,0 +1,53 @@
+package org.apache.activemq.spring;
+
+import org.apache.activemq.broker.BrokerService;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import junit.framework.TestCase;
+
+public class SpringTest extends TestCase {
+    
+	/**
+     * Make sure that brokers are being pooled properly.
+     *
+     * @throws Exception
+     */
+    public void testSenderWithSpringXmlEmbeddedPooledBrokerConfiguredViaXml() throws Exception
{
+        String config = "spring-embedded-pooled.xml";
+
+        Thread.currentThread().setContextClassLoader(SpringTest.class.getClassLoader());
+        ClassPathXmlApplicationContext context1 = new ClassPathXmlApplicationContext(config);
+
+        BrokerService bs1 = (BrokerService) context1.getBean("broker1");
+        assertNotNull(bs1);
+        BrokerService bs2 = (BrokerService) context1.getBean("broker2");
+        assertNotNull(bs1);
+
+        // It should be the same broker;
+        assertEquals(bs1, bs2);
+
+        // Even if we load up another context, it should still be the same broker.
+        ClassPathXmlApplicationContext context2 = new ClassPathXmlApplicationContext(config);
+
+        BrokerService bs3 = (BrokerService) context2.getBean("broker1");
+        assertNotNull(bs3);
+        BrokerService bs4 = (BrokerService) context2.getBean("broker2");
+        assertNotNull(bs4);
+
+        // It should be the same broker;
+        assertEquals(bs1, bs3);
+        assertEquals(bs1, bs4);
+
+        // And it should be started.
+        assertTrue(bs1.isStarted());
+
+        // should still be started asfter the 2nd context closes.
+        context2.close();
+        assertTrue(bs1.isStarted());
+
+        // Should stop once all contexts close.
+        context1.close();
+        assertFalse(bs1.isStarted());
+    }
+    
+}

Added: activemq/trunk/activemq-spring/src/test/resources/activemq.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/test/resources/activemq.xml?rev=938343&view=auto
==============================================================================
--- activemq/trunk/activemq-spring/src/test/resources/activemq.xml (added)
+++ activemq/trunk/activemq-spring/src/test/resources/activemq.xml Tue Apr 27 07:48:49 2010
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF 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.
+-->
+<!-- START SNIPPET: xbean -->
+<beans 
+  xmlns="http://www.springframework.org/schema/beans" 
+  xmlns:amq="http://activemq.apache.org/schema/core"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+  http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
+ 
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <broker useJmx="false"  xmlns="http://activemq.apache.org/schema/core" persistent="false">
+  
+    <networkConnectors>
+      <networkConnector uri="multicast://default"/>
+    </networkConnectors>
+
+    <transportConnectors>
+      <transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>
+    </transportConnectors>
+        
+  </broker>
+  
+</beans>
+<!-- END SNIPPET: xbean -->

Propchange: activemq/trunk/activemq-spring/src/test/resources/activemq.xml
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/trunk/activemq-spring/src/test/resources/spring-embedded-pooled.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/test/resources/spring-embedded-pooled.xml?rev=938343&view=auto
==============================================================================
--- activemq/trunk/activemq-spring/src/test/resources/spring-embedded-pooled.xml (added)
+++ activemq/trunk/activemq-spring/src/test/resources/spring-embedded-pooled.xml Tue Apr 27
07:48:49 2010
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF 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.
+-->
+
+<!-- START SNIPPET: spring -->
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+
+    <bean id="broker1" class="org.apache.activemq.xbean.PooledBrokerFactoryBean">
+      <property name="config" value="classpath:activemq.xml"/>
+    </bean>
+
+    <bean id="broker2" class="org.apache.activemq.xbean.PooledBrokerFactoryBean">
+      <property name="config" value="classpath:activemq.xml"/>
+    </bean>
+    
+</beans>
+
+<!-- END SNIPPET: spring -->

Propchange: activemq/trunk/activemq-spring/src/test/resources/spring-embedded-pooled.xml
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message