Skip to content

Commit fbc9854

Browse files
author
Alexandru Scvortov
committed
remove the tests for AMQP URIs which are not actually URIs
1 parent 4aadebb commit fbc9854

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ public void setVirtualHost(String virtualHost) {
187187
* Convenience method for setting the fields in an AMQP URI: host,
188188
* port, username, password and virtual host. If any part of the
189189
* URI is ommited, the ConnectionFactory's corresponding variable
190-
* is left unchanged. Escapes in the hostname are not permitted.
190+
* is left unchanged. Note that not all valid AMQP URIs are
191+
* accepted; in particular, the hostname must be given if the
192+
* port, username or password are given, and escapes in the
193+
* hostname are not permitted.
191194
* @param uriString is the AMQP URI containing the data
192195
*/
193196
public void setUri(String uriString)

test/src/com/rabbitmq/client/test/AmqpUriTest.java

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,60 +23,43 @@
2323
public class AmqpUriTest extends BrokerTestCase
2424
{
2525
public void testUriParsing() throws URISyntaxException {
26-
/* From the spec */
26+
/* From the spec (subset of the tests) */
2727
parseSuccess("amqp://user:pass@host:10000/vhost",
2828
"user", "pass", "host", 10000, "vhost");
2929
parseSuccess("amqp://user%61:%61pass@host:10000/v%2fhost",
3030
"usera", "apass", "host", 10000, "v/host");
31-
parseSuccess("amqp://", "guest", "guest", "localhost", 5672, "/");
32-
parseSuccess("amqp://:@/", "", "", "localhost", 5672, "");
33-
parseSuccess("amqp://user@", "user", "guest", "localhost", 5672, "/");
34-
parseSuccess("amqp://user:pass@",
35-
"user", "pass", "localhost", 5672, "/");
3631
parseSuccess("amqp://host", "guest", "guest", "host", 5672, "/");
37-
parseSuccess("amqp://:10000",
38-
"guest", "guest", "localhost", 10000, "/");
3932
parseSuccess("amqp:///vhost",
4033
"guest", "guest", "localhost", 5672, "vhost");
4134
parseSuccess("amqp://host/", "guest", "guest", "host", 5672, "");
4235
parseSuccess("amqp://host/%2f", "guest", "guest", "host", 5672, "/");
43-
parseSuccess("amqp://[::1]", "guest", "guest", "::1", 5672, "/");
36+
parseSuccess("amqp://[::1]", "guest", "guest", "[::1]", 5672, "/");
4437

4538
/* Various other success cases */
4639
parseSuccess("amqp://host:100", "guest", "guest", "host", 100, "/");
47-
parseSuccess("amqp://[::1]:100", "guest", "guest", "::1", 100, "/");
40+
parseSuccess("amqp://[::1]:100", "guest", "guest", "[::1]", 100, "/");
4841

4942
parseSuccess("amqp://host/blah",
5043
"guest", "guest", "host", 5672, "blah");
5144
parseSuccess("amqp://host:100/blah",
5245
"guest", "guest", "host", 100, "blah");
53-
parseSuccess("amqp://:100/blah", "guest", "guest",
54-
"localhost", 100, "blah");
5546
parseSuccess("amqp://[::1]/blah",
56-
"guest", "guest", "::1", 5672, "blah");
47+
"guest", "guest", "[::1]", 5672, "blah");
5748
parseSuccess("amqp://[::1]:100/blah",
58-
"guest", "guest", "::1", 100, "blah");
49+
"guest", "guest", "[::1]", 100, "blah");
5950

6051
parseSuccess("amqp://user:pass@host",
6152
"user", "pass", "host", 5672, "/");
62-
parseSuccess("amqp://user:pass@host:100",
63-
"user", "pass", "host", 100, "/");
64-
parseSuccess("amqp://user:pass@:100",
65-
"user", "pass", "localhost", 100, "/");
6653
parseSuccess("amqp://user:pass@[::1]",
67-
"user", "pass", "::1", 5672, "/");
54+
"user", "pass", "[::1]", 5672, "/");
6855
parseSuccess("amqp://user:pass@[::1]:100",
69-
"user", "pass", "::1", 100, "/");
56+
"user", "pass", "[::1]", 100, "/");
7057

7158
/* Various failure cases */
7259
parseFail("http://www.rabbitmq.com");
73-
parseFail("amqp://foo:bar:baz");
7460
parseFail("amqp://foo[::1]");
7561
parseFail("amqp://foo:[::1]");
7662
parseFail("amqp://[::1]foo");
77-
parseFail("amqp://foo:1000xyz");
78-
parseFail("amqp://foo:1000000");
79-
parseFail("amqp://foo/bar/baz");
8063

8164
parseFail("amqp://foo%1");
8265
parseFail("amqp://foo%1x");

0 commit comments

Comments
 (0)