cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r504621 [2/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/phase/ api/src/main/java/org/apache/cxf/ws/policy/ api/src/test/java/org/apache/cxf/phase/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/main/...
Date Wed, 07 Feb 2007 17:11:27 GMT
Added: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java?view=auto&rev=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java
(added)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java
Wed Feb  7 09:11:23 2007
@@ -0,0 +1,138 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.policy;
+
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyOperator;
+
+/**
+ * 
+ */
+public class PolicyTest extends TestCase {
+
+    private static final String INDENT = "  ";
+    
+    public void testNothing() {
+    }
+    
+    public void xtestMergeIdentical() {
+        Policy p1 = new Policy();
+        Assertion a1 = new TestAssertion(new QName("http://x.y.z", "a"));
+        p1.addPolicyComponent(a1);
+        System.out.println("Policy p1:");
+        printPolicyComponent(p1);
+        
+        Policy p2 = new Policy();
+        Assertion a2 = new TestAssertion(new QName("http://x.y.z", "b"));
+        p2.addPolicyComponent(a2);
+        System.out.println("Policy p2:");
+        printPolicyComponent(p2);
+        
+        Policy p3 = new Policy();
+        p3.addPolicyComponent(a1);
+        System.out.println("Policy p3:");
+        printPolicyComponent(p3);
+        
+        Policy p = p1.merge(p2);
+        System.out.println("p1 merged with p2:");
+        printPolicyComponent(p);
+        
+        System.out.println("normalised merge result:");
+        printPolicyComponent(p.normalize(true));
+        
+        p = p1.merge(p3);
+        System.out.println("p1 merged with p3:");
+        printPolicyComponent(p);
+        
+        System.out.println("normalised merge result:");
+        printPolicyComponent(p.normalize(true));
+        
+        
+        
+        
+    }
+    
+    private void printPolicyComponent(PolicyComponent pc) {
+        StringBuffer buf = new StringBuffer();
+        printPolicyComponent(pc, buf, 0);
+        System.out.println(buf.toString());
+    }
+    
+    private void printPolicyComponent(PolicyComponent pc, StringBuffer buf, int level) {
+        indent(buf, level);
+        buf.append("type: ");
+        buf.append(typeToString(pc.getType()));
+        if (Constants.TYPE_ASSERTION == pc.getType()) {
+            buf.append(" (");
+            buf.append(((Assertion)pc).getName());
+            buf.append(")");
+            nl(buf);
+        } else {
+            level++;
+            List<PolicyComponent> children = CastUtils.cast(((PolicyOperator)pc).getPolicyComponents(),
+                PolicyComponent.class);
+            nl(buf);
+            for (PolicyComponent child : children) {
+                printPolicyComponent(child, buf, level);
+            }
+            level--;
+        }
+    }
+    
+    private void indent(StringBuffer buf, int level) {
+        for (int i = 0; i < level; i++) {
+            buf.append(INDENT);
+        }
+    }
+    
+    private void nl(StringBuffer buf) {
+        buf.append(System.getProperty("line.separator"));
+    }
+    
+    private String typeToString(short type) {
+        switch(type) {
+        case Constants.TYPE_ASSERTION:
+            return "Assertion";
+        case Constants.TYPE_ALL:
+            return "All";
+        case Constants.TYPE_EXACTLYONE:
+            return "ExactlyOne";
+        case Constants.TYPE_POLICY:
+            return "Policy";
+        case Constants.TYPE_POLICY_REF:
+            return "PolicyReference";
+        default:
+            break;
+        }
+        return "";
+    }
+    
+    
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/PolicyTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java?view=auto&rev=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
(added)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
Wed Feb  7 09:11:23 2007
@@ -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 org.apache.cxf.ws.policy;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.PolicyComponent;
+
+/**
+ * 
+ */
+public class TestAssertion implements Assertion {
+    
+    private QName name;
+    private boolean optional;
+    
+    TestAssertion() {
+        this(null);
+    }
+    
+    TestAssertion(QName n) {
+        name = n;
+    }
+    
+    public QName getName() {
+        return name;
+    }
+
+    public boolean isOptional() {
+        return optional;
+    }
+
+    public PolicyComponent normalize() {
+        return this;
+    }
+
+    public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+    }
+
+    public boolean equal(PolicyComponent policyComponent) {
+        return this == policyComponent;
+    }
+
+    public short getType() {
+        return Constants.TYPE_ASSERTION;
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/TestAssertion.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
Wed Feb  7 09:11:23 2007
@@ -61,7 +61,6 @@
 
     private static final String NAMESPACE_URI = "http://apache.org/cxf/calculator";
     private static final QName OPERATION_NAME = new QName(NAMESPACE_URI, "add");
-    // private static Bus bus;
     private static ServiceInfo[] services;
     private static EndpointInfo[] endpoints;
     private Wsdl11AttachmentPolicyProvider app; 

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilderTest.java?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilderTest.java
(original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builders/jaxb/JaxbAssertionBuilderTest.java
Wed Feb  7 09:11:23 2007
@@ -37,7 +37,21 @@
  */
 public class JaxbAssertionBuilderTest extends TestCase {
     
-    public void testGetSupported() throws Exception {
+    public void testConstructors() throws Exception {        
+        QName qn = new QName("http://cxf.apache.org/test/assertions/foo", "FooType");
+        try {
+            new JaxbAssertionBuilder("org.apache.cxf.test.assertions.foo.UnknownType", qn);
+            fail("Expected ClassNotFoundException not thrown.");
+        } catch (ClassNotFoundException ex) {
+            // expected
+        }
+        assertNotNull(new JaxbAssertionBuilder(qn)); 
+        assertNotNull(new JaxbAssertionBuilder("org.apache.cxf.test.assertions.foo.FooType",
qn));   
+        assertNotNull(new JaxbAssertionBuilder<FooType>(FooType.class, qn));
+    }
+    
+    
+    public void testGetKnownElements() throws Exception {
         QName qn = new QName("http://cxf.apache.org/test/assertions/foo", "FooType");
         JaxbAssertionBuilder<FooType> ab = new JaxbAssertionBuilder<FooType>(FooType.class,
qn);
         assertNotNull(ab);
@@ -58,8 +72,7 @@
         JaxbAssertion<FooType> jba = (JaxbAssertion<FooType>)a;
         FooType foo = jba.getData();
         assertEquals("CXF", foo.getName());
-        assertEquals(2, foo.getNumber().intValue()); 
-        
+        assertEquals(2, foo.getNumber().intValue());         
     }
 
 }

Modified: incubator/cxf/trunk/rt/ws/rm/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/pom.xml?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/pom.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/pom.xml Wed Feb  7 09:11:23 2007
@@ -54,12 +54,12 @@
             <version>${project.version}</version>
         </dependency>
         <!--
+        -->
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-policy</artifactId>
             <version>${project.version}</version>
         </dependency>
-        -->
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-ws-addr</artifactId>

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMConstants.java Wed Feb
 7 09:11:23 2007
@@ -69,6 +69,11 @@
     
     private static final String WSA_NONE_ADDRESS =
         WSA_NAMESPACE_NAME + "/none";
+    
+    private static final String RMASSERTION_NAME = "RMAssertion";
+    
+    private static final QName RMASSERTION_QNAME = 
+        new QName(WSRMP_NAMESPACE_NAME, RMASSERTION_NAME);
       
     /**
      * The set of headers understood by the protocol binding.
@@ -147,6 +152,8 @@
         return HEADERS;
     }
     
+    // namespaces
+    
     public static String getNamespace() {
         return WSRM_NAMESPACE_NAME; 
     }
@@ -165,7 +172,9 @@
     
     public static  String getWsdlNamespace() {
         return WSRM_WSDL_NAMESPACE_NAME;
-    }    
+    }  
+    
+    // schema type constants
   
     public static String getSequenceName() {
         return WSRM_SEQUENCE_NAME;
@@ -199,6 +208,8 @@
         return WSA_NONE_ADDRESS;
     }
     
+    // service model constants
+    
     public static QName getCreateSequenceOperationName() {
         return WSRM_CREATE_SEQUENCE_QNAME;
     }
@@ -223,6 +234,8 @@
         return WSRM_SEQUENCE_ACKNOWLEDGEMENT_QNAME;
     }
     
+    // actions
+    
     public static String getCreateSequenceAction() {
         return WSRM_CREATE_SEQUENCE_ACTION;
     }
@@ -251,6 +264,8 @@
         return WSRM_SEQUENCE_INFO_ACTION;
     }
     
+    // fault codes
+    
     public static QName getUnknownSequenceFaultCode() {
         return new QName(WSRM_NAMESPACE_NAME, WSRM_UNKNOWN_SEQUENCE_FAULT_CODE);
     }
@@ -273,5 +288,15 @@
     
     public static QName getLastMessageNumberExceededFaultCode() {
         return new QName(WSRM_NAMESPACE_NAME, WSRM_LAST_MESSAGE_NUMBER_EXCEEDED_FAULT_CODE);
+    }
+    
+    // policies
+    
+    public static String getRMAssertionName() {
+        return RMASSERTION_NAME;
+    }
+    
+    public static QName getRMAssertionQName() {
+        return RMASSERTION_QNAME;
     }
 }

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
(original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
Wed Feb  7 09:11:23 2007
@@ -171,7 +171,7 @@
                 rmpsOut.addAck(seq);
             } else if (LOG.isLoggable(Level.FINE)) {
                 if (!seq.sendAcknowledgement()) {
-                    LOG.fine("no need to add an acknowledgements for sequence "
+                    LOG.fine("no need to add acknowledgements for sequence "
                              + seq.getIdentifier().getValue());
                 } else {
                     LOG.fine("sequences acksTo address (" + seq.getAcksTo().getAddress().getValue()

Added: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java?view=auto&rev=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
(added)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
Wed Feb  7 09:11:23 2007
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm.policy;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.interceptor.AbstractAttributedInterceptorProvider;
+import org.apache.cxf.ws.policy.PolicyInterceptorProvider;
+import org.apache.cxf.ws.rm.RMConstants;
+
+/**
+ * 
+ */
+public class RMPolicyInterceptorProvider  extends AbstractAttributedInterceptorProvider 
+    implements PolicyInterceptorProvider {
+
+    private static final Collection<QName> ASSERTION_TYPES 
+        = Collections.singletonList(RMConstants.getRMAssertionQName());    
+    
+    public RMPolicyInterceptorProvider() {
+        // configurable content
+    } 
+    
+    public Collection<QName> getAssertionTypes() {
+        return ASSERTION_TYPES;
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/policy/RMPolicyInterceptorProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/resources/META-INF/cxf/cxf-extension-rm.xml Wed
Feb  7 09:11:23 2007
@@ -27,4 +27,63 @@
         <property name="bus" ref="cxf"/>
     </bean>
     
+    <!-- global definition of interceptors, may need to switch qualified names -->
+    
+    <bean id="mapAggregator" class="org.apache.cxf.ws.addressing.MAPAggregator"/>
+    <bean id="mapCodec" class="org.apache.cxf.ws.addressing.soap.MAPCodec"/>
+    <bean id="rmLogicalOut" class="org.apache.cxf.ws.rm.RMOutInterceptor">
+        <property name="bus" ref="cxf"/>
+    </bean>
+    <bean id="rmLogicalIn" class="org.apache.cxf.ws.rm.RMInInterceptor">
+        <property name="bus" ref="cxf"/>
+    </bean>    
+    <bean id="rmCodec" class="org.apache.cxf.ws.rm.soap.RMSoapInterceptor"/>
+    
+    <bean class="org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider">
+        <property name="inInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="rmLogicalIn"/>
+                <ref bean="rmCodec"/>
+            </list>
+        </property>
+        <property name="inFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <!--
+                <ref bean="mapCodec"/>
+                -->
+                <ref bean="rmLogicalIn"/>
+                <ref bean="rmCodec"/>
+            </list>
+        </property>
+        <property name="outInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="rmLogicalOut"/>
+                <ref bean="rmCodec"/>
+            </list>
+        </property>
+        <property name="outFaultInterceptors">
+            <list>
+                <ref bean="mapAggregator"/>
+                <ref bean="mapCodec"/>
+                <ref bean="rmLogicalOut"/>
+                <ref bean="rmCodec"/>
+            </list>
+        </property>
+    </bean>
+    
+    <bean id="org.apache.cxf.ws.rm.RMAssertionBuilder" class="org.apache.cxf.ws.policy.builders.jaxb.JaxbAssertionBuilder">
+        <constructor-arg value="org.apache.cxf.ws.rm.policy.RMAssertion"/>
+        <constructor-arg>
+            <bean class="javax.xml.namespace.QName">
+              <constructor-arg value="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"/>
+              <constructor-arg value="RMAssertion"/>
+          </bean>
+        </constructor-arg>
+    </bean>
+    
 </beans>

Added: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/RMPolicyExtensionsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/RMPolicyExtensionsTest.java?view=auto&rev=504621
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/RMPolicyExtensionsTest.java
(added)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/RMPolicyExtensionsTest.java
Wed Feb  7 09:11:23 2007
@@ -0,0 +1,72 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.ws.rm.policy;
+
+import junit.framework.TestCase;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.phase.PhaseManager;
+import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
+import org.apache.cxf.ws.policy.PolicyInterceptorProvider;
+import org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry;
+import org.apache.cxf.ws.rm.RMConstants;
+
+/**
+ * 
+ */
+public class RMPolicyExtensionsTest extends TestCase {
+
+    public void testExtensions() {
+        Bus bus = null;
+        try {
+            bus = new SpringBusFactory().createBus();
+
+            AssertionBuilderRegistry abr = bus.getExtension(AssertionBuilderRegistry.class);
+            assertNotNull(abr);
+            AssertionBuilder ab = abr.get(RMConstants.getRMAssertionQName());
+            assertNotNull(ab);
+
+            PolicyInterceptorProviderRegistry pipr = bus
+                .getExtension(PolicyInterceptorProviderRegistry.class);
+            assertNotNull(pipr);
+            PolicyInterceptorProvider pip = pipr.get(RMConstants.getRMAssertionQName());
+            assertNotNull(pip);
+            
+            assertEquals(4, pip.getOutInterceptors().size());
+            assertEquals(4, pip.getOutFaultInterceptors().size());
+            assertEquals(4, pip.getInInterceptors().size());
+            assertEquals(3, pip.getInFaultInterceptors().size());
+            
+            PhaseManager pm = bus.getExtension(PhaseManager.class);
+            PhaseInterceptorChain chain = new PhaseInterceptorChain(pm.getOutPhases());
+            chain.add(pip.getOutInterceptors());
+            
+        } finally {
+            if (null != bus) {
+                bus.shutdown(true);
+                BusFactory.setDefaultBus(null);
+            }
+        }
+    }
+}

Propchange: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/RMPolicyExtensionsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/policy/RMPolicyExtensionsTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/ControlImpl.java
Wed Feb  7 09:11:23 2007
@@ -53,7 +53,6 @@
         greeterBus = bf.createBus(cfgResource);
         BusFactory.setDefaultBus(greeterBus);
         LOG.info("Initialised bus with cfg file resource: " + cfgResource);
-        // greeterBus.getOutInterceptors().add(new JaxwsInterceptorRemover());
         greeterBus.getOutInterceptors().add(new OutMessageRecorder());
         greeterBus.getInInterceptors().add(new InMessageRecorder());
         

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java?view=diff&rev=504621&r1=504620&r2=504621
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
(original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/ws/rm/SequenceTest.java
Wed Feb  7 09:11:23 2007
@@ -20,6 +20,8 @@
 package org.apache.cxf.systest.ws.rm;
 
 import java.math.BigInteger;
+import java.util.Iterator;
+import java.util.List;
 import java.util.logging.Logger;
 
 import junit.framework.Test;
@@ -32,10 +34,14 @@
 import org.apache.cxf.greeter_control.ControlService;
 import org.apache.cxf.greeter_control.Greeter;
 import org.apache.cxf.greeter_control.GreeterService;
+import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.systest.common.ClientServerSetupBase;
 import org.apache.cxf.systest.common.ClientServerTestBase;
 import org.apache.cxf.ws.rm.RMConstants;
+import org.apache.cxf.ws.rm.RMInInterceptor;
 import org.apache.cxf.ws.rm.RMManager;
+import org.apache.cxf.ws.rm.RMOutInterceptor;
+import org.apache.cxf.ws.rm.soap.RMSoapInterceptor;
 
 
 /**
@@ -117,8 +123,13 @@
         }
     }
 
+    /** 
+      * Server is configured with RM interceptors, client without;
+      * Addressing interceptors are installed on either side.
+      * The (oneway) application request should be dispatched straight to the
+      * implementor.
+      */
     public void xtestRMServerPlainClient() throws Exception {
-        setupGreeter("org/apache/cxf/systest/ws/rm/anonymous.xml");
 
         SpringBusFactory bf = new SpringBusFactory();
         
@@ -129,12 +140,15 @@
         control = cs.getControlPort();
 
         assertTrue("Failed to start greeter",
-            control.startGreeter("org/apache/cxf/systest/ws/rm/twoway.xml"));
-        
+            control.startGreeter("org/apache/cxf/systest/ws/rm/anonymous.xml"));
 
-        greeterBus = bf.createBus();
+        greeterBus = bf.createBus("org/apache/cxf/systest/ws/rm/anonymous.xml");
         BusFactory.setDefaultBus(greeterBus);
-        LOG.fine("Initialised greeter default bus with configuration");
+        removeRMInterceptors(greeterBus.getOutInterceptors());
+        removeRMInterceptors(greeterBus.getOutFaultInterceptors());
+        removeRMInterceptors(greeterBus.getInInterceptors());
+        removeRMInterceptors(greeterBus.getInFaultInterceptors());
+        LOG.fine("Initialised greeter bus with addressing but without RM interceptors");
 
         outRecorder = new OutMessageRecorder();
         greeterBus.getOutInterceptors().add(outRecorder);
@@ -145,7 +159,7 @@
         greeter = gs.getGreeterPort();
         LOG.fine("Created greeter client.");
 
-        greeter.greetMe("Andrea");
+        greeter.greetMeOneWay("once");
 
     }
 
@@ -803,5 +817,17 @@
         }
         assertEquals("Did not receive expected number of inbound messages", nExpectedIn,
nIn);
         assertEquals("Did not send expected number of outbound messages", nExpectedOut, nOut);
       
+    }
+
+    private void removeRMInterceptors(List<Interceptor> interceptors) {
+        int n = interceptors.size();
+        for (Iterator<Interceptor> it = interceptors.iterator(); it.hasNext();) {
+            Interceptor i = it.next();
+            if (i instanceof RMSoapInterceptor
+                || i instanceof RMOutInterceptor
+                || i instanceof RMInInterceptor) {
+                it.remove();
+            }
+        }
     }
 }



Mime
View raw message