You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by da...@apache.org on 2007/05/14 08:46:56 UTC

svn commit: r537733 - in /webservices/axis2/scratch/java/davidillsley: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/axis2/ src/main/java/org/apache/axis2/addressing/ src/main/java/org/apache/axi...

Author: davidillsley
Date: Sun May 13 23:46:55 2007
New Revision: 537733

URL: http://svn.apache.org/viewvc?view=rev&rev=537733
Log:
Initial work on WS-A Metadata/Policy support

Added:
    webservices/axis2/scratch/java/davidillsley/pom.xml
    webservices/axis2/scratch/java/davidillsley/simple.xml
    webservices/axis2/scratch/java/davidillsley/src/
    webservices/axis2/scratch/java/davidillsley/src/main/
    webservices/axis2/scratch/java/davidillsley/src/main/java/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertion.java
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertionBuilder.java
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/AnonymousAssertion.java
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/CompactAddressingAssertion.java
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NonAnonymousAssertion.java
    webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NormalisedAddressingAssertion.java
    webservices/axis2/scratch/java/davidillsley/src/main/resources/
    webservices/axis2/scratch/java/davidillsley/src/test/
    webservices/axis2/scratch/java/davidillsley/src/test/java/
    webservices/axis2/scratch/java/davidillsley/src/test/java/AddressingAssertionTests.java
    webservices/axis2/scratch/java/davidillsley/src/test/resources/

Added: webservices/axis2/scratch/java/davidillsley/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/pom.xml?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/pom.xml (added)
+++ webservices/axis2/scratch/java/davidillsley/pom.xml Sun May 13 23:46:55 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>addressing-policy</groupId>
+  <artifactId>addressing-policy</artifactId>
+  <version>0.0.1</version>
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.ws.commons.neethi</groupId>
+      <artifactId>neethi</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.ws.commons.neethi</groupId>
+      <artifactId>neethi</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+</project>
+

Added: webservices/axis2/scratch/java/davidillsley/simple.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/simple.xml?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/simple.xml (added)
+++ webservices/axis2/scratch/java/davidillsley/simple.xml Sun May 13 23:46:55 2007
@@ -0,0 +1,14 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+    <wsam:Addressing wsp:Optional="true" xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata" wsp:Ignorable="true">
+        <wsp:Policy>
+        	<wsp:ExactlyOne>
+        	<wsp:All>
+	        	<wsam:Anonymous/>
+        	</wsp:All>
+        	<wsp:All>
+	        	<wsam:NonAnonymous wsp:Optional="true" />
+        	</wsp:All>
+        	</wsp:ExactlyOne> 
+        </wsp:Policy>
+    </wsam:Addressing>
+</wsp:Policy>
\ No newline at end of file

Added: webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertion.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertion.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertion.java Sun May 13 23:46:55 2007
@@ -0,0 +1,18 @@
+/*
+ * 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.axis2.addressing.policy;
+
+public interface AddressingAssertion {
+	public boolean isResponseCombinationAllowed(boolean anonymous, boolean nonAnonymous);
+}

Added: webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertionBuilder.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertionBuilder.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/AddressingAssertionBuilder.java Sun May 13 23:46:55 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.axis2.addressing.policy;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.policy.impl.CompactAddressingAssertion;
+import org.apache.axis2.addressing.policy.impl.AnonymousAssertion;
+import org.apache.axis2.addressing.policy.impl.NonAnonymousAssertion;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.AssertionBuilderFactory;
+import org.apache.neethi.builders.AssertionBuilder;
+
+public class AddressingAssertionBuilder implements AssertionBuilder {
+
+	public Assertion build(OMElement element, AssertionBuilderFactory factory)
+			throws IllegalArgumentException {
+		if(element.getQName().equals(CompactAddressingAssertion.ADDRESSING_ASSERTION)){
+			return new CompactAddressingAssertion(element);
+		}
+		if(element.getQName().equals(AnonymousAssertion.ANONYMOUS_ASSERTION)){
+			return new AnonymousAssertion(element);
+		}
+		if(element.getQName().equals(NonAnonymousAssertion.NON_ANONYMOUS_ASSERTION)){
+			return new NonAnonymousAssertion(element);
+		}
+		throw new IllegalArgumentException();
+	}
+
+	public QName[] getKnownElements() {
+		return new QName[]{CompactAddressingAssertion.ADDRESSING_ASSERTION, AnonymousAssertion.ANONYMOUS_ASSERTION, NonAnonymousAssertion.NON_ANONYMOUS_ASSERTION};
+	}
+
+}

Added: webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/AnonymousAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/AnonymousAssertion.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/AnonymousAssertion.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/AnonymousAssertion.java Sun May 13 23:46:55 2007
@@ -0,0 +1,35 @@
+/*
+ * 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.axis2.addressing.policy.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.builders.xml.XmlPrimtiveAssertion;
+
+
+public class AnonymousAssertion extends XmlPrimtiveAssertion{
+
+	public static final QName ANONYMOUS_ASSERTION =  new QName("http://www.w3.org/2007/02/addressing/metadata", "Anonymous", "wsam");
+	
+	public AnonymousAssertion(OMElement element) {
+		super(element);
+	}
+	
+	public PolicyComponent normalize(boolean isDeep) {
+		// No depth here, just do a standard normalisation
+        return normalize();
+    }
+}
\ No newline at end of file

Added: webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/CompactAddressingAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/CompactAddressingAssertion.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/CompactAddressingAssertion.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/CompactAddressingAssertion.java Sun May 13 23:46:55 2007
@@ -0,0 +1,124 @@
+/*
+ * 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.axis2.addressing.policy.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.PolicyEngine;
+
+public class CompactAddressingAssertion implements Assertion, org.apache.axis2.addressing.policy.AddressingAssertion {
+
+	public static final QName ADDRESSING_ASSERTION =  new QName("http://www.w3.org/2007/02/addressing/metadata", "Addressing", "wsam");
+	
+	private boolean isOptional = true;
+	private Policy nestedPolicy = null;
+	private OMElement omElement = null;
+	
+	public CompactAddressingAssertion(OMElement element){
+		String optionalString = element.getAttributeValue(Constants.Q_ELEM_OPTIONAL_ATTR);
+		if(optionalString == null || "false".equals(optionalString)){
+			isOptional = false;
+		}
+		omElement = element;
+		nestedPolicy = new Policy();
+
+		OMElement nestedPolicyElement = (OMElement)element.getFirstChildWithName(Constants.Q_ELEM_POLICY);
+		if(nestedPolicyElement != null){
+			nestedPolicy = PolicyEngine.getPolicy(nestedPolicyElement);
+		}
+	}
+	
+	public QName getName() {
+		return ADDRESSING_ASSERTION;
+	}
+
+	public boolean isOptional() {
+		return isOptional;
+	}
+
+	public PolicyComponent normalize() {
+		ArrayList<OMAttribute> nonoptatts = new ArrayList<OMAttribute>();
+		Iterator<OMAttribute> tatts = omElement.getAllAttributes();
+		while(tatts.hasNext()){
+			OMAttribute oma = tatts.next();
+			if(!Constants.Q_ELEM_OPTIONAL_ATTR.equals(oma.getQName())){
+				nonoptatts.add(oma);
+			}
+		}
+
+		Policy normalisedPolicy = (Policy)nestedPolicy.normalize(true);
+		Iterator<List<Assertion>> iter = (Iterator<List<Assertion>>)normalisedPolicy.getAlternatives();
+
+		Policy policy = new Policy();
+		ExactlyOne exactlyOne = new ExactlyOne();
+
+		while(iter.hasNext()){
+			All all = new All();
+			all.addPolicyComponent(new NormalisedAddressingAssertion(iter.next(), nonoptatts));
+			exactlyOne.addPolicyComponent(all);
+		}
+		if (isOptional) {
+			exactlyOne.addPolicyComponent(new All());
+		}
+		policy.addPolicyComponent(exactlyOne);
+
+		return policy;
+	}
+
+	public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+		omElement.serialize(writer);
+	}
+
+	public boolean equal(PolicyComponent policyComponent) {
+		if(policyComponent instanceof CompactAddressingAssertion){
+			return normalize().equals(((CompactAddressingAssertion)policyComponent).normalize());
+		}
+		return false;
+	}
+
+	public short getType() {
+		return Constants.TYPE_ASSERTION;
+	}
+
+	public boolean isResponseCombinationAllowed(boolean anonymous, boolean nonAnonymous) {
+		boolean result = false;
+		Policy p = (Policy)normalize();
+		Iterator<List<Assertion>> iter = (Iterator<List<Assertion>>)p.getAlternatives();
+		while(iter.hasNext() && !result){
+			for(Assertion a: iter.next()){
+				if(a instanceof org.apache.axis2.addressing.policy.AddressingAssertion){
+					if(((org.apache.axis2.addressing.policy.AddressingAssertion)a).isResponseCombinationAllowed(anonymous, nonAnonymous)){
+						result = true;
+					}
+				}
+			}
+		}
+		return result;
+	}
+
+}

Added: webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NonAnonymousAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NonAnonymousAssertion.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NonAnonymousAssertion.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NonAnonymousAssertion.java Sun May 13 23:46:55 2007
@@ -0,0 +1,34 @@
+/*
+ * 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.axis2.addressing.policy.impl;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.neethi.PolicyComponent;
+import org.apache.neethi.builders.xml.XmlPrimtiveAssertion;
+
+public class NonAnonymousAssertion extends XmlPrimtiveAssertion{
+	
+	public static final QName NON_ANONYMOUS_ASSERTION =  new QName("http://www.w3.org/2007/02/addressing/metadata", "NonAnonymous", "wsam");
+	
+	public NonAnonymousAssertion(OMElement element) {
+		super(element);
+	}
+	
+	public PolicyComponent normalize(boolean isDeep) {
+		// No depth here, just do a standard normalisation
+        return normalize();
+    }
+}
\ No newline at end of file

Added: webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NormalisedAddressingAssertion.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NormalisedAddressingAssertion.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NormalisedAddressingAssertion.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/main/java/org/apache/axis2/addressing/policy/impl/NormalisedAddressingAssertion.java Sun May 13 23:46:55 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.axis2.addressing.policy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.neethi.All;
+import org.apache.neethi.Assertion;
+import org.apache.neethi.Constants;
+import org.apache.neethi.ExactlyOne;
+import org.apache.neethi.Policy;
+import org.apache.neethi.PolicyComponent;
+
+public class NormalisedAddressingAssertion implements Assertion, org.apache.axis2.addressing.policy.AddressingAssertion {
+	private Policy normaliseNestedPolicy;
+	ArrayList<OMAttribute> nonoptatts;
+	List<Assertion> assertions;
+	public NormalisedAddressingAssertion(List<Assertion> assertions, ArrayList<OMAttribute> newnonoptatts){
+		this.assertions = assertions;
+		nonoptatts = newnonoptatts;
+		normaliseNestedPolicy = new Policy();
+		if(!assertions.isEmpty()){
+		    ExactlyOne seo = new ExactlyOne();
+		    All sall = new All();
+		    for(Assertion assertion: assertions){
+		    	sall.addAssertion(assertion);
+		    }
+		    seo.addPolicyComponent(sall);
+		    normaliseNestedPolicy.addPolicyComponent(seo);
+		}
+	}
+	
+	public QName getName() {
+		return CompactAddressingAssertion.ADDRESSING_ASSERTION;
+	}
+
+	public boolean isOptional() {
+		return false;
+	}
+
+	public PolicyComponent normalize() {
+		return this;
+	}
+
+	public void serialize(XMLStreamWriter writer) throws XMLStreamException {
+		writer.writeStartElement(CompactAddressingAssertion.ADDRESSING_ASSERTION.getPrefix(), CompactAddressingAssertion.ADDRESSING_ASSERTION.getLocalPart(), CompactAddressingAssertion.ADDRESSING_ASSERTION.getNamespaceURI());
+		for(OMAttribute oma: nonoptatts){
+			writer.writeAttribute(oma.getNamespace().getPrefix(), oma.getNamespace().getNamespaceURI(), oma.getLocalName(), oma.getAttributeValue());
+		}
+		normaliseNestedPolicy.serialize(writer);
+		writer.writeEndElement();
+	}
+
+	public boolean equal(PolicyComponent policyComponent) {
+		if(policyComponent instanceof NormalisedAddressingAssertion){
+			return normaliseNestedPolicy.equal(((NormalisedAddressingAssertion)policyComponent).normaliseNestedPolicy);
+		}
+		return false;
+	}
+
+	public short getType() {
+		return Constants.TYPE_ASSERTION;
+	}
+
+	public boolean isResponseCombinationAllowed(boolean anonymous, boolean nonAnonymous) {
+//  TODO reimplement this or re-design the method signature so it more closely
+//		matches the nested assertions
+//		boolean result = true;
+//		if(anonymous){
+//			result = false;
+//			for(Assertion a: assertions){
+//				if(a instanceof AnonymousAssertion){
+//					result = true;
+//				}
+//			}
+//		}
+//		if(result && nonAnonymous){
+//			result = false;
+//			for(Assertion a: assertions){
+//				if(a instanceof NonAnonymousAssertion){
+//					result = true;
+//				}
+//			}
+//		}
+//		return result;
+		return false;
+	}
+}

Added: webservices/axis2/scratch/java/davidillsley/src/test/java/AddressingAssertionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/davidillsley/src/test/java/AddressingAssertionTests.java?view=auto&rev=537733
==============================================================================
--- webservices/axis2/scratch/java/davidillsley/src/test/java/AddressingAssertionTests.java (added)
+++ webservices/axis2/scratch/java/davidillsley/src/test/java/AddressingAssertionTests.java Sun May 13 23:46:55 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+import java.io.FileInputStream;
+
+import javax.xml.stream.XMLStreamWriter;
+
+import junit.framework.TestCase;
+
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axis2.addressing.policy.*;
+import org.apache.axis2.addressing.policy.impl.CompactAddressingAssertion;
+import org.apache.axis2.addressing.policy.impl.AnonymousAssertion;
+import org.apache.axis2.addressing.policy.impl.NonAnonymousAssertion;
+import org.apache.neethi.*;
+import org.apache.neethi.builders.AssertionBuilder;
+
+public class AddressingAssertionTests extends TestCase {
+
+	public void testSimpleAssertion() throws Exception{
+		AssertionBuilder ab = new AddressingAssertionBuilder();
+		PolicyEngine.registerBuilder(CompactAddressingAssertion.ADDRESSING_ASSERTION, ab);
+		PolicyEngine.registerBuilder(AnonymousAssertion.ANONYMOUS_ASSERTION, ab);
+		PolicyEngine.registerBuilder(NonAnonymousAssertion.NON_ANONYMOUS_ASSERTION, ab);
+		
+		Policy policy = PolicyEngine.getPolicy(new FileInputStream("simple.xml"));
+		Policy p = (Policy)policy.normalize(true);
+		XMLStreamWriter writer = StAXUtils.createXMLStreamWriter(System.out); 
+		p.serialize(writer);
+		writer.close();
+	}
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org