Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public void testBadMessagePropertyType() throws Exception {
producer.setProperties(createJsonProperty("myType", "myKey", "myValue"));
producer.applyProperties(mockMessage);

assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string.\n", context.getStderr());
assertEquals("Unable to set property: myKey. Did not recognize type: myType. Supported types are: boolean, int, long, byte, short, float, double, string.\n", context.getStderr().replace("\r\n", "\n"));
}

private static String createJsonProperty(String type, String key, String value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,18 @@ public boolean purePing(InetAddress address) throws IOException, InterruptedExce
@Test
@Timeout(30)
public void testPurePingTimeout() throws Exception {
NetworkHealthCheck check = new NetworkHealthCheck(null, 100, 2000);
int timeout = 2000;

// Add a "tolerance" for Windows, since it reports less time spent in timeout than the networkTimeout parameter (around 200ms)
int tolerance = 500;

NetworkHealthCheck check = new NetworkHealthCheck(null, 100, timeout);

long time = System.currentTimeMillis();
//[RFC1166] reserves the address block 192.0.2.0/24 for test.
assertFalse(check.purePing(InetAddress.getByName("192.0.2.0")));
assertTrue(System.currentTimeMillis() - time >= 2000);

assertTrue(System.currentTimeMillis() - time >= (timeout - tolerance));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,26 @@
public class XmlUtilTest extends ArtemisTestCase {

@Test
public void testPropertySubstituion(@TempDir Path tempDir) throws Exception {
public void testPropertySubstitution(@TempDir Path tempDir) throws Exception {
final String SYSTEM_PROP_NAME = getTestMethodName() + "SysPropName";
final String SYSTEM_PROP_VALUE = getTestMethodName() + "SysPropValue";
System.setProperty(SYSTEM_PROP_NAME, SYSTEM_PROP_VALUE);

// since System.getenv() returns an immutable Map we rely here on an environment variable that is likely to exist
final String ENV_VAR_NAME = "HOME";
String ENV_VAR_NAME = "HOME";

// override to USERPROFILE if OS is windows
if (System.getProperty("os.name").toLowerCase().contains("win")) {
ENV_VAR_NAME = "USERPROFILE";
}

BrokerDTO brokerDTO = getBrokerDTO(tempDir, SYSTEM_PROP_NAME, ENV_VAR_NAME);
assertEquals(SYSTEM_PROP_VALUE, ((JaasSecurityDTO)brokerDTO.security).domain);
assertEquals(System.getenv(ENV_VAR_NAME), brokerDTO.server.configuration);
}

@Test
public void testPropertySubstituionPrecedence(@TempDir Path tempDir) throws Exception {
public void testPropertySubstitutionPrecedence(@TempDir Path tempDir) throws Exception {
final String SYSTEM_PROP_NAME = "HOME";
final String SYSTEM_PROP_VALUE = getTestMethodName() + "SysPropValue";
System.setProperty(SYSTEM_PROP_NAME, SYSTEM_PROP_VALUE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2969,12 +2969,15 @@ public void testRegxPropertiesFilesInDir() throws Exception {
File tmpFile = File.createTempFile("a_stuff", ".properties", temporaryFolder);
Properties properties = new Properties();
properties.put("name", "a");
properties.store(new FileOutputStream(tmpFile), null);

try (FileOutputStream out = new FileOutputStream(tmpFile)) {
properties.store(out, null);
}
tmpFile = File.createTempFile("b_stuff", ".0-properties", temporaryFolder);
properties = new Properties();
properties.put("name", "0");
properties.store(new FileOutputStream(tmpFile), null);
try (FileOutputStream out = new FileOutputStream(tmpFile)) {
properties.store(out, null);
}

ConfigurationImpl configuration = new ConfigurationImpl();
configuration.parseProperties(temporaryFolder + "/");
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,9 @@
-Djava.library.path="${activemq.basedir}/target/bin/lib/linux-x86_64:${activemq.basedir}/target/bin/lib/linux-i686"
-Djgroups.bind_addr=localhost
-Djava.net.preferIPv4Stack=true
-Dbasedir=${basedir}
-Djdk.attach.allowAttachSelf=true
-Dartemis.distribution.output="${artemis.distribution.output}"
-Dlog4j2.configurationFile="file:${activemq.basedir}/tests/config/${logging.config}"
-Dlog4j2.configurationFile="${activemq.basedir}/tests/config/${logging.config}"
</activemq-surefire-argline>
<activemq.basedir>${project.basedir}</activemq.basedir>
<proton.trace.frames>false</proton.trace.frames>
Expand Down