summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/ws
diff options
context:
space:
mode:
Diffstat (limited to '')
-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
-rw-r--r--sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java22
5 files changed, 94 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>
diff --git a/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java b/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java
index a8980c8031..d5cfbb9c0e 100644
--- a/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java
+++ b/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java
@@ -22,13 +22,22 @@ package org.apache.tuscany.sca.binding.ws.launcher.axis2;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
import org.apache.tuscany.sca.binding.ws.jaxws.external.client.HelloWorldClientLauncher;
import org.apache.tuscany.sca.binding.ws.jaxws.external.service.HelloWorldServiceLauncher;
import org.apache.tuscany.sca.binding.ws.jaxws.sca.Bar;
import org.apache.tuscany.sca.binding.ws.jaxws.sca.Foo;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
import org.apache.tuscany.sca.node.Contribution;
import org.apache.tuscany.sca.node.Node;
import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.policy.PolicySubject;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
@@ -71,6 +80,7 @@ public class CallbackFullSpecTestCase {
@Test
public void testGetGreetings() throws Exception {
assertEquals("Hello Fred", externalClient.getGreetings("Fred"));
+ assertEquals("Hello Fred", externalClient.getGreetings("Fred"));
}
@Test
@@ -101,6 +111,18 @@ public class CallbackFullSpecTestCase {
assertTrue(f2.getBars().get(2).isB().booleanValue());
}
+ @Test
+ public void testCallbackBindingConfig() throws Exception {
+ Component helloWorldCallbackServiceComponent = ((NodeImpl)node).getDomainComposite().getComponent("HelloWorldCallbackService");
+ Service helloWorldService = helloWorldCallbackServiceComponent.getService("HelloWorldCallbackService");
+ Reference callbackReference = ((RuntimeComponentService)helloWorldService).getCallbackReference();
+ for (EndpointReference epr : callbackReference.getEndpointReferences()){
+ Binding callbackBinding = epr.getBinding();
+ assertEquals(WebServiceBinding.TYPE, callbackBinding.getType());
+ assertEquals(1, ((PolicySubject)callbackBinding).getPolicySets().size());
+ }
+ }
+
@After
public void tearDown() throws Exception {
node.stop();