You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by de...@apache.org on 2009/06/15 14:10:22 UTC

svn commit: r784745 - in /activemq/sandbox/activemq-flow: ./ activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/ activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/ activemq-broker/src/test/java/org/apache/activemq/apollo/ as...

Author: dejanb
Date: Mon Jun 15 12:10:21 2009
New Revision: 784745

URL: http://svn.apache.org/viewvc?rev=784745&view=rev
Log:
introducing 'assembly' packet; moving jaxb test there (it should be a place for all multi-module tests); adding transport server jaxb support

Added:
    activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/TransportServerXml.java
    activemq/sandbox/activemq-flow/assembly/pom.xml
    activemq/sandbox/activemq-flow/assembly/src/
    activemq/sandbox/activemq-flow/assembly/src/main/
    activemq/sandbox/activemq-flow/assembly/src/main/java/
    activemq/sandbox/activemq-flow/assembly/src/main/java/org/
    activemq/sandbox/activemq-flow/assembly/src/main/java/org/apache/
    activemq/sandbox/activemq-flow/assembly/src/main/java/org/apache/activemq/
    activemq/sandbox/activemq-flow/assembly/src/main/java/org/apache/activemq/assembly/
    activemq/sandbox/activemq-flow/assembly/src/test/
    activemq/sandbox/activemq-flow/assembly/src/test/java/
    activemq/sandbox/activemq-flow/assembly/src/test/java/org/
    activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/
    activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/
    activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/
    activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/jaxb/
    activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/jaxb/JAXBConfigTest.java
    activemq/sandbox/activemq-flow/assembly/src/test/resources/
    activemq/sandbox/activemq-flow/assembly/src/test/resources/org/
    activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/
    activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/
    activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/
    activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/jaxb/
    activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/jaxb/activemq.xml
Removed:
    activemq/sandbox/activemq-flow/activemq-broker/src/main/resources/org/apache/activemq/apollo/jaxb/
    activemq/sandbox/activemq-flow/activemq-broker/src/test/java/org/apache/activemq/apollo/
Modified:
    activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java
    activemq/sandbox/activemq-flow/pom.xml

Modified: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java?rev=784745&r1=784744&r2=784745&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java (original)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/BrokerXml.java Mon Jun 15 12:10:21 2009
@@ -1,14 +1,47 @@
+/**
+ * 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.
+ */
 package org.apache.activemq.apollo.jaxb;
 
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.activemq.apollo.broker.Broker;
 
 @XmlRootElement(name="broker")
 public class BrokerXml {
+	
+	@XmlAttribute(name="name")
+	String name;
+	
+	@XmlElementWrapper(name="transportServers")
+	@XmlElement(name="transportServer")
+	CopyOnWriteArrayList<TransportServerXml> transportServers = new CopyOnWriteArrayList<TransportServerXml>();
 
-	public Broker createMessageBroker() {
-		return null;
+	public Broker createMessageBroker() throws Exception {
+		Broker broker = new Broker();
+		broker.setName(name);
+		for (TransportServerXml transportServer : transportServers) {
+			broker.addTransportServer(transportServer.createTransportServer());
+		}
+		return broker;
 	}
 
 }

Added: activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/TransportServerXml.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/TransportServerXml.java?rev=784745&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/TransportServerXml.java (added)
+++ activemq/sandbox/activemq-flow/activemq-broker/src/main/java/org/apache/activemq/apollo/jaxb/TransportServerXml.java Mon Jun 15 12:10:21 2009
@@ -0,0 +1,25 @@
+package org.apache.activemq.apollo.jaxb;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.activemq.transport.TransportFactory;
+import org.apache.activemq.transport.TransportServer;
+
+
+
+@XmlRootElement(name="transportServer")
+public class TransportServerXml {
+
+	@XmlAttribute(name="uri")
+	String uri;
+	
+	public TransportServer createTransportServer() throws IOException, URISyntaxException {
+		return TransportFactory.bind(new URI(uri));
+	}
+	
+}

Added: activemq/sandbox/activemq-flow/assembly/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/assembly/pom.xml?rev=784745&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/assembly/pom.xml (added)
+++ activemq/sandbox/activemq-flow/assembly/pom.xml Mon Jun 15 12:10:21 2009
@@ -0,0 +1,53 @@
+<?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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.activemq</groupId>
+    <artifactId>activemq-parent</artifactId>
+    <version>6.0-SNAPSHOT</version>
+  </parent>
+
+  <groupId>org.apache.activemq</groupId>
+  <artifactId>assembly</artifactId>
+  <packaging>jar</packaging>
+  <version>6.0-SNAPSHOT</version>
+  
+  <name>ActiveMQ :: Assembly</name>
+  <description>Puts together the ActiveMQ distribution</description>
+  
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-broker</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>activemq-openwire</artifactId>
+      <scope>test</scope>
+    </dependency>    
+  </dependencies>
+</project>
\ No newline at end of file

Added: activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/jaxb/JAXBConfigTest.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/jaxb/JAXBConfigTest.java?rev=784745&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/jaxb/JAXBConfigTest.java (added)
+++ activemq/sandbox/activemq-flow/assembly/src/test/java/org/apache/activemq/assembly/jaxb/JAXBConfigTest.java Mon Jun 15 12:10:21 2009
@@ -0,0 +1,60 @@
+/**
+ * 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.
+ */
+package org.apache.activemq.assembly.jaxb;
+
+
+import java.net.URI;
+
+import junit.framework.TestCase;
+
+import org.apache.activemq.apollo.broker.Broker;
+import org.apache.activemq.apollo.broker.BrokerFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class JAXBConfigTest extends TestCase {
+
+    private static final Log LOG = LogFactory.getLog(JAXBConfigTest.class);
+	
+    Broker broker;
+    
+	@Before
+	public void setUp() throws Exception {
+		broker = createBroker();
+	}
+
+	@After
+	public void tearDown() throws Exception {
+	}
+	
+	@Test
+	public void testBrokerConfiguredCorrectly() throws Exception {
+		assertNotNull(broker);
+		assertEquals("broker", broker.getName());
+		assertEquals("tcp://localhost:61616?wireFormat=openwire", broker.getTransportServers().get(0).getConnectURI().toString());
+	}
+
+    protected Broker createBroker() throws Exception {
+    	URI uri = new URI("jaxb:classpath:org/apache/activemq/assembly/jaxb/activemq.xml");
+        LOG.info("Loading broker configuration from the classpath with URI: " + uri);
+        return BrokerFactory.createBroker(uri);
+    }
+	
+}

Added: activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/jaxb/activemq.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/jaxb/activemq.xml?rev=784745&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/jaxb/activemq.xml (added)
+++ activemq/sandbox/activemq-flow/assembly/src/test/resources/org/apache/activemq/assembly/jaxb/activemq.xml Mon Jun 15 12:10:21 2009
@@ -0,0 +1,24 @@
+<?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.
+-->
+<broker name="broker">
+
+    <transportServers>
+        <transportServer uri="tcp://localhost:61616?wireFormat=openwire"/>
+    </transportServers>
+
+</broker>
\ No newline at end of file

Modified: activemq/sandbox/activemq-flow/pom.xml
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/pom.xml?rev=784745&r1=784744&r2=784745&view=diff
==============================================================================
--- activemq/sandbox/activemq-flow/pom.xml (original)
+++ activemq/sandbox/activemq-flow/pom.xml Mon Jun 15 12:10:21 2009
@@ -14,8 +14,7 @@
   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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <parent>
     <groupId>org.apache</groupId>
     <artifactId>apache</artifactId>
@@ -133,6 +132,7 @@
     <module>activemq-queue</module>
     <module>activemq-jmx</module>
     <module>activemq-spring</module>
+    <module>assembly</module>
   </modules>
 
 <!--
@@ -1267,4 +1267,4 @@
 
   </profiles>
 
-</project>
+</project>
\ No newline at end of file