Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 019181080B for ; Mon, 26 Aug 2013 15:52:22 +0000 (UTC) Received: (qmail 44627 invoked by uid 500); 26 Aug 2013 15:52:21 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 44573 invoked by uid 500); 26 Aug 2013 15:52:21 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 44565 invoked by uid 99); 26 Aug 2013 15:52:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Aug 2013 15:52:21 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Aug 2013 15:52:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 404AC2388AB8; Mon, 26 Aug 2013 15:52:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1517576 - /cxf/branches/2.7.x-fixes/testutils/src/main/java/org/apache/cxf/testutil/common/EmbeddedJMSBrokerLauncher.java Date: Mon, 26 Aug 2013 15:52:00 -0000 To: commits@cxf.apache.org From: dkulp@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130826155200.404AC2388AB8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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(); }