activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martyntay...@apache.org
Subject [14/34] activemq-artemis git commit: NO-JIRA fixing byteman (extra tests)
Date Tue, 01 Nov 2016 10:21:43 GMT
NO-JIRA fixing byteman (extra tests)

Two issues encountered here:

i - ClosingConnectionTest was intermittently breaking other tests, in particular it was breaking
PagingLeakTest for no apparent reason
  . apparently it was a dead lock from removeAddress on the ServerController

ii - it still showing issues after removing the not needed synchronziation. Since the test
is not really needed I am just removing the offending test.


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

Branch: refs/heads/ARTEMIS-780
Commit: e49eda966417e83906e9f7a5bf9c89b978ceaff0
Parents: 51fa840
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Fri Oct 28 00:31:42 2016 -0400
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Fri Oct 28 16:32:04 2016 -0400

----------------------------------------------------------------------
 .../impl/ActiveMQServerControlImpl.java         |   6 +-
 .../extras/byteman/ClosingConnectionTest.java   | 160 -------------------
 2 files changed, 3 insertions(+), 163 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e49eda96/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index fb7deee..b0e8b9b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -1189,7 +1189,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements
Active
    }
 
    @Override
-   public synchronized boolean closeConnectionsForAddress(final String ipAddress) {
+   public boolean closeConnectionsForAddress(final String ipAddress) {
       checkStarted();
 
       clearIO();
@@ -1213,7 +1213,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements
Active
    }
 
    @Override
-   public synchronized boolean closeConsumerConnectionsForAddress(final String address) {
+   public boolean closeConsumerConnectionsForAddress(final String address) {
       boolean closed = false;
       checkStarted();
 
@@ -1251,7 +1251,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements
Active
    }
 
    @Override
-   public synchronized boolean closeConnectionsForUser(final String userName) {
+   public boolean closeConnectionsForUser(final String userName) {
       boolean closed = false;
       checkStarted();
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e49eda96/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
deleted file mode 100644
index d4bfc00..0000000
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClosingConnectionTest.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.tests.extras.byteman;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.api.core.client.ClientMessage;
-import org.apache.activemq.artemis.api.core.client.ClientProducer;
-import org.apache.activemq.artemis.api.core.client.ClientSession;
-import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
-import org.apache.activemq.artemis.api.core.client.ServerLocator;
-import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.JournalType;
-import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
-import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
-import org.apache.activemq.artemis.tests.integration.management.ManagementControlHelper;
-import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
-import org.jboss.byteman.contrib.bmunit.BMRule;
-import org.jboss.byteman.contrib.bmunit.BMRules;
-import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(BMUnitRunner.class)
-public class ClosingConnectionTest extends ActiveMQTestBase {
-
-   public static final SimpleString ADDRESS = new SimpleString("SimpleAddress");
-
-   private ServerLocator locator;
-
-   private ActiveMQServer server;
-
-   private static MBeanServer mBeanServer;
-
-   private static boolean readyToKill = false;
-
-   protected boolean isNetty() {
-      return true;
-   }
-
-   @Override
-   @Before
-   public void setUp() throws Exception {
-      super.setUp();
-      mBeanServer = MBeanServerFactory.createMBeanServer();
-      server = newActiveMQServer();
-      server.getConfiguration().setJournalType(JournalType.NIO);
-      server.getConfiguration().setJMXManagementEnabled(true);
-      server.start();
-      waitForServerToStart(server);
-      locator = createFactory(isNetty());
-      readyToKill = false;
-   }
-
-   public static void killConnection() throws InterruptedException {
-      if (readyToKill) {
-         // We have to kill the connection in a new thread otherwise Netty won't interrupt
the current thread
-         Thread closeConnectionThread = new Thread(new Runnable() {
-            @Override
-            public void run() {
-               try {
-                  ActiveMQServerControl serverControl = ManagementControlHelper.createActiveMQServerControl(mBeanServer);
-                  serverControl.closeConnectionsForUser("guest");
-                  readyToKill = false;
-               } catch (Exception e) {
-                  e.printStackTrace();
-               }
-            }
-         });
-
-         closeConnectionThread.start();
-
-         try {
-            /* We want to simulate a long-running remoting thread here. If closing the connection
in the closeConnectionThread
-             * interrupts this thread then it will cause sleep() to throw and InterruptedException.
Therefore we catch
-             * the InterruptedException and re-interrupt the current thread so the interrupt
will be passed properly
-             * back to the caller. It's a bit of a hack, but I couldn't find any other way
to simulate it.
-             */
-            Thread.sleep(1500);
-         } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-         }
-      }
-   }
-
-   /*
-   * Test for https://bugzilla.redhat.com/show_bug.cgi?id=1193085
-   * */
-   @Test
-   @BMRules(rules = {@BMRule(
-      name = "rule to kill connection",
-      targetClass = "org.apache.activemq.artemis.core.io.nio.NIOSequentialFile",
-      targetMethod = "open(int, boolean)",
-      targetLocation = "AT INVOKE java.nio.channels.FileChannel.size()",
-      action = "org.apache.activemq.artemis.tests.extras.byteman.ClosingConnectionTest.killConnection();")})
-   public void testKillConnection() throws Exception {
-      locator.setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setBlockOnAcknowledge(true);
-
-      ClientSessionFactory sf = createSessionFactory(locator);
-      ClientSession session = sf.createSession("guest", null, false, true, true, false, 0);
-
-      session.createQueue(ADDRESS, ADDRESS, null, true);
-
-      ClientProducer producer = session.createProducer(ADDRESS);
-
-      ClientMessage message = session.createMessage(true);
-      message.getBodyBuffer().writeBytes(new byte[1024]);
-
-      for (int i = 0; i < 200; i++) {
-         producer.send(message);
-      }
-
-      assertTrue(server.locateQueue(ADDRESS).getPageSubscription().getPagingStore().isPaging());
-
-      readyToKill = true;
-      try {
-         for (int i = 0; i < 10; i++) {
-            producer.send(message);
-         }
-         fail("Sending message here should result in failure.");
-      } catch (Exception e) {
-         IntegrationTestLogger.LOGGER.info("Caught exception: " + e.getMessage());
-      }
-
-      Thread.sleep(1000);
-
-      assertTrue(server.isStarted());
-
-      session.close();
-   }
-
-   private ActiveMQServer newActiveMQServer() throws Exception {
-      ActiveMQServer server = createServer(true, createDefaultConfig(isNetty()));
-      server.setMBeanServer(mBeanServer);
-
-      AddressSettings defaultSetting = new AddressSettings().setPageSizeBytes(10 * 1024).setMaxSizeBytes(20
* 1024);
-
-      server.getAddressSettingsRepository().addMatch("#", defaultSetting);
-
-      return server;
-   }
-}


Mime
View raw message