Openwire test fix:

Fixed issues with TcpTransportBrokerTest
  removed one irrelevant test
  Not all tests in it are passing however that'll
  fix 125 of total 128 tests.
This commit is contained in:
Howard Gao 2015-08-11 16:06:46 +08:00 committed by Clebert Suconic
parent 126be4ce24
commit bb1e03c079
4 changed files with 26 additions and 6 deletions

View File

@ -22,6 +22,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -633,6 +634,22 @@ public class BrokerService implements Service {
map.clear();
return runningBrokers;
}
public URI getConnectURI() {
URI uri = null;
try {
if (this.extraConnectors.size() > 0) {
Integer port = extraConnectors.iterator().next();
uri = new URI("tcp://localhost:" + port);
} else {
uri = new URI(this.getDefaultUri());
}
} catch (URISyntaxException e) {
//ignore
}
return uri;
}
}

View File

@ -199,6 +199,12 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
settings.setSlowConsumerCheckPeriod(1);
settings.setSlowConsumerPolicy(SlowConsumerPolicy.NOTIFY);
}
if (entry.isProducerFlowControl()) {
settings.setMaxSizeBytes(10240).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
if (bservice.getSystemUsage().isSendFailIfNoSpace()) {
settings.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL);
}
}
}
PolicyEntry defaultEntry = policyMap.getDefaultEntry();
@ -209,7 +215,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase {
settingsMap.put("#", defSettings);
}
if (defaultEntry.isProducerFlowControl()) {
defSettings.setMaxSizeBytes(1).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
defSettings.setMaxSizeBytes(10240).setAddressFullMessagePolicy(AddressFullMessagePolicy.BLOCK);
if (bservice.getSystemUsage().isSendFailIfNoSpace()) {
defSettings.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL);
}

View File

@ -1653,10 +1653,6 @@ public class BrokerTest extends BrokerTestSupport {
connection.request(createAck(consumerInfo, m3, 1, MessageAck.DELIVERED_ACK_TYPE));
}
public void testGetServices() throws Exception {
assertTrue(broker.getServices().length != 0);
}
public static Test suite() {
return suite(BrokerTest.class);
}

View File

@ -25,6 +25,7 @@ import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.BrokerTest;
import org.apache.activemq.broker.StubConnection;
import org.apache.activemq.broker.TransportConnector;
import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper;
public abstract class TransportBrokerTestSupport extends BrokerTest {
@ -65,7 +66,7 @@ public abstract class TransportBrokerTestSupport extends BrokerTest {
// Note: on platforms like OS X we cannot bind to the actual hostname, so we
// instead use the original host name (typically localhost) to bind to
URI actualURI = connector.getServer().getConnectURI();
URI actualURI = this.broker.getConnectURI();
URI connectURI = new URI(actualURI.getScheme(), actualURI.getUserInfo(), bindURI.getHost(), actualURI.getPort(), actualURI.getPath(), bindURI.getQuery(), bindURI.getFragment());
Transport transport = TransportFactory.connect(connectURI);