From commits-return-11304-apmail-cxf-commits-archive=cxf.apache.org@cxf.apache.org Wed Mar 17 17:15:50 2010 Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 14104 invoked from network); 17 Mar 2010 17:15:50 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 17 Mar 2010 17:15:50 -0000 Received: (qmail 72354 invoked by uid 500); 17 Mar 2010 17:15:49 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 72289 invoked by uid 500); 17 Mar 2010 17:15:49 -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 72282 invoked by uid 99); 17 Mar 2010 17:15:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 17 Mar 2010 17:15:49 +0000 X-ASF-Spam-Status: No, hits=-1001.3 required=10.0 tests=ALL_TRUSTED,AWL 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; Wed, 17 Mar 2010 17:15:48 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id CA1EA238897F; Wed, 17 Mar 2010 17:15:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r924371 - in /cxf/dosgi/trunk: discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/ discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/ discovery/local/src/test/resources/ samples/greeter/client/src/main/resou... Date: Wed, 17 Mar 2010 17:15:27 -0000 To: commits@cxf.apache.org From: davidb@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100317171527.CA1EA238897F@eris.apache.org> Author: davidb Date: Wed Mar 17 17:15:27 2010 New Revision: 924371 URL: http://svn.apache.org/viewvc?rev=924371&view=rev Log: Update the syntax of the endpoint description XML file to be compliant with the RSA spec. Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java (original) +++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscovery.java Wed Mar 17 17:15:27 2010 @@ -170,7 +170,8 @@ public class LocalDiscovery implements B case BundleEvent.STARTED: findDeclaredRemoteServices(be.getBundle()); break; - case BundleEvent.STOPPING: + case BundleEvent.STOPPED: + System.out.println("#### Bundle Stopped: " + be.getBundle().getSymbolicName()); removeServicesDeclaredInBundle(be.getBundle()); break; } Modified: cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java (original) +++ cxf/dosgi/trunk/discovery/local/src/main/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtils.java Wed Mar 17 17:15:27 2010 @@ -96,7 +96,8 @@ public final class LocalDiscoveryUtils { private static EndpointDescription getEndpointDescription(Element endpointDescriptionElement) { Map map = new HashMap(); - List properties = endpointDescriptionElement.getChildren(PROPERTY_ELEMENT); + List properties = endpointDescriptionElement.getChildren(PROPERTY_ELEMENT, + Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); for (Element prop : properties) { boolean handled = handleArray(prop, map); if (handled) { @@ -168,12 +169,13 @@ public final class LocalDiscoveryUtils { @SuppressWarnings("unchecked") private static boolean handleArray(Element prop, Map map) { - Element arrayEl = prop.getChild("array"); + Element arrayEl = prop.getChild("array", Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); if (arrayEl == null) { return false; } - List values = arrayEl.getChildren(PROPERTY_VALUE_ATTRIBUTE); + List values = arrayEl.getChildren(PROPERTY_VALUE_ATTRIBUTE, + Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); String type = getTypeName(prop); Class cls = null; if ("long".equals(type)) { @@ -216,11 +218,12 @@ public final class LocalDiscoveryUtils { @SuppressWarnings("unchecked") private static boolean handleCollection(Element prop, Map map) { Collection col = null; - Element el = prop.getChild("list"); + Element el = prop.getChild("list", + Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); if (el != null) { col = new ArrayList(); } else { - el = prop.getChild("set"); + el = prop.getChild("set", Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); if (el != null) { col = new HashSet(); } @@ -231,7 +234,8 @@ public final class LocalDiscoveryUtils { } String type = getTypeName(prop); - List values = el.getChildren(PROPERTY_VALUE_ATTRIBUTE); + List values = el.getChildren(PROPERTY_VALUE_ATTRIBUTE, + Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); for (Element val : values) { Object obj = handleValue(val, type); col.add(obj); @@ -255,7 +259,7 @@ public final class LocalDiscoveryUtils { @SuppressWarnings("unchecked") private static String readXML(Element prop) { - Element el = prop.getChild("xml"); + Element el = prop.getChild("xml", Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS)); if (el == null) { return null; } @@ -314,10 +318,14 @@ public final class LocalDiscoveryUtils { } String javaType = "java.lang." + boxedType; - try { - Class cls = ClassLoader.getSystemClassLoader().loadClass(javaType); - Constructor ctor = cls.getConstructor(String.class); - return ctor.newInstance(value); + try { + if (boxedType.equals("Character")) { + return new Character(value.charAt(0)); + } else { + Class cls = ClassLoader.getSystemClassLoader().loadClass(javaType); + Constructor ctor = cls.getConstructor(String.class); + return ctor.newInstance(value); + } } catch (Exception e) { LOG.warning("Could not create Endpoint Property of type " + type + " and value " + value); return null; @@ -363,7 +371,8 @@ public final class LocalDiscoveryUtils { try { Document d = new SAXBuilder().build(resourceURL.openStream()); if (d.getRootElement().getNamespaceURI().equals(REMOTE_SERVICES_ADMIN_NS)) { - elements.addAll(d.getRootElement().getChildren(ENDPOINT_DESCRIPTION_ELEMENT)); + elements.addAll(d.getRootElement().getChildren(ENDPOINT_DESCRIPTION_ELEMENT, + Namespace.getNamespace(REMOTE_SERVICES_ADMIN_NS))); } Namespace nsOld = Namespace.getNamespace(REMOTE_SERVICES_NS); Modified: cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java (original) +++ cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryTest.java Wed Mar 17 17:15:27 2010 @@ -134,6 +134,7 @@ public class LocalDiscoveryTest extends LocalDiscovery ld = getLocalDiscovery(); Bundle bundle = EasyMock.createMock(Bundle.class); + EasyMock.expect(bundle.getSymbolicName()).andReturn("testing.bundle").anyTimes(); EasyMock.expect(bundle.getState()).andReturn(Bundle.ACTIVE); Dictionary headers = new Hashtable(); headers.put("Remote-Service", "OSGI-INF/rsa/"); @@ -181,7 +182,7 @@ public class LocalDiscoveryTest extends EasyMock.expectLastCall(); EasyMock.replay(el); - BundleEvent be1 = new BundleEvent(BundleEvent.STOPPING, bundle); + BundleEvent be1 = new BundleEvent(BundleEvent.STOPPED, bundle); ld.bundleChanged(be1); assertEquals(0, ld.endpointDescriptions.size()); Modified: cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java (original) +++ cxf/dosgi/trunk/discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/LocalDiscoveryUtilsTest.java Wed Mar 17 17:15:27 2010 @@ -122,7 +122,7 @@ public class LocalDiscoveryUtilsTest ext "org.apache.cxf.ws".equals(props.get("service.exported.configs"))); assertEquals("org.apache.cxf.ws", props.get("service.exported.configs").toString().trim()); - assertEquals(normXML("haha"), + assertEquals(normXML("haha"), normXML((String) props.get("someXML"))); assertEquals(Long.MAX_VALUE, props.get("long")); @@ -139,6 +139,9 @@ public class LocalDiscoveryUtilsTest ext assertEquals(new Boolean(true), props.get("Boolean2")); assertEquals(new Short((short) 99), props.get("short")); assertEquals(new Short((short) -99), props.get("Short2")); + assertEquals(new Character('@'), props.get("char")); + assertEquals(new Character('X'), props.get("Character2")); + int [] intArray = (int []) props.get("int-array"); assertTrue(Arrays.equals(new int[] {1, 2}, intArray)); Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml (original) +++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed1.xml Wed Mar 17 17:15:27 2010 @@ -19,7 +19,7 @@ under the License. --> - @@ -69,5 +69,5 @@ http://somewhere:1/2/3/4?5 - + Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml (original) +++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed2.xml Wed Mar 17 17:15:27 2010 @@ -1,5 +1,5 @@ - @@ -25,7 +25,7 @@ - + haha @@ -45,6 +45,8 @@ 99 + @ + @@ -87,6 +89,6 @@ - + - + Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml (original) +++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed3.xml Wed Mar 17 17:15:27 2010 @@ -19,7 +19,7 @@ under the License. --> - @@ -30,5 +30,5 @@ http://somewhere:12345 - + Modified: cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml (original) +++ cxf/dosgi/trunk/discovery/local/src/test/resources/ed4.xml Wed Mar 17 17:15:27 2010 @@ -19,7 +19,7 @@ under the License. --> - @@ -40,5 +40,5 @@ http://somewhere:1 - + Modified: cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml (original) +++ cxf/dosgi/trunk/samples/greeter/client/src/main/resources/OSGI-INF/remote-service/remote-services.xml Wed Mar 17 17:15:27 2010 @@ -13,7 +13,7 @@ License for the specific language governing permissions and limitations under the License. --> - @@ -24,5 +24,5 @@ http://localhost:9090/greeter org.apache.cxf.ws - + Modified: cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml URL: http://svn.apache.org/viewvc/cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml?rev=924371&r1=924370&r2=924371&view=diff ============================================================================== --- cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml (original) +++ cxf/dosgi/trunk/systests2/common/src/main/resources/rs-test1.xml Wed Mar 17 17:15:27 2010 @@ -13,7 +13,7 @@ License for the specific language governing permissions and limitations under the License. --> - @@ -24,5 +24,5 @@ http://localhost:9191/grrr org.apache.cxf.ws - +