Author: jkaputin
Date: Fri Aug 31 14:44:45 2007
New Revision: 571605
URL: http://svn.apache.org/viewvc?rev=571605&view=rev
Log:
WODEN-178
Changed access of addElementDeclaration and addTypeDefinition
methods of DescriptionImpl from public to package private. Fixed
testcases to use correct API programming model and
to test xml schema components correctly in Element and
Component models.
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/DescriptionTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/TypesElementTest.java
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/DescriptionImpl.java
Fri Aug 31 14:44:45 2007
@@ -543,16 +543,14 @@
return fWsdlContext;
}
- //TODO make this package private (several tests use it, these must chg to
correct API pgm model)
- public void addElementDeclaration(ElementDeclaration elDec)
+ void addElementDeclaration(ElementDeclaration elDec)
{
if(elDec != null) {
fAllElementDeclarations.add(elDec);
}
}
- //TODO make this package private (one test uses it, this must chg to
correct API pgm model)
- public void addTypeDefinition(TypeDefinition typeDef)
+ void addTypeDefinition(TypeDefinition typeDef)
{
if(typeDef != null) {
fAllTypeDefinitions.add(typeDef);
@@ -564,6 +562,14 @@
//TODO consider moving the builder logic inside this class, maybe as
an inner class.
fComponentsInitialized = true;
new ComponentModelBuilder(this);
+ }
+
+ /* This package private method is called if something in the Element model
changes that necessitates
+ * a rebuild of the Component model. For example, if a schema is added to
TypesElement the
+ * ElementDeclaration and TypeDefinition components need to be rebuilt.
+ */
+ void resetComponentsInitialized() {
+ fComponentsInitialized = false;
}
/*
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceFaultImpl.java
Fri Aug 31 14:44:45 2007
@@ -89,9 +89,14 @@
*/
public ElementDeclaration getElementDeclaration()
{
- Interface interfac = (Interface)getParent();
- Description desc = ((InterfaceImpl)interfac).getDescriptionComponent();
- return desc.getElementDeclaration(fElement.getQName());
+ ElementDeclaration elemDecl = null;
+
+ if(fElement != null && fElement.isQName()) {
+ Interface interfac = (Interface)getParent();
+ Description desc =
((InterfaceImpl)interfac).getDescriptionComponent();
+ elemDecl = desc.getElementDeclaration(fElement.getQName());
+ }
+ return elemDecl;
}
/*
@@ -135,7 +140,7 @@
public XmlSchemaElement getXmlSchemaElement()
{
XmlSchemaElement xse = null;
- if (fElement.isQName()) {
+ if (fElement != null && fElement.isQName()) {
InterfaceElement interfac = (InterfaceElement)getParentElement();
DescriptionElement desc =
(DescriptionElement)interfac.getParentElement();
TypesElement types = desc.getTypesElement();
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/InterfaceMessageReferenceImpl.java
Fri Aug 31 14:44:45 2007
@@ -91,7 +91,7 @@
{
ElementDeclaration elemDecl = null;
- if(fElement != null) {
+ if(fElement != null && fElement.isQName()) {
InterfaceOperation oper = (InterfaceOperation)getParent();
Interface interfac = (Interface)oper.getParent();
Description desc =
((InterfaceImpl)interfac).getDescriptionComponent();
@@ -138,8 +138,7 @@
public XmlSchemaElement getXmlSchemaElement()
{
XmlSchemaElement xse = null;
- if(fElement != null && fElement.isQName())
- {
+ if(fElement != null && fElement.isQName()) {
InterfaceOperationElement oper =
(InterfaceOperationElement)getParentElement();
InterfaceElement interfac =
(InterfaceElement)oper.getParentElement();
DescriptionElement desc =
(DescriptionElement)interfac.getParentElement();
Modified:
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java
(original)
+++
incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/TypesImpl.java
Fri Aug 31 14:44:45 2007
@@ -72,6 +72,8 @@
{
if(schema != null) {
fSchemas.add(schema);
+ //reset flag so ComponentModelBuilder will rebuild the
ElementDeclarations and TypeDefinitions
+ ((DescriptionImpl)getParentElement()).resetComponentsInitialized();
}
}
Modified:
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
Fri Aug 31 14:44:45 2007
@@ -31,15 +31,11 @@
import org.apache.woden.internal.ErrorReporterImpl;
import org.apache.woden.internal.wsdl20.BindingFaultImpl;
import org.apache.woden.internal.wsdl20.BindingFaultReferenceImpl;
-import org.apache.woden.internal.wsdl20.Constants;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
import org.apache.woden.internal.wsdl20.EndpointImpl;
import org.apache.woden.internal.wsdl20.InterfaceFaultReferenceImpl;
import org.apache.woden.internal.wsdl20.InterfaceImpl;
import org.apache.woden.internal.wsdl20.InterfaceMessageReferenceImpl;
import org.apache.woden.internal.wsdl20.ServiceImpl;
-import org.apache.woden.internal.wsdl20.extensions.PopulatedExtensionRegistry;
import org.apache.woden.tests.TestErrorHandler;
import org.apache.woden.types.NCName;
import org.apache.woden.types.QNameTokenUnion;
@@ -405,8 +401,6 @@
*/
public void testTestAssertionInterfaceMessageReference1028()
{
- QName name1 = new QName("http://www.sample.org", "name1");
-
WSDLFactory factory = null;
try {
factory = WSDLFactory.newInstance();
@@ -418,19 +412,16 @@
try
{
DescriptionElement descEl = factory.newDescription();
- Description descComp = descEl.toComponent();
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(name1);
- ((DescriptionImpl)descEl).addElementDeclaration(ed);
InterfaceElement interfac = descEl.addInterfaceElement();
InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
-
InterfaceMessageReferenceElement interfaceMessageReference =
oper.addInterfaceMessageReferenceElement();
interfaceMessageReference.setElement(QNameTokenUnion.ANY);
- descComp.getInterfaces(); //init Interface's ref to its Description
+ Description descComp = descEl.toComponent(); //initialise Interface's
ref to its Description
+ InterfaceMessageReference msgRefComp =
+
descComp.getInterfaces()[0].getInterfaceOperations()[0].getInterfaceMessageReferences()[0];
-
if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)interfaceMessageReference,
reporter))
+
if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)msgRefComp,
reporter))
{
fail("The testAssertionInterfaceMessageReference1028 method
returned false for an interface message reference with the message content
model #any and an empty element declaration.");
}
@@ -444,19 +435,16 @@
try
{
DescriptionElement descEl = factory.newDescription();
- Description descComp = descEl.toComponent();
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(name1);
- ((DescriptionImpl)descEl).addElementDeclaration(ed);
InterfaceElement interfac = descEl.addInterfaceElement();
InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
-
InterfaceMessageReferenceElement interfaceMessageReference =
oper.addInterfaceMessageReferenceElement();
- interfaceMessageReference.setElement(QNameTokenUnion.NONE);
+ interfaceMessageReference.setElement(QNameTokenUnion.NONE);
- descComp.getInterfaces(); //init Interface's ref to its Description
-
-
if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)interfaceMessageReference,
reporter))
+ Description descComp = descEl.toComponent(); //initialise Interface's
ref to its Description
+ InterfaceMessageReference msgRefComp =
+
descComp.getInterfaces()[0].getInterfaceOperations()[0].getInterfaceMessageReferences()[0];
+
+
if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)msgRefComp,
reporter))
{
fail("The testAssertionInterfaceMessageReference1028 method
returned false for an interface message reference with the message content
model #none and an empty element declaration.");
}
@@ -465,118 +453,6 @@
{
fail("There was a problem running the test assertion method " + e);
}
-
- /*
- * These tests are no longer valid as there is no way to setup the
element model with false properties with the QNameTokenUnion type.
- *
- // Test that the method returns false if the message content model is #any
and the element declaration is not empty.
- try
- {
- DescriptionElement descEl = factory.newDescription();
- Description descComp = descEl.toComponent();
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(name1);
- ((DescriptionImpl)descEl).addElementDeclaration(ed);
- InterfaceElement interfac = descEl.addInterfaceElement();
- InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
-
- InterfaceMessageReferenceElement interfaceMessageReference =
oper.addInterfaceMessageReferenceElement();
- interfaceMessageReference.setElement(new
QNameTokenUnion(Constants.NMTOKEN_ANY));
- interfaceMessageReference.setElement(new QNameTokenUnion(name1));
-
- descComp.getInterfaces(); //init Interface's ref to its Description
-
-
if(val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)interfaceMessageReference,
reporter))
- {
- fail("The testAssertionInterfaceMessageReference1028 method
returned true for an interface message reference with the message content model
#any and a non-empty element declaration.");
- }
- }
- catch(WSDLException e)
- {
- fail("There was a problem running the test assertion method " + e);
- }
-
- // Test that the method returns false if the message content model is
#none and the element declaration is not empty.
- try
- {
- DescriptionElement descEl = factory.newDescription();
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(name1);
- ((DescriptionImpl)descEl).addElementDeclaration(ed);
- InterfaceElement interfac = descEl.addInterfaceElement();
- InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
-
- InterfaceMessageReferenceElement interfaceMessageReference =
oper.addInterfaceMessageReferenceElement();
- interfaceMessageReference.setElement(new
QNameTokenUnion(Constants.NMTOKEN_NONE));
- interfaceMessageReference.setElement(new QNameTokenUnion(name1));
-
- descEl.toComponent().getInterfaces(); //init Interface's ref to its
Description
-
-
if(val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)interfaceMessageReference,
reporter))
- {
- fail("The testAssertionInterfaceMessageReference1028 method
returned true for an interface message reference with the message content model
#none and a non-empty element declaration.");
- }
- }
- catch(WSDLException e)
- {
- fail("There was a problem running the test assertion method " + e);
- }
- */
- // Test that the method returns true if the message content model is
#other and the element declaration is not empty.
- try
- {
- DescriptionElement descEl = factory.newDescription();
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(name1);
- ((DescriptionImpl)descEl).addElementDeclaration(ed);
- InterfaceElement interfac = descEl.addInterfaceElement();
- InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
-
- InterfaceMessageReferenceElement interfaceMessageReference =
oper.addInterfaceMessageReferenceElement();
- interfaceMessageReference.setElement(QNameTokenUnion.OTHER);
- interfaceMessageReference.setElement(new QNameTokenUnion(name1));
-
- descEl.toComponent().getInterfaces(); //init Interface's ref to its
Description
-
-
if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)interfaceMessageReference,
reporter))
- {
- fail("The testAssertionInterfaceMessageReference1028 method
returned false for an interface message reference with the message content
model #other and a non-empty element declaration.");
- }
- }
- catch(WSDLException e)
- {
- fail("There was a problem running the test assertion method " + e);
- }
-
- /*
- * These tests are no longer valid as there is no way to setup the element
model with false properties with the QNameTokenUnion type.
- *
- // Test that the method returns true if the message content model is
#element and the element declaration is not empty.
- try
- {
- DescriptionElement descEl = factory.newDescription();
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(name1);
- ((DescriptionImpl)descEl).addElementDeclaration(ed);
- InterfaceElement interfac = descEl.addInterfaceElement();
- InterfaceOperationElement oper = interfac.addInterfaceOperationElement();
-
- InterfaceMessageReferenceElement interfaceMessageReference =
oper.addInterfaceMessageReferenceElement();
- interfaceMessageReference.setElement(new
QNameTokenUnion(Constants.NMTOKEN_ELEMENT));
- interfaceMessageReference.setElement(new QNameTokenUnion(name1));
-
- descEl.toComponent().getInterfaces(); //init Interface's ref to its
Description
-
-
if(!val.testAssertionInterfaceMessageReference1028((InterfaceMessageReferenceImpl)interfaceMessageReference,
reporter))
- {
- fail("The testAssertionInterfaceMessageReference1028 method
returned false for an interface message reference with the message content
model #element and a non-empty element declaration.");
- }
- }
- catch(WSDLException e)
- {
- fail("There was a problem running the test assertion method " + e);
- }
- */
}
/**
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/DescriptionTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/DescriptionTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/DescriptionTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/DescriptionTest.java
Fri Aug 31 14:44:45 2007
@@ -16,6 +16,12 @@
*/
package org.apache.woden.wsdl20;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URI;
+import java.net.URISyntaxException;
+
import javax.xml.namespace.QName;
import junit.framework.Test;
@@ -23,14 +29,22 @@
import junit.framework.TestSuite;
import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.schema.InlinedSchemaImpl;
import org.apache.woden.internal.wsdl20.DescriptionImpl;
import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
import org.apache.woden.internal.wsdl20.TypeDefinitionImpl;
+import org.apache.woden.schema.InlinedSchema;
import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.xml.BindingElement;
import org.apache.woden.wsdl20.xml.DescriptionElement;
import org.apache.woden.wsdl20.xml.InterfaceElement;
import org.apache.woden.wsdl20.xml.ServiceElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.w3c.dom.Document;
/**
* Unit tests for the Description component API.
@@ -64,19 +78,38 @@
fInterfaceElement.setName(new NCName("interfaceName"));
fServiceElement = fDescriptionElement.addServiceElement();
fServiceElement.setName(new NCName("serviceName"));
- fDescriptionElement.addTypesElement(); // create a TypesElement
-
- // TODO check the following are not too contrived...
- // 1:
- ElementDeclarationImpl refEd = new ElementDeclarationImpl();
- refEd.setName(new QName("myEd"));
- ((DescriptionImpl)fDescriptionElement).addElementDeclaration(refEd);
-
- // 2:
- TypeDefinitionImpl typeDef = new TypeDefinitionImpl();
- typeDef.setName(new QName("myTypeDef"));
- ((DescriptionImpl)fDescriptionElement).addTypeDefinition(typeDef);
+
+ //Create a test schema
+ InlinedSchema schema = new InlinedSchemaImpl();
+ XmlSchema xs1 = null;
+ URI schemaNS = null;
+
+ String schemaString = "<schema
xmlns=\"http://www.w3.org/2001/XMLSchema\">"
+ + "<element name=\"myEd\" type=\"string\"/>"
+ + "<complexType name=\"myTypeDef\">"
+ + "<sequence>"
+ + "<element name=\"element\" type=\"string\"/>"
+ + "</sequence>"
+ + "</complexType>"
+ + "</schema>";
+
+ DOMParser builder = new DOMParser();
+ Reader reader = new StringReader(schemaString);
+ XMLInputSource is = new XMLInputSource(null, null, null, reader, null);
+ try {
+ builder.parse(is);
+ } catch(IOException e) {
+ fail("There was an IOException whilst trying to parse the sample
schema.");
+ }
+ Document schemaDoc1 = builder.getDocument();
+ XmlSchemaCollection xsc = new XmlSchemaCollection();
+ xs1 = xsc.read(schemaDoc1.getDocumentElement());
+ schema.setSchemaDefinition(xs1);
+ //Add it to the typesElement.
+ TypesElement typesEl = fDescriptionElement.addTypesElement();
+ typesEl.addSchema(schema);
+
fDescription = fDescriptionElement.toComponent();
}
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceFaultTest.java
Fri Aug 31 14:44:45 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.wsdl20;
+import java.io.Reader;
+import java.io.StringReader;
import java.net.URI;
import javax.xml.namespace.QName;
@@ -26,13 +28,23 @@
import org.apache.woden.WSDLException;
import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.schema.InlinedSchemaImpl;
+import org.apache.woden.internal.wsdl20.Constants;
import org.apache.woden.internal.wsdl20.DescriptionImpl;
import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.schema.InlinedSchema;
import org.apache.woden.types.NCName;
import org.apache.woden.types.QNameTokenUnion;
import org.apache.woden.wsdl20.xml.DescriptionElement;
import org.apache.woden.wsdl20.xml.InterfaceElement;
import org.apache.woden.wsdl20.xml.InterfaceFaultElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.w3c.dom.Document;
/**
* Unit tests for the InterfaceFault class.
@@ -87,40 +99,93 @@
super.tearDown();
}
- /*
- * Test that an (optional) ElementDecalaration QName can be
successfully retrieved
- */
- public void testGetElementDeclaration()
- {
- assertNotNull(fFault);
-
- // Default case
- assertNull("The retrieved Element Declaration when unset should
be null", fFault.getElementDeclaration());
-
- // set and associate the Element Declaration
- ElementDeclarationImpl ed = new ElementDeclarationImpl();
- ed.setName(new QName(FAULT_NAME));
- ((DescriptionImpl)fDescriptionElement).addElementDeclaration(ed);
+ /*
+ * Test that a (Mandatory) Name QName can be successfully retrieved
+ */
+ public void testGetName()
+ {
+ QName faultName = new QName(TNS, FAULT_NAME);
fDescription = fDescriptionElement.toComponent();
- fFault = fDescription.getInterface(new
QName(TNS,INTF_NAME)).getInterfaceFault(new QName(TNS,FAULT_NAME));
- assertEquals("The retrieved Element Declaration is not that
which was set",
- ed, fFault.getElementDeclaration());
- }
+ fFault = fDescription.getInterface(new QName(TNS,
INTF_NAME)).getInterfaceFault(new QName(TNS, FAULT_NAME));
+ assertEquals("The retrieved fault name is not that which was set",
+ faultName, fFault.getName());
+ }
+
+ /*
+ * Test that the (Mandatory) Message Content Model property can be
successfully retrieved
+ */
+ public void testGetMessageContentModel()
+ {
+ Description desc = fDescriptionElement.toComponent();
+ InterfaceFault fault = desc.getInterfaces()[0].getInterfaceFaults()[0];
+ fFaultElement.setElement(QNameTokenUnion.ANY);
+ assertEquals("The retrieved Message Content Model is not #any",
+ Constants.NMTOKEN_ANY, fault.getMessageContentModel());
+
+ fFaultElement.setElement(QNameTokenUnion.NONE);
+ assertEquals("The retrieved Message Content Model is not #none",
+ Constants.NMTOKEN_NONE, fault.getMessageContentModel());
+
+ fFaultElement.setElement(QNameTokenUnion.OTHER);
+ assertEquals("The retrieved Message Content Model is not #other",
+ Constants.NMTOKEN_OTHER, fault.getMessageContentModel());
+
+ fFaultElement.setElement(null);
+ assertEquals("The retrieved Message Content Model is not #other",
+ Constants.NMTOKEN_OTHER, fault.getMessageContentModel());
+
+ fFaultElement.setElement(new QNameTokenUnion(new
QName("elementName")));
+ assertEquals("The retrieved Message Content Model is not #element",
+ Constants.NMTOKEN_ELEMENT, fault.getMessageContentModel());
+ }
+
/*
- * Test that a (Mandatory) Name QName can be successfully retrieved
+ * Test that an (optional) ElementDecalaration can be successfully
retrieved
*/
- public void testGetName()
+ public void testGetElementDeclaration() throws Exception
{
- QName faultName = new QName(TNS, FAULT_NAME);
- fDescription = fDescriptionElement.toComponent();
- fFault = fDescription.getInterface(new QName(TNS,
INTF_NAME)).getInterfaceFault(new QName(TNS, FAULT_NAME));
- assertEquals("The retrieved fault name is not that which was
set",
- faultName, fFault.getName());
+ fFaultElement.setName(new NCName(FAULT_NAME));
+ fDescription = fDescriptionElement.toComponent();
+ Interface iface = fDescription.getInterface(new QName(TNS,INTF_NAME));
+ InterfaceFault fault = iface.getInterfaceFault(new
QName(TNS,FAULT_NAME));
+ assertNotNull(fault);
+
+ // Default case
+ assertNull("When 'element' attribute is omitted, no ElementDeclaration
should be present", fault.getElementDeclaration());
+
+ // Test that the expected ElementDeclaration is returned
+ TypesElement typesElement = fDescriptionElement.addTypesElement();
//throws WSDLException
+ InlinedSchema schema = new InlinedSchemaImpl();
+ String schemaString = "<schema
xmlns=\"http://www.w3.org/2001/XMLSchema\"
targetNamespace=\"http://www.sample.org\">"
+ + "<complexType name=\"myType\">"
+ + "<sequence>"
+ + "<element name=\"element\" type=\"string\"/>"
+ + "</sequence>"
+ + "</complexType>"
+ + "<element name=\"myElement\" type=\"string\"/>"
+ + "</schema>";
+ DOMParser builder = new DOMParser();
+ Reader reader = new StringReader(schemaString);
+ XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
+ builder.parse(is); //throws IOException
+ Document schemaDoc1 = builder.getDocument();
+ XmlSchemaCollection xsc = new XmlSchemaCollection();
+ XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
+ schema.setSchemaDefinition(xs1);
+ URI schemaNS = URI.create("http://www.sample.org");
+ schema.setNamespace(schemaNS);
+ typesElement.addSchema(schema);
+
+ QName elemQN = new QName("http://www.sample.org","myElement");
+
+ fFaultElement.setElement(new QNameTokenUnion(elemQN));
+ ElementDeclaration elemDecl = fault.getElementDeclaration();
+
+ assertEquals("The ElementDeclaration did not match the qname in the
'element' attribute",
+ elemQN, elemDecl.getName());
}
-
- //TODO WODEN-162, need to create testGetMessageContentModel() method.
-
+
/*
* toElement()
*/
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/InterfaceMessageReferenceTest.java
Fri Aug 31 14:44:45 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.wsdl20;
+import java.io.Reader;
+import java.io.StringReader;
import java.net.URI;
import javax.xml.namespace.QName;
@@ -26,7 +28,9 @@
import org.apache.woden.WSDLException;
import org.apache.woden.WSDLFactory;
+import org.apache.woden.internal.schema.InlinedSchemaImpl;
import org.apache.woden.internal.wsdl20.Constants;
+import org.apache.woden.schema.InlinedSchema;
import org.apache.woden.types.NCName;
import org.apache.woden.types.QNameTokenUnion;
import org.apache.woden.wsdl20.enumeration.Direction;
@@ -34,6 +38,12 @@
import org.apache.woden.wsdl20.xml.InterfaceElement;
import org.apache.woden.wsdl20.xml.InterfaceMessageReferenceElement;
import org.apache.woden.wsdl20.xml.InterfaceOperationElement;
+import org.apache.woden.wsdl20.xml.TypesElement;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.w3c.dom.Document;
@@ -48,7 +58,6 @@
private InterfaceElement fInterfaceElement = null;
private InterfaceOperationElement fInterfaceOperationElement = null;
private InterfaceMessageReferenceElement fMessageReferenceElement =
null;
- private InterfaceMessageReference fMessageReferenceComp = null;
private final String TNS = "http://example.org";
private final String INTF_NAME = "interfaceName";
private final String OPER_NAME = "operationName";
@@ -77,8 +86,6 @@
fInterfaceOperationElement =
fInterfaceElement.addInterfaceOperationElement();
fInterfaceOperationElement.setName(new NCName(OPER_NAME));
fMessageReferenceElement =
fInterfaceOperationElement.addInterfaceMessageReferenceElement();
- //fMessageReferenceElement.setElement(QNameTokenUnion.OTHER);
- //fMessageReferenceComp = (InterfaceMessageReference)
fMessageReferenceElement;
}
/*
@@ -139,7 +146,52 @@
Constants.NMTOKEN_ELEMENT, msgRef.getMessageContentModel());
}
- //TODO WODEN-162, testGetElementDeclaration()
+ /*
+ * Test that an (optional) ElementDecalaration can be successfully
retrieved
+ */
+ public void testGetElementDeclaration() throws Exception
+ {
+ Description desc = fDescriptionElement.toComponent();
+ Interface iface = desc.getInterface(new QName(TNS,INTF_NAME));
+ InterfaceOperation oper = iface.getInterfaceOperation(new
QName(TNS,OPER_NAME));
+ InterfaceMessageReference msgRef =
oper.getInterfaceMessageReferences()[0];
+ assertNotNull(msgRef);
+
+ // Default case
+ assertNull("When 'element' attribute is omitted, no ElementDeclaration
should be present", msgRef.getElementDeclaration());
+
+ // Test that the expected ElementDeclaration is returned
+ TypesElement typesElement = fDescriptionElement.addTypesElement();
//throws WSDLException
+ InlinedSchema schema = new InlinedSchemaImpl();
+ String schemaString = "<schema
xmlns=\"http://www.w3.org/2001/XMLSchema\"
targetNamespace=\"http://www.sample.org\">"
+ + "<complexType name=\"myType\">"
+ + "<sequence>"
+ + "<element name=\"element\" type=\"string\"/>"
+ + "</sequence>"
+ + "</complexType>"
+ + "<element name=\"myElement\" type=\"string\"/>"
+ + "</schema>";
+ DOMParser builder = new DOMParser();
+ Reader reader = new StringReader(schemaString);
+ XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
+ builder.parse(is); //throws IOException
+ Document schemaDoc1 = builder.getDocument();
+ XmlSchemaCollection xsc = new XmlSchemaCollection();
+ XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
+ schema.setSchemaDefinition(xs1);
+ URI schemaNS = URI.create("http://www.sample.org");
+ schema.setNamespace(schemaNS);
+ typesElement.addSchema(schema);
+
+ QName elemQN = new QName("http://www.sample.org","myElement");
+
+ fMessageReferenceElement.setElement(new QNameTokenUnion(elemQN));
+ ElementDeclaration elemDecl = msgRef.getElementDeclaration();
+
+ assertEquals("The ElementDeclaration did not match the qname in the
'element' attribute",
+ elemQN, elemDecl.getName());
+ }
+
/*
* toElement() - test that the infoset element view of this component can
be retreived
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultElementTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultElementTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultElementTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceFaultElementTest.java
Fri Aug 31 14:44:45 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.wsdl20.xml;
+import java.io.Reader;
+import java.io.StringReader;
import java.net.URI;
import javax.xml.namespace.QName;
@@ -26,12 +28,16 @@
import org.apache.woden.WSDLException;
import org.apache.woden.WSDLFactory;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.internal.schema.InlinedSchemaImpl;
+import org.apache.woden.schema.InlinedSchema;
import org.apache.woden.types.NCName;
import org.apache.woden.types.QNameTokenUnion;
-import org.apache.woden.wsdl20.ElementDeclaration;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.w3c.dom.Document;
/**
* Unit tests for the InterfaceFaultElement class.
@@ -103,7 +109,7 @@
* the QNameTokenUnion is of type qname and if it is of type token, that
there is no
* element declaration returned.
*/
- public void testGetXmlSchemaElement()
+ public void testGetXmlSchemaElement() throws Exception
{
WSDLFactory factory = null;
try {
@@ -115,36 +121,57 @@
// Create the
DescriptionElement->InterfaceElement->InterfaceOperationElement->InterfaceMessageReferenceElement
hierarchy
DescriptionElement descriptionElement = factory.newDescription();
InterfaceElement interfaceElement =
descriptionElement.addInterfaceElement();
- InterfaceOperationElement interfaceOperationElement =
interfaceElement.addInterfaceOperationElement();
-
- // create the InterfaceMessageReferenceElement to test
- InterfaceMessageReferenceElement messageReference =
interfaceOperationElement.addInterfaceMessageReferenceElement();
+ InterfaceFaultElement faultElement =
interfaceElement.addInterfaceFaultElement();
// Default case:
- XmlSchemaElement retrievedElement =
messageReference.getXmlSchemaElement();
- assertNull("Unset Element Declaration should return null",
retrievedElement);
+ XmlSchemaElement retrievedElement = faultElement.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is not set",
retrievedElement);
- // populated case 1 - (with Message Content Model set to #ANY or
#NONE).
- ElementDeclaration ed = new ElementDeclarationImpl();
- ((DescriptionImpl)descriptionElement).addElementDeclaration(ed);
- messageReference.setElement(QNameTokenUnion.NONE);
-
- descriptionElement.toComponent();
-
- retrievedElement = messageReference.getXmlSchemaElement();
- assertNull("The retrieved Element Declation should return null when
message content model is #NONE",
- retrievedElement);
-
- messageReference.setElement(QNameTokenUnion.ANY);
- descriptionElement.toComponent();
- retrievedElement = messageReference.getXmlSchemaElement();
- assertNull("The retrieved Element Declaration should return null when
message content model is #ANY",
- retrievedElement);
-
- /* TODO WODEN-162, need a test that adds an xml schema to the
TypesElement, then
- * refers to a schema element via the 'element' attribute, then calls
- * getXmlSchemaElement to retrieve it.
- */
+ // Case 1 - (with 'element' set to #any)
+ faultElement.setElement(QNameTokenUnion.ANY);
+ retrievedElement = faultElement.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is #any",
retrievedElement);
+
+ // Case 2 - (with 'element' set to #none)
+ faultElement.setElement(QNameTokenUnion.NONE);
+ retrievedElement = faultElement.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is #none",
retrievedElement);
+
+ // Case 3 - (with 'element' set to #other)
+ faultElement.setElement(QNameTokenUnion.OTHER);
+ retrievedElement = faultElement.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is #other",
retrievedElement);
+
+ // Case 4 - (with 'element' set to the qname of a schema element
declaration)
+ TypesElement typesElement = descriptionElement.addTypesElement();
//throws WSDLException
+ InlinedSchema schema = new InlinedSchemaImpl();
+ String schemaString = "<schema
xmlns=\"http://www.w3.org/2001/XMLSchema\"
targetNamespace=\"http://www.sample.org\">"
+ + "<complexType name=\"myType\">"
+ + "<sequence>"
+ + "<element name=\"element\" type=\"string\"/>"
+ + "</sequence>"
+ + "</complexType>"
+ + "<element name=\"myElement\" type=\"string\"/>"
+ + "</schema>";
+ DOMParser builder = new DOMParser();
+ Reader reader = new StringReader(schemaString);
+ XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
+ builder.parse(is); //throws IOException
+ Document schemaDoc1 = builder.getDocument();
+ XmlSchemaCollection xsc = new XmlSchemaCollection();
+ XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
+ schema.setSchemaDefinition(xs1);
+ URI schemaNS = URI.create("http://www.sample.org");
+ schema.setNamespace(schemaNS);
+ typesElement.addSchema(schema);
+
+ QName elemQN = new QName("http://www.sample.org","myElement");
+ XmlSchemaElement expectedElement = xs1.getElementByName(elemQN);
+
+ faultElement.setElement(new QNameTokenUnion(elemQN));
+ retrievedElement = faultElement.getXmlSchemaElement();
+ assertEquals("The 'element' qname should resolve to the expected XML
Schema element declaration",
+ expectedElement, retrievedElement);
}
}
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/InterfaceMessageReferenceElementTest.java
Fri Aug 31 14:44:45 2007
@@ -16,6 +16,8 @@
*/
package org.apache.woden.wsdl20.xml;
+import java.io.Reader;
+import java.io.StringReader;
import java.net.URI;
import javax.xml.namespace.QName;
@@ -26,15 +28,18 @@
import org.apache.woden.WSDLException;
import org.apache.woden.WSDLFactory;
-import org.apache.woden.internal.wsdl20.Constants;
-import org.apache.woden.internal.wsdl20.DescriptionImpl;
-import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.internal.schema.InlinedSchemaImpl;
import org.apache.woden.internal.wsdl20.InterfaceMessageReferenceImpl;
+import org.apache.woden.schema.InlinedSchema;
import org.apache.woden.types.NCName;
import org.apache.woden.types.QNameTokenUnion;
-import org.apache.woden.wsdl20.ElementDeclaration;
import org.apache.woden.wsdl20.enumeration.Direction;
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaCollection;
import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.xerces.parsers.DOMParser;
+import org.apache.xerces.xni.parser.XMLInputSource;
+import org.w3c.dom.Document;
@@ -46,7 +51,6 @@
public class InterfaceMessageReferenceElementTest extends TestCase {
private InterfaceMessageReferenceElement fMessageReferenceElement =
null;
- private URI fNamespace = null;
public static Test suite()
{
@@ -60,7 +64,6 @@
{
super.setUp();
fMessageReferenceElement = new InterfaceMessageReferenceImpl();
- fNamespace = new URI("http://apache.org/testns");
}
/*
@@ -121,8 +124,8 @@
* TODO Need to check model structure for XmlSchema
*/
- public void testGetXmlSchemaElement()
- {
+ public void testGetXmlSchemaElement() throws Exception
+ {
WSDLFactory factory = null;
try {
factory = WSDLFactory.newInstance();
@@ -134,61 +137,56 @@
DescriptionElement descriptionElement =
factory.newDescription();
InterfaceElement interfaceElement =
descriptionElement.addInterfaceElement();
InterfaceOperationElement interfaceOperationElement =
interfaceElement.addInterfaceOperationElement();
-
- // create the InterfaceMessageReferenceElement to test
InterfaceMessageReferenceElement messageReference =
interfaceOperationElement.addInterfaceMessageReferenceElement();
// Default case:
XmlSchemaElement retrievedElement =
messageReference.getXmlSchemaElement();
- assertNull("Unset Element Declaration should return null",
retrievedElement);
+ assertNull("Should return null if 'element' attribute is not
set", retrievedElement);
- // populated case 1 - (with Message Content Model set to #ANY
or #NONE).
- messageReference.setElement(QNameTokenUnion.NONE);
- retrievedElement = messageReference.getXmlSchemaElement();
- assertNull("The retrieved Element Declation should return null
when message content model is #NONE",
- retrievedElement);
-
- messageReference.setElement(QNameTokenUnion.ANY);
- retrievedElement = messageReference.getXmlSchemaElement();
- assertNull("The retrieved Element Declaration should return
null when message content model is #ANY",
- retrievedElement);
-
- /* TODO WODEN-162, need a test that adds an xml schema to the
TypesElement, then
- * refers to a schema element via the 'element' attribute, then calls
- * getXmlSchemaElement to retrieve it.
- *
- * following populated case (with Message Content Model set) requires
XmlSchema "element" field to be set.
- * (probably via
org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement())
- */
-/*
- // populated case 2 - success:
-
- // Add a TypesElement to the Description
- TypesElement typesElement =
descriptionElement.getTypesElement();
-
- // Add a namespace-identified schema element declaration to the
Types element
- XmlSchemaCollection xsc = new XmlSchemaCollection();
- XmlSchema xmlSchema = new XmlSchema("ElementName", xsc);
- Schema schema = new ImportedSchemaImpl(); // arbitrary schema
- schema.setNamespace(fNamespace);
- schema.setSchemaDefinition(xmlSchema);
- typesElement.addSchema(schema);
-
-
fExtensionRegistry.registerComponentExtension(InterfaceOperation.class,
- InterfaceOperationExtensionsImpl.URI_NS_EXTENSIONS,
InterfaceOperationExtensionsImpl.class);
-
- descriptionElement.setExtensionRegistry(fExtensionRegistry);
-
- // set the element name reference
- QName elementName = new QName("http://apache.org/testns",
"ElementName");
- messageReference.setElementName(elementName);
-
messageReference.setMessageContentModel(Constants.NMTOKEN_ELEMENT);
-
- //descriptionElement.toComponent(); // quick test of model
integrity for testing purposes
-
- retrievedElement = messageReference.getElement();
- assertEquals("The retrieved Element is not that which was set",
- schema, retrievedElement);
-*/
+ // Case 1 - (with 'element' set to #any)
+ messageReference.setElement(QNameTokenUnion.ANY);
+ retrievedElement = messageReference.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is #any",
retrievedElement);
+
+ // Case 2 - (with 'element' set to #none)
+ messageReference.setElement(QNameTokenUnion.NONE);
+ retrievedElement = messageReference.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is #none",
retrievedElement);
+
+ // Case 3 - (with 'element' set to #other)
+ messageReference.setElement(QNameTokenUnion.OTHER);
+ retrievedElement = messageReference.getXmlSchemaElement();
+ assertNull("Should return null if 'element' attribute is #other",
retrievedElement);
+
+ // Case 4 - (with 'element' set to the qname of a schema element
declaration)
+ TypesElement typesElement = descriptionElement.addTypesElement();
//throws WSDLException
+ InlinedSchema schema = new InlinedSchemaImpl();
+ String schemaString = "<schema
xmlns=\"http://www.w3.org/2001/XMLSchema\"
targetNamespace=\"http://www.sample.org\">"
+ + "<complexType name=\"myType\">"
+ + "<sequence>"
+ + "<element name=\"element\" type=\"string\"/>"
+ + "</sequence>"
+ + "</complexType>"
+ + "<element name=\"myElement\" type=\"string\"/>"
+ + "</schema>";
+ DOMParser builder = new DOMParser();
+ Reader reader = new StringReader(schemaString);
+ XMLInputSource is = new XMLInputSource(null,null,null,reader,null);
+ builder.parse(is); //throws IOException
+ Document schemaDoc1 = builder.getDocument();
+ XmlSchemaCollection xsc = new XmlSchemaCollection();
+ XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
+ schema.setSchemaDefinition(xs1);
+ URI schemaNS = URI.create("http://www.sample.org");
+ schema.setNamespace(schemaNS);
+ typesElement.addSchema(schema);
+
+ QName elemQN = new QName("http://www.sample.org","myElement");
+ XmlSchemaElement expectedElement = xs1.getElementByName(elemQN);
+
+ messageReference.setElement(new QNameTokenUnion(elemQN));
+ retrievedElement = messageReference.getXmlSchemaElement();
+ assertEquals("The 'element' qname should resolve to the expected XML
Schema element declaration",
+ expectedElement, retrievedElement);
}
}
Modified:
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/TypesElementTest.java
URL:
http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/TypesElementTest.java?rev=571605&r1=571604&r2=571605&view=diff
==============================================================================
---
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/TypesElementTest.java
(original)
+++
incubator/woden/trunk/java/test/org/apache/woden/wsdl20/xml/TypesElementTest.java
Fri Aug 31 14:44:45 2007
@@ -16,6 +16,7 @@
*/
package org.apache.woden.wsdl20.xml;
+import java.net.URI;
import java.util.Arrays;
import java.util.List;
@@ -23,6 +24,7 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.woden.WSDLFactory;
import org.apache.woden.internal.schema.ImportedSchemaImpl;
import org.apache.woden.internal.schema.InlinedSchemaImpl;
import org.apache.woden.internal.wsdl20.TypesImpl;
@@ -38,11 +40,13 @@
public class TypesElementTest extends TestCase {
+ private DescriptionElement fDescriptionElement = null;
private TypesElement fTypesElement = null;
private Schema fInlinedSchema1 = null;
private Schema fInlinedSchema2 = null;
private Schema fImportedSchema1 = null;
private Schema fImportedSchema2 = null;
+ private final String TNS = "http://example.org";
public static Test suite()
{
@@ -55,7 +59,11 @@
protected void setUp() throws Exception
{
super.setUp();
- fTypesElement = new TypesImpl();
+ WSDLFactory factory = null;
+ factory = WSDLFactory.newInstance();
+ fDescriptionElement = factory.newDescription();
+ fDescriptionElement.setTargetNamespace(URI.create(TNS));
+ fTypesElement = fDescriptionElement.addTypesElement();
fInlinedSchema1 = new InlinedSchemaImpl();
fInlinedSchema2 = new InlinedSchemaImpl();
fImportedSchema1 = new ImportedSchemaImpl();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]