You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by sa...@apache.org on 2006/05/09 12:30:12 UTC
svn commit: r405377 [1/2] - in /webservices/commons/trunk/modules/neethi:
src/org/apache/ws/policy/ src/org/apache/ws/policy/util/
test-resources/base/ test2/ test2/org/ test2/org/apache/
test2/org/apache/ws/ test2/org/apache/ws/policy/
Author: sanka
Date: Tue May 9 03:30:07 2006
New Revision: 405377
URL: http://svn.apache.org/viewcvs?rev=405377&view=rev
Log:
Added: Policy.iterator() method which will return and iterator to keep track of alternatives. Here itertor.next() will return another iterator which points to the primitive terms set in the alternative which its parent points to ..
It is a slight modification to the patch provided in JIRA WSCOMMONS-17.
Added: Set of testcases which is provided in JIRA WSCOMMONS-21
Added:
webservices/commons/trunk/modules/neethi/test-resources/base/
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllEmpty.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllMany.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllNested.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllSingle.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_Duplicates.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOEmpty.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOMany.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EONested.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOSingle.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_MixedNested.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyEmpty.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyMany.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyNested.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicySingle.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality1.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality2.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_All.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_EO.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllMany.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllSingle.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOMany.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOSingle.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_Explosion.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_MixedNested.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicyMany.xml
webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicySingle.xml
webservices/commons/trunk/modules/neethi/test2/
webservices/commons/trunk/modules/neethi/test2/org/
webservices/commons/trunk/modules/neethi/test2/org/apache/
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionPerm.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionSet.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/TestConstants.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_JIRA14.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_Policy.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Timer.java
webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/WSPTestSuite.java
Modified:
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java
webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java
Modified: webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java?rev=405377&r1=405376&r2=405377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java (original)
+++ webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/Policy.java Tue May 9 03:30:07 2006
@@ -113,30 +113,29 @@
}
/**
- * Sets the Name of the Policy object
- *
- * @param name
- */
- public void setName(String name) {
- addAttribute(new QName("", PolicyConstants.WS_POLICY_NAME), name);
- }
-
- /**
- * Returns the Name of the Policy object. Returns null if no Name is set.
- *
- * @return the Name of the policy object.
- */
- public String getName() {
- return (String) getAttribute(new QName(
- "", PolicyConstants.WS_POLICY_NAME));
- }
-
- /**
-
- /**
- * Returns a String which uniquely identify the policy object. It has the
- * format of {$xmlBase}#{$id}. If the xmlBase is null it will return #{$id}
- * as the URI String. If the Id is null, this will return.
+ * Sets the Name of the Policy object
+ *
+ * @param name
+ */
+ public void setName(String name) {
+ addAttribute(new QName("", PolicyConstants.WS_POLICY_NAME), name);
+ }
+
+ /**
+ * Returns the Name of the Policy object. Returns null if no Name is set.
+ *
+ * @return the Name of the policy object.
+ */
+ public String getName() {
+ return (String) getAttribute(new QName("",
+ PolicyConstants.WS_POLICY_NAME));
+ }
+
+ /**
+ *
+ * /** Returns a String which uniquely identify the policy object. It has
+ * the format of {$xmlBase}#{$id}. If the xmlBase is null it will return
+ * #{$id} as the URI String. If the Id is null, this will return.
*
* @return a String which uniquely identify the policy object.
*/
@@ -457,6 +456,49 @@
}
return result;
+ }
+
+ /**
+ * Returns an Iterator to track the Alternatives within this Policy. This
+ * iterator will again return an iterator which points to the set of
+ * primitives in an alternative.
+ *
+ * @return
+ */
+ public Iterator iterator() {
+ return new PolicyIterator(this);
+ }
+
+ private class PolicyIterator implements java.util.Iterator {
+
+ private XorCompositeAssertion XOR = null;
+
+ private int currentIndex = 0;
+
+ private PolicyIterator(Policy policy) {
+ if (!policy.isNormalized()) {
+ policy = (Policy) policy.normalize();
+ }
+
+ XOR = (XorCompositeAssertion) policy.getTerms().get(0);
+ }
+
+ public boolean hasNext() {
+ return XOR.size() > currentIndex;
+ }
+
+ public Object next() {
+ AndCompositeAssertion AND = (AndCompositeAssertion) XOR.getTerms()
+ .get(currentIndex);
+ currentIndex++;
+ return AND.getTerms();
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException(
+ "currently not supported .. ");
+
+ }
}
}
Modified: webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java?rev=405377&r1=405376&r2=405377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java (original)
+++ webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/PolicyConstants.java Tue May 9 03:30:07 2006
@@ -22,43 +22,43 @@
*/
public interface PolicyConstants {
- /** Tag name of AndComposteAssertion */
- public static final String AND_COMPOSITE_ASSERTION = "All";
+ /** Tag name of AndComposteAssertion */
+ public static final String AND_COMPOSITE_ASSERTION = "All";
- /** Tag name of XorCompositeAssertion */
- public static final String XOR_COMPOSITE_ASSERTION = "ExactlyOne";
+ /** Tag name of XorCompositeAssertion */
+ public static final String XOR_COMPOSITE_ASSERTION = "ExactlyOne";
- /** Tag name of Policy */
- public static final String WS_POLICY = "Policy";
+ /** Tag name of Policy */
+ public static final String WS_POLICY = "Policy";
- /** Prefix of WS-Policy namespace */
- public static final String WS_POLICY_PREFIX = "wsp";
-
- /** Prefix of WSU namespace */
- public static final String WSU_NAMESPACE_PREFIX = "wsu";
-
- /** Tag name of PolicyReference */
- public static final String WS_POLICY_REFERENCE = "PolicyReference";
-
- /** Namespace of WS-Policy */
- public static final String WS_POLICY_NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2004/09/policy";
-
- /** Namespace of WSU */
- public static final String WSU_NAMESPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
-
- /** XML namespace */
- public static final String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
-
- /** Policy Id attribute **/
- public static final String WS_POLICY_ID = "Id";
-
- /** Policy Name attribute **/
- public static final String WS_POLICY_NAME = "Name";
-
- /** Policy base attribute **/
- public static final String WS_POLICY_BASE = "base";
-
- /** Namespace of xmlns prefix when defining namespace aliases */
- public static final String NAMESPACE_XMLNS = "http://www.w3.org/2000/xmlns/";
+ /** Prefix of WS-Policy namespace */
+ public static final String WS_POLICY_PREFIX = "wsp";
+
+ /** Prefix of WSU namespace */
+ public static final String WSU_NAMESPACE_PREFIX = "wsu";
+
+ /** Tag name of PolicyReference */
+ public static final String WS_POLICY_REFERENCE = "PolicyReference";
+
+ /** Namespace of WS-Policy */
+ public static final String WS_POLICY_NAMESPACE_URI = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+
+ /** Namespace of WSU */
+ public static final String WSU_NAMESPACE_URI = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
+
+ /** XML namespace */
+ public static final String XML_NAMESPACE_URI = "http://www.w3.org/XML/1998/namespace";
+
+ /** Policy Id attribute * */
+ public static final String WS_POLICY_ID = "Id";
+
+ /** Policy Name attribute * */
+ public static final String WS_POLICY_NAME = "Name";
+
+ /** Policy base attribute * */
+ public static final String WS_POLICY_BASE = "base";
+
+ /** Namespace of xmlns prefix when defining namespace aliases */
+ public static final String NAMESPACE_XMLNS = "http://www.w3.org/2000/xmlns/";
}
Modified: webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java?rev=405377&r1=405376&r2=405377&view=diff
==============================================================================
--- webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java (original)
+++ webservices/commons/trunk/modules/neethi/src/org/apache/ws/policy/util/DOMPolicyReader.java Tue May 9 03:30:07 2006
@@ -154,8 +154,15 @@
result.setAttributes(getAttributes(element));
String isOptional = result.getAttribute(new QName(
PolicyConstants.WS_POLICY_NAMESPACE_URI, "Optional"));
- result.setOptional(new Boolean(isOptional).booleanValue());
-
+
+ if (isOptional != null) {
+ if (isOptional.equalsIgnoreCase("true")) {
+ result.setOptional(true);
+ } else if (isOptional.equals("1")) {
+ result.setOptional(true);
+ }
+ }
+
//CHECK ME
NodeList list = element.getChildNodes();
int length = list.getLength();
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllEmpty.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllEmpty.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllEmpty.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllEmpty.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,7 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_AllEmpty"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+ <wsp:All></wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllMany.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllMany.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllMany.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllMany.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,13 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_AllMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:All>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay>Numeric</cal:MonthDay>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllNested.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllNested.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllNested.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllNested.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,20 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_AllNested"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ </wsp:All>
+ <wsp:All>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay>Numeric</cal:MonthDay>
+ </wsp:All>
+ <wsp:All>
+ <cal:YearDay>Numeric</cal:YearDay>
+ <cal:Year>Numeric</cal:Year>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllSingle.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllSingle.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllSingle.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_AllSingle.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,9 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_AllSingle"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+ <wsp:All>
+ <cal:Hour>24</cal:Hour>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_Duplicates.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_Duplicates.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_Duplicates.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_Duplicates.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,12 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_Duplicates"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ <cal:Log>ID</cal:Log>
+ <cal:Hour>24</cal:Hour>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOEmpty.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOEmpty.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOEmpty.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOEmpty.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,7 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_EOEmpty"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne></wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOMany.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOMany.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOMany.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOMany.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,13 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_EOMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay>Numeric</cal:MonthDay>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EONested.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EONested.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EONested.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EONested.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,20 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_EONested"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:All>
+ <wsp:ExactlyOne>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ </wsp:ExactlyOne>
+ <wsp:ExactlyOne>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay>Numeric</cal:MonthDay>
+ </wsp:ExactlyOne>
+ <wsp:ExactlyOne>
+ <cal:YearDay>Numeric</cal:YearDay>
+ <cal:Year>Numeric</cal:Year>
+ </wsp:ExactlyOne>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOSingle.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOSingle.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOSingle.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_EOSingle.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,9 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_EOSingle"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <cal:Hour>24</cal:Hour>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_MixedNested.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_MixedNested.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_MixedNested.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_MixedNested.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,20 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_MixedNested"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:Policy>
+ <cal:Hour>24</cal:Hour>
+ <cal:Unknown>XXX</cal:Unknown>
+ </wsp:Policy>
+ <cal:Month>UNSUPPORTED_XXX</cal:Month>
+ </wsp:ExactlyOne>
+ <wsp:All>
+ <wsp:ExactlyOne>
+ <cal:YearDay>Numeric</cal:YearDay>
+ <cal:Unknown>YYY</cal:Unknown>
+ </wsp:ExactlyOne>
+ <cal:MonthDay>UNSUPPORTED_YYY</cal:MonthDay>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyEmpty.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyEmpty.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyEmpty.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyEmpty.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,7 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_PolicyEmpty"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy />
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyMany.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyMany.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyMany.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyMany.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,13 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_PolicyMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay>Numeric</cal:MonthDay>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:Policy>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyNested.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyNested.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyNested.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicyNested.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,22 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_PolicyNested"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:Policy>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log>ID</cal:Log>
+ </wsp:Policy>
+ <wsp:All>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay>Numeric</cal:MonthDay>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ <wsp:All>
+ <wsp:Policy Name="second">
+ <cal:YearDay>Numeric</cal:YearDay>
+ <cal:Year>Numeric</cal:Year>
+ </wsp:Policy>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicySingle.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicySingle.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicySingle.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Alternatives_PolicySingle.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,9 @@
+<wsp:Policy wsu:Id="Policy_Alternatives_PolicySingle"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <cal:Hour>24</cal:Hour>
+ </wsp:Policy>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality1.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality1.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality1.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality1.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,112 @@
+<wsp:Policy
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="Equality">
+ <sp:SymmetricBinding>
+ <wsp:Policy>
+ <sp:EncryptionToken>
+ <wsp:Policy>
+ <sp:UsernameToken>
+ <wsp:Policy>
+ <sp:WssUsernameToken11 />
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:EncryptionToken>
+ <sp:SignatureToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:WssX509V1Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:SignatureToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:TripleDes />
+ <sp:Basic256 />
+ <sp:Basic256Rsa15 />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:Strict />
+ <sp:Lax />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp />
+ <sp:EncryptBeforeSigning />
+ <sp:EncryptSignature />
+ <sp:ProtectTokens />
+ <sp:OnlySignEntireHeadersAndBody />
+ <sp:EndorsingSupportingTokens>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:WssX509V1Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ <sp:UsernameToken>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:WssUsernameToken11 />
+ <sp:WssUsernameToken10 />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:UsernameToken>
+ <sp:KerberosToken
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:WssGssKerberosV5ApReqToken11 />
+ </wsp:Policy>
+ </sp:KerberosToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:Basic256 />
+ <sp:TripleDes />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="mySignedPartsA"
+ Namespace="http://myNamespaceA" />
+ <sp:Header Name="mySignedPartsB"
+ Namespace="http://myNamespaceB" />
+ <sp:Header Namespace="http://myNamespaceC" />
+ </sp:SignedParts>
+ <sp:EncryptedParts>
+ <sp:Body />
+ <sp:Header Name="myEncryptedPartsA"
+ Namespace="http://myNamespaceA" />
+ <sp:Header Name="myEncryptedPartsB"
+ Namespace="http://myNamespaceB" />
+ <sp:Header Namespace="http://myNamespaceC" />
+ </sp:EncryptedParts>
+ <sp:SignedElements
+ sp:XPathVersion="http://www.w3.org/TR/1999/REC-xpath-19991116">
+ <sp:XPath>A/*</sp:XPath>
+ <sp:XPath>B/*</sp:XPath>
+ <sp:XPath>C/*</sp:XPath>
+ </sp:SignedElements>
+ <sp:EncryptedElements
+ sp:XPathVersion="http://www.w3.org/2002/06/xmldsig-filter2">
+ <sp:XPath>X/*</sp:XPath>
+ <sp:XPath>Y/*</sp:XPath>
+ <sp:XPath>Z/*</sp:XPath>
+ </sp:EncryptedElements>
+ </wsp:Policy>
+ </sp:EndorsingSupportingTokens>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality2.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality2.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality2.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Equality2.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,112 @@
+<wsp:Policy
+ xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="Equality">
+ <sp:SymmetricBinding>
+ <wsp:Policy>
+ <sp:EncryptionToken>
+ <wsp:Policy>
+ <sp:UsernameToken>
+ <wsp:Policy>
+ <sp:WssUsernameToken11 />
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:EncryptionToken>
+ <sp:SignatureToken>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:WssX509V1Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:SignatureToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:Basic256 />
+ <sp:TripleDes />
+ <sp:Basic256Rsa15 />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:Lax />
+ <sp:Strict />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:EncryptSignature />
+ <sp:ProtectTokens />
+ <sp:OnlySignEntireHeadersAndBody />
+ <sp:IncludeTimestamp />
+ <sp:EncryptBeforeSigning />
+ <sp:EndorsingSupportingTokens>
+ <wsp:Policy>
+ <sp:X509Token
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:WssX509V1Token10 />
+ </wsp:Policy>
+ </sp:X509Token>
+ <sp:UsernameToken>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:WssUsernameToken10 />
+ <sp:WssUsernameToken11 />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:UsernameToken>
+ <sp:KerberosToken
+ sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once">
+ <wsp:Policy>
+ <sp:WssGssKerberosV5ApReqToken11 />
+ </wsp:Policy>
+ </sp:KerberosToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <sp:TripleDes />
+ <sp:Basic256 />
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:EncryptedParts>
+ <sp:Body />
+ <sp:Header Name="myEncryptedPartsA"
+ Namespace="http://myNamespaceA" />
+ <sp:Header Name="myEncryptedPartsB"
+ Namespace="http://myNamespaceB" />
+ <sp:Header Namespace="http://myNamespaceC" />
+ </sp:EncryptedParts>
+ <sp:SignedElements
+ sp:XPathVersion="http://www.w3.org/TR/1999/REC-xpath-19991116">
+ <sp:XPath>A/*</sp:XPath>
+ <sp:XPath>B/*</sp:XPath>
+ <sp:XPath>C/*</sp:XPath>
+ </sp:SignedElements>
+ <sp:SignedParts>
+ <sp:Body />
+ <sp:Header Name="mySignedPartsB"
+ Namespace="http://myNamespaceB" />
+ <sp:Header Name="mySignedPartsA"
+ Namespace="http://myNamespaceA" />
+ <sp:Header Namespace="http://myNamespaceC" />
+ </sp:SignedParts>
+ <sp:EncryptedElements
+ sp:XPathVersion="http://www.w3.org/2002/06/xmldsig-filter2">
+ <sp:XPath>X/*</sp:XPath>
+ <sp:XPath>Y/*</sp:XPath>
+ <sp:XPath>Z/*</sp:XPath>
+ </sp:EncryptedElements>
+ </wsp:Policy>
+ </sp:EndorsingSupportingTokens>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_All.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_All.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_All.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_All.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,17 @@
+<wsp:Policy wsu:Id="Policy_NestedAssertion_EO"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:form="http://policy.test.webservices.com/form"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <form:Quantity>10</form:Quantity>
+ <form:Widget>
+ <form:Shape>Square</form:Shape>
+ <wsp:Policy>
+ <wsp:All>
+ <form:Size>Large</form:Size
+ <form:Color>Red</form:Color>
+ </wsp:All>
+ </wsp:Policy>
+ </form:Widget>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_EO.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_EO.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_EO.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_NestedAssertion_EO.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,18 @@
+<wsp:Policy wsu:Id="Policy_NestedAssertion_EO"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:form="http://policy.test.webservices.com/form"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <form:Shape>Circle</form:Shape>
+ <form:Widget>
+ <form:Size>Small</form:Size>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <form:Color>Green</form:Color>
+ <form:Color>Blue</form:Color>
+ <form:Color>Red</form:Color>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </form:Widget>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllMany.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllMany.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllMany.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllMany.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,13 @@
+<wsp:Policy wsu:Id="Policy_Optional_AllMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:All>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log wsp:Optional="true">ID</cal:Log>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay wsp:Optional="1">Numeric</cal:MonthDay>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllSingle.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllSingle.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllSingle.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_AllSingle.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,9 @@
+<wsp:Policy wsu:Id="Policy_Optional_AllMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:All>
+ <cal:Hour wsp:Optional="true">24</cal:Hour>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOMany.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOMany.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOMany.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOMany.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,13 @@
+<wsp:Policy wsu:Id="Policy_Optional_EOMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log wsp:Optional="true">ID</cal:Log>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay wsp:Optional="true">Numeric</cal:MonthDay>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOSingle.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOSingle.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOSingle.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_EOSingle.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,9 @@
+<wsp:Policy wsu:Id="Policy_Optional_EOSingle"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <cal:Hour wsp:Optional="true">24</cal:Hour>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_Explosion.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_Explosion.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_Explosion.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_Explosion.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,26 @@
+<wsp:Policy wsu:Id="Policy_Optional_Explosion"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:util="http://policy.test.webservices.com/util"
+ xmlns:form="http://policy.test.webservices.com/form"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:All>
+ <cal:Second wsp:Optional="true">Numeric</cal:Second>
+ <cal:Minute wsp:Optional="true">Numeric</cal:Minute>
+ <cal:Hour wsp:Optional="true">24</cal:Hour>
+ <cal:Log wsp:Optional="true">ID</cal:Log>
+ <cal:Month wsp:Optional="true">Alpha</cal:Month>
+ <cal:MonthDay wsp:Optional="true">Numeric</cal:MonthDay>
+ <cal:YearDay wsp:Optional="true">Numeric</cal:YearDay>
+ <cal:Year wsp:Optional="true">Numeric</cal:Year>
+ <cal:WeekDay wsp:Optional="true">Numeric</cal:WeekDay>
+ <cal:Day wsp:Optional="true">Alpha</cal:Day>
+ <util:Log wsp:Optional="true">Header</util:Log>
+ <util:Log wsp:Optional="true">Time</util:Log>
+ <util:Log wsp:Optional="true">ID</util:Log>
+ <form:Shape wsp:Optional="true">Circle</form:Shape>
+ <form:Size wsp:Optional="true">Small</form:Size>
+ <form:Color wsp:Optional="true">Green</form:Color>
+ </wsp:All>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_MixedNested.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_MixedNested.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_MixedNested.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_MixedNested.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,22 @@
+<wsp:Policy wsu:Id="Policy_Optional_MixedNested"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ Name="http://www.ibm.com/policies/TestID"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ cal:attributeA="A" cal:attributeB="B" cal:attributeC="C">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <cal:Hour wsp:Optional="true">24</cal:Hour>
+ <cal:Unknown>XXX</cal:Unknown>
+ </wsp:All>
+ <cal:Month wsp:Optional="true">UNSUPPORTED_XXX</cal:Month>
+ </wsp:ExactlyOne>
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ <cal:Unknown wsp:Optional="true">YYY</cal:Unknown>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:ExactlyOne>
+ <cal:MonthDay wsp:Optional="true">UNSUPPORTED_YYY</cal:MonthDay>
+ </wsp:Policy>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicyMany.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicyMany.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicyMany.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicyMany.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,13 @@
+<wsp:Policy wsu:Id="Policy_Optional_PolicyMany"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <cal:Hour>24</cal:Hour>
+ <cal:Log wsp:Optional="true">ID</cal:Log>
+ <cal:Month>Alpha</cal:Month>
+ <cal:MonthDay wsp:Optional="true">Numeric</cal:MonthDay>
+ <cal:YearDay>Numeric</cal:YearDay>
+ </wsp:Policy>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicySingle.xml
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicySingle.xml?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicySingle.xml (added)
+++ webservices/commons/trunk/modules/neethi/test-resources/base/Policy_Optional_PolicySingle.xml Tue May 9 03:30:07 2006
@@ -0,0 +1,9 @@
+<wsp:Policy wsu:Id="Policy_Optional_PolicySingle"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:cal="http://policy.test.webservices.com/calendar"
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:Policy>
+ <cal:Hour wsp:Optional="true">24</cal:Hour>
+ </wsp:Policy>
+</wsp:Policy>
+
Added: webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionPerm.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionPerm.java?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionPerm.java (added)
+++ webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionPerm.java Tue May 9 03:30:07 2006
@@ -0,0 +1,213 @@
+/*
+ * Copyright 2004,2006 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.policy;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
+import javax.xml.namespace.QName;
+import org.apache.ws.policy.*;
+
+/**
+ * <p>Class to represent an Assertion permutation.
+ * @version 1.0.0
+ */
+public class AssertionPerm {
+ private Assertion _perm[] = null;
+ private boolean _matched[] = null;
+ private boolean _allChecked = false;
+
+ public AssertionPerm(Assertion perm[]) {
+ _perm = perm;
+ int length = perm.length;
+ _matched = new boolean[perm.length];
+ for (int i = 0; i < _perm.length; i++) {
+ _matched[i] = false;
+ }
+ }
+
+ boolean isChecked() {
+ return _allChecked;
+ }
+
+ public void setChecked(boolean checked) {
+ _allChecked = checked;
+ }
+
+ public boolean matches(List alternative) {
+ // Special case an empty Alternative
+ if (_perm.length == 0) {
+ if (alternative.size() == 0) {
+ return true;
+ }
+ }
+ boolean outcome = false;
+ // Initialise the checked flag for each assertion
+ for (int i = 0; i < _perm.length; i++) {
+ _matched[i] = false;
+ }
+ int numberOfAltAssertions = 0;
+ for (int j = 0; j < alternative.size(); j++) {
+ PrimitiveAssertion ass = (PrimitiveAssertion) alternative.get(j);
+ numberOfAltAssertions++;
+ for (int i = 0; i < _perm.length; i++) {
+ // Only if it's not already been matched
+ if (_matched[i] != true) {
+ if (checkEquality((PrimitiveAssertion) ass, (PrimitiveAssertion) _perm[i]) == true) {
+ _matched[i] = true;
+ break;
+ }
+ }
+ }
+ }
+ // If we don't even have the same number, it doesn't matter
+ // how many have matched, it's not a full match.
+ if (_perm.length == numberOfAltAssertions) {
+
+ // Now check that all of the values in this permutation have
+ // been met. If so, flag this permutation as being checked.
+ for (int i = 0; i < _perm.length; i++) {
+ if (_matched[i] == false) {
+ break;
+ }
+ // If we got this far, it's all checked.
+ int j = i + 1;
+ if (j == _perm.length) {
+ outcome = true;
+ }
+ }
+ }
+ return outcome;
+ }
+
+ public boolean matches(Assertion[] valueArray) {
+
+ if (valueArray.length != _perm.length) {
+ return false;
+ }
+ boolean outcome = false;
+ for (int i = 0; i < _perm.length; i++) {
+ _matched[i] = false;
+ }
+
+ for (int j = 0; j < valueArray.length; j++) {
+ for (int i = 0; i < _perm.length; i++) {
+ // Only if it's not already been matched
+ if (_matched[i] != true) {
+ if (checkEquality((PrimitiveAssertion) valueArray[j], (PrimitiveAssertion) _perm[i]) == true) {
+ _matched[i] = true;
+ break;
+ }
+ }
+ }
+ }
+
+ // Now check that all of the values in this permutation have
+ // been met. If so, flag this permutation as being checked.
+ for (int i = 0; i < _perm.length; i++) {
+ if (_matched[i] == false) {
+ break;
+ }
+ // If we got this far, it's all checked.
+ int j = i + 1;
+ if (j == _perm.length) {
+ outcome = true;
+ }
+ }
+
+ return outcome;
+ }
+
+ boolean checkEquality(PrimitiveAssertion yours, PrimitiveAssertion ours) {
+ boolean matched = false;
+
+ if (ours.equals(yours)) {
+ matched = true;
+ } else if (ours.getName().equals(yours.getName())) {
+ String ourValue = ours.getStrValue();
+ String yourValue = yours.getStrValue();
+ if (ourValue == null) {
+ if (yourValue == null) {
+ if (equalAttributes(ours, yours)) {
+ matched = true;
+ }
+ }
+ } else {
+ if (ourValue.equals(yourValue)) {
+ if (equalAttributes(ours, yours)) {
+ matched = true;
+ }
+ }
+ }
+ }
+ return matched;
+ }
+
+ public String permToString() {
+ String result = "";
+ for (int i = 0; i < _perm.length; i++) {
+ result += _perm[i] + "\n";
+ }
+ return result;
+ }
+
+ public boolean equalAttributes(PrimitiveAssertion ours, PrimitiveAssertion yours) {
+
+ boolean result = true;
+ try {
+ Hashtable ourAttributes = ours.getAttributes();
+ Hashtable yourAttributes = yours.getAttributes();
+ if (ourAttributes.size() == yourAttributes.size()) {
+ int matchCount = 0;
+ // Go through each of ourNames and see if we have a match.
+ Enumeration ourKeys = ourAttributes.keys();
+ while (ourKeys.hasMoreElements()) {
+ QName ourQName = (QName) ourKeys.nextElement();
+ String yourValue = yours.getAttribute(ourQName);
+ if (yourValue == null) {
+ result = false;
+ break;
+ }
+ String ourValue = ours.getAttribute(ourQName);
+ if (!yourValue.equals(ourValue)) {
+ result = false;
+ break;
+ }
+ matchCount++;
+ }
+ if (matchCount != ourAttributes.size()) {
+ result = false;
+ }
+ } else {
+ result = false;
+ }
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ result = false;
+ }
+ return result;
+ }
+
+ public String toString() {
+ StringBuffer result = new StringBuffer("[Alternative]:");
+ for (int i = 0; i < _perm.length; i++) {
+ Assertion vpa = (Assertion) _perm[i];
+ result.append("{" + vpa.toString() + "}");
+ }
+ return result.toString();
+ }
+
+}
\ No newline at end of file
Added: webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionSet.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionSet.java?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionSet.java (added)
+++ webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/AssertionSet.java Tue May 9 03:30:07 2006
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2004,2006 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.policy;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.apache.ws.policy.*;
+
+/**
+ * <p>
+ * Class to represent a collection of PermValues.
+ *
+ * @version 1.0.0
+ */
+public class AssertionSet {
+ private Vector _values = new Vector();
+
+ public void clear() {
+ _values.clear();
+ }
+
+ public boolean isComplete() {
+ boolean outcome = true;
+
+ for (int i = 0; i < _values.size(); i++) {
+ AssertionPerm perm = (AssertionPerm) _values.elementAt(i);
+ if (perm.isChecked() == false) {
+ outcome = false;
+ break;
+ }
+ }
+ return outcome;
+ }
+
+ public void add(Assertion perm[]) {
+ AssertionPerm permValue = new AssertionPerm(perm);
+ _values.add(permValue);
+ }
+
+ public boolean contains(List alternative) {
+ boolean outcome = false;
+
+ for (int i = 0; i < _values.size(); i++) {
+ AssertionPerm permValue = (AssertionPerm) _values.elementAt(i);
+ // We allow duplicates, so this may well be a repeat
+ if (permValue.matches(alternative)) {
+ outcome = true;
+ permValue.setChecked(true);
+ break;
+ }
+ }
+ return outcome;
+ }
+
+ public boolean contains(Assertion[] array) {
+ boolean outcome = false;
+
+ for (int i = 0; i < _values.size(); i++) {
+ AssertionPerm permValue = (AssertionPerm) _values.elementAt(i);
+ if (permValue.matches(array)) {
+ outcome = true;
+ permValue.setChecked(true);
+ break;
+ }
+ }
+ return outcome;
+ }
+
+ // Special case where in fact you just want to match a single element.
+ public boolean contains(Assertion value) {
+ Assertion array[] = { value };
+ return contains(array);
+ }
+
+}
Added: webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/TestConstants.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/TestConstants.java?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/TestConstants.java (added)
+++ webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/TestConstants.java Tue May 9 03:30:07 2006
@@ -0,0 +1,238 @@
+/*
+ * Copyright 2004,2006 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.policy;
+
+/**
+ * <p>Common PUBLIC constants used throughout the package.
+ *
+ * @version 1.0.0
+ */
+public interface TestConstants {
+
+ /**
+ * Namespace for WS-Policy.
+ */
+ public static final String NAMESPACE_WSP = "http://schemas.xmlsoap.org/ws/2004/09/policy".intern();
+ /**
+ * Namespace for Web service utilities.
+ */
+ public static final String NAMESPACE_WSU =
+ "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern();
+
+ /**
+ * Namespace for Web service security.
+ */
+ public static final String NAMESPACE_WSSE =
+ "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd".intern();
+
+ /**
+ * Namespace for WS-SecurityPolicy.
+ */
+ public static final String NAMESPACE_WSE = "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy".intern();
+
+ /**
+ * Namespace for Web service addressing.
+ */
+ public static final String NAMESPACE_WSA = "http://schemas.xmlsoap.org/ws/2004/08/addressing".intern();
+
+ /**
+ * Namespace for WSDL
+ */
+ public static final String NAMESPACE_WSDL = "http://schemas.xmlsoap.org/wsdl/".intern();
+
+ /**
+ * Namespace for XML addressing.
+ */
+ public static final String NAMESPACE_XML = "http://www.w3.org/XML/1998/namespace".intern();
+
+ /**
+ * Namespace of xmlns prefix when defining namespace aliases
+ */
+ public static final String NAMESPACE_XMLNS = "http://www.w3.org/2000/xmlns/".intern();
+
+ /**
+ * Namespace definition
+ */
+ public static final String NAMESPACE_DEF = "http://www.w3.org/XML/1998/namespace".intern();
+
+ // ***********************************************************************
+ // Operator Constants
+ // ***********************************************************************
+ /**
+ * WS-Policy <i>All</i> Operator String value.
+ */
+ public static final String OPERATOR_ALL = "All".intern();
+ /**
+ * WS-Policy <i>ExactlyOne</i> Operator String value.
+ */
+ public static final String OPERATOR_EXACTLYONE = "ExactlyOne".intern();
+ /**
+ * WS-Policy <i>Policy</i> Operator String value.
+ */
+ public static final String OPERATOR_POLICY = "Policy".intern();
+ /**
+ * WS-Policy <i>Optional</i> attribute String value.
+ */
+ public static final String ATTRIBUTE_OPTIONAL = "Optional".intern();
+ // ***********************************************************************
+ // Element constants
+ // ***********************************************************************
+ /**
+ * WS-Policy <i>Policy</i> Element String value.
+ */
+ public static final String ELEMENT_POLICY = "Policy".intern();
+ /**
+ * WS-Policy <i>PolicyReference</i> Element String value.
+ */
+ public static final String ELEMENT_POLICYREF = "PolicyReference".intern();
+
+ // ***********************************************************************
+ // AppliesTo Constants
+ //
+ // These constants refer to constants used in the definition of
+ // scope in the AppliesTo class.
+ // ***********************************************************************
+ /**
+ * AppliesTo attribute to identify <code>WS-Addressing</code> Object.
+ */
+ public static final String ATTACH_ENDPOINT = "EndpointReference".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL service at which Policy is attached.
+ */
+ public static final String ATTACH_SERVICE = "Service".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL portType definition at which Policy is attached.
+ */
+ public static final String ATTACH_PORTTYPE = "PortType".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL binding at which Policy is attached.
+ */
+ public static final String ATTACH_BINDING = "Binding".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL operation at which Policy is attached.
+ */
+ public static final String ATTACH_OPERATION = "Operation".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL input message at which Policy is attached.
+ */
+ public static final String ATTACH_INPUT = "Input".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL output message at which Policy is attached.
+ */
+ public static final String ATTACH_OUTPUT = "Output".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL fault message at which Policy is attached.
+ */
+ public static final String ATTACH_FAULT = "Fault".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL port at which Policy is attached.
+ */
+ public static final String ATTACH_PORT = "Port".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL message definition at which Policy is attached.
+ */
+ public static final String ATTACH_MESSAGE = "Message".intern();
+
+ /**
+ * AppliesTo attribute to identify name of WSDL message part definition at which Policy is attached.
+ */
+ public static final String ATTACH_ADDRESS = "Address".intern();
+
+ /**
+ * AppliesTo attribute to identify name of WSDL message part definition at which Policy is attached.
+ */
+ public static final String ATTACH_SERVICENAME = "ServiceName".intern();
+
+ /**
+ * AppliesTo attribute to identify name of WSDL operation at which Policy is attached.
+ */
+ public static final String ATTACH_BINDING_OPERATION = "BindingOperation".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL input message at which Policy is attached.
+ */
+ public static final String ATTACH_BINDING_INPUT = "BindingInput".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL output message at which Policy is attached.
+ */
+ public static final String ATTACH_BINDING_OUTPUT = "BindingOutput".intern();
+ /**
+ * AppliesTo attribute to identify name of WSDL fault message at which Policy is attached.
+ */
+ public static final String ATTACH_BINDING_FAULT = "BindingFault".intern();
+
+ // **************************************************************************
+ // * Domain specific constants
+ // **************************************************************************
+ public static String NAMESPACE_CAL = "http://policy.test.webservices.com/calendar";
+ public static String NAMESPACE_UTIL = "http://policy.test.webservices.com/util";
+ public static String NAMESPACE_FORM = "http://policy.test.webservices.com/form";
+
+ // These are some of the predefined values for the assertions.
+ public static String VALUE_NUMERIC = "Numeric";
+ public static String VALUE_ALPHA = "Alpha";
+ public static String VALUE_24_HOUR = "24";
+ public static String VALUE_12_HOUR = "12";
+ public static String VALUE_ID = "ID";
+ public static String VALUE_TIME = "Time";
+ public static String VALUE_RED = "Red";
+ public static String VALUE_GREEN = "Green";
+ public static String VALUE_BLUE = "Blue";
+ public static String VALUE_LARGE = "Large";
+ public static String VALUE_MEDIUM = "Medium";
+ public static String VALUE_SMALL = "Small";
+ public static String VALUE_SQUARE = "Square";
+ public static String VALUE_CIRCLE = "Circle";
+ public static String VALUE_TRIANGLE = "Triangle";
+
+ // These are the supported Assertions (local names)
+ public static String ASSERTION_MINUTE = "Minute";
+ public static String ASSERTION_SECOND = "Second";
+ public static String ASSERTION_HOUR = "Hour";
+ public static String ASSERTION_MONTH = "Month";
+ public static String ASSERTION_YEAR = "Year";
+ public static String ASSERTION_LOG = "Log";
+ public static String ASSERTION_UNKNOWN = "Unknown";
+ public static String ASSERTION_YEAR_DAY = "YearDay";
+ public static String ASSERTION_WEEK_DAY = "WeekDay";
+ public static String ASSERTION_MONTH_DAY = "MonthDay";
+ public static String ASSERTION_DAY = "Day";
+ public static String ASSERTION_ZONE = "Zone";
+
+ public static String ASSERTION_WIDGET = "Widget";
+ public static String ASSERTION_COLOR = "Color";
+ public static String ASSERTION_SHAPE = "Shape";
+ public static String ASSERTION_SIZE = "Size";
+ public static String ASSERTION_QUANTITY = "Quantity";
+
+ // These are more complex ones
+ public static String ASSERTION_RANGE = "Range";
+ public static String ASSERTION_SET = "Set";
+
+ // Supported RANGE attributes
+ public static String RANGE_ATTRIBUTE_TYPE = "type";
+ public static String RANGE_ATTRIBUTE_LOWER = "lower";
+ public static String RANGE_ATTRIBUTE_UPPER = "upper";
+ //Supported RANGE TYPE values
+ public static String RANGE_TYPE_YEAR = ASSERTION_YEAR;
+ public static String RANGE_TYPE_HOUR = ASSERTION_HOUR;
+
+ // Supported SET attributes
+ public static String SET_ATTRIBUTE_TYPE = "type";
+ public static String SET_ATTRIBUTE_VALUES = "values";
+ //Supported SET TYPE values
+ public static String SET_TYPE_MONTH = ASSERTION_MONTH;
+
+}
Added: webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_JIRA14.java
URL: http://svn.apache.org/viewcvs/webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_JIRA14.java?rev=405377&view=auto
==============================================================================
--- webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_JIRA14.java (added)
+++ webservices/commons/trunk/modules/neethi/test2/org/apache/ws/policy/Test_JIRA14.java Tue May 9 03:30:07 2006
@@ -0,0 +1,276 @@
+/*
+ * Copyright 2004,2006 The Apache Software Foundation.
+ *
+ * Licensed 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.ws.policy;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Vector;
+
+import javax.xml.namespace.QName;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.policy.Policy;
+import org.apache.ws.policy.PrimitiveAssertion;
+import org.apache.ws.policy.util.PolicyComparator;
+import org.apache.ws.policy.util.PolicyFactory;
+import org.apache.ws.policy.util.PolicyReader;
+import org.apache.ws.policy.util.PolicyUtil;
+import org.apache.ws.policy.util.PolicyWriter;
+
+public class Test_JIRA14 extends TestCase {
+
+ QName q1 = new QName("http://www.apache.org/policyTest", "q1");
+ QName q2 = new QName("http://www.apache.org/policyTest", "q2");
+ QName q3 = new QName("http://www.apache.org/policyTest", "q3");
+ QName q4 = new QName("http://www.apache.org/policyTest", "q4");
+
+ /**
+ * Constructor
+ */
+ public Test_JIRA14(String name) {
+ super(name);
+ }
+
+ public void testAddAttribute() {
+ try {
+ String myId = "myId";
+ Policy pol = new Policy(myId);
+ assertTrue("INCORRECT Id", pol.getId().equals(myId));
+
+ pol.addAttribute(q1, "First");
+ pol.addAttribute(q2, "Second");
+ pol.addAttribute(q3, "Third");
+ pol.addAttribute(q4, "Fourth");
+
+ Hashtable attributes = pol.getAttributes();
+ String value = null;
+ assertTrue("Attribute number check [" + attributes.size() + "]",
+ attributes.size() == 5);
+
+ value = pol.getAttribute(q4);
+ assertTrue("Attribute value check for [Fourth]", value.equals("Fourth"));
+ value = pol.getAttribute(q1);
+ assertTrue("Attribute value check for [First]", value.equals("First"));
+ value = pol.getAttribute(q3);
+ assertTrue("Attribute value check for [Third]", value.equals("Third"));
+ value = pol.getAttribute(q2);
+ assertTrue("Attribute value check for [Second]", value.equals("Second"));
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public void testRemoveAttribute() {
+ try {
+ String myId = "myId";
+ Policy pol = new Policy(myId);
+ assertTrue("INCORRECT Id", pol.getId().equals(myId));
+
+ pol.addAttribute(q1, "First");
+ String value = pol.getAttribute(q1);
+ assertTrue("Attribute value check", value.equals("First"));
+ pol.removeAttribute(q1);
+ Hashtable attributes = pol.getAttributes();
+ assertTrue("Should be no attributes", attributes.size() == 1);
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public void testOverwriteAttribute() {
+ try {
+ String myId = "myId";
+ Policy pol = new Policy(myId);
+ assertTrue("INCORRECT Id", pol.getId().equals(myId));
+
+ String newId = "newId";
+ pol.setId(newId);
+ assertTrue("INCORRECT Id from overwrite", pol.getId().equals(newId));
+
+ pol.addAttribute(q1, "First");
+ String value = pol.getAttribute(q1);
+ assertTrue("Attribute value check", value.equals("First"));
+
+ pol.addAttribute(q1, "Overwrite");
+ value = pol.getAttribute(q1);
+ assertTrue("Attribute value check", value.equals("Overwrite"));
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public void testUnknownAttribute() {
+
+ try {
+ String myId = "myId";
+ Policy pol = new Policy(myId);
+ assertTrue("INCORRECT Id", pol.getId().equals(myId));
+
+ String value = pol.getAttribute(q1);
+ assertTrue("Unexpected value [" + value + "] from q1", value == null);
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public void testClearAllAttributes() {
+ try {
+ String myId = "myId";
+ Policy pol = new Policy(myId);
+ assertTrue("INCORRECT Id", pol.getId().equals(myId));
+
+ pol.addAttribute(q1, "First");
+ pol.addAttribute(q2, "Second");
+ pol.addAttribute(q3, "Third");
+ pol.addAttribute(q4, "Fourth");
+
+ Hashtable attributes = pol.getAttributes();
+ String value = null;
+ assertTrue("Attribute number check [" + attributes.size() + "]",
+ attributes.size() == 5);
+
+ pol.clearAttributes();
+
+ attributes = pol.getAttributes();
+ assertTrue("Should be no attributes", attributes.size() == 0);
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public void testCompleteAttributes() {
+ try {
+ String myId = "myId";
+ Policy pol = new Policy(myId);
+ assertTrue("INCORRECT Id", pol.getId().equals(myId));
+
+ Hashtable myHashtable = new Hashtable();
+
+ myHashtable.put(q1, "First");
+ myHashtable.put(q2, "Second");
+ myHashtable.put(q3, "Third");
+ myHashtable.put(q4, "Fourth");
+
+ pol.setAttributes(myHashtable);
+
+ Hashtable attributes = pol.getAttributes();
+ String value = null;
+ assertTrue("Attribute number check [" + attributes.size() + "]",
+ attributes.size() == 4);
+
+ value = (String) attributes.get((Object) q4);
+ assertTrue("Attribute value check for [Fourth]", value.equals("Fourth"));
+ value = (String) attributes.get((Object) q1);
+ assertTrue("Attribute value check for [First]", value.equals("First"));
+ value = (String) attributes.get((Object) q3);
+ assertTrue("Attribute value check for [Third]", value.equals("Third"));
+ value = (String) attributes.get((Object) q2);
+ assertTrue("Attribute value check for [Second]", value.equals("Second"));
+
+ pol.clearAttributes();
+
+ attributes = pol.getAttributes();
+ assertTrue("Should be no attributes", attributes.size() == 0);
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public void testReadAttributes() {
+ try {
+ File f = new File("test-resources/base/Policy_Optional_MixedNested.xml");
+ FileInputStream in = new FileInputStream(f);
+ PolicyReader pReader = PolicyFactory
+ .getPolicyReader(PolicyFactory.OM_POLICY_READER);
+ Policy pol = pReader.readPolicy(in);
+
+ QName qNameA = new QName(TestConstants.NAMESPACE_CAL, "attributeA");
+ QName qNameB = new QName(TestConstants.NAMESPACE_CAL, "attributeB");
+ QName qNameC = new QName(TestConstants.NAMESPACE_CAL, "attributeC");
+
+ assertTrue("Attribute B INCORRECT", pol.getAttribute(qNameB).equals("B"));
+ assertTrue("Attribute A INCORRECT", pol.getAttribute(qNameA).equals("A"));
+ assertTrue("Attribute C INCORRECT", pol.getAttribute(qNameC).equals("C"));
+
+ // Now do the same for DOM ...
+ f = new File("test-resources/base/Policy_Optional_MixedNested.xml");
+ in = new FileInputStream(f);
+ pReader = PolicyFactory.getPolicyReader(PolicyFactory.DOM_POLICY_READER);
+ pol = pReader.readPolicy(in);
+
+ assertTrue("Attribute B INCORRECT", pol.getAttribute(qNameB).equals("B"));
+ assertTrue("Attribute A INCORRECT", pol.getAttribute(qNameA).equals("A"));
+ assertTrue("Attribute C INCORRECT", pol.getAttribute(qNameC).equals("C"));
+
+ // Write it out ...
+ PolicyWriter pWriter = PolicyFactory
+ .getPolicyWriter(PolicyFactory.StAX_POLICY_WRITER);
+ File tempFile = buildFile("tempFile");
+ FileOutputStream fos = new FileOutputStream(tempFile);
+ pWriter.writePolicy(pol, fos);
+
+ // Read it back ... it should have the same attributes
+ in = new FileInputStream(tempFile);
+ pReader = PolicyFactory.getPolicyReader(PolicyFactory.OM_POLICY_READER);
+ Policy polRead = pReader.readPolicy(in);
+
+ assertTrue("Attribute B INCORRECT", pol.getAttribute(qNameB).equals("B"));
+ assertTrue("Attribute A INCORRECT", pol.getAttribute(qNameA).equals("A"));
+ assertTrue("Attribute C INCORRECT", pol.getAttribute(qNameC).equals("C"));
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("Unexpected exception: " + ex.toString());
+ fail();
+ }
+ }
+
+ public static void main(String[] args) {
+ WSPTestSuite suite = new WSPTestSuite(Test_JIRA14.class);
+ suite.run();
+ }
+
+ private File buildFile(String fileName) {
+ File file = null;
+ try {
+ String sep = System.getProperty("file.separator");
+ String fullFile = "." + sep + fileName + ".xml";
+
+ file = new File(fullFile);
+
+ } catch (Exception ex) {
+ WSPTestSuite.logInfo("buildFile: Unexpected exception: " + ex.toString());
+ fail();
+ }
+ return file;
+ }
+
+}
\ No newline at end of file