cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r692310 - in /cxf/trunk: api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/ rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/ rt/ws/policy/src/test/java/org/apache/cxf/ws/po...
Date Fri, 05 Sep 2008 00:21:04 GMT
Author: dkulp
Date: Thu Sep  4 17:21:03 2008
New Revision: 692310

URL: http://svn.apache.org/viewvc?rev=692310&view=rev
Log:
Change the default to not throw an exception when encountering an unknown extensor.  Parse
it into a XmlPrimitiveAssertion and allow the effective policy computation consider other
alternatives.

Modified:
    cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
    cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java
    cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
    cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl

Modified: cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java?rev=692310&r1=692309&r2=692310&view=diff
==============================================================================
--- cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
(original)
+++ cxf/trunk/api/src/main/java/org/apache/cxf/ws/policy/builder/primitive/PrimitiveAssertion.java
Thu Sep  4 17:21:03 2008
@@ -63,11 +63,13 @@
     public PrimitiveAssertion(Element element) {
         name = new QName(element.getNamespaceURI(), element.getLocalName());
         NamedNodeMap atts = element.getAttributes();
-        for (int x = 0; x < atts.getLength(); x++) {
-            Attr att = (Attr)atts.item(x);
-            QName qn = new QName(att.getNamespaceURI(), att.getLocalName());
-            if (PolicyConstants.isOptionalAttribute(qn)) {
-                optional = Boolean.valueOf(att.getValue());                
+        if (atts != null) {
+            for (int x = 0; x < atts.getLength(); x++) {
+                Attr att = (Attr)atts.item(x);
+                QName qn = new QName(att.getNamespaceURI(), att.getLocalName());
+                if (PolicyConstants.isOptionalAttribute(qn)) {
+                    optional = Boolean.valueOf(att.getValue());                
+                }
             }
         }
     }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java?rev=692310&r1=692309&r2=692310&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
(original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImpl.java
Thu Sep  4 17:21:03 2008
@@ -36,6 +36,7 @@
 import org.apache.cxf.configuration.spring.MapProvider;
 import org.apache.cxf.extension.BusExtension;
 import org.apache.cxf.extension.RegistryImpl;
+import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
 
 /**
  * 
@@ -47,7 +48,7 @@
     private static final Logger LOG 
         = LogUtils.getL7dLogger(AssertionBuilderRegistryImpl.class);
     private static final int IGNORED_CACHE_SIZE = 10;
-    private boolean ignoreUnknownAssertions; 
+    private boolean ignoreUnknownAssertions = true; 
     private List<QName> ignored = new ArrayList<QName>(IGNORED_CACHE_SIZE);
     
     public AssertionBuilderRegistryImpl() {
@@ -100,7 +101,7 @@
                 if (!alreadyWarned) {
                     LOG.warning(m.toString());
                 }
-                return null;
+                return new XmlPrimitiveAssertion(element);
             } else {
                 throw new PolicyException(m);
             }

Modified: cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java?rev=692310&r1=692309&r2=692310&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java (original)
+++ cxf/trunk/rt/ws/policy/src/main/java/org/apache/cxf/ws/policy/PolicyEngineImpl.java Thu
Sep  4 17:21:03 2008
@@ -60,7 +60,7 @@
     private PolicyRegistry registry;
     private Collection<PolicyProvider> policyProviders;
     private boolean enabled;
-    private boolean ignoreUnknownAssertions;
+    private boolean ignoreUnknownAssertions = true;
     private boolean addedBusInterceptors;
     private AlternativeSelector alternativeSelector;
 

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java?rev=692310&r1=692309&r2=692310&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/AssertionBuilderRegistryImplTest.java
Thu Sep  4 17:21:03 2008
@@ -23,6 +23,7 @@
 
 import org.w3c.dom.Element;
 
+import org.apache.cxf.ws.policy.builder.xml.XmlPrimitiveAssertion;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
 import org.junit.After;
@@ -50,6 +51,7 @@
     @Test
     public void testBuildUnknownAssertion() {
         AssertionBuilderRegistry reg = new AssertionBuilderRegistryImpl();
+        reg.setIgnoreUnknownAssertions(false);
         Element[] elems = new Element[11];
         QName[] qnames = new QName[11];
         for (int i = 0; i < 11; i++) {
@@ -71,11 +73,11 @@
         reg.setIgnoreUnknownAssertions(true);
         assertTrue(reg.isIgnoreUnknownAssertions());
         for (int i = 0; i < 10; i++) {
-            assertNull(reg.build(elems[i]));
+            assertTrue(reg.build(elems[i]) instanceof XmlPrimitiveAssertion);
         }
         for (int i = 9; i >= 0; i--) {
-            assertNull(reg.build(elems[i]));
+            assertTrue(reg.build(elems[i]) instanceof XmlPrimitiveAssertion);
         }
-        assertNull(reg.build(elems[10]));        
+        assertTrue(reg.build(elems[10]) instanceof XmlPrimitiveAssertion);
     }
 }

Modified: cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java?rev=692310&r1=692309&r2=692310&view=diff
==============================================================================
--- cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
(original)
+++ cxf/trunk/rt/ws/policy/src/test/java/org/apache/cxf/ws/policy/attachment/wsdl11/Wsdl11AttachmentPolicyProviderTest.java
Thu Sep  4 17:21:03 2008
@@ -117,7 +117,8 @@
     public void setUp() {   
         control = EasyMock.createNiceControl();
         bus = control.createMock(Bus.class);
-        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();        
+        AssertionBuilderRegistry abr = new AssertionBuilderRegistryImpl();
+        abr.setIgnoreUnknownAssertions(false);
         XMLPrimitiveAssertionBuilder ab = new XMLPrimitiveAssertionBuilder();
         ab.setBus(bus);
         abr.register(new QName("http://cxf.apache.org/test/assertions", "A"), ab);

Modified: cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl?rev=692310&r1=692309&r2=692310&view=diff
==============================================================================
--- cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl (original)
+++ cxf/trunk/systests/src/test/resources/wsdl_systest/DoubleIt.wsdl Thu Sep  4 17:21:03 2008
@@ -82,6 +82,9 @@
    <wsp:Policy wsu:Id="DoubleItBindingPolicy">
       <wsp:ExactlyOne>
          <wsp:All>
+            <foo:unknownPolicy xmlns:foo="http://cxf.apache.org/not/a/policy"/>
+         </wsp:All>
+         <wsp:All>
             <wsaws:UsingAddressing xmlns:wsaws="http://www.w3.org/2006/05/addressing/wsdl"/>
             <sp:TransportBinding>
                <wsp:Policy>



Mime
View raw message