ARTEMIS-3543 Fix encrypted passwords in composite urls
This commit is contained in:
parent
f1004c8b94
commit
7988739f41
|
@ -108,7 +108,7 @@ public class URIFactory<T, P> {
|
|||
* */
|
||||
private URI normalise(String uri) throws URISyntaxException {
|
||||
if (uri.startsWith("(")) {
|
||||
String[] split = uri.split("\\)");
|
||||
String[] split = uri.split("\\)", 2);
|
||||
String[] connectorURIS = split[0].substring(split[0].indexOf('(') + 1).split(",");
|
||||
String factoryQuery = split.length > 1 ? split[1] : "";
|
||||
StringBuilder builder = new StringBuilder(connectorURIS[0]);
|
||||
|
|
|
@ -224,6 +224,25 @@ public class ConnectionFactoryURITest {
|
|||
checkTC(props3, staticConnectors[2], 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTCPEncryptedNettyConnectorPropertiesMultiple() throws Exception {
|
||||
final String trustStorePath = "truststore.jks";
|
||||
final String trustStorePassword = "ENC(3a34fd21b82bf2a822fa49a8d8fa115d)";
|
||||
|
||||
ActiveMQConnectionFactory factory = parser.newObject(parser.expandURI(
|
||||
"(tcp://localhost0:61616?,tcp://localhost1:61617?,tcp://localhost2:61618?)" +
|
||||
"?ha=true&clientID=myID&trustStorePath=" + trustStorePath +
|
||||
"&trustStorePassword=" + trustStorePassword), null);
|
||||
|
||||
TransportConfiguration[] staticConnectors = factory.getStaticConnectors();
|
||||
Assert.assertEquals(3, staticConnectors.length);
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Assert.assertEquals(trustStorePath, staticConnectors[i].getParams().get("trustStorePath"));
|
||||
Assert.assertEquals(trustStorePassword, staticConnectors[0].getParams().get("trustStorePassword"));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkTC(Map<String, Object> props, TransportConfiguration staticConnector, int offfSet) {
|
||||
TransportConfiguration connector = staticConnector;
|
||||
Assert.assertEquals(connector.getParams().get("host"), "localhost" + offfSet);
|
||||
|
|
Loading…
Reference in New Issue