cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r523766 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/ api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/ rt/transports/http/src/main/java/org/apache/cxf/t...
Date Thu, 29 Mar 2007 16:50:18 GMT
Author: andreasmyth
Date: Thu Mar 29 09:50:15 2007
New Revision: 523766

URL: http://svn.apache.org/viewvc?view=rev&rev=523766
Log:
[JIRA CXF-473] Implemented AssertionBuilder for HTTPClientPolicy and HTTPServerPolicy assertions.
Removed runtime dependency of cxf-rt-ws-rm on cxf-rt-ws-policy (RMEndpoint.setPolicies is a no-op if no PolicyEngine is available).
Added MessageUtils to API module and replaced local implementations in ws-rm and cxf-rt-ws-policy (ws-addr still to be done).

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java   (with props)
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java   (with props)
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java   (with props)
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/
    incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
    incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
    incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMOutInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java?view=auto&rev=523766
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java Thu Mar 29 09:50:15 2007
@@ -0,0 +1,79 @@
+/**
+ * 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.message;
+
+/**
+ * Holder for utility methods relating to messages.
+ */
+public final class MessageUtils {
+
+    /**
+     * Prevents instantiation.
+     */
+    private MessageUtils() {
+    }
+
+    /**
+     * Determine if message is outbound.
+     * 
+     * @param message the current Message
+     * @return true iff the message direction is outbound
+     */
+    public static boolean isOutbound(Message message) {
+        Exchange exchange = message.getExchange();
+        return message != null && exchange != null
+               && (message == exchange.getOutMessage() || message == exchange.getOutFaultMessage());
+    }
+
+    /**
+     * Determine if message is fault.
+     * 
+     * @param message the current Message
+     * @return true iff the message is a fault
+     */
+    public static boolean isFault(Message message) {
+        return message != null
+               && message.getExchange() != null
+               && (message == message.getExchange().getInFaultMessage() || message == message.getExchange()
+                   .getOutFaultMessage());
+    }
+
+    /**
+     * Determine if current messaging role is that of requestor.
+     * 
+     * @param message the current Message
+     * @return true iff the current messaging role is that of requestor
+     */
+    public static boolean isRequestor(Message message) {
+        Boolean requestor = (Boolean)message.get(Message.REQUESTOR_ROLE);
+        return requestor != null && requestor.booleanValue();
+    }
+    
+    /**
+     * Determine if the current message is a partial response.
+     * 
+     * @param message the current message
+     * @return true iff the current messags is a partial response
+     */
+    public static boolean isPartialResponse(Message message) {
+        return Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE));
+    }
+
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertion.java Thu Mar 29 09:50:15 2007
@@ -54,7 +54,7 @@
         if (!super.equal(policyComponent)) {
             return false;
         }
-        JaxbAssertion<T> other = (JaxbAssertion<T>)policyComponent;
+        JaxbAssertion<T> other = JaxbAssertion.cast((Assertion)policyComponent);
         return data.equals(other.data);        
     }
 

Modified: incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java (original)
+++ incubator/cxf/trunk/api/src/test/java/org/apache/cxf/ws/policy/builder/jaxb/JaxbAssertionBuilderTest.java Thu Mar 29 09:50:15 2007
@@ -71,7 +71,7 @@
         Element elem = (Element)doc.getDocumentElement()
             .getElementsByTagNameNS("http://cxf.apache.org/test/assertions/foo", "foo").item(0);
         Assertion a = ab.build(elem);
-        JaxbAssertion<FooType> jba = (JaxbAssertion<FooType>)a;
+        JaxbAssertion<FooType> jba = JaxbAssertion.cast(a, FooType.class);
         FooType foo = jba.getData();
         assertEquals("CXF", foo.getName());
         assertEquals(2, foo.getNumber().intValue());         

Added: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java?view=auto&rev=523766
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java Thu Mar 29 09:50:15 2007
@@ -0,0 +1,60 @@
+/**
+ * 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.transport.http.policy;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
+import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
+import org.apache.neethi.Assertion;
+
+/**
+ * 
+ */
+public class HTTPClientAssertionBuilder extends JaxbAssertionBuilder<HTTPClientPolicy> {
+ 
+    public HTTPClientAssertionBuilder() throws JAXBException {
+        super(HTTPClientPolicy.class, PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME);        
+    }
+
+    @Override
+    public Assertion buildCompatible(Assertion a, Assertion b) {
+        if (PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())
+            && PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(b.getName())) {
+            
+            HTTPClientPolicy compatible = PolicyUtils.intersect(
+                JaxbAssertion.cast(a, HTTPClientPolicy.class).getData(),
+                JaxbAssertion.cast(b, HTTPClientPolicy.class).getData());
+            if (null == compatible) {
+                return null;
+            }
+            JaxbAssertion<HTTPClientPolicy> ca = 
+                new JaxbAssertion<HTTPClientPolicy>(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME, 
+                    a.isOptional() && b.isOptional());
+            ca.setData(compatible);
+            return ca;
+        }
+        return null;
+    }
+    
+    
+
+}

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPClientAssertionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java?view=auto&rev=523766
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java (added)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java Thu Mar 29 09:50:15 2007
@@ -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 org.apache.cxf.transport.http.policy;
+
+import javax.xml.bind.JAXBException;
+
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
+import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertionBuilder;
+import org.apache.neethi.Assertion;
+
+/**
+ * 
+ */
+public class HTTPServerAssertionBuilder extends JaxbAssertionBuilder<HTTPServerPolicy> {
+ 
+    public HTTPServerAssertionBuilder() throws JAXBException {
+        super(HTTPServerPolicy.class, PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME);        
+    }
+
+    @Override
+    public Assertion buildCompatible(Assertion a, Assertion b) {
+        if (PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())
+            && PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME.equals(b.getName())) {
+            
+            HTTPServerPolicy compatible = PolicyUtils.intersect(
+                JaxbAssertion.cast(a, HTTPServerPolicy.class).getData(),
+                JaxbAssertion.cast(b, HTTPServerPolicy.class).getData());
+            if (null == compatible) {
+                return null;
+            }
+            JaxbAssertion<HTTPServerPolicy> ca = 
+                new JaxbAssertion<HTTPServerPolicy>(PolicyUtils.HTTPSERVERPOLICY_ASSERTION_QNAME, 
+                    a.isOptional() && b.isOptional());
+            ca.setData(compatible);
+            return ca;
+        }
+        return null;
+    }
+}

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/HTTPServerAssertionBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java?view=auto&rev=523766
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java (added)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java Thu Mar 29 09:50:15 2007
@@ -0,0 +1,440 @@
+/**
+ * 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.transport.http.policy;
+
+import java.util.Collection;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.policy.AssertionInfo;
+import org.apache.cxf.ws.policy.AssertionInfoMap;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
+import org.apache.neethi.Assertion;
+
+/**
+ * 
+ */
+public final class PolicyUtils {
+    
+    public static final String HTTPCONF_NAMESPACE = 
+        "http://cxf.apache.org/transports/http/configuration";
+    public static final QName HTTPCLIENTPOLICY_ASSERTION_QNAME =
+        new QName(HTTPCONF_NAMESPACE, "HTTPClientPolicy");
+    public static final QName HTTPSERVERPOLICY_ASSERTION_QNAME =
+        new QName(HTTPCONF_NAMESPACE, "HTTPServerPolicy");
+
+    /**
+     * Prevents instantiation.
+     *
+     */
+    private PolicyUtils() {        
+    }
+
+
+    /**
+     * Returns the HTTPClientPolicy for the specified message or null if no assertions of this type
+     * pertain to the underlying message.
+     * If on the other hand there is more than one such assertion, the first one is taken.
+     * TODO:
+     * This should be replaced by computing an merged assertion if this is possible, e.g. one in
+     * which the connection timeout is set to be to the minimum of all connections timeouts.
+     * If there are conflicting assertions, resulting e.g. from a client element that is included
+     * in a policy attached to the endpoint and another client element, included in a policy 
+     * attached to the underlying message, in which chunking is disallowed, a exception should be thrown. 
+     * 
+     * @param message the message
+     * @return the HTTPClientPolicy for the message
+     */
+    public static HTTPClientPolicy getClient(Message message) {
+        AssertionInfoMap amap =  message.get(AssertionInfoMap.class);
+        if (null == amap) {
+            return null;
+        }
+        Collection<AssertionInfo> ais = amap.get(HTTPCLIENTPOLICY_ASSERTION_QNAME);
+        if (null != ais) {
+            for (AssertionInfo ai : ais) {
+                JaxbAssertion<HTTPClientPolicy> ja = 
+                    JaxbAssertion.cast(ai.getAssertion(), HTTPClientPolicy.class);
+                return ja.getData();
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Returns the HTTPServerPolicy for the specified message or null if no assertions of this type
+     * pertain to the underlying message.
+     */
+    public static HTTPServerPolicy getServer(Message message) {
+        AssertionInfoMap amap =  message.get(AssertionInfoMap.class);
+        if (null == amap) {
+            return null;
+        }
+        Collection<AssertionInfo> ais = amap.get(HTTPSERVERPOLICY_ASSERTION_QNAME);
+        if (null != ais) {
+            for (AssertionInfo ai : ais) {
+                JaxbAssertion<HTTPServerPolicy> ja = 
+                    JaxbAssertion.cast(ai.getAssertion(), HTTPServerPolicy.class);
+                return ja.getData();
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Returns the first HTTPClientPolicy element specified in the http client policy assertions
+     * or null if there are no such assertions. 
+     * TODO: Return a merged value if there are multiple such assertions, or report conflict
+     */
+    public static HTTPClientPolicy getClient(Collection<Assertion> alternative) {
+        for (Assertion a : alternative) {
+            if (HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())) {
+                return JaxbAssertion.cast(a, HTTPClientPolicy.class).getData();
+            }
+        }
+        return null;
+    }
+    
+    /**
+     * Returns the first HTTPServerPolicy element specified in the http client policy assertions
+     * or null if there are no such assertions. 
+     * TODO: Return a merged value if there are multiple such assertions, or report conflict
+     */
+    public static HTTPServerPolicy getServer(Collection<Assertion> alternative) {       
+        for (Assertion a : alternative) {
+            if (HTTPSERVERPOLICY_ASSERTION_QNAME.equals(a.getName())) {
+                return JaxbAssertion.cast(a, HTTPServerPolicy.class).getData();
+            }
+        }
+        return null;
+    }
+    
+    public static void assertClientPolicy(PolicyEngine engine, Message message) {
+        AssertionInfoMap aim = message.get(AssertionInfoMap.class);
+        if (null == aim) {
+            return;
+        }
+        Collection<AssertionInfo> ais = aim.get(HTTPCLIENTPOLICY_ASSERTION_QNAME);        
+        if (null == ais || ais.size() == 0) {
+            return;
+        }
+        
+        // assert the endpoint level assertion(s) and any message specific ones that are compatible
+        // with these
+        
+        if (MessageUtils.isOutbound(message)) {
+            System.out.println("message is outbound");
+            Endpoint e = message.getExchange().get(Endpoint.class);
+            EndpointInfo ei = e.getEndpointInfo();
+            Collection<Assertion> endpointAssertions = engine.getClientEndpointPolicy(ei, null)
+                .getChosenAlternative();
+            for (Assertion a : endpointAssertions) {
+                if (HTTPCLIENTPOLICY_ASSERTION_QNAME.equals(a.getName())) {
+                    HTTPClientPolicy p1 = (JaxbAssertion.cast(a, HTTPClientPolicy.class)).getData();
+                    for (AssertionInfo ai : ais) {
+                        HTTPClientPolicy p2 = (JaxbAssertion.cast(ai.getAssertion(), 
+                                                                  HTTPClientPolicy.class)).getData();
+                        if (compatible(p1, p2)) {
+                            ai.setAsserted(true);
+                        }
+                    }
+                }
+            }
+        } else {
+            for (AssertionInfo ai : ais) {
+                ai.setAsserted(true);
+            }
+        }
+    }
+    
+    /**
+     * Checks if two HTTPClientPolicy objects are compatible.
+     * @param p1 one policy
+     * @param p2 another policy
+     * @return true iff policies are compatible
+     */
+    public static boolean compatible(HTTPClientPolicy p1, HTTPClientPolicy p2) {
+        
+        if (p1 == p2 || p1.equals(p2)) {
+            return true;
+        }
+        
+        boolean compatible = true;
+        
+        if (compatible) {
+            compatible &= compatible(p1.getAccept(), p2.getAccept());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getAcceptEncoding(), p2.getAcceptEncoding());
+        }
+           
+        if (compatible) {
+            compatible &= compatible(p1.getAcceptLanguage(), p2.getAcceptLanguage());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getBrowserType(), p2.getBrowserType());
+        }
+        
+        if (compatible) {
+            compatible &= !p1.isSetCacheControl() || !p2.isSetCacheControl()
+                || p1.getCacheControl().value().equals(p2.getCacheControl().value());
+        }
+        
+        if (compatible) {            
+            compatible = !p1.isSetConnection() || !p2.isSetConnection()
+                || p1.getConnection().value().equals(p2.getConnection().value());
+        }
+        
+        if (compatible) {
+            compatible &= p1.getContentType().equals(p2.getContentType());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getCookie(), p2.getCookie());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getDecoupledEndpoint(), p2.getDecoupledEndpoint());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getHost(), p2.getHost());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getProxyServer(), p2.getProxyServer());
+        }
+       
+        if (compatible) {
+            compatible &= !p1.isSetProxyServerPort() || !p2.isSetProxyServerPort()
+                || p1.getProxyServerPort() == p2.getProxyServerPort();
+        }
+        
+        if (compatible) {
+            compatible &= !p1.isSetProxyServerType() || !p2.isSetProxyServerType()
+                || p1.getProxyServerType().equals(p2.getProxyServerType());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getReferer(), p2.getReferer());
+        }
+        
+        if (compatible) {
+            compatible &= p1.isAllowChunking() == p2.isAllowChunking();
+        }
+        
+        if (compatible) {
+            compatible &= p1.isAutoRedirect() == p2.isAutoRedirect();
+        }
+        
+        return compatible;
+    }
+ 
+    
+    /**
+     * Returns a new HTTPClientPolicy which is compatible with the two specified policies or
+     * null if no compatible policy can be determined.
+     * @param p1 one policy
+     * @param p2 another policy
+     * @return the compatible policy
+     */
+    public static HTTPClientPolicy intersect(HTTPClientPolicy p1, HTTPClientPolicy p2) {
+        
+        // incompatibilities
+        
+        if (!compatible(p1, p2)) {
+            return null;
+        }
+        
+        // ok - compute compatible policy
+        
+        HTTPClientPolicy p = new HTTPClientPolicy();
+        p.setAccept(combine(p1.getAccept(), p2.getAccept()));
+        p.setAcceptEncoding(combine(p1.getAcceptEncoding(), p2.getAcceptEncoding()));
+        p.setAcceptLanguage(combine(p1.getAcceptLanguage(), p2.getAcceptLanguage()));
+        if (p1.isSetAllowChunking()) {
+            p.setAllowChunking(p1.isAllowChunking());
+        } else if (p2.isSetAllowChunking()) {
+            p.setAllowChunking(p2.isAllowChunking());
+        } 
+        if (p1.isSetAutoRedirect()) {
+            p.setAutoRedirect(p1.isAutoRedirect());
+        } else if (p2.isSetAutoRedirect()) {
+            p.setAutoRedirect(p2.isAutoRedirect());
+        } 
+        p.setAutoRedirect(p1.isAutoRedirect());
+        p.setBrowserType(combine(p1.getBrowserType(), p2.getBrowserType()));
+        if (p1.isSetCacheControl()) {
+            p.setCacheControl(p1.getCacheControl());
+        } else if (p2.isSetCacheControl()) {
+            p.setCacheControl(p2.getCacheControl());
+        }
+        if (p1.isSetConnection()) {
+            p.setConnection(p1.getConnection());
+        } else if (p2.isSetConnection()) {
+            p.setConnection(p2.getConnection());
+        }        
+        p.setContentType(p1.getContentType());
+        p.setCookie(combine(p1.getCookie(), p2.getCookie()));
+        p.setDecoupledEndpoint(combine(p1.getDecoupledEndpoint(), p2.getDecoupledEndpoint()));
+        p.setHost(combine(p1.getHost(), p2.getHost()));
+        p.setProxyServer(combine(p1.getProxyServer(), p2.getProxyServer()));
+        if (p1.isSetProxyServerPort()) {
+            p.setProxyServerPort(p1.getProxyServerPort());
+        } else if (p2.isSetProxyServerPort()) {
+            p.setProxyServerPort(p2.getProxyServerPort());
+        }
+        if (p1.isSetProxyServerType()) {
+            p.setProxyServerType(p1.getProxyServerType());
+        } else if (p2.isSetProxyServerType()) {
+            p.setProxyServerType(p2.getProxyServerType());
+        }
+        p.setReferer(combine(p1.getReferer(), p2.getReferer()));
+        if (p1.isSetConnectionTimeout() || p2.isSetConnectionTimeout()) {
+            p.setConnectionTimeout(Math.min(p1.getConnectionTimeout(), p2.getConnectionTimeout()));
+        }
+        if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) {
+            p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout()));
+        }
+         
+        return p;      
+    }
+    
+    /**
+     * Checks if two HTTPServerPolicy objects are compatible.
+     * @param p1 one policy
+     * @param p2 another policy
+     * @return true iff policies are compatible
+     */
+    public static boolean compatible(HTTPServerPolicy p1, HTTPServerPolicy p2) {
+        
+        if (p1 == p2 || p1.equals(p2)) {
+            return true;
+        }
+        
+        boolean compatible = true;
+        
+        if (compatible) {
+            compatible &= !p1.isSetCacheControl() || !p2.isSetCacheControl()
+                || p1.getCacheControl().value().equals(p2.getCacheControl().value());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getContentEncoding(), p2.getContentEncoding());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getContentLocation(), p2.getContentLocation());
+        }
+        
+        if (compatible) {
+            compatible &= p1.getContentType().equals(p2.getContentType());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getRedirectURL(), p2.getRedirectURL());
+        }
+        
+        if (compatible) {
+            compatible &= compatible(p1.getServerType(), p2.getServerType());
+        }
+        
+        if (compatible) {
+            compatible &= p1.isHonorKeepAlive() == p2.isHonorKeepAlive();
+        }
+        
+        if (compatible) {
+            compatible &= p1.isSuppressClientReceiveErrors() == p2.isSuppressClientReceiveErrors();
+        }
+        
+        if (compatible) {
+            compatible &= p1.isSuppressClientSendErrors() == p2.isSuppressClientSendErrors();
+        }
+        
+        return compatible;
+    }
+    
+    /**
+     * Returns a new HTTPServerPolicy which is compatible with the two specified policies or
+     * null if no compatible policy can be determined.
+     * @param p1 one policy
+     * @param p2 another policy
+     * @return the compatible policy
+     */
+    public static HTTPServerPolicy intersect(HTTPServerPolicy p1, HTTPServerPolicy p2) {
+                
+        if (!compatible(p1, p2)) {
+            return null;
+        }
+        
+        HTTPServerPolicy p = new HTTPServerPolicy();
+        if (p1.isSetCacheControl()) {
+            p.setCacheControl(p1.getCacheControl());
+        } else if (p2.isSetCacheControl()) {
+            p.setCacheControl(p2.getCacheControl());
+        }
+        p.setContentEncoding(combine(p1.getContentEncoding(), p2.getContentEncoding()));
+        p.setContentLocation(combine(p1.getContentLocation(), p2.getContentLocation()));
+        if (p1.isSetContentType()) {
+            p.setContentType(p1.getContentType());
+        } else if (p2.isSetContentType()) {
+            p.setContentType(p2.getContentType());
+        }     
+        if (p1.isSetHonorKeepAlive()) {
+            p.setHonorKeepAlive(p1.isHonorKeepAlive());
+        } else if (p2.isSetHonorKeepAlive()) {
+            p.setHonorKeepAlive(p2.isHonorKeepAlive());
+        } 
+        if (p1.isSetReceiveTimeout() || p2.isSetReceiveTimeout()) {
+            p.setReceiveTimeout(Math.min(p1.getReceiveTimeout(), p2.getReceiveTimeout()));
+        }
+        p.setRedirectURL(combine(p1.getRedirectURL(), p2.getRedirectURL()));
+        p.setServerType(combine(p1.getServerType(), p2.getServerType()));
+        if (p1.isSetSuppressClientReceiveErrors()) {
+            p.setSuppressClientReceiveErrors(p1.isSuppressClientReceiveErrors());
+        } else if (p2.isSetSuppressClientReceiveErrors()) {
+            p.setSuppressClientReceiveErrors(p2.isSuppressClientReceiveErrors());
+        }
+        if (p1.isSetSuppressClientSendErrors()) {
+            p.setSuppressClientSendErrors(p1.isSuppressClientSendErrors());
+        } else if (p2.isSetSuppressClientSendErrors()) {
+            p.setSuppressClientSendErrors(p2.isSuppressClientSendErrors());
+        } 
+        
+        return p;
+    }
+    
+    private static String combine(String s1, String s2) {
+        return s1 == null ? s2 : s1;
+    }
+    
+    private static boolean compatible(String s1, String s2) {
+        return s1 == null || s2 == null || s1.equals(s2);
+    }
+}

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/policy/PolicyUtils.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/resources/META-INF/cxf/cxf-extension-http.xml Thu Mar 29 09:50:15 2007
@@ -36,4 +36,8 @@
             </list>
         </property>
     </bean>
+    
+    <bean class="org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder"/>
+    <bean class="org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder"/>
+
 </beans>

Added: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java?view=auto&rev=523766
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java (added)
+++ incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java Thu Mar 29 09:50:15 2007
@@ -0,0 +1,211 @@
+/**
+ * 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.transport.http.policy;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
+import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.policy.AssertionInfo;
+import org.apache.cxf.ws.policy.AssertionInfoMap;
+import org.apache.cxf.ws.policy.EndpointPolicy;
+import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
+import org.apache.neethi.Assertion;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * 
+ */
+public class PolicyUtilsTest extends Assert {
+
+    private IMocksControl control;
+
+    @Before
+    public void setUp() {
+        control = EasyMock.createNiceControl();
+    }
+
+    @Test
+    public void testCompatibleClientPolicies() {
+        HTTPClientPolicy p1 = new HTTPClientPolicy();
+        assertTrue("Policy is not compatible with itself.", PolicyUtils.compatible(p1, p1));
+        HTTPClientPolicy p2 = new HTTPClientPolicy();
+        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setBrowserType("browser");
+        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setBrowserType(null);
+        p1.setConnectionTimeout(10000);
+        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setAllowChunking(false);
+        assertTrue("Policies are compatible.", !PolicyUtils.compatible(p1, p2));
+        p2.setAllowChunking(false);
+        assertTrue("Policies are compatible.", PolicyUtils.compatible(p1, p2));
+    }
+
+    @Test
+    public void testIntersectClientPolicies() {
+        HTTPClientPolicy p1 = new HTTPClientPolicy();
+        HTTPClientPolicy p2 = new HTTPClientPolicy();
+        HTTPClientPolicy p = null;
+
+        p1.setBrowserType("browser");
+        p = PolicyUtils.intersect(p1, p2);
+        assertEquals("browser", p.getBrowserType());
+        p1.setBrowserType(null);
+        p1.setConnectionTimeout(10000L);
+        p = PolicyUtils.intersect(p1, p2);
+        assertEquals(10000L, p.getConnectionTimeout());
+        p1.setAllowChunking(false);
+        p2.setAllowChunking(false);
+        p = PolicyUtils.intersect(p1, p2);
+        assertTrue(!p.isAllowChunking());
+    }
+
+    @Test
+    public void testCompatibleServerPolicies() {
+        HTTPServerPolicy p1 = new HTTPServerPolicy();
+        assertTrue("Policy is not compatible with itself.", PolicyUtils.compatible(p1, p1));
+        HTTPServerPolicy p2 = new HTTPServerPolicy();
+        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setServerType("server");
+        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setServerType(null);
+        p1.setReceiveTimeout(10000);
+        assertTrue("Policies are not compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setSuppressClientSendErrors(false);
+        assertTrue("Policies are compatible.", PolicyUtils.compatible(p1, p2));
+        p1.setSuppressClientSendErrors(true);
+        assertTrue("Policies are compatible.", !PolicyUtils.compatible(p1, p2));
+        p2.setSuppressClientSendErrors(true);
+        assertTrue("Policies are compatible.", PolicyUtils.compatible(p1, p2));
+    }
+
+    @Test
+    public void testIntersectServerPolicies() {
+        HTTPServerPolicy p1 = new HTTPServerPolicy();
+        HTTPServerPolicy p2 = new HTTPServerPolicy();
+        HTTPServerPolicy p = null;
+
+        p1.setServerType("server");
+        p = PolicyUtils.intersect(p1, p2);
+        assertEquals("server", p.getServerType());
+        p1.setServerType(null);
+        p1.setReceiveTimeout(10000L);
+        p = PolicyUtils.intersect(p1, p2);
+        assertEquals(10000L, p.getReceiveTimeout());
+        p1.setSuppressClientSendErrors(true);
+        p2.setSuppressClientSendErrors(true);
+        p = PolicyUtils.intersect(p1, p2);
+        assertTrue(p.isSuppressClientSendErrors());
+    }
+
+    @Test
+    public void testAssertClientPolicyNoop() {
+        Message message = control.createMock(Message.class);
+        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(null);
+        control.replay();
+        PolicyUtils.assertClientPolicy(null, message);
+        control.verify();
+
+        control.reset();
+        Collection<Assertion> as = new ArrayList<Assertion>();
+        AssertionInfoMap aim = new AssertionInfoMap(as);
+        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim);
+        control.replay();
+        PolicyUtils.assertClientPolicy(null, message);
+        control.verify();
+    }
+
+    @Test
+    public void testAssertClientPolicyOutbound() {
+        testAssertClientPolicy(true);
+    }
+
+    @Test
+    public void testAssertClientPolicyInbound() {
+        testAssertClientPolicy(false);
+    }
+
+    void testAssertClientPolicy(boolean outbound) {
+        Message message = control.createMock(Message.class);
+        PolicyEngine pe = control.createMock(PolicyEngine.class);
+        HTTPClientPolicy ep = new HTTPClientPolicy();
+        HTTPClientPolicy cmp = new HTTPClientPolicy();
+        cmp.setConnectionTimeout(60000L);
+        HTTPClientPolicy icmp = new HTTPClientPolicy();
+        icmp.setAllowChunking(false);
+
+        JaxbAssertion<HTTPClientPolicy> ea = 
+            new JaxbAssertion<HTTPClientPolicy>(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME, false);
+        ea.setData(ep);
+        JaxbAssertion<HTTPClientPolicy> cma = 
+            new JaxbAssertion<HTTPClientPolicy>(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME, false);
+        cma.setData(cmp);
+        JaxbAssertion<HTTPClientPolicy> icma = 
+            new JaxbAssertion<HTTPClientPolicy>(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME, false);
+        icma.setData(icmp);
+
+        AssertionInfo eai = new AssertionInfo(ea);
+        AssertionInfo cmai = new AssertionInfo(cma);
+        AssertionInfo icmai = new AssertionInfo(icma);
+
+        AssertionInfoMap aim = new AssertionInfoMap(CastUtils.cast(Collections.EMPTY_LIST, Assertion.class));
+        Collection<AssertionInfo> ais = new ArrayList<AssertionInfo>();
+        ais.add(eai);
+        ais.add(cmai);
+        ais.add(icmai);
+        aim.put(PolicyUtils.HTTPCLIENTPOLICY_ASSERTION_QNAME, ais);
+        EasyMock.expect(message.get(AssertionInfoMap.class)).andReturn(aim);
+        Exchange ex = control.createMock(Exchange.class);
+        EasyMock.expect(message.getExchange()).andReturn(ex).times(outbound ? 2 : 1);
+        EasyMock.expect(ex.getOutMessage()).andReturn(outbound ? message : null);
+        if (!outbound) {
+            EasyMock.expect(ex.getOutFaultMessage()).andReturn(null);
+        } else {
+            Endpoint e = control.createMock(Endpoint.class);
+            EasyMock.expect(ex.get(Endpoint.class)).andReturn(e);
+            EndpointInfo ei = control.createMock(EndpointInfo.class);
+            EasyMock.expect(e.getEndpointInfo()).andReturn(ei);
+            EndpointPolicy endpointPolicy = control.createMock(EndpointPolicy.class);
+            EasyMock.expect(pe.getClientEndpointPolicy(ei, null)).andReturn(endpointPolicy);
+            Collection<Assertion> alt = CastUtils.cast(Collections.singleton(ea), Assertion.class);
+            EasyMock.expect(endpointPolicy.getChosenAlternative()).andReturn(alt);
+        }
+
+        control.replay();
+        PolicyUtils.assertClientPolicy(pe, message);
+        assertTrue(eai.isAsserted());
+        assertTrue(cmai.isAsserted());
+        assertTrue(outbound ? !icmai.isAsserted() : icmai.isAsserted());
+        control.verify();
+    }
+}

Propchange: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/transports/http/src/test/java/org/apache/cxf/transport/http/policy/PolicyUtilsTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInFaultInterceptor.java Thu Mar 29 09:50:15 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
@@ -47,7 +48,7 @@
     }
     
     public void handleMessage(Message msg) {        
-        if (!PolicyUtils.isRequestor(msg)) {
+        if (!MessageUtils.isRequestor(msg)) {
             LOG.fine("Not a requestor.");
             return;
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyInInterceptor.java Thu Mar 29 09:50:15 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
@@ -47,7 +48,7 @@
     }
     
     public void handleMessage(Message msg) {        
-        if (!PolicyUtils.isRequestor(msg)) {
+        if (!MessageUtils.isRequestor(msg)) {
             LOG.fine("Not a requestor.");
             return;
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ClientPolicyOutInterceptor.java Thu Mar 29 09:50:15 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -48,7 +49,7 @@
     }
     
     public void handleMessage(Message msg) {
-        if (!PolicyUtils.isRequestor(msg)) {
+        if (!MessageUtils.isRequestor(msg)) {
             LOG.fine("Not a requestor.");
             return;
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyUtils.java Thu Mar 29 09:50:15 2007
@@ -25,7 +25,6 @@
 import java.util.logging.Logger;
 
 import org.apache.cxf.helpers.CastUtils;
-import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.policy.builder.primitive.NestedPrimitiveAssertion;
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Constants;
@@ -40,28 +39,7 @@
     private static final String INDENT = "  ";
     
     private PolicyUtils() {
-    }
-
-    /**
-     * Determine if current messaging role is that of requestor.
-     * 
-     * @param message the current Message
-     * @return true iff the current messaging role is that of requestor
-     */
-    public static boolean isRequestor(Message message) {
-        Boolean requestor = (Boolean)message.get(Message.REQUESTOR_ROLE);
-        return requestor != null && requestor.booleanValue();
-    }
-    
-    /**
-     * Determine if the current message is a partial response.
-     * 
-     * @param message the current message
-     * @return true iff the current messags is a partial response
-     */
-    public static boolean isPartialResponse(Message message) {
-        return Boolean.TRUE.equals(message.get(Message.PARTIAL_RESPONSE_MESSAGE));
-    }
+    }  
     
     /**
      * Determine if a collection of assertions contains a given assertion, using

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInFaultInterceptor.java Thu Mar 29 09:50:15 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -50,7 +51,7 @@
      */
     public void handleMessage(Message message) throws Fault {
         
-        if (!PolicyUtils.isRequestor(message)) {
+        if (!MessageUtils.isRequestor(message)) {
             return; 
         }
         

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationInInterceptor.java Thu Mar 29 09:50:15 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -74,13 +75,13 @@
             return;
         }
         
-        if (PolicyUtils.isPartialResponse(message)) {
+        if (MessageUtils.isPartialResponse(message)) {
             LOG.fine("Not verifying policies on inbound partial response.");
             return;
         }
         
         EffectivePolicy effectivePolicy = null;
-        if (PolicyUtils.isRequestor(message)) {
+        if (MessageUtils.isRequestor(message)) {
             effectivePolicy = pe.getEffectiveClientResponsePolicy(ei, boi);
         } else {
             effectivePolicy = pe.getEffectiveServerRequestPolicy(ei, boi);

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyVerificationOutInterceptor.java Thu Mar 29 09:50:15 2007
@@ -27,6 +27,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 
 /**
@@ -52,7 +53,7 @@
      */
     public void handleMessage(Message message) throws Fault {
         
-        if (PolicyUtils.isPartialResponse(message)) {
+        if (MessageUtils.isPartialResponse(message)) {
             LOG.fine("Not verifying policies on outbound partial response.");
             return;
         } 

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyInInterceptor.java Thu Mar 29 09:50:15 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
@@ -47,7 +48,7 @@
     }
     
     public void handleMessage(Message msg) {        
-        if (PolicyUtils.isRequestor(msg)) {
+        if (MessageUtils.isRequestor(msg)) {
             LOG.fine("Is a requestor.");
             return;
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutFaultInterceptor.java Thu Mar 29 09:50:15 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingFaultInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
@@ -49,7 +50,7 @@
     }
        
     public void handleMessage(Message msg) {        
-        if (PolicyUtils.isRequestor(msg)) {
+        if (MessageUtils.isRequestor(msg)) {
             LOG.fine("Is a requestor.");
             return;
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ServerPolicyOutInterceptor.java Thu Mar 29 09:50:15 2007
@@ -29,6 +29,7 @@
 import org.apache.cxf.interceptor.Interceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -48,7 +49,7 @@
     }
     
     public void handleMessage(Message msg) {        
-        if (PolicyUtils.isRequestor(msg)) {
+        if (MessageUtils.isRequestor(msg)) {
             LOG.fine("Is a requestor.");
             return;
         }

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMContextUtils.java Thu Mar 29 09:50:15 2007
@@ -19,10 +19,8 @@
 
 package org.apache.cxf.ws.rm;
 
-import java.util.List;
-
-import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
 import org.apache.cxf.ws.addressing.VersionTransformer;
@@ -47,26 +45,6 @@
     }
 
     /**
-     * Determine if message is outbound.
-     * 
-     * @param message the current Message
-     * @return true iff the message direction is outbound
-     */
-    public static boolean isOutbound(Message message) {
-        return org.apache.cxf.ws.addressing.ContextUtils.isOutbound(message);
-    }
-
-    /**
-     * Determine if current messaging role is that of requestor.
-     * 
-     * @param message the current Message
-     * @return true iff the current messaging role is that of requestor
-     */
-    public static boolean isRequestor(Message message) {
-        return org.apache.cxf.ws.addressing.ContextUtils.isRequestor(message);
-    }
-
-    /**
      * Determine if message is currently being processed on server side.
      * 
      * @param message the current Message
@@ -77,18 +55,6 @@
     }
 
     /**
-     * Checks if the message is a partial response to a oneway request.
-     * 
-     * @param message the message
-     * @return true iff the message is a partial response to a oneway request
-     */
-    public static boolean isPartialResponse(Message message) {
-        return RMContextUtils.isOutbound(message) 
-            && message.getContent(List.class) == null
-            && getException(message.getExchange()) == null; 
-    }
-
-    /**
      * Checks if the action String belongs to an application message.
      * 
      * @param action the action
@@ -118,7 +84,7 @@
             return (RMProperties)message.get(getRMPropertiesKey(true));
         } else {
             Message m = null;
-            if (isOutbound(message)) {
+            if (MessageUtils.isOutbound(message)) {
                 // the in properties are only available on the in message
                 m = message.getExchange().getInMessage();
                 if (null == m) {
@@ -189,14 +155,5 @@
     private static String getRMPropertiesKey(boolean outbound) {
         return outbound
             ? RMMessageConstants.RM_PROPERTIES_OUTBOUND : RMMessageConstants.RM_PROPERTIES_INBOUND;
-    }
-    
-    private static Exception getException(Exchange exchange) {
-        if (exchange.getOutFaultMessage() != null) {
-            return exchange.getOutFaultMessage().getContent(Exception.class);
-        } else if (exchange.getInFaultMessage() != null) {
-            return exchange.getInFaultMessage().getContent(Exception.class);
-        }
-        return null;
     }
 }

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/RMEndpoint.java Thu Mar 29 09:50:15 2007
@@ -243,12 +243,14 @@
     }
     
     void setPolicies() {
-        
-        EndpointInfo ei = getEndpoint().getEndpointInfo();
-        
         // use same WS-policies as for application endpoint
+        PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);  
+        if (null == engine) {
+            return;
+        }
         
-        PolicyEngine engine = manager.getBus().getExtension(PolicyEngine.class);
+        EndpointInfo ei = getEndpoint().getEndpointInfo();
+                
         PolicyInterceptorProviderRegistry reg = 
             manager.getBus().getExtension(PolicyInterceptorProviderRegistry.class);
         EndpointPolicy ep = null == conduit

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=523766&r1=523765&r2=523766
==============================================================================
--- 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 Thu Mar 29 09:50:15 2007
@@ -26,6 +26,7 @@
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.MAPAggregator;
 import org.apache.cxf.ws.addressing.VersionTransformer;
@@ -62,7 +63,7 @@
         }
 
         boolean isApplicationMessage = RMContextUtils.isAplicationMessage(action);
-        boolean isPartialResponse = RMContextUtils.isPartialResponse(message);
+        boolean isPartialResponse = MessageUtils.isPartialResponse(message);
         LOG.fine("isApplicationMessage: " + isApplicationMessage);
         LOG.fine("isPartialResponse: " + isPartialResponse);
         
@@ -123,7 +124,7 @@
                 }
             }
         } else {
-            if (!RMContextUtils.isRequestor(message)
+            if (!MessageUtils.isRequestor(message)
                 && RMConstants.getCreateSequenceAction().equals(action)) {
                 maps.getAction().setValue(RMConstants.getCreateSequenceResponseAction());
             }

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RMSoapInterceptor.java Thu Mar 29 09:50:15 2007
@@ -36,6 +36,7 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPException;
 
+
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -54,6 +55,7 @@
 import org.apache.cxf.interceptor.WrappedInInterceptor;
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptor;
 import org.apache.cxf.service.Service;
@@ -147,7 +149,7 @@
      */ 
 
     void mediate(SoapMessage message) {
-        if (RMContextUtils.isOutbound(message)) {
+        if (MessageUtils.isOutbound(message)) {
             encode(message);
         } else {
             decode(message);
@@ -396,8 +398,7 @@
      * @param message the message
      */
     private void updateServiceModelInfo(SoapMessage message) {
-        
-        assert !RMContextUtils.isOutbound(message);
+
         AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
         AttributedURIType actionURI = null == maps ? null : maps.getAction();
         String action = null == actionURI ? null : actionURI.getValue().trim();

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/soap/RetransmissionQueueImpl.java Thu Mar 29 09:50:15 2007
@@ -41,6 +41,7 @@
 import org.apache.cxf.io.AbstractCachedOutputStream;
 import org.apache.cxf.io.CachedOutputStreamCallback;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageUtils;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.ws.policy.AssertionInfo;
 import org.apache.cxf.ws.policy.builder.jaxb.JaxbAssertion;
@@ -486,7 +487,7 @@
                     // TODO: remove previously added acknowledgments and update
                     // message id (to avoid duplicates)
 
-                    if (RMContextUtils.isRequestor(message)) {
+                    if (MessageUtils.isRequestor(message)) {
                         clientResend(message);
                     } else {
                         serverResend(message);

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMContextUtilsTest.java Thu Mar 29 09:50:15 2007
@@ -19,8 +19,6 @@
 
 package org.apache.cxf.ws.rm;
 
-import java.util.List;
-
 import org.apache.cxf.message.Exchange;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.addressing.AddressingProperties;
@@ -63,25 +61,6 @@
     }
     
     @Test
-    public void testIsOutbound() {
-        Message msg = control.createMock(Message.class); 
-        Exchange ex = control.createMock(Exchange.class);
-        EasyMock.expect(msg.getExchange()).andReturn(ex);
-        EasyMock.expect(ex.getOutMessage()).andReturn(null);
-        EasyMock.expect(ex.getOutFaultMessage()).andReturn(null);
-        control.replay();
-        assertTrue(!RMContextUtils.isOutbound(msg));
-    }
-    
-    @Test
-    public void testIsRequestor() {
-        Message msg = control.createMock(Message.class); 
-        EasyMock.expect(msg.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE);
-        control.replay();
-        assertTrue(RMContextUtils.isRequestor(msg));
-    }
-    
-    @Test
     public void testIsServerSide() {
         Message msg = control.createMock(Message.class); 
         Exchange ex = control.createMock(Exchange.class);
@@ -89,19 +68,6 @@
         EasyMock.expect(ex.getDestination()).andReturn(null);
         control.replay();
         assertTrue(!RMContextUtils.isServerSide(msg));
-    }
-    
-    @Test
-    public void testIsPartialResponse() {
-        Message msg = control.createMock(Message.class); 
-        Exchange ex = control.createMock(Exchange.class);
-        EasyMock.expect(msg.getExchange()).andReturn(ex).times(2);
-        EasyMock.expect(ex.getOutMessage()).andReturn(msg);
-        EasyMock.expect(msg.getContent(List.class)).andReturn(null);
-        EasyMock.expect(ex.getOutFaultMessage()).andReturn(null);
-        EasyMock.expect(ex.getInFaultMessage()).andReturn(null);
-        control.replay();
-        assertTrue(RMContextUtils.isPartialResponse(msg));
     }
     
     @Test

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMEndpointTest.java Thu Mar 29 09:50:15 2007
@@ -197,6 +197,15 @@
     }
     
     @Test
+    public void testSetPoliciesNoEngine() {
+        Bus bus = control.createMock(Bus.class);
+        EasyMock.expect(manager.getBus()).andReturn(bus);
+        EasyMock.expect(bus.getExtension(PolicyEngine.class)).andReturn(null);
+        control.replay();
+        rme.setPolicies();   
+    }
+    
+    @Test
     public void testSetPolicies() throws NoSuchMethodException {
         Method m = RMEndpoint.class.getDeclaredMethod("getEndpoint", new Class[] {});
         rme = control.createMock(RMEndpoint.class, new Method[] {m});

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java?view=diff&rev=523766&r1=523765&r2=523766
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java Thu Mar 29 09:50:15 2007
@@ -23,7 +23,6 @@
 import java.math.BigInteger;
 import java.util.Collections;
 import java.util.Iterator;
-import java.util.List;
 
 import org.apache.cxf.interceptor.InterceptorChain;
 import org.apache.cxf.message.Exchange;
@@ -81,15 +80,13 @@
         
         Message message = control.createMock(Message.class);
         Exchange ex = control.createMock(Exchange.class);
-        EasyMock.expect(message.getExchange()).andReturn(ex).times(2);
-        EasyMock.expect(ex.getOutMessage()).andReturn(message);
-        EasyMock.expect(message.getContent(List.class)).andReturn(Collections.singletonList("CXF"));        
+        EasyMock.expect(message.getExchange()).andReturn(ex).times(3);
+        EasyMock.expect(ex.getOutMessage()).andReturn(message).times(1);       
         EasyMock.expect(message.get(Message.REQUESTOR_ROLE)).andReturn(Boolean.TRUE).anyTimes();        
         EasyMock.expect(message.get(JAXWSAConstants.CLIENT_ADDRESSING_PROPERTIES_OUTBOUND))
             .andReturn(maps).anyTimes();
         RMProperties rmpsOut = new RMProperties();
         EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_OUTBOUND)).andReturn(rmpsOut);
-        EasyMock.expect(message.get(RMMessageConstants.RM_PROPERTIES_INBOUND)).andReturn(null);
         InterceptorChain chain = control.createMock(InterceptorChain.class);
         EasyMock.expect(message.getInterceptorChain()).andReturn(chain);
         chain.add(EasyMock.isA(RetransmissionInterceptor.class));



Mime
View raw message