You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2011/02/24 18:01:00 UTC

svn commit: r1074213 - in /tuscany/sca-java-2.x/trunk/unreleased/testing: ./ itest/ itest/interceptors/ itest/interceptors/src/ itest/interceptors/src/main/ itest/interceptors/src/main/java/ itest/interceptors/src/main/java/sample/ itest/interceptors/s...

Author: slaws
Date: Thu Feb 24 17:00:59 2011
New Revision: 1074213

URL: http://svn.apache.org/viewvc?rev=1074213&view=rev
Log:
Adding a test to start looking if we can support Gang's scenario in 2.x. The idea is to prod each of the injection points to make sure we do the right thing at each stage. 

Added:
    tuscany/sca-java-2.x/trunk/unreleased/testing/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/   (with props)
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/pom.xml
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/Helloworld.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/HelloworldImpl.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicy.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicyProcessor.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicy.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProcessor.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProviderFactory.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSReferencePolicyProvider.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSServicePolicyProvider.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicy.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicyProcessor.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestAxisHandler.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestPolicyInterceptor.java
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/sca-contribution.xml
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/definitions.xml
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/helloworld.composite
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/sample/
    tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/sample/HelloworldTestCase.java

Propchange: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Feb 24 17:00:59 2011
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/pom.xml?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/pom.xml (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/pom.xml Thu Feb 24 17:00:59 2011
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+   <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-itest</artifactId>
+        <version>2.0-SNAPSHOT</version>
+    </parent>
+
+   <artifactId>interceptors</artifactId>
+   <name>Apache Tuscany SCA iTest Interceptors</name>
+
+   <properties>
+      <tuscany.version>2.0-SNAPSHOT</tuscany.version>
+   </properties>
+
+   <dependencies>
+
+       <dependency>
+           <groupId>org.apache.tuscany.sca</groupId>
+           <artifactId>tuscany-base-runtime-pom</artifactId>
+           <type>pom</type>
+           <version>2.0-SNAPSHOT</version>
+       </dependency>
+
+       <dependency>
+           <groupId>org.apache.tuscany.sca</groupId>
+           <artifactId>tuscany-binding-ws-runtime-axis2</artifactId>
+           <version>2.0-SNAPSHOT</version>
+       </dependency>
+       
+       <dependency>
+           <groupId>org.apache.tuscany.sca</groupId>
+           <artifactId>tuscany-host-jetty</artifactId>
+           <version>2.0-SNAPSHOT</version>
+       </dependency>       
+
+       <dependency>
+         <groupId>junit</groupId>
+         <artifactId>junit</artifactId>
+         <version>4.8.1</version>
+         <scope>test</scope>
+      </dependency>
+
+   </dependencies>
+
+</project>

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/Helloworld.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/Helloworld.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/Helloworld.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/Helloworld.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,28 @@
+/*
+ * 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 sample;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface Helloworld {
+
+    String sayHello(String name);
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/HelloworldImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/HelloworldImpl.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/HelloworldImpl.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/HelloworldImpl.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,42 @@
+/*
+ * 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 sample;
+
+import org.oasisopen.sca.annotation.Property;
+import org.oasisopen.sca.annotation.Reference;
+
+
+public class HelloworldImpl implements Helloworld {
+    
+    @Reference(required=false)
+    protected Helloworld hwRef;
+    
+    @Property
+    protected String componentName;
+
+    public String sayHello(String name) {
+        String returnString = name + "->" + componentName;
+        if (hwRef != null){
+            return hwRef.sayHello(returnString);
+        } else {
+            return returnString;
+        }
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicy.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicy.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicy.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicy.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,57 @@
+/*
+ * 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 sample;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * A test policy that can be applied at various places along the message
+ * handling chain
+ * 
+ * @version $Rev: 916315 $ $Date: 2010-02-25 15:12:44 +0000 (Thu, 25 Feb 2010) $
+ */
+public class ImplementationGenericPolicy {
+    public static final QName NAME = new QName(Constants.SCA11_TUSCANY_NS, "implementationGenericPolicy");
+
+    private String name;
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public QName getSchemaName() {
+        return NAME;
+    }
+
+    public boolean isUnresolved() {
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        // it's always resolved
+    }
+   
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicyProcessor.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicyProcessor.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/ImplementationGenericPolicyProcessor.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,80 @@
+/*
+ * 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 sample;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+public class ImplementationGenericPolicyProcessor implements StAXArtifactProcessor<ImplementationGenericPolicy> {
+    
+    public ImplementationGenericPolicyProcessor(FactoryExtensionPoint modelFactories) {
+    }
+    
+    public QName getArtifactType() {
+        return ImplementationGenericPolicy.NAME;
+    }
+
+    public Class<ImplementationGenericPolicy> getModelType() {
+        return ImplementationGenericPolicy.class;
+    }
+
+    public ImplementationGenericPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
+        ImplementationGenericPolicy policy = new ImplementationGenericPolicy();
+        
+        String name = reader.getAttributeValue(null, "name");
+        
+        if (name != null) {
+            policy.setName(name);
+        } else {
+            Monitor.error(context.getMonitor(), 
+                    this, 
+                    "policy-security-validation-messages", 
+                    "RequiredAttributeKeyStoreTypeMissing");
+        }
+    
+        return policy;
+    }
+
+    public void write(ImplementationGenericPolicy model, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException,
+        XMLStreamException {
+        // TODO 
+
+    }
+
+    public void resolve(ImplementationGenericPolicy model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
+        // It's resolved when it's read
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicy.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicy.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicy.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicy.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,57 @@
+/*
+ * 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 sample;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * A test policy that can be applied at various places along the message
+ * handling chain
+ * 
+ * @version $Rev: 916315 $ $Date: 2010-02-25 15:12:44 +0000 (Thu, 25 Feb 2010) $
+ */
+public class InteractionBindingWSPolicy {
+    public static final QName NAME = new QName(Constants.SCA11_TUSCANY_NS, "interactionBindingWSPolicy");
+
+    private String name;
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public QName getSchemaName() {
+        return NAME;
+    }
+
+    public boolean isUnresolved() {
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        // it's always resolved
+    }
+   
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProcessor.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProcessor.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProcessor.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,76 @@
+/*
+ * 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 sample;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+public class InteractionBindingWSPolicyProcessor implements StAXArtifactProcessor<InteractionBindingWSPolicy> {
+    
+    public InteractionBindingWSPolicyProcessor(FactoryExtensionPoint modelFactories) {
+    }
+    
+    public QName getArtifactType() {
+        return InteractionBindingWSPolicy.NAME;
+    }
+
+    public Class<InteractionBindingWSPolicy> getModelType() {
+        return InteractionBindingWSPolicy.class;
+    }
+
+    public InteractionBindingWSPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
+        InteractionBindingWSPolicy policy = new InteractionBindingWSPolicy();
+        
+        String name = reader.getAttributeValue(null, "name");
+        
+        if (name != null) {
+            policy.setName(name);
+        } else {
+            Monitor.error(context.getMonitor(), 
+                    this, 
+                    "policy-security-validation-messages", 
+                    "RequiredAttributeKeyStoreTypeMissing");
+        }
+    
+        return policy;
+    }
+
+    public void write(InteractionBindingWSPolicy model, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException,
+        XMLStreamException {
+        // TODO 
+
+    }
+
+    public void resolve(InteractionBindingWSPolicy model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
+        // It's resolved when it's read
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProviderFactory.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProviderFactory.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSPolicyProviderFactory.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,68 @@
+/*
+ * 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 sample;
+
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.PolicyProvider;
+import org.apache.tuscany.sca.provider.PolicyProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+/**
+ * @version $Rev: 792622 $ $Date: 2009-07-09 19:14:18 +0100 (Thu, 09 Jul 2009) $
+ */
+public class InteractionBindingWSPolicyProviderFactory implements PolicyProviderFactory<InteractionBindingWSPolicy> {
+    private ExtensionPointRegistry registry;
+    
+    public InteractionBindingWSPolicyProviderFactory(ExtensionPointRegistry registry) {
+        super();
+        this.registry = registry;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createImplementationPolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.assembly.Implementation)
+     */
+    public PolicyProvider createImplementationPolicyProvider(RuntimeComponent component) {
+        return null;
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createReferencePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentReference, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createReferencePolicyProvider(EndpointReference endpointReference) {
+        return new InteractionBindingWSReferencePolicyProvider(endpointReference);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.PolicyProviderFactory#createServicePolicyProvider(org.apache.tuscany.sca.runtime.RuntimeComponent, org.apache.tuscany.sca.runtime.RuntimeComponentService, org.apache.tuscany.sca.assembly.Binding)
+     */
+    public PolicyProvider createServicePolicyProvider(Endpoint endpoint) {
+        return new InteractionBindingWSServicePolicyProvider(endpoint);
+    }
+
+    /**
+     * @see org.apache.tuscany.sca.provider.ProviderFactory#getModelType()
+     */
+    public Class<InteractionBindingWSPolicy> getModelType() {
+        return InteractionBindingWSPolicy.class;
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSReferencePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSReferencePolicyProvider.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSReferencePolicyProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSReferencePolicyProvider.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,85 @@
+/*
+ * 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 sample;
+
+import java.util.List;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.binding.ws.axis2.provider.Axis2BaseBindingProvider;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev: 792641 $ $Date: 2009-07-09 20:13:08 +0100 (Thu, 09 Jul 2009) $
+ */
+public class InteractionBindingWSReferencePolicyProvider extends BasePolicyProvider<InteractionBindingWSPolicy> {
+    
+    private EndpointReference endpointReference;
+
+    public InteractionBindingWSReferencePolicyProvider(EndpointReference endpointReference) {
+        super(InteractionBindingWSPolicy.class, endpointReference);
+        
+        this.endpointReference = endpointReference;
+    }
+    
+    public void configureBinding(Object configuration) {
+        Axis2BaseBindingProvider bindingProvider = (Axis2BaseBindingProvider)configuration;
+        ConfigurationContext axisConfigurationContext = bindingProvider.getAxisConfigurationContext();
+        AxisConfiguration axisConfiguration = axisConfigurationContext.getAxisConfiguration();
+        List<org.apache.axis2.engine.Phase> outPhases = axisConfiguration.getOutFlowPhases();
+        outPhases.get(0).addHandler(new TestAxisHandler("Reference OutFlow Handler"));
+        List<org.apache.axis2.engine.Phase> inPhases = axisConfiguration.getInFlowPhases();
+        inPhases.get(0).addHandler(new TestAxisHandler("Reference InFlow Handler"));      
+    }
+    
+    public PhasedInterceptor createBindingInterceptor() {
+        List<InteractionBindingWSPolicy> policies = findPolicies();   
+        
+        if (policies.isEmpty()){
+            return null;
+        } else {
+            return new TestPolicyInterceptor(subject, 
+                                             getContext(), 
+                                             null, 
+                                             policies, 
+                                             Phase.REFERENCE_BINDING_POLICY);
+        } 
+    }
+
+    public PhasedInterceptor createInterceptor(Operation operation) {
+        List<InteractionBindingWSPolicy> policies = findPolicies();   
+        
+        if (policies.isEmpty()){
+            return null;
+        } else {
+            return new TestPolicyInterceptor(subject, 
+                                             getContext(), 
+                                             operation, 
+                                             policies, 
+                                             Phase.REFERENCE_POLICY);
+        }        
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSServicePolicyProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSServicePolicyProvider.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSServicePolicyProvider.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionBindingWSServicePolicyProvider.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,80 @@
+/*
+ * 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 sample;
+
+import java.util.List;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.tuscany.sca.assembly.Endpoint;
+import org.apache.tuscany.sca.binding.ws.axis2.provider.Axis2BaseBindingProvider;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Phase;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.provider.BasePolicyProvider;
+
+/**
+ * @version $Rev: 792641 $ $Date: 2009-07-09 20:13:08 +0100 (Thu, 09 Jul 2009) $
+ */
+public class InteractionBindingWSServicePolicyProvider extends BasePolicyProvider<InteractionBindingWSPolicy> {
+
+    public InteractionBindingWSServicePolicyProvider(Endpoint endpoint) {
+        super(InteractionBindingWSPolicy.class, endpoint);
+    }
+    
+    public void configureBinding(Object configuration) {
+        Axis2BaseBindingProvider bindingProvider = (Axis2BaseBindingProvider)configuration;
+        ConfigurationContext axisConfigurationContext = bindingProvider.getAxisConfigurationContext();
+        AxisConfiguration axisConfiguration = axisConfigurationContext.getAxisConfiguration();
+        List<org.apache.axis2.engine.Phase> inPhases = axisConfiguration.getInFlowPhases();
+        inPhases.get(0).addHandler(new TestAxisHandler("Service InFlow Handler"));              
+        List<org.apache.axis2.engine.Phase> outPhases = axisConfiguration.getOutFlowPhases();
+        outPhases.get(0).addHandler(new TestAxisHandler("Service OutFlow Handler"));
+    }
+    
+    public PhasedInterceptor createBindingInterceptor() {
+        List<InteractionBindingWSPolicy> policies = findPolicies();   
+        
+        if (policies.isEmpty()){
+            return null;
+        } else {
+            return new TestPolicyInterceptor(subject, 
+                                             getContext(), 
+                                             null, 
+                                             policies, 
+                                             Phase.SERVICE_BINDING_POLICY);
+        }
+    }
+
+    public PhasedInterceptor createInterceptor(Operation operation) {
+        List<InteractionBindingWSPolicy> policies = findPolicies();   
+        
+        if (policies.isEmpty()){
+            return null;
+        } else {
+            return new TestPolicyInterceptor(subject, 
+                                             getContext(), 
+                                             operation, 
+                                             policies, 
+                                             Phase.SERVICE_POLICY);
+        }
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicy.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicy.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicy.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicy.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,57 @@
+/*
+ * 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 sample;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.xml.Constants;
+
+/**
+ * A test policy that can be applied at various places along the message
+ * handling chain
+ * 
+ * @version $Rev: 916315 $ $Date: 2010-02-25 15:12:44 +0000 (Thu, 25 Feb 2010) $
+ */
+public class InteractionGenericPolicy {
+    public static final QName NAME = new QName(Constants.SCA11_TUSCANY_NS, "interactionGenericPolicy");
+
+    private String name;
+    
+    public String getName() {
+        return name;
+    }
+    
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public QName getSchemaName() {
+        return NAME;
+    }
+
+    public boolean isUnresolved() {
+        return false;
+    }
+
+    public void setUnresolved(boolean unresolved) {
+        // it's always resolved
+    }
+   
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicyProcessor.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicyProcessor.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/InteractionGenericPolicyProcessor.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,76 @@
+/*
+ * 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 sample;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.contribution.processor.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.processor.ContributionWriteException;
+import org.apache.tuscany.sca.contribution.processor.ProcessorContext;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
+import org.apache.tuscany.sca.monitor.Monitor;
+
+public class InteractionGenericPolicyProcessor implements StAXArtifactProcessor<InteractionGenericPolicy> {
+    
+    public InteractionGenericPolicyProcessor(FactoryExtensionPoint modelFactories) {
+    }
+    
+    public QName getArtifactType() {
+        return InteractionGenericPolicy.NAME;
+    }
+
+    public Class<InteractionGenericPolicy> getModelType() {
+        return InteractionGenericPolicy.class;
+    }
+
+    public InteractionGenericPolicy read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
+        InteractionGenericPolicy policy = new InteractionGenericPolicy();
+        
+        String name = reader.getAttributeValue(null, "name");
+        
+        if (name != null) {
+            policy.setName(name);
+        } else {
+            Monitor.error(context.getMonitor(), 
+                    this, 
+                    "policy-security-validation-messages", 
+                    "RequiredAttributeKeyStoreTypeMissing");
+        }
+    
+        return policy;
+    }
+
+    public void write(InteractionGenericPolicy model, XMLStreamWriter writer, ProcessorContext context) throws ContributionWriteException,
+        XMLStreamException {
+        // TODO 
+
+    }
+
+    public void resolve(InteractionGenericPolicy model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
+        // It's resolved when it's read
+    }
+
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestAxisHandler.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestAxisHandler.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestAxisHandler.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestAxisHandler.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,43 @@
+/*
+ * 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 sample;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+
+/**
+ * An Axis handler to show that policy can add one of needs be
+ *
+ * @version $Rev: 881959 $ $Date: 2009-11-18 22:07:09 +0000 (Wed, 18 Nov 2009) $
+ */
+public class TestAxisHandler  extends AbstractHandler
+{
+    private String name;
+    
+    public TestAxisHandler(String name)
+    {
+        this.name = name;
+    }
+    
+    public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
+        System.out.println("TestAxisHandler.invoke() " + name);
+        return InvocationResponse.CONTINUE;
+    }
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestPolicyInterceptor.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestPolicyInterceptor.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/java/sample/TestPolicyInterceptor.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,80 @@
+/*
+ * 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 sample;
+
+import java.util.List;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+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;
+import org.apache.tuscany.sca.invocation.PhasedInterceptor;
+import org.apache.tuscany.sca.policy.PolicySubject;
+
+/**
+ * Policy interceptor that tests the locations where interceptors can be
+ * added
+ *
+ * @version $Rev: 881959 $ $Date: 2009-11-18 22:07:09 +0000 (Wed, 18 Nov 2009) $
+ */
+public class TestPolicyInterceptor  extends InterceptorAsyncImpl implements PhasedInterceptor{
+    //public static final QName policySetQName = new QName(JDKLoggingPolicy.SCA11_TUSCANY_NS, loggingPolicy);
+
+    private Operation operation;
+    private List<?> policies;
+    private PolicySubject subject;
+    private String context;
+    private String phase;
+
+    public TestPolicyInterceptor(PolicySubject subject,
+                                 String context,
+                                 Operation operation,
+                                 List<?> policies,
+                                 String phase) {
+        super();
+        this.operation = operation;
+        this.policies = policies;
+        this.subject = subject;
+        this.phase = phase;
+        this.context = context;
+    }
+
+    public Message processRequest(Message msg) {
+        System.out.println("TestPolicyInterceptor.processRequest() " + context + " @ " + phase);
+        return msg;
+    }
+    
+    public Message processResponse(Message msg) {
+        System.out.println("TestPolicyInterceptor.processResponse() " + context + " @ " + phase);
+        return msg;
+    }
+
+    public String getPhase() {
+        return phase;
+    }
+}

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/sca-contribution.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/sca-contribution.xml?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/sca-contribution.xml (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/sca-contribution.xml Thu Feb 24 17:00:59 2011
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+              xmlns:sample="http://sample">
+   
+   <deployable composite="sample:helloworld-contribution" />
+
+</contribution>

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor Thu Feb 24 17:00:59 2011
@@ -0,0 +1,20 @@
+# 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. 
+
+sample.ImplementationGenericPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#implementationGenericPolicy,model=sample.ImplementationGenericPolicy
+sample.InteractionGenericPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#interactionGenericPolicy,model=sample.InteractionGenericPolicy
+sample.InteractionBindingWSPolicyProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.1#interactionBindingWSPolicy,model=sample.InteractionBindingWSPolicy
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.definitions.xml.Definitions Thu Feb 24 17:00:59 2011
@@ -0,0 +1,17 @@
+# 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.xml

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.PolicyProviderFactory Thu Feb 24 17:00:59 2011
@@ -0,0 +1,18 @@
+# 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. 
+
+sample.InteractionBindingWSPolicyProviderFactory;model=sample.InteractionBindingWSPolicy
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/definitions.xml?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/definitions.xml (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/definitions.xml Thu Feb 24 17:00:59 2011
@@ -0,0 +1,60 @@
+<?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">
+
+	<intent name="implementation.generic" constrains="implementation">
+		<description>
+			An intent that targets policy interceptors at the implementation
+		</description>
+	</intent>
+    
+    <intent name="interaction.generic" constrains="binding">
+        <description>
+            An intent that targets policy interceptors at the binding generically
+        </description>
+    </intent>
+    
+    <intent name="interaction.bindingws" constrains="binding.ws">
+        <description>
+            An intent that targets policy interceptors at binding.ws
+        </description>
+    </intent>
+    
+    <policySet name="ImplementationGeneric"
+               provides="tuscany:implementation.generic"
+               appliesTo="//implementation">
+        <tuscany:implementationGenericPolicy name="ImplementationGeneric"/>
+    </policySet>  
+    
+    <policySet name="InteractionGeneric"
+               provides="tuscany:interaction.generic"
+               appliesTo="//binding">
+        <tuscany:interactionGenericPolicy name="InteractionGeneric"/>
+    </policySet>  
+    
+    <policySet name="InteractionBindingWS"
+               provides="tuscany:interaction.bindingws"
+               appliesTo="//binding.ws">
+        <tuscany:interactionBindingWSPolicy name="InteractionBindingWS"/>
+    </policySet> 
+    
+</definitions>
\ No newline at end of file

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/helloworld.composite?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/helloworld.composite (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/main/resources/helloworld.composite Thu Feb 24 17:00:59 2011
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.    
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+           targetNamespace="http://sample"
+           name="helloworld-contribution">
+
+    <component name="HelloworldComponent1">
+        <implementation.java class="sample.HelloworldImpl"/>
+        <reference name="hwRef" 
+                   target="HelloworldComponent2"
+                   requires="tuscany:interaction.bindingws" 
+                   policySets="tuscany:InteractionBindingWS"/>
+        <property name="componentName" value="HelloworldComponent1"/>
+    </component>
+    
+     <component name="HelloworldComponent2">
+        <implementation.java class="sample.HelloworldImpl"/>
+        <service name="Helloworld" 
+                 requires="tuscany:interaction.bindingws" 
+                 policySets="tuscany:InteractionBindingWS">
+            <binding.ws/>
+        </service>
+        <reference name="hwRef" target="HelloworldComponent3"/>
+        <property name="componentName" value="HelloworldComponent2"/>
+    </component>
+    
+    <component name="HelloworldComponent3">
+        <implementation.java class="sample.HelloworldImpl"/>
+        <property name="componentName" value="HelloworldComponent3"/>
+    </component>    
+
+</composite>

Added: tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/sample/HelloworldTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/sample/HelloworldTestCase.java?rev=1074213&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/sample/HelloworldTestCase.java (added)
+++ tuscany/sca-java-2.x/trunk/unreleased/testing/itest/interceptors/src/test/java/sample/HelloworldTestCase.java Thu Feb 24 17:00:59 2011
@@ -0,0 +1,48 @@
+/*
+ * 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 sample;
+
+import org.junit.Assert;
+
+import org.apache.tuscany.sca.Node;
+import org.apache.tuscany.sca.TuscanyRuntime;
+import org.junit.Test;
+import org.oasisopen.sca.NoSuchServiceException;
+
+public class HelloworldTestCase {
+
+    @Test
+    public void testSayHello() throws NoSuchServiceException {
+
+        // Run the SCA composite in a Tuscany runtime
+        Node node = TuscanyRuntime.runComposite("helloworld.composite", "target/classes");
+        try {
+            
+            // Get the Helloworld service proxy
+            Helloworld helloworld = node.getService(Helloworld.class, "HelloworldComponent1");
+            
+            // test that it works as expected
+            Assert.assertEquals("Fred->HelloworldComponent1->HelloworldComponent2->HelloworldComponent3", helloworld.sayHello("Fred"));
+            
+        } finally {
+            // Stop the Tuscany runtime Node
+            node.stop();        
+        }
+    }
+}