NO-JIRA: Trivial test fix on StompPluginTest

This commit is contained in:
Clebert Suconic 2017-05-04 15:32:26 -04:00
parent b9e7e7ed9d
commit 800976ec76
2 changed files with 7 additions and 2 deletions

View File

@ -31,7 +31,7 @@ import org.apache.activemq.artemis.core.server.plugin.ActiveMQServerPlugin;
import org.apache.activemq.artemis.core.transaction.Transaction; import org.apache.activemq.artemis.core.transaction.Transaction;
import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection; import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
import org.apache.activemq.artemis.spi.core.protocol.SessionCallback; import org.apache.activemq.artemis.spi.core.protocol.SessionCallback;
import org.apache.activemq.artemis.tests.util.Wait;
/** /**
* Licensed to the Apache Software Foundation (ASF) under one or more * Licensed to the Apache Software Foundation (ASF) under one or more
@ -265,6 +265,11 @@ public class MethodCalledVerifier implements ActiveMQServerPlugin {
public void validatePluginMethodsAtLeast(int count, String... names) { public void validatePluginMethodsAtLeast(int count, String... names) {
Arrays.asList(names).forEach(name -> { Arrays.asList(names).forEach(name -> {
try {
Wait.waitFor(() -> count <= methodCalls.getOrDefault(name, new AtomicInteger()).get());
} catch (Exception e) {
e.printStackTrace();
}
assertTrue("validating method " + name, count <= methodCalls.getOrDefault(name, new AtomicInteger()).get()); assertTrue("validating method " + name, count <= methodCalls.getOrDefault(name, new AtomicInteger()).get());
}); });
} }

View File

@ -98,7 +98,7 @@ public class StompPluginTest extends StompTestBase {
@Test @Test
public void testSendAndReceive() throws Exception { public void testSendAndReceive() throws Exception {
// subscribehoward county escaped // subscribe
StompClientConnection newConn = StompClientConnectionFactory.createClientConnection("1.2", hostname, port); StompClientConnection newConn = StompClientConnectionFactory.createClientConnection("1.2", hostname, port);
newConn.connect(defUser, defPass); newConn.connect(defUser, defPass);
subscribe(newConn, "a-sub"); subscribe(newConn, "a-sub");