cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andreasm...@apache.org
Subject svn commit: r556609 - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/ api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ api/src/main/java/org/apache/cxf/ws/policy/builder/xml/ rt/ws/addr/src/main/java/org/apache/cxf/ws/...
Date Mon, 16 Jul 2007 12:56:09 GMT
Author: andreasmyth
Date: Mon Jul 16 05:56:03 2007
New Revision: 556609

URL: http://svn.apache.org/viewvc?view=rev&rev=556609
Log:
[JIRA CXF-797] PolicyConstants are now a bus extension, allowing namespace to be configured.

Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalDocumentReferenceResolver.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java
    incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
    incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
    incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
    incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/PolicyConstants.java Mon Jul 16 05:56:03 2007
@@ -21,10 +21,12 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.extension.BusExtension;
+
 /**
  * Encapsulation of version-specific WS-Policy constants.
  */
-public final class PolicyConstants {
+public final class PolicyConstants implements BusExtension {
     
     public static final String NAMESPACE_XMLSOAP_200409
         = "http://schemas.xmlsoap.org/ws/2004/09/policy";
@@ -102,113 +104,111 @@
     private static final QName WSU_ID_ATTR_QNAME =
         new QName(WSU_NAMESPACE_URI, WSU_ID_ATTR_NAME);
     
-    static {
+    
+    public PolicyConstants() {
         setNamespace(NAMESPACE_W3_200607);
     }
     
-    /**
-     * Prevents instantiation.
-     */
-    
-    private PolicyConstants() {
+    public Class<?> getRegistrationType() {
+        return PolicyConstants.class;
     }
-    
-    
-    
-    public static String getNamespace() {
+
+    public void setNamespace(String uri) {
+        namespaceURI = uri;
+        
+        // update qnames
+        
+        policyElemQName = new QName(namespaceURI, POLICY_ELEM_NAME);
+        allElemQName = new QName(namespaceURI, ALL_ELEM_NAME);
+        exactlyOneElemQName = new QName(namespaceURI, EXACTLYONE_ELEM_NAME);
+        policyReferenceElemQName = new QName(namespaceURI, POLICYREFERENCE_ELEM_NAME);
+        policyAttachmentElemQName = new QName(namespaceURI, POLICYATTACHMENT_ELEM_NAME);
+        appliesToElemQName = new QName(namespaceURI, APPLIESTO_ELEM_NAME);
+        optionalAttrQName = new QName(namespaceURI, OPTIONAL_ATTR_NAME);
+        policyURIsAttrQName = new QName(namespaceURI, POLICYURIS_ATTR_NAME);
+        
+    }
+  
+    public String getNamespace() {
         return namespaceURI;
     } 
     
-    public static String getWSUNamespace() {
+    public String getWSUNamespace() {
         return WSU_NAMESPACE_URI;
     }
     
-    public static String getPolicyElemName() {
+    public String getPolicyElemName() {
         return POLICY_ELEM_NAME;
     }
     
-    public static String getAllElemName() {
+    public String getAllElemName() {
         return ALL_ELEM_NAME;
     }
     
-    public static String getExactlyOneElemName() {
+    public String getExactlyOneElemName() {
         return EXACTLYONE_ELEM_NAME;
     }
     
-    public static String getPolicyReferenceElemName() {
+    public String getPolicyReferenceElemName() {
         return POLICYREFERENCE_ELEM_NAME;
     }
     
-    public static String getPolicyAttachmentElemName() {
+    public String getPolicyAttachmentElemName() {
         return POLICYATTACHMENT_ELEM_NAME;
     }
     
-    public static String getAppliesToElemName() {
+    public String getAppliesToElemName() {
         return APPLIESTO_ELEM_NAME;
     }
     
-    public static String getOptionalAttrName() {
+    public String getOptionalAttrName() {
         return OPTIONAL_ATTR_NAME;
     }
     
-    public static String getPolicyURIsAttrName() {
+    public String getPolicyURIsAttrName() {
         return POLICYURIS_ATTR_NAME;
     }
     
-    public static String getIdAttrName() {
+    public String getIdAttrName() {
         return WSU_ID_ATTR_NAME;
     }
     
-    public static QName getPolicyElemQName() {
+    public QName getPolicyElemQName() {
         return policyElemQName;
     }
     
-    public static QName getAllElemQName() {
+    public QName getAllElemQName() {
         return allElemQName;
     }
     
-    public static QName getExactlyOneElemQName() {
+    public QName getExactlyOneElemQName() {
         return exactlyOneElemQName;
     }
     
-    public static QName getPolicyReferenceElemQName() {
+    public QName getPolicyReferenceElemQName() {
         return policyReferenceElemQName;
     }
     
-    public static QName getPolicyAttachmentElemQName() {
+    public QName getPolicyAttachmentElemQName() {
         return policyAttachmentElemQName;
     }
     
-    public static QName getAppliesToElemQName() {
+    public QName getAppliesToElemQName() {
         return appliesToElemQName;
     }
     
-    public static QName getOptionalAttrQName() {
+    public QName getOptionalAttrQName() {
         return optionalAttrQName;
     }
     
-    public static QName getPolicyURIsAttrQName() {
+    public QName getPolicyURIsAttrQName() {
         return policyURIsAttrQName;
     }
     
-    public static QName getIdAttrQName() {
+    public QName getIdAttrQName() {
         return WSU_ID_ATTR_QNAME;
     } 
     
     
-    public static void setNamespace(String uri) {
-        namespaceURI = uri;
-        
-        // update qnames
-        
-        policyElemQName = new QName(namespaceURI, POLICY_ELEM_NAME);
-        allElemQName = new QName(namespaceURI, ALL_ELEM_NAME);
-        exactlyOneElemQName = new QName(namespaceURI, EXACTLYONE_ELEM_NAME);
-        policyReferenceElemQName = new QName(namespaceURI, POLICYREFERENCE_ELEM_NAME);
-        policyAttachmentElemQName = new QName(namespaceURI, POLICYATTACHMENT_ELEM_NAME);
-        appliesToElemQName = new QName(namespaceURI, APPLIESTO_ELEM_NAME);
-        optionalAttrQName = new QName(namespaceURI, OPTIONAL_ATTR_NAME);
-        policyURIsAttrQName = new QName(namespaceURI, POLICYURIS_ATTR_NAME);
-        
-    }
+   
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertion.java Mon Jul 16 05:56:03 2007
@@ -54,8 +54,8 @@
         super(name, optional);
     }
     
-    public NestedPrimitiveAssertion(Element elem, PolicyBuilder builder) {
-        super(elem);
+    public NestedPrimitiveAssertion(Element elem, PolicyBuilder builder, PolicyConstants constants) {
+        super(elem, constants);
         
         // expect exactly one child element of type Policy
        
@@ -63,18 +63,18 @@
         for (Node nd = elem.getFirstChild(); nd != null; nd = nd.getNextSibling()) {
             if (Node.ELEMENT_NODE == nd.getNodeType()) {
                 QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
-                if (PolicyConstants.getPolicyElemQName().equals(qn)
+                if (constants.getPolicyElemQName().equals(qn)
                     && null == policyElem) {
                     policyElem = (Element)nd;
                 } else {
                     throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
-                                                          PolicyConstants.getPolicyElemQName()));
+                                                          constants.getPolicyElemQName()));
                 }                
             }
         }
         if (null == policyElem) {
             throw new PolicyException(new Message("UNEXPECTED_CHILD_ELEMENT_EXC", BUNDLE, 
-                                                  PolicyConstants.getPolicyElemQName()));
+                                                  constants.getPolicyElemQName()));
         }
         
         nested = builder.getPolicy(policyElem);  

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionBuilder.java Mon Jul 16 05:56:03 2007
@@ -28,21 +28,21 @@
 import org.apache.neethi.Policy;
 
 public class NestedPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {
-
-    private PolicyBuilder builder;
+    
+    private PolicyBuilder builder;    
     private AssertionBuilderRegistry assertionBuilderRegistry;
     
     public void setPolicyBuilder(PolicyBuilder b) {
         builder = b;
     }
-    
+        
     public void setAssertionBuilderRegistry(AssertionBuilderRegistry abr) {
         assertionBuilderRegistry = abr;
     }
     
     @Override
     public Assertion build(Element elem) {
-        return new NestedPrimitiveAssertion(elem, builder); 
+        return new NestedPrimitiveAssertion(elem, builder, getPolicyConstants()); 
     }
 
     @Override

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java Mon Jul 16 05:56:03 2007
@@ -55,10 +55,10 @@
         optional = o;
     }
     
-    public PrimitiveAssertion(Element element) {
+    public PrimitiveAssertion(Element element, PolicyConstants constants) {
         name = new QName(element.getNamespaceURI(), element.getLocalName());
-        Attr attribute = element.getAttributeNodeNS(PolicyConstants.getNamespace(), 
-                                              PolicyConstants.getOptionalAttrName());
+        Attr attribute = element.getAttributeNodeNS(constants.getNamespace(), 
+                                                    constants.getOptionalAttrName());
         if (attribute != null) {
             optional = Boolean.valueOf(attribute.getValue());
         }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertionBuilder.java Mon Jul 16 05:56:03 2007
@@ -24,17 +24,25 @@
 
 import javax.xml.namespace.QName;
 
+
 import org.w3c.dom.Element;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.AssertionBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.neethi.Assertion;
 
 public class PrimitiveAssertionBuilder implements AssertionBuilder {
 
+    protected Bus bus;
     private Collection<QName> knownElements = new ArrayList<QName>();
     
-    public Assertion build(Element element) {
-        return new PrimitiveAssertion(element);
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    public Assertion build(Element element) {  
+        return new PrimitiveAssertion(element, getPolicyConstants());
     }
 
     public Collection<QName> getKnownElements() {
@@ -55,4 +63,16 @@
         }
         return  null;
     }   
+    
+    protected PolicyConstants getPolicyConstants() {
+        PolicyConstants constants = null;
+        if (null != bus) {
+            constants = bus.getExtension(PolicyConstants.class);
+        }
+        if (null == constants) {
+            constants = new PolicyConstants();
+        }
+        return constants;
+        
+    }
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XMLPrimitiveAssertionBuilder.java Mon Jul 16 05:56:03 2007
@@ -27,6 +27,6 @@
 public class XMLPrimitiveAssertionBuilder extends PrimitiveAssertionBuilder {
  
     public Assertion build(Element element) {
-        return new XmlPrimitiveAssertion(element);
+        return new XmlPrimitiveAssertion(element, getPolicyConstants());
     }
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/xml/XmlPrimitiveAssertion.java Mon Jul 16 05:56:03 2007
@@ -34,15 +34,17 @@
 public class XmlPrimitiveAssertion extends PrimitiveAssertion {
 
     private Element element;
+    private PolicyConstants constants;
 
     /**
      * Constructs a XmlPrimitiveAssertion from an xml element.
      * 
      * @param e the xml element
      */
-    public XmlPrimitiveAssertion(Element e) {
-        super(e);
+    public XmlPrimitiveAssertion(Element e, PolicyConstants c) {
+        super(e, c);
         element = e;
+        constants = c;
     }
 
     /**
@@ -66,9 +68,9 @@
     protected Assertion cloneMandatory() {
         Element e = (Element)element.cloneNode(true);
         if (isOptional()) {
-            e.removeAttributeNode(e.getAttributeNodeNS(PolicyConstants.getNamespace(), 
-                                                   PolicyConstants.getOptionalAttrName()));
+            e.removeAttributeNode(e.getAttributeNodeNS(constants.getNamespace(), 
+                                                       constants.getOptionalAttrName()));
         }
-        return new XmlPrimitiveAssertion(e);        
+        return new XmlPrimitiveAssertion(e, constants);        
     }
 }

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/policy/AddressingAssertionBuilder.java Mon Jul 16 05:56:03 2007
@@ -63,14 +63,15 @@
         QName qn = new QName(elem.getNamespaceURI(), localName);
         
         boolean optional = false;
-        Attr attribute = elem.getAttributeNodeNS(PolicyConstants.getNamespace(), 
-                                              PolicyConstants.getOptionalAttrName());
+        PolicyConstants constants = bus.getExtension(PolicyConstants.class);
+        Attr attribute = elem.getAttributeNodeNS(constants.getNamespace(), 
+                                                 constants.getOptionalAttrName());
         if (attribute != null) {
             optional = Boolean.valueOf(attribute.getValue());
         }
         if (MetadataConstants.ADDRESSING_ASSERTION_QNAME.equals(qn)) {
             PolicyBuilder builder = bus.getExtension(PolicyBuilder.class);
-            return new NestedPrimitiveAssertion(elem, builder);
+            return new NestedPrimitiveAssertion(elem, builder, constants);
         } else if (MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME.equals(qn)) {
             return new PrimitiveAssertion(MetadataConstants.ANON_RESPONSES_ASSERTION_QNAME, 
                                           optional);

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/AbstractPolicyProvider.java Mon Jul 16 05:56:03 2007
@@ -27,6 +27,7 @@
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.ws.policy.PolicyException;
 import org.apache.cxf.ws.policy.PolicyProvider;
@@ -73,7 +74,8 @@
     }
     
     protected Policy resolveExternal(PolicyReference ref,  String baseURI) {
-        ReferenceResolver resolver = new RemoteReferenceResolver(baseURI, builder);
+        ReferenceResolver resolver = new RemoteReferenceResolver(baseURI, builder,
+            bus.getExtension(PolicyConstants.class));
         Policy resolved = registry.lookup(ref.getURI());
         if (null != resolved) {
             return resolved;

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/external/ExternalAttachmentProvider.java Mon Jul 16 05:56:03 2007
@@ -156,8 +156,16 @@
         } catch (Exception ex) {
             throw new PolicyException(ex);
         }
-        NodeList nl = doc.getElementsByTagNameNS(PolicyConstants.getNamespace(), 
-                                                 PolicyConstants.getPolicyAttachmentElemName());
+        
+        PolicyConstants constants = null;
+        if (null != bus) {
+            constants = bus.getExtension(PolicyConstants.class);
+        }
+        if (null == constants) {
+            constants = new PolicyConstants();
+        }
+        NodeList nl = doc.getElementsByTagNameNS(constants.getNamespace(), 
+                                                 constants.getPolicyAttachmentElemName());
         for (int i = 0; i < nl.getLength(); i++) {
             
             PolicyAttachment attachment = new PolicyAttachment();
@@ -169,20 +177,20 @@
                     continue;
                 }
                 QName qn = new QName(nd.getNamespaceURI(), nd.getLocalName());
-                if (PolicyConstants.getAppliesToElemQName().equals(qn)) {
+                if (constants.getAppliesToElemQName().equals(qn)) {
                     Collection<DomainExpression> des = readDomainExpressions((Element)nd);
                     if (des.isEmpty()) {
                         // forget about this attachment
                         continue;
                     }
                     attachment.setDomainExpressions(des);                    
-                } else if (PolicyConstants.getPolicyElemQName().equals(qn)) {
+                } else if (constants.getPolicyElemQName().equals(qn)) {
                     Policy p = builder.getPolicy((Element)nd);
                     if (null != attachment.getPolicy()) {
                         p = p.merge(attachment.getPolicy());
                     }
                     attachment.setPolicy(p);
-                } else if (PolicyConstants.getPolicyReferenceElemQName().equals(qn)) {
+                } else if (constants.getPolicyReferenceElemQName().equals(qn)) {
                     PolicyReference ref = builder.getPolicyReference((Element)nd);
                     if (null != ref) {   
                         Policy p = resolveReference(ref, doc);
@@ -220,7 +228,8 @@
         if (null != resolved) {
             return resolved;
         }
-        ReferenceResolver resolver = new LocalDocumentReferenceResolver(doc, builder);
+        ReferenceResolver resolver = new LocalDocumentReferenceResolver(doc, builder, 
+            bus.getExtension(PolicyConstants.class));
         resolved = resolver.resolveReference(relativeURI);
         if (null != resolved) {
             ref.setURI(absoluteURI);

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalDocumentReferenceResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalDocumentReferenceResolver.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalDocumentReferenceResolver.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalDocumentReferenceResolver.java Mon Jul 16 05:56:03 2007
@@ -34,20 +34,22 @@
 
     private Document document;
     private PolicyBuilder builder;
+    private PolicyConstants constants;
     
-    public LocalDocumentReferenceResolver(Document di, PolicyBuilder b) {
+    public LocalDocumentReferenceResolver(Document di, PolicyBuilder b, PolicyConstants c) {
         document = di;
         builder = b;
+        constants = c;
     }
     
     public Policy resolveReference(String uri) {
-        NodeList nl = document.getElementsByTagNameNS(PolicyConstants.getNamespace(),
-                                                      PolicyConstants.getPolicyElemName());
+        NodeList nl = document.getElementsByTagNameNS(constants.getNamespace(),
+                                                      constants.getPolicyElemName());
         
         for (int i = 0; i < nl.getLength(); i++) {
             Element e = (Element)nl.item(i);
-            if (uri.equals(e.getAttributeNS(PolicyConstants.getWSUNamespace(),
-                                                            PolicyConstants.getIdAttrName()))) {
+            if (uri.equals(e.getAttributeNS(constants.getWSUNamespace(),
+                                            constants.getIdAttrName()))) {
                 return builder.getPolicy(e);
             }
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/LocalServiceModelReferenceResolver.java Mon Jul 16 05:56:03 2007
@@ -35,20 +35,22 @@
 
     private DescriptionInfo descriptionInfo;
     private PolicyBuilder builder;
+    private PolicyConstants constants;
     
-    public LocalServiceModelReferenceResolver(DescriptionInfo d, PolicyBuilder b) {
+    public LocalServiceModelReferenceResolver(DescriptionInfo d, PolicyBuilder b, PolicyConstants c) {
         descriptionInfo = d;
         builder = b;
+        constants = c;
     }
     
     public Policy resolveReference(String uri) {
         List<UnknownExtensibilityElement> extensions = 
             descriptionInfo.getExtensors(UnknownExtensibilityElement.class);
         for (UnknownExtensibilityElement e : extensions) {
-            if (PolicyConstants.getNamespace().equals(e.getElementType().getNamespaceURI())
-                && PolicyConstants.getPolicyElemName().equals(e.getElementType().getLocalPart())
-                && uri.equals(e.getElement().getAttributeNS(PolicyConstants.getWSUNamespace(),
-                                                            PolicyConstants.getIdAttrName()))) {
+            if (constants.getNamespace().equals(e.getElementType().getNamespaceURI())
+                && constants.getPolicyElemName().equals(e.getElementType().getLocalPart())
+                && uri.equals(e.getElement().getAttributeNS(constants.getWSUNamespace(),
+                                                            constants.getIdAttrName()))) {
                 return builder.getPolicy(e.getElement());
             }
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/reference/RemoteReferenceResolver.java Mon Jul 16 05:56:03 2007
@@ -39,10 +39,12 @@
     
     private String baseURI;
     private PolicyBuilder builder;
+    private PolicyConstants constants;
     
-    public RemoteReferenceResolver(String uri, PolicyBuilder b) {
+    public RemoteReferenceResolver(String uri, PolicyBuilder b, PolicyConstants c) {
         baseURI = uri;
         builder = b;
+        constants = c;
     }
 
     public Policy resolveReference(String uri) {
@@ -60,13 +62,13 @@
             throw new PolicyException(ex);
         }
 
-        NodeList nl = doc.getElementsByTagNameNS(PolicyConstants.getNamespace(), 
-                                                 PolicyConstants.getPolicyElemName());
+        NodeList nl = doc.getElementsByTagNameNS(constants.getNamespace(), 
+                                                 constants.getPolicyElemName());
         String id = uri.substring(pos + 1);
         for (int i = 0; i < nl.getLength(); i++) {
             Element elem = (Element)nl.item(i);
-            if (id.equals(elem.getAttributeNS(PolicyConstants.getWSUNamespace(), 
-                                              PolicyConstants.getIdAttrName()))) {
+            if (id.equals(elem.getAttributeNS(constants.getWSUNamespace(), 
+                                              constants.getIdAttrName()))) {
                 return builder.getPolicy(elem);
             }
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProvider.java Mon Jul 16 05:56:03 2007
@@ -23,6 +23,8 @@
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import javax.wsdl.Definition;
 import javax.wsdl.extensions.ExtensibilityElement;
@@ -30,9 +32,11 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.AbstractDescriptionElement;
 import org.apache.cxf.service.model.BindingFaultInfo;
+import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.DescriptionInfo;
@@ -43,6 +47,7 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.PolicyProvider;
+import org.apache.cxf.ws.policy.PolicyUtils;
 import org.apache.cxf.ws.policy.attachment.AbstractPolicyProvider;
 import org.apache.cxf.ws.policy.attachment.reference.LocalServiceModelReferenceResolver;
 import org.apache.cxf.ws.policy.attachment.reference.ReferenceResolver;
@@ -58,6 +63,7 @@
 public class Wsdl11AttachmentPolicyProvider extends AbstractPolicyProvider 
     implements PolicyProvider {
 
+    private static final Logger LOG = LogUtils.getL7dLogger(Wsdl11AttachmentPolicyProvider.class);
     
     public Wsdl11AttachmentPolicyProvider() {
         this(null);
@@ -162,18 +168,27 @@
         
         List<UnknownExtensibilityElement> extensions = 
             ex.getExtensors(UnknownExtensibilityElement.class);
+        if (ex instanceof BindingInfo && null != extensions) {
+            LOG.fine("Number of extensions: " + extensions.size());
+        }
+        PolicyConstants constants = bus.getExtension(PolicyConstants.class);
         if (null != extensions) {
-
             for (UnknownExtensibilityElement e : extensions) {
+                if (ex instanceof BindingInfo) {
+                    LOG.fine("Extension of type: " + e.getElementType());
+                }
                 Policy p = null;
-                if (PolicyConstants.getPolicyElemQName().equals(e.getElementType())) {
-                    p = builder.getPolicy(e.getElement());
+                if (constants.getPolicyElemQName().equals(e.getElementType())) {
+                    p = builder.getPolicy(e.getElement());                    
 
-                } else if (PolicyConstants.getPolicyReferenceElemQName().equals(e.getElementType())) {
+                } else if (constants.getPolicyReferenceElemQName().equals(e.getElementType())) {
                     PolicyReference ref = builder.getPolicyReference(e.getElement());
                     if (null != ref) {
                         p = resolveReference(ref, di);
                     }
+                } else {
+                    LOG.fine("No match for " + constants.getPolicyElemQName()
+                             + " or " + constants.getPolicyReferenceElemQName());
                 }
                 if (null != p) {
                     elementPolicy = elementPolicy.merge(p);
@@ -182,7 +197,7 @@
         }
         
         if (includeAttributes) {
-            Object attr = ex.getExtensionAttribute(PolicyConstants.getPolicyURIsAttrQName());
+            Object attr = ex.getExtensionAttribute(constants.getPolicyURIsAttrQName());
             // can be of type a String, a QName, a list of Srings or a list of QNames
             String uris = null;
             if (attr instanceof QName) {
@@ -204,6 +219,7 @@
             }
         }
 
+        PolicyUtils.logPolicy(LOG, Level.FINE, "Element policy for " + ex, elementPolicy);
         return elementPolicy;
     }
     
@@ -225,7 +241,8 @@
         if (null != resolved) {
             return resolved;
         }
-        ReferenceResolver resolver = new LocalServiceModelReferenceResolver(di, builder);
+        ReferenceResolver resolver = new LocalServiceModelReferenceResolver(di, builder,
+            bus.getExtension(PolicyConstants.class));
         resolved = resolver.resolveReference(uri);
         if (null != resolved) {
             ref.setURI(absoluteURI);

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/mtom/MTOMAssertionBuilder.java Mon Jul 16 05:56:03 2007
@@ -28,6 +28,7 @@
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.policy.builder.primitive.PrimitiveAssertion;
@@ -36,17 +37,29 @@
 
 public class MTOMAssertionBuilder implements AssertionBuilder {
     private static final Collection<QName> KNOWN = new ArrayList<QName>();
+    private Bus bus;
     static {
         KNOWN.add(MetadataConstants.MTOM_ASSERTION_QNAME);
     }
+    
+    public void setBus(Bus b) {
+        bus = b;
+    }
 
     public Assertion build(Element elem) {
         String localName = elem.getLocalName();
         QName qn = new QName(elem.getNamespaceURI(), localName);
 
         boolean optional = false;
-        Attr attribute = elem.getAttributeNodeNS(PolicyConstants.getNamespace(),
-                                              PolicyConstants.getOptionalAttrName());
+        PolicyConstants constants = null;
+        if (null != bus) {
+            constants = bus.getExtension(PolicyConstants.class);
+        }
+        if (null == constants) {
+            constants = new PolicyConstants();
+        }
+        Attr attribute = elem.getAttributeNodeNS(constants.getNamespace(),
+                                                 constants.getOptionalAttrName());
         if (attribute != null) {
             optional = Boolean.valueOf(attribute.getValue());
         }

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/spring/PolicyFeatureBeanDefinitionParser.java Mon Jul 16 05:56:03 2007
@@ -43,7 +43,8 @@
     @Override
     protected String resolveId(Element element, AbstractBeanDefinition bean, 
                                ParserContext ctx) throws BeanDefinitionStoreException {
-        return element.getAttributeNS(PolicyConstants.getWSUNamespace(), PolicyConstants.getIdAttrName());
+        PolicyConstants constants = new PolicyConstants();
+        return element.getAttributeNS(constants.getWSUNamespace(), constants.getIdAttrName());
     }
 
     @Override

Modified: incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/main/resources/META-INF/cxf/cxf-extension-policy.xml Mon Jul 16 05:56:03 2007
@@ -31,6 +31,8 @@
         </constructor-arg>
     </bean>
     
+    <bean class="org.apache.cxf.ws.policy.PolicyConstants"/>
+    
     <bean id="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry" class="org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistryImpl">
         <constructor-arg>
             <bean class="org.apache.cxf.configuration.spring.SpringBeanQNameMap">
@@ -69,6 +71,8 @@
     </bean>
     
     <!-- MTOM Policy Support -->
-    <bean class="org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder" />
+    <bean class="org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder">
+        <property name="bus" ref="cxf"/>
+    </bean>
     <bean class="org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider"/>
 </beans>

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/NormalizeTest.java Mon Jul 16 05:56:03 2007
@@ -23,9 +23,12 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.builder.xml.XMLPrimitiveAssertionBuilder;
 import org.apache.neethi.Policy;
 import org.apache.neethi.util.PolicyComparator;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -33,27 +36,32 @@
 
 public class NormalizeTest extends Assert {
     
-    private String originalNamespace;
+    private IMocksControl control;
     
     
     @Before
     public void setUp() {
-        originalNamespace = PolicyConstants.getNamespace();
-        PolicyConstants.setNamespace("http://schemas.xmlsoap.org/ws/2004/09/policy");
+        control = EasyMock.createNiceControl();
     }
     
     @After
     public void tearDown() {
-        PolicyConstants.setNamespace(originalNamespace);
+        control.verify();
     }
     
     @Test
     public void testNormalise() throws Exception {
-        
+        Bus bus = control.createMock(Bus.class);
+        PolicyConstants constants = new PolicyConstants();
+        constants.setNamespace("http://schemas.xmlsoap.org/ws/2004/09/policy");
+        EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(constants).anyTimes();
+        control.replay();
         PolicyBuilderImpl builder = new PolicyBuilderImpl();
         AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder.setAssertionBuilderRegistry(abr);
-        AssertionBuilder ab = new XMLPrimitiveAssertionBuilder(); 
+        XMLPrimitiveAssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
+        ab.setBus(bus);
+       
         abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityToken"), ab);
         abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "SecurityHeader"), ab);
         abr.register(new QName("http://schemas.xmlsoap.org/ws/2002/12/secext", "Integrity"), ab);

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/reference/ReferenceResolverTest.java Mon Jul 16 05:56:03 2007
@@ -46,17 +46,19 @@
 public class ReferenceResolverTest extends Assert {
 
     private IMocksControl control;
+    private PolicyConstants constants = new PolicyConstants();
     
     @Before
     public void setUp() {
-        control = EasyMock.createNiceControl();        
+        control = EasyMock.createNiceControl();
     } 
     
     @Test
     public void testLocalServiceModelReferenceResolver() {
         DescriptionInfo di = control.createMock(DescriptionInfo.class);
         PolicyBuilder builder = control.createMock(PolicyBuilder.class);
-        LocalServiceModelReferenceResolver resolver = new LocalServiceModelReferenceResolver(di, builder);
+        LocalServiceModelReferenceResolver resolver = 
+            new LocalServiceModelReferenceResolver(di, builder, constants);
         
         List<UnknownExtensibilityElement> extensions = new ArrayList<UnknownExtensibilityElement>();
         EasyMock.expect(di.getExtensors(UnknownExtensibilityElement.class)).andReturn(extensions);
@@ -71,9 +73,9 @@
         EasyMock.expect(di.getExtensors(UnknownExtensibilityElement.class)).andReturn(extensions);
         Element e = control.createMock(Element.class);
         EasyMock.expect(extension.getElement()).andReturn(e).times(2);
-        QName qn = new QName(PolicyConstants.getNamespace(), PolicyConstants.getPolicyElemName());
+        QName qn = new QName(constants.getNamespace(), constants.getPolicyElemName());
         EasyMock.expect(extension.getElementType()).andReturn(qn).times(2);
-        EasyMock.expect(e.getAttributeNS(PolicyConstants.getWSUNamespace(), PolicyConstants.getIdAttrName()))
+        EasyMock.expect(e.getAttributeNS(constants.getWSUNamespace(), constants.getIdAttrName()))
                         .andReturn("A");
         Policy p = control.createMock(Policy.class);
         EasyMock.expect(builder.getPolicy(e)).andReturn(p);        
@@ -88,11 +90,11 @@
     public void testLocalDocumentReferenceResolver() {
         Document doc = control.createMock(Document.class);
         PolicyBuilder builder = control.createMock(PolicyBuilder.class);
-        LocalDocumentReferenceResolver resolver = new LocalDocumentReferenceResolver(doc, builder);
+        LocalDocumentReferenceResolver resolver = new LocalDocumentReferenceResolver(doc, builder, constants);
         
         NodeList nl = control.createMock(NodeList.class);
-        EasyMock.expect(doc.getElementsByTagNameNS(PolicyConstants.getNamespace(),
-                                                   PolicyConstants.getPolicyElemName())).andReturn(nl);
+        EasyMock.expect(doc.getElementsByTagNameNS(constants.getNamespace(),
+                                                   constants.getPolicyElemName())).andReturn(nl);
         EasyMock.expect(nl.getLength()).andReturn(0);
         
         control.replay();
@@ -100,12 +102,12 @@
         control.verify();
         
         control.reset();
-        EasyMock.expect(doc.getElementsByTagNameNS(PolicyConstants.getNamespace(),
-                                                   PolicyConstants.getPolicyElemName())).andReturn(nl);
+        EasyMock.expect(doc.getElementsByTagNameNS(constants.getNamespace(),
+                                                   constants.getPolicyElemName())).andReturn(nl);
         EasyMock.expect(nl.getLength()).andReturn(1);
         Element e = control.createMock(Element.class);
         EasyMock.expect(nl.item(0)).andReturn(e);
-        EasyMock.expect(e.getAttributeNS(PolicyConstants.getWSUNamespace(), PolicyConstants.getIdAttrName()))
+        EasyMock.expect(e.getAttributeNS(constants.getWSUNamespace(), constants.getIdAttrName()))
                         .andReturn("A");
         Policy p = control.createMock(Policy.class);
         EasyMock.expect(builder.getPolicy(e)).andReturn(p);        
@@ -121,7 +123,7 @@
         URL url = ReferenceResolverTest.class.getResource("referring.wsdl");
         String baseURI = url.toString();
         PolicyBuilder builder = control.createMock(PolicyBuilder.class);
-        RemoteReferenceResolver resolver = new RemoteReferenceResolver(baseURI, builder);
+        RemoteReferenceResolver resolver = new RemoteReferenceResolver(baseURI, builder, constants);
     
         assertNull(resolver.resolveReference("referred.wsdl#PolicyB"));
         

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=556609&r1=556608&r2=556609
==============================================================================
--- 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 Mon Jul 16 05:56:03 2007
@@ -33,7 +33,6 @@
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.DestinationFactoryManager;
-import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl;
 import org.apache.cxf.ws.policy.PolicyBuilderImpl;
@@ -67,7 +66,9 @@
     private static ServiceInfo[] services;
     private static EndpointInfo[] endpoints;
     private Wsdl11AttachmentPolicyProvider app;
-    private String originalNamespace;
+    private PolicyConstants constants;
+    private Bus bus;
+    private IMocksControl control = EasyMock.createNiceControl();
     
    
     
@@ -84,6 +85,10 @@
         BindingFactoryManager bfm = control.createMock(BindingFactoryManager.class);
         EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bfm).anyTimes();
         EasyMock.expect(bfm.getBindingFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
+        PolicyConstants constants = new PolicyConstants();
+        // test data uses 2004/09 namespace
+        constants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409);
+        EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(constants).anyTimes();
         control.replay();
         
         int n = 19;
@@ -115,28 +120,33 @@
     }
     
     @Before
-    public void setUp() {
-        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
-        AssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
+    public void setUp() {   
+        control = EasyMock.createNiceControl();
+        constants = new PolicyConstants();
+        // test data uses 2004/09 namespace
+        constants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409);
+        bus = control.createMock(Bus.class);
+        EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(constants).anyTimes();
+        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();        
+        XMLPrimitiveAssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
+        ab.setBus(bus);
         abr.register(new QName("http://cxf.apache.org/test/assertions", "A"), ab);
         abr.register(new QName("http://cxf.apache.org/test/assertions", "B"), ab);
         abr.register(new QName("http://cxf.apache.org/test/assertions", "C"), ab);
         
         PolicyBuilderImpl pb = new PolicyBuilderImpl(); 
         pb.setAssertionBuilderRegistry(abr);
-        app = new Wsdl11AttachmentPolicyProvider();
+        app = new Wsdl11AttachmentPolicyProvider(bus);
         app.setBuilder(pb);
         app.setRegistry(new PolicyRegistryImpl());
+        control.replay();
         
-        // test data uses 2004/09 namespace
-        originalNamespace = PolicyConstants.getNamespace();
-        PolicyConstants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409);
     }
     
     
     @After
     public void tearDown() {
-        PolicyConstants.setNamespace(originalNamespace);
+        control.verify();
     }
     
     @Test

Modified: incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java (original)
+++ incubator/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/builder/primitive/NestedPrimitiveAssertionTest.java Mon Jul 16 05:56:03 2007
@@ -26,6 +26,7 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.Bus;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistry;
 import org.apache.cxf.ws.policy.AssertionBuilderRegistryImpl;
 import org.apache.cxf.ws.policy.PolicyBuilderImpl;
@@ -34,6 +35,8 @@
 import org.apache.neethi.Assertion;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyComponent;
+import org.easymock.classextension.EasyMock;
+import org.easymock.classextension.IMocksControl;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
@@ -50,22 +53,33 @@
     private static final QName TEST_NAME2 = new QName(TEST_NAMESPACE, "AnonymousResponses");
     private static final QName TEST_NAME3 = new QName(TEST_NAMESPACE, "NonAnonymousResponses");
     
-    private String originalNamespace;
-
     private PolicyBuilderImpl builder;
+    private IMocksControl control;
+    private Bus bus;
+    private PolicyConstants constants;
     
     @Before
     public void setUp() {
+        
+        control = EasyMock.createNiceControl();
+        
+        bus = control.createMock(Bus.class);
+        constants = new PolicyConstants();
+        constants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409);
+        EasyMock.expect(bus.getExtension(PolicyConstants.class)).andReturn(constants).anyTimes();
+        
         AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
         builder = new PolicyBuilderImpl();
         builder.setAssertionBuilderRegistry(abr);
         
         NestedPrimitiveAssertionBuilder npab = new NestedPrimitiveAssertionBuilder();
+        npab.setBus(bus);
         npab.setPolicyBuilder(builder);
         npab.setKnownElements(Collections.singletonList(TEST_NAME1));
         abr.register(TEST_NAME1, npab);
         
         PrimitiveAssertionBuilder pab = new PrimitiveAssertionBuilder();
+        pab.setBus(bus);
         Collection<QName> known = new ArrayList<QName>();
         known.add(TEST_NAME2);
         known.add(TEST_NAME3);
@@ -73,13 +87,12 @@
         abr.register(TEST_NAME2, pab);
         abr.register(TEST_NAME3, pab); 
         
-        originalNamespace = PolicyConstants.getNamespace();
-        PolicyConstants.setNamespace(PolicyConstants.NAMESPACE_XMLSOAP_200409);
+        control.replay();
     }
     
     @After
     public void tearDown() {
-        PolicyConstants.setNamespace(originalNamespace);
+        control.verify();
     }
     
     @Test

Modified: incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java?view=diff&rev=556609&r1=556608&r2=556609
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java (original)
+++ incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/testutil/common/ServerLauncher.java Mon Jul 16 05:56:03 2007
@@ -338,6 +338,7 @@
         cmd.add("-Djavax.xml.ws.spi.Provider=org.apache.cxf.bus.jaxws.spi.ProviderImpl");
         
         String loggingPropertiesFile = System.getProperty("java.util.logging.config.file");
+        loggingPropertiesFile = "c:/logging.properties";
         if (null != loggingPropertiesFile) {
             cmd.add("-Djava.util.logging.config.file=" + loggingPropertiesFile);
         } 



Mime
View raw message