ws-woden-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkapu...@apache.org
Subject svn commit: r546889 - in /incubator/woden/trunk/java: src/org/apache/woden/internal/wsdl20/validation/ test/org/apache/woden/internal/wsdl20/validation/
Date Wed, 13 Jun 2007 14:32:11 GMT
Author: jkaputin
Date: Wed Jun 13 07:32:10 2007
New Revision: 546889

URL: http://svn.apache.org/viewvc?view=rev&rev=546889
Log:
WODEN-149
Removed validation code for CR assertions that no
longer exist in the WSDL2 PR spec:

Endpoint-0065, enforced by WSDL2 schema, CR118
InterfaceFault-0028, enforced by WSDL2 schema, CR074
InterfaceFault-0032, enforced by WSDL2 schema, CR118
InterfaceOperation-0029, enforced by WSDL2 schema, CR074
InterfaceOperation-0035, enforced by WSDL2 schema, CR118
Schema-0020, made redundant by InterfaceMessageReference-1036
Schema-0020b, made redundant by InterfaceFault-1017

Modified:
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
    incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
    incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
    incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java?view=diff&rev=546889&r1=546888&r2=546889
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
(original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
Wed Jun 13 07:32:10 2007
@@ -86,8 +86,6 @@
 	  testAssertionInterface1009(interfac, errorReporter);
 	  
 	  validateInterfaceOperations(interfac, interfac.getInterfaceOperations(), errorReporter);
-	  
-	  validateInterfaceFaults(interfac, interfac.getInterfaceFaults(), errorReporter);
 	}
   }
   
@@ -101,15 +99,12 @@
    */
   protected void validateInterfaceOperations(Interface interfac, InterfaceOperation[] interfaceOperations,
ErrorReporter errorReporter) throws WSDLException
   {
-    testAssertionInterfaceOperation0035(interfaceOperations, errorReporter);
-	  
 	int numInterfaceOperations = interfaceOperations.length;
 	for(int j = 0; j < numInterfaceOperations; j++)
 	{
       InterfaceOperation interfaceOperation = interfaceOperations[j];
 		
       testAssertionMEP1022(interfaceOperation.getMessageExchangePattern(), errorReporter);
-      testAssertionInterfaceOperation0029(interfaceOperation, interfac, errorReporter);
 		
       validateInterfaceMessageReferences(interfaceOperation.getInterfaceMessageReferences(),
errorReporter);
 		
@@ -118,27 +113,6 @@
   }
   
   /**
-   * Validate the interface faults in the WSDL component model.
-   * 
-   * @param interfac The interface that contains the interface faults.
-   * @param interfaceFaults An array of the interface faults.
-   * @param errorReporter An error reporter.
-   * @throws WSDLException
-   */
-  protected void validateInterfaceFaults(Interface interfac, InterfaceFault[] interfaceFaults,
ErrorReporter errorReporter) throws WSDLException
-  {
-    testAssertionInterfaceFault0032(interfaceFaults, errorReporter);
-	  
-    int numInterfaceFaults = interfaceFaults.length;
-    for(int j = 0; j < numInterfaceFaults; j++)
-    {
-      InterfaceFault interfaceFault = interfaceFaults[j];
-		
-      testAssertionInterfaceFault0028(interfaceFault, interfac, errorReporter);
-    }
-  }
-  
-  /**
    * Validate the interface message references in the WSDL component model.
    * 
    * @param messageReferences An array containing the interface message references.
@@ -318,8 +292,6 @@
    */
   protected void  validateEndpoints(Endpoint[] endpoints, Description desc, ErrorReporter
errorReporter) throws WSDLException
   {
-	  testAssertionEndpoint0065(endpoints, errorReporter);
-
 	  int numEndpoints = endpoints.length;
 	  for(int i = 0; i < numEndpoints; i++)
 	  {
@@ -423,108 +395,6 @@
   }
   
   /**
-   * Test assertion InterfaceOperation-0029. The namespace name of the interface operation
-   * must be the same as the namespace name of the interface.
-   * 
-   * @param interfaceOperation The interface operation to check the namespace of.
-   * @param interfac The interface parent of the interface operation.
-   * @param errorReporter The error reporter.
-   * @return True if the assertion passes, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean testAssertionInterfaceOperation0029(InterfaceOperation interfaceOperation,
Interface interfac, ErrorReporter errorReporter) throws WSDLException
-  {
-	if(!interfaceOperation.getName().getNamespaceURI().equals(interfac.getName().getNamespaceURI()))
//TODO null checks
-	{
-	  errorReporter.reportError(new ErrorLocatorImpl(), "InterfaceOperation-0029", new Object[]{},
ErrorReporter.SEVERITY_ERROR);
-	  return false;
-	}
-	return true;
-  }
-  
-  /**
-   * Test assertion InterfaceOperation-0035. An interface operation must have a unique name
out of all the interface
-   * operations defined in an interface component.
-   * 
-   * @param interfaceOperations The interface operations to check for duplicate names.
-   * @param errorReporter The error reporter.
-   * @return True if the assertion passes, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean testAssertionInterfaceOperation0035(InterfaceOperation[] interfaceOperations,
ErrorReporter errorReporter) throws WSDLException
-  {
-	List names = new ArrayList();
-	int numInterfaces = interfaceOperations.length;
-	for(int i = 0; i < numInterfaces; i++)
-	{
-	  QName name = interfaceOperations[i].getName();
-      if(name == null)
-        continue;
-	  if(names.contains(name))
-	  {
-		errorReporter.reportError(new ErrorLocatorImpl(), "InterfaceOperation-0035", new Object[]{name},
ErrorReporter.SEVERITY_ERROR);
-		return false;
-	  }
-	  else
-	  {
-		names.add(name);
-	  }
-	}
-	return true;
-  }
-  
-  /**
-   * Test assertion InterfaceFault-0032. An interface fault must have a unique name out of
all the interface
-   * faults defined in an interface component.
-   * 
-   * @param interfaceFaults The interface faults to check for duplicate names.
-   * @param errorReporter The error reporter.
-   * @return True if the assertion passes, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean testAssertionInterfaceFault0032(InterfaceFault[] interfaceFaults, ErrorReporter
errorReporter) throws WSDLException
-  {
-	List names = new ArrayList();
-	int numInterfaceFaults = interfaceFaults.length;
-	for(int i = 0; i < numInterfaceFaults; i++)
-	{
-	  QName name = interfaceFaults[i].getName();
-      if(name == null)
-        continue;
-	  if(names.contains(name))
-	  {
-		errorReporter.reportError(new ErrorLocatorImpl(), "InterfaceFault-0032", new Object[]{name},
ErrorReporter.SEVERITY_ERROR);
-		return false;
-	  }
-	  else
-	  {
-		names.add(name);
-	  }
-	}
-	return true;
-  }
-  
-  /**
-   * Test assertion InterfaceFault-0028. The namespace name of the interface fault
-   * must be the same as the namespace name of the interface.
-   * 
-   * @param interfaceFault The interface fault to check the namespace of.
-   * @param interfac The interface parent of the interface fault.
-   * @param errorReporter The error reporter.
-   * @return True if the assertion passes, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean testAssertionInterfaceFault0028(InterfaceFault interfaceFault, Interface
interfac, ErrorReporter errorReporter) throws WSDLException
-  {
-	if(!interfaceFault.getName().getNamespaceURI().equals(interfac.getName().getNamespaceURI()))
//TODO null checks
-	{
-	  errorReporter.reportError(new ErrorLocatorImpl(), "InterfaceFault-0028", new Object[]{},
ErrorReporter.SEVERITY_ERROR);
-	  return false;
-	}
-	return true;
-  }
-  
-  /**
    * Test assertion InterfaceMessageReference-1028. When the {message content model} property

    * has the value #any or #none the {element declaration} property MUST be empty.
    * 
@@ -957,38 +827,6 @@
 	  else
 	  {
 		names.add(name);
-	  }
-	}
-	return true;
-  }
-  
-  /**
-   * Test assertion Endpoint-0065. For each Endpoint component in the {endpoints} property

-   * of a Service component, the {name} property MUST be unique.
-   * 
-   * @param endpoints An array containing all the endpoints for a service in the description
component.
-   * @param errorReporter The error reporter.
-   * @return True if all endpoints in the array contain unique names, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean  testAssertionEndpoint0065(Endpoint[] endpoints, ErrorReporter errorReporter)
throws WSDLException
-  {
-	List names = new ArrayList();
-	int numEndpoints = endpoints.length;
-	for(int i = 0; i < numEndpoints; i++)
-	{
-	  NCName name = endpoints[i].getName();
-	  if(name == null)
-		continue;
-	  String sName = name.toString();
-	  if(names.contains(sName))
-	  {
-		errorReporter.reportError(new ErrorLocatorImpl(), "Endpoint-0065", new Object[]{sName},
ErrorReporter.SEVERITY_ERROR);
-		return false;
-	  }
-	  else
-	  {
-		names.add(sName);
 	  }
 	}
 	return true;

Modified: incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java?view=diff&rev=546889&r1=546888&r2=546889
==============================================================================
--- incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
(original)
+++ incubator/woden/trunk/java/src/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidator.java
Wed Jun 13 07:32:10 2007
@@ -179,8 +179,6 @@
 	for(int j = 0; j < numFaultElements; j++)
 	{
 	  InterfaceFaultElement faultElement = faultElements[j];
-      if(!testAssertionSchema0020b(descElement, faultElement, errorReporter))
-	    isValid = false;
 	  if(!testAssertionSchema1066(descElement, faultElement.getElementName().getNamespaceURI(),
errorReporter))
 	    isValid = false;
 	  }  
@@ -222,22 +220,7 @@
   protected boolean validateInterfaceMessageReferences(DescriptionElement descElement, InterfaceMessageReferenceElement[]
messageReferences, ErrorReporter errorReporter) throws WSDLException
   {
 	boolean isValid = true;
-	int numMessageReferences = messageReferences.length;
-	for(int k = 0; k < numMessageReferences; k++)
-	{
-	  InterfaceMessageReferenceElement messageReference = messageReferences[k];
-	  if(!testAssertionSchema0020(descElement, messageReference, errorReporter))
-	    isValid = false;
-	      
-	  // Only call the namespace assertion if the referenced element name is not null.
-      //Schema-1066 removed from spec during CR phase
-	  //QName elementName = messageReference.getElementName();
-	  //if(elementName != null)
-	  //{
-	  //  if(!testAssertionSchema0016(descElement, elementName.getNamespaceURI(), errorReporter))
-	  //	  isValid = false;
-	  //}      
-    }
+    //WODEN-149 removed assertion Schema-0020 from this method. InterfaceMessageReference
assertions to be implemented.
 	return isValid;
   }
   
@@ -418,56 +401,6 @@
 	  }
 	}
 	return isValid;
-  }
-  
-  /**
-   * Test assertion Schema-0020. An interface message reference element must
-   * not refer to an xs:simpleType or xs:complexType.
-   * 
-   * @param descElement The description element of the document.
-   * @param messageReference The message reference to check.
-   * @param errorReporter The error Reporter.
-   * @return True if the assertion passes, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean testAssertionSchema0020(DescriptionElement descElement, InterfaceMessageReferenceElement
messageReference, ErrorReporter errorReporter) throws WSDLException
-  {
-	XmlSchemaElement element = messageReference.getElement();
-	String contentModel = messageReference.getMessageContentModel();
-    if(element == null && (contentModel == null || !contentModel.equals(Constants.NMTOKEN_NONE)))
-    {
-      QName elementName = messageReference.getElementName();
-      if(descElement.toComponent().getTypeDefinition(elementName) != null)
-      {
-    	errorReporter.reportError(new ErrorLocatorImpl(), "Schema-0020", new Object[]{messageReference.getMessageLabel(),
elementName}, ErrorReporter.SEVERITY_ERROR);
-  	    return false;
-      }
-    }
-    return true;
-  }
-  
-  /**
-   * Test assertion Schema-0020. An interface fault element must
-   * not refer to an xs:simpleType or xs:complexType.
-   * 
-   * @param descElement The description element of the document.
-   * @param faultElement The fault element to check.
-   * @param errorReporter The error Reporter.
-   * @return True if the assertion passes, false otherwise.
-   * @throws WSDLException
-   */
-  protected boolean testAssertionSchema0020b(DescriptionElement descElement, InterfaceFaultElement
faultElement, ErrorReporter errorReporter) throws WSDLException
-  {
-    if(faultElement.getElement() == null)
-    {
-      QName elementName = faultElement.getElementName();
-      if(descElement.toComponent().getTypeDefinition(elementName) != null)
-      {
-    	errorReporter.reportError(new ErrorLocatorImpl(), "Schema-0020b", new Object[]{faultElement.getName(),
elementName}, ErrorReporter.SEVERITY_ERROR);
-  	    return false;
-      }
-    }
-    return true;
   }
   
   /**

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?view=diff&rev=546889&r1=546888&r2=546889
==============================================================================
--- 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
Wed Jun 13 07:32:10 2007
@@ -384,345 +384,6 @@
   }
   
   /**
-   * Test that the testAssertionInterfaceOperation0029 method returns
-   * true if the namespace of the interface operation name is the same 
-   * as the namespace of the interface name, false otherwise.
-   */
-  public void testTestAssertionInterfaceOperation0029()
-  {
-    // Test that the method returns true if the namespaces are the same.
-	try
-	{
-      // create an element model by setting interface and interfaceoperation elements
-      // on the DescriptionElement. This is synonymous to parsing a WSDL file 
-      QName interfaceName = new QName("http://www.sample.org", "interfacename");
-      DescriptionElement descElem = new DescriptionImpl();
-      descElem.setTargetNamespace(new URI(interfaceName.getNamespaceURI()));
-      
-      // Create and add an interface element to the description element
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      
-	  interfaceElem.setName(new NCName(interfaceName.getLocalPart()));
-      
-      // Create and add an interface operation element to the interface element
-      InterfaceOperationElement interfaceOperationElem = interfaceElem.addInterfaceOperationElement();
-      
-	  interfaceOperationElem.setName(new NCName("interfaceoperation"));
-      
-      // turn the DescriptionElement to a Description component - the only way to do
-      // this is to cast it. Then run the validator over the Description
-      QName testIfName = new QName("http://www.sample.org", "interfacename");
-      QName testIfOpName = new QName("http://www.sample.org", "interfaceoperation");
-      Interface testIf = ((Description)descElem).getInterface(testIfName);
-      InterfaceOperation testIfOp = testIf.getInterfaceOperation(testIfOpName);
-      
-      if(!val.testAssertionInterfaceOperation0029(testIfOp, testIf, reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0029 method returned false for an interface
operation with the same namespace as the containing interface.");
-	  }
-	}
-	catch(Exception e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-  }
-		
-  /**
-   * Test that the testAssertionInterfaceOperation0035 method returns
-   * true if the list of interface operations contains no interface
-   * operations with duplicate names, false otherwise.
-   */
-  public void testTestAssertionInterfaceOperation0035()
-  {
-    // Test that the assertion returns true for an empty list of interface operations.
-	try
-	{
-	  if(!val.testAssertionInterfaceOperation0035(new InterfaceOperation[]{}, reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0035 method returned false for an empty list
of interface operations.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that the assertion returns true for an interface operation with no name.
-	try
-	{
-      InterfaceOperationImpl interfaceOperation = new InterfaceOperationImpl();
-	  if(!val.testAssertionInterfaceOperation0035(new InterfaceOperation[]{interfaceOperation},
reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0035 method returned false for an interface
operation with no name.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that the assertion returns true for an interface operation that is the only interface
operation defined.
-	try
-	{
-      // Use this DescriptionElement as the container for an InterfaceElement which is a
-      // container for InterfaceOperationElements we're going to test. The
-      // InterfaceOperationElement.getName() method fetches the targetNamespace from the
-      // enclosing DescriptionElement.
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      InterfaceOperationElement ioe = ie.addInterfaceOperationElement();
-      InterfaceOperation interfaceOperation = (InterfaceOperation)ioe;
-      
-      ioe.setName(name1);
-	  if(!val.testAssertionInterfaceOperation0035(new InterfaceOperation[]{interfaceOperation},
reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0035 method returned false for an interface
operation that is the only interface operation defined.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns true for a list of interface operations that contains
no duplicate names.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-          
-	  InterfaceOperationElement interfaceOperation = ie.addInterfaceOperationElement();
-	  interfaceOperation.setName(name1);
-	  InterfaceOperationElement interfaceOperation2 = ie.addInterfaceOperationElement();
-	  interfaceOperation2.setName(name2);
-	  InterfaceOperationElement interfaceOperation3 = ie.addInterfaceOperationElement();
-	  interfaceOperation3.setName(name3);
-	  
-	  InterfaceOperation[] interfaceOperations = new InterfaceOperation[]{(InterfaceOperationImpl)interfaceOperation,
(InterfaceOperationImpl)interfaceOperation2, (InterfaceOperationImpl)interfaceOperation3};
-	  
-	  if(!val.testAssertionInterfaceOperation0035(interfaceOperations, reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0035 method returned false for a list of interface
operations that contains no duplicate names.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns false for two interface operations that are defined with
the same QName object.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      
-      InterfaceOperationElement interfaceOperation = ie.addInterfaceOperationElement();
-      interfaceOperation.setName(name1);
-      InterfaceOperationElement interfaceOperation2 = ie.addInterfaceOperationElement();
-      interfaceOperation2.setName(name2);
-      InterfaceOperationElement interfaceOperation3 = ie.addInterfaceOperationElement();
-      interfaceOperation3.setName(name1);
-	  
-	  InterfaceOperation[] interfaceOperations = new InterfaceOperation[]{(InterfaceOperationImpl)interfaceOperation,
(InterfaceOperationImpl)interfaceOperation2, (InterfaceOperationImpl)interfaceOperation3};
-	  
-	  if(val.testAssertionInterfaceOperation0035(interfaceOperations, reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0035 method returned true for a list of interface
operations that contains two interface operations defined with the same QName object.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns false for two interface operations that are defined with
the same name and
-	// different NCName objects.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      
-      InterfaceOperationElement interfaceOperation = ie.addInterfaceOperationElement();
-      interfaceOperation.setName(name1);
-      InterfaceOperationElement interfaceOperation2 = ie.addInterfaceOperationElement();
-      interfaceOperation2.setName(name2);
-      InterfaceOperationElement interfaceOperation3 = ie.addInterfaceOperationElement();
-	  interfaceOperation3.setName(new NCName("name1"));
-	  
-	  InterfaceOperation[] interfaceOperations = new InterfaceOperation[]{(InterfaceOperationImpl)interfaceOperation,
(InterfaceOperationImpl)interfaceOperation2, (InterfaceOperationImpl)interfaceOperation3};
-	  
-	  if(val.testAssertionInterfaceOperation0035(interfaceOperations, reporter))
-	  {
-	    fail("The testAssertionInterfaceOperation0035 method returned true for a list of interface
operations that contains two interface operations with the same name defined with different
QName objects.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-  }
-  
-  /**
-   * Test that the testAssertionInterfaceFault0032 method returns
-   * true if the list of interface faults contains no interface
-   * faults with duplicate names, false otherwise.
-   */
-  public void testTestAssertionInterfaceFault0032()
-  {
-    // Test that the assertion returns true for an empty list of interface faults.
-	try
-	{
-	  if(!val.testAssertionInterfaceFault0032(new InterfaceFault[]{}, reporter))
-	  {
-	    fail("The testAssertionInterfaceFault0032 method returned false for an empty list of
interface faults.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that the assertion returns true for an interface fault that is the only interface
fault defined.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      
-	  InterfaceFaultElement interfaceFault = ie.addInterfaceFaultElement();
-	  interfaceFault.setName(name1);
-	  if(!val.testAssertionInterfaceFault0032(new InterfaceFault[]{(InterfaceFaultImpl)interfaceFault},
reporter))
-	  {
-	    fail("The testAssertionInterfaceFault0032 method returned false for an interface fault
that is the only interface fault defined.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns true for a list of interface faults that contains no
duplicate names.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      
-      InterfaceFaultElement interfaceFault = ie.addInterfaceFaultElement();
-	  interfaceFault.setName(name1);
-      InterfaceFaultElement interfaceFault2 = ie.addInterfaceFaultElement();
-	  interfaceFault2.setName(name2);
-      InterfaceFaultElement interfaceFault3 = ie.addInterfaceFaultElement();
-	  interfaceFault3.setName(name3);
-	  
-	  InterfaceFault[] interfaceFaults = new InterfaceFault[]{(InterfaceFaultImpl)interfaceFault,
(InterfaceFaultImpl)interfaceFault2, (InterfaceFaultImpl)interfaceFault3};
-	  
-	  if(!val.testAssertionInterfaceFault0032(interfaceFaults, reporter))
-	  {
-	    fail("The testAssertionInterfaceFault0032 method returned false for a list of interface
faults that contains no duplicate names.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns false for two interface faults that are defined with
the same QName object.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      
-      InterfaceFaultElement interfaceFault = ie.addInterfaceFaultElement();
-      interfaceFault.setName(name1);
-      InterfaceFaultElement interfaceFault2 = ie.addInterfaceFaultElement();
-      interfaceFault2.setName(name2);
-      InterfaceFaultElement interfaceFault3 = ie.addInterfaceFaultElement();
-      interfaceFault3.setName(name1);
-      
-      InterfaceFault[] interfaceFaults = new InterfaceFault[]{(InterfaceFaultImpl)interfaceFault,
(InterfaceFaultImpl)interfaceFault2, (InterfaceFaultImpl)interfaceFault3};
-	  
-	  if(val.testAssertionInterfaceFault0032(interfaceFaults, reporter))
-	  {
-	    fail("The testAssertionInterfaceFault0032 method returned true for a list of interface
faults that contains two interface faults defined with the same QName object.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns false for two interface faults that are defined with
the same name and
-	// different NCName objects.
-	try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      InterfaceElement ie = descElem.addInterfaceElement();
-      
-      InterfaceFaultElement interfaceFault = ie.addInterfaceFaultElement();
-      interfaceFault.setName(name1);
-      InterfaceFaultElement interfaceFault2 = ie.addInterfaceFaultElement();
-      interfaceFault2.setName(name2);
-      InterfaceFaultElement interfaceFault3 = ie.addInterfaceFaultElement();
-	  interfaceFault3.setName(new NCName("name1"));
-	  
-      InterfaceFault[] interfaceFaults = new InterfaceFault[]{(InterfaceFaultImpl)interfaceFault,
(InterfaceFaultImpl)interfaceFault2, (InterfaceFaultImpl)interfaceFault3};
-	  
-	  if(val.testAssertionInterfaceFault0032(interfaceFaults, reporter))
-	  {
-	    fail("The testAssertionInterfaceFault0032 method returned true for a list of interface
faults that contains two interface faults with the same name defined with different QName
objects.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-  }
-  
-  /**
-   * Test that the testAssertionInterfaceFault0028 method returns
-   * true if the namespace of the interface fault name is the same 
-   * as the namespace of the interface name, false otherwise.
-   */
-  public void testTestAssertionInterfaceFault0028()
-  {
-    // Test that the method returns true if the namespaces are the same.
-	try
-	{
-      DescriptionImpl desc = new DescriptionImpl();
-      InterfaceImpl interfac = (InterfaceImpl)desc.addInterfaceElement();
-	  interfac.setName(new NCName("interfacename"));
-      InterfaceFaultElement interfaceFault = interfac.addInterfaceFaultElement();
-      interfaceFault.setName(new NCName("interfaceoperation"));
-	  if(!val.testAssertionInterfaceFault0028((InterfaceFaultImpl)interfaceFault, interfac,
reporter))
-	  {
-	    fail("The testAssertionInterfaceFault0028 method returned false for an interface fault
with the same namespace as the containing interface.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-		
-    // This test no longer possible as can't set namespace of name attribute
-    // as it's now represented (correctly) an NCName
-//    // Test that the method returns false if the namespaces are different.
-//	try
-//	{
-//      DescriptionImpl desc = new DescriptionImpl();
-//      InterfaceImpl interfac = (InterfaceImpl)desc.createInterfaceElement();
-//	  interfac.setName(new QName("http://www.sample.org", "interfacename"));
-//	  InterfaceFaultImpl interfaceFault = new InterfaceFaultImpl();
-//	  interfaceFault.setName(new QName("http://www.sample2.org", "interfaceoperation"));
-//	  if(val.testAssertionInterfaceFault0028(interfaceFault, interfac, reporter))
-//	  {
-//	    fail("The testAssertionInterfaceFault0028 method returned true for an interface fault
with a different namespace than the containing interface.");
-//	  }
-//	}
-//	catch(WSDLException e)
-//	{
-//	  fail("There was a problem running the test assertion method " + e);
-//	}
-  }
-  
-  /**
    * Test that the testAssertionInterfaceMessageReference1028 method returns
    * true if the message content model is #any or #none and the element
    * declartion is empty, false otherwise.
@@ -2516,142 +2177,6 @@
 	  if(val.testAssertionService1060(services, reporter))
 	  {
 	    fail("The testAssertionService1060 method returned true for a list of services that
contains two services with the same name defined with different QName objects.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-  }
-  
-  /**
-   * Test that the testAssertionEndpoint0065 method returns
-   * true if the list of endpoints contains no endpoints
-   * with duplicate names, false otherwise.
-   */
-  public void testTestAssertionEndpoint0065()
-  {
-	NCName name1 = new NCName("name1");
-	NCName name2 = new NCName("name2");
-	NCName name3 = new NCName("name3");
-	
-	// Test that the assertion returns true for an empty list of endpoints.
-	try
-	{
-	  if(!val.testAssertionEndpoint0065(new Endpoint[]{}, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned false for an empty list of endpoints.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that the assertion returns true for an endpoint with no name.
-	try
-	{
-	  EndpointImpl endpoint = new EndpointImpl();
-	  if(!val.testAssertionEndpoint0065(new Endpoint[]{endpoint}, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned false for an endpoint with no defined
name.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns true for an endpoint an empty NCname.
-	try
-	{
-	  EndpointImpl endpoint = new EndpointImpl();
-	  endpoint.setName(new NCName());
-	  if(!val.testAssertionEndpoint0065(new Endpoint[]{endpoint}, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned false for an endpoint with an empty
NCName.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that the assertion returns true for an endpoint that is the only endpoint defined.
-	try
-	{
-	  EndpointImpl endpoint = new EndpointImpl();
-	  endpoint.setName(name1);
-	  if(!val.testAssertionEndpoint0065(new Endpoint[]{endpoint}, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned false for an endpoint that is the
only endpoint defined.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns true for a list of endpoints that contains no duplicate
names.
-	try
-	{
-	  EndpointImpl endpoint = new EndpointImpl();
-	  endpoint.setName(name1);
-	  EndpointImpl endpoint2 = new EndpointImpl();
-	  endpoint2.setName(name2);
-	  EndpointImpl endpoint3 = new EndpointImpl();
-	  endpoint3.setName(name3);
-	  
-	  Endpoint[] endpoints = new Endpoint[]{endpoint, endpoint2, endpoint3};
-	  
-	  if(!val.testAssertionEndpoint0065(endpoints, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned false for a list of endpoints that
contains no duplicate names.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns false for two endpoints that are defined with the same
NCName object.
-	try
-	{
-	  EndpointImpl endpoint = new EndpointImpl();
-	  endpoint.setName(name1);
-	  EndpointImpl endpoint2 = new EndpointImpl();
-	  endpoint2.setName(name2);
-	  EndpointImpl endpoint3 = new EndpointImpl();
-	  endpoint3.setName(name1);
-	  
-	  Endpoint[] endpoints = new Endpoint[]{endpoint, endpoint2, endpoint3};
-	  
-	  if(val.testAssertionEndpoint0065(endpoints, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned true for a list of endpoints that
contains two endpoints defined with the same NCName object.");
-	  }
-	}
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that the assertion returns false for two endpoints that are defined with the same
name and
-	// different NCName objects.
-	try
-	{
-	  EndpointImpl endpoint = new EndpointImpl();
-	  endpoint.setName(name1);
-	  EndpointImpl endpoint2 = new EndpointImpl();
-	  endpoint2.setName(name2);
-	  EndpointImpl endpoint3 = new EndpointImpl();
-	  endpoint3.setName(new NCName("name1"));
-	  
-	  Endpoint[] endpoints = new Endpoint[]{endpoint, endpoint2, endpoint3};
-	  
-	  if(val.testAssertionEndpoint0065(endpoints, reporter))
-	  {
-	    fail("The testAssertionEndpoint0065 method returned true for a list of endpoints that
contains two endpoints with the same name defined with different NCName objects.");
 	  }
 	}
 	catch(WSDLException e)

Modified: incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java?view=diff&rev=546889&r1=546888&r2=546889
==============================================================================
--- incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
(original)
+++ incubator/woden/trunk/java/test/org/apache/woden/internal/wsdl20/validation/WSDLDocumentValidatorTest.java
Wed Jun 13 07:32:10 2007
@@ -973,292 +973,6 @@
   }
   
   /**
-   * Test assertion Schema-0020. An interface message reference must not refer
-   * to an xs:simpleType or xs:complexType.
-   */
-  public void testTestAssertionSchema0020()
-  {
-    // Create a schema for use in the tests and add it to a types section.
-    InlinedSchema schema = new InlinedSchemaImpl();
-	try
-	{
-      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);
-      Document schemaDoc1 = builder.getDocument();
-      XmlSchemaCollection xsc = new XmlSchemaCollection();
-      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
-      URI schemaNS = new URI("http://www.sample.org");
-      schema.setSchemaDefinition(xs1);
-      schema.setNamespace(schemaNS);
-      TypesElement types = new DescriptionImpl().getTypesElement();
-      types.addSchema(schema);
-	}
-	catch(Exception e)
-	{
-	  fail("An error occurred while creating the sample types section.");
-	}
-	
-    // Test that true is returned when the element content is #none
-	handler.reset();
-	try
-	{
-	  DescriptionElement descElem = new DescriptionImpl();
-	  InterfaceElement interfaceElem = descElem.addInterfaceElement();
-	  InterfaceOperationElement interfaceOperation = interfaceElem.addInterfaceOperationElement();
-	  InterfaceMessageReferenceElement messageRef = interfaceOperation.addInterfaceMessageReferenceElement();
-	  messageRef.setMessageContentModel(Constants.NMTOKEN_NONE);
-	  messageRef.setElementName(new QName("http://www.sample.org","myElement"));
-	      
-      if(!val.testAssertionSchema0020(descElem, messageRef, reporter))
-      {
-		fail("The testAssertionSchema0020 method returned false for an message reference that has
an element set to #none.");
-	  }
-    }
-	catch(WSDLException e)
-	{
-	  fail("There was a problem running the test assertion method " + e);
-    }
-    
-	// Test that an interface message reference with a reference to an element
-	// does not return an error.
-	handler.reset();
-    try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      descElem.setExtensionRegistry(new PopulatedExtensionRegistry());
-      TypesElement types = descElem.getTypesElement();
-      types.addSchema(schema);
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      InterfaceOperationElement interfaceOperation = interfaceElem.addInterfaceOperationElement();
-      InterfaceMessageReferenceElement messageRef = interfaceOperation.addInterfaceMessageReferenceElement();
-      messageRef.setElementName(new QName("http://www.sample.org", "myElement"));
-      
-	  if(!val.testAssertionSchema0020(descElem, messageRef, reporter))
-	  {
-	    fail("The testAssertionSchema0020 method returned false for an message reference that
refers to a valid element.");
-	  }
-	}
-	catch(WSDLException e)
-    {
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that an interface message reference with a reference to an element
-	// that has not been defined does not return an error. This problem is checked
-	// by another assertion.
-	handler.reset();
-    try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      descElem.setExtensionRegistry(new PopulatedExtensionRegistry());
-      TypesElement types = descElem.getTypesElement();
-      types.addSchema(schema);
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      InterfaceOperationElement interfaceOperation = interfaceElem.addInterfaceOperationElement();
-      InterfaceMessageReferenceElement messageRef = interfaceOperation.addInterfaceMessageReferenceElement();
-      messageRef.setElementName(new QName("http://www.sample.org", "myElement2"));
-      
-	  if(!val.testAssertionSchema0020(descElem, messageRef, reporter))
-	  {
-	    fail("The testAssertionSchema0020 method returned false for an message reference that
refers to an element that has not been defined.");
-	  }
-	}
-	catch(WSDLException e)
-    {
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that an interface message reference with a reference to a type
-	// returns an error. 
-	handler.reset();
-    try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      descElem.setExtensionRegistry(new PopulatedExtensionRegistry());
-      TypesElement types = descElem.getTypesElement();
-      types.addSchema(schema);
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      InterfaceOperationElement interfaceOperation = interfaceElem.addInterfaceOperationElement();
-      InterfaceMessageReferenceElement messageRef = interfaceOperation.addInterfaceMessageReferenceElement();
-      messageRef.setElementName(new QName("http://www.sample.org", "myType"));
-      
-	  if(val.testAssertionSchema0020(descElem, messageRef, reporter))
-	  {
-	    fail("The testAssertionSchema0020 method returned true for an message reference that
refers to a type.");
-	  }
-	}
-	catch(WSDLException e)
-    {
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that a reference to a built in XML schema type such as xs:string returns an error.
-	// TODO: Enable this test once the workaround for schema types has been resolved.
-//	handler.reset();
-//    try
-//	{
-//      
-//      DescriptionElement descElem = new DescriptionImpl();
-//      InterfaceElement interfaceElem = descElem.createInterfaceElement();
-//      InterfaceOperationElement interfaceOperation = descElem.createInterfaceOperationElement();
-//      InterfaceMessageReferenceElement messageRef = descElem.createInterfaceMessageReferenceElement();
-//      messageRef.setElementName(new QName("http://www.w3.org/2001/XMLSchema", "string"));
-//      interfaceOperation.addInterfaceMessageReferenceElement(messageRef);
-//      interfaceElem.addInterfaceOperationElement(interfaceOperation);
-//      descElem.addInterfaceElement(interfaceElem);
-//      
-//	  if(val.testAssertionSchema0020(descElem, messageRef, reporter))
-//	  {
-//	    fail("The testAssertionSchema0020 method returned true for an message reference that
refers to a built in XML schema type.");
-//	  }
-//	}
-//	catch(WSDLException e)
-//    {
-//	  fail("There was a problem running the test assertion method " + e);
-//	}
-  }
-  
-  /**
-   * Test assertion Schema-0020b. An interface fault must not refer
-   * to an xs:simpleType or xs:complexType.
-   */
-  public void testTestAssertionSchema0020b()
-  {
-	// Create a schema for use in the tests and add it to a types section.
-    InlinedSchema schema = new InlinedSchemaImpl();
-	try
-	{
-      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);
-      Document schemaDoc1 = builder.getDocument();
-      XmlSchemaCollection xsc = new XmlSchemaCollection();
-      XmlSchema xs1 = xsc.read(schemaDoc1.getDocumentElement());
-      URI schemaNS = new URI("http://www.sample.org");
-      schema.setSchemaDefinition(xs1);
-      schema.setNamespace(schemaNS);
-      TypesElement types = new DescriptionImpl().getTypesElement();
-      types.addSchema(schema);
-	}
-	catch(Exception e)
-	{
-	  fail("An error occurred while creating the sample types section.");
-	}
-    
-	// Test that an interface fault with a reference to an element
-	// does not return an error.
-	handler.reset();
-    try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      TypesElement types = descElem.getTypesElement();
-      types.addSchema(schema);
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      InterfaceFaultElement fault = interfaceElem.addInterfaceFaultElement();
-      fault.setElementName(new QName("http://www.sample.org", "myElement"));
-      
-	  if(!val.testAssertionSchema0020b(descElem, fault, reporter))
-	  {
-	    fail("The testAssertionSchema0020b method returned false for a fault that refers to
a valid element.");
-	  }
-	}
-	catch(WSDLException e)
-    {
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that an interface fault with a reference to an element
-	// that has not been defined does not return an error. This problem is checked
-	// by another assertion.
-	handler.reset();
-    try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      TypesElement types = descElem.getTypesElement();
-      types.addSchema(schema);
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      InterfaceFaultElement fault = interfaceElem.addInterfaceFaultElement();
-      fault.setElementName(new QName("http://www.sample.org", "myElement2"));
-      
-	  if(!val.testAssertionSchema0020b(descElem, fault, reporter))
-	  {
-	    fail("The testAssertionSchema0020b method returned false for a fault that refers to
an element that has not been defined.");
-	  }
-	}
-	catch(WSDLException e)
-    {
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-    // Test that an interface message reference with a reference to a type
-	// returns an error. 
-	handler.reset();
-    try
-	{
-      DescriptionElement descElem = new DescriptionImpl();
-      TypesElement types = descElem.getTypesElement();
-      types.addSchema(schema);
-      InterfaceElement interfaceElem = descElem.addInterfaceElement();
-      InterfaceFaultElement fault = interfaceElem.addInterfaceFaultElement();
-      fault.setElementName(new QName("http://www.sample.org", "myType"));
-      
-	  if(val.testAssertionSchema0020b(descElem, fault, reporter))
-	  {
-	    fail("The testAssertionSchema0020b method returned true for a fault that refers to a
type.");
-	  }
-	}
-	catch(WSDLException e)
-    {
-	  fail("There was a problem running the test assertion method " + e);
-	}
-	
-	// Test that a reference to a built in XML schema type such as xs:string returns an error.
-	// TODO: Enable this test once the workaround for schema types has been resolved.
-//	handler.reset();
-//    try
-//	{
-//      DescriptionElement descElem = new DescriptionImpl();
-//      InterfaceElement interfaceElem = descElem.createInterfaceElement();
-//      InterfaceFaultElement fault = descElem.createInterfaceFaultElement();
-//      fault.setElementName(new QName("http://www.w3.org/2001/XMLSchema", "string"));
-//      interfaceElem.addInterfaceFaultElement(fault);
-//      descElem.addInterfaceElement(interfaceElem);
-//      
-//	  if(val.testAssertionSchema0020b(descElem, fault, reporter))
-//	  {
-//	    fail("The testAssertionSchema0020b method returned true for a fault that refers to
a built in XML schema type.");
-//	  }
-//	}
-//	catch(WSDLException e)
-//    {
-//	  fail("There was a problem running the test assertion method " + e);
-//	}
-  }
-  
-
-  /**
-   * TODO: this assertion has been removed from the WSDL2 spec during CR, so
-   * ignore this test method when reimplementing the validation code.
-   * 
    * Test assertion Schema-1066. References to XML schema components must only refer
    * to elements and types in namespaces that have been imported or inlined or that
    * are part of the XML schema namespace.



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


Mime
View raw message