Fixing DynamicallyIncludedDestinationsDuplexNetworkTest
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-01-18 15:27:11 +00:00
parent a3fa0da6ec
commit 1ae29382e1
1 changed files with 17 additions and 0 deletions

View File

@ -19,6 +19,7 @@ package org.apache.activemq.network;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.lang.reflect.Field;
import java.util.concurrent.CopyOnWriteArrayList;
@ -30,6 +31,7 @@ import org.apache.activemq.advisory.AdvisorySupport;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.TransportConnection;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.util.Wait;
import org.junit.Test;
/**
@ -114,4 +116,19 @@ public class DynamicallyIncludedDestinationsDuplexNetworkTest extends SimpleNetw
TransportConnection duplexBridgeConnectionFromRemote = transportConnections.get(0);
return duplexBridgeConnectionFromRemote;
}
@Override
protected void assertNetworkBridgeStatistics(final long expectedLocalSent, final long expectedRemoteSent) throws Exception {
final NetworkBridge localBridge = localBroker.getNetworkConnectors().get(0).activeBridges().iterator().next();
assertTrue(Wait.waitFor(new Wait.Condition() {
@Override
public boolean isSatisified() throws Exception {
return expectedLocalSent == localBridge.getNetworkBridgeStatistics().getDequeues().getCount() &&
expectedRemoteSent == localBridge.getNetworkBridgeStatistics().getReceivedCount().getCount();
}
}));
}
}