activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1032370 - in /activemq/activemq-apollo/trunk/apollo-cli: ./ src/main/scala/org/apache/activemq/apollo/cli/commands/ src/test/resources/example-broker/ src/test/resources/example-broker/etc/ src/test/scala/org/apache/activemq/apollo/cli/
Date Sun, 07 Nov 2010 19:51:47 GMT
Author: chirino
Date: Sun Nov  7 19:51:47 2010
New Revision: 1032370

URL: http://svn.apache.org/viewvc?rev=1032370&view=rev
Log:
Better ide based execution of the broker (using an ide makes it easier to debug).

Added:
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/jul.properties
    activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
Removed:
    activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/TestApollo.scala
Modified:
    activemq/activemq-apollo/trunk/apollo-cli/pom.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala

Modified: activemq/activemq-apollo/trunk/apollo-cli/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/pom.xml?rev=1032370&r1=1032369&r2=1032370&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/pom.xml Sun Nov  7 19:51:47 2010
@@ -78,16 +78,14 @@
       <version>${slf4j-version}</version>
       <scope>test</scope>
     </dependency>
-
-    <!-- Optional Modules -->
     <dependency>
-      <groupId>org.apache.activemq</groupId>
-      <artifactId>apollo-web</artifactId>
-      <version>1.0-SNAPSHOT</version>
-      <type>jar</type>
-      <classifier>slim</classifier>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jul-to-slf4j</artifactId>
+      <version>${slf4j-version}</version>
       <scope>test</scope>
     </dependency>
+
+    <!-- Optional Modules -->
     <dependency>
       <groupId>org.apache.activemq</groupId>
       <artifactId>apollo-stomp</artifactId>
@@ -112,6 +110,14 @@
       <version>1.0-SNAPSHOT</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.apache.activemq</groupId>
+      <artifactId>apollo-web</artifactId>
+      <version>1.0-SNAPSHOT</version>
+      <type>jar</type>
+      <classifier>slim</classifier>
+      <scope>test</scope>
+    </dependency>
 
   </dependencies>
 

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala?rev=1032370&r1=1032369&r2=1032370&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/scala/org/apache/activemq/apollo/cli/commands/Run.scala
Sun Nov  7 19:51:47 2010
@@ -85,7 +85,6 @@ class Run extends Action with Logging {
       info("Apollo Broker Service Starting");
 
       // Load the configs and start the brokers up.
-      info("log4j configured using '%s'.", getClass.getClassLoader.getResource("log4j.properties")
);
       info("Loading configurations from '%s'.", conf);
       val store = new FileConfigStore
       store.file = conf

Added: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml?rev=1032370&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/apollo.xml
Sun Nov  7 19:51:47 2010
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<broker basedir="./activemq-data/default" rev="4" enabled="true" id="default" xmlns="http://activemq.apache.org/schema/activemq/apollo">
+    <notes>
+      A default configuration
+    </notes>
+    <virtual-host purge-on-startup="false" auto-create-queues="true" enabled="true" id="default">
+        <host-name>localhost</host-name>
+        <bdb-store directory="${apollo.base}/data" flush-delay="100"/>
+    </virtual-host>
+    <connectors advertise="tcp://localhost:61613" protocol="multi" bind="tcp://0.0.0.0:61613"
enabled="true" id="default"/>
+</broker>

Added: activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/jul.properties
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/jul.properties?rev=1032370&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/jul.properties
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/test/resources/example-broker/etc/jul.properties
Sun Nov  7 19:51:47 2010
@@ -0,0 +1,25 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+# This file configures how Java Util Logging is handled.
+
+#
+# We just redirect all log events to slf4j so that all logging can be 
+# configured via log4j
+#
+handlers=org.slf4j.bridge.SLF4JBridgeHandler
+.level=INFO

Added: activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala?rev=1032370&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
(added)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/test/scala/org/apache/activemq/apollo/cli/ApolloIDERunner.scala
Sun Nov  7 19:51:47 2010
@@ -0,0 +1,83 @@
+/**
+ * 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.cli
+
+import org.junit.Test
+import java.io.File
+;
+
+/**
+ * <p>
+ * Launches the Apollo broker assuming it's being run from
+ * an IDE environment.
+ * </p>
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+object ApolloIDERunner  {
+  def main(args:Array[String]) = new ApolloIDERunner().run
+}
+
+/**
+ * The broker can be launchedas a Junit test case, that way IDE's can auto configure
+ * the proper classpath.
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+class ApolloIDERunner  {
+
+  import commands.Helper._
+
+  @Test
+  def run:Unit = {
+
+    // Let the user know where he configure logging at.
+    println("Logging was configured using '%s'.".format(getClass.getClassLoader.getResource("log4j.properties")));
+
+    // We use this to figure out where the source code is in the files system.
+    def project_base = new File(getClass.getResource("banner.txt").toURI.resolve("../../../../../../../..").toURL.getFile)
+
+    // Setups where the broker base directory is...
+    if( System.getProperty("apollo.base") == null ) {
+      val apollo_base = project_base / "apollo-cli" / "target" / "test-classes" / "example-broker"
+      System.setProperty("apollo.base", apollo_base.getCanonicalPath)
+    }
+
+    // Setup where the web app resources are...
+    if( System.getProperty("apollo.webapp") == null ) {
+      val apollo_webapp = project_base / "apollo-web"/ "src" / "main"/ "webapp"
+      System.setProperty("apollo.webapp", apollo_webapp.getCanonicalPath)
+    }
+
+    // Configure jul logging..
+    val apollo_base = new File(System.getProperty("apollo.base"))
+    val jul_properties = apollo_base / "etc" / "jul.properties"
+    System.setProperty("java.util.logging.config.file", jul_properties.getCanonicalPath)
+
+    println("=======================")
+    println("Press Enter To Shutdown")
+    println("=======================")
+
+    new Apollo().run(Array("run"))
+    System.in.read
+    println("=============")
+    println("Shutting down")
+    println("=============")
+    System.exit(0)
+  }
+
+}
\ No newline at end of file



Mime
View raw message