You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2012/08/28 22:55:32 UTC

svn commit: r1378333 - in /activemq/activemq-apollo/trunk: apollo-boot/ apollo-boot/src/main/java/org/apache/activemq/apollo/boot/ apollo-boot/src/test/java/ apollo-boot/src/test/java/org/ apollo-boot/src/test/java/org/apache/ apollo-boot/src/test/java...

Author: chirino
Date: Tue Aug 28 20:55:31 2012
New Revision: 1378333

URL: http://svn.apache.org/viewvc?rev=1378333&view=rev
Log:
Fixes APLO-246: Cannot start Apollo as a windows service when not on C drive

Applied Christian Posta's patch.  Many thanks.
Also update to the winsw version to 1.9 so that you can install as a service on windows vista and later.

Added:
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/boot/
    activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/boot/ApolloTest.java
Modified:
    activemq/activemq-apollo/trunk/apollo-boot/pom.xml
    activemq/activemq-apollo/trunk/apollo-boot/src/main/java/org/apache/activemq/apollo/boot/Apollo.java
    activemq/activemq-apollo/trunk/apollo-cli/pom.xml
    activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml
    activemq/activemq-apollo/trunk/apollo-distro/src/main/descriptors/windows-bin.xml
    activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo
    activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo.cmd

Modified: activemq/activemq-apollo/trunk/apollo-boot/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-boot/pom.xml?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-boot/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-boot/pom.xml Tue Aug 28 20:55:31 2012
@@ -33,4 +33,13 @@
 
   <name>${project.artifactId}</name>
 
+    <dependencies>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>${junit-version}</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
 </project>

Modified: activemq/activemq-apollo/trunk/apollo-boot/src/main/java/org/apache/activemq/apollo/boot/Apollo.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-boot/src/main/java/org/apache/activemq/apollo/boot/Apollo.java?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-boot/src/main/java/org/apache/activemq/apollo/boot/Apollo.java (original)
+++ activemq/activemq-apollo/trunk/apollo-boot/src/main/java/org/apache/activemq/apollo/boot/Apollo.java Tue Aug 28 20:55:31 2012
@@ -37,15 +37,15 @@ public class Apollo {
    public static void main(String[] args) throws Throwable, NoSuchMethodException, IllegalAccessException {
        LinkedList<String> argList = new LinkedList<String>(Arrays.asList(args));
        if( argList.isEmpty() ) {
-           System.err.println("Usage "+Apollo.class.getName()+" <bootdir>(:<bootdir>)* <main-class> <arg>*");
+           System.err.println("Usage "+Apollo.class.getName()+" <bootdir>(;<bootdir>)* <main-class> <arg>*");
            System.err.println();
            System.err.println("Mising <bootdir>");
            System.exit(2);
        }
-       String[] bootdirs = argList.removeFirst().split(":");
+       String[] bootdirs = resolveBootDirs(argList);
 
        if( argList.isEmpty() ) {
-           System.err.println("Usage "+Apollo.class.getName()+" <bootdir>(:<bootdir>)* <main-class> <arg>*");
+           System.err.println("Usage "+Apollo.class.getName()+" <bootdir>(;<bootdir>)* <main-class> <arg>*");
            System.err.println();
            System.err.println("Mising <main-class>");
            System.exit(2);
@@ -111,6 +111,10 @@ public class Apollo {
 
    }
 
+   protected static String[] resolveBootDirs(LinkedList<String> argList) {
+       return argList.removeFirst().split(";");
+   }
+
    static private void add(ArrayList<URL> urls, File file) {
        try {
            urls.add(file.toURI().toURL());

Added: activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/boot/ApolloTest.java
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/boot/ApolloTest.java?rev=1378333&view=auto
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/boot/ApolloTest.java (added)
+++ activemq/activemq-apollo/trunk/apollo-boot/src/test/java/org/apache/activemq/apollo/boot/ApolloTest.java Tue Aug 28 20:55:31 2012
@@ -0,0 +1,46 @@
+/**
+ * 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.boot;
+
+import org.junit.Test;
+
+import java.util.LinkedList;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author <a href="http://www.christianposta.com/blog">Christian Posta</a>
+ */
+public class ApolloTest {
+    private static final String DIR_SEPARATOR = ";";
+
+    @Test
+    public void testResolveBootDirsAsSeenOnWindows() {
+        LinkedList<String> args = new LinkedList<String>();
+        args.add("D:\\apache-apollo-1.4\\lib"+ DIR_SEPARATOR +"D:\\apache-apollo\\myboker\\lib");
+        String[] bootDirs = Apollo.resolveBootDirs(args);
+        assertEquals("The correct number of boot dirs was not found", 2, bootDirs.length);
+    }
+
+    @Test
+    public void testResolveBootDirsAsSeenOnLinux() {
+        LinkedList<String> args = new LinkedList<String>();
+        args.add("/Users/cposta/dev/apache-apollo-1.4/lib"+ DIR_SEPARATOR+"/Users/cposta/dev/apache-apollo-1.4/mybroker/lib");
+        String[] bootDirs = Apollo.resolveBootDirs(args);
+        assertEquals("The correct number of boot dirs was not found", 2, bootDirs.length);
+    }
+}

Modified: activemq/activemq-apollo/trunk/apollo-cli/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/pom.xml?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/pom.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/pom.xml Tue Aug 28 20:55:31 2012
@@ -89,7 +89,7 @@
     <dependency>
       <groupId>com.sun.winsw</groupId>
       <artifactId>winsw</artifactId>
-      <version>1.8</version>
+      <version>1.9</version>
       <classifier>bin</classifier>
       <type>exe</type>
       <scope>test</scope>
@@ -230,7 +230,7 @@
                 <artifactItem>
                   <groupId>com.sun.winsw</groupId>
                   <artifactId>winsw</artifactId>
-                  <version>1.8</version>
+                  <version>1.9</version>
                   <classifier>bin</classifier>
                   <type>exe</type>
                   <outputDirectory>${basedir}/target/classes/org/apache/activemq/apollo/cli/commands/bin</outputDirectory>

Modified: activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-cli/src/main/resources/org/apache/activemq/apollo/cli/commands/bin/apollo-broker-service.xml Tue Aug 28 20:55:31 2012
@@ -18,7 +18,7 @@
 -->
 
 <service>
-  <id>org.apache.activemq.apollo.${host}</id>
+  <id>apollo-${host}</id>
   <name>Apollo: ${host}</name>
   <description>Apache Apollo is a reliable messaging broker</description>
 
@@ -36,7 +36,7 @@
   <argument>-classpath</argument>
   <argument>"${base}\etc;${home}\lib\apollo-boot.jar"</argument>
   <argument>org.apache.activemq.apollo.boot.Apollo</argument>
-  <argument>"${base}\lib:${home}\lib"</argument>
+  <argument>"${base}\lib;${home}\lib"</argument>
   <argument>org.apache.activemq.apollo.cli.Apollo</argument>
   <argument>run</argument>
 

Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/descriptors/windows-bin.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/descriptors/windows-bin.xml?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/descriptors/windows-bin.xml (original)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/descriptors/windows-bin.xml Tue Aug 28 20:55:31 2012
@@ -51,7 +51,7 @@
       <includes>
         <include>**/pom.xml</include>
       </includes>
-      <lineEnding>unix</lineEnding>
+      <lineEnding>dos</lineEnding>
       <filtered>true</filtered>
     </fileSet>
 

Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo (original)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo Tue Aug 28 20:55:31 2012
@@ -105,7 +105,7 @@ CLASSPATH="${APOLLO_HOME}/lib/apollo-boo
 
 BOOTDIRS="${APOLLO_HOME}/lib"
 if [ ! -z "$APOLLO_BASE" ] ; then
-  BOOTDIRS="${APOLLO_BASE}/lib:${BOOTDIRS}"
+  BOOTDIRS="${APOLLO_BASE}/lib\;${BOOTDIRS}"
 fi
 
 # For Cygwin, switch paths to Windows format before running java

Modified: activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo.cmd
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo.cmd?rev=1378333&r1=1378332&r2=1378333&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo.cmd (original)
+++ activemq/activemq-apollo/trunk/apollo-distro/src/main/release/bin/apollo.cmd Tue Aug 28 20:55:31 2012
@@ -50,7 +50,7 @@ echo.
 set CLASSPATH=%APOLLO_HOME%\lib\apollo-boot.jar
 
 set BOOTDIRS=%APOLLO_HOME%\lib
-if NOT "x%APOLLO_BASE%" == "x" set BOOTDIRS=%APOLLO_BASE%\lib:%BOOTDIRS%
+if NOT "x%APOLLO_BASE%" == "x" set BOOTDIRS=%APOLLO_BASE%\lib;%BOOTDIRS%
 
 if "%JVM_FLAGS%" == "" set JVM_FLAGS=-server -Xmx1G -XX:-UseBiasedLocking