qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astitc...@apache.org
Subject svn commit: r1576412 - in /qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger: ./ impl/ impl/AddressTest.java
Date Tue, 11 Mar 2014 16:33:43 GMT
Author: astitcher
Date: Tue Mar 11 16:33:42 2014
New Revision: 1576412

URL: http://svn.apache.org/r1576412
Log:
PROTON-506: Added unit tests for Java url parser

Added:
    qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/
    qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/impl/
    qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/impl/AddressTest.java

Added: qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/impl/AddressTest.java
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/impl/AddressTest.java?rev=1576412&view=auto
==============================================================================
--- qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/impl/AddressTest.java
(added)
+++ qpid/proton/trunk/proton-j/src/test/java/org/apache/qpid/proton/messenger/impl/AddressTest.java
Tue Mar 11 16:33:42 2014
@@ -0,0 +1,38 @@
+package org.apache.qpid.proton.messenger.impl;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class AddressTest {
+
+	private void testParse(String url, String scheme, String user, String pass, String host,
String port, String name)
+	{
+		Address address = new Address(url);
+		assertEquals(scheme, address.getScheme());
+		assertEquals(user, address.getUser());
+		assertEquals(pass, address.getPass());
+		assertEquals(host, address.getHost());
+		assertEquals(port, address.getPort());
+	}
+
+	@Test
+	public void addressTests()
+	{
+		testParse("host", null, null, null, "host", null, null);
+		testParse("host:423", null, null, null, "host", "423", null);
+		testParse("user@host", null, "user", null, "host", null, null);
+		testParse("user:1243^&^:pw@host:423", null, "user", "1243^&^:pw", "host", "423",
null);
+		testParse("user:1243^&^:pw@host:423/Foo.bar:90087", null, "user", "1243^&^:pw",
"host", "423", "Foo.bar:90087");
+		testParse("user:1243^&^:pw@host:423/Foo.bar:90087@somewhere", null, "user", "1243^&^:pw",
"host", "423", "Foo.bar:90087@somewhere");
+		testParse("amqp://host", "amqp", null, null, "host", null, null);
+		testParse("amqp://user@host", "amqp", "user", null, "host", null, null);
+		testParse("amqp://user@host/path:%", "amqp", "user", null, "host", null, "path:%");
+		testParse("amqp://user@host:5674/path:%", "amqp", "user", null, "host", "5674", "path:%");
+		testParse("amqp://user@host/path:%", "amqp", "user", null, "host", null, "path:%");
+		testParse("amqp://bigbird@host/queue@host", "amqp", "bigbird", null, "host", null, "queue@host");
+		testParse("amqp://host/queue@host", "amqp", null, null, "host", null, "queue@host");
+		testParse("amqp://host:9765/queue@host", "amqp", null, null, "host", "9765", "queue@host");
+	}
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message