tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r675323 - in /tuscany/java/sca/modules: binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/ definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/ policy-xml/src/main/java/org/...
Date Wed, 09 Jul 2008 19:46:50 GMT
Author: lresende
Date: Wed Jul  9 12:46:49 2008
New Revision: 675323

URL: http://svn.apache.org/viewvc?rev=675323&view=rev
Log:
TUSCANY-2434 and updates from TUSCANY-2354

Modified:
    tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
    tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
    tuscany/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
    tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
    tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
    tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
    tuscany/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml

Modified: tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
(original)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/WSSecurityAuthentication.composite
Wed Jul  9 12:46:49 2008
@@ -27,7 +27,7 @@
     so for this composite the service is: http://localhost:8085/myExplicitURI 
     -->      
 
-    <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsAuthenticationPolicy">
+    <service name="helloWorld" promote="HelloWorldService" policySets="tuscany:wsSecurityPolicyForAuthentication">
         <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)"
/>
         <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.port(HelloWorldService/HelloWorldSoapPort)"
/>
     </service>
@@ -41,7 +41,7 @@
         <reference name="helloWorldWS" />
     </component>
 
-    <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsAuthenticationPolicy">
+    <reference name="helloWorldWS" promote="HelloWorldComponent/helloWorldWS" policySets="tuscany:wsSecurityPolicyForAuthentication">
         <interface.wsdl interface="http://helloworld-om-uri#wsdl.interface(HelloWorld)"
/>
         <binding.ws wsdlElement="http://helloworld-om-uri#wsdl.binding(HelloWorldSoapBinding)"
                     uri="http://localhost:8085/myExplicitURI"/>

Modified: tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
(original)
+++ tuscany/java/sca/modules/binding-ws-axis2/src/test/resources/org/apache/tuscany/sca/binding/ws/axis2/itests/policy/wspolicy/definitions.xml
Wed Jul  9 12:46:49 2008
@@ -24,7 +24,7 @@
  
  <!-- WS Security POLICY SETS -->
  <!-- A policyset that uses WS Policy -->
- <sca:policySet name="wsAuthenticationPolicy"
+ <sca:policySet name="wsSecurityPolicyForAuthentication"
  	provides="sca:authentication"
  	appliesTo="sca:binding.ws">
  	<wsp:Policy wsu:Id="UTOverTransport" 

Modified: tuscany/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
(original)
+++ tuscany/java/sca/modules/definitions-xml/src/test/resources/org/apache/tuscany/sca/definitions/test_definitions.xml
Wed Jul  9 12:46:49 2008
@@ -102,7 +102,9 @@
     </intentMap>
 </policySet>
 
-<policySet name="SecurityPolicy" provides="test:confidentiality"
+<policySet name="SecurityPolicy" 
+    provides="test:confidentiality" 
+	appliesTo="binding.ws"
 	xmlns="http://www.osoa.org/xmlns/sca/1.0"
 	xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
     <intentMap provides="test:confidentiality" default="message">
@@ -149,7 +151,7 @@
 
 <policySet name="ConfidentialityPolicies"
  provides="test:confidentiality"
- bindings="binding.ws"
+ appliesTo="binding.ws"
  xmlns="http://www.osoa.org/xmlns/sca/1.0"
     xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
     <intentMap provides="test:confidentiality"  default="transport">

Modified: tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
(original)
+++ tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicyIntentProcessor.java
Wed Jul  9 12:46:49 2008
@@ -84,6 +84,11 @@
     public T read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException
{
         Intent policyIntent = null;
         String policyIntentName = reader.getAttributeValue(null, NAME);
+        if (policyIntentName == null) {
+            error("IntentNameMissing", reader);
+            return (T)policyIntent;
+        }
+        
         // Read an <sca:intent>
         if (reader.getAttributeValue(null, REQUIRES) != null) {
             policyIntent = policyFactory.createProfileIntent();

Modified: tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
(original)
+++ tuscany/java/sca/modules/policy-xml/src/main/java/org/apache/tuscany/sca/policy/xml/PolicySetProcessor.java
Wed Jul  9 12:46:49 2008
@@ -109,11 +109,20 @@
      }
 
     public PolicySet read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException
{
+        PolicySet policySet = null;
+        
         String policySetName = reader.getAttributeValue(null, NAME);
+        String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
+        if (policySetName == null || appliesTo == null) {
+            if (policySetName == null)
+                error("PolicySetNameMissing", reader);
+            if (appliesTo == null)
+                error("PolicySetAppliesToMissing", reader);
+            return policySet;
+        }
         
-        PolicySet policySet = policyFactory.createPolicySet();
+        policySet = policyFactory.createPolicySet();
         policySet.setName(new QName(policySetName));
-        String appliesTo = reader.getAttributeValue(null, APPLIES_TO);
         String alwaysAppliesTo = reader.getAttributeValue(TUSCANY_NS, ALWAYS_APPLIES_TO);
         
         //TODO: with 1.0 version of specs the applies to xpath is given related to the immediate
@@ -158,17 +167,27 @@
                     name = reader.getName();
                     if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
                         Intent mappedIntent = policyFactory.createIntent();
-                        mappedIntent.setName(getQName(reader, PROVIDES));
-                        if ( policySet.getProvidedIntents().contains(mappedIntent) ) {
-                            readIntentMap(reader, policySet, mappedIntent);
+                        String provides = reader.getAttributeValue(null, PROVIDES);
+                        if (provides != null) {
+                            mappedIntent.setName(getQName(reader, PROVIDES));
+                            if ( policySet.getProvidedIntents().contains(mappedIntent) )
{
+                                readIntentMap(reader, policySet, mappedIntent);
+                            } else {
+                                error("IntentNotSpecified", policySet, policySetName);
+                                //throw new ContributionReadException("Intent Map provides
for Intent not specified as provided by parent PolicySet - " + policySetName);
+                            }
                         } else {
-                        	error("IntentNotSpecified", policySet, policySetName);
-                            //throw new ContributionReadException("Intent Map provides for
Intent not specified as provided by parent PolicySet - " + policySetName);
+                            error("IntentMapProvidesMissing", reader, policySetName);
                         }
                     } else if ( POLICY_SET_REFERENCE_QNAME.equals(name) )  {
                         PolicySet referredPolicySet = policyFactory.createPolicySet();
-                        referredPolicySet.setName(getQName(reader, NAME));
-                        policySet.getReferencedPolicySets().add(referredPolicySet);
+                        String referencename = reader.getAttributeValue(null, NAME);
+                        if (referencename != null) {
+                            referredPolicySet.setName(getQName(reader, NAME));
+                            policySet.getReferencedPolicySets().add(referredPolicySet);
+                        } else {
+                            error("PolicySetReferenceNameMissing", reader, policySetName);
+                        }
                     } /*else if ( WS_POLICY_QNAME.equals(name) )  {
                         OMElement policyElement = loadElement(reader);
                         org.apache.neethi.Policy wsPolicy = PolicyEngine.getPolicy(policyElement);
@@ -218,12 +237,16 @@
                         case START_ELEMENT : {
                             name = reader.getName();
                             if ( POLICY_INTENT_MAP_QUALIFIER_QNAME.equals(name)) {
-                                qualifierName = getString(reader, NAME);
-                                qualfiedIntentName = mappedIntent.getName().getLocalPart()
+ 
-                                                            QUALIFIER + qualifierName;
-                                qualifiedIntent = policyFactory.createIntent();
-                                qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
-                                                                  qualfiedIntentName)); 
+                                qualifierName = getString(reader, NAME);                
               
+                                if (qualifierName != null) {
+                                    qualfiedIntentName = mappedIntent.getName().getLocalPart()
+ 
+                                                                    QUALIFIER + qualifierName;
+                                    qualifiedIntent = policyFactory.createIntent();
+                                    qualifiedIntent.setName(new QName(mappedIntent.getName().getNamespaceURI(),
+                                                                        qualfiedIntentName));
+                                } else {
+                                    error("QualifierNameMissing", reader, policySet.getName());
+                                }
                             } else if ( POLICY_INTENT_MAP_QNAME.equals(name) ) {
                                 QName providedIntent = getQName(reader, PROVIDES);
                                 if ( qualifierName.equals(providedIntent.getLocalPart())
) {
@@ -251,7 +274,7 @@
                                 policyList.add((Policy)wsPolicy);
                             }*/ else {
                                 Object extension = extensionProcessor.read(reader);
-                                if ( extension != null ) {
+                                if ( extension != null && qualifiedIntent != null)
{
                                     List<Object> policyList = mappedPolicies.get(qualifiedIntent);
                                     if ( policyList == null ) {
                                         policyList = new ArrayList<Object>();
@@ -345,13 +368,15 @@
 
    private void resolvePolicies(PolicySet policySet, ModelResolver resolver) throws ContributionResolveException
{
        boolean unresolved = false;
-       for ( Object o : policySet.getPolicies() ) {
-           extensionProcessor.resolve(o, resolver);
-           /*if ( o instanceof Policy && ((Policy)o).isUnresolved() ) {
-              unresolved = true;
-           }*/
+       if (policySet != null) {
+           for ( Object o : policySet.getPolicies() ) {
+               extensionProcessor.resolve(o, resolver);
+               /*if ( o instanceof Policy && ((Policy)o).isUnresolved() ) {
+                  unresolved = true;
+               }*/
+           }
+           policySet.setUnresolved(unresolved);
        }
-       policySet.setUnresolved(unresolved);
    }
    
    

Modified: tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
(original)
+++ tuscany/java/sca/modules/policy-xml/src/main/resources/policy-xml-validation-messages.properties
Wed Jul  9 12:46:49 2008
@@ -24,7 +24,7 @@
 UnableToMapPolicies = Unable to map policies for default qualifier in IntentMap for - {0}
in policy set - {1}
 IntentMapDoesNotMatch = Intent provided by IntentMap {0} does not match parent qualifier
{1} in policyset - {2}
 IntentNotSpecified = Intent Map provides for Intent not specified as provided by parent PolicySet
- {0}
-ContrainsAttributeMissing = Contrains attribute missing from Policy Intent Definition {0}
+ContrainsAttributeMissing = Constrains attribute missing from Policy Intent Definition {0}
 RequiredIntentNotFound = Required Intent - {0} not found for ProfileIntent {1}
 QualifiableIntentNotFound = Qualifiable Intent - {0} not found for QualifiedIntent {1}
 ErrorInPolicyIntentDefinition = Error in PolicyIntent Definition - {0} {1}
@@ -33,5 +33,12 @@
 RequiredAttributeMissing = Required attribute {0} missing from BindingType Definition
 AlwaysProvidedIntentNotFound = Always Provided Intent - {0} not found for ExtensionType {1}
 MayProvideIntentNotFound = May Provide Intent - {0} not found for ExtensionType {1}
-ContributionReadException = ContributionReadException occured due to: {0}
-CyclicReferenceFound = Cyclic reference detected in required attributes of ProfileIntents
{0} and {1}
\ No newline at end of file
+ContributionReadException = ContributionReadException occurred due to: {0}
+CyclicReferenceFound = Cyclic reference detected in required attributes of ProfileIntents
{0} and {1}
+IntentNameMissing = Required attribute "name" missing for Intent Definition
+PolicySetReferenceNameMissing = Required attribute "name" missing for PolicySetReference
in PolicySet : {0}
+PolicySetNameMissing = Required attribute "name" missing for PolicySet Definition
+PolicySetAppliesToMissing = Required attribute "appliesTo" missing for PolicySet Definition
+IntentMapProvidesMissing = Required attribute "provides" missing for IntentMap in PolicySet
: {0}
+QualifierNameMissing = Required attribute "name" missing for qualifier definition in PolicySet
: {0}
+

Modified: tuscany/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml?rev=675323&r1=675322&r2=675323&view=diff
==============================================================================
--- tuscany/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
(original)
+++ tuscany/java/sca/modules/policy-xml/src/test/resources/org/apache/tuscany/sca/policy/xml/test_definitions.xml
Wed Jul  9 12:46:49 2008
@@ -102,7 +102,9 @@
     </intentMap>
 </policySet>
 
-<policySet name="SecurityPolicy" provides="test:confidentiality"
+<policySet name="SecurityPolicy" 
+    provides="test:confidentiality"
+	appliesTo="binding.ws"
 	xmlns="http://www.osoa.org/xmlns/sca/1.0"
 	xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
     <intentMap provides="test:confidentiality" default="message">
@@ -149,7 +151,7 @@
 
 <policySet name="ConfidentialityPolicies"
  provides="test:confidentiality"
- bindings="binding.ws"
+ appliesTo="binding.ws"
  xmlns="http://www.osoa.org/xmlns/sca/1.0"
     xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
     <intentMap provides="test:confidentiality"  default="transport">



Mime
View raw message