[1/3] activemq-artemis git commit: NO-JIRA fixing NettySecurityClientTest

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/3] activemq-artemis git commit: NO-JIRA fixing NettySecurityClientTest

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 1f82c783a -> cc4c3957b


NO-JIRA fixing NettySecurityClientTest


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/c82ac631
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/c82ac631
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/c82ac631

Branch: refs/heads/master
Commit: c82ac631b8a49136c597724432b9a80c42bfe6cc
Parents: 1f82c78
Author: Clebert Suconic <[hidden email]>
Authored: Tue Apr 18 12:43:58 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Tue Apr 18 15:14:21 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/remoting/impl/netty/Epoll.java | 22 +++++++++++++-------
 .../integration/client/JournalCrashTest.java    |  2 +-
 .../cluster/RealNodeManagerTest.java            |  2 +-
 .../security/NettySecurityClientTest.java       |  3 +--
 .../integration/security/SimpleClient.java      |  5 ++++-
 .../resources/restricted-security-client.policy |  3 +++
 .../artemis/tests/util/SpawnedVMSupport.java    | 14 ++++++++-----
 7 files changed, 34 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/Epoll.java
----------------------------------------------------------------------
diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/Epoll.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/Epoll.java
index 96af017..40612d4 100644
--- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/Epoll.java
+++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/Epoll.java
@@ -18,20 +18,28 @@
 package org.apache.activemq.artemis.core.remoting.impl.netty;
 
 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.
  */
 public final class Epoll {
 
-   private static final boolean IS_AVAILABLE_EPOLL;
-
-   static {
-      if (Env.is64BitJvm() && Env.isLinuxOs()) {
-         IS_AVAILABLE_EPOLL = io.netty.channel.epoll.Epoll.isAvailable();
-      } else {
-         IS_AVAILABLE_EPOLL = false;
+   private static final Logger logger = Logger.getLogger(Epoll.class);
+   private static final boolean IS_AVAILABLE_EPOLL = isIsAvailableEpoll();
+
+   private static boolean isIsAvailableEpoll() {
+      try {
+         if (Env.is64BitJvm() && Env.isLinuxOs()) {
+            return io.netty.channel.epoll.Epoll.isAvailable();
+         } else {
+            return false;
+         }
+      } catch (Throwable e) {
+         logger.warn(e.getMessage(), e);
+         return false;
       }
+
    }
 
    private Epoll() {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java
index 88bfd7a..49453d3 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java
@@ -164,7 +164,7 @@ public class JournalCrashTest extends ActiveMQTestBase {
     */
    private void runExternalProcess(final String tempDir, final int start, final int end) throws Exception {
       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());
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java
index 3484932..1a49f94 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java
@@ -45,7 +45,7 @@ public class RealNodeManagerTest extends NodeManagerTest {
    public void performWork(NodeManagerAction... actions) throws Exception {
       List<Process> processes = new ArrayList<>();
       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);
       }
       for (Process process : processes) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java
index 8c876b2..a908f79 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/NettySecurityClientTest.java
@@ -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
       // 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());
 
       BufferedReader br = new BufferedReader(isr);
       String line = null;
       while ((line = br.readLine()) != null) {
-         //System.out.println(line);
          line = line.replace('|', '\n');
          if (line.startsWith("Listening")) {
             continue;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java
index 0dd9eb6..65c980b 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SimpleClient.java
@@ -37,12 +37,14 @@ final class SimpleClient {
          if (args.length != 1) {
             throw new Exception("require 1 argument: connector factory class name");
          }
+
+         System.out.println("I'm here");
          String connectorFactoryClassName = args[0];
 
          String queueName = 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 {
             ClientSessionFactory sf = locator.createSessionFactory();
             ClientSession session = sf.createSession(false, true, true);
@@ -77,6 +79,7 @@ final class SimpleClient {
             locator.close();
          }
       } catch (Throwable t) {
+         t.printStackTrace(System.out);
 
          String allStack = t.getMessage() + "|";
          StackTraceElement[] stackTrace = t.getStackTrace();

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/tests/integration-tests/src/test/resources/restricted-security-client.policy
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/resources/restricted-security-client.policy b/tests/integration-tests/src/test/resources/restricted-security-client.policy
index ecd4081..4b5d5d7 100644
--- a/tests/integration-tests/src/test/resources/restricted-security-client.policy
+++ b/tests/integration-tests/src/test/resources/restricted-security-client.policy
@@ -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.scheduled.thread.pool.core.size", "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.tryUnsafe", "read";
         permission java.util.PropertyPermission "org.jboss.netty.tryUnsafe", "read";

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/c82ac631/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
----------------------------------------------------------------------
diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
index 1ed0e73..c1153bc 100644
--- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
+++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/util/SpawnedVMSupport.java
@@ -57,7 +57,7 @@ public final class SpawnedVMSupport {
                                  final String[] vmargs,
                                  final boolean logOutput,
                                  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,
@@ -66,7 +66,7 @@ public final class SpawnedVMSupport {
                                               final String[] vmargs,
                                               final boolean logOutput,
                                               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,
@@ -75,8 +75,9 @@ public final class SpawnedVMSupport {
                                  final String[] vmargs,
                                  final boolean logOutput,
                                  final boolean logErrorOutput,
+                                 final boolean useLogging,
                                  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,
@@ -87,6 +88,7 @@ public final class SpawnedVMSupport {
                                  final String[] vmargs,
                                  final boolean logOutput,
                                  final boolean logErrorOutput,
+                                 final boolean useLogging,
                                  final String... args) throws Exception {
       ProcessBuilder builder = new ProcessBuilder();
       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
-      commandList.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
-      commandList.add("-Dlogging.configuration=file:../config/logging.properties");
+      if (useLogging) {
+         commandList.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
+         commandList.add("-Dlogging.configuration=file:../config/logging.properties");
+      }
 
       commandList.add("-Djava.io.tmpdir=" + System.getProperty("java.io.tmpdir", "./tmp"));
       commandList.add("-Djava.library.path=" + System.getProperty("java.library.path", "./native/bin"));

Reply | Threaded
Open this post in threaded view
|

[2/3] activemq-artemis git commit: NO-JIRA Fixing AddressControlTest

clebertsuconic-2
NO-JIRA Fixing AddressControlTest


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/04535ee7
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/04535ee7
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/04535ee7

Branch: refs/heads/master
Commit: 04535ee7626ac79772e975052f1b8e041eacfc52
Parents: c82ac63
Author: Clebert Suconic <[hidden email]>
Authored: Tue Apr 18 19:09:01 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Tue Apr 18 19:09:01 2017 -0400

----------------------------------------------------------------------
 .../artemis/tests/integration/management/AddressControlTest.java   | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/04535ee7/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
index 08781fe..bf505ed 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java
@@ -41,6 +41,7 @@ import org.apache.activemq.artemis.core.security.Role;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.impl.QueueImpl;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
+import org.apache.activemq.artemis.tests.util.Wait;
 import org.apache.activemq.artemis.utils.Base64;
 import org.apache.activemq.artemis.utils.RandomUtil;
 import org.junit.Assert;
@@ -345,6 +346,7 @@ public class AddressControlTest extends ManagementTestBase {
       Assert.assertEquals(1, addressControl.getQueueNames().length);
       addressControl.sendMessage(null, Message.BYTES_TYPE, Base64.encodeBytes("test".getBytes()), false, null, null);
 
+      Wait.waitFor(() -> addressControl.getMessageCount() == 1);
       Assert.assertEquals(1, addressControl.getMessageCount());
 
       ClientConsumer consumer = session.createConsumer(address);

Reply | Threaded
Open this post in threaded view
|

[3/3] activemq-artemis git commit: This closes #1210

clebertsuconic-2
In reply to this post by clebertsuconic-2
This closes #1210


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/cc4c3957
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/cc4c3957
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/cc4c3957

Branch: refs/heads/master
Commit: cc4c3957b1db5619a5628ab48c111d9889209404
Parents: 1f82c78 04535ee
Author: Clebert Suconic <[hidden email]>
Authored: Wed Apr 19 00:49:48 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Wed Apr 19 00:49:48 2017 -0400

----------------------------------------------------------------------
 .../artemis/core/remoting/impl/netty/Epoll.java | 22 +++++++++++++-------
 .../integration/client/JournalCrashTest.java    |  2 +-
 .../cluster/RealNodeManagerTest.java            |  2 +-
 .../management/AddressControlTest.java          |  2 ++
 .../security/NettySecurityClientTest.java       |  3 +--
 .../integration/security/SimpleClient.java      |  5 ++++-
 .../resources/restricted-security-client.policy |  3 +++
 .../artemis/tests/util/SpawnedVMSupport.java    | 14 ++++++++-----
 8 files changed, 36 insertions(+), 17 deletions(-)
----------------------------------------------------------------------