Jenkins build is still unstable: ActiveMQ-Java7 » ActiveMQ :: Unit Tests #951

2016-02-25 Thread Apache Jenkins Server
See 




Jenkins build is back to stable : ActiveMQ-Java7 » ActiveMQ :: RA #951

2016-02-25 Thread Apache Jenkins Server
See 




Jenkins build is still unstable: ActiveMQ-Java7 #951

2016-02-25 Thread Apache Jenkins Server
See 



activemq-artemis git commit: more refactorings on producers [Forced Update!]

2016-02-25 Thread clebertsuconic
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 566e39b7b -> 86f305be3 (forced update)


more refactorings on producers


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

Branch: refs/heads/refactor-openwire
Commit: 86f305be3d126e46ea4ac2632db5e002495d9950
Parents: 20476a9
Author: Clebert Suconic 
Authored: Thu Feb 25 18:10:18 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 22:08:53 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   | 190 +--
 .../core/protocol/openwire/OpenWireUtil.java|  23 +--
 .../artemis/core/server/ActiveMQServer.java |   4 +
 .../core/server/impl/ActiveMQServerImpl.java|  71 +++
 .../core/server/impl/ServerSessionImpl.java |  56 +-
 .../InvestigationOpenwireTest.java  |  17 +-
 6 files changed, 181 insertions(+), 180 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/86f305be/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index dc2a8a6..6839259 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -51,7 +51,9 @@ import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSingleConsumerB
 import org.apache.activemq.artemis.core.remoting.FailureListener;
 import org.apache.activemq.artemis.core.security.CheckType;
 import org.apache.activemq.artemis.core.security.SecurityAuth;
+import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.apache.activemq.artemis.core.server.BindingQueryResult;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.ServerConsumer;
 import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener;
@@ -146,6 +148,7 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
private String defaultSocketURIString;
 
+   // TODO-NOW: check on why there are two connections created for every 
createConnection on the client.
public OpenWireConnection(Connection connection,
  Executor executor,
  OpenWireProtocolManager openWireProtocolManager,
@@ -267,13 +270,25 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
  }
   }
-  catch (IOException e) {
+  catch (Exception e) {
+ ActiveMQServerLogger.LOGGER.debug(e);
 
- // TODO-NOW: send errors
- ActiveMQServerLogger.LOGGER.error("error decoding", e);
-  }
-  catch (Throwable t) {
- ActiveMQServerLogger.LOGGER.error("error decoding", t);
+ Response resp;
+ if (e instanceof ActiveMQSecurityException) {
+resp = new ExceptionResponse(new 
JMSSecurityException(e.getMessage()));
+ }
+ else if (e instanceof ActiveMQNonExistentQueueException) {
+resp = new ExceptionResponse(new 
InvalidDestinationException(e.getMessage()));
+ }
+ else {
+resp = new ExceptionResponse(e);
+ }
+ try {
+dispatch(resp);
+ }
+ catch (IOException e2) {
+ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e2);
+ }
   }
}
 
@@ -861,6 +876,22 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
   }
}
 
+   /**
+* Checks to see if this destination exists.  If it does not throw an 
invalid destination exception.
+*
+* @param destination
+*/
+   private void validateDestination(ActiveMQDestination destination) throws 
Exception {
+  if (destination.isQueue()) {
+ SimpleString physicalName = OpenWireUtil.toCoreAddress(destination);
+ BindingQueryResult result = 
protocolManager.getServer().bindingQuery(physicalName);
+ if (!result.isExists() && 

[activemq-artemis] Git Push Summary [forced push!] [Forced Update!]

2016-02-25 Thread clebertsuconic
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 10c7c1a09 -> 566e39b7b (forced update)


activemq git commit: https://issues.apache.org/jira/browse/AMQ-5881

2016-02-25 Thread tabish
Repository: activemq
Updated Branches:
  refs/heads/master 06bc2840d -> c530b69e1


https://issues.apache.org/jira/browse/AMQ-5881

Fail the connect if the password is set but the username bit is not as
per the V3.1.1 spec requirements. 

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

Branch: refs/heads/master
Commit: c530b69e16372232bef19dcd353cbe91e4a511d2
Parents: 06bc284
Author: Timothy Bish 
Authored: Thu Feb 25 19:08:22 2016 -0500
Committer: Timothy Bish 
Committed: Thu Feb 25 19:08:22 2016 -0500

--
 .../transport/mqtt/MQTTProtocolConverter.java   |  9 +++
 .../activemq/transport/mqtt/MQTTTest.java   | 28 
 2 files changed, 37 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/activemq/blob/c530b69e/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
--
diff --git 
a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
 
b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
index 2b384e1..8e83ed2 100644
--- 
a/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
+++ 
b/activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java
@@ -248,6 +248,15 @@ public class MQTTProtocolConverter {
 }
 String passswd = null;
 if (connect.password() != null) {
+
+if (userName == null && connect.version() != V3_1) {
+// [MQTT-3.1.2-22]: If the user name is not present then the
+// password must also be absent.
+// [MQTT-3.1.4-1]: would seem to imply we don't send a CONNACK 
here.
+
getMQTTTransport().onException(IOExceptionSupport.create("Password given 
without a user name", null));
+return;
+}
+
 passswd = connect.password().toString();
 }
 

http://git-wip-us.apache.org/repos/asf/activemq/blob/c530b69e/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
--
diff --git 
a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java 
b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
index 7dbf9c7..3dd3348 100644
--- 
a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
+++ 
b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTTest.java
@@ -331,6 +331,34 @@ public class MQTTTest extends MQTTTestSupport {
 connection.disconnect();
 }
 
+@Test(timeout = 30 * 1000)
+public void testConnectWithUserButNoPassword() throws Exception {
+MQTT mqtt = createMQTTConnection();
+mqtt.setClientId("test");
+mqtt.setUserName("foo");
+
+BlockingConnection connection = mqtt.blockingConnection();
+connection.connect();
+connection.disconnect();
+}
+
+@Test(timeout = 30 * 1000)
+public void testConnectWithPasswordButNoUsername() throws Exception {
+MQTT mqtt = createMQTTConnection();
+mqtt.setVersion("3.1.1"); // The V3.1 spec doesn't make the same 
assertion
+mqtt.setClientId("test");
+mqtt.setPassword("bar");
+
+BlockingConnection connection = mqtt.blockingConnection();
+
+try {
+connection.connect();
+fail("Should not be able to connect in this case.");
+} catch (Exception ex) {
+LOG.info("Exception expected on connect with password but no 
username");
+}
+}
+
 @Test(timeout = 2 *  60 * 1000)
 public void testMQTTWildcard() throws Exception {
 MQTT mqtt = createMQTTConnection();



activemq-artemis git commit: using converter interface

2016-02-25 Thread clebertsuconic
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 566e39b7b -> 10c7c1a09


using converter interface


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

Branch: refs/heads/refactor-openwire
Commit: 10c7c1a0982b7001739e80c1c7f616b7419201f7
Parents: 566e39b
Author: Clebert Suconic 
Authored: Thu Feb 25 18:57:21 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:57:21 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   |  7 ---
 .../openwire/OpenWireMessageConverter.java  | 22 +---
 .../openwire/OpenWireProtocolManager.java   |  9 +++-
 .../core/protocol/openwire/amq/AMQSession.java  | 10 +++--
 4 files changed, 30 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/10c7c1a0/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 6839259..0fd8dc2 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -146,8 +146,6 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
private volatile AMQSession advisorySession;
 
-   private String defaultSocketURIString;
-
// TODO-NOW: check on why there are two connections created for every 
createConnection on the client.
public OpenWireConnection(Connection connection,
  Executor executor,
@@ -156,7 +154,6 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
   super(connection, executor);
   this.protocolManager = openWireProtocolManager;
   this.wireFormat = wf;
-  this.defaultSocketURIString = connection.getLocalAddress();
}
 
// SecurityAuth implementation
@@ -635,10 +632,6 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
   return this.context;
}
 
-   public String getDefaultSocketURIString() {
-  return defaultSocketURIString;
-   }
-
public void updateClient(ConnectionControl control) {
   //  if (!destroyed && context.isFaultTolerant()) {
   if (protocolManager.isUpdateClusterClients()) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/10c7c1a0/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
index d040955..6176490 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
@@ -96,10 +96,11 @@ public class OpenWireMessageConverter implements 
MessageConverter {
private static final String AMQ_MSG_DROPPABLE = AMQ_PREFIX + "DROPPABLE";
private static final String AMQ_MSG_COMPRESSED = AMQ_PREFIX + "COMPRESSED";
 
-   @Override
-   public ServerMessage inbound(Object message) {
-  // TODO: implement this
-  return null;
+
+   private final WireFormat marshaller;
+
+   public OpenWireMessageConverter(WireFormat marshaller) {
+  this.marshaller = marshaller;
}
 
@Override
@@ -108,10 +109,13 @@ public class OpenWireMessageConverter implements 
MessageConverter {
   return null;
}
 
-   //convert an ActiveMQ Artemis message to coreMessage
-   public static void toCoreMessage(ServerMessageImpl coreMessage,
-Message messageSend,
-WireFormat marshaller) 

[19/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4517Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4517Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4517Test.java
deleted file mode 100644
index 8d94998..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4517Test.java
+++ /dev/null
@@ -1,129 +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.bugs;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.advisory.AdvisorySupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.policy.DeadLetterStrategy;
-import org.apache.activemq.broker.region.policy.IndividualDeadLetterStrategy;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AMQ4517Test {
-
-   private BrokerService brokerService;
-   private String connectionUri;
-
-   @Before
-   public void setup() throws Exception {
-  brokerService = new BrokerService();
-
-  connectionUri = 
brokerService.addConnector("tcp://localhost:0").getPublishableConnectString();
-
-  // Configure Dead Letter Strategy
-  DeadLetterStrategy strategy = new IndividualDeadLetterStrategy();
-  ((IndividualDeadLetterStrategy) 
strategy).setUseQueueForQueueMessages(true);
-  ((IndividualDeadLetterStrategy) strategy).setQueuePrefix("DLQ.");
-  strategy.setProcessNonPersistent(false);
-  strategy.setProcessExpired(false);
-
-  // Add policy and individual DLQ strategy
-  PolicyEntry policy = new PolicyEntry();
-  policy.setTimeBeforeDispatchStarts(3000);
-  policy.setDeadLetterStrategy(strategy);
-
-  PolicyMap pMap = new PolicyMap();
-  pMap.setDefaultEntry(policy);
-
-  brokerService.setDestinationPolicy(pMap);
-  brokerService.setPersistent(false);
-  brokerService.start();
-   }
-
-   @After
-   public void stop() throws Exception {
-  brokerService.stop();
-   }
-
-   @Test(timeout = 36)
-   public void test() throws Exception {
-
-  final ActiveMQConnectionFactory cf = new 
ActiveMQConnectionFactory(connectionUri);
-
-  final AtomicBoolean advised = new AtomicBoolean(false);
-  Connection connection = cf.createConnection();
-  Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-  Destination dlqDestination = 
session.createTopic(AdvisorySupport.MESSAGE_DLQ_TOPIC_PREFIX + ">");
-  MessageConsumer consumer = session.createConsumer(dlqDestination);
-  consumer.setMessageListener(new MessageListener() {
-
- @Override
- public void onMessage(Message message) {
-advised.set(true);
- }
-  });
-  connection.start();
-
-  ExecutorService service = Executors.newSingleThreadExecutor();
-
-  service.execute(new Runnable() {
- @Override
- public void run() {
-try {
-   ActiveMQConnection connection = (ActiveMQConnection) 
cf.createConnection();
-   Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-   Destination destination = session.createTemporaryQueue();
-   MessageProducer producer = session.createProducer(destination);
-   

[47/50] [abbrv] activemq-artemis git commit: fixing SlowConsumerDetection

2016-02-25 Thread clebertsuconic
fixing SlowConsumerDetection


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

Branch: refs/heads/refactor-openwire
Commit: 20476a9b4f8fa30873a3f911406f1901ff3ae290
Parents: 50dfa49
Author: Clebert Suconic 
Authored: Thu Feb 25 14:40:04 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../core/protocol/openwire/OpenWireConnection.java | 12 +---
 .../protocol/openwire/OpenWireProtocolManager.java | 17 -
 .../core/server/impl/ServerConsumerImpl.java   |  4 +++-
 3 files changed, 16 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/20476a9b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 6f2e3be..dc2a8a6 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -204,6 +204,11 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
  boolean responseRequired = command.isResponseRequired();
  int commandId = command.getCommandId();
+
+
+ // TODO-NOW: the server should send packets to the client based on 
the requested times
+ //   need to look at what Andy did on AMQP
+
  // the connection handles pings, negotiations directly.
  // and delegate all other commands to manager.
  if (command.getClass() == KeepAliveInfo.class) {
@@ -1196,12 +1201,12 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
   @Override
   public Response processMessageDispatch(MessageDispatch arg0) throws 
Exception {
- throw new IllegalStateException("not implemented! ");
+ return null;
   }
 
   @Override
   public Response 
processMessageDispatchNotification(MessageDispatchNotification arg0) throws 
Exception {
- throw new IllegalStateException("not implemented! ");
+ return null;
   }
 
   @Override
@@ -1222,7 +1227,8 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
   @Override
   public Response processProducerAck(ProducerAck arg0) throws Exception {
- throw new IllegalStateException("not implemented! ");
+ // a broker doesn't do producers.. this shouldn't happen
+ return null;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/20476a9b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
index bdf27f8..514a2b9 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
@@ -17,14 +17,12 @@
 package org.apache.activemq.artemis.core.protocol.openwire;
 
 import javax.jms.InvalidClientIDException;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ScheduledExecutorService;
 
@@ -44,7 +42,6 @@ import 
org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnectio
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import 

[41/50] [abbrv] activemq-artemis git commit: avoiding NPE

2016-02-25 Thread clebertsuconic
avoiding NPE


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

Branch: refs/heads/refactor-openwire
Commit: 545b8c99ad233543ee1aca66073590a159405978
Parents: 9aba647
Author: Clebert Suconic 
Authored: Fri Feb 19 15:37:12 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../artemis/core/protocol/openwire/OpenWireProtocolManager.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/545b8c99/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
index bd26b07..014181d 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
@@ -811,7 +811,7 @@ public class OpenWireProtocolManager implements 
ProtocolManager, No
public void sendBrokerInfo(OpenWireConnection connection) {
   BrokerInfo brokerInfo = new BrokerInfo();
   brokerInfo.setBrokerName(server.getIdentity());
-  brokerInfo.setBrokerId(new BrokerId(server.getNodeID().toString()));
+  brokerInfo.setBrokerId(new BrokerId("" + server.getNodeID()));
   brokerInfo.setPeerBrokerInfos(null);
   brokerInfo.setFaultTolerantConfiguration(false);
   brokerInfo.setBrokerURL(connection.getLocalAddress());



[11/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
deleted file mode 100644
index ae0ac1f..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java
+++ /dev/null
@@ -1,451 +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.store.jdbc;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Vector;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.TopicSubscriber;
-
-import junit.framework.Test;
-
-import org.apache.activemq.command.ActiveMQMessage;
-import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.activemq.store.MessagePriorityTest;
-import org.apache.activemq.store.PersistenceAdapter;
-import org.apache.activemq.util.Wait;
-import org.apache.derby.jdbc.EmbeddedDataSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JDBCMessagePriorityTest extends MessagePriorityTest {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(JDBCMessagePriorityTest.class);
-   EmbeddedDataSource dataSource;
-   JDBCPersistenceAdapter jdbc;
-
-   @Override
-   protected PersistenceAdapter createPersistenceAdapter(boolean delete) 
throws Exception {
-  jdbc = new JDBCPersistenceAdapter();
-  dataSource = new EmbeddedDataSource();
-  dataSource.setDatabaseName("derbyDb");
-  dataSource.setCreateDatabase("create");
-  dataSource.setShutdownDatabase(null);
-  jdbc.setDataSource(dataSource);
-  jdbc.deleteAllMessages();
-  jdbc.setCleanupPeriod(2000);
-  return jdbc;
-   }
-
-   @Override
-   protected void tearDown() throws Exception {
-  super.tearDown();
-  try {
- if (dataSource != null) {
-// ref 
http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/JDBCDataSource.java?view=markup
-dataSource.setShutdownDatabase("shutdown");
-dataSource.getConnection();
- }
-  }
-  catch (Exception ignored) {
-  }
-  finally {
- dataSource.setShutdownDatabase(null);
-  }
-
-   }
-
-   // this cannot be a general test as kahaDB just has support for 3 priority 
levels
-   public void testDurableSubsReconnectWithFourLevels() throws Exception {
-  ActiveMQTopic topic = (ActiveMQTopic) sess.createTopic("TEST");
-  final String subName = "priorityDisconnect";
-  TopicSubscriber sub = sess.createDurableSubscriber(topic, subName);
-  sub.close();
-
-  final int MED_PRI = LOW_PRI + 1;
-  final int MED_HIGH_PRI = HIGH_PRI - 1;
-
-  ProducerThread lowPri = new ProducerThread(topic, MSG_NUM, LOW_PRI);
-  ProducerThread medPri = new ProducerThread(topic, MSG_NUM, MED_PRI);
-  ProducerThread medHighPri = new ProducerThread(topic, MSG_NUM, 
MED_HIGH_PRI);
-  ProducerThread highPri = new ProducerThread(topic, MSG_NUM, HIGH_PRI);
-
-  lowPri.start();
-  highPri.start();
-  medPri.start();
-  medHighPri.start();
-
-  lowPri.join();
-  highPri.join();
-  medPri.join();
-  medHighPri.join();
-
-  final int closeFrequency = MSG_NUM;
-  final int[] priorities = new int[]{HIGH_PRI, MED_HIGH_PRI, MED_PRI, 
LOW_PRI};
-  sub = sess.createDurableSubscriber(topic, subName);
-  for (int i = 0; i < MSG_NUM * 4; i++) {
- Message msg = sub.receive(1);
- LOG.debug("received i=" + i + ", m=" + (msg != null ? 
msg.getJMSMessageID() + ", priority: 

[17/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java
deleted file mode 100644
index 6cf42f3..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java
+++ /dev/null
@@ -1,617 +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.bugs;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeSet;
-import java.util.UUID;
-import java.util.concurrent.TimeUnit;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.QueueConnection;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.RedeliveryPolicy;
-import org.apache.activemq.TestSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.TransportConnector;
-import org.apache.activemq.broker.region.RegionBroker;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * Non transactional concurrent producer/consumer to single dest
- */
-@RunWith(Parameterized.class)
-public class AMQ5266SingleDestTest {
-
-   static Logger LOG = LoggerFactory.getLogger(AMQ5266SingleDestTest.class);
-   String activemqURL;
-   BrokerService brokerService;
-
-   public int numDests = 1;
-   public int messageSize = 10 * 1000;
-
-   @Parameterized.Parameter(0)
-   public int publisherMessagesPerThread = 1000;
-
-   @Parameterized.Parameter(1)
-   public int publisherThreadCount = 20;
-
-   @Parameterized.Parameter(2)
-   public int consumerThreadsPerQueue = 5;
-
-   @Parameterized.Parameter(3)
-   public int destMemoryLimit = 50 * 1024;
-
-   @Parameterized.Parameter(4)
-   public boolean useCache = true;
-
-   @Parameterized.Parameter(5)
-   public TestSupport.PersistenceAdapterChoice persistenceAdapterChoice = 
TestSupport.PersistenceAdapterChoice.KahaDB;
-
-   @Parameterized.Parameter(6)
-   public boolean optimizeDispatch = false;
-
-   @Parameterized.Parameters(name = 
"#{0},producerThreads:{1},consumerThreads:{2},mL:{3},useCache:{4},useDefaultStore:{5},optimizedDispatch:{6}")
-   public static Iterable parameters() {
-  return Arrays.asList(new Object[][]{{1000, 40, 40, 1024 * 1024 * 1, 
true, TestSupport.PersistenceAdapterChoice.KahaDB, false}, {1000, 40, 40, 1024 
* 1024 * 1, true, TestSupport.PersistenceAdapterChoice.LevelDB, false}, {1000, 
40, 40, 1024 * 1024 * 1, true, TestSupport.PersistenceAdapterChoice.JDBC, 
false},});
-   }
-
-   public int consumerBatchSize = 25;
-
-   @BeforeClass
-   public static void derbyTestMode() throws Exception {
-  System.setProperty("derby.system.durability", "test");
-   }
-
-   @Before
-   public void startBroker() throws Exception {
-  brokerService = new BrokerService();
-
-  TestSupport.setPersistenceAdapter(brokerService, 
persistenceAdapterChoice);
-  brokerService.setDeleteAllMessagesOnStartup(true);
-  brokerService.setUseJmx(false);
-  brokerService.setAdvisorySupport(false);
-
-  PolicyMap policyMap = new PolicyMap();
-  PolicyEntry defaultEntry = new PolicyEntry();
-  defaultEntry.setUseConsumerPriority(false); // 
java.lang.IllegalArgumentException: Comparison method 

[13/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/VerifySteadyEnqueueRate.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/VerifySteadyEnqueueRate.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/VerifySteadyEnqueueRate.java
deleted file mode 100644
index 80ab8e1..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/VerifySteadyEnqueueRate.java
+++ /dev/null
@@ -1,148 +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.bugs;
-
-import junit.framework.TestCase;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.store.kahadb.KahaDBStore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jms.Connection;
-import java.io.File;
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-
-public class VerifySteadyEnqueueRate extends TestCase {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(VerifySteadyEnqueueRate.class);
-
-   private static int max_messages = 100;
-   private final String destinationName = getName() + "_Queue";
-   private BrokerService broker;
-   final boolean useTopic = false;
-
-   protected static final String payload = new String(new byte[24]);
-
-   @Override
-   public void setUp() throws Exception {
-  startBroker();
-   }
-
-   @Override
-   public void tearDown() throws Exception {
-  broker.stop();
-   }
-
-   @SuppressWarnings("unused")
-   public void testEnqueueRateCanMeetSLA() throws Exception {
-  if (true) {
- return;
-  }
-  doTestEnqueue(false);
-   }
-
-   private void doTestEnqueue(final boolean transacted) throws Exception {
-  final long min = 100;
-  final AtomicLong total = new AtomicLong(0);
-  final AtomicLong slaViolations = new AtomicLong(0);
-  final AtomicLong max = new AtomicLong(0);
-  final int numThreads = 6;
-
-  Runnable runner = new Runnable() {
-
- @Override
- public void run() {
-try {
-   MessageSender producer = new MessageSender(destinationName, 
createConnection(), transacted, useTopic);
-
-   for (int i = 0; i < max_messages; i++) {
-  long startT = System.currentTimeMillis();
-  producer.send(payload);
-  long endT = System.currentTimeMillis();
-  long duration = endT - startT;
-
-  total.incrementAndGet();
-
-  if (duration > max.get()) {
- max.set(duration);
-  }
-
-  if (duration > min) {
- slaViolations.incrementAndGet();
- System.err.println("SLA violation @ " + 
Thread.currentThread().getName() + " " + 
DateFormat.getTimeInstance().format(new Date(startT)) + " at message " + i + " 
send time=" + duration + " - Total SLA violations: " + slaViolations.get() + 
"/" + total.get() + " (" + String.format("%.6f", 100.0 * slaViolations.get() / 
total.get()) + "%)");
-  }
-   }
-
-}
-catch (Exception e) {
-   // TODO Auto-generated catch block
-   e.printStackTrace();
-}
-System.out.println("Max Violation = " + max + " - Total SLA 
violations: " + slaViolations.get() + "/" + total.get() + " (" + 
String.format("%.6f", 100.0 * slaViolations.get() / total.get()) + "%)");
- }
-  };
-  ExecutorService executor = Executors.newCachedThreadPool();
-
-  for (int i = 0; i < numThreads; i++) {
- executor.execute(runner);
-  }
-
-  executor.shutdown();
-  while (!executor.isTerminated()) {
- executor.awaitTermination(10, TimeUnit.SECONDS);
-  }
-   }
-
-   private Connection createConnection() throws 

[05/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java
index 5016e30..dc91873 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/TwoBrokerFailoverClusterTest.java
@@ -16,22 +16,41 @@
  */
 package org.apache.activemq.transport.failover;
 
-public class TwoBrokerFailoverClusterTest extends FailoverClusterTestSupport {
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
-   private static final String BROKER_A_CLIENT_TC_ADDRESS = 
"tcp://127.0.0.1:61616";
-   private static final String BROKER_B_CLIENT_TC_ADDRESS = 
"tcp://127.0.0.1:61617";
-   private static final String BROKER_A_NOB_TC_ADDRESS = 
"tcp://127.0.0.1:61626";
-   private static final String BROKER_B_NOB_TC_ADDRESS = 
"tcp://127.0.0.1:61627";
-   private static final String BROKER_A_NAME = "BROKERA";
-   private static final String BROKER_B_NAME = "BROKERB";
+import javax.jms.Connection;
+import javax.jms.MessageConsumer;
+import javax.jms.Queue;
+import javax.jms.Session;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
+public class TwoBrokerFailoverClusterTest extends OpenwireArtemisBaseTest {
+
+   private static final int NUMBER_OF_CLIENTS = 30;
+   private final List connections = new 
ArrayList();
+   private EmbeddedJMS server0;
+   private EmbeddedJMS server1;
+   private String clientUrl;
+
+   @Test
public void testTwoBrokersRestart() throws Exception {
-  createBrokerA(false, "", null, null);
-  createBrokerB(false, "", null, null);
-  getBroker(BROKER_B_NAME).waitUntilStarted();
 
   Thread.sleep(2000);
-  setClientUrl("failover://(" + BROKER_A_CLIENT_TC_ADDRESS + "," + 
BROKER_B_CLIENT_TC_ADDRESS + ")");
   createClients();
 
   Thread.sleep(5000);
@@ -39,59 +58,106 @@ public class TwoBrokerFailoverClusterTest extends 
FailoverClusterTestSupport {
   assertClientsConnectedToTwoBrokers();
   assertClientsConnectionsEvenlyDistributed(.35);
 
-  getBroker(BROKER_A_NAME).stop();
-  getBroker(BROKER_A_NAME).waitUntilStopped();
-  removeBroker(BROKER_A_NAME);
+  server0.stop();
+  Assert.assertTrue(server1.waitClusterForming(100, TimeUnit.MILLISECONDS, 
20, 1));
 
   Thread.sleep(1000);
 
-  assertAllConnectedTo(BROKER_B_CLIENT_TC_ADDRESS);
+  assertAllConnectedTo(newURI("127.0.0.1", 1));
 
   Thread.sleep(5000);
 
-  createBrokerA(false, "", null, null);
-  getBroker(BROKER_A_NAME).waitUntilStarted();
+  server0.start();
+  Assert.assertTrue(server0.waitClusterForming(100, TimeUnit.MILLISECONDS, 
20, 2));
+  Assert.assertTrue(server1.waitClusterForming(100, TimeUnit.MILLISECONDS, 
20, 2));
   Thread.sleep(5000);
 
+  //need update-cluster-clients, -on-remove and rebalance set to true.
   assertClientsConnectedToTwoBrokers();
   assertClientsConnectionsEvenlyDistributed(.35);
}
 
-   private void createBrokerA(boolean multi,
-  String params,
-  String clusterFilter,
-  String destinationFilter) throws Exception {
-  final String tcParams = (params == null) ? "" : params;
-  if (getBroker(BROKER_A_NAME) == null) {
- addBroker(BROKER_A_NAME, createBroker(BROKER_A_NAME));
- addTransportConnector(getBroker(BROKER_A_NAME), "openwire", 
BROKER_A_CLIENT_TC_ADDRESS + tcParams, true);
- if (multi) {
-addTransportConnector(getBroker(BROKER_A_NAME), "network", 
BROKER_A_NOB_TC_ADDRESS + tcParams, false);
-addNetworkBridge(getBroker(BROKER_A_NAME), "A_2_B_Bridge", 
"static://(" + BROKER_B_NOB_TC_ADDRESS + ")?useExponentialBackOff=false", 
false, clusterFilter);
- }
- else {
-addNetworkBridge(getBroker(BROKER_A_NAME), "A_2_B_Bridge", 
"static://(" + BROKER_B_CLIENT_TC_ADDRESS + 

[07/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
index 2779f52..75c27d7 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
@@ -22,6 +22,8 @@ import java.util.Vector;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.jms.Destination;
 import javax.jms.JMSException;
@@ -37,97 +39,105 @@ import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQMessageConsumer;
 import org.apache.activemq.ActiveMQMessageTransformation;
 import org.apache.activemq.ActiveMQSession;
-import org.apache.activemq.broker.BrokerPlugin;
-import org.apache.activemq.broker.BrokerPluginSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.ConnectionContext;
-import org.apache.activemq.broker.region.Subscription;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
+import org.apache.activemq.artemis.core.server.impl.QueueImpl;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
 import org.apache.activemq.command.ConsumerId;
-import org.apache.activemq.command.ConsumerInfo;
 import org.apache.activemq.command.SessionId;
 import org.apache.activemq.util.Wait;
+import org.jboss.byteman.contrib.bmunit.BMRule;
+import org.jboss.byteman.contrib.bmunit.BMRules;
+import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.junit.After;
 import org.junit.Test;
 
 // see https://issues.apache.org/activemq/browse/AMQ-2573
-public class FailoverConsumerUnconsumedTest {
-
+@RunWith(BMUnitRunner.class)
+public class FailoverConsumerUnconsumedTest extends OpenwireArtemisBaseTest {
private static final Logger LOG = 
LoggerFactory.getLogger(FailoverConsumerUnconsumedTest.class);
private static final String QUEUE_NAME = "FailoverWithUnconsumed";
-   private static final String TRANSPORT_URI = "tcp://localhost:0";
-   private String url;
+   private static final AtomicBoolean doByteman = new AtomicBoolean(false);
+
+   private static int maxConsumers = 2;
+   private static AtomicInteger consumerCount = new AtomicInteger(0);
+   private static CountDownLatch brokerStopLatch = new CountDownLatch(1);
+   private static AtomicBoolean watchTopicAdvisories = new 
AtomicBoolean(false);
+
+   private String url = newURI(0);
final int prefetch = 10;
-   BrokerService broker;
+   private static EmbeddedJMS broker;
 
@After
-   public void stopBroker() throws Exception {
+   public void tearDown() throws Exception {
   if (broker != null) {
  broker.stop();
+ broker = null;
   }
}
 
-   public void startBroker(boolean deleteAllMessagesOnStartup) throws 
Exception {
-  broker = createBroker(deleteAllMessagesOnStartup);
-  broker.start();
-   }
-
-   public BrokerService createBroker(boolean deleteAllMessagesOnStartup) 
throws Exception {
-  return createBroker(deleteAllMessagesOnStartup, TRANSPORT_URI);
-   }
-
-   public BrokerService createBroker(boolean deleteAllMessagesOnStartup, 
String bindAddress) throws Exception {
-  broker = new BrokerService();
-  broker.addConnector(bindAddress);
-  broker.setDeleteAllMessagesOnStartup(deleteAllMessagesOnStartup);
-
-  this.url = 
broker.getTransportConnectors().get(0).getConnectUri().toString();
-
-  return broker;
+   @Before
+   public void setUp() throws Exception {
+  consumerCount.set(0);
}
 
@Test
+   @BMRules(
+   rules = {
+   @BMRule(
+   name = "set no return response and stop the broker",
+   targetClass = 
"org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection",
+   targetMethod = "processAddConsumer",
+   targetLocation = "ENTRY",
+   binding = "owconn:OpenWireConnection = $0; context 
= owconn.getContext()",
+

[29/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicDLQTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicDLQTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicDLQTest.java
deleted file mode 100644
index d05a5c7..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicDLQTest.java
+++ /dev/null
@@ -1,433 +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.broker.virtual;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.ExceptionListener;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import junit.framework.TestCase;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQMessageProducer;
-import org.apache.activemq.ActiveMQSession;
-import org.apache.activemq.RedeliveryPolicy;
-import org.apache.activemq.broker.BrokerFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.Queue;
-import org.apache.activemq.broker.region.RegionBroker;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Unit test for virtual topics and DLQ messaging. See individual test for more
- * detail
- */
-public class VirtualTopicDLQTest extends TestCase {
-
-   private static BrokerService broker;
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(VirtualTopicDLQTest.class);
-
-   static final String jmsConnectionURI = "failover:(vm://localhost)";
-
-   // Virtual Topic that the test publishes 10 messages to
-   private static final String virtualTopicName = "VirtualTopic.Test";
-
-   // Queues that receive all the messages send to the virtual topic
-   private static final String consumer1Prefix = "Consumer.A.";
-   private static final String consumer2Prefix = "Consumer.B.";
-   private static final String consumer3Prefix = "Consumer.C.";
-
-   // Expected Individual Dead Letter Queue names that are tied to the
-   // Subscriber Queues
-   private static final String dlqPrefix = "ActiveMQ.DLQ.Topic.";
-
-   // Number of messages
-   private static final int numberMessages = 6;
-
-   @Override
-   @Before
-   public void setUp() throws Exception {
-  try {
- broker = 
BrokerFactory.createBroker("xbean:org/apache/activemq/broker/virtual/virtual-individual-dlq.xml",
 true);
- broker.start();
- broker.waitUntilStarted();
-  }
-  catch (Exception e) {
- e.printStackTrace();
- throw e;
-  }
-   }
-
-   @Override
-   @After
-   public void tearDown() throws Exception {
-  try {
- // Purge the DLQ's so counts are correct for next run
- purgeDestination(dlqPrefix + consumer1Prefix + virtualTopicName);
- purgeDestination(dlqPrefix + consumer2Prefix + virtualTopicName);
- purgeDestination(dlqPrefix + consumer3Prefix + virtualTopicName);
-  }
-  catch (Exception e) {
- e.printStackTrace();
-  }
-
-  if (broker != null) {
- broker.stop();
- broker.waitUntilStopped();
- broker = null;
-  }
-   }
-
-   /*
-* This test verifies that all undelivered messages sent to a consumers
-* listening on a queue associated with a virtual topic with be forwarded to
-* separate DLQ's.
-*
-* Note that the broker config, deadLetterStrategy need to have the enable
-* audit set to false so that duplicate message sent from a topic to
-* individual consumers are forwarded to the DLQ
-*
-*  

[37/50] [abbrv] activemq-artemis git commit: added some clean up code that cause other tests fail.

2016-02-25 Thread clebertsuconic
added some clean up code that cause other tests fail.


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

Branch: refs/heads/refactor-openwire
Commit: fda6e339f45dbf5d75677617d477643ee1d82f6c
Parents: 1be5004
Author: Howard Gao 
Authored: Thu Feb 4 22:53:31 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../activemq/transport/tcp/TcpTransportFactory.java  | 15 ++-
 .../apache/activemq/QueueConsumerPriorityTest.java   |  3 +++
 .../test/java/org/apache/activemq/TimeStampTest.java | 10 ++
 .../org/apache/activemq/TransactionContextTest.java  | 10 ++
 4 files changed, 37 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fda6e339/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
index b3ac85f..4ddc2a6 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
@@ -57,6 +57,8 @@ public class TcpTransportFactory extends TransportFactory {
   Map params = URISupport.parseParameters(location);
   String brokerId = params.remove("invmBrokerId");
   URI location1 = URISupport.createRemainingURI(location, 
Collections.EMPTY_MAP);
+
+  LOG.info("deciding whether starting an internal broker: " + 
brokerService + " flag: " + BrokerService.disableWrapper);
   if (brokerService == null && !BrokerService.disableWrapper) {
 
  ArtemisBrokerHelper.startArtemisBroker(location1);
@@ -179,7 +181,18 @@ public class TcpTransportFactory extends TransportFactory {
   return new InactivityMonitor(transport, format);
}
 
+   //remember call this if the test is using the internal broker.
public static void clearService() {
-  brokerService = null;
+  if (brokerService != null) {
+ try {
+ArtemisBrokerHelper.stopArtemisBroker();
+ }
+ catch (Exception e) {
+e.printStackTrace();
+ }
+ finally {
+brokerService = null;
+ }
+  }
}
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fda6e339/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java
index 0358323..296f52b 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/QueueConsumerPriorityTest.java
@@ -26,7 +26,9 @@ import javax.jms.Session;
 
 import junit.framework.TestCase;
 
+import org.apache.activemq.artemiswrapper.ArtemisBrokerHelper;
 import org.apache.activemq.command.ActiveMQQueue;
+import org.apache.activemq.transport.tcp.TcpTransportFactory;
 
 public class QueueConsumerPriorityTest extends TestCase {
 
@@ -43,6 +45,7 @@ public class QueueConsumerPriorityTest extends TestCase {
 
@Override
protected void tearDown() throws Exception {
+  TcpTransportFactory.clearService();
   super.tearDown();
}
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fda6e339/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java
index 87c5fc9..c1c058f 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/TimeStampTest.java
@@ -34,6 +34,16 @@ import 
org.apache.activemq.broker.view.ConnectionDotFilePlugin;
 
 public class TimeStampTest extends TestCase {
 
+   @Override
+   public void setUp() {
+  BrokerService.disableWrapper = true;
+   }
+
+   @Override
+   public 

[34/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
open wire changes
equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

More or less what I meant by getting rid of PeerBroker.. we can just use the 
Topology we already have
(cherry picked from commit 5559f05cc57493ad5f54f214c0b6bc3d92820efb)

put back rebalance and test
(cherry picked from commit 9711d6cf26ddaad5b08c0024e27819e74fef02af from branch 
new2)

fix some configure issues for tests. so far only one of the two bridges seen 
started
(cherry picked from commit ec1bfdb65bf314c05f12134e96a5e7d1a854b398)

Reverting configuration stuff, adding new cluster base class
(cherry picked from 8267e8196c969fef8dc6248ed7791b31e6e01a03)

fixing cluster test
(cherry picked from commit ab29219c0f89909bd1687e00353a19e4385eb06e)

getting the first test working
(cherry picked from commit 0e724d1cb462345969f96a0e706799628a2c56dd)

fixing clustering tests
(cherry picked from 2a20696cdec44963ba1320b438d84409a1709809)

Starting with nother test FailoverComplexClusterTest

  I added a NewFailoverComplexClusterTest copied from the
  original test. So I can keep the original for reference.
  Once test passed I'll overwrite the original with the
  new one.
(cherry picked from f9e959d91d99676916a3e218738809c7f0c62b99)

Test fixes
(cherry picked from commit 567f57848ed10f54512b25118c54372e6510afdc)

more tests
(cherry picked from 67633c61c64f2bd0ffab4c5bb608922387427ad8)

Finished FailoverComplexClusterTest, now its tests all pass.
(cherry picked from 8ee4bb845fffd6499665801b73ac2e443dda8de5)

Openwire test work update:
  changed some code to pass protocol specific params to accetpors
  FailoverRandomTest ok
  delete a test that is not relevant
  FailoverPriorityTest (still not working)

(cherry picked from commit 3b9eae2d52dc73f58e4f5106c912cddda95388c6)

FailoverPriorityTest is ok now.
(cherry picked from commit a61abdc3349ad846f53b5703c6ff03a68304ac6f)

- Fix ReconnectTest
- Update activemq-client to 5.12.0 for activemq5-unit-tests
- Remove some tests that are removed from 5.12.0
- Add a synchronization on JMSServerManagerImpl
internalCreateQueue to avoid NPE in FailoverClusterTest

(cherry picked from commit 5d44bcf8ce02f3a0936ee12ecf86a3948e2b3a0c)

Fix connection closing issue which causes
tests teardown takes very long time.
(cherry picked from 50bef42d32d2fae705353b96e2b626d4fc722cc6)

InitalReconnectDelayTest.java
SlowConnectionTest.java
TwoBrokerFailoverClusterTest.java
(cherry picked from a5ebfae1a2af938ad10b1dee2d2c9bf11f8d0116)

Fix a few more tests
(cherry picked from 83a316c37f1a1ba7b36a35261a0fee031d606e96)

- Fix tests:
FanoutTransportBrokerTest, FanoutTest
- Disable server auto-creation for cluster tests
(cherry picked from commit c6d7c7b28b1754b1d1898c038f1c9a0952028cbd)

more tests
(cherry picked from commit f4217734492ffe9be1e8380959f13cfb85ab9e1e)

Fix SoWriteTimeoutClientTest
Add a check in OpenwireConnection.disconnect() to prevent it from reentering.

(cherry picked from commit c74ef17f4d038d772c0d8457194bb83282e87211)

Remove command check in OpenWireConnection
Handle ShutdownInfo command properly
ConnectionCleanupTest (a new test from 12.0)

(cherry picked from commit a2512ff083ab691b7cb0abc27711d6ed78739d66)

Clean up all tests under org.apache.activemq.transport.failover package

(Cherry picked from 181c874fa80ae103df3b8619c97141e49aafc847)


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

Branch: refs/heads/refactor-openwire
Commit: 6371d64f2bd372f033d6c7496974bfba894826df
Parents: e202240
Author: Clebert Suconic 
Authored: Wed Jan 13 22:53:59 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../jms/server/impl/JMSServerManagerImpl.java   |   34 +-
 .../protocol/openwire/OpenWireConnection.java   |  294 ++--
 .../openwire/OpenWireProtocolManager.java   |  197 ++-
 .../openwire/amq/AMQConnectionContext.java  |   19 +
 .../core/protocol/openwire/amq/AMQConsumer.java |   16 +-
 .../protocol/openwire/amq/AMQServerSession.java |8 +-
 .../core/protocol/openwire/amq/AMQSession.java  |   23 +-
 .../artemis/core/config/Configuration.java  |4 +
 .../core/config/impl/ConfigurationImpl.java |   19 +
 .../core/remoting/impl/netty/NettyAcceptor.java |2 +
 .../server/impl/RemotingServiceImpl.java|6 +-
 .../core/server/embedded/EmbeddedActiveMQ.java  |5 +
 tests/activemq5-unit-tests/pom.xml  |   39 +-
 .../broker/ArtemisBrokerWrapperFactory.java |   32 +
 .../apache/activemq/broker/BrokerService.java   |  133 +-
 .../artemiswrapper/ArtemisBrokerBase.java   |   17 +-
 .../artemiswrapper/ArtemisBrokerWrapper.java|  

[49/50] [abbrv] activemq-artemis git commit: Refactoring between Connection and protocol manager

2016-02-25 Thread clebertsuconic
Refactoring between Connection and protocol manager


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

Branch: refs/heads/refactor-openwire
Commit: 3f0335def34649516431b9bc75d4395de761156d
Parents: 0c8b117
Author: Clebert Suconic 
Authored: Wed Feb 24 22:30:28 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   | 331 ++-
 .../openwire/OpenWireProtocolManager.java   | 325 +++---
 .../core/protocol/openwire/amq/AMQConsumer.java |  20 +-
 .../openwire/amq/AMQProducerBrokerExchange.java |  96 --
 .../openwire/amq/AMQServerConsumer.java |  12 +
 .../core/protocol/openwire/amq/AMQSession.java  |  21 +-
 .../artemis/core/server/ServerConsumer.java |   6 +
 .../server/SlowConsumerDetectionListener.java   |  22 ++
 .../artemis/core/server/impl/QueueImpl.java |   2 +
 .../core/server/impl/ServerConsumerImpl.java|  18 +
 10 files changed, 370 insertions(+), 483 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3f0335de/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 991f24b..6f2e3be 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -23,37 +23,45 @@ import javax.jms.ResourceAllocationException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.LinkedList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
 
+import org.apache.activemq.advisory.AdvisorySupport;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
 import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.postoffice.Binding;
+import org.apache.activemq.artemis.core.postoffice.Bindings;
+import org.apache.activemq.artemis.core.postoffice.QueueBinding;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQCompositeConsumerBrokerExchange;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
 import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConsumer;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConsumerBrokerExchange;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQProducerBrokerExchange;
+import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQServerConsumer;
 import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSession;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSingleConsumerBrokerExchange;
-import org.apache.activemq.artemis.core.remoting.CloseListener;
 import org.apache.activemq.artemis.core.remoting.FailureListener;
+import org.apache.activemq.artemis.core.security.CheckType;
 import org.apache.activemq.artemis.core.security.SecurityAuth;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.apache.activemq.artemis.core.server.Queue;
+import org.apache.activemq.artemis.core.server.ServerConsumer;
+import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener;
 import 
org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
-import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
 import 

[39/50] [abbrv] activemq-artemis git commit: Fixing SslContextNBrokerServiceTest (one of the two)

2016-02-25 Thread clebertsuconic
Fixing SslContextNBrokerServiceTest (one of the two)


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

Branch: refs/heads/refactor-openwire
Commit: bc0b37f16d8180b37d338ba2c4af4e9d8bfb90db
Parents: 610174b
Author: Howard Gao 
Authored: Fri Feb 19 21:32:14 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../apache/activemq/broker/BrokerService.java   | 19 
 .../artemiswrapper/ArtemisBrokerWrapper.java| 46 ++
 .../activemq/transport/tcp/n-brokers-ssl.xml| 51 
 3 files changed, 97 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bc0b37f1/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
index b7b02b3..99de104 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -53,6 +53,7 @@ import org.apache.activemq.network.NetworkConnector;
 import org.apache.activemq.network.jms.JmsConnector;
 import org.apache.activemq.proxy.ProxyConnector;
 import org.apache.activemq.security.MessageAuthorizationPolicy;
+import org.apache.activemq.spring.SpringSslContext;
 import org.apache.activemq.store.PListStore;
 import org.apache.activemq.store.PersistenceAdapter;
 import org.apache.activemq.store.PersistenceAdapterFactory;
@@ -100,6 +101,7 @@ public class BrokerService implements Service {
private Throwable startException = null;
private boolean startAsync = false;
public Set extraConnectors = new HashSet<>();
+   public Set sslConnectors = new HashSet<>();
 
private List transportConnectors = new ArrayList<>();
private File dataDirectoryFile;
@@ -491,6 +493,15 @@ public class BrokerService implements Service {
 
public void setTransportConnectors(List 
transportConnectors) throws Exception {
   this.transportConnectors = transportConnectors;
+  for (TransportConnector connector : transportConnectors) {
+ if (connector.getUri().getScheme().equals("ssl")) {
+this.sslConnectors.add(connector.getUri().getPort());
+System.out.println(this + " added ssl connector: " + 
connector.getUri().getPort());
+ }
+ else {
+this.extraConnectors.add(connector.getUri().getPort());
+ }
+  }
}
 
public NetworkConnector addNetworkConnector(NetworkConnector connector) 
throws Exception {
@@ -698,6 +709,14 @@ public class BrokerService implements Service {
 
public void setSslContext(SslContext sslContext) {
   this.sslContext = sslContext;
+  if (sslContext instanceof SpringSslContext) {
+ SpringSslContext springContext = (SpringSslContext)sslContext;
+ this.SERVER_SIDE_KEYSTORE = springContext.getKeyStore();
+ this.KEYSTORE_PASSWORD = springContext.getKeyStorePassword();
+ this.SERVER_SIDE_TRUSTSTORE = springContext.getTrustStore();
+ this.TRUSTSTORE_PASSWORD = springContext.getTrustStorePassword();
+ this.storeType = springContext.getKeyStoreType();
+  }
}
 
public void setPersistenceFactory(PersistenceAdapterFactory 
persistenceFactory) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bc0b37f1/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
index 5cb5048..1c8ce9b 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
@@ -33,13 +33,12 @@ import org.apache.activemq.artemis.core.postoffice.Binding;
 import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
 import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
 import org.apache.activemq.artemis.core.security.Role;
-import 

[09/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/perf/TempKahaStoreQueueTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/perf/TempKahaStoreQueueTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/perf/TempKahaStoreQueueTest.java
deleted file mode 100644
index 2575afd..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/perf/TempKahaStoreQueueTest.java
+++ /dev/null
@@ -1,45 +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.store.kahadb.perf;
-
-import java.io.File;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.perf.SimpleQueueTest;
-import org.apache.activemq.store.kahadb.TempKahaDBStore;
-
-/**
- *
- */
-public class TempKahaStoreQueueTest extends SimpleQueueTest {
-
-   @Override
-   protected void configureBroker(BrokerService answer, String uri) throws 
Exception {
-  File dataFileDir = new File("target/test-amq-data/perfTest/temp-amqdb");
-  dataFileDir.mkdirs();
-  answer.setDeleteAllMessagesOnStartup(true);
-
-  TempKahaDBStore adaptor = new TempKahaDBStore();
-  adaptor.setDirectory(dataFileDir);
-
-  answer.setDataDirectoryFile(dataFileDir);
-  answer.setPersistenceAdapter(adaptor);
-  answer.addConnector(uri);
-   }
-
-}
-

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/KahaDBFilePendingMessageCursorTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/KahaDBFilePendingMessageCursorTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/KahaDBFilePendingMessageCursorTest.java
deleted file mode 100644
index 6626603..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/KahaDBFilePendingMessageCursorTest.java
+++ /dev/null
@@ -1,96 +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.store.kahadb.plist;
-
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.*;
-import org.apache.activemq.broker.region.cursors.FilePendingMessageCursor;
-import 
org.apache.activemq.broker.region.cursors.FilePendingMessageCursorTestSupport;
-import org.apache.activemq.command.ActiveMQMessage;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.MessageId;
-import org.apache.activemq.store.kahadb.disk.page.PageFile;
-import org.apache.activemq.usage.SystemUsage;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-/**
- * @author http://hiramchirino.com;>Hiram Chirino
- */
-public class KahaDBFilePendingMessageCursorTest extends 
FilePendingMessageCursorTestSupport {
-
-   @Test
-   public void testAddRemoveAddIndexSize() throws Exception {
-  brokerService = new BrokerService();
-  brokerService.setUseJmx(false);
-  SystemUsage usage = brokerService.getSystemUsage();
-  usage.getMemoryUsage().setLimit(1024 * 150);
-  String body = new 

[26/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2580Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2580Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2580Test.java
deleted file mode 100644
index 9d79a8e..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2580Test.java
+++ /dev/null
@@ -1,195 +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.bugs;
-
-import junit.framework.Test;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQPrefetchPolicy;
-import org.apache.activemq.TestSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.jms.ConnectionFactory;
-import javax.jms.JMSException;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.jms.TopicConnection;
-import javax.jms.TopicSession;
-
-public class AMQ2580Test extends TestSupport {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(AMQ2580Test.class);
-
-   private static final String TOPIC_NAME = "topicName";
-   private static final String CLIENT_ID = "client_id";
-   private static final String textOfSelectedMsg = "good_message";
-
-   protected TopicConnection connection;
-
-   private Topic topic;
-   private Session session;
-   private MessageProducer producer;
-   private ConnectionFactory connectionFactory;
-   private BrokerService service;
-
-   public static Test suite() {
-  return suite(AMQ2580Test.class);
-   }
-
-   @Override
-   protected void setUp() throws Exception {
-  super.setUp();
-  initDurableBroker();
-  initConnectionFactory();
-  initTopic();
-   }
-
-   @Override
-   protected void tearDown() throws Exception {
-  shutdownClient();
-  service.stop();
-  super.tearDown();
-   }
-
-   private void initConnection() throws JMSException {
-  if (connection == null) {
- LOG.info("Initializing connection");
-
- connection = (TopicConnection) connectionFactory.createConnection();
- connection.start();
-  }
-   }
-
-   public void initCombosForTestTopicIsDurableSmokeTest() throws Exception {
-  addCombinationValues("defaultPersistenceAdapter", 
PersistenceAdapterChoice.values());
-   }
-
-   public void testTopicIsDurableSmokeTest() throws Exception {
-
-  initClient();
-  MessageConsumer consumer = createMessageConsumer();
-  LOG.info("Consuming message");
-  assertNull(consumer.receive(1));
-  shutdownClient();
-  consumer.close();
-
-  sendMessages();
-  shutdownClient();
-
-  initClient();
-  consumer = createMessageConsumer();
-
-  LOG.info("Consuming message");
-  TextMessage answer1 = (TextMessage) consumer.receive(1000);
-  assertNotNull("we got our message", answer1);
-
-  consumer.close();
-   }
-
-   private MessageConsumer createMessageConsumer() throws JMSException {
-  LOG.info("creating durable subscriber");
-  return session.createDurableSubscriber(topic, TOPIC_NAME, 
"name='value'", false);
-   }
-
-   private void initClient() throws JMSException {
-  LOG.info("Initializing client");
-
-  initConnection();
-  initSession();
-   }
-
-   private void shutdownClient() throws JMSException {
-  LOG.info("Closing session and connection");
-  session.close();
-  connection.close();
-  session = null;
-  connection = null;
-   }
-
-   private void sendMessages() throws JMSException {
-  initConnection();
-
-  initSession();
-
-  LOG.info("Creating producer");
-  producer = session.createProducer(topic);
-
-  sendMessageThatFailsSelection();
-
-  sendMessage(textOfSelectedMsg, "value");
-   }
-
-   private void initSession() throws JMSException {
-  LOG.info("Initializing session");
-  session = 

[21/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4212Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4212Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4212Test.java
deleted file mode 100644
index 3504c1f..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4212Test.java
+++ /dev/null
@@ -1,357 +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.bugs;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-import javax.management.ObjectName;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
-import org.apache.activemq.store.kahadb.disk.journal.DataFile;
-import org.apache.activemq.util.Wait;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AMQ4212Test {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(AMQ4212Test.class);
-
-   private BrokerService service;
-   private String connectionUri;
-   private ActiveMQConnectionFactory cf;
-
-   private final int MSG_COUNT = 256;
-
-   @Before
-   public void setUp() throws IOException, Exception {
-  createBroker(true, false);
-   }
-
-   public void createBroker(boolean deleteAllMessages, boolean recover) throws 
Exception {
-  service = new BrokerService();
-  service.setBrokerName("InactiveSubTest");
-  service.setDeleteAllMessagesOnStartup(deleteAllMessages);
-  service.setAdvisorySupport(false);
-  service.setPersistent(true);
-  service.setUseJmx(true);
-  service.setKeepDurableSubsActive(false);
-
-  KahaDBPersistenceAdapter pa = new KahaDBPersistenceAdapter();
-  File dataFile = new File("KahaDB");
-  pa.setDirectory(dataFile);
-  pa.setJournalMaxFileLength(10 * 1024);
-  pa.setCheckpointInterval(TimeUnit.SECONDS.toMillis(5));
-  pa.setCleanupInterval(TimeUnit.SECONDS.toMillis(5));
-  pa.setForceRecoverIndex(recover);
-
-  service.setPersistenceAdapter(pa);
-  service.start();
-  service.waitUntilStarted();
-
-  connectionUri = "vm://InactiveSubTest?create=false";
-  cf = new ActiveMQConnectionFactory(connectionUri);
-   }
-
-   private void restartBroker() throws Exception {
-  stopBroker();
-  createBroker(false, false);
-   }
-
-   private void recoverBroker() throws Exception {
-  stopBroker();
-  createBroker(false, true);
-   }
-
-   @After
-   public void stopBroker() throws Exception {
-  if (service != null) {
- service.stop();
- service.waitUntilStopped();
- service = null;
-  }
-   }
-
-   @Test
-   public void testDirableSubPrefetchRecovered() throws Exception {
-
-  ActiveMQQueue queue = new ActiveMQQueue("MyQueue");
-  ActiveMQTopic topic = new ActiveMQTopic("MyDurableTopic");
-
-  // Send to a Queue to create some journal files
-  sendMessages(queue);
-
-  LOG.info("There are currently [{}] journal log files.", 
getNumberOfJournalFiles());
-
-  createInactiveDurableSub(topic);
-
-  assertTrue("Should have an inactive durable sub", Wait.waitFor(new 
Wait.Condition() {
- @Override
- public boolean isSatisified() throws Exception {
-ObjectName[] subs = 
service.getAdminView().getInactiveDurableTopicSubscribers();
-

[27/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java
deleted file mode 100644
index ea794ff..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java
+++ /dev/null
@@ -1,150 +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.bugs;
-
-import java.util.*;
-import java.util.concurrent.CopyOnWriteArrayList;
-import javax.jms.*;
-import javax.jms.Queue;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class AMQ2171Test implements Thread.UncaughtExceptionHandler {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(AMQ2171Test.class);
-   private static final String BROKER_URL = "tcp://localhost:0";
-   private static final int QUEUE_SIZE = 100;
-
-   private static BrokerService brokerService;
-   private static Queue destination;
-
-   private String brokerUri;
-   private String brokerUriNoPrefetch;
-   private Collection exceptions = new CopyOnWriteArrayList<>();
-
-   @Before
-   public void setUp() throws Exception {
-  // Start an embedded broker up.
-  brokerService = new BrokerService();
-  brokerService.setDeleteAllMessagesOnStartup(true);
-  brokerService.addConnector(BROKER_URL);
-  brokerService.start();
-
-  brokerUri = 
brokerService.getTransportConnectors().get(0).getPublishableConnectString().toString();
-  brokerUriNoPrefetch = brokerUri + "?jms.prefetchPolicy.all=0";
-
-  destination = new ActiveMQQueue("Test");
-  produce(brokerUri, QUEUE_SIZE);
-   }
-
-   @Before
-   public void addHandler() {
-  Thread.setDefaultUncaughtExceptionHandler(this);
-   }
-
-   @After
-   public void tearDown() throws Exception {
-  brokerService.stop();
-   }
-
-   @Test(timeout = 1)
-   public void testBrowsePrefetch() throws Exception {
-  runTest(brokerUri);
-   }
-
-   @Test(timeout = 1)
-   public void testBrowseNoPrefetch() throws Exception {
-  runTest(brokerUriNoPrefetch);
-   }
-
-   private void runTest(String brokerURL) throws Exception {
-
-  Connection connection = new 
ActiveMQConnectionFactory(brokerURL).createConnection();
-
-  try {
- connection.start();
-
- Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
- Enumeration unread = 
session.createBrowser(destination).getEnumeration();
-
- int count = 0;
- while (unread.hasMoreElements()) {
-unread.nextElement();
-count++;
- }
-
- assertEquals(QUEUE_SIZE, count);
- assertTrue(exceptions.isEmpty());
-  }
-  finally {
- try {
-connection.close();
- }
- catch (JMSException e) {
-exceptions.add(e);
- }
-  }
-   }
-
-   private static void produce(String brokerURL, int count) throws Exception {
-  Connection connection = null;
-
-  try {
-
- ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(brokerURL);
- connection = factory.createConnection();
- Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
- MessageProducer producer = session.createProducer(destination);
- producer.setTimeToLive(0);
- connection.start();
-
- for (int i = 0; i < count; i++) {
-int id = i + 1;
-TextMessage message = session.createTextMessage("Message " + id);
-message.setIntProperty("MsgNumber", id);
-producer.send(message);
-
-if (id % 500 == 0) {
-   LOG.info("sent " + id + ", 

[28/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java
deleted file mode 100644
index ad12f71..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java
+++ /dev/null
@@ -1,233 +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.bugs;
-
-import java.util.ArrayList;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.jms.Connection;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import junit.framework.TestCase;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.leveldb.LevelDBStore;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is a test case for the issue reported at:
- * https://issues.apache.org/activemq/browse/AMQ-1866
- *
- * If you have a JMS producer sending messages to multiple fast consumers and
- * one slow consumer, eventually all consumers will run as slow as
- * the slowest consumer.
- */
-public class AMQ1866 extends TestCase {
-
-   private static final Logger log = 
LoggerFactory.getLogger(ConsumerThread.class);
-   private BrokerService brokerService;
-   private ArrayList threads = new ArrayList<>();
-
-   private final String ACTIVEMQ_BROKER_BIND = "tcp://localhost:0";
-   private String ACTIVEMQ_BROKER_URI;
-
-   AtomicBoolean shutdown = new AtomicBoolean();
-   private ActiveMQQueue destination;
-
-   @Override
-   protected void setUp() throws Exception {
-  // Start an embedded broker up.
-  brokerService = new BrokerService();
-  LevelDBStore adaptor = new LevelDBStore();
-  brokerService.setPersistenceAdapter(adaptor);
-  brokerService.deleteAllMessages();
-
-  // A small max page size makes this issue occur faster.
-  PolicyMap policyMap = new PolicyMap();
-  PolicyEntry pe = new PolicyEntry();
-  pe.setMaxPageSize(1);
-  policyMap.put(new ActiveMQQueue(">"), pe);
-  brokerService.setDestinationPolicy(policyMap);
-
-  brokerService.addConnector(ACTIVEMQ_BROKER_BIND);
-  brokerService.start();
-
-  ACTIVEMQ_BROKER_URI = 
brokerService.getTransportConnectors().get(0).getPublishableConnectString();
-  destination = new ActiveMQQueue(getName());
-   }
-
-   @Override
-   protected void tearDown() throws Exception {
-  // Stop any running threads.
-  shutdown.set(true);
-  for (Thread t : threads) {
- t.interrupt();
- t.join();
-  }
-  brokerService.stop();
-   }
-
-   public void testConsumerSlowDownPrefetch0() throws Exception {
-  ACTIVEMQ_BROKER_URI = ACTIVEMQ_BROKER_URI + 
"?jms.prefetchPolicy.queuePrefetch=0";
-  doTestConsumerSlowDown();
-   }
-
-   public void testConsumerSlowDownPrefetch10() throws Exception {
-  ACTIVEMQ_BROKER_URI = ACTIVEMQ_BROKER_URI + 
"?jms.prefetchPolicy.queuePrefetch=10";
-  doTestConsumerSlowDown();
-   }
-
-   public void testConsumerSlowDownDefaultPrefetch() throws Exception {
-  doTestConsumerSlowDown();
-   }
-
-   public void doTestConsumerSlowDown() throws Exception {
-
-  // Preload the queue.
-  produce(2);
-
-  Thread producer = new Thread() {
- @Override
- public void run() {
-try {
-   while (!shutdown.get()) {
-  produce(1000);
-   }
-}
-catch (Exception e) {
-}
- }
-  };
-  threads.add(producer);
-  producer.start();
-
-  // This is the slow consumer.
-  ConsumerThread c1 = new 

[30/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
index 97cd6f6..9729793 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java
@@ -32,6 +32,7 @@ import junit.framework.TestCase;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.ConnectionContext;
 import org.apache.activemq.broker.ProducerBrokerExchange;
+import org.apache.activemq.broker.region.SubscriptionStatistics;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
 import org.apache.activemq.command.ActiveMQTextMessage;
@@ -53,12 +54,13 @@ import org.slf4j.LoggerFactory;
 /**
  * @author gtully
  * @see https://issues.apache.org/activemq/browse/AMQ-2020
- */
+ **/
 public class QueueDuplicatesFromStoreTest extends TestCase {
+   private static final Logger LOG = LoggerFactory
+   .getLogger(QueueDuplicatesFromStoreTest.class);
 
-   private static final Logger LOG = 
LoggerFactory.getLogger(QueueDuplicatesFromStoreTest.class);
-
-   ActiveMQQueue destination = new ActiveMQQueue("queue-" + 
QueueDuplicatesFromStoreTest.class.getSimpleName());
+   ActiveMQQueue destination = new ActiveMQQueue("queue-"
+   + QueueDuplicatesFromStoreTest.class.getSimpleName());
BrokerService brokerService;
 
final static String mesageIdRoot = "1:2:";
@@ -89,7 +91,7 @@ public class QueueDuplicatesFromStoreTest extends TestCase {
}
 
public void testNoDuplicateAfterCacheFullAndAckedWithLargeAuditDepth() 
throws Exception {
-  doTestNoDuplicateAfterCacheFullAndAcked(1024 * 10);
+  doTestNoDuplicateAfterCacheFullAndAcked(1024*10);
}
 
public void testNoDuplicateAfterCacheFullAndAckedWithSmallAuditDepth() 
throws Exception {
@@ -97,13 +99,15 @@ public class QueueDuplicatesFromStoreTest extends TestCase {
}
 
public void doTestNoDuplicateAfterCacheFullAndAcked(final int auditDepth) 
throws Exception {
-  final PersistenceAdapter persistenceAdapter = 
brokerService.getPersistenceAdapter();
-  final MessageStore queueMessageStore = 
persistenceAdapter.createQueueMessageStore(destination);
+  final PersistenceAdapter persistenceAdapter =  
brokerService.getPersistenceAdapter();
+  final MessageStore queueMessageStore =
+  persistenceAdapter.createQueueMessageStore(destination);
   final ConnectionContext contextNotInTx = new ConnectionContext();
   final ConsumerInfo consumerInfo = new ConsumerInfo();
   final DestinationStatistics destinationStatistics = new 
DestinationStatistics();
   consumerInfo.setExclusive(true);
-  final Queue queue = new Queue(brokerService, destination, 
queueMessageStore, destinationStatistics, brokerService.getTaskRunnerFactory());
+  final Queue queue = new Queue(brokerService, destination,
+  queueMessageStore, destinationStatistics, 
brokerService.getTaskRunnerFactory());
 
   // a workaround for this issue
   // queue.setUseCache(false);
@@ -134,34 +138,38 @@ public class QueueDuplicatesFromStoreTest extends 
TestCase {
   // pull from store in small windows
   Subscription subscription = new Subscription() {
 
+ private SubscriptionStatistics subscriptionStatistics = new 
SubscriptionStatistics();
+
  @Override
  public void add(MessageReference node) throws Exception {
 if (enqueueCounter.get() != 
node.getMessageId().getProducerSequenceId()) {
-   errors.add("Not in sequence at: " + enqueueCounter.get() + ", 
received: " + node.getMessageId().getProducerSequenceId());
+   errors.add("Not in sequence at: " + enqueueCounter.get() + ", 
received: "
+   + node.getMessageId().getProducerSequenceId());
 }
-assertEquals("is in order", enqueueCounter.get(), 
node.getMessageId().getProducerSequenceId());
+assertEquals("is in order", enqueueCounter.get(), node
+.getMessageId().getProducerSequenceId());
 receivedLatch.countDown();
 enqueueCounter.incrementAndGet();
 node.decrementReferenceCount();
  }
 
  @Override
- public void add(ConnectionContext context, Destination destination) 
throws Exception {
+ public void add(ConnectionContext context, Destination destination)
+ throws Exception {
   

[03/50] [abbrv] activemq-artemis git commit: removing AMQProducer

2016-02-25 Thread clebertsuconic
removing AMQProducer


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

Branch: refs/heads/refactor-openwire
Commit: 0c8b1171ac3c3e902958b2c78b7fa6bfe8dc8a86
Parents: fd52dc3
Author: Clebert Suconic 
Authored: Wed Feb 24 22:29:54 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../core/protocol/openwire/amq/AMQProducer.java | 38 
 1 file changed, 38 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/0c8b1171/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQProducer.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQProducer.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQProducer.java
deleted file mode 100644
index 848325e..000
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQProducer.java
+++ /dev/null
@@ -1,38 +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.core.protocol.openwire.amq;
-
-import org.apache.activemq.command.ProducerInfo;
-import org.apache.activemq.artemis.core.protocol.openwire.OpenWireUtil;
-
-public class AMQProducer {
-
-   private AMQSession amqSession;
-   private ProducerInfo info;
-
-   public AMQProducer(AMQSession amqSession, ProducerInfo info) {
-  this.amqSession = amqSession;
-  this.info = info;
-   }
-
-   public void init() throws Exception {
-  // If the destination is specified check that it exists.
-  if (info.getDestination() != null) {
- OpenWireUtil.validateDestination(info.getDestination(), amqSession);
-  }
-   }
-}



[45/50] [abbrv] activemq-artemis git commit: fixing byteman tests

2016-02-25 Thread clebertsuconic
fixing byteman tests


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

Branch: refs/heads/refactor-openwire
Commit: 89855fd2a23b86554db87f3feb4b49cbee59d4e9
Parents: e493891
Author: Clebert Suconic 
Authored: Tue Feb 23 22:04:16 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   |  7 +-
 .../FailoverConsumerOutstandingCommitTest.java  | 88 +---
 .../FailoverConsumerUnconsumedTest.java | 24 +++---
 .../failover/FailoverDuplicateTest.java | 12 +--
 .../failover/FailoverPrefetchZeroTest.java  | 11 +--
 .../failover/FailoverTransactionTest.java   | 33 
 6 files changed, 85 insertions(+), 90 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/89855fd2/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index dbbb59f..7c1c094 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -690,7 +690,12 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
}
 
// This will listen for commands throught the protocolmanager
-   class CommandProcessor implements CommandVisitor {
+   public class CommandProcessor implements CommandVisitor {
+
+
+  public AMQConnectionContext getContext() {
+ return OpenWireConnection.this.getContext();
+  }
 
   @Override
   public Response processAddConnection(ConnectionInfo info) throws 
Exception {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/89855fd2/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
index 78a8a0b..705c033 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
@@ -6,7 +6,7 @@
  * (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
+ * 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,
@@ -40,6 +40,7 @@ import javax.jms.TextMessage;
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
 import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
 import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
@@ -55,6 +56,7 @@ import org.junit.Test;
 
 @RunWith(BMUnitRunner.class)
 public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTest {
+
private static final Logger LOG = 
LoggerFactory.getLogger(FailoverConsumerOutstandingCommitTest.class);
private static final String QUEUE_NAME = "FailoverWithOutstandingCommit";
private static final String MESSAGE_TEXT = "Test message ";
@@ -78,22 +80,17 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
 
@Test
@BMRules(
-  rules = {
-  @BMRule(
-  name = "set no return response",
-  targetClass = 

[01/50] [abbrv] activemq-artemis git commit: adding profile openwire-tests (to replace activemq5-unit-tests [Forced Update!]

2016-02-25 Thread clebertsuconic
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 6c686530e -> 566e39b7b (forced update)


adding profile openwire-tests (to replace activemq5-unit-tests


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

Branch: refs/heads/refactor-openwire
Commit: 39ec3937a9a0181e71fe9b0bdde740f5eef6e148
Parents: 03a54d8
Author: Clebert Suconic 
Authored: Wed Feb 24 13:53:44 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 tests/pom.xml | 10 ++
 1 file changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/39ec3937/tests/pom.xml
--
diff --git a/tests/pom.xml b/tests/pom.xml
index bb54b95..630da1e 100644
--- a/tests/pom.xml
+++ b/tests/pom.xml
@@ -84,6 +84,7 @@
  
   
   
+ 
  activemq5-unit-tests
  
 activemq5-unit-tests
@@ -93,6 +94,15 @@
  
   
   
+ openwire-tests
+ 
+activemq5-unit-tests
+ 
+ 
+false
+ 
+  
+  
  release
  
 activemq5-unit-tests



[16/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java
deleted file mode 100644
index 7ea4044..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java
+++ /dev/null
@@ -1,196 +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.bugs;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.Destination;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.store.PersistenceAdapter;
-import org.apache.activemq.store.kahadb.FilteredKahaDBPersistenceAdapter;
-import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
-import org.apache.activemq.store.kahadb.MultiKahaDBPersistenceAdapter;
-import org.junit.After;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.*;
-
-public class AMQ5450Test {
-
-   static final Logger LOG = LoggerFactory.getLogger(AMQ5450Test.class);
-   private final static int maxFileLength = 1024 * 1024 * 32;
-
-   private final static String POSTFIX_DESTINATION_NAME = ".dlq";
-
-   private final static String DESTINATION_NAME = "test" + 
POSTFIX_DESTINATION_NAME;
-   private final static String DESTINATION_NAME_2 = "2.test" + 
POSTFIX_DESTINATION_NAME;
-   private final static String DESTINATION_NAME_3 = "3.2.test" + 
POSTFIX_DESTINATION_NAME;
-
-   private final static String[] DESTS = new String[]{DESTINATION_NAME, 
DESTINATION_NAME_2, DESTINATION_NAME_3, DESTINATION_NAME, DESTINATION_NAME};
-
-   BrokerService broker;
-   private HashMap adapters = new HashMap();
-
-   @After
-   public void tearDown() throws Exception {
-  broker.stop();
-   }
-
-   protected BrokerService createAndStartBroker(PersistenceAdapter 
persistenceAdapter) throws Exception {
-  BrokerService broker = new BrokerService();
-  broker.setUseJmx(false);
-  broker.setBrokerName("localhost");
-  broker.setPersistenceAdapter(persistenceAdapter);
-  broker.setDeleteAllMessagesOnStartup(true);
-  broker.start();
-  broker.waitUntilStarted();
-  return broker;
-   }
-
-   @Test
-   public void testPostFixMatch() throws Exception {
-  doTestPostFixMatch(false);
-   }
-
-   @Test
-   public void testPostFixCompositeMatch() throws Exception {
-  doTestPostFixMatch(true);
-   }
-
-   private void doTestPostFixMatch(boolean useComposite) throws Exception {
-  prepareBrokerWithMultiStore(useComposite);
-
-  sendMessage(DESTINATION_NAME, "test 1");
-  sendMessage(DESTINATION_NAME_2, "test 1");
-  sendMessage(DESTINATION_NAME_3, "test 1");
-
-  assertNotNull(broker.getDestination(new 
ActiveMQQueue(DESTINATION_NAME)));
-  assertNotNull(broker.getDestination(new 
ActiveMQQueue(DESTINATION_NAME_2)));
-  assertNotNull(broker.getDestination(new 
ActiveMQQueue(DESTINATION_NAME_3)));
-
-  for (String dest : DESTS) {
- Destination destination2 = broker.getDestination(new 
ActiveMQQueue(dest));
- assertNotNull(destination2);
- assertEquals(1, destination2.getMessageStore().getMessageCount());
-  }
-
-  HashMap numDests = new HashMap();
-  for (PersistenceAdapter pa : adapters.values()) {
- numDests.put(pa.getDestinations().size(), pa);
-  }
-
-  // ensure wildcard does not match any
-  assertTrue("0 in wildcard matcher", 
adapters.get(null).getDestinations().isEmpty());
-
-  assertEquals("only two values", 2, numDests.size());
-  assertTrue("0 in others", numDests.containsKey(0));
-
-  if 

[46/50] [abbrv] activemq-artemis git commit: Added openwire parameters as bean properties so that it can be passed via the new protocol manager bean util.

2016-02-25 Thread clebertsuconic
Added openwire parameters as bean properties so that it
can be passed via the new protocol manager bean util.


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

Branch: refs/heads/refactor-openwire
Commit: bdb27a9ef1fa8c7091b46aac5a296d3eaedddabc
Parents: 3ab1359
Author: Howard Gao 
Authored: Wed Feb 17 20:50:33 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   | 25 ++---
 .../openwire/OpenWireProtocolManager.java   | 38 +---
 .../artemiswrapper/OpenwireArtemisBaseTest.java | 20 ---
 .../transport/failover/FailoverClusterTest.java | 11 --
 .../failover/FailoverComplexClusterTest.java| 16 ++---
 .../failover/FailoverPriorityTest.java  | 22 
 .../failover/FailoverUpdateURIsTest.java|  6 +++-
 7 files changed, 94 insertions(+), 44 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/bdb27a9e/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 61e93cb..a6f0f34 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -55,7 +55,6 @@ import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
 import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.ConcurrentHashSet;
-import org.apache.activemq.artemis.utils.ConfigurationHelper;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.command.Command;
@@ -153,10 +152,6 @@ public class OpenWireConnection implements 
RemotingConnection, CommandVisitor, S
 
private String defaultSocketURIString;
 
-   private boolean rebalance;
-   private boolean updateClusterClients;
-   private boolean updateClusterClientsOnRemove;
-
public OpenWireConnection(Acceptor acceptorUsed,
  Connection connection,
  OpenWireProtocolManager openWireProtocolManager,
@@ -167,12 +162,6 @@ public class OpenWireConnection implements 
RemotingConnection, CommandVisitor, S
   this.wireFormat = wf;
   this.creationTime = System.currentTimeMillis();
   this.defaultSocketURIString = connection.getLocalAddress();
-
-  //Clebert: These are parameters specific to openwire cluster with 
defaults as specified at
-  //http://activemq.apache.org/failover-transport-reference.html
-  rebalance = 
ConfigurationHelper.getBooleanProperty("rebalance-cluster-clients", true, 
acceptorUsed.getConfiguration());
-  updateClusterClients = 
ConfigurationHelper.getBooleanProperty("update-cluster-clients", true, 
acceptorUsed.getConfiguration());
-  updateClusterClientsOnRemove = 
ConfigurationHelper.getBooleanProperty("update-cluster-clients-on-remove", 
true, acceptorUsed.getConfiguration());
}
 
@Override
@@ -200,10 +189,6 @@ public class OpenWireConnection implements 
RemotingConnection, CommandVisitor, S
   return info.getPassword();
}
 
-   public boolean isRebalance() {
-  return rebalance;
-   }
-
private ConnectionInfo getConnectionInfo() {
   if (state == null) {
  return null;
@@ -539,9 +524,9 @@ public class OpenWireConnection implements 
RemotingConnection, CommandVisitor, S
  Response resp = new ExceptionResponse(e);
  return resp;
   }
-  if (info.isManageable() && this.isUpdateClusterClients()) {
+  if (info.isManageable() && protocolManager.isUpdateClusterClients()) {
  // send ConnectionCommand
- ConnectionControl command = 
protocolManager.newConnectionControl(rebalance);
+ ConnectionControl command = protocolManager.newConnectionControl();
  
command.setFaultTolerant(protocolManager.isFaultTolerantConfiguration());
  if 

[25/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java
deleted file mode 100644
index 362fa5c..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java
+++ /dev/null
@@ -1,130 +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.bugs;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.JmsMultipleClientsTestSupport;
-import org.apache.activemq.broker.BrokerService;
-import 
org.apache.activemq.broker.region.policy.FilePendingQueueMessageStoragePolicy;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.BlockJUnit4ClassRunner;
-
-import java.util.Vector;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import static org.junit.Assert.assertTrue;
-
-@RunWith(BlockJUnit4ClassRunner.class)
-public class AMQ2910Test extends JmsMultipleClientsTestSupport {
-
-   final int maxConcurrency = 60;
-   final int msgCount = 200;
-   final Vector exceptions = new Vector<>();
-
-   @Override
-   protected BrokerService createBroker() throws Exception {
-  //persistent = true;
-  BrokerService broker = new BrokerService();
-  broker.setDeleteAllMessagesOnStartup(true);
-  broker.addConnector("tcp://localhost:0");
-  PolicyMap policyMap = new PolicyMap();
-  PolicyEntry defaultEntry = new PolicyEntry();
-  defaultEntry.setPendingQueuePolicy(new 
FilePendingQueueMessageStoragePolicy());
-  defaultEntry.setCursorMemoryHighWaterMark(50);
-  defaultEntry.setMemoryLimit(500 * 1024);
-  defaultEntry.setProducerFlowControl(false);
-  policyMap.setDefaultEntry(defaultEntry);
-  broker.setDestinationPolicy(policyMap);
-
-  broker.getSystemUsage().getMemoryUsage().setLimit(1000 * 1024);
-
-  return broker;
-   }
-
-   @Test(timeout = 30 * 1000)
-   public void testConcurrentSendToPendingCursor() throws Exception {
-  final ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(broker.getTransportConnectors().get(0).getConnectUri());
-  factory.setCloseTimeout(3);
-  ExecutorService executor = Executors.newCachedThreadPool();
-  for (int i = 0; i < maxConcurrency; i++) {
- final ActiveMQQueue dest = new ActiveMQQueue("Queue-" + i);
- executor.execute(new Runnable() {
-@Override
-public void run() {
-   try {
-  sendMessages(factory.createConnection(), dest, msgCount);
-   }
-   catch (Throwable t) {
-  exceptions.add(t);
-   }
-}
- });
-  }
-
-  executor.shutdown();
-
-  assertTrue("send completed", executor.awaitTermination(60, 
TimeUnit.SECONDS));
-  assertNoExceptions();
-
-  executor = Executors.newCachedThreadPool();
-  for (int i = 0; i < maxConcurrency; i++) {
- final ActiveMQQueue dest = new ActiveMQQueue("Queue-" + i);
- executor.execute(new Runnable() {
-@Override
-public void run() {
-   try {
-  startConsumers(factory, dest);
-   }
-   catch (Throwable t) {
-  exceptions.add(t);
-   }
-}
- });
-  }
-
-  executor.shutdown();
-  assertTrue("consumers completed", executor.awaitTermination(60, 
TimeUnit.SECONDS));
-
-  allMessagesList.setMaximumDuration(120 * 1000);
-  final int numExpected = maxConcurrency * msgCount;
-  allMessagesList.waitForMessagesToArrive(numExpected);
-
-  if (allMessagesList.getMessageCount() != 

[15/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java
deleted file mode 100644
index 7e46df4..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java
+++ /dev/null
@@ -1,221 +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.bugs;
-
-import java.io.File;
-import java.util.Vector;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQPrefetchPolicy;
-import org.apache.activemq.TestSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.util.Wait;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@RunWith(BlockJUnit4ClassRunner.class)
-public class MemoryUsageBlockResumeTest extends TestSupport implements 
Thread.UncaughtExceptionHandler {
-
-   public int deliveryMode = DeliveryMode.PERSISTENT;
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(MemoryUsageBlockResumeTest.class);
-   private static byte[] buf = new byte[4 * 1024];
-   private static byte[] bigBuf = new byte[48 * 1024];
-
-   private BrokerService broker;
-   AtomicInteger messagesSent = new AtomicInteger(0);
-   AtomicInteger messagesConsumed = new AtomicInteger(0);
-
-   protected long messageReceiveTimeout = 1L;
-
-   Destination destination = new ActiveMQQueue("FooTwo");
-   Destination bigDestination = new ActiveMQQueue("FooTwoBig");
-
-   private String connectionUri;
-   private final Vector exceptions = new Vector<>();
-
-   @Test(timeout = 60 * 1000)
-   public void testBlockByOtherResumeNoException() throws Exception {
-
-  ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(connectionUri);
-
-  // ensure more than on message can be pending when full
-  factory.setProducerWindowSize(48 * 1024);
-  // ensure messages are spooled to disk for this consumer
-  ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
-  prefetch.setTopicPrefetch(10);
-  factory.setPrefetchPolicy(prefetch);
-  Connection consumerConnection = factory.createConnection();
-  consumerConnection.start();
-
-  Session consumerSession = consumerConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-  MessageConsumer consumer = 
consumerSession.createConsumer(bigDestination);
-
-  final Connection producerConnection = factory.createConnection();
-  producerConnection.start();
-
-  final int fillWithBigCount = 10;
-  Session session = producerConnection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-  MessageProducer producer = session.createProducer(null);
-  producer.setDeliveryMode(deliveryMode);
-  for (int idx = 0; idx < fillWithBigCount; ++idx) {
- Message message = session.createTextMessage(new String(bigBuf) + idx);
- producer.send(bigDestination, message);
- messagesSent.incrementAndGet();
- LOG.info("After big: " + idx + ", System Memory Usage " + 
broker.getSystemUsage().getMemoryUsage().getPercentUsage());
-  }
-
-  // will block on pfc
-  final int toSend = 20;
-  Thread producingThread = new Thread("Producing thread") {
- @Override
- public void run() {
-  

[10/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
deleted file mode 100644
index 352d2f0..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java
+++ /dev/null
@@ -1,249 +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.store.kahadb;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Vector;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.jms.BytesMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ConnectionControl;
-import org.apache.activemq.store.kahadb.disk.journal.FileAppender;
-import org.apache.activemq.store.kahadb.disk.journal.Journal;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class KahaDBFastEnqueueTest {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(KahaDBFastEnqueueTest.class);
-   private BrokerService broker;
-   private ActiveMQConnectionFactory connectionFactory;
-   KahaDBPersistenceAdapter kahaDBPersistenceAdapter;
-   private final Destination destination = new ActiveMQQueue("Test");
-   private final String payloadString = new String(new byte[6 * 1024]);
-   private final boolean useBytesMessage = true;
-   private final int parallelProducer = 20;
-   private final Vector exceptions = new Vector<>();
-   long toSend = 1;
-
-   // use with:
-   // -Xmx4g -Dorg.apache.kahadb.journal.appender.WRITE_STAT_WINDOW=1 
-Dorg.apache.kahadb.journal.CALLER_BUFFER_APPENDER=true
-   @Test
-   public void testPublishNoConsumer() throws Exception {
-
-  startBroker(true, 10);
-
-  final AtomicLong sharedCount = new AtomicLong(toSend);
-  long start = System.currentTimeMillis();
-  ExecutorService executorService = Executors.newCachedThreadPool();
-  for (int i = 0; i < parallelProducer; i++) {
- executorService.execute(new Runnable() {
-@Override
-public void run() {
-   try {
-  publishMessages(sharedCount, 0);
-   }
-   catch (Exception e) {
-  exceptions.add(e);
-   }
-}
- });
-  }
-  executorService.shutdown();
-  executorService.awaitTermination(30, TimeUnit.MINUTES);
-  assertTrue("Producers done in time", executorService.isTerminated());
-  assertTrue("No exceptions: " + exceptions, exceptions.isEmpty());
-  long totalSent = toSend * payloadString.length();
-
-  double duration = System.currentTimeMillis() - start;
-  stopBroker();
-  LOG.info("Duration:" + duration + "ms");
-  LOG.info("Rate:   " + (toSend * 1000 / duration) + 
"m/s");
-  LOG.info("Total send: " + totalSent);
-  LOG.info("Total journal write: " + 
kahaDBPersistenceAdapter.getStore().getJournal().length());
-  LOG.info("Total index size " + 
kahaDBPersistenceAdapter.getStore().getPageFile().getDiskSize());
-  LOG.info("Total store size: " + kahaDBPersistenceAdapter.size());
-  LOG.info("Journal writes %:" + 

[04/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java
new file mode 100644
index 000..b01a4e1
--- /dev/null
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SocketProxy.java
@@ -0,0 +1,396 @@
+/**
+ * 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.util;
+
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocketFactory;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.SocketTimeoutException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SocketProxy {
+
+private static final transient Logger LOG = 
LoggerFactory.getLogger(SocketProxy.class);
+
+public static final int ACCEPT_TIMEOUT_MILLIS = 100;
+
+private URI proxyUrl;
+private URI target;
+
+private Acceptor acceptor;
+private ServerSocket serverSocket;
+
+private CountDownLatch closed = new CountDownLatch(1);
+
+public final List connections = new LinkedList();
+
+private int listenPort = 0;
+
+private int receiveBufferSize = -1;
+
+private boolean pauseAtStart = false;
+
+private int acceptBacklog = 50;
+
+public SocketProxy() throws Exception {
+}
+
+public SocketProxy(URI uri) throws Exception {
+this(0, uri);
+}
+
+public SocketProxy(int port, URI uri) throws Exception {
+listenPort = port;
+target = uri;
+open();
+}
+
+public void setReceiveBufferSize(int receiveBufferSize) {
+this.receiveBufferSize = receiveBufferSize;
+}
+
+public void setTarget(URI tcpBrokerUri) {
+target = tcpBrokerUri;
+}
+
+public void open() throws Exception {
+serverSocket = createServerSocket(target);
+serverSocket.setReuseAddress(true);
+if (receiveBufferSize > 0) {
+serverSocket.setReceiveBufferSize(receiveBufferSize);
+}
+if (proxyUrl == null) {
+serverSocket.bind(new InetSocketAddress(listenPort), 
acceptBacklog);
+proxyUrl = urlFromSocket(target, serverSocket);
+} else {
+serverSocket.bind(new InetSocketAddress(proxyUrl.getPort()));
+}
+acceptor = new Acceptor(serverSocket, target);
+if (pauseAtStart) {
+acceptor.pause();
+}
+new Thread(null, acceptor, "SocketProxy-Acceptor-" + 
serverSocket.getLocalPort()).start();
+closed = new CountDownLatch(1);
+}
+
+private boolean isSsl(URI target) {
+return "ssl".equals(target.getScheme());
+}
+
+private ServerSocket createServerSocket(URI target) throws Exception {
+if (isSsl(target)) {
+return SSLServerSocketFactory.getDefault().createServerSocket();
+}
+return new ServerSocket();
+}
+
+private Socket createSocket(URI target) throws Exception {
+if (isSsl(target)) {
+return SSLSocketFactory.getDefault().createSocket();
+}
+return new Socket();
+}
+
+public URI getUrl() {
+return proxyUrl;
+}
+
+/*
+ * close all proxy connections and acceptor
+ */
+public void close() {
+List connections;
+synchronized(this.connections) {
+connections = new ArrayList(this.connections);
+}
+LOG.info("close, numConnections=" + connections.size());
+for (Bridge con : connections) {
+closeConnection(con);
+}
+

[14/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
deleted file mode 100644
index 62723af..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RedeliveryPluginHeaderTest.java
+++ /dev/null
@@ -1,166 +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.bugs;
-
-import java.io.File;
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import junit.framework.TestCase;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.RedeliveryPolicy;
-import org.apache.activemq.broker.BrokerPlugin;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.TransportConnector;
-import org.apache.activemq.broker.region.policy.RedeliveryPolicyMap;
-import org.apache.activemq.broker.util.RedeliveryPlugin;
-import org.apache.activemq.util.IOHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Testing if the the broker "sends" the message as expected after the 
redeliveryPlugin has redelivered the
- * message previously.
- */
-
-public class RedeliveryPluginHeaderTest extends TestCase {
-
-   private static final String TEST_QUEUE_ONE = "TEST_QUEUE_ONE";
-   private static final String TEST_QUEUE_TWO = "TEST_QUEUE_TWO";
-   private static final Logger LOG = 
LoggerFactory.getLogger(RedeliveryPluginHeaderTest.class);
-   private String transportURL;
-   private BrokerService broker;
-
-   /**
-* Test
-* - consumes message from Queue1
-* - rolls back message to Queue1 and message is scheduled for redelivery 
to Queue1 by brokers plugin
-* - consumes message from Queue1 again
-* - sends same message to Queue2
-* - expects to consume message from Queue2 immediately
-*/
-
-   public void testSendAfterRedelivery() throws Exception {
-  broker = this.createBroker(false);
-  broker.start();
-  broker.waitUntilStarted();
-
-  LOG.info("***Broker started...");
-
-  //pushed message to broker
-
-  ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(transportURL + 
"?trace=true=0");
-
-  Connection connection = factory.createConnection();
-  connection.start();
-
-  try {
-
- Session session = connection.createSession(true, 
Session.SESSION_TRANSACTED);
-
- Destination destinationQ1 = session.createQueue(TEST_QUEUE_ONE);
- Destination destinationQ2 = session.createQueue(TEST_QUEUE_TWO);
-
- MessageProducer producerQ1 = session.createProducer(destinationQ1);
- producerQ1.setDeliveryMode(DeliveryMode.PERSISTENT);
-
- Message m = session.createTextMessage("testMessage");
- LOG.info("*** send message to broker...");
- producerQ1.send(m);
- session.commit();
-
- //consume message from Q1 and rollback to get it redelivered
- MessageConsumer consumerQ1 = session.createConsumer(destinationQ1);
-
- LOG.info("*** consume message from Q1 and rolled back..");
-
- TextMessage textMessage = (TextMessage) consumerQ1.receive();
- LOG.info("got redelivered: " + textMessage);
- assertFalse("JMSRedelivered flag is not set", 
textMessage.getJMSRedelivered());
- session.rollback();
-
- LOG.info("*** consumed message from Q1 again and sending to Q2..");
- TextMessage textMessage2 = (TextMessage) consumerQ1.receive();
- LOG.info("got: " + textMessage2);
- session.commit();
- assertTrue("JMSRedelivered flag is set", 
textMessage2.getJMSRedelivered());
-
- //send message to Q2 and consume from Q2
- MessageConsumer 

[02/50] [abbrv] activemq-artemis git commit: Fixed some test failures

2016-02-25 Thread clebertsuconic
Fixed some test failures


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

Branch: refs/heads/refactor-openwire
Commit: 610174b42b84d1764a35ebe1ccec13afeab8e23d
Parents: bdb27a9
Author: Howard Gao 
Authored: Thu Feb 18 20:52:32 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../openwire/OpenWireMessageConverter.java   |  7 +++
 .../core/protocol/openwire/amq/AMQSession.java   |  1 +
 .../artemiswrapper/ArtemisBrokerWrapper.java | 14 ++
 .../org/apache/activemq/broker/BrokerTest.java   | 19 +++
 4 files changed, 37 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/610174b4/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
index f61705e..d040955 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java
@@ -391,6 +391,13 @@ public class OpenWireMessageConverter implements 
MessageConverter {
  coreMessage.putStringProperty(AMQ_MSG_USER_ID, userId);
   }
   coreMessage.putBooleanProperty(AMQ_MSG_DROPPABLE, 
messageSend.isDroppable());
+
+  ActiveMQDestination origDest = messageSend.getOriginalDestination();
+  if (origDest != null) {
+ ByteSequence origDestBytes = marshaller.marshal(origDest);
+ origDestBytes.compact();
+ coreMessage.putBytesProperty(AMQ_MSG_ORIG_DESTINATION, 
origDestBytes.data);
+  }
}
 
private static void loadMapIntoProperties(TypedProperties props, 
Map map) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/610174b4/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
index 701c9ce..fe8d3c4 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java
@@ -255,6 +255,7 @@ public class AMQSession implements SessionCallback {
   ActiveMQDestination[] actualDestinations = null;
   if (destination.isComposite()) {
  actualDestinations = destination.getCompositeDestinations();
+ messageSend.setOriginalDestination(destination);
   }
   else {
  actualDestinations = new ActiveMQDestination[]{destination};

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/610174b4/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
index 3ad6072..5cb5048 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
@@ -29,9 +29,12 @@ import org.apache.activemq.artemis.api.core.SimpleString;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
+import org.apache.activemq.artemis.core.postoffice.Binding;
 import 

[40/50] [abbrv] activemq-artemis git commit: moving send method to the connection

2016-02-25 Thread clebertsuconic
moving send method to the connection


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

Branch: refs/heads/refactor-openwire
Commit: fd52dc3ba7c77a36ab5e5d2cfbd05782fb8534a9
Parents: 39ec393
Author: Clebert Suconic 
Authored: Wed Feb 24 14:26:55 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   | 39 ++--
 .../openwire/OpenWireProtocolManager.java   | 36 --
 2 files changed, 27 insertions(+), 48 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/fd52dc3b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 7c1c094..991f24b 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -22,9 +22,7 @@ import javax.jms.JMSSecurityException;
 import javax.jms.ResourceAllocationException;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -36,13 +34,9 @@ import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
 import org.apache.activemq.artemis.api.core.ActiveMQException;
 import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
 import org.apache.activemq.artemis.api.core.ActiveMQSecurityException;
-import 
org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManager;
-import org.apache.activemq.artemis.core.protocol.openwire.OpenWireUtil;
-import org.apache.activemq.artemis.core.protocol.openwire.SendingResult;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQCompositeConsumerBrokerExchange;
 import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
 import org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConsumer;
@@ -58,7 +52,6 @@ import 
org.apache.activemq.artemis.spi.core.protocol.AbstractRemotingConnection;
 import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.spi.core.remoting.Acceptor;
 import org.apache.activemq.artemis.spi.core.remoting.Connection;
-import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
 import org.apache.activemq.artemis.utils.ConcurrentHashSet;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.BrokerInfo;
@@ -104,7 +97,6 @@ import org.apache.activemq.wireformat.WireFormat;
 
 /**
  * Represents an activemq connection.
- * ToDo: extends AbstractRemotingConnection
  */
 public class OpenWireConnection extends AbstractRemotingConnection implements 
SecurityAuth {
 
@@ -214,7 +206,7 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 info.setResponseRequired(false);
 // if we don't respond to KeepAlive commands then the client will 
think the server is dead and timeout
 // for some reason KeepAliveInfo.isResponseRequired() is always 
false
-protocolManager.sendReply(this, info);
+sendCommand(info);
  }
  else {
 Response response = null;
@@ -333,7 +325,7 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
// throw a WireFormatInfo to the peer
public void init() {
   WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
-  protocolManager.send(this, info);
+  sendCommand(info);
}
 
public ConnectionState getState() {
@@ -536,7 +528,7 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
  m.setBrokerOutTime(endTime);
   }
 
-  protocolManager.send(this, dispatch);
+  

[06/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
index eb5bc61..c129791 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java
@@ -16,29 +16,23 @@
  */
 package org.apache.activemq.transport.failover;
 
-import junit.framework.Test;
-
 import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.ActiveMQMessageConsumer;
 import org.apache.activemq.AutoFailTestSupport;
-import org.apache.activemq.TestSupport;
-import org.apache.activemq.broker.BrokerPlugin;
-import org.apache.activemq.broker.BrokerPluginSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.ConnectionContext;
-import org.apache.activemq.broker.ConsumerBrokerExchange;
-import org.apache.activemq.broker.ProducerBrokerExchange;
-import org.apache.activemq.broker.region.RegionBroker;
-import org.apache.activemq.broker.util.DestinationPathSeparatorBroker;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.command.ConsumerInfo;
-import org.apache.activemq.command.MessageAck;
-import org.apache.activemq.command.TransactionId;
-import org.apache.activemq.store.PersistenceAdapter;
-import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter;
+import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQConnectionContext;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
 import org.apache.activemq.transport.TransportListener;
 import org.apache.activemq.util.SocketProxy;
+import org.jboss.byteman.contrib.bmunit.BMRule;
+import org.jboss.byteman.contrib.bmunit.BMRules;
+import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -69,28 +63,30 @@ import java.util.concurrent.atomic.AtomicBoolean;
 // see https://issues.apache.org/activemq/browse/AMQ-2473
 
 // https://issues.apache.org/activemq/browse/AMQ-2590
-public class FailoverTransactionTest extends TestSupport {
+@RunWith(BMUnitRunner.class)
+public class FailoverTransactionTest extends OpenwireArtemisBaseTest {
 
private static final Logger LOG = 
LoggerFactory.getLogger(FailoverTransactionTest.class);
private static final String QUEUE_NAME = "Failover.WithTx";
-   private static final String TRANSPORT_URI = "tcp://localhost:0";
-   private String url;
-   BrokerService broker;
+   private String url = newURI(0);
 
-   public static Test suite() {
-  return suite(FailoverTransactionTest.class);
-   }
+   private static final AtomicBoolean doByteman = new AtomicBoolean(false);
+   private static CountDownLatch brokerStopLatch;
+
+   private static SocketProxy proxy;
+   private static boolean firstSend;
+   private static int count;
+
+   private static EmbeddedJMS broker;
 
-   @Override
+   @Before
public void setUp() throws Exception {
-  super.setMaxTestTime(2 * 60 * 1000); // some boxes can be real slow
-  super.setAutoFail(true);
-  super.setUp();
+  doByteman.set(false);
+  brokerStopLatch = new CountDownLatch(1);
}
 
-   @Override
+   @After
public void tearDown() throws Exception {
-  super.tearDown();
   stopBroker();
}
 
@@ -101,39 +97,19 @@ public class FailoverTransactionTest extends TestSupport {
}
 
private void startCleanBroker() throws Exception {
-  startBroker(true);
-   }
-
-   public void startBroker(boolean deleteAllMessagesOnStartup) throws 
Exception {
-  broker = createBroker(deleteAllMessagesOnStartup);
-  broker.start();
+  startBroker();
}
 
-   public void startBroker(boolean deleteAllMessagesOnStartup, String 
bindAddress) throws Exception {
-  broker = createBroker(deleteAllMessagesOnStartup, bindAddress);
+   public void startBroker() throws Exception {
+  broker = createBroker();
   broker.start();
}
 
-   public BrokerService createBroker(boolean deleteAllMessagesOnStartup) 
throws Exception {
-  return createBroker(deleteAllMessagesOnStartup, TRANSPORT_URI);
-   }
-
-   public BrokerService createBroker(boolean deleteAllMessagesOnStartup, 
String bindAddress) throws Exception {
-  broker = new BrokerService();
-

[31/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
deleted file mode 100644
index be9e222..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java
+++ /dev/null
@@ -1,1505 +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.broker.jmx;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerInvocationHandler;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.TabularData;
-
-import junit.textui.TestRunner;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQPrefetchPolicy;
-import org.apache.activemq.ActiveMQSession;
-import org.apache.activemq.BlobMessage;
-import org.apache.activemq.EmbeddedBrokerTestSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.BaseDestination;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ActiveMQTempQueue;
-import org.apache.activemq.util.JMXSupport;
-import org.apache.activemq.util.URISupport;
-import org.apache.activemq.util.Wait;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A test case of the various MBeans in ActiveMQ. If you want to look at the
- * various MBeans after the test has been run then run this test case as a
- * command line application.
- */
-public class MBeanTest extends EmbeddedBrokerTestSupport {
-
-   private static final Logger LOG = LoggerFactory.getLogger(MBeanTest.class);
-
-   private static boolean waitForKeyPress;
-
-   protected MBeanServer mbeanServer;
-   protected String domain = "org.apache.activemq";
-   protected String clientID = "foo";
-
-   protected Connection connection;
-   protected boolean transacted;
-   protected int authMode = Session.AUTO_ACKNOWLEDGE;
-   protected static final int MESSAGE_COUNT = 2 * 
BaseDestination.MAX_PAGE_SIZE;
-   final static String QUEUE_WITH_OPTIONS = "QueueWithOptions";
-
-   /**
-* When you run this test case from the command line it will pause before
-* terminating so that you can look at the MBeans state for debugging
-* purposes.
-*/
-   public static void main(String[] args) {
-  waitForKeyPress = true;
-  TestRunner.run(MBeanTest.class);
-   }
-
-   public void testConnectors() throws Exception {
-  ObjectName brokerName = assertRegisteredObjectName(domain + 
":type=Broker,brokerName=localhost");
-  BrokerViewMBean broker = 
MBeanServerInvocationHandler.newProxyInstance(mbeanServer, brokerName, 
BrokerViewMBean.class, true);
-
-  assertEquals("openwire URL port doesn't equal bind Address", new 
URI(broker.getTransportConnectorByType("tcp")).getPort(), new 
URI(this.broker.getTransportConnectors().get(0).getPublishableConnectString()).getPort());
-   }
-
-   public void testMBeans() throws 

[35/50] [abbrv] activemq-artemis git commit: added jboss logging dependency

2016-02-25 Thread clebertsuconic
added jboss logging dependency


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

Branch: refs/heads/refactor-openwire
Commit: 1c7ab6f9628a3f4106f751f677b172620ed95a05
Parents: 6371d64
Author: Howard Gao 
Authored: Wed Feb 3 10:37:19 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 tests/activemq5-unit-tests/pom.xml | 11 +++
 1 file changed, 11 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/1c7ab6f9/tests/activemq5-unit-tests/pom.xml
--
diff --git a/tests/activemq5-unit-tests/pom.xml 
b/tests/activemq5-unit-tests/pom.xml
index e52b9a6..0f7c9ac 100644
--- a/tests/activemq5-unit-tests/pom.xml
+++ b/tests/activemq5-unit-tests/pom.xml
@@ -336,6 +336,17 @@
 
  
   
+   
+   
+   org.jboss.logging
+   jboss-logging
+   
+  
+org.jboss.logmanager
+jboss-logmanager
+  
 

 



[42/50] [abbrv] activemq-artemis git commit: More test fix. Enabled management in the wrapper class so some tests can use it to check some data.

2016-02-25 Thread clebertsuconic
More test fix.
Enabled management in the wrapper class so some tests can use
it to check some data.


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

Branch: refs/heads/refactor-openwire
Commit: 9aba647c731aa4fdf3fbf00b99e5aeca83b2c1c2
Parents: bc0b37f
Author: Howard Gao 
Authored: Mon Feb 22 21:03:39 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../apache/activemq/broker/BrokerService.java   |  1 -
 .../artemiswrapper/ArtemisBrokerWrapper.java| 20 +---
 .../org/apache/activemq/JMSConsumerTest.java| 52 +++-
 .../JmsDurableQueueWildcardSendReceiveTest.java |  2 +-
 .../JmsQueueWildcardSendReceiveTest.java|  2 +-
 .../org/apache/activemq/broker/BrokerTest.java  |  4 ++
 6 files changed, 59 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9aba647c/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
index 99de104..13d6b96 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -109,7 +109,6 @@ public class BrokerService implements Service {
private PolicyMap destinationPolicy;
private SystemUsage systemUsage;
 
-   private boolean isClustered = true;
private final List networkConnectors = new 
CopyOnWriteArrayList();
 
private TemporaryFolder tmpfolder;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/9aba647c/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
index 1c8ce9b..be1713b 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java
@@ -44,10 +44,14 @@ import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
 import org.apache.activemq.broker.region.policy.PolicyMap;
 
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
 public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
 
protected final Map testQueues = new HashMap<>();
protected JMSServerManagerImpl jmsServer;
+   protected MBeanServer mbeanServer;
 
public ArtemisBrokerWrapper(BrokerService brokerService, File 
temporaryFolder) {
   super(temporaryFolder);
@@ -57,10 +61,16 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase 
{
@Override
public void start() throws Exception {
   clearDataRecreateServerDirs();
+
+  mbeanServer = MBeanServerFactory.createMBeanServer();
+
   server = createServer(realStore, true);
+  server.setMBeanServer(mbeanServer);
+
   server.getConfiguration().getAcceptorConfigurations().clear();
 
   Configuration serverConfig = server.getConfiguration();
+  serverConfig.setJMXManagementEnabled(true);
 
   Map addressSettingsMap = 
serverConfig.getAddressesSettings();
 
@@ -155,11 +165,6 @@ public class ArtemisBrokerWrapper extends 
ArtemisBrokerBase {
 
   server.start();
 
-/*
- registerConnectionFactory();
- mbeanServer = MBeanServerFactory.createMBeanServer();
-*/
-
   ArtemisBrokerHelper.setBroker(this.bservice);
   stopped = false;
 
@@ -174,7 +179,6 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase 
{
   params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, 
bservice.KEYSTORE_PASSWORD);
   params.put(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME, 
bservice.storeType);
   if (bservice.SERVER_SIDE_TRUSTSTORE != null) {
- params.put(TransportConstants.NEED_CLIENT_AUTH_PROP_NAME, true);
  params.put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, 
bservice.SERVER_SIDE_TRUSTSTORE);
  

[08/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
index f80b09a..3d75905 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -34,22 +33,26 @@ import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.TransactionRolledBackException;
-
-import junit.framework.TestCase;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
 
 import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.TransportConnector;
-import org.apache.activemq.broker.region.Destination;
-import org.apache.activemq.broker.region.Queue;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.util.ServiceStopper;
+import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.artemis.core.config.Configuration;
+import org.apache.activemq.artemis.core.server.impl.QueueImpl;
+import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
+import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
+import org.apache.activemq.broker.artemiswrapper.OpenwireArtemisBaseTest;
 import org.apache.log4j.Logger;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
 
 /**
  * TestCase showing the message-destroying described in AMQ-1925
  */
-public class AMQ1925Test extends TestCase implements ExceptionListener {
+public class AMQ1925Test extends OpenwireArtemisBaseTest implements 
ExceptionListener {
 
private static final Logger log = Logger.getLogger(AMQ1925Test.class);
 
@@ -57,7 +60,7 @@ public class AMQ1925Test extends TestCase implements 
ExceptionListener {
private static final String PROPERTY_MSG_NUMBER = "NUMBER";
private static final int MESSAGE_COUNT = 1;
 
-   private BrokerService bs;
+   private EmbeddedJMS bs;
private URI tcpUri;
private ActiveMQConnectionFactory cf;
 
@@ -74,17 +77,13 @@ public class AMQ1925Test extends TestCase implements 
ExceptionListener {
   final CountDownLatch starter = new CountDownLatch(1);
   final AtomicBoolean restarted = new AtomicBoolean();
   new Thread(new Runnable() {
- @Override
  public void run() {
 try {
starter.await();
 
// Simulate broker failure & restart
bs.stop();
-   bs = new BrokerService();
-   bs.setPersistent(true);
-   bs.setUseJmx(true);
-   bs.addConnector(tcpUri);
+   bs = createNewServer();
bs.start();
 
restarted.set(true);
@@ -97,21 +96,21 @@ public class AMQ1925Test extends TestCase implements 
ExceptionListener {
 
   for (int i = 0; i < MESSAGE_COUNT; i++) {
  Message message = consumer.receive(500);
- assertNotNull("No Message " + i + " found", message);
+ Assert.assertNotNull("No Message " + i + " found", message);
 
  if (i < 10)
-assertFalse("Timing problem, restarted too soon", restarted.get());
+Assert.assertFalse("Timing problem, restarted too soon", 
restarted.get());
  if (i == 10) {
 starter.countDown();
  }
  if (i > MESSAGE_COUNT - 100) {
-assertTrue("Timing problem, restarted too late", restarted.get());
+Assert.assertTrue("Timing problem, restarted too late", 
restarted.get());
  }
 
- assertEquals(i, message.getIntProperty(PROPERTY_MSG_NUMBER));
+ Assert.assertEquals(i, message.getIntProperty(PROPERTY_MSG_NUMBER));
  session.commit();
   }
-  assertNull(consumer.receive(500));
+  Assert.assertNull(consumer.receive(500));
 
   consumer.close();
   session.close();
@@ -133,17 +132,13 @@ public class AMQ1925Test extends TestCase implements 
ExceptionListener {
   final CountDownLatch starter = new CountDownLatch(1);
   final AtomicBoolean restarted = new AtomicBoolean();
   new Thread(new Runnable() {
- @Override
  public void run() {
 try {
starter.await();
 
 

[22/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java
deleted file mode 100644
index 882105b..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java
+++ /dev/null
@@ -1,520 +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.bugs;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageListener;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.management.ObjectName;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQPrefetchPolicy;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.jmx.QueueViewMBean;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.util.Wait;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public class AMQ4083Test {
-
-   private static final transient Logger LOG = 
LoggerFactory.getLogger(AMQ3992Test.class);
-   private static BrokerService brokerService;
-   private static String BROKER_ADDRESS = "tcp://localhost:0";
-   private static String TEST_QUEUE = "testQueue";
-   private static ActiveMQQueue queue = new ActiveMQQueue(TEST_QUEUE);
-
-   private final int messageCount = 100;
-
-   private String connectionUri;
-   private String[] data;
-
-   @Before
-   public void setUp() throws Exception {
-  brokerService = new BrokerService();
-  brokerService.setPersistent(false);
-  brokerService.setUseJmx(true);
-  brokerService.setDeleteAllMessagesOnStartup(true);
-  connectionUri = 
brokerService.addConnector(BROKER_ADDRESS).getPublishableConnectString();
-  brokerService.start();
-  brokerService.waitUntilStarted();
-
-  data = new String[messageCount];
-
-  for (int i = 0; i < messageCount; i++) {
- data[i] = "Text for message: " + i + " at " + new Date();
-  }
-   }
-
-   @After
-   public void tearDown() throws Exception {
-  brokerService.stop();
-  brokerService.waitUntilStopped();
-   }
-
-   @Test
-   public void testExpiredMsgsBeforeNonExpired() throws Exception {
-
-  ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(connectionUri);
-  ActiveMQConnection connection = (ActiveMQConnection) 
factory.createConnection();
-  connection.getPrefetchPolicy().setQueuePrefetch(400);
-
-  Session session = connection.createSession(false, 
Session.CLIENT_ACKNOWLEDGE);
-
-  connection.start();
-
-  MessageProducer producer = session.createProducer(queue);
-  MessageConsumer consumer = session.createConsumer(queue);
-
-  // send a batch that expires in a short time.
-  for (int i = 0; i < 100; i++) {
- producer.send(session.createTextMessage(), DeliveryMode.PERSISTENT, 
4, 4000);
-  }
-
-  // and send one that doesn't expire to we can ack it.
-  producer.send(session.createTextMessage());
-
-  // wait long enough so the first batch times out.
-  TimeUnit.SECONDS.sleep(5);
-
-  final QueueViewMBean queueView = getProxyToQueueViewMBean();
-
-  assertEquals(101, queueView.getInFlightCount());
-
-  consumer.setMessageListener(new MessageListener() {
- @Override
- public void onMessage(Message message) {
-try {
-   message.acknowledge();
-}
-catch (JMSException e) {
-}
- 

[24/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java
deleted file mode 100644
index 74c19b7..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java
+++ /dev/null
@@ -1,763 +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.bugs;
-
-import static org.junit.Assert.assertTrue;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.network.DiscoveryNetworkConnector;
-import org.apache.activemq.network.NetworkConnector;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AMQ3274Test {
-
-   private static final transient Logger LOG = 
LoggerFactory.getLogger(AMQ3274Test.class);
-
-   protected static int Next_broker_num = 0;
-   protected EmbeddedTcpBroker broker1;
-   protected EmbeddedTcpBroker broker2;
-
-   protected int nextEchoId = 0;
-   protected boolean testError = false;
-
-   protected int echoResponseFill = 0; // Number of "filler" response messages 
per request
-
-   public AMQ3274Test() throws Exception {
-  broker1 = new EmbeddedTcpBroker();
-  broker2 = new EmbeddedTcpBroker();
-
-  broker1.coreConnectTo(broker2, true);
-  broker2.coreConnectTo(broker1, true);
-   }
-
-   public void logMessage(String msg) {
-  System.out.println(msg);
-  System.out.flush();
-   }
-
-   public void testMessages(Session sess,
-MessageProducer req_prod,
-Destination resp_dest,
-int num_msg) throws Exception {
-  MessageConsumer resp_cons;
-  TextMessage msg;
-  MessageClient cons_client;
-  int cur;
-  int tot_expected;
-
-  resp_cons = sess.createConsumer(resp_dest);
-
-  cons_client = new MessageClient(resp_cons, num_msg);
-  cons_client.start();
-
-  cur = 0;
-  while ((cur < num_msg) && (!testError)) {
- msg = sess.createTextMessage("MSG  " + cur);
- msg.setIntProperty("SEQ", 100 + cur);
- msg.setStringProperty("TEST", "TOPO");
- msg.setJMSReplyTo(resp_dest);
-
- if (cur == (num_msg - 1))
-msg.setBooleanProperty("end-of-response", true);
-
- req_prod.send(msg);
-
- cur++;
-  }
-
-  cons_client.waitShutdown(5000);
-
-  if (cons_client.shutdown()) {
- LOG.debug("Consumer client shutdown complete");
-  }
-  else {
- LOG.debug("Consumer client shutdown incomplete!!!");
-  }
-
-  tot_expected = num_msg * (echoResponseFill + 1);
-
-  if (cons_client.getNumMsgReceived() == tot_expected) {
- LOG.info("Have " + tot_expected + " messages, as-expected");
-  }
-  else {
- LOG.error("Have " + cons_client.getNumMsgReceived() + " messages; 
expected " + tot_expected);
- testError = true;
-  }
-
-  resp_cons.close();
-   }
-
-   /**
-* Test one destination between the given "producer broker" and
-* "consumer broker" specified.
-*/
-   public void testOneDest(Connection conn,
-   Session sess,
-   Destination cons_dest,
-   String prod_broker_url,
-   String cons_broker_url,
-   int num_msg) 

[18/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4887Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4887Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4887Test.java
deleted file mode 100644
index 657d7a2..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4887Test.java
+++ /dev/null
@@ -1,168 +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.bugs;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import javax.jms.BytesMessage;
-import javax.jms.Connection;
-import javax.jms.Destination;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.StreamMessage;
-
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AMQ4887Test {
-
-   private static final transient Logger LOG = 
LoggerFactory.getLogger(AMQ4887Test.class);
-   private static final Integer ITERATIONS = 10;
-
-   @Rule
-   public TestName name = new TestName();
-
-   @Test
-   public void testBytesMessageSetPropertyBeforeCopy() throws Exception {
-  ActiveMQConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory("vm://localhost");
-  ActiveMQConnection connection = (ActiveMQConnection) 
connectionFactory.createConnection();
-  connection.start();
-  doTestBytesMessageSetPropertyBeforeCopy(connection);
-   }
-
-   @Test
-   public void testBytesMessageSetPropertyBeforeCopyCompressed() throws 
Exception {
-  ActiveMQConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory("vm://localhost");
-  connectionFactory.setUseCompression(true);
-  ActiveMQConnection connection = (ActiveMQConnection) 
connectionFactory.createConnection();
-  connection.start();
-  doTestBytesMessageSetPropertyBeforeCopy(connection);
-   }
-
-   public void doTestBytesMessageSetPropertyBeforeCopy(Connection connection) 
throws Exception {
-
-  Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
-  Destination destination = session.createQueue(name.toString());
-  MessageConsumer consumer = session.createConsumer(destination);
-  MessageProducer producer = session.createProducer(destination);
-
-  BytesMessage message = session.createBytesMessage();
-
-  for (int i = 0; i < ITERATIONS; i++) {
-
- long sendTime = System.currentTimeMillis();
- message.setLongProperty("sendTime", sendTime);
- producer.send(message);
-
- LOG.debug("Receiving message " + i);
- Message receivedMessage = consumer.receive(5000);
- assertNotNull("On message " + i, receivedMessage);
- assertTrue("On message " + i, receivedMessage instanceof 
BytesMessage);
-
- BytesMessage receivedBytesMessage = (BytesMessage) receivedMessage;
-
- int numElements = 0;
- try {
-while (true) {
-   receivedBytesMessage.readBoolean();
-   numElements++;
-}
- }
- catch (Exception ex) {
- }
-
- LOG.info("Iteration [{}]: Received Message contained {} boolean 
values.", i, numElements);
- assertEquals(i, numElements);
-
- long receivedSendTime = 
receivedBytesMessage.getLongProperty("sendTime");
- assertEquals("On message " + i, receivedSendTime, sendTime);
-
- // Add a new bool value on each iteration.
- message.writeBoolean(true);
-  }
-   }
-
-   @Test
-   public void testStreamMessageSetPropertyBeforeCopy() throws Exception {
-  ActiveMQConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory("vm://localhost");
-  ActiveMQConnection connection = 

[38/50] [abbrv] activemq-artemis git commit: Fix "Address already in use" issues in testsuite. Excluded a test from test suite that seems to cause hang for now.

2016-02-25 Thread clebertsuconic
Fix "Address already in use" issues in testsuite.
Excluded a test from test suite that seems to cause hang for now.


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

Branch: refs/heads/refactor-openwire
Commit: 3ab1359751dd6d7f26c60abab9ceffb9d20a897d
Parents: fda6e33
Author: Howard Gao 
Authored: Fri Feb 5 23:05:54 2016 +0800
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 tests/activemq5-unit-tests/pom.xml |  3 +++
 .../artemiswrapper/ArtemisBrokerHelper.java|  9 -
 .../org/apache/activemq/broker/BrokerService.java  |  2 +-
 .../transport/tcp/TcpTransportFactory.java |  4 +++-
 .../activemq/ReconnectWithSameClientIDTest.java|  1 +
 .../org/apache/activemq/RemoveDestinationTest.java |  2 ++
 .../java/org/apache/activemq/TimeStampTest.java|  6 +++---
 .../apache/activemq/TransactionContextTest.java| 17 ++---
 .../apache/activemq/ZeroPrefetchConsumerTest.java  |  4 +++-
 .../failover/ConnectionHangOnStartupTest.java  |  4 
 .../transport/tcp/TcpTransportBindTest.java|  5 +++--
 11 files changed, 41 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3ab13597/tests/activemq5-unit-tests/pom.xml
--
diff --git a/tests/activemq5-unit-tests/pom.xml 
b/tests/activemq5-unit-tests/pom.xml
index 2782627..a17847e 100644
--- a/tests/activemq5-unit-tests/pom.xml
+++ b/tests/activemq5-unit-tests/pom.xml
@@ -427,6 +427,9 @@
   
**/org/apache/activemq/blob/BlobTransferPolicyUriTest.java


+  
+  
**/org/apache/activemq/transport/failover/FailoverTransactionTest.java
+
   
   
**/org/apache/activemq/PerDestinationStoreLimitTest.java
   
**/org/apache/activemq/ProducerFlowControlTest.java

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3ab13597/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
index bc4bb11..4161859 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/artemiswrapper/ArtemisBrokerHelper.java
@@ -42,6 +42,7 @@ public class ArtemisBrokerHelper {
// start a tcp transport artemis broker, the broker need to
// be invm with client.
public static void startArtemisBroker(URI location) throws IOException {
+  System.out.println("---starting broker, service is there? " + service);
   if (service != null) {
  return;
   }
@@ -49,6 +50,7 @@ public class ArtemisBrokerHelper {
  service = serviceClass.newInstance();
  Method startMethod = serviceClass.getMethod("start");
  startMethod.invoke(service, (Object[]) null);
+ System.out.println("started a service instance: " + service);
   }
   catch (InstantiationException e) {
  throw new IOException("Inst exception", e);
@@ -79,19 +81,24 @@ public class ArtemisBrokerHelper {
//to prevent auto broker creation.
public static void setBroker(Object startedBroker) {
   service = startedBroker;
+  System.out.println("somebody set a broker service: " + service);
}
 
public static BrokerService getBroker() {
   return (BrokerService) service;
}
 
-   public static void stopArtemisBroker() throws Exception {
+   public static void stopArtemisBroker() {
   try {
  if (service != null) {
 Method startMethod = serviceClass.getMethod("stop");
 startMethod.invoke(service, (Object[]) null);
+System.out.println("stopped the service instance: " + service);
  }
   }
+  catch (Exception e) {
+ e.printStackTrace();
+  }
   finally {
  service = null;
   }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3ab13597/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
--
diff --git 

[12/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
deleted file mode 100644
index a70ef67..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/MessagePriorityTest.java
+++ /dev/null
@@ -1,584 +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.store;
-
-import javax.jms.Connection;
-import javax.jms.DeliveryMode;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.MessageProducer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-import javax.jms.TopicSubscriber;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.ActiveMQPrefetchPolicy;
-import org.apache.activemq.CombinationTestSupport;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.broker.region.policy.SharedDeadLetterStrategy;
-import 
org.apache.activemq.broker.region.policy.StorePendingDurableSubscriberMessageStoragePolicy;
-import org.apache.activemq.command.ActiveMQDestination;
-import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ActiveMQTopic;
-import org.apache.activemq.util.Wait;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-abstract public class MessagePriorityTest extends CombinationTestSupport {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(MessagePriorityTest.class);
-
-   BrokerService broker;
-   PersistenceAdapter adapter;
-
-   protected ActiveMQConnectionFactory factory;
-   protected Connection conn;
-   protected Session sess;
-
-   public boolean useCache = true;
-   public int deliveryMode = Message.DEFAULT_DELIVERY_MODE;
-   public boolean dispatchAsync = true;
-   public boolean prioritizeMessages = true;
-   public boolean immediatePriorityDispatch = true;
-   public int prefetchVal = 500;
-   public int expireMessagePeriod = 3;
-
-   public int MSG_NUM = 600;
-   public int HIGH_PRI = 7;
-   public int LOW_PRI = 3;
-
-   abstract protected PersistenceAdapter createPersistenceAdapter(boolean 
delete) throws Exception;
-
-   @Override
-   protected void setUp() throws Exception {
-  broker = new BrokerService();
-  broker.setBrokerName("priorityTest");
-  broker.setAdvisorySupport(false);
-  adapter = createPersistenceAdapter(true);
-  broker.setPersistenceAdapter(adapter);
-  PolicyEntry policy = new PolicyEntry();
-  policy.setPrioritizedMessages(prioritizeMessages);
-  policy.setUseCache(useCache);
-  policy.setExpireMessagesPeriod(expireMessagePeriod);
-  StorePendingDurableSubscriberMessageStoragePolicy durableSubPending = 
new StorePendingDurableSubscriberMessageStoragePolicy();
-  
durableSubPending.setImmediatePriorityDispatch(immediatePriorityDispatch);
-  durableSubPending.setUseCache(useCache);
-  policy.setPendingDurableSubscriberPolicy(durableSubPending);
-  PolicyMap policyMap = new PolicyMap();
-  policyMap.put(new ActiveMQQueue("TEST"), policy);
-  policyMap.put(new ActiveMQTopic("TEST"), policy);
-
-  // do not process expired for one test
-  PolicyEntry ignoreExpired = new PolicyEntry();
-  SharedDeadLetterStrategy ignoreExpiredStrategy = new 
SharedDeadLetterStrategy();
-  ignoreExpiredStrategy.setProcessExpired(false);
-  ignoreExpired.setDeadLetterStrategy(ignoreExpiredStrategy);
-  policyMap.put(new ActiveMQTopic("TEST_CLEANUP_NO_PRIORITY"), 
ignoreExpired);
-
-  broker.setDestinationPolicy(policyMap);
-  broker.start();
-  broker.waitUntilStarted();
-
-  factory = new ActiveMQConnectionFactory("vm://priorityTest");
-  ActiveMQPrefetchPolicy prefetch = new ActiveMQPrefetchPolicy();
-  

[20/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4469Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4469Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4469Test.java
deleted file mode 100644
index e80b05c..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4469Test.java
+++ /dev/null
@@ -1,113 +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.bugs;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
-
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.broker.TransportConnector;
-import org.apache.activemq.transport.tcp.TcpTransportServer;
-import org.apache.activemq.util.Wait;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.jms.support.JmsUtils;
-
-public class AMQ4469Test {
-
-   private static final int maxConnections = 100;
-
-   private final ExecutorService executor = Executors.newCachedThreadPool();
-   private String connectionUri;
-   private BrokerService service;
-   private TransportConnector connector;
-
-   @Before
-   public void setUp() throws Exception {
-  service = new BrokerService();
-  service.setPersistent(false);
-  service.setUseJmx(false);
-  connector = service.addConnector("tcp://0.0.0.0:0?maximumConnections=" + 
maxConnections);
-  connectionUri = connector.getPublishableConnectString();
-  service.start();
-  service.waitUntilStarted();
-   }
-
-   protected ConnectionFactory createConnectionFactory() throws Exception {
-  return new ActiveMQConnectionFactory(connectionUri);
-   }
-
-   @Test
-   public void testMaxConnectionControl() throws Exception {
-  final ConnectionFactory cf = createConnectionFactory();
-  final CountDownLatch startupLatch = new CountDownLatch(1);
-  for (int i = 0; i < maxConnections + 20; i++) {
- executor.submit(new Runnable() {
-@Override
-public void run() {
-   Connection conn = null;
-   try {
-  startupLatch.await();
-  conn = cf.createConnection();
-  conn.start();
-   }
-   catch (Exception e) {
-  e.printStackTrace();
-  JmsUtils.closeConnection(conn);
-   }
-}
- });
-  }
-
-  TcpTransportServer transportServer = (TcpTransportServer) 
connector.getServer();
-  // ensure the max connections is in effect
-  assertEquals(maxConnections, transportServer.getMaximumConnections());
-  // No connections at first
-  assertEquals(0, connector.getConnections().size());
-  // Release the latch to set up connections in parallel
-  startupLatch.countDown();
-  TimeUnit.SECONDS.sleep(5);
-
-  final TransportConnector connector = this.connector;
-
-  // Expect the max connections is created
-  assertTrue("Expected: " + maxConnections + " found: " + 
connector.getConnections().size(), Wait.waitFor(new Wait.Condition() {
-@Override
-public boolean isSatisified() throws Exception {
-   return connector.getConnections().size() == 
maxConnections;
-}
- }));
-   }
-
-   @After
-   public void tearDown() throws Exception {
-  executor.shutdown();
-
-  service.stop();
-  service.waitUntilStopped();
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4472Test.java

[43/50] [abbrv] activemq-artemis git commit: investigation tests

2016-02-25 Thread clebertsuconic
investigation tests

don't merge this commit on master, this is to be removed... just something that 
Clebert is using to debug openwire packets


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

Branch: refs/heads/refactor-openwire
Commit: 6a7795198159612db584849e276ab3ac659d2036
Parents: 545b8c9
Author: Clebert Suconic 
Authored: Tue Feb 23 21:51:05 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../integration/openwire/BasicOpenWireTest.java |   4 +
 .../InvestigationOpenwireTest.java  | 184 +++
 2 files changed, 188 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6a779519/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
--
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
index d2e3215..09fd9b7 100644
--- 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java
@@ -31,6 +31,7 @@ import org.apache.activemq.ActiveMQConnection;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.artemis.api.core.ActiveMQNonExistentQueueException;
 import org.apache.activemq.artemis.api.core.SimpleString;
+import org.apache.activemq.ActiveMQXAConnectionFactory;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.junit.After;
 import org.junit.Before;
@@ -44,6 +45,9 @@ public class BasicOpenWireTest extends OpenWireTestBase {
 
protected static final String urlString = "tcp://" + OWHOST + ":" + OWPORT 
+ "?wireFormat.cacheEnabled=true";
protected ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(urlString);
+   protected ActiveMQXAConnectionFactory xaFactory = new 
ActiveMQXAConnectionFactory(urlString);
+
+
protected ActiveMQConnection connection;
protected String topicName = "amqTestTopic1";
protected String queueName = "amqTestQueue1";

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6a779519/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java
--
diff --git 
a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java
 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java
new file mode 100644
index 000..3614b9a
--- /dev/null
+++ 
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/investigations/InvestigationOpenwireTest.java
@@ -0,0 +1,184 @@
+/**
+ * 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.integration.openwire.investigations;
+
+import 
org.apache.activemq.artemis.tests.integration.openwire.BasicOpenWireTest;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.jms.*;
+import javax.transaction.xa.XAResource;
+import java.util.Collection;
+import java.util.LinkedList;
+
+public class InvestigationOpenwireTest extends BasicOpenWireTest {
+
+   @Test
+   public void testSimple() throws Exception {
+  try {
+
+ Connection connection = factory.createConnection();
+ //  Thread.sleep(5000);
+
+ 

[33/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
index ffdfc6e..d34f943 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -16,22 +16,25 @@
  */
 package org.apache.activemq.broker;
 
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.ServerSocket;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.WeakHashMap;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.activemq.ActiveMQConnectionMetaData;
 import org.apache.activemq.Service;
@@ -44,6 +47,8 @@ import org.apache.activemq.broker.region.policy.PolicyMap;
 import org.apache.activemq.broker.scheduler.JobSchedulerStore;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.BrokerId;
+import org.apache.activemq.network.ConnectionFilter;
+import org.apache.activemq.network.DiscoveryNetworkConnector;
 import org.apache.activemq.network.NetworkConnector;
 import org.apache.activemq.network.jms.JmsConnector;
 import org.apache.activemq.proxy.ProxyConnector;
@@ -57,6 +62,7 @@ import org.apache.activemq.usage.SystemUsage;
 import org.apache.activemq.util.IOExceptionHandler;
 import org.apache.activemq.util.IOHelper;
 import org.apache.activemq.util.ServiceStopper;
+import org.junit.rules.TemporaryFolder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -68,10 +74,12 @@ import org.slf4j.LoggerFactory;
 public class BrokerService implements Service {
 
public static final String DEFAULT_PORT = "61616";
+   public static final AtomicInteger RANDOM_PORT_BASE = new 
AtomicInteger(51616);
public static final String DEFAULT_BROKER_NAME = "localhost";
public static final String BROKER_VERSION;
public static final int DEFAULT_MAX_FILE_LENGTH = 1024 * 1024 * 32;
public static final long DEFAULT_START_TIMEOUT = 60L;
+   public static boolean disableWrapper = false;
 
public String SERVER_SIDE_KEYSTORE;
public String KEYSTORE_PASSWORD;
@@ -99,6 +107,11 @@ public class BrokerService implements Service {
private PolicyMap destinationPolicy;
private SystemUsage systemUsage;
 
+   private boolean isClustered = true;
+   private final List networkConnectors = new 
CopyOnWriteArrayList();
+
+   private TemporaryFolder tmpfolder;
+
public static WeakHashMap map = new WeakHashMap<>();
 
static {
@@ -131,6 +144,10 @@ public class BrokerService implements Service {
 
@Override
public void start() throws Exception {
+  File targetTmp = new File("./target/tmp");
+  targetTmp.mkdirs();
+  tmpfolder = new TemporaryFolder(targetTmp);
+  tmpfolder.create();
   Exception e = new Exception();
   e.fillInStackTrace();
   startBroker(startAsync);
@@ -188,10 +205,10 @@ public class BrokerService implements Service {
   LOG.info("Apache ActiveMQ Artemis{} ({}, {}) is shutting down", new 
Object[]{getBrokerVersion(), getBrokerName(), brokerId});
 
   if (broker != null) {
- System.out.println("__stopping broker: " + 
broker.getClass().getName());
  broker.stop();
  broker = null;
   }
+  tmpfolder.delete();
   LOG.info("Apache ActiveMQ Artemis {} ({}, {}) is shutdown", new 
Object[]{getBrokerVersion(), getBrokerName(), brokerId});
}
 
@@ -200,7 +217,7 @@ public class BrokerService implements Service {
 
public Broker getBroker() throws Exception {
   if (broker == null) {
- broker = createBroker();
+ broker = createBroker(tmpfolder.getRoot());
   }
   return broker;
}
@@ -220,13 +237,14 @@ public class BrokerService implements Service {
   this.brokerName = str.trim();
}
 
-   protected Broker createBroker() throws Exception {
-  broker = createBrokerWrapper();
+   protected Broker createBroker(File temporaryFile) throws Exception {
+  new Exception("file=" + 
temporaryFile.getAbsolutePath()).printStackTrace();
+  broker = createBrokerWrapper(temporaryFile);
   

[23/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java
deleted file mode 100644
index 7556def..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java
+++ /dev/null
@@ -1,109 +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.bugs;
-
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import org.apache.activemq.broker.BrokerService;
-import 
org.apache.activemq.broker.region.policy.FilePendingSubscriberMessageStoragePolicy;
-import 
org.apache.activemq.broker.region.policy.LastImageSubscriptionRecoveryPolicy;
-import org.apache.activemq.broker.region.policy.PolicyEntry;
-import org.apache.activemq.broker.region.policy.PolicyMap;
-import org.apache.activemq.transport.stomp.Stomp;
-import org.apache.activemq.transport.stomp.StompConnection;
-import org.apache.activemq.util.DefaultTestAppender;
-import org.apache.log4j.Appender;
-import org.apache.log4j.Logger;
-import org.apache.log4j.spi.LoggingEvent;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class AMQ3622Test {
-
-   protected BrokerService broker;
-   protected AtomicBoolean failed = new AtomicBoolean(false);
-   protected String connectionUri;
-   protected Appender appender = new DefaultTestAppender() {
-
-  @Override
-  public void doAppend(LoggingEvent event) {
- System.err.println(event.getMessage());
- if (event.getThrowableInformation() != null) {
-if (event.getThrowableInformation().getThrowable() instanceof 
NullPointerException) {
-   failed.set(true);
-}
- }
-  }
-   };
-
-   @Before
-   public void before() throws Exception {
-  Logger.getRootLogger().addAppender(appender);
-
-  broker = new BrokerService();
-  broker.setDataDirectory("target" + File.separator + "activemq-data");
-  broker.setPersistent(true);
-  broker.setDeleteAllMessagesOnStartup(true);
-  PolicyEntry policy = new PolicyEntry();
-  policy.setTopic(">");
-  policy.setProducerFlowControl(false);
-  policy.setMemoryLimit(1 * 1024 * 1024);
-  policy.setPendingSubscriberPolicy(new 
FilePendingSubscriberMessageStoragePolicy());
-  policy.setSubscriptionRecoveryPolicy(new 
LastImageSubscriptionRecoveryPolicy());
-  policy.setExpireMessagesPeriod(500);
-  List entries = new ArrayList<>();
-
-  entries.add(policy);
-  PolicyMap pMap = new PolicyMap();
-  pMap.setPolicyEntries(entries);
-  broker.setDestinationPolicy(pMap);
-
-  connectionUri = 
broker.addConnector("stomp://localhost:0").getPublishableConnectString();
-
-  broker.start();
-  broker.waitUntilStarted();
-   }
-
-   @After
-   public void after() throws Exception {
-  broker.stop();
-  broker.waitUntilStopped();
-  Logger.getRootLogger().removeAppender(appender);
-   }
-
-   @Test
-   public void go() throws Exception {
-  StompConnection connection = new StompConnection();
-  Integer port = Integer.parseInt(connectionUri.split(":")[2]);
-  connection.open("localhost", port);
-  connection.connect("", "");
-  connection.subscribe("/topic/foobar", 
Stomp.Headers.Subscribe.AckModeValues.CLIENT);
-  connection.disconnect();
-  Thread.sleep(1000);
-
-  if (failed.get()) {
- fail("Received NullPointerException");
-  }
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3625Test.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3625Test.java
 

[48/50] [abbrv] activemq-artemis git commit: fixing tests and removing new Executor().run(...) usages

2016-02-25 Thread clebertsuconic
fixing tests and removing new Executor().run(...) usages


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

Branch: refs/heads/refactor-openwire
Commit: 03a54d8311a1428c4c4dbd586552b1e4fb704dcb
Parents: 89855fd
Author: Clebert Suconic 
Authored: Wed Feb 24 13:17:03 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:23 2016 -0500

--
 .../FailoverConsumerOutstandingCommitTest.java  | 14 +++
 .../FailoverConsumerUnconsumedTest.java | 16 
 .../failover/FailoverDuplicateTest.java |  8 ++--
 .../failover/FailoverPrefetchZeroTest.java  |  8 ++--
 .../failover/FailoverTransactionTest.java   | 40 ++--
 .../TwoBrokerQueueClientsReconnectTest.java |  8 ++--
 6 files changed, 47 insertions(+), 47 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03a54d83/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
index 705c033..5a160ab 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java
@@ -139,7 +139,7 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
   });
 
   // may block if broker shutodwn happens quickly
-  Executors.newSingleThreadExecutor().execute(new Runnable() {
+  new Thread() {
  public void run() {
 LOG.info("producer started");
 try {
@@ -153,9 +153,9 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
 }
 LOG.info("producer done");
  }
-  });
+  }.start();
 
-  // will be stopped by the plugin
+   // will be stopped by the plugin
   brokerStopLatch.await();
   server.stop();
   server = createBroker();
@@ -253,7 +253,7 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
   });
 
   // may block if broker shutdown happens quickly
-  Executors.newSingleThreadExecutor().execute(new Runnable() {
+  new Thread() {
  public void run() {
 LOG.info("producer started");
 try {
@@ -267,7 +267,7 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
 }
 LOG.info("producer done");
  }
-  });
+  }.start();
 
   // will be stopped by the plugin
   brokerStopLatch.await();
@@ -364,7 +364,7 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
 
public static void stopServerInTransaction() {
   if (doByteman.get()) {
- Executors.newSingleThreadExecutor().execute(new Runnable() {
+ new Thread() {
 public void run() {
LOG.info("Stopping broker in transaction...");
try {
@@ -377,7 +377,7 @@ public class FailoverConsumerOutstandingCommitTest extends 
OpenwireArtemisBaseTe
   brokerStopLatch.countDown();
}
 }
- });
+ }.start();
   }
}
 }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/03a54d83/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
index 10927f2..fb9479c 100644
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
+++ 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java
@@ -180,7 +180,7 @@ public class FailoverConsumerUnconsumedTest extends 
OpenwireArtemisBaseTest {
 
   final CountDownLatch shutdownConsumerAdded = new CountDownLatch(1);
 
-  

[50/50] [abbrv] activemq-artemis git commit: more refactorings on producers

2016-02-25 Thread clebertsuconic
more refactorings on producers


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

Branch: refs/heads/refactor-openwire
Commit: 566e39b7bbc38ca3224c9853a1789bd8313ade53
Parents: 20476a9
Author: Clebert Suconic 
Authored: Thu Feb 25 18:10:18 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 18:10:28 2016 -0500

--
 .../protocol/openwire/OpenWireConnection.java   | 190 +--
 .../core/protocol/openwire/OpenWireUtil.java|  23 +--
 .../artemis/core/server/ActiveMQServer.java |   4 +
 .../core/server/impl/ActiveMQServerImpl.java|  71 +++
 .../core/server/impl/ServerSessionImpl.java |  56 +-
 .../InvestigationOpenwireTest.java  |  17 +-
 6 files changed, 181 insertions(+), 180 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/566e39b7/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index dc2a8a6..6839259 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -51,7 +51,9 @@ import 
org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSingleConsumerB
 import org.apache.activemq.artemis.core.remoting.FailureListener;
 import org.apache.activemq.artemis.core.security.CheckType;
 import org.apache.activemq.artemis.core.security.SecurityAuth;
+import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle;
 import org.apache.activemq.artemis.core.server.ActiveMQServerLogger;
+import org.apache.activemq.artemis.core.server.BindingQueryResult;
 import org.apache.activemq.artemis.core.server.Queue;
 import org.apache.activemq.artemis.core.server.ServerConsumer;
 import org.apache.activemq.artemis.core.server.SlowConsumerDetectionListener;
@@ -146,6 +148,7 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
private String defaultSocketURIString;
 
+   // TODO-NOW: check on why there are two connections created for every 
createConnection on the client.
public OpenWireConnection(Connection connection,
  Executor executor,
  OpenWireProtocolManager openWireProtocolManager,
@@ -267,13 +270,25 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
  }
   }
-  catch (IOException e) {
+  catch (Exception e) {
+ ActiveMQServerLogger.LOGGER.debug(e);
 
- // TODO-NOW: send errors
- ActiveMQServerLogger.LOGGER.error("error decoding", e);
-  }
-  catch (Throwable t) {
- ActiveMQServerLogger.LOGGER.error("error decoding", t);
+ Response resp;
+ if (e instanceof ActiveMQSecurityException) {
+resp = new ExceptionResponse(new 
JMSSecurityException(e.getMessage()));
+ }
+ else if (e instanceof ActiveMQNonExistentQueueException) {
+resp = new ExceptionResponse(new 
InvalidDestinationException(e.getMessage()));
+ }
+ else {
+resp = new ExceptionResponse(e);
+ }
+ try {
+dispatch(resp);
+ }
+ catch (IOException e2) {
+ActiveMQServerLogger.LOGGER.warn(e.getMessage(), e2);
+ }
   }
}
 
@@ -861,6 +876,22 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
   }
}
 
+   /**
+* Checks to see if this destination exists.  If it does not throw an 
invalid destination exception.
+*
+* @param destination
+*/
+   private void validateDestination(ActiveMQDestination destination) throws 
Exception {
+  if (destination.isQueue()) {
+ SimpleString physicalName = OpenWireUtil.toCoreAddress(destination);
+ BindingQueryResult result = 
protocolManager.getServer().bindingQuery(physicalName);
+ if (!result.isExists() && !result.isAutoCreateJmsQueues()) {
+throw ActiveMQMessageBundle.BUNDLE.noSuchQueue(physicalName);
+ }
+ 

[32/50] [abbrv] activemq-artemis git commit: open wire changes equivalent to ab16f7098fb52d2b4c40627ed110e1776525f208

2016-02-25 Thread clebertsuconic
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6371d64f/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/LargeStreamletTest.java
--
diff --git 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/LargeStreamletTest.java
 
b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/LargeStreamletTest.java
deleted file mode 100644
index 37899e8..000
--- 
a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/LargeStreamletTest.java
+++ /dev/null
@@ -1,170 +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;
-
-/**
- * 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.
- */
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Random;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import javax.jms.Destination;
-import javax.jms.Session;
-
-import junit.framework.TestCase;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author rnewson
- */
-public final class LargeStreamletTest extends TestCase {
-
-   private static final Logger LOG = 
LoggerFactory.getLogger(LargeStreamletTest.class);
-   private static final String BROKER_URL = 
"vm://localhost?broker.persistent=false";
-   private static final int BUFFER_SIZE = 1 * 1024;
-   private static final int MESSAGE_COUNT = 10 * 1024;
-
-   protected Exception writerException;
-   protected Exception readerException;
-
-   private final AtomicInteger totalRead = new AtomicInteger();
-   private final AtomicInteger totalWritten = new AtomicInteger();
-   private final AtomicBoolean stopThreads = new AtomicBoolean(false);
-
-   public void testStreamlets() throws Exception {
-  final ActiveMQConnectionFactory factory = new 
ActiveMQConnectionFactory(BROKER_URL);
-
-  final ActiveMQConnection connection = (ActiveMQConnection) 
factory.createConnection();
-  connection.start();
-  try {
- final Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
- try {
-final Destination destination = session.createQueue("wibble");
-final Thread readerThread = new Thread(new Runnable() {
-
-   @Override
-   public void run() {
-  totalRead.set(0);
-  try {
- final InputStream inputStream = 
connection.createInputStream(destination);
- try {
-int read;
-final byte[] buf = new byte[BUFFER_SIZE];
-while (!stopThreads.get() && (read = 
inputStream.read(buf)) != -1) {
-   totalRead.addAndGet(read);
-}
- }
- finally {
-inputStream.close();
- }
-  }
-  catch (Exception e) {
- readerException = e;
- e.printStackTrace();
-  }
-  finally {
- LOG.info(totalRead + " total bytes read.");
-  }
-   }
-});
-
-final Thread writerThread = new Thread(new Runnable() {
-   private final Random random = new Random();
-
-   @Override
-   public void run() {
- 

Jenkins build became unstable: ActiveMQ-Java8 » ActiveMQ :: HTTP Protocol Support #616

2016-02-25 Thread Apache Jenkins Server
See 




Jenkins build is still unstable: ActiveMQ-Java8 #616

2016-02-25 Thread Apache Jenkins Server
See 



Jenkins build became unstable: ActiveMQ-Java8 » ActiveMQ :: AMQP #616

2016-02-25 Thread Apache Jenkins Server
See 




Jenkins build became unstable: ActiveMQ-Java8 » ActiveMQ :: RA #616

2016-02-25 Thread Apache Jenkins Server
See 




Jenkins build is still unstable: ActiveMQ-Java8 » ActiveMQ :: Unit Tests #616

2016-02-25 Thread Apache Jenkins Server
See 




Jenkins build became unstable: ActiveMQ-Java8 » ActiveMQ :: LevelDB Store #616

2016-02-25 Thread Apache Jenkins Server
See 




[1/2] activemq-artemis git commit: ARTEMIS-422 support appendRollbackRecord

2016-02-25 Thread clebertsuconic
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8196b1ddf -> e202240cc


ARTEMIS-422 support appendRollbackRecord


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

Branch: refs/heads/master
Commit: e64ecf5523f7f5a0ce924cc4bf2666ece425f135
Parents: 8196b1d
Author: jbertram 
Authored: Thu Feb 25 13:31:19 2016 -0600
Committer: jbertram 
Committed: Thu Feb 25 13:31:19 2016 -0600

--
 .../artemis/core/journal/impl/FileWrapperJournal.java   | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/e64ecf55/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
--
diff --git 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
index cf09fd7..2be9200 100644
--- 
a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
+++ 
b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java
@@ -41,6 +41,7 @@ import 
org.apache.activemq.artemis.core.journal.impl.dataformat.JournalCompleteR
 import 
org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecord;
 import 
org.apache.activemq.artemis.core.journal.impl.dataformat.JournalDeleteRecordTX;
 import 
org.apache.activemq.artemis.core.journal.impl.dataformat.JournalInternalRecord;
+import 
org.apache.activemq.artemis.core.journal.impl.dataformat.JournalRollbackRecordTX;
 
 /**
  * Journal used at a replicating backup server during the synchronization of 
data with the 'live'
@@ -208,13 +209,18 @@ public final class FileWrapperJournal extends JournalBase 
{
   return FileWrapperJournal.class.getName() + "(currentFile=[" + 
currentFile + "], hash=" + super.toString() + ")";
}
 
-   // UNSUPPORTED STUFF
-
@Override
public void appendRollbackRecord(long txID, boolean sync, IOCompletion 
callback) throws Exception {
-  throw new ActiveMQUnsupportedPacketException();
+  JournalInternalRecord rollbackRecord = new JournalRollbackRecordTX(txID);
+  AtomicInteger value = transactions.remove(Long.valueOf(txID));
+  if (value != null) {
+ rollbackRecord.setNumberOfRecords(value.get());
+  }
+  writeRecord(rollbackRecord, sync, callback);
}
 
+   // UNSUPPORTED STUFF
+
@Override
public JournalLoadInformation load(LoaderCallback reloadManager) throws 
Exception {
   throw new ActiveMQUnsupportedPacketException();



[2/2] activemq-artemis git commit: This closes #406

2016-02-25 Thread clebertsuconic
This closes #406


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

Branch: refs/heads/master
Commit: e202240ccc9ac5708ca8321e5951001a7d9c0897
Parents: 8196b1d e64ecf5
Author: Clebert Suconic 
Authored: Thu Feb 25 15:14:47 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 15:14:47 2016 -0500

--
 .../artemis/core/journal/impl/FileWrapperJournal.java   | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)
--




activemq-artemis git commit: fixing SlowConsumerDetection

2016-02-25 Thread clebertsuconic
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 3c9e1cb5e -> 6c686530e


fixing SlowConsumerDetection


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

Branch: refs/heads/refactor-openwire
Commit: 6c686530e21d375acf8a5fa60f9089a62e6775c7
Parents: 3c9e1cb
Author: Clebert Suconic 
Authored: Thu Feb 25 14:40:04 2016 -0500
Committer: Clebert Suconic 
Committed: Thu Feb 25 14:40:04 2016 -0500

--
 .../core/protocol/openwire/OpenWireConnection.java | 12 +---
 .../protocol/openwire/OpenWireProtocolManager.java | 17 -
 .../core/server/impl/ServerConsumerImpl.java   |  4 +++-
 3 files changed, 16 insertions(+), 17 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6c686530/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
index 6f2e3be..dc2a8a6 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java
@@ -204,6 +204,11 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
  boolean responseRequired = command.isResponseRequired();
  int commandId = command.getCommandId();
+
+
+ // TODO-NOW: the server should send packets to the client based on 
the requested times
+ //   need to look at what Andy did on AMQP
+
  // the connection handles pings, negotiations directly.
  // and delegate all other commands to manager.
  if (command.getClass() == KeepAliveInfo.class) {
@@ -1196,12 +1201,12 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
   @Override
   public Response processMessageDispatch(MessageDispatch arg0) throws 
Exception {
- throw new IllegalStateException("not implemented! ");
+ return null;
   }
 
   @Override
   public Response 
processMessageDispatchNotification(MessageDispatchNotification arg0) throws 
Exception {
- throw new IllegalStateException("not implemented! ");
+ return null;
   }
 
   @Override
@@ -1222,7 +1227,8 @@ public class OpenWireConnection extends 
AbstractRemotingConnection implements Se
 
   @Override
   public Response processProducerAck(ProducerAck arg0) throws Exception {
- throw new IllegalStateException("not implemented! ");
+ // a broker doesn't do producers.. this shouldn't happen
+ return null;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/6c686530/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
--
diff --git 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
index bdf27f8..514a2b9 100644
--- 
a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
+++ 
b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java
@@ -17,14 +17,12 @@
 package org.apache.activemq.artemis.core.protocol.openwire;
 
 import javax.jms.InvalidClientIDException;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.ScheduledExecutorService;
 
@@ -44,7 +42,6 @@ import 
org.apache.activemq.artemis.core.remoting.impl.netty.NettyServerConnectio
 

activemq git commit: AMQ-6167 Remove old example that used the now defunct IBM perfharness.

2016-02-25 Thread tabish
Repository: activemq
Updated Branches:
  refs/heads/master ca5912d9f -> 06bc2840d


AMQ-6167 Remove old example that used the now defunct IBM perfharness.

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

Branch: refs/heads/master
Commit: 06bc2840deab1d30296848d024dec0bcbd27cd77
Parents: ca5912d
Author: Timothy Bish 
Authored: Thu Feb 25 12:19:59 2016 -0500
Committer: Timothy Bish 
Committed: Thu Feb 25 12:20:20 2016 -0500

--
 .../other/perfharness/perfharness-activemq.sh   | 49 
 1 file changed, 49 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq/blob/06bc2840/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh
--
diff --git 
a/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh 
b/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh
deleted file mode 100755
index c226b4a..000
--- a/assembly/src/release/examples/other/perfharness/perfharness-activemq.sh
+++ /dev/null
@@ -1,49 +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.
-# 
-
-# ==
-# Helper script to run the IBM JMS performance harness against
-# the ActiveMQ message broker.
-#
-# Sample Usage: 
-#   ./perfharness-activemq.sh -d dynamicQueues/FOO -tc jms.r11.PutGet -nt 6
-#
-# It assumes that the apache-activemq-${project.version}.jar and 
-# perfharness.jar files are in the current directory.  If they are not,
-# set the ACTIVEMQ_HOME and PERFHARNESS_HOME env variable to the correct 
location.
-#
-# You can download the perfharness.jar file from:
-# http://www.alphaworks.ibm.com/tech/perfharness
-#
-# By Default the test connects the the vm://localhost broker.
-# To change that, use set the BROKER_URL to the broker url you want to use.
-#
-# ==
-
-if [ -z "$PERFHARNESS_HOME" ] ; then
-   PERFHARNESS_HOME=.
-fi
-
-if [ -z "$ACTIVEMQ_HOME" ] ; then
-   ACTIVEMQ_HOME=../..
-fi
-
-if [ -z "$BROKER_URL" ] ; then
-   BROKER_URL='vm://(broker://()/localhost?useJmx=false)/localhost'
-fi
-
-java ${JAVA_OPTIONS} -cp 
${ACTIVEMQ_HOME}/apache-activemq-${project.version}.jar:${PERFHARNESS_HOME}/perfharness.jar
 JMSPerfHarness -pc JNDI -ii 
org.apache.activemq.jndi.ActiveMQInitialContextFactory -iu $BROKER_URL -cf 
ConnectionFactory -d dynamic$DESTINATION $@



svn commit: r981149 - in /websites/production/activemq/content: activemq-4-connection-uris.html cache/main.pageCache configuring-transports.html configuring-version-5-transports.html nio-transport-ref

2016-02-25 Thread buildbot
Author: buildbot
Date: Thu Feb 25 16:43:16 2016
New Revision: 981149

Log:
Production update by buildbot for activemq

Modified:
websites/production/activemq/content/activemq-4-connection-uris.html
websites/production/activemq/content/cache/main.pageCache
websites/production/activemq/content/configuring-transports.html
websites/production/activemq/content/configuring-version-5-transports.html
websites/production/activemq/content/nio-transport-reference.html

Modified: websites/production/activemq/content/activemq-4-connection-uris.html
==
--- websites/production/activemq/content/activemq-4-connection-uris.html 
(original)
+++ websites/production/activemq/content/activemq-4-connection-uris.html Thu 
Feb 25 16:43:16 2016
@@ -91,7 +91,7 @@
   ...
 /broker
 
-Trying to use nio transport url on the client side will 
instantiate the regular TCP transport.The SSL TransportThis 
allows you to talk over TCP using SSL.For more information see the SSL Transport 
ReferenceThe NIO 
SSL TransportAvailabilityAvailable since 
5.6Implementing SSL transport over NIO. This allows you to 
connect large number of SSL clients to a single broker instance. It's server 
side transport-option only
+Trying to use nio transport url on the client side will 
instantiate the regular TCP transport.For more information see the NIO Transport 
ReferenceThe SSL 
TransportThis allows you to talk over TCP using SSL.For more 
information see the SSL 
Transport ReferenceThe NIO SSL TransportAvailabilityAvailable since 
5.6Implementing SSL transport over NIO. This allows you to 
connect large number of SSL clients to a single broker instance. It's server 
side transport-option
  only
 broker
   ...
   transportConnectors

Modified: websites/production/activemq/content/cache/main.pageCache
==
Binary files - no diff available.

Modified: websites/production/activemq/content/configuring-transports.html
==
--- websites/production/activemq/content/configuring-transports.html (original)
+++ websites/production/activemq/content/configuring-transports.html Thu Feb 25 
16:43:16 2016
@@ -90,7 +90,7 @@
   ...
 /broker
 
-Trying to use nio transport url on the client side will 
instantiate the regular TCP transport.The SSL TransportThis allows 
you to talk over TCP using SSL.For more information see the SSL Transport 
ReferenceThe NIO SSL 
TransportAvailabilityAvailable since 
5.6Implementing SSL transport over NIO. This allows you to 
connect large number of SSL clients to a single broker instance. It's server 
side transport-option only
+Trying to use nio transport url on the client side will 
instantiate the regular TCP transport.For more information see the NIO Transport 
ReferenceThe SSL 
TransportThis allows you to talk over TCP using SSL.For more 
information see the SSL 
Transport ReferenceThe NIO SSL TransportAvailabilityAvailable since 
5.6Implementing SSL transport over NIO. This allows you to 
connect large number of SSL clients to a single broker instance. It's server 
side transport-option onl
 y
 broker
   ...
   transportConnectors

Modified: 
websites/production/activemq/content/configuring-version-5-transports.html
==
--- websites/production/activemq/content/configuring-version-5-transports.html 
(original)
+++ websites/production/activemq/content/configuring-version-5-transports.html 
Thu Feb 25 16:43:16 2016
@@ -91,7 +91,7 @@
   ...
 /broker
 
-Trying to use nio transport url on the client side will 
instantiate the regular TCP transport.The SSL 
TransportThis allows you to talk over TCP using SSL.For more 
information see the SSL 
Transport ReferenceThe NIO SSL 
TransportAvailabilityAvailable since 
5.6Implementing SSL transport over NIO. This allows you to 
connect large number of SSL clients to a single broker instance. It's server 
side transport-option only
+Trying to use nio transport url on the client side will 
instantiate the regular TCP transport.For more information see the NIO Transport 
ReferenceThe SSL 
TransportThis allows you to talk over TCP using SSL.For more 
information see the SSL 
Transport ReferenceThe NIO SSL 
TransportAvailabilityAvailable since 
5.6Implementing SSL transport over NIO. This allows you to 
connect large number of SSL clients to a single broker instance. It's server 
side tran
 sport-option only
 broker
   ...
   transportConnectors

Modified: websites/production/activemq/content/nio-transport-reference.html
==
--- websites/production/activemq/content/nio-transport-reference.html (original)
+++ websites/production/activemq/content/nio-transport-reference.html Thu Feb 
25 16:43:16 2016
@@ -32,6 +32,15 @@
   

[CONF] Apache ActiveMQ > Configuring Transports

2016-02-25 Thread Dejan Bosanac (Confluence)
Title: Message Title



 
 
 
 
 
 
 

Dejan Bosanac edited a page 
 
 
  
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Configuring Transports 
 
 
  
 
 
 
 
 
 
 ... Trying to use nio transport url on the client side will instantiate the regular TCP transport.  For more information see the NIO Transport Reference  The SSL Transport This allows you to talk over TCP using SSL. ...  
 
 
  
 
 
 
 
 
 
 
 
 
 

View page
• 
 
 
 
 
 
 

Like 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 5.8.4  
 
 
  
 
 
 
 
 
 
 
 
 




[CONF] Apache ActiveMQ > NIO Transport Reference

2016-02-25 Thread Dejan Bosanac (Confluence)
Title: Message Title



 
 
 
 
 
 
 

Dejan Bosanac edited a page 
 
 
  
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
NIO Transport Reference 
 
 
  
 
 
 
 
 
 
 ... All protocol specific configuration should be applicable to the nio NIO version of the transport as well. ... One of the main advantages of using NIO instead of the regular versions of the transport is that it can scale better and support larger number of connections. The main limit in this scenario is the number of threads the system in using. In blocking implementations of the transports, one thread is used per connection. In the NIO implementation, there's a shared pool of threads that will take the load, so that number of connections are not directly related to the number of threads used in the system. You can tune the number of threads used by the transport using the following system properties (available since 5.14.0) 
 
 
 
 
Property 
Default value 
Description 
 
 
org.apache.activemq.transport.nio.SelectorManager.corePoolSize 
10 
 The number of threads to keep in the pool, even if they are idle  
 
 
org.apache.activemq.transport.nio.SelectorManager.maximumPoolSize 
1024 
 The maximum number of threads to allow in the pool  
 
 
 
 ... to the startup script (${ACTIVEMQ_HOME}/bin/env for example) to have a constant pool of 2000 threads handling connections. With the setting like this, the broker should be able to accept the number of connections up to the system limits. Of course, accepting connections is just one part of the story, so there are other limits to vertically scaling the broker.     
 
 
  
 
 
 
 
 
 
 
 
 
 

View page
• 
 
 
 
 
 
 

Like 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 5.8.4  
 
 
  
 
 
 
 
 
 
 
 
 




[CONF] Apache ActiveMQ > NIO Transport Reference

2016-02-25 Thread Dejan Bosanac (Confluence)
Title: Message Title



 
 
 
 
 
 
 

Dejan Bosanac edited a page 
 
 
  
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
NIO Transport Reference 
 
 
  
 
 
 
 
 
 
  NIO Transport is very similar to the regular TCP transport. The difference is that it is implemented using NIO API which can help with performance and scalability. NIO is a server side transport option only. Trying to use it on the client side will instantiate the regular TCP transport.   Configuration Syntax   nio://hostname:port?key=value   Configuration options are the same as for the TCP transport.   Note that the original NIO transport is a replacement for the tcp transport that uses OpenWire protocol. Other network protocols, such AMQP, MQTT, Stomp, etc also have their own NIO transport implementations. It configured usually, by adding "+nio" suffix to the protocol prefix, like  
 
 
 
 Code Block 
 
 
 
 
 
mqtt+nio://localhost:1883
  
 
 
  All protocol specific configuration should be applicable to the nio version of the transport as well.   Tuning NIO transport thread usage   One of the main advantages of using NIO instead of the regular versions of the transport is that it can scale better and support larger number of connections. The main limit in this scenario is the number of threads the system in using. In blocking implementations of the transports, one thread is used per connection. In NIO implementation, there's a shared pool of threads that will take the load, so that number of connections are not directly to the number of threads used in the system.   You can tune the number of threads used by the transport using the following system properties (available since 5.14.0)  
 
 
 
 
Property 
Default value 
Description 
 
 
org.apache.activemq.transport.nio.SelectorManager.corePoolSize 
10 
  The number of threads to keep in the pool, even if they are idle   
 
 
org.apache.activemq.transport.nio.SelectorManager.maximumPoolSize 
1024 
  The maximum number of threads to allow in the pool   
 
 
 
  If you want to scale your broker to support thousands of connections to it, you need to first find the limits of number of threads JVM process is allowed to create. Then you can set these properties to some value below that (broker need more threads to operate normally). For more information on thread usage by destinations and how to limit those, please take a look at Scaling Queues or this configuration file. For example you can add the following  
 
 
 
 Code Block 
 
 
 
 
 
ACTIVEMQ_OPTS="$ACTIVEMQ_OPTS -Dorg.apache.activemq.transport.nio.SelectorManager.corePoolSize=2000 -Dorg.apache.activemq.transport.nio.SelectorManager.maximumPoolSize=2000"
  
 
 
  to the startup script (${ACTIVEMQ_HOME}/bin/env for example) to have a constant pool of 2000 threads handling connections. With the setting like this, the broker should be able to accept the number of connections up to the system limits.       
 
 
  
 
 
 
 
 
 
 
 
 
 

View page
• 
 
 
 
 
 
 

Like 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 5.8.4  
 
 
  
 
 
 
 
 
 
 
 
 




svn commit: r981144 - in /websites/production/activemq/content: cache/main.pageCache nio-transport-reference.html using-activemq-4.html

2016-02-25 Thread buildbot
Author: buildbot
Date: Thu Feb 25 15:21:50 2016
New Revision: 981144

Log:
Production update by buildbot for activemq

Added:
websites/production/activemq/content/nio-transport-reference.html
Modified:
websites/production/activemq/content/cache/main.pageCache
websites/production/activemq/content/using-activemq-4.html

Modified: websites/production/activemq/content/cache/main.pageCache
==
Binary files - no diff available.

Added: websites/production/activemq/content/nio-transport-reference.html
==
--- websites/production/activemq/content/nio-transport-reference.html (added)
+++ websites/production/activemq/content/nio-transport-reference.html Thu Feb 
25 15:21:50 2016
@@ -0,0 +1,138 @@
+http://www.w3.org/TR/html4/loose.dtd;>
+
+
+
+http://activemq.apache.org/styles/site.css; rel="stylesheet" 
type="text/css"/>
+http://activemq.apache.org/styles/type-settings.css; 
rel="stylesheet" type="text/css"/>
+http://activemq.apache.org/styles/prototype.js"; 
type="text/javascript">
+http://activemq.apache.org/styles/rico.js"; 
type="text/javascript">
+http://activemq.apache.org/styles/site.js"; 
type="text/javascript">
+
+  .maincontent { overflow:hidden; }
+
+
+
+
+
+Apache ActiveMQ  -- NIO Transport Reference
+
+
+
+
+
+  
+
+
+  
+
+
+  
+
+  
+
+
+
+   
+   
+http://activemq.apache.org; 
title="The most popular and powerful open source Message Broker">ActiveMQ 

+http://www.apache.org; title="The 
Apache Software Foundation">ASF
+   
+
+
+
+  
+Using ActiveMQ 4Configuring TransportsActiveMQ 4 Connection 
URIsNIO Transport 
Reference
+  
+  
+Download | http://activemq.apache.org/maven/apidocs/index.html;>JavaDocs More... | Source | Forums | Support
+  
+
+
+  
+  
+
+
+
+
+
+  
+
+  
+https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=35985;>OverviewIndexNewsNew FeaturesGetting StartedFAQArticlesBooksDownloadhttp://www.apache.org/licenses/;>LicenseSearch
+http://www.google.com/search; style="font-size: 10px;">
+
+
+  
+  
+  
+  
+
+
+Sub Projectshttp://activemq.apache.org/artemis/;>Artemishttp://activemq.apache.org/apollo; title="ActiveMQ 
Apollo">Apollohttp://activemq.apache.org/cms/;>CMShttp://activemq.apache.org/nms/; title="NMS is the 
.Net Messaging API">NMShttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=36130;>CommunitySupportContributingDiscussion ForumsMailing ListsIRChttp://javabot.evanchooly.com/logs/%23apache-activemq/today; 
rel="nofollow">IRC LogSecurity AdvisoriesSitehttp://www.apache.org/foundation/sponsorship.html;>SponsorshipProjects Using 
ActiveMQUsersTeamThankshttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=35883;>FeaturesAdvisory 
MessageClusteringCross Language ClientsEnterprise Integration 
PatternsJMXJMS to JMS BridgeMasterSlaveMessage GroupsNetworks of BrokersPerformancePersistenceSecurityVirtual DestinationsVisualisationMore ...https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=3616
 7">ConnectivityAjaxAMQPAxis and CXF SupportC IntegrationC++http://activemq.apache.org/nms/;>C# and .Net 
Integrationhttp://activemq.apache.org/cms/;>CMSJ2EEJBoss Integrationhttp://docs.codehaus.org/display/JETTY/Integrating+with+ActiveMQ; 
rel="nofollow">JettyJNDI 
SupportNMSRESTRSS and AtomSpring SupportStompTomcatUnix ServiceWebLogic IntegrationXMPPMore ...https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=71176;>Using ActiveMQ 5Getting StartedInitial Configuration<
 /a>Running a 
BrokerEmbedded 
BrokersCommand Line 
ToolsConfiguring 
TransportsExamplesWeb SamplesMonitoring the BrokerXml 
ConfigurationXml 
ReferenceMore 
...https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=35912;>ToolsWeb ConsoleMaven2 
Performance Pluginhttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=35919;>Supporthttp://issues.apache.org/jira/browse/AMQ;>Issueshttp://issues.apache.org/activemq/browse/AMQ?report=com.atlassian.jira.plugin.system.project:roadmap-panel;>Roadmaphttp://issues.apache.org/activemq/browse/AMQ?report=com.atlassian.jira.plugin.system.project:changelog-panel;>Change
 loghttps://cwiki.apache.org/confluence/pages/viewpage.action?pageId=35903;>Developers
 SourceBuildingDeveloper GuideBecoming a committerCode OverviewWire ProtocolRelease GuideTestsMaven2 Performance 
PluginBenchmark 
TestsJMeter System 
TestsJMeter 
Performance TestsIntegration TestsPro
 ject ReportsJUnit ReportsSource XRefTest Source XRefXml Reference
+  
+
+  
+
+
+  
+
+
+  
+
+  
+
+
+
+  
+
+  
+

[CONF] Apache ActiveMQ > NIO Transport Reference

2016-02-25 Thread Dejan Bosanac (Confluence)
Title: Message Title



 
 
 
 
 
 
 

Dejan Bosanac created a page 
 
 
  
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 
 
 
 
 
NIO Transport Reference 
 
 
  
 
 
 
 
 
 
 
 
 
  
 
 
 
 
 
 
 
 
 
 

View page
• 
 
 
 
 
 
 

Like 
 
 
  
 
 
  
 
 
  
 
 
  
 
 
 
 
 
 
 
 
 
 
Stop watching space
• 
 
 
 
 
 
 
Manage notifications 
 
 
 
 
 
 
 
 
 
 
  
 
 
This message was sent by Atlassian Confluence 5.8.4  
 
 
  
 
 
 
 
 
 
 
 
 




activemq-artemis git commit: Refactor test to avoid port conflict.

2016-02-25 Thread gaohoward
Repository: activemq-artemis
Updated Branches:
  refs/heads/refactor-openwire 4a0004cda -> 3c9e1cb5e


Refactor test to avoid port conflict.


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

Branch: refs/heads/refactor-openwire
Commit: 3c9e1cb5eea134208ad9aa0f7fba4c1a44e428e8
Parents: 4a0004c
Author: Howard Gao 
Authored: Thu Feb 25 20:43:02 2016 +0800
Committer: Howard Gao 
Committed: Thu Feb 25 20:43:02 2016 +0800

--
 .../apache/activemq/broker/BrokerService.java   | 56 +---
 .../artemiswrapper/ArtemisBrokerWrapper.java| 45 
 2 files changed, 71 insertions(+), 30 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3c9e1cb5/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
--
diff --git 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
index 13d6b96..cbf41e1 100644
--- 
a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
+++ 
b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java
@@ -100,8 +100,8 @@ public class BrokerService implements Service {
private BrokerId brokerId;
private Throwable startException = null;
private boolean startAsync = false;
-   public Set extraConnectors = new HashSet<>();
-   public Set sslConnectors = new HashSet<>();
+   public Set extraConnectors = new HashSet<>();
+//   public Set sslConnectors = new HashSet<>();
 
private List transportConnectors = new ArrayList<>();
private File dataDirectoryFile;
@@ -494,11 +494,22 @@ public class BrokerService implements Service {
   this.transportConnectors = transportConnectors;
   for (TransportConnector connector : transportConnectors) {
  if (connector.getUri().getScheme().equals("ssl")) {
-this.sslConnectors.add(connector.getUri().getPort());
-System.out.println(this + " added ssl connector: " + 
connector.getUri().getPort());
+boolean added = this.extraConnectors.add(new 
ConnectorInfo(connector.getUri().getPort(), true));
+if (added) {
+   System.out.println("added ssl connector " + connector);
+}
+else {
+   System.out.println("WARNing! failed to add ssl connector: " + 
connector);
+}
  }
  else {
-this.extraConnectors.add(connector.getUri().getPort());
+boolean added = this.extraConnectors.add(new 
ConnectorInfo(connector.getUri().getPort()));
+if (added) {
+   System.out.println("added connector " + connector);
+}
+else {
+   System.out.println("WARNing! failed to add connector: " + 
connector);
+}
  }
   }
}
@@ -567,7 +578,7 @@ public class BrokerService implements Service {
 
   connector = new FakeTransportConnector(bindAddress);
   this.transportConnectors.add(connector);
-  this.extraConnectors.add(port);
+  this.extraConnectors.add(new ConnectorInfo(port));
 
   return connector;
}
@@ -752,8 +763,10 @@ public class BrokerService implements Service {
   URI uri = null;
   try {
  if (this.extraConnectors.size() > 0) {
-Integer port = extraConnectors.iterator().next();
-uri = new URI("tcp://localhost:" + port);
+ConnectorInfo info = extraConnectors.iterator().next();
+Integer port = info.port;
+String schema = info.ssl ? "ssl" : "tcp";
+uri = new URI(schema + "://localhost:" + port);
  } else {
 uri = new URI(this.getDefaultUri());
  }
@@ -763,6 +776,33 @@ public class BrokerService implements Service {
   return uri;
}
 
+   public static class ConnectorInfo {
+
+  public int port;
+  public boolean ssl;
+
+  public ConnectorInfo(int port) {
+ this(port, false);
+  }
+
+  public ConnectorInfo(int port, boolean ssl) {
+ this.port = port;
+ this.ssl = ssl;
+  }
+
+  @Override
+  public int hashCode() {
+ return port;
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+ if (obj instanceof ConnectorInfo) {
+return this.port == ((ConnectorInfo)obj).port;
+ }
+ return false;
+  }
+   }
 }
 
 


activemq git commit: https://issues.apache.org/jira/browse/AMQ-6184 - improve nio transport scalability

2016-02-25 Thread dejanb
Repository: activemq
Updated Branches:
  refs/heads/master c2ad0c325 -> 934a30a32


https://issues.apache.org/jira/browse/AMQ-6184 - improve nio transport 
scalability


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

Branch: refs/heads/master
Commit: 934a30a327c46100224c6822be2d947c5d848afb
Parents: c2ad0c3
Author: Dejan Bosanac 
Authored: Thu Feb 25 12:07:41 2016 +0100
Committer: Dejan Bosanac 
Committed: Thu Feb 25 12:07:51 2016 +0100

--
 .../activemq/transport/nio/NIOTransport.java|  5 +-
 .../activemq/transport/nio/SelectorManager.java | 15 +---
 .../transport/tcp/TcpTransportServer.java   | 83 +++-
 3 files changed, 53 insertions(+), 50 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/activemq/blob/934a30a3/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java
--
diff --git 
a/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java
 
b/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java
index 0a15fa5..58ee1aa 100644
--- 
a/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java
+++ 
b/activemq-client/src/main/java/org/apache/activemq/transport/nio/NIOTransport.java
@@ -92,7 +92,7 @@ public class NIOTransport extends TcpTransport {
 
 // Send the data via the channel
 // inputBuffer = ByteBuffer.allocateDirect(8*1024);
-inputBuffer = ByteBuffer.allocate(getIoBufferSize());
+inputBuffer = ByteBuffer.allocateDirect(getIoBufferSize());
 currentBuffer = inputBuffer;
 nextFrameSize = -1;
 currentBuffer.limit(4);
@@ -120,7 +120,6 @@ public class NIOTransport extends TcpTransport {
 }
 
 this.receiveCounter += readSize;
-
 if (currentBuffer.hasRemaining()) {
 continue;
 }
@@ -143,7 +142,7 @@ public class NIOTransport extends TcpTransport {
 }
 
 if (nextFrameSize > inputBuffer.capacity()) {
-currentBuffer = ByteBuffer.allocate(nextFrameSize);
+currentBuffer = 
ByteBuffer.allocateDirect(nextFrameSize);
 currentBuffer.putInt(nextFrameSize);
 } else {
 inputBuffer.limit(nextFrameSize);

http://git-wip-us.apache.org/repos/asf/activemq/blob/934a30a3/activemq-client/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
--
diff --git 
a/activemq-client/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
 
b/activemq-client/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
index 1adb92f..bc50003 100644
--- 
a/activemq-client/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
+++ 
b/activemq-client/src/main/java/org/apache/activemq/transport/nio/SelectorManager.java
@@ -19,12 +19,7 @@ package org.apache.activemq.transport.nio;
 import java.io.IOException;
 import java.nio.channels.spi.AbstractSelectableChannel;
 import java.util.LinkedList;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.*;
 
 /**
  * The SelectorManager will manage one Selector and the thread that checks the
@@ -43,7 +38,7 @@ public final class SelectorManager {
 private int maxChannelsPerWorker = 1024;
 
 protected ExecutorService createDefaultExecutor() {
-ThreadPoolExecutor rc = new 
ThreadPoolExecutor(getDefaultCorePoolSize(), getDefaultMaximumPoolSize(), 
getDefaultKeepAliveTime(), TimeUnit.SECONDS, new SynchronousQueue(),
+ThreadPoolExecutor rc = new 
ThreadPoolExecutor(getDefaultMaximumPoolSize(), getDefaultMaximumPoolSize(), 
getDefaultKeepAliveTime(), TimeUnit.SECONDS, new 
LinkedBlockingQueue(),
 new ThreadFactory() {
 
 private long i = 0;
@@ -59,12 +54,8 @@ public final class SelectorManager {
 return rc;
 }
 
-private static int getDefaultCorePoolSize() {
-return 
Integer.getInteger("org.apache.activemq.transport.nio.SelectorManager.corePoolSize",
 0);
-}
-
 private static int getDefaultMaximumPoolSize() {
-return