This closes #248 Windows fixes
This commit is contained in:
commit
e2e1c3f95d
|
@ -131,8 +131,8 @@
|
||||||
<version>1.9</version>
|
<version>1.9</version>
|
||||||
<classifier>bin</classifier>
|
<classifier>bin</classifier>
|
||||||
<type>exe</type>
|
<type>exe</type>
|
||||||
<outputDirectory>${basedir}/target/classes/org/apache/artemis/cli/commands/bin</outputDirectory>
|
<outputDirectory>${basedir}/target/classes/org/apache/activemq/artemis/cli/commands/bin/</outputDirectory>
|
||||||
<destFileName>activemq-service.exe</destFileName>
|
<destFileName>artemis-service.exe</destFileName>
|
||||||
</artifactItem>
|
</artifactItem>
|
||||||
</artifactItems>
|
</artifactItems>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
|
@ -61,6 +61,19 @@ public class Create implements Action
|
||||||
|
|
||||||
private static final Integer HQ_PORT = 5445;
|
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)
|
@Arguments(description = "The instance directory to hold the broker's configuration and data", required = true)
|
||||||
File directory;
|
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
|
public Object run(ActionContext context) throws Exception
|
||||||
{
|
{
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
@ -205,34 +226,34 @@ public class Create implements Action
|
||||||
|
|
||||||
if (IS_WINDOWS)
|
if (IS_WINDOWS)
|
||||||
{
|
{
|
||||||
write("bin/artemis.cmd", null, false);
|
write(BIN_ARTEMIS_CMD, null, false);
|
||||||
write("bin/artemis-service.exe");
|
write(BIN_ARTEMIS_SERVICE_EXE);
|
||||||
write("bin/artemis-service.xml", filters, false);
|
write(BIN_ARTEMIS_SERVICE_XML, filters, false);
|
||||||
write("etc/artemis.profile.cmd", filters, false);
|
write(ETC_ARTEMIS_PROFILE_CMD, filters, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_WINDOWS || IS_CYGWIN)
|
if (!IS_WINDOWS || IS_CYGWIN)
|
||||||
{
|
{
|
||||||
write("bin/artemis", null, true);
|
write(BIN_ARTEMIS, null, true);
|
||||||
makeExec("bin/artemis");
|
makeExec(BIN_ARTEMIS);
|
||||||
write("bin/artemis-service", null, true);
|
write(BIN_ARTEMIS_SERVICE, null, true);
|
||||||
makeExec("bin/artemis-service");
|
makeExec(BIN_ARTEMIS_SERVICE);
|
||||||
write("etc/artemis.profile", filters, true);
|
write(ETC_ARTEMIS_PROFILE, filters, true);
|
||||||
makeExec("etc/artemis.profile");
|
makeExec(ETC_ARTEMIS_PROFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
write("etc/logging.properties", null, false);
|
write(ETC_LOGGING_PROPERTIES, null, false);
|
||||||
write("etc/bootstrap.xml", null, false);
|
write(ETC_BOOTSTRAP_XML, null, false);
|
||||||
write("etc/broker.xml", filters, false);
|
write(ETC_BROKER_XML, filters, false);
|
||||||
write("etc/artemis-roles.properties", null, false);
|
write(ETC_ARTEMIS_ROLES_PROPERTIES, null, false);
|
||||||
write("etc/artemis-users.properties", null, false);
|
write(ETC_ARTEMIS_USERS_PROPERTIES, null, false);
|
||||||
|
|
||||||
context.out.println("");
|
context.out.println("");
|
||||||
context.out.println("You can now start the broker by executing: ");
|
context.out.println("You can now start the broker by executing: ");
|
||||||
context.out.println("");
|
context.out.println("");
|
||||||
context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/artemis"), true)));
|
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("");
|
context.out.println("");
|
||||||
|
|
||||||
if (!IS_WINDOWS || IS_CYGWIN)
|
if (!IS_WINDOWS || IS_CYGWIN)
|
||||||
|
@ -351,7 +372,7 @@ public class Create implements Action
|
||||||
private String readTextFile(String source) throws IOException
|
private String readTextFile(String source) throws IOException
|
||||||
{
|
{
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
try (InputStream in = this.getClass().getResourceAsStream(source))
|
try (InputStream in = openStream(source))
|
||||||
{
|
{
|
||||||
copy(in, out);
|
copy(in, out);
|
||||||
}
|
}
|
||||||
|
@ -367,7 +388,7 @@ public class Create implements Action
|
||||||
}
|
}
|
||||||
try (FileOutputStream fout = new FileOutputStream(target))
|
try (FileOutputStream fout = new FileOutputStream(target))
|
||||||
{
|
{
|
||||||
try (InputStream in = this.getClass().getResourceAsStream(source))
|
try (InputStream in = openStream(source))
|
||||||
{
|
{
|
||||||
copy(in, fout);
|
copy(in, fout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ set ARTEMIS_INSTANCE=%CD%
|
||||||
POPD
|
POPD
|
||||||
|
|
||||||
:CHECK_ARTEMIS_INSTANCE
|
: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
|
:NO_HOME
|
||||||
echo ARTEMIS_INSTANCE environment variable is set incorrectly. Please set ARTEMIS_INSTANCE.
|
echo ARTEMIS_INSTANCE environment variable is set incorrectly. Please set ARTEMIS_INSTANCE.
|
||||||
|
|
|
@ -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();
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,7 +30,7 @@ under the License.
|
||||||
|
|
||||||
<journal-directory>./target/journal</journal-directory>
|
<journal-directory>./target/journal</journal-directory>
|
||||||
|
|
||||||
<journal-min-files>10</journal-min-files>
|
<journal-min-files>2</journal-min-files>
|
||||||
|
|
||||||
<large-messages-directory>./target/large-messages</large-messages-directory>
|
<large-messages-directory>./target/large-messages</large-messages-directory>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue