Author: sanka
Date: Sun Nov 12 02:22:54 2006
New Revision: 473914
URL: http://svn.apache.org/viewvc?view=rev&rev=473914
Log:
Applied few patches uploaded in JIRA
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/ws/policy/Policy.java
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/ws/policy/util/PolicyComparator.java
webservices/commons/trunk/modules/neethi/src/test/test2/org/apache/ws/policy/Test_EffectivePolicy.java
Modified:
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/ws/policy/Policy.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/main/java/org/apache/ws/policy/Policy.java?view=diff&rev=473914&r1=473913&r2=473914
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/ws/policy/Policy.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/main/java/org/apache/ws/policy/Policy.java
Sun Nov 12 02:22:54 2006
@@ -44,17 +44,6 @@
}
/**
- * Creates a policy object with the specified Id
- *
- * @param id
- * a string as the id
- */
- public Policy(String id) {
- this(null, id);
- setNormalized(false);
- }
-
- /**
* Creates a policy object with the specified xml-base and id.
*
* @param xmlBase
@@ -62,36 +51,12 @@
* @param id
* a string as the id
*/
- public Policy(String xmlBase, String id) {
- setBase(xmlBase);
+ public Policy(String id) {
setId(id);
setNormalized(false);
}
/**
- * Set the xml-base of the policy object
- *
- * @param xmlBase
- * the xml base of the policy object
- */
- public void setBase(String xmlBase) {
- addAttribute(new QName(PolicyConstants.XML_NAMESPACE_URI,
- PolicyConstants.POLICY_BASE), xmlBase);
- }
-
- /**
- * Returns the xml-base of the policy object. Returns null if no xml-base
is
- * set.
- *
- * @return xml base of the policy object
- */
- public String getBase() {
- return (String) getAttribute(new QName(
- PolicyConstants.XML_NAMESPACE_URI,
- PolicyConstants.POLICY_BASE));
- }
-
- /**
* Sets the id of the Policy object
*
* @param id
@@ -141,9 +106,6 @@
*/
public String getPolicyURI() {
if (getId() != null) {
- if (getBase() != null) {
- return getBase() + "#" + getId();
- }
return "#" + getId();
}
return null;
@@ -160,9 +122,8 @@
return this;
}
- String xmlBase = getBase();
String id = getId();
- Policy policy = new Policy(xmlBase, id);
+ Policy policy = new Policy(id);
All all = new All();
ExactlyOne exactlyOne = new ExactlyOne();
@@ -467,7 +428,36 @@
public Iterator iterator() {
return new PolicyIterator(this);
}
-
+ /**
+ * Returns the vocabulary of this Policy.
+ *
+ * @return List of QNames of assertions in this Policy
+ */
+ public List getVocabulary(){
+ return getVocabulary(this);
+ }
+
+ private List getVocabulary(Assertion assertion){
+
+ List result = new ArrayList();
+ if (assertion instanceof CompositeAssertion){
+ List subAssertion = assertion.getTerms();
+ Iterator itr = subAssertion.iterator();
+ while (itr.hasNext()){
+ List vocab = getVocabulary((Assertion)itr.next());
+ result.removeAll(vocab);
+ result.addAll(vocab);
+ }
+ } else {
+ if (assertion instanceof PrimitiveAssertion){
+ result.remove(((PrimitiveAssertion)assertion).getName());
+ result.add(((PrimitiveAssertion)assertion).getName());
+ }
+ }
+
+ return result;
+ }
+
private class PolicyIterator implements java.util.Iterator {
private ExactlyOne exactlyOne = null;
Modified:
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/ws/policy/util/PolicyComparator.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/test/java/org/apache/ws/policy/util/PolicyComparator.java?view=diff&rev=473914&r1=473913&r2=473914
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/ws/policy/util/PolicyComparator.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/test/java/org/apache/ws/policy/util/PolicyComparator.java
Sun Nov 12 02:22:54 2006
@@ -42,17 +42,6 @@
}
}
- if (arg1.getBase() == null && arg2.getBase() != null
- || arg1.getBase() != null && arg1.getBase() ==
null) {
- return false;
- }
-
- if (arg1.getBase() != null) {
- if (!arg1.getBase().equals(arg2.getBase())) {
- return false;
- }
- }
-
return compare(arg1.getTerms(), arg2.getTerms());
}
Modified:
webservices/commons/trunk/modules/neethi/src/test/test2/org/apache/ws/policy/Test_EffectivePolicy.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/neethi/src/test/test2/org/apache/ws/policy/Test_EffectivePolicy.java?view=diff&rev=473914&r1=473913&r2=473914
==============================================================================
---
webservices/commons/trunk/modules/neethi/src/test/test2/org/apache/ws/policy/Test_EffectivePolicy.java
(original)
+++
webservices/commons/trunk/modules/neethi/src/test/test2/org/apache/ws/policy/Test_EffectivePolicy.java
Sun Nov 12 02:22:54 2006
@@ -8,9 +8,11 @@
import javax.xml.namespace.QName;
import org.apache.ws.policy.attachment.WSDLPolicyProcessor;
+import org.apache.ws.policy.util.ExtraUtil;
import org.apache.ws.policy.util.PolicyFactory;
import org.apache.ws.policy.util.PolicyReader;
import org.apache.ws.policy.util.PolicyRegistry;
+import org.apache.ws.policy.util.PolicyUtil;
public class Test_EffectivePolicy extends PolicyTestCase {
@@ -193,28 +195,21 @@
QName service = new QName(ns, "MyService");
Iterator it = null;
- Policy normPolOperation = wpp.getEffectiveOperationPolicy(service,
- "MyPort", "MyOperation");
+ Policy normPolOperation = wpp.getEffectiveOperationPolicy(service,
+ "MyPort", "MyOperation");
it = normPolOperation.iterator();
- PrimitiveAssertion yearDay = new PrimitiveAssertion(new QName(
- TestConstants.NAMESPACE_CAL,
- TestConstants.ASSERTION_YEAR_DAY));
- yearDay.setStrValue(TestConstants.VALUE_NUMERIC);
PrimitiveAssertion hour = new PrimitiveAssertion(new QName(
TestConstants.NAMESPACE_CAL,
TestConstants.ASSERTION_HOUR));
hour.setStrValue(TestConstants.VALUE_NUMERIC);
PrimitiveAssertion day = new PrimitiveAssertion(new QName(
TestConstants.NAMESPACE_CAL, TestConstants.ASSERTION_DAY));
day.setStrValue(TestConstants.VALUE_ALPHA);
- PrimitiveAssertion logTime = new PrimitiveAssertion(new QName(
- TestConstants.NAMESPACE_UTIL,
TestConstants.ASSERTION_LOG));
- logTime.setStrValue(TestConstants.VALUE_TIME);
-
+
AssertionSet set = new AssertionSet();
- PrimitiveAssertion p1[] = { yearDay, logTime, hour };
- PrimitiveAssertion p2[] = { yearDay, logTime, day };
+ PrimitiveAssertion p1[] = { hour };
+ PrimitiveAssertion p2[] = { day };
set.clear();
set.add(p1);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]