summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2012-02-09 17:46:50 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2012-02-09 17:46:50 +0000
commit59412d176cd4e7950cb48e48580a6de6fb8fec70 (patch)
tree2b41f3020605fe14c7ec709aa9b241dfcd8c7d0d /sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src
parenta9891d03be69d7daab14d273f3209c178fcb086e (diff)
TUSCANY-4011 - stop the SCDL callback binding configuration from being overwritten. The JMS binding strangely relied on this so required some surgery. I've also simplified CallbackServiceReference and added a CALLBACK message header and CallbackHandler object to make is simpler to pass the callback address down the message chain. The existing approach of creating a CallbackEndpoint model is still supported at the moment.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1242412 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src')
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java12
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java26
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml36
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite5
4 files changed, 72 insertions, 7 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java
index 057b884bc9..0cbc421f23 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java
@@ -32,7 +32,11 @@ public class HelloWorldCallbackServiceImpl implements HelloWorldCallbackService
public String getGreetings(String s) {
System.out.println("Entering SCA HelloWorldCallbackService.getGreetings: " + s);
- String response = helloWorldCallback.getGreetingsCallback(s);
+ String response = null;
+ for (int i = 0; i < 5 ; i++){
+ System.out.println("In SCA HelloWorldCallbackService.getGreetings: calling helloWorldCallback.getGreetingsCallback(s) interation " + i);
+ response = helloWorldCallback.getGreetingsCallback(s);
+ }
System.out.println("Leaving SCA HelloWorldCallbackService.getGreetings: " + response);
return response;
}
@@ -46,7 +50,11 @@ public class HelloWorldCallbackServiceImpl implements HelloWorldCallbackService
public Foo getGreetingsComplex(Foo foo){
System.out.println("Entering SCA HelloWorldCallbackService.getGreetingsComplex: " + foo.getBars().get(0).getS());
- Foo response = helloWorldCallback.getGreetingsComplexCallback(foo);
+ Foo response = null;
+ for (int i = 0; i < 5 ; i++){
+ System.out.println("In SCA HelloWorldCallbackService.getGreetingsComplex: calling helloWorldCallback.getGreetingsComplexCallback(s) interation " + i);
+ response = helloWorldCallback.getGreetingsComplexCallback(foo);
+ }
System.out.println("Leaving SCA HelloWorldCallbackService.getGreetingsComplex: " + foo.getBars().get(0).getS());
return response;
}
diff --git a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java
index 1ff58a29b0..39ef3c2032 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java
@@ -20,10 +20,13 @@
package org.apache.tuscany.sca.binding.ws;
import javax.jws.WebService;
+import javax.security.auth.Subject;
import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.Foo;
import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.HelloWorldService;
+import org.oasisopen.sca.RequestContext;
import org.oasisopen.sca.ServiceRuntimeException;
+import org.oasisopen.sca.annotation.Context;
import org.oasisopen.sca.annotation.Reference;
@WebService
@@ -35,25 +38,36 @@ public class HelloWorldImpl implements HelloWorld, HelloWorldCallback {
@Reference
public HelloWorldCallbackService helloWorldCallbackService;
+ @Context
+ protected RequestContext requestContext;
+
// HelloWorld operations
public String getGreetings(String s) {
System.out.println("Entering SCA HelloWorld.getGreetings: " + s);
- String response = helloWorldCallbackService.getGreetings(s);
+ String response = null;
+ for (int i = 0; i < 5 ; i++){
+ System.out.println("In SCA HelloWorld.getGreetings: calling helloWorldCallbackService.getGreetings(s) interation " + i);
+ response = helloWorldCallbackService.getGreetings(s);
+ }
System.out.println("Leaving SCA HelloWorld.getGreetings: " + response);
return response;
}
public String getGreetingsException(String s) throws ServiceRuntimeException {
System.out.println("Entering SCA HelloWorld.getGreetingsException: " + s);
- String response = helloWorldCallbackService.getGreetings(s);
+ String response = helloWorldCallbackService.getGreetings(s);
System.out.println("Leaving SCA HelloWorld.getGreetings: " + response);
throw new ServiceRuntimeException(response);
}
public Foo getGreetingsComplex(Foo foo){
System.out.println("Entering SCA HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
- Foo response = helloWorldCallbackService.getGreetingsComplex(foo);
+ Foo response = null;
+ for (int i = 0; i < 5 ; i++){
+ System.out.println("In SCA HelloWorld.getGreetingsComplex: calling helloWorldCallbackService.getGreetingsComplex(foo) interation " + i);
+ response = helloWorldCallbackService.getGreetingsComplex(foo);
+ }
System.out.println("Leaving SCA HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
return response;
}
@@ -63,6 +77,12 @@ public class HelloWorldImpl implements HelloWorld, HelloWorldCallback {
public String getGreetingsCallback(String s) {
System.out.println("Entering SCA HelloWorld.getGreetingsCallback: " + s);
String response = helloWorldExternal.getGreetings(s);
+
+ Subject subject = requestContext.getSecuritySubject();
+ if (subject == null){
+ response = "No Security Subject";
+ }
+
System.out.println("Leaving SCA HelloWorld.getGreetingsCallback: " + response);
return response;
}
diff --git a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml
new file mode 100644
index 0000000000..cce5bbe403
--- /dev/null
+++ b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" >
+
+
+ <sca:policySet name="BasicAuthenticationPolicySet"
+ provides="clientAuthentication.transport"
+ appliesTo="//sca:binding.ws">
+ <tuscany:basicAuthentication>
+ <tuscany:userName>myname</tuscany:userName>
+ <tuscany:password>mypassword</tuscany:password>
+ </tuscany:basicAuthentication>
+ </sca:policySet>
+
+
+</definitions> \ No newline at end of file
diff --git a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite
index 31414beb47..fc64de7b8a 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite
+++ b/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite
@@ -19,6 +19,7 @@
-->
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
targetNamespace="http://www.tuscany.apache.org/itests/binding/ws/axis2"
name="HelloWorld">
@@ -33,7 +34,7 @@
<reference name="helloWorldCallbackService">
<binding.ws uri="http://localhost:8084/HelloWorldCallbackService"/>
<callback>
- <binding.ws uri="http://localhost:8085/HelloWorldService/HelloWorldCallback"/>
+ <binding.ws uri="http://localhost:8085/HelloWorldService/HelloWorldCallback" policySets="tuscany:BasicAuthenticationPolicySet"/>
</callback>
</reference>
</component>
@@ -43,7 +44,7 @@
<service name="HelloWorldCallbackService">
<binding.ws uri="http://localhost:8084/HelloWorldCallbackService"/>
<callback>
- <binding.ws/>
+ <binding.ws policySets="tuscany:BasicAuthenticationPolicySet"/>
</callback>
</service>
</component>