mirror of https://github.com/apache/activemq.git
apply patch for: https://issues.apache.org/jira/browse/AMQ-3953
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1367620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c9b49d8b07
commit
79bce92c33
|
@ -205,18 +205,12 @@ public class URISupport {
|
|||
}
|
||||
|
||||
public static boolean isCompositeURI(URI uri) {
|
||||
if (uri.getQuery() != null) {
|
||||
return false;
|
||||
} else {
|
||||
String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "(").trim();
|
||||
ssp = stripPrefix(ssp, "//").trim();
|
||||
try {
|
||||
new URI(ssp);
|
||||
} catch (URISyntaxException e) {
|
||||
return false;
|
||||
}
|
||||
String ssp = stripPrefix(uri.getRawSchemeSpecificPart().trim(), "//").trim();
|
||||
|
||||
if (ssp.indexOf('(') == 0 && checkParenthesis(ssp)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static int indexOfParenthesisMatch(String str, int first) throws URISyntaxException {
|
||||
|
|
|
@ -178,4 +178,37 @@ public class URISupportTest extends TestCase {
|
|||
assertEquals(parameters.get("proxyPort"), "80");
|
||||
}
|
||||
|
||||
public void testIsCompositeURIWithQueryNoSlashes() throws URISyntaxException {
|
||||
URI[] compositeURIs = new URI[] { new URI("test:(part1://host?part1=true)?outside=true"), new URI("broker:(tcp://localhost:61616)?name=foo") };
|
||||
for (URI uri : compositeURIs) {
|
||||
assertTrue(uri + " must be detected as composite URI", URISupport.isCompositeURI(uri));
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsCompositeURIWithQueryAndSlashes() throws URISyntaxException {
|
||||
URI[] compositeURIs = new URI[] { new URI("test://(part1://host?part1=true)?outside=true"), new URI("broker://(tcp://localhost:61616)?name=foo") };
|
||||
for (URI uri : compositeURIs) {
|
||||
assertTrue(uri + " must be detected as composite URI", URISupport.isCompositeURI(uri));
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsCompositeURINoQueryNoSlashes() throws URISyntaxException {
|
||||
URI[] compositeURIs = new URI[] { new URI("test:(part1://host,part2://(sub1://part,sube2:part))"), new URI("test:(path)/path") };
|
||||
for (URI uri : compositeURIs) {
|
||||
assertTrue(uri + " must be detected as composite URI", URISupport.isCompositeURI(uri));
|
||||
}
|
||||
}
|
||||
|
||||
public void testIsCompositeURINoQueryNoSlashesNoParentheses() throws URISyntaxException {
|
||||
assertFalse("test:part1" + " must be detected as non-composite URI", URISupport.isCompositeURI(new URI("test:part1")));
|
||||
}
|
||||
|
||||
public void testIsCompositeURINoQueryWithSlashes() throws URISyntaxException {
|
||||
URI[] compositeURIs = new URI[] { new URI("failover://(tcp://bla:61616,tcp://bla:61617)"),
|
||||
new URI("failover://(tcp://localhost:61616,ssl://anotherhost:61617)") };
|
||||
for (URI uri : compositeURIs) {
|
||||
assertTrue(uri + " must be detected as composite URI", URISupport.isCompositeURI(uri));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue