Author: dkulp
Date: Mon Aug 26 15:51:59 2013
New Revision: 1517576
URL: http://svn.apache.org/r1517576
Log:
Merged revisions 1517548 via git cherry-pick from
https://svn.apache.org/repos/asf/cxf/trunk
........
r1517548 | dkulp | 2013-08-26 10:44:41 -0400 (Mon, 26 Aug 2013) | 2 lines
Check the service itself and the binding for the various JMS spec extensors
and adjust those url's as well.
........
Modified:
cxf/branches/2.7.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
Modified:
cxf/branches/2.7.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
URL:
http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java?rev=1517576&r1=1517575&r2=1517576&view=diff
==============================================================================
---
cxf/branches/2.7.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
(original)
+++
cxf/branches/2.7.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java
Mon Aug 26 15:51:59 2013
@@ -94,42 +94,12 @@ public class EmbeddedJMSBrokerLauncher e
for (Object o : map.values()) {
Service service = (Service)o;
Map<?, ?> ports = service.getPorts();
+
adjustExtensibilityElements(service.getExtensibilityElements(), url,
encodedUrl);
+
for (Object p : ports.values()) {
Port port = (Port)p;
- List<?> l = port.getExtensibilityElements();
- for (Object e : l) {
- if (e instanceof SOAPAddress) {
- String add = ((SOAPAddress)e).getLocationURI();
- int idx = add.indexOf("jndiURL=");
- if (idx != -1) {
- int idx2 = add.indexOf("&", idx);
- add = add.substring(0, idx)
- + "jndiURL=" + encodedUrl
- + (idx2 == -1 ? "" : add.substring(idx2));
- ((SOAPAddress)e).setLocationURI(add);
- }
- } else {
- try {
- Field f =
e.getClass().getDeclaredField("jmsNamingProperty");
- ReflectionUtil.setAccessible(f);
- List<?> props = (List<?>)f.get(e);
- for (Object prop : props) {
- f =
prop.getClass().getDeclaredField("name");
- ReflectionUtil.setAccessible(f);
- if
("java.naming.provider.url".equals(f.get(prop))) {
- f =
prop.getClass().getDeclaredField("value");
- ReflectionUtil.setAccessible(f);
- String value = (String)f.get(prop);
- if (value == null ||
!value.startsWith("classpath")) {
- f.set(prop, url);
- }
- }
- }
- } catch (Exception ex) {
- //ignore
- }
- }
- }
+
adjustExtensibilityElements(port.getExtensibilityElements(), url, encodedUrl);
+
adjustExtensibilityElements(port.getBinding().getExtensibilityElements(), url,
encodedUrl);
}
}
} catch (Exception e) {
@@ -137,6 +107,49 @@ public class EmbeddedJMSBrokerLauncher e
}
}
+ private static void adjustExtensibilityElements(List<?> l,
+ String url,
+ String encodedUrl) {
+ for (Object e : l) {
+ if (e instanceof SOAPAddress) {
+ String add = ((SOAPAddress)e).getLocationURI();
+ int idx = add.indexOf("jndiURL=");
+ if (idx != -1) {
+ int idx2 = add.indexOf("&", idx);
+ add = add.substring(0, idx)
+ + "jndiURL=" + encodedUrl
+ + (idx2 == -1 ? "" : add.substring(idx2));
+ ((SOAPAddress)e).setLocationURI(add);
+ }
+ } else if (e.getClass().getSimpleName().startsWith("JndiURLType"))
{
+ try {
+ e.getClass().getMethod("setValue", String.class).invoke(e,
url);
+ } catch (Exception ex) {
+ //ignore
+ }
+ } else {
+ try {
+ Field f =
e.getClass().getDeclaredField("jmsNamingProperty");
+ ReflectionUtil.setAccessible(f);
+ List<?> props = (List<?>)f.get(e);
+ for (Object prop : props) {
+ f = prop.getClass().getDeclaredField("name");
+ ReflectionUtil.setAccessible(f);
+ if ("java.naming.provider.url".equals(f.get(prop))) {
+ f = prop.getClass().getDeclaredField("value");
+ ReflectionUtil.setAccessible(f);
+ String value = (String)f.get(prop);
+ if (value == null ||
!value.startsWith("classpath")) {
+ f.set(prop, url);
+ }
+ }
+ }
+ } catch (Exception ex) {
+ //ignore
+ }
+ }
+ }
+ }
public void stop() throws Exception {
tearDown();
}