NO-JIRA fixing NettySecurityClientTest
This commit is contained in:
parent
1f82c783a7
commit
c82ac631b8
|
@ -18,20 +18,28 @@
|
||||||
package org.apache.activemq.artemis.core.remoting.impl.netty;
|
package org.apache.activemq.artemis.core.remoting.impl.netty;
|
||||||
|
|
||||||
import org.apache.activemq.artemis.utils.Env;
|
import org.apache.activemq.artemis.utils.Env;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tells if <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-epoll}</a> is supported.
|
* Tells if <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-epoll}</a> is supported.
|
||||||
*/
|
*/
|
||||||
public final class Epoll {
|
public final class Epoll {
|
||||||
|
|
||||||
private static final boolean IS_AVAILABLE_EPOLL;
|
private static final Logger logger = Logger.getLogger(Epoll.class);
|
||||||
|
private static final boolean IS_AVAILABLE_EPOLL = isIsAvailableEpoll();
|
||||||
|
|
||||||
static {
|
private static boolean isIsAvailableEpoll() {
|
||||||
|
try {
|
||||||
if (Env.is64BitJvm() && Env.isLinuxOs()) {
|
if (Env.is64BitJvm() && Env.isLinuxOs()) {
|
||||||
IS_AVAILABLE_EPOLL = io.netty.channel.epoll.Epoll.isAvailable();
|
return io.netty.channel.epoll.Epoll.isAvailable();
|
||||||
} else {
|
} else {
|
||||||
IS_AVAILABLE_EPOLL = false;
|
return false;
|
||||||
}
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.warn(e.getMessage(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Epoll() {
|
private Epoll() {
|
||||||
|
|
|
@ -164,7 +164,7 @@ public class JournalCrashTest extends ActiveMQTestBase {
|
||||||
*/
|
*/
|
||||||
private void runExternalProcess(final String tempDir, final int start, final int end) throws Exception {
|
private void runExternalProcess(final String tempDir, final int start, final int end) throws Exception {
|
||||||
System.err.println("running external process...");
|
System.err.println("running external process...");
|
||||||
Process process = SpawnedVMSupport.spawnVM(this.getClass().getCanonicalName(), "-Xms128m", "-Xmx128m", new String[]{}, true, true, tempDir, Integer.toString(start), Integer.toString(end));
|
Process process = SpawnedVMSupport.spawnVM(this.getClass().getCanonicalName(), "-Xms128m", "-Xmx128m", new String[]{}, true, true, true, tempDir, Integer.toString(start), Integer.toString(end));
|
||||||
|
|
||||||
Assert.assertEquals(100, process.waitFor());
|
Assert.assertEquals(100, process.waitFor());
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RealNodeManagerTest extends NodeManagerTest {
|
||||||
public void performWork(NodeManagerAction... actions) throws Exception {
|
public void performWork(NodeManagerAction... actions) throws Exception {
|
||||||
List<Process> processes = new ArrayList<>();
|
List<Process> processes = new ArrayList<>();
|
||||||
for (NodeManagerAction action : actions) {
|
for (NodeManagerAction action : actions) {
|
||||||
Process p = SpawnedVMSupport.spawnVM(NodeManagerAction.class.getName(), "-Xms512m", "-Xmx512m", new String[0], true, true, action.getWork());
|
Process p = SpawnedVMSupport.spawnVM(NodeManagerAction.class.getName(), "-Xms512m", "-Xmx512m", new String[0], true, true, true, action.getWork());
|
||||||
processes.add(p);
|
processes.add(p);
|
||||||
}
|
}
|
||||||
for (Process process : processes) {
|
for (Process process : processes) {
|
||||||
|
|
|
@ -66,14 +66,13 @@ public class NettySecurityClientTest extends ActiveMQTestBase {
|
||||||
|
|
||||||
// spawn a JVM that creates a client with a security manager which sends and receives a
|
// spawn a JVM that creates a client with a security manager which sends and receives a
|
||||||
// test message
|
// test message
|
||||||
Process p = SpawnedVMSupport.spawnVM(SimpleClient.class.getName(), "-Xms512m", "-Xmx512m", vmargs, false, true, new String[]{NETTY_CONNECTOR_FACTORY});
|
Process p = SpawnedVMSupport.spawnVM(SimpleClient.class.getName(), "-Xms512m", "-Xmx512m", vmargs, true, true, false, new String[]{NETTY_CONNECTOR_FACTORY});
|
||||||
|
|
||||||
InputStreamReader isr = new InputStreamReader(p.getInputStream());
|
InputStreamReader isr = new InputStreamReader(p.getInputStream());
|
||||||
|
|
||||||
BufferedReader br = new BufferedReader(isr);
|
BufferedReader br = new BufferedReader(isr);
|
||||||
String line = null;
|
String line = null;
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
//System.out.println(line);
|
|
||||||
line = line.replace('|', '\n');
|
line = line.replace('|', '\n');
|
||||||
if (line.startsWith("Listening")) {
|
if (line.startsWith("Listening")) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -37,12 +37,14 @@ final class SimpleClient {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
throw new Exception("require 1 argument: connector factory class name");
|
throw new Exception("require 1 argument: connector factory class name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println("I'm here");
|
||||||
String connectorFactoryClassName = args[0];
|
String connectorFactoryClassName = args[0];
|
||||||
|
|
||||||
String queueName = RandomUtil.randomString();
|
String queueName = RandomUtil.randomString();
|
||||||
String messageText = RandomUtil.randomString();
|
String messageText = RandomUtil.randomString();
|
||||||
|
|
||||||
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(connectorFactoryClassName));
|
ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(new TransportConfiguration(connectorFactoryClassName)).setReconnectAttempts(1).setInitialConnectAttempts(1);
|
||||||
try {
|
try {
|
||||||
ClientSessionFactory sf = locator.createSessionFactory();
|
ClientSessionFactory sf = locator.createSessionFactory();
|
||||||
ClientSession session = sf.createSession(false, true, true);
|
ClientSession session = sf.createSession(false, true, true);
|
||||||
|
@ -77,6 +79,7 @@ final class SimpleClient {
|
||||||
locator.close();
|
locator.close();
|
||||||
}
|
}
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
|
t.printStackTrace(System.out);
|
||||||
|
|
||||||
String allStack = t.getMessage() + "|";
|
String allStack = t.getMessage() + "|";
|
||||||
StackTraceElement[] stackTrace = t.getStackTrace();
|
StackTraceElement[] stackTrace = t.getStackTrace();
|
||||||
|
|
|
@ -29,6 +29,9 @@ grant {
|
||||||
permission java.util.PropertyPermission "activemq.artemis.client.global.thread.pool.max.size", "read";
|
permission java.util.PropertyPermission "activemq.artemis.client.global.thread.pool.max.size", "read";
|
||||||
permission java.util.PropertyPermission "activemq.artemis.client.global.scheduled.thread.pool.core.size", "read";
|
permission java.util.PropertyPermission "activemq.artemis.client.global.scheduled.thread.pool.core.size", "read";
|
||||||
permission java.util.PropertyPermission "io.netty.eventLoopThreads", "read";
|
permission java.util.PropertyPermission "io.netty.eventLoopThreads", "read";
|
||||||
|
permission java.util.PropertyPermission "io.netty.maxThreadLocalCharBufferSize", "read";
|
||||||
|
permission java.util.PropertyPermission "io.netty.batch.bytes", "read";
|
||||||
|
permission java.util.PropertyPermission "com.ibm.vm.bitmode", "read";
|
||||||
permission java.util.PropertyPermission "io.netty.noUnsafe", "read";
|
permission java.util.PropertyPermission "io.netty.noUnsafe", "read";
|
||||||
permission java.util.PropertyPermission "io.netty.tryUnsafe", "read";
|
permission java.util.PropertyPermission "io.netty.tryUnsafe", "read";
|
||||||
permission java.util.PropertyPermission "org.jboss.netty.tryUnsafe", "read";
|
permission java.util.PropertyPermission "org.jboss.netty.tryUnsafe", "read";
|
||||||
|
|
|
@ -57,7 +57,7 @@ public final class SpawnedVMSupport {
|
||||||
final String[] vmargs,
|
final String[] vmargs,
|
||||||
final boolean logOutput,
|
final boolean logOutput,
|
||||||
final String... args) throws Exception {
|
final String... args) throws Exception {
|
||||||
return SpawnedVMSupport.spawnVM(className, "-Xms512m", "-Xmx512m", vmargs, logOutput, true, args);
|
return SpawnedVMSupport.spawnVM(className, "-Xms512m", "-Xmx512m", vmargs, logOutput, true, true, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Process spawnVMWithLogMacher(String wordMatch,
|
public static Process spawnVMWithLogMacher(String wordMatch,
|
||||||
|
@ -66,7 +66,7 @@ public final class SpawnedVMSupport {
|
||||||
final String[] vmargs,
|
final String[] vmargs,
|
||||||
final boolean logOutput,
|
final boolean logOutput,
|
||||||
final String... args) throws Exception {
|
final String... args) throws Exception {
|
||||||
return SpawnedVMSupport.spawnVM(wordMatch, runnable, className, "-Xms512m", "-Xmx512m", vmargs, logOutput, true, args);
|
return SpawnedVMSupport.spawnVM(wordMatch, runnable, className, "-Xms512m", "-Xmx512m", vmargs, logOutput, true, true, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Process spawnVM(final String className,
|
public static Process spawnVM(final String className,
|
||||||
|
@ -75,8 +75,9 @@ public final class SpawnedVMSupport {
|
||||||
final String[] vmargs,
|
final String[] vmargs,
|
||||||
final boolean logOutput,
|
final boolean logOutput,
|
||||||
final boolean logErrorOutput,
|
final boolean logErrorOutput,
|
||||||
|
final boolean useLogging,
|
||||||
final String... args) throws Exception {
|
final String... args) throws Exception {
|
||||||
return spawnVM(null, null, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, args);
|
return spawnVM(null, null, className, memoryArg1, memoryArg2, vmargs, logOutput, logErrorOutput, useLogging, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Process spawnVM(final String wordMatch,
|
public static Process spawnVM(final String wordMatch,
|
||||||
|
@ -87,6 +88,7 @@ public final class SpawnedVMSupport {
|
||||||
final String[] vmargs,
|
final String[] vmargs,
|
||||||
final boolean logOutput,
|
final boolean logOutput,
|
||||||
final boolean logErrorOutput,
|
final boolean logErrorOutput,
|
||||||
|
final boolean useLogging,
|
||||||
final String... args) throws Exception {
|
final String... args) throws Exception {
|
||||||
ProcessBuilder builder = new ProcessBuilder();
|
ProcessBuilder builder = new ProcessBuilder();
|
||||||
final String javaPath = Paths.get(System.getProperty("java.home"), "bin", "java").toAbsolutePath().toString();
|
final String javaPath = Paths.get(System.getProperty("java.home"), "bin", "java").toAbsolutePath().toString();
|
||||||
|
@ -102,8 +104,10 @@ public final class SpawnedVMSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
// The logs will be huge if you don't set this
|
// The logs will be huge if you don't set this
|
||||||
|
if (useLogging) {
|
||||||
commandList.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
|
commandList.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
|
||||||
commandList.add("-Dlogging.configuration=file:../config/logging.properties");
|
commandList.add("-Dlogging.configuration=file:../config/logging.properties");
|
||||||
|
}
|
||||||
|
|
||||||
commandList.add("-Djava.io.tmpdir=" + System.getProperty("java.io.tmpdir", "./tmp"));
|
commandList.add("-Djava.io.tmpdir=" + System.getProperty("java.io.tmpdir", "./tmp"));
|
||||||
commandList.add("-Djava.library.path=" + System.getProperty("java.library.path", "./native/bin"));
|
commandList.add("-Djava.library.path=" + System.getProperty("java.library.path", "./native/bin"));
|
||||||
|
|
Loading…
Reference in New Issue