activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gtu...@apache.org
Subject svn commit: r1390204 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/broker/util/ activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/ activemq-spring/src/main/java/org/apache/activemq/hooks/ assembly/ assembly/sr...
Date Tue, 25 Sep 2012 22:52:28 GMT
Author: gtully
Date: Tue Sep 25 22:52:28 2012
New Revision: 1390204

URL: http://svn.apache.org/viewvc?rev=1390204&view=rev
Log:
fix up assembly xml configuration validtion tests - have them run by default. Pull out osgi
isms to separate hook and add shutdown hook when jetty.xml is included so that it is shutdown
on broker stop. Fix problems with the xml eposed by the tests

Added:
    activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringOsgiContextHook.java
      - copied, changed from r1390202, activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
    activemq/trunk/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/spring.xml
    activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java
    activemq/trunk/assembly/pom.xml
    activemq/trunk/assembly/src/main/descriptors/common-bin.xml
    activemq/trunk/assembly/src/release/conf/activemq.xml
    activemq/trunk/assembly/src/sample-conf/activemq-demo.xml
    activemq/trunk/assembly/src/sample-conf/activemq-security.xml
    activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/util/CommandAgent.java
Tue Sep 25 22:52:28 2012
@@ -75,32 +75,27 @@ public class CommandAgent implements Ser
      */
     @PreDestroy
     public void stop() throws Exception {
-        ServiceStopper stopper = new ServiceStopper();
         if (consumer != null) {
             try {
                 consumer.close();
                 consumer = null;
-            } catch (JMSException e) {
-                stopper.onException(this, e);
+            } catch (JMSException ignored) {
             }
         }
         if (session != null) {
             try {
                 session.close();
                 session = null;
-            } catch (JMSException e) {
-                stopper.onException(this, e);
+            } catch (JMSException ignored) {
             }
         }
         if (connection != null) {
             try {
                 connection.close();
                 connection = null;
-            } catch (JMSException e) {
-                stopper.onException(this, e);
+            } catch (JMSException ignored) {
             }
         }
-        stopper.throwFirstException();
     }
 
     // Properties

Modified: activemq/trunk/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/spring.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/spring.xml?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/spring.xml
(original)
+++ activemq/trunk/activemq-karaf/src/main/resources/org/apache/activemq/karaf/commands/spring.xml
Tue Sep 25 22:52:28 2012
@@ -101,7 +101,7 @@
         -->
 
         <shutdownHooks>
-           <bean xmlns="http://www.springframework.org/schema/beans" id="hook" class="org.apache.activemq.hooks.SpringContextHook"
/>
+           <bean xmlns="http://www.springframework.org/schema/beans" id="hook" class="org.apache.activemq.hooks.SpringOsgiContextHook"
/>
         </shutdownHooks>
 
         <!-- The transport connectors ActiveMQ will listen to -->

Modified: activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java
(original)
+++ activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java
Tue Sep 25 22:52:28 2012
@@ -16,32 +16,19 @@
  */
 package org.apache.activemq.hooks;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.osgi.framework.BundleException;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
 
 public class SpringContextHook implements Runnable, ApplicationContextAware {
 
-    private static final transient Logger LOG = LoggerFactory.getLogger(SpringContextHook.class);
     ApplicationContext applicationContext;
     
     public void run() {
         if (applicationContext instanceof ConfigurableApplicationContext) {
             ((ConfigurableApplicationContext) applicationContext).close();
         }
-        if (applicationContext instanceof OsgiBundleXmlApplicationContext){
-            try {
-                ((OsgiBundleXmlApplicationContext)applicationContext).getBundle().stop();
-            } catch (BundleException e) {
-                LOG.info("Error stopping OSGi bundle " + e, e);
-            }
-        }
-
     }
 
     public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{

Copied: activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringOsgiContextHook.java
(from r1390202, activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java)
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringOsgiContextHook.java?p2=activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringOsgiContextHook.java&p1=activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java&r1=1390202&r2=1390204&rev=1390204&view=diff
==============================================================================
--- activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringContextHook.java
(original)
+++ activemq/trunk/activemq-spring/src/main/java/org/apache/activemq/hooks/SpringOsgiContextHook.java
Tue Sep 25 22:52:28 2012
@@ -16,18 +16,18 @@
  */
 package org.apache.activemq.hooks;
 
+import org.osgi.framework.BundleException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.osgi.framework.BundleException;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.osgi.context.support.OsgiBundleXmlApplicationContext;
 
-public class SpringContextHook implements Runnable, ApplicationContextAware {
+public class SpringOsgiContextHook implements Runnable, ApplicationContextAware {
 
-    private static final transient Logger LOG = LoggerFactory.getLogger(SpringContextHook.class);
+    private static final transient Logger LOG = LoggerFactory.getLogger(SpringOsgiContextHook.class);
     ApplicationContext applicationContext;
     
     public void run() {

Modified: activemq/trunk/assembly/pom.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/pom.xml?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/assembly/pom.xml (original)
+++ activemq/trunk/assembly/pom.xml Tue Sep 25 22:52:28 2012
@@ -127,10 +127,6 @@
     </dependency>
     <dependency>
       <groupId>org.apache.camel</groupId>
-      <artifactId>camel-jetty</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.camel</groupId>
       <artifactId>camel-jms</artifactId>
     </dependency>
 
@@ -294,6 +290,12 @@
     </dependency>
 
     <dependency>
+      <groupId>org.jasypt</groupId>
+      <artifactId>jasypt-spring3</artifactId>
+      <version>${jasypt-version}</version>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
@@ -342,6 +344,18 @@
         </executions>
       </plugin>
       <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>validate-config</id>
+            <phase>test-compile</phase>
+            <goals>
+             <goal>testCompile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <executions>
           <execution>
@@ -352,6 +366,9 @@
             </goals>
             <configuration>
              <forkMode>pertest</forkMode>
+             <environmentVariables>
+                 <ACTIVEMQ_ENCRYPTION_PASSWORD>activemq</ACTIVEMQ_ENCRYPTION_PASSWORD>
+             </environmentVariables>
             </configuration>
           </execution>
         </executions>

Modified: activemq/trunk/assembly/src/main/descriptors/common-bin.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/main/descriptors/common-bin.xml?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/assembly/src/main/descriptors/common-bin.xml (original)
+++ activemq/trunk/assembly/src/main/descriptors/common-bin.xml Tue Sep 25 22:52:28 2012
@@ -127,7 +127,6 @@
       <includes>
         <include>org.apache.camel:camel-core</include>
         <include>org.apache.camel:camel-spring</include>
-        <include>org.apache.camel:camel-jetty</include>
         <include>org.apache.camel:camel-jms</include>
         <include>org.apache.activemq:activemq-camel</include>
       </includes>
@@ -171,6 +170,7 @@
         <include>org.apache.velocity:velocity</include>
         <include>org.apache.servicemix.bundles:org.apache.servicemix.bundles.josql</include>
         <include>org.jasypt:jasypt</include>
+        <include>org.jasypt:jasypt-spring3</include>
         <include>javax.jmdns:jmdns</include>
       </includes>
     </dependencySet>

Modified: activemq/trunk/assembly/src/release/conf/activemq.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/release/conf/activemq.xml?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/assembly/src/release/conf/activemq.xml (original)
+++ activemq/trunk/assembly/src/release/conf/activemq.xml Tue Sep 25 22:52:28 2012
@@ -145,6 +145,11 @@
             <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireformat.maxFrameSize=104857600"/>
         </transportConnectors>
 
+        <!-- destroy the spring context on shutdown to stop jetty -->
+        <shutdownHooks>
+            <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook"
/>
+        </shutdownHooks>
+
     </broker>
 
     <!--

Modified: activemq/trunk/assembly/src/sample-conf/activemq-demo.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/sample-conf/activemq-demo.xml?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/assembly/src/sample-conf/activemq-demo.xml (original)
+++ activemq/trunk/assembly/src/sample-conf/activemq-demo.xml Tue Sep 25 22:52:28 2012
@@ -47,7 +47,7 @@
           - Change the brokerName attribute to something unique
     -->
 
-    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="amq-broker" useJmx="true"
destroyApplicationContextOnStop="true">
+    <broker xmlns="http://activemq.apache.org/schema/core" brokerName="amq-broker" useJmx="true">
 
         <!--
             Examples of destination-specific policies using destination
@@ -205,6 +205,11 @@
             <transportConnector name="xmpp" uri="xmpp://localhost:61222"/>
         </transportConnectors>
 
+        <!-- destroy the spring context on shutdown to stop jetty -->
+        <shutdownHooks>
+            <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook"
/>
+        </shutdownHooks>
+
     </broker>
 
     <!--

Modified: activemq/trunk/assembly/src/sample-conf/activemq-security.xml
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/sample-conf/activemq-security.xml?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/assembly/src/sample-conf/activemq-security.xml (original)
+++ activemq/trunk/assembly/src/sample-conf/activemq-security.xml Tue Sep 25 22:52:28 2012
@@ -70,9 +70,9 @@
             <property xmlns="http://www.springframework.org/schema/beans" name="environment">
                 <map xmlns="http://www.springframework.org/schema/beans">
                     <entry xmlns="http://www.springframework.org/schema/beans" key="jmx.remote.x.password.file"
-                           value="conf/jmx.password"/>
+                           value="${activemq.conf}/jmx.password"/>
                     <entry xmlns="http://www.springframework.org/schema/beans" key="jmx.remote.x.access.file"
-                           value="conf/jmx.access"/>
+                           value="${activemq.conf}/jmx.access"/>
                 </map>
             </property>
         </managementContext>
@@ -116,7 +116,12 @@
     <transportConnectors>
        <transportConnector name="default" uri="tcp://0.0.0.0:61616"/>
     </transportConnectors>
-    
+
+    <!-- destroy the spring context on shutdown to stop jetty -->
+    <shutdownHooks>
+        <bean xmlns="http://www.springframework.org/schema/beans" class="org.apache.activemq.hooks.SpringContextHook"
/>
+    </shutdownHooks>
+
   </broker>
 
   <!-- 

Modified: activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java?rev=1390204&r1=1390203&r2=1390204&view=diff
==============================================================================
--- activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java
(original)
+++ activemq/trunk/assembly/src/test/java/org/apache/activemq/config/BrokerXmlConfigStartTest.java
Tue Sep 25 22:52:28 2012
@@ -28,11 +28,13 @@ import javax.jms.JMSException;
 
 import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerContext;
 import org.apache.activemq.broker.BrokerFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.TransportConnection;
 import org.apache.activemq.broker.TransportConnector;
 import org.apache.activemq.transport.stomp.StompConnection;
+import org.apache.activemq.util.URISupport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -68,7 +70,7 @@ public class BrokerXmlConfigStartTest ex
         // alive, now try connect to connect
         try {
             for (TransportConnector transport : broker.getTransportConnectors()) {
-                final URI UriToConnectTo = transport.getConnectUri();
+                final URI UriToConnectTo = URISupport.removeQuery(transport.getConnectUri());
                  
                 if (UriToConnectTo.getScheme().startsWith("stomp")) {
                     LOG.info("validating alive with connection to: " + UriToConnectTo);
@@ -98,6 +100,9 @@ public class BrokerXmlConfigStartTest ex
 
     public void setUp() throws Exception {
         System.setProperty("activemq.base", "target");
+        System.setProperty("activemq.home", "target"); // not a valid home but ok for xml
validation
+        System.setProperty("activemq.data", "target");
+        System.setProperty("activemq.conf", "target/conf");
         secProps = new Properties();
         secProps.load(new FileInputStream(new File("target/conf/credentials.properties")));
     }



Mime
View raw message