diff --git a/artemis-cli/pom.xml b/artemis-cli/pom.xml
index 4006d3445a..44a38b48db 100644
--- a/artemis-cli/pom.xml
+++ b/artemis-cli/pom.xml
@@ -131,8 +131,8 @@
1.9
bin
exe
- ${basedir}/target/classes/org/apache/artemis/cli/commands/bin
- activemq-service.exe
+ ${basedir}/target/classes/org/apache/activemq/artemis/cli/commands/bin/
+ artemis-service.exe
diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
index 074ced08e0..c3eb44b205 100644
--- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
+++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java
@@ -61,6 +61,19 @@ public class Create implements Action
private static final Integer HQ_PORT = 5445;
+ public static final String BIN_ARTEMIS_CMD = "bin/artemis.cmd";
+ public static final String BIN_ARTEMIS_SERVICE_EXE = "bin/artemis-service.exe";
+ public static final String BIN_ARTEMIS_SERVICE_XML = "bin/artemis-service.xml";
+ public static final String ETC_ARTEMIS_PROFILE_CMD = "etc/artemis.profile.cmd";
+ public static final String BIN_ARTEMIS = "bin/artemis";
+ public static final String BIN_ARTEMIS_SERVICE = "bin/artemis-service";
+ public static final String ETC_ARTEMIS_PROFILE = "etc/artemis.profile";
+ public static final String ETC_LOGGING_PROPERTIES = "etc/logging.properties";
+ public static final String ETC_BOOTSTRAP_XML = "etc/bootstrap.xml";
+ public static final String ETC_BROKER_XML = "etc/broker.xml";
+ public static final String ETC_ARTEMIS_ROLES_PROPERTIES = "etc/artemis-roles.properties";
+ public static final String ETC_ARTEMIS_USERS_PROPERTIES = "etc/artemis-users.properties";
+
@Arguments(description = "The instance directory to hold the broker's configuration and data", required = true)
File directory;
@@ -116,6 +129,14 @@ public class Create implements Action
}
}
+
+ /** This method is made public for the testsuite */
+ public InputStream openStream(String source)
+ {
+ return this.getClass().getResourceAsStream(source);
+ }
+
+
public Object run(ActionContext context) throws Exception
{
this.context = context;
@@ -205,34 +226,34 @@ public class Create implements Action
if (IS_WINDOWS)
{
- write("bin/artemis.cmd", null, false);
- write("bin/artemis-service.exe");
- write("bin/artemis-service.xml", filters, false);
- write("etc/artemis.profile.cmd", filters, false);
+ write(BIN_ARTEMIS_CMD, null, false);
+ write(BIN_ARTEMIS_SERVICE_EXE);
+ write(BIN_ARTEMIS_SERVICE_XML, filters, false);
+ write(ETC_ARTEMIS_PROFILE_CMD, filters, false);
}
if (!IS_WINDOWS || IS_CYGWIN)
{
- write("bin/artemis", null, true);
- makeExec("bin/artemis");
- write("bin/artemis-service", null, true);
- makeExec("bin/artemis-service");
- write("etc/artemis.profile", filters, true);
- makeExec("etc/artemis.profile");
+ write(BIN_ARTEMIS, null, true);
+ makeExec(BIN_ARTEMIS);
+ write(BIN_ARTEMIS_SERVICE, null, true);
+ makeExec(BIN_ARTEMIS_SERVICE);
+ write(ETC_ARTEMIS_PROFILE, filters, true);
+ makeExec(ETC_ARTEMIS_PROFILE);
}
- write("etc/logging.properties", null, false);
- write("etc/bootstrap.xml", null, false);
- write("etc/broker.xml", filters, false);
- write("etc/artemis-roles.properties", null, false);
- write("etc/artemis-users.properties", null, false);
+ write(ETC_LOGGING_PROPERTIES, null, false);
+ write(ETC_BOOTSTRAP_XML, null, false);
+ write(ETC_BROKER_XML, filters, false);
+ write(ETC_ARTEMIS_ROLES_PROPERTIES, null, false);
+ write(ETC_ARTEMIS_USERS_PROPERTIES, null, false);
context.out.println("");
context.out.println("You can now start the broker by executing: ");
context.out.println("");
context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/artemis"), true)));
- File service = new File(directory, "bin/artemis-service");
+ File service = new File(directory, BIN_ARTEMIS_SERVICE);
context.out.println("");
if (!IS_WINDOWS || IS_CYGWIN)
@@ -351,7 +372,7 @@ public class Create implements Action
private String readTextFile(String source) throws IOException
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
- try (InputStream in = this.getClass().getResourceAsStream(source))
+ try (InputStream in = openStream(source))
{
copy(in, out);
}
@@ -367,7 +388,7 @@ public class Create implements Action
}
try (FileOutputStream fout = new FileOutputStream(target))
{
- try (InputStream in = this.getClass().getResourceAsStream(source))
+ try (InputStream in = openStream(source))
{
copy(in, fout);
}
diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
index 5e8f5000cc..c9384ca181 100755
--- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
+++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/bin/artemis.cmd
@@ -25,7 +25,7 @@ set ARTEMIS_INSTANCE=%CD%
POPD
:CHECK_ARTEMIS_INSTANCE
-if exist "%ARTEMIS_INSTANCE%\bin\activemq.cmd" goto CHECK_JAVA
+if exist "%ARTEMIS_INSTANCE%\bin\artemis.cmd" goto CHECK_JAVA
:NO_HOME
echo ARTEMIS_INSTANCE environment variable is set incorrectly. Please set ARTEMIS_INSTANCE.
diff --git a/artemis-cli/src/test/java/org/apache/activemq/artemis/test/StreamClassPathTest.java b/artemis-cli/src/test/java/org/apache/activemq/artemis/test/StreamClassPathTest.java
new file mode 100644
index 0000000000..d46d3c6f09
--- /dev/null
+++ b/artemis-cli/src/test/java/org/apache/activemq/artemis/test/StreamClassPathTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.artemis.test;
+
+import java.io.InputStream;
+
+import org.apache.activemq.artemis.cli.commands.Create;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class StreamClassPathTest
+{
+
+ /** Validate if all the known resources are available on the classpath for the jar */
+ @Test
+ public void testFindStreams() throws Exception
+ {
+ openStream(Create.BIN_ARTEMIS_CMD);
+ openStream(Create.BIN_ARTEMIS_SERVICE_EXE);
+ openStream(Create.BIN_ARTEMIS_SERVICE_XML);
+ openStream(Create.ETC_ARTEMIS_PROFILE_CMD);
+ openStream(Create.BIN_ARTEMIS);
+ openStream(Create.BIN_ARTEMIS_SERVICE);
+ openStream(Create.ETC_ARTEMIS_PROFILE);
+ openStream(Create.ETC_LOGGING_PROPERTIES);
+ openStream(Create.ETC_BOOTSTRAP_XML);
+ openStream(Create.ETC_BROKER_XML);
+ openStream(Create.ETC_ARTEMIS_ROLES_PROPERTIES);
+ openStream(Create.ETC_ARTEMIS_USERS_PROPERTIES);
+ }
+
+
+ private void openStream(String source) throws Exception
+ {
+ Create create = new Create();
+ InputStream in = create.openStream(source);
+ Assert.assertNotNull(source + " not found", in);
+ in.close();
+ }
+}
diff --git a/artemis-cli/src/test/resources/broker.xml b/artemis-cli/src/test/resources/broker.xml
index b420ad8478..df5610dd83 100644
--- a/artemis-cli/src/test/resources/broker.xml
+++ b/artemis-cli/src/test/resources/broker.xml
@@ -30,7 +30,7 @@ under the License.
./target/journal
- 10
+ 2
./target/large-messages