summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-06-21 16:08:48 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-06-21 16:08:48 +0000
commit2c9c36e7af90ef230f70ef9480435c70e98771ab (patch)
tree6ba4a3baf38596c97607b5194395fb36048714cd /sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy
parent74016a79997195f318749df00ed07933b4673c4a (diff)
Add a binding.ws specific policy set and capture the order in which the interceptors should be called so that this can be explicitly checked by the test. The test also looks at the result of the matchin process which is not correct at present because "appliesTo" processing is not performed for runtime resolved references.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1138071 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyInterceptor.java37
-rw-r--r--sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderImplementation.java15
-rw-r--r--sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderReference.java12
-rw-r--r--sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderService.java11
4 files changed, 52 insertions, 23 deletions
diff --git a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyInterceptor.java b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyInterceptor.java
index 6600f34b66..73b4ce2825 100644
--- a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyInterceptor.java
+++ b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyInterceptor.java
@@ -18,6 +18,8 @@
*/
package testpolicy;
+import helloworld.StatusImpl;
+
import java.util.List;
import java.util.logging.ConsoleHandler;
import java.util.logging.Handler;
@@ -29,6 +31,7 @@ import javax.xml.namespace.QName;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.Endpoint;
import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
@@ -36,12 +39,8 @@ import org.apache.tuscany.sca.invocation.PhasedInterceptor;
import org.apache.tuscany.sca.policy.PolicySubject;
-public class TestPolicyInterceptor implements PhasedInterceptor {
- public static final String loggingPolicy = "JDKLoggingPolicy";
- public static final QName policySetQName = new QName(TestPolicy.SCA11_TUSCANY_NS, loggingPolicy);
- private Logger logger = null;
-
- private Invoker next;
+public class TestPolicyInterceptor extends InterceptorAsyncImpl implements PhasedInterceptor {
+
private Operation operation;
private List<TestPolicy> policies;
private PolicySubject subject;
@@ -75,18 +74,26 @@ public class TestPolicyInterceptor implements PhasedInterceptor {
return null;
}
- public Message invoke(Message msg) {
- System.out.println("In interceptor at " + subject.toString());
- return getNext().invoke(msg);
+ public Message processRequest(Message msg) {
+ StatusImpl.appendStatus("TestPolicyInterceptor.processRequest()", context + " @ " + phase);
+ return msg;
}
-
- public Invoker getNext() {
- return next;
+
+ public Message postProcessRequest(Message msg, Throwable e) throws Throwable {
+ StatusImpl.appendStatus("TestPolicyInterceptor.postProcessRequest()", context + " @ " + phase);
+ return msg;
+ }
+
+ public Message processResponse(Message msg) {
+ StatusImpl.appendStatus("TestPolicyInterceptor.processResponse()", context + " @ " + phase);
+ return msg;
}
-
- public void setNext(Invoker next) {
- this.next = next;
+/* not in interface - should we add it?
+ public Message postProcessResponse(Message msg) {
+ System.out.println("TestPolicyInterceptor.postProcessResponse() " + context + " @ " + phase);
+ return msg;
}
+*/
public String getPhase() {
return phase;
diff --git a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderImplementation.java b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderImplementation.java
index 33d2254798..b027763d22 100644
--- a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderImplementation.java
+++ b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderImplementation.java
@@ -41,11 +41,16 @@ public class TestPolicyProviderImplementation extends BasePolicyProvider<TestPol
*/
public PhasedInterceptor createInterceptor(Operation operation) {
List<TestPolicy> policies = findPolicies();
- return policies.isEmpty() ? null : new TestPolicyInterceptor(subject,
- getContext(),
- operation,
- policies,
- Phase.IMPLEMENTATION_POLICY);
+
+ if (policies.isEmpty()){
+ return null;
+ } else {
+ return new TestPolicyInterceptor(subject,
+ getContext(),
+ operation,
+ policies,
+ Phase.IMPLEMENTATION_POLICY);
+ }
}
}
diff --git a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderReference.java b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderReference.java
index eb546c0057..3e784aa62e 100644
--- a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderReference.java
+++ b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderReference.java
@@ -38,8 +38,16 @@ public class TestPolicyProviderReference extends BasePolicyProvider<TestPolicy>
public PhasedInterceptor createInterceptor(Operation operation) {
List<TestPolicy> policies = findPolicies();
- return policies.isEmpty() ? null : new TestPolicyInterceptor(subject, getContext(), operation,
- policies, Phase.REFERENCE_POLICY);
+
+ if (policies.isEmpty()){
+ return null;
+ } else {
+ return new TestPolicyInterceptor(subject,
+ getContext(),
+ operation,
+ policies,
+ Phase.REFERENCE_POLICY);
+ }
}
}
diff --git a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderService.java b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderService.java
index adb5664a24..5066193aa6 100644
--- a/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderService.java
+++ b/sca-java-2.x/trunk/testing/itest/policy/interceptors/src/main/java/testpolicy/TestPolicyProviderService.java
@@ -38,7 +38,16 @@ public class TestPolicyProviderService extends BasePolicyProvider<TestPolicy> {
public PhasedInterceptor createInterceptor(Operation operation) {
List<TestPolicy> policies = findPolicies();
- return policies.isEmpty() ? null : new TestPolicyInterceptor(subject, getContext(), operation, policies, Phase.SERVICE_POLICY);
+
+ if (policies.isEmpty()){
+ return null;
+ } else {
+ return new TestPolicyInterceptor(subject,
+ getContext(),
+ operation,
+ policies,
+ Phase.SERVICE_POLICY);
+ }
}
}