You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2008/06/10 12:02:09 UTC
svn commit: r666054 [2/2] - in
/servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005: ./
src/main/java/org/apache/servicemix/wsn/
src/main/java/org/apache/servicemix/wsn/client/
src/main/java/org/apache/servicemix/wsn/component/ src/main...
Added: servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/client/AbstractWSAClientTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/client/AbstractWSAClientTest.java?rev=666054&view=auto
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/client/AbstractWSAClientTest.java (added)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/client/AbstractWSAClientTest.java Tue Jun 10 03:02:08 2008
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.servicemix.wsn.client;
+
+import javax.xml.transform.Source;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
+import junit.framework.TestCase;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+
+public class AbstractWSAClientTest extends TestCase {
+
+ public void test() {
+ Source src = new StringSource("<EndpointReference xmlns='http://www.w3.org/2005/08/addressing'><Address>"
+ + "endpoint:http://www.consumer.org/service/endpoint</Address></EndpointReference>");
+ W3CEndpointReference ref = new W3CEndpointReference(src);
+ String address = AbstractWSAClient.getWSAAddress(ref);
+ assertEquals("endpoint:http://www.consumer.org/service/endpoint", address);
+ }
+
+}
Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/component/WSNComponentTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/component/WSNComponentTest.java?rev=666054&r1=666053&r2=666054&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/component/WSNComponentTest.java (original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-wsn2005/src/test/java/org/apache/servicemix/wsn/component/WSNComponentTest.java Tue Jun 10 03:02:08 2008
@@ -27,6 +27,7 @@
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
import javax.xml.parsers.DocumentBuilder;
+import javax.xml.ws.wsaddressing.W3CEndpointReference;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -50,8 +51,6 @@
import org.apache.servicemix.wsn.spring.PublisherComponent;
import org.oasis_open.docs.wsn.b_2.NotificationMessageHolderType;
import org.oasis_open.docs.wsn.b_2.Notify;
-import org.w3._2005._08.addressing.AttributedURIType;
-import org.w3._2005._08.addressing.EndpointReferenceType;
public class WSNComponentTest extends TestCase {
@@ -115,7 +114,7 @@
ReceiverComponent receiver = new ReceiverComponent();
jbi.activateComponent(receiver, "receiver");
- EndpointReferenceType consumer = createEPR(ReceiverComponent.SERVICE, ReceiverComponent.ENDPOINT);
+ W3CEndpointReference consumer = createEPR(ReceiverComponent.SERVICE, ReceiverComponent.ENDPOINT);
wsnBroker.subscribe(consumer, "myTopic", null);
wsnBroker.notify("myTopic", parse("<hello>world</hello>"));
@@ -136,7 +135,7 @@
jbi.activateComponent(receiver, "receiver");
// START SNIPPET: notify
- EndpointReferenceType consumer = createEPR(ReceiverComponent.SERVICE, ReceiverComponent.ENDPOINT);
+ W3CEndpointReference consumer = createEPR(ReceiverComponent.SERVICE, ReceiverComponent.ENDPOINT);
wsnBroker.subscribe(consumer, "myTopic", null, true);
Element body = parse("<hello>world</hello>");
@@ -261,7 +260,7 @@
publisherComponent.setDemand(true);
jbi.activateComponent(publisherComponent, "publisher");
- Thread.sleep(150);
+ Thread.sleep(500);
assertNull(publisherComponent.getSubscription());
PullPoint pullPoint = wsnCreatePullPoint.createPullPoint();
@@ -275,7 +274,7 @@
Thread.sleep(500);
assertNull(publisherComponent.getSubscription());
- Thread.sleep(150);
+ Thread.sleep(500);
}
public void testDeployPullPoint() throws Exception {
@@ -338,11 +337,8 @@
return doc.getDocumentElement();
}
- protected EndpointReferenceType createEPR(QName service, String endpoint) {
- EndpointReferenceType epr = new EndpointReferenceType();
- epr.setAddress(new AttributedURIType());
- epr.getAddress().setValue(service.getNamespaceURI() + "/" + service.getLocalPart() + "/" + endpoint);
- return epr;
+ protected W3CEndpointReference createEPR(QName service, String endpoint) {
+ return AbstractWSAClient.createWSA(service.getNamespaceURI() + "/" + service.getLocalPart() + "/" + endpoint);
}
}