You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2015/08/10 15:12:46 UTC
[2/2] activemq-artemis git commit: Fix openwire tests -
ProducerFlowControlSendFailTest
Fix openwire tests - ProducerFlowControlSendFailTest
Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/5230237a
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/5230237a
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/5230237a
Branch: refs/heads/master
Commit: 5230237a7c9855a00a901ca337bff20b665d8a68
Parents: 4ed21a4
Author: Howard Gao <hg...@redhat.com>
Authored: Fri Aug 7 13:40:51 2015 +0800
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Aug 10 09:12:27 2015 -0400
----------------------------------------------------------------------
.../artemiswrapper/ArtemisBrokerWrapper.java | 39 ++++++++++++++++++--
1 file changed, 35 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/5230237a/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 77926c1..7e7ec19 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
@@ -32,6 +32,7 @@ import org.apache.activemq.artemis.core.config.impl.SecurityConfiguration;
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 org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
@@ -196,12 +197,12 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase
private void translatePolicyMap(Configuration serverConfig, PolicyMap policyMap)
{
List allEntries = policyMap.getAllEntries();
+ Map<String, AddressSettings> settingsMap = serverConfig.getAddressesSettings();
for (Object o : allEntries)
{
PolicyEntry entry = (PolicyEntry)o;
org.apache.activemq.command.ActiveMQDestination targetDest = entry.getDestination();
String match = getCorePattern(targetDest);
- Map<String, AddressSettings> settingsMap = serverConfig.getAddressesSettings();
AddressSettings settings = settingsMap.get(match);
if (settings == null)
{
@@ -216,6 +217,25 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase
settings.setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY);
}
}
+
+ PolicyEntry defaultEntry = policyMap.getDefaultEntry();
+ if (defaultEntry != null)
+ {
+ AddressSettings defSettings = settingsMap.get("#");
+ if (defSettings == null)
+ {
+ defSettings = new AddressSettings();
+ settingsMap.put("#", defSettings);
+ }
+ if (defaultEntry.isProducerFlowControl())
+ {
+ defSettings.setMaxSizeBytes(1).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
+ if (bservice.getSystemUsage().isSendFailIfNoSpace())
+ {
+ defSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL);
+ }
+ }
+ }
}
private String getCorePattern(org.apache.activemq.command.ActiveMQDestination dest)
@@ -237,9 +257,20 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase
@Override
public void stop() throws Exception
{
- server.stop();
- testQueues.clear();
- stopped = true;
+ try
+ {
+ server.stop();
+ testQueues.clear();
+ stopped = true;
+ }
+ catch (Throwable t)
+ {
+ //ignore
+ }
+ finally
+ {
+ server = null;
+ }
}
public void makeSureQueueExists(String qname) throws Exception