Remove strict check for 'amqp' scheme in AmqpServiceInfo

This commit is contained in:
Mark Fisher
2014-10-31 09:51:45 -04:00
parent c3002b6db6
commit bcbd2f6333
2 changed files with 10 additions and 5 deletions

View File

@@ -31,8 +31,8 @@ public class AmqpServiceInfo extends UriBasedServiceInfo {
@Override
protected UriInfo validateAndCleanUriInfo(UriInfo uriInfo) {
if (!URI_SCHEME.equals(uriInfo.getScheme())) {
throw new IllegalArgumentException("wrong scheme in amqp URI: " + uriInfo);
if (uriInfo.getScheme() == null) {
throw new IllegalArgumentException("missing scheme in amqp URI: " + uriInfo);
}
if (uriInfo.getHost() == null) {

View File

@@ -21,10 +21,15 @@ public class RabbitServiceInfoTest {
assertEquals("mypass", serviceInfo.getPassword());
assertEquals("myvhost", serviceInfo.getVirtualHost());
}
@Test(expected=IllegalArgumentException.class)
public void badProtocol() {
new AmqpServiceInfo("id", "XX://myuser:mypass@myhost:12345/myvhost");
public void missingScheme() {
new AmqpServiceInfo("id", "://myuser:mypass@:12345/myvhost");
}
public void amqpsSchemeAccepted() {
AmqpServiceInfo serviceInfo = new AmqpServiceInfo("id", "amqps://myuser:mypass@myhost:12345/myvhost");
assertEquals("amqps", serviceInfo.getScheme());
}
@Test(expected=IllegalArgumentException.class)