Author: lmandel
Date: Mon Dec  5 15:05:33 2005
New Revision: 354217

URL: http://svn.apache.org/viewcvs?rev=354217&view=rev
Log:
Added validation and tests for assertions FeatureRef-0046, FeatureRef-0047, 
InterfaceFaultReference-0045, InterfaceMessageReference-0042, Property-0049, 
Property-0049b, Property-0050, and PropertyRef-0048.
Updated validation and test for assertion InterfaceFault-0032.

Modified:
    incubator/woden/java/src/org/apache/woden/internal/Messages.properties
    
incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
    
incubator/woden/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java

Modified: incubator/woden/java/src/org/apache/woden/internal/Messages.properties
URL: 
http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/Messages.properties?rev=354217&r1=354216&r2=354217&view=diff
==============================================================================
--- incubator/woden/java/src/org/apache/woden/internal/Messages.properties 
(original)
+++ incubator/woden/java/src/org/apache/woden/internal/Messages.properties Mon 
Dec  5 15:05:33 2005
@@ -184,11 +184,11 @@
 Description-0024.ref = 2.1.2
 Description-0024.assertion = Each WSDL 2.0 or type system component MUST be 
uniquely identified by its qualified name.
 
-FeatureRef-0046 = 
+FeatureRef-0046 = The ref '{0}' specified for this feature is not absolute. 
The ref must be absolute.
 FeatureRef-0046.ref = 2.7.1
 FeatureRef-0046.assertion = This xs:anyURI MUST be an absolute IRI as defined 
by [IETF RFC 3987].
 
-FeatureRef-0047 = 
+FeatureRef-0047 = The ref '{0}' has already been specified for a feature in 
this component. The ref property for a feature must be unique within the 
enclosing component.
 FeatureRef-0047.ref = 2.7.1
 FeatureRef-0047.assertion = The {ref} property of a Feature component MUST be 
unique within the {features} property of an Interface, Interface Fault, 
Interface Operation, Interface Message Reference, Interface Fault Reference, 
Binding, Binding Fault, Binding Operation, Binding Message Reference, Binding 
Fault Reference, Service, or Endpoint component.
 
@@ -220,7 +220,7 @@
 InterfaceFaultReference-0044.ref = 2.6.1
 InterfaceFaultReference-0044.assertion = The direction MUST be consistent with 
the direction implied by the fault propagation ruleset used in the message 
exchange pattern of the operation.
 
-InterfaceFaultReference-0045 = 
+InterfaceFaultReference-0045 = An interface fault reference with for the fault 
'{0}' and message label '{1}' has already been defined for this interface 
operation. Each fault reference in an interface operation must have a unique 
combination of fault and message label.
 InterfaceFaultReference-0045.ref = 2.6.1
 InterfaceFaultReference-0045.assertion = For each Interface Fault Reference 
component in the {interface fault references} property of an Interface 
Operation component, the combination of its {interface fault} and {message 
label} properties MUST be unique.
 
@@ -232,7 +232,7 @@
 InterfaceMessageReference-0041.ref = 2.5.1
 InterfaceMessageReference-0041.assertion = When the {message content model} 
property has the value #any or #none the {element declaration} property MUST be 
empty.
 
-InterfaceMessageReference-0042 = 
+InterfaceMessageReference-0042 = An interface message reference with the 
message label '{0}' has already been defined. An interface message reference 
must have a unique message label within the interface operation that contains 
it.
 InterfaceMessageReference-0042.ref = 2.5.1
 InterfaceMessageReference-0042.assertion = For each Interface Message 
Reference component in the {interface message references} property of an 
Interface Operation component, its {message label} property MUST be unique.
 
@@ -260,11 +260,15 @@
 MessageLabel-0039.ref = 2.5.1
 MessageLabel-0039.assertion = The value of this property MUST match the name 
of a placeholder message defined by the message exchange pattern.
 
-Property-0049 = 
+Property-0049 = The constraint references type '{0}' that is not available. A 
constraint may only reference types that are available in the description 
component.
 Property-0049.ref = 2.8.1
 Property-0049.assertion = A reference to a Type Definition component in the 
{type definitions} property of the Description component constraining the value 
of the Property, or the token #value if the {value} property is not empty.
 
-Property-0050 = 
+Property-0049b = The property value is not empty and the constraint is not 
#value. The constraint must be #value when the value is not empty.
+Property-0049b.ref = 2.8.1
+Property-0049b.assertion = A reference to a Type Definition component in the 
{type definitions} property of the Description component constraining the value 
of the Property, or the token #value if the {value} property is not empty.
+
+Property-0050 = The ref '{0}' has already been specified for a property in 
this component. The ref property for a property must be unique within the 
enclosing component.
 Property-0050.ref = 2.8.1
 Property-0050.assertion = The {ref} property of a Property component MUST be 
unique within the {properties} property of an Interface, Interface Fault, 
Interface Operation, Interface Message Reference, Interface Fault Reference, 
Binding, Binding Fault, Binding Operation, Binding Message Reference, Binding 
Fault Reference, Service, or Endpoint component.
 
@@ -272,7 +276,7 @@
 Property-0051.ref = 2.8.1.1
 Property-0051.assertion = All specified values MUST be equal and belong to 
each specified value set.
 
-PropertyRef-0048 = 
+PropertyRef-0048 = The ref '{0}' specified for this property is not absolute. 
The ref must be absolute.
 PropertyRef-0048.ref = 2.8.1
 PropertyRef-0048.assertion = This xs:anyURI MUST an absolute IRI as defined by 
[IETF RFC 3987].
 

Modified: 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
URL: 
http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java?rev=354217&r1=354216&r2=354217&view=diff
==============================================================================
--- 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
 (original)
+++ 
incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
 Mon Dec  5 15:05:33 2005
@@ -17,6 +17,7 @@
 
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Hashtable;
 import java.util.List;
 
 import javax.xml.namespace.QName;
@@ -26,20 +27,24 @@
 import org.apache.woden.internal.ErrorLocatorImpl;
 import org.apache.woden.internal.wsdl20.Constants;
 import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.Feature;
 import org.apache.woden.wsdl20.Interface;
 import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
 import org.apache.woden.wsdl20.InterfaceMessageReference;
 import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Property;
+import org.apache.woden.wsdl20.enumeration.MessageLabel;
 
 public class WSDLComponentValidator 
 {
   public void validate(Description desc, ErrorReporter errorReporter) throws 
WSDLException
   {
-    validateInterfaces(desc.getInterfaces(), errorReporter);
+    validateInterfaces(desc.getInterfaces(), desc, errorReporter);
                
   }
        
-  protected void validateInterfaces(Interface[] interfaces, ErrorReporter 
errorReporter) throws WSDLException
+  protected void validateInterfaces(Interface[] interfaces, Description desc, 
ErrorReporter errorReporter) throws WSDLException
   {
        testAssertionInterface0030(interfaces, errorReporter);
          
@@ -62,12 +67,94 @@
                testAssertionInterfaceOperation0029(interfaceOperation, 
interfac, errorReporter);
                
                InterfaceMessageReference[] messageReferences = 
interfaceOperation.getInterfaceMessageReferences();
+               
+               testAssertionInterfaceMessageReference0042(messageReferences, 
errorReporter);
+               
                int numMessageReferences = messageReferences.length;
                for(int k = 0; k < numMessageReferences; k++)
                {
                  InterfaceMessageReference messageReference = 
messageReferences[k];
                  
                  testAssertionInterfaceMessageReference0041(messageReference, 
errorReporter);
+                 
+                 Feature[] messageReferenceFeatures = 
messageReference.getFeatures();
+                 
+                 testAssertionFeatureRef0047(messageReferenceFeatures, 
errorReporter);
+                       
+                 int numMessageReferenceFeatures = 
messageReferenceFeatures.length;
+                 for(int l = 0; l < numMessageReferenceFeatures; l++)
+                 {
+                       
testAssertionFeatureRef0046(messageReferenceFeatures[l], errorReporter);
+                 }
+                 
+                 Property[] messageReferenceProperties = 
messageReference.getProperties();
+                 
+                 testAssertionProperty0050(messageReferenceProperties, 
errorReporter);
+                 
+                 int numMessageReferenceProperties = 
messageReferenceProperties.length;
+                 for(int l = 0; l < numMessageReferenceProperties; l++)
+                 {
+                       Property messageReferenceProperty = 
messageReferenceProperties[l];
+                       
+                       testAssertionPropertyRef0048(messageReferenceProperty, 
errorReporter);
+                       testAssertionProperty0049(messageReferenceProperty, 
desc, errorReporter);
+                       testAssertionProperty0049b(messageReferenceProperty, 
errorReporter);
+                 }
+               }
+               
+               InterfaceFaultReference[] faultReferences = 
interfaceOperation.getInterfaceFaultReferences();
+               
+               testAssertionInterfaceFaultReference0045(faultReferences, 
errorReporter);
+               
+               int numFaultReferences = faultReferences.length;
+               for(int k = 0; k < numFaultReferences; k++)
+               {
+                 Feature[] faultReferenceFeatures = 
faultReferences[k].getFeatures();
+                         
+                 testAssertionFeatureRef0047(faultReferenceFeatures, 
errorReporter);
+                               
+                 int numFaultReferenceFeatures = faultReferenceFeatures.length;
+                 for(int l = 0; l < numFaultReferenceFeatures; l++)
+                 {
+                       testAssertionFeatureRef0046(faultReferenceFeatures[l], 
errorReporter);
+                 }
+                 
+          Property[] faultReferenceProperties = 
faultReferences[k].getProperties();
+          
+          testAssertionProperty0050(faultReferenceProperties, errorReporter);
+                 
+                 int numFaultReferenceProperties = 
faultReferenceProperties.length;
+                 for(int l = 0; l < numFaultReferenceProperties; l++)
+                 {
+                       Property faultReferenceProperty = 
faultReferenceProperties[l];
+                       
+                       testAssertionPropertyRef0048(faultReferenceProperty, 
errorReporter);
+                       testAssertionProperty0049(faultReferenceProperty, desc, 
errorReporter);
+                       testAssertionProperty0049b(faultReferenceProperty, 
errorReporter);
+                 }
+               }
+               
+               Feature[] interfaceOperationFeatures = 
interfaceOperation.getFeatures();
+               
+               testAssertionFeatureRef0047(interfaceOperationFeatures, 
errorReporter);
+               
+               int numInterfaceOperationFeatures = 
interfaceOperationFeatures.length;
+               for(int k = 0; k < numInterfaceOperationFeatures; k++)
+               {
+                 testAssertionFeatureRef0046(interfaceOperationFeatures[k], 
errorReporter);
+               }
+               
+               Property[] interfaceOperationProperties = 
interfaceOperation.getProperties();
+               
+               testAssertionProperty0050(interfaceOperationProperties, 
errorReporter);
+                 
+               int numInterfaceOperationProperties = 
interfaceOperationProperties.length;
+               for(int k = 0; k < numInterfaceOperationProperties; k++)
+               {
+                 Property interfaceOperationProperty = 
interfaceOperationProperties[k];
+                 testAssertionPropertyRef0048(interfaceOperationProperty, 
errorReporter);
+                 testAssertionProperty0049(interfaceOperationProperty, desc, 
errorReporter);
+             testAssertionProperty0049b(interfaceOperationProperty, 
errorReporter);
                }
          }
          
@@ -80,18 +167,57 @@
                InterfaceFault interfaceFault = interfaceFaults[j];
                
                testAssertionInterfaceFault0028(interfaceFault, interfac, 
errorReporter);
+               
+               Feature[] interfaceFaultFeatures = interfaceFault.getFeatures();
+                 
+               testAssertionFeatureRef0047(interfaceFaultFeatures, 
errorReporter);
+                       
+               int numInterfaceFaultFeatures = interfaceFaultFeatures.length;
+               for(int k = 0; k < numInterfaceFaultFeatures; k++)
+               {
+                 testAssertionFeatureRef0046(interfaceFaultFeatures[k], 
errorReporter);
+               }
+               
+               Property[] interfaceFaultProperties = 
interfaceFault.getProperties();
+               
+               testAssertionProperty0050(interfaceFaultProperties, 
errorReporter);
+                 
+               int numInterfaceFaultProperties = 
interfaceFaultProperties.length;
+               for(int k = 0; k < numInterfaceFaultProperties; k++)
+               {
+                 Property interfaceFaultProperty = interfaceFaultProperties[k];
+                 
+                 testAssertionPropertyRef0048(interfaceFaultProperty, 
errorReporter);
+                 testAssertionProperty0049(interfaceFaultProperty, desc, 
errorReporter);
+                 testAssertionProperty0049b(interfaceFaultProperty, 
errorReporter);
+               }
+         }
+         
+         Feature[] interfaceFeatures = interfac.getFeatures();
+         
+         testAssertionFeatureRef0047(interfaceFeatures, errorReporter);
+               
+         int numInterfaceFeatures = interfaceFeatures.length;
+         for(int j = 0; j < numInterfaceFeatures; j++)
+         {
+               testAssertionFeatureRef0046(interfaceFeatures[j], 
errorReporter);
+         }
+         
+         Property[] interfaceProperties = interfac.getProperties();
+         
+         testAssertionProperty0050(interfaceProperties, errorReporter);
+         
+         int numInterfaceProperties = interfaceProperties.length;
+         for(int j = 0; j < numInterfaceProperties; j++)
+         {
+               Property interfaceProperty = interfaceProperties[j];
+               
+               testAssertionPropertyRef0048(interfaceProperty, errorReporter);
+               testAssertionProperty0049(interfaceProperty, desc, 
errorReporter);
+               testAssertionProperty0049b(interfaceProperty, errorReporter);
          }
        }
-               // Implement 46 and 47 for interface, fault, message ref, 
interface operation, fault ref
-//             feature-ref-0046 = 
-//             feature-ref-0046.ref = 2.7.1
-//             feature-ref-0046.assertion = This xs:anyURI MUST be an absolute 
IRI as defined by [IETF RFC 3987].
-       //
-               // # for interface, binding, and service
-//             feature-ref-0047 = 
-//             feature-ref-0047.ref = 2.7.1
-//             feature-ref-0047.assertion = The {ref} property of a Feature 
component MUST be unique within the {features} property of an Interface, 
Interface Fault, Interface Operation, Interface Message Reference, Interface 
Fault Reference, Binding, Binding Fault, Binding Operation, Binding Message 
Reference, Binding Fault Reference, Service, or Endpoint component.
-       //
+               
 
 //             
 //             # test for equivalence of two fault definitions. Should the 
equivalence code be in the InterfaceFault class.
@@ -107,19 +233,13 @@
 //             interface-fault-ref-0044.ref = 2.6.1
 //             interface-fault-ref-0044.assertion = The direction MUST be 
consistent with the direction implied by the fault propagation ruleset used in 
the message exchange pattern of the operation.
        //
-//             interface-fault-ref-0045 = 
-//             interface-fault-ref-0045.ref = 2.6.1
-//             interface-fault-ref-0045.assertion = For each Interface Fault 
Reference component in the {interface fault references} property of an 
Interface Operation component, the combination of its {interface fault} and 
{message label} properties MUST be unique.
-       //
+//             
 //             interface-message-ref-0040 = 
 //             interface-message-ref-0040.ref = 2.5.1
 //             interface-message-ref-0040.assertion = The direction MUST be 
the same as the direction of the message identified by the {message label} 
property in the {message exchange pattern} of the Interface Operation component 
this is contained within.
        //
 //             
-//             interface-message-ref-0042 = 
-//             interface-message-ref-0042.ref = 2.5.1
-//             interface-message-ref-0042.assertion = For each Interface 
Message Reference component in the {interface message references} property of 
an Interface Operation component, its {message label} property MUST be unique.
-       //
+//             
 //             
 //             interface-operation-0036 = 
 //             interface-operation-0036 = 2.4.1
@@ -283,8 +403,8 @@
   protected boolean testAssertionInterfaceFault0032(InterfaceFault[] 
interfaceFaults, ErrorReporter errorReporter) throws WSDLException
   {
        List names = new ArrayList();
-       int numInterfaces = interfaceFaults.length;
-       for(int i = 0; i < numInterfaces; i++)
+       int numInterfaceFaults = interfaceFaults.length;
+       for(int i = 0; i < numInterfaceFaults; i++)
        {
          QName name = interfaceFaults[i].getName();
          if(names.contains(name))
@@ -340,7 +460,246 @@
        }
        return true;
   }
- 
+  
+  /**
+   * Test assertion InterfaceMessageReference-0042. For each Interface Message 
Reference 
+   * component in the {interface message references} property of an Interface 
Operation 
+   * component, its {message label} property MUST be unique.
+   * 
+   * @param messageReferences The message references to check for duplicate 
names.
+   * @param errorReporter The error reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean 
testAssertionInterfaceMessageReference0042(InterfaceMessageReference[] 
messageReferences, ErrorReporter errorReporter) throws WSDLException
+  {
+       List messageLabels = new ArrayList();
+       int numMessageReferences = messageReferences.length;
+       for(int i = 0; i < numMessageReferences; i++)
+       {
+         MessageLabel messageLabel = messageReferences[i].getMessageLabel();
+         if(messageLabels.contains(messageLabel))
+         {
+               errorReporter.reportError(new ErrorLocatorImpl(), 
"InterfaceMessageReference-0042", new Object[]{messageLabel}, 
ErrorReporter.SEVERITY_ERROR);
+               return false;
+         }
+         else
+         {
+               messageLabels.add(messageLabel);
+         }
+       }
+       return true;
+  }
+  
+  /**
+   * Test assertion InterfaceFaultReference-0045. For each Interface Fault 
Reference 
+   * component in the {interface fault references} property of an Interface 
Operation 
+   * component, the combination of its {interface fault} and {message label} 
properties 
+   * MUST be unique.
+   * 
+   * @param faultReferences The fault references to check for duplicate 
fault/message label pairs.
+   * @param errorReporter The error reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean 
testAssertionInterfaceFaultReference0045(InterfaceFaultReference[] 
faultReferences, ErrorReporter errorReporter) throws WSDLException
+  {
+       Hashtable identifiers = new Hashtable();
+       
+       int numFaultReferences = faultReferences.length;
+       for(int i = 0; i < numFaultReferences; i++)
+       {
+         InterfaceFault fault = faultReferences[i].getInterfaceFault();
+         MessageLabel messageLabel = faultReferences[i].getMessageLabel();
+      if(fault == null || messageLabel == null)
+       continue;
+         List messageLabels = (List)identifiers.get(fault);
+         if(messageLabels != null && messageLabels.contains(messageLabel))
+         {
+           errorReporter.reportError(new ErrorLocatorImpl(), 
"InterfaceFaultReference-0045", new Object[]{fault, messageLabel}, 
ErrorReporter.SEVERITY_ERROR);
+               return false;
+      }
+         else
+         {
+               if(messageLabels == null)
+                 messageLabels = new ArrayList();
+               messageLabels.add(messageLabel);
+               identifiers.put(fault, messageLabels);
+         }
+       }
+       return true;
+  }
+  
+  /**
+   * Test assertion FeatureRef-0046. The feature ref xs:anyURI MUST be an 
+   * absolute IRI as defined by [IETF RFC 3987].
+   * 
+   * @param feature The feature to check the ref of.
+   * @param errorReporter The error reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean testAssertionFeatureRef0046(Feature feature, ErrorReporter 
errorReporter) throws WSDLException
+  {
+       URI ref = feature.getRef();
+    if(ref != null && !ref.isAbsolute())
+    {
+      errorReporter.reportError(new ErrorLocatorImpl(), "FeatureRef-0046", new 
Object[]{ref}, ErrorReporter.SEVERITY_ERROR);
+         return false;
+    }
+    return true;
+  }
+  
+  /**
+   * Test assertion FeatureRef-0047. The {ref} property of a 
+   * Feature component MUST be unique within the {features} 
+   * property of an Interface, Interface Fault, Interface Operation, 
+   * Interface Message Reference, Interface Fault Reference, Binding, 
+   * Binding Fault, Binding Operation, Binding Message Reference, 
+   * Binding Fault Reference, Service, or Endpoint component.
+   * 
+   * @param features The features within a given component to check the refs 
for uniqueness.
+   * @param errorReporter The error reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean testAssertionFeatureRef0047(Feature[] features, 
ErrorReporter errorReporter) throws WSDLException
+  {
+       boolean isValid = true;
+       List refs = new ArrayList();
+       int numFeatures = features.length;
+       for(int i = 0; i < numFeatures; i++)
+       {
+         URI ref = features[i].getRef();
+         if(ref == null)
+               continue;
+      if(refs.contains(ref))
+      {
+        errorReporter.reportError(new ErrorLocatorImpl(), "FeatureRef-0047", 
new Object[]{ref}, ErrorReporter.SEVERITY_ERROR);
+           isValid = false;
+      }
+      else
+      {
+       refs.add(ref);
+      }
+       }
+    return isValid;
+  }
+  
+  /**
+   * Test assertion PropertyRef-0048. The property ref xs:anyURI MUST be an 
+   * absolute IRI as defined by [IETF RFC 3987].
+   * 
+   * @param propertye The property to check the ref of.
+   * @param errorReporter The error reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean testAssertionPropertyRef0048(Property property, 
ErrorReporter errorReporter) throws WSDLException
+  {
+       URI ref = property.getRef();
+    if(ref != null && !ref.isAbsolute())
+    {
+      errorReporter.reportError(new ErrorLocatorImpl(), "PropertyRef-0048", 
new Object[]{ref}, ErrorReporter.SEVERITY_ERROR);
+         return false;
+    }
+    return true;
+  }
+  
+  /**
+   * Test assertion Property-0050. The {ref} property of a Property 
+   * component MUST be unique within the {properties} property of an 
+   * Interface, Interface Fault, Interface Operation, Interface Message 
+   * Reference, Interface Fault Reference, Binding, Binding Fault, 
+   * Binding Operation, Binding Message Reference, Binding Fault Reference, 
+   * Service, or Endpoint component.
+   * 
+   * @param properties The properties within a given component to check the 
refs for uniqueness.
+   * @param errorReporter The error reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean testAssertionProperty0050(Property[] properties, 
ErrorReporter errorReporter) throws WSDLException
+  {
+       boolean isValid = true;
+       List refs = new ArrayList();
+       int numProperties = properties.length;
+       for(int i = 0; i < numProperties; i++)
+       {
+         URI ref = properties[i].getRef();
+         if(ref == null)
+               continue;
+      if(refs.contains(ref))
+      {
+        errorReporter.reportError(new ErrorLocatorImpl(), "Property-0050", new 
Object[]{ref}, ErrorReporter.SEVERITY_ERROR);
+           isValid = false;
+      }
+      else
+      {
+       refs.add(ref);
+      }
+       }
+    return isValid;
+  }
+  
+  /**
+   * Test assertion Property-0049. A reference to a Type Definition 
+   * component in the {type definitions} property of the Description 
+   * component constraining the value of the Property, or the token 
+   * #value if the {value} property is not empty.
+   * 
+   * This test focuses on the first part of the statement, that the type
+   * definition references a type definition in the description component.
+   * 
+   * @param property The property for which to check the contstraint.
+   * @param desc The description component.
+   * @param errorReporter The error Reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean testAssertionProperty0049(Property property, Description 
desc, ErrorReporter errorReporter) throws WSDLException
+  {
+       QName constraint = property.toElement().getConstraintName();
+       if(constraint != null && desc.getTypeDefinition(constraint) == null)
+       {
+         errorReporter.reportError(new ErrorLocatorImpl(), "Property-0049", 
new Object[]{constraint}, ErrorReporter.SEVERITY_ERROR);
+         return false;
+       }
+    return true;
+  }
+  
+  /**
+   * Test assertion Property-0049. A reference to a Type Definition 
+   * component in the {type definitions} property of the Description 
+   * component constraining the value of the Property, or the token 
+   * #value if the {value} property is not empty.
+   * 
+   * This test focuses on the second part of the statement, checking that
+   * the constraint is set to #value if the value is not empty.
+   * 
+   * @param Property The property for which to check the contstraint.
+   * @param errorReporter The error Reporter.
+   * @return True if the assertion passes, false otherwise.
+   * @throws WSDLException
+   */
+  protected boolean testAssertionProperty0049b(Property property, 
ErrorReporter errorReporter) throws WSDLException
+  {
+       if(property.getValue() != null && !property.toElement().hasValueToken())
+       {
+         errorReporter.reportError(new ErrorLocatorImpl(), "Property-0049", 
new Object[]{}, ErrorReporter.SEVERITY_ERROR);
+         return false;
+       }
+    return true;
+  }
+  
+
+
+//     property-0051 = 
+//     property-0051.ref = 2.8.1.1
+//     property-0051.assertion = All specified values MUST be equal and belong 
to each specified value set.
+//
+//     
+  
 //
 //     # ---------------- WSDL Component Level Assertions -------------------
 //

Modified: 
incubator/woden/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
URL: 
http://svn.apache.org/viewcvs/incubator/woden/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java?rev=354217&r1=354216&r2=354217&view=diff
==============================================================================
--- 
incubator/woden/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
 (original)
+++ 
incubator/woden/java/test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
 Mon Dec  5 15:05:33 2005
@@ -28,14 +28,24 @@
 import org.apache.woden.WSDLException;
 import org.apache.woden.internal.ErrorReporterImpl;
 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.FeatureImpl;
 import org.apache.woden.internal.wsdl20.InterfaceFaultImpl;
+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.InterfaceOperationImpl;
+import org.apache.woden.internal.wsdl20.PropertyImpl;
+import org.apache.woden.internal.wsdl20.TypeDefinitionImpl;
+import org.apache.woden.wsdl20.Feature;
 import org.apache.woden.wsdl20.Interface;
 import org.apache.woden.wsdl20.InterfaceFault;
+import org.apache.woden.wsdl20.InterfaceFaultReference;
+import org.apache.woden.wsdl20.InterfaceMessageReference;
 import org.apache.woden.wsdl20.InterfaceOperation;
+import org.apache.woden.wsdl20.Property;
+import org.apache.woden.wsdl20.enumeration.MessageLabel;
 
 /**
  * A test class to test the assertion tests in the WSDLComponentValidator.
@@ -473,8 +483,7 @@
     // Test that the assertion returns true for an empty list of interface 
faults.
        try
        {
-         InterfaceFaultImpl interfaceFault = new InterfaceFaultImpl();
-         if(!val.testAssertionInterfaceFault0032(new 
InterfaceFault[]{interfaceFault}, reporter))
+         if(!val.testAssertionInterfaceFault0032(new InterfaceFault[]{}, 
reporter))
          {
            fail("The testAssertionInterfaceFault0032 method returned false for 
an empty list of interface faults.");
          }
@@ -703,6 +712,675 @@
          
if(!val.testAssertionInterfaceMessageReference0041(interfaceMessageReference, 
reporter))
          {
            fail("The testAssertionInterfaceMessageReference0041 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);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionInterfaceMessageReferencet0042 method returns
+   * true if the list of interface message references contains no duplicate
+   * message labels, false otherwise.
+   */
+  public void testTestAssertionInterfaceMessageReference0042()
+  {
+    // Test that the assertion returns true for an empty list of message 
references.
+       try
+       {
+         if(!val.testAssertionInterfaceMessageReference0042(new 
InterfaceMessageReference[]{}, reporter))
+         {
+           fail("The testAssertionInterfaceMessageReference0042 method 
returned false for an empty list of interface message references.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns true for an interface message reference 
that is the only interface message reference defined.
+       try
+       {
+         InterfaceMessageReferenceImpl interfaceMessageReference = new 
InterfaceMessageReferenceImpl();
+         interfaceMessageReference.setMessageLabel(MessageLabel.IN);
+         if(!val.testAssertionInterfaceMessageReference0042(new 
InterfaceMessageReference[]{interfaceMessageReference}, reporter))
+         {
+           fail("The testAssertionInterfaceMessageReference0042 method 
returned false for an interface message reference that is the only interface 
message reference 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 message 
references that contains no duplicate message labels.
+       try
+       {
+         InterfaceMessageReferenceImpl interfaceMessageReference = new 
InterfaceMessageReferenceImpl();
+         interfaceMessageReference.setMessageLabel(MessageLabel.IN);
+         InterfaceMessageReferenceImpl interfaceMessageReference2 = new 
InterfaceMessageReferenceImpl();
+         interfaceMessageReference2.setMessageLabel(MessageLabel.OUT);
+         
+         InterfaceMessageReference[] interfaceMessageReferences = new 
InterfaceMessageReference[]{interfaceMessageReference, 
interfaceMessageReference2};
+         
+         
if(!val.testAssertionInterfaceMessageReference0042(interfaceMessageReferences, 
reporter))
+         {
+           fail("The testAssertionInterfaceMessageReference0042 method 
returned false for a list of interface message references that contains no 
duplicate message labels.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns false for two interface message 
references that are defined with the same message label.
+       try
+       {
+         InterfaceMessageReferenceImpl interfaceMessageReference = new 
InterfaceMessageReferenceImpl();
+         interfaceMessageReference.setMessageLabel(MessageLabel.IN);
+         InterfaceMessageReferenceImpl interfaceMessageReference2 = new 
InterfaceMessageReferenceImpl();
+         interfaceMessageReference2.setMessageLabel(MessageLabel.OUT);
+         InterfaceMessageReferenceImpl interfaceMessageReference3 = new 
InterfaceMessageReferenceImpl();
+         interfaceMessageReference3.setMessageLabel(MessageLabel.IN);
+         
+         InterfaceMessageReference[] interfaceMessageReferences = new 
InterfaceMessageReference[]{interfaceMessageReference, 
interfaceMessageReference2, interfaceMessageReference3};
+         
+         
if(val.testAssertionInterfaceMessageReference0042(interfaceMessageReferences, 
reporter))
+         {
+           fail("The testAssertionInterfaceMessageReference0042 method 
returned true for a list of interface message references that contains two 
interface message references defined with the same message label.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionInterfaceFaultReference0045 method returns
+   * true if the list of interface fault references contains no duplicate
+   * fault/message label pairs, false otherwise.
+   */
+  public void testTestAssertionInterfaceFaultReference0045()
+  {
+    // Test that the assertion returns true for an interface fault reference 
list that is empy.
+       try
+       {
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for an interface fault reference list that is empty.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for an interface fault 
reference list with one entry.
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         faultReference.setMessageLabel(MessageLabel.IN);
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for an interface fault reference that is the only interface fault 
reference defined.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for two interface fault 
references that have both different
+       // faults and different message labels.
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         faultReference.setMessageLabel(MessageLabel.IN);
+         InterfaceFault fault2 = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference2 = new 
InterfaceFaultReferenceImpl();
+         faultReference2.setInterfaceFault(fault2);
+         faultReference2.setMessageLabel(MessageLabel.OUT);
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference, faultReference2}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for two interface fault references that have different faults and message 
labels.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for two interface fault 
references that have the same fault
+       // but different message labels
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         faultReference.setMessageLabel(MessageLabel.IN);
+         InterfaceFaultReferenceImpl faultReference2 = new 
InterfaceFaultReferenceImpl();
+         faultReference2.setInterfaceFault(fault);
+         faultReference2.setMessageLabel(MessageLabel.OUT);
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference, faultReference2}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for two interface fault references that have the same fault but different 
message labels.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for two interface fault 
references that have the same
+       // message label but different faults.
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         faultReference.setMessageLabel(MessageLabel.IN);
+         InterfaceFault fault2 = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference2 = new 
InterfaceFaultReferenceImpl();
+         faultReference2.setInterfaceFault(fault2);
+         faultReference2.setMessageLabel(MessageLabel.IN);
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference, faultReference2}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for two interface fault references that have different faults but the 
same message labels.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns false for two interface fault 
references that have the same
+       // fault and message label.
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         faultReference.setMessageLabel(MessageLabel.IN);
+         InterfaceFaultReferenceImpl faultReference2 = new 
InterfaceFaultReferenceImpl();
+         faultReference2.setInterfaceFault(fault);
+         faultReference2.setMessageLabel(MessageLabel.IN);
+         if(val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference, faultReference2}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
true for two interface fault references that have the same fault and message 
label.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the method returns true for an interface fault reference 
with a null message label.
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for an interface fault references with a null message labels.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the method returns true for an interface fault reference 
with a null fault.
+       try
+       {
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setMessageLabel(MessageLabel.IN);
+         if(!val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference}, reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
false for ano interface fault reference that has a null fault.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the method returns false for two interface fault 
references that have the same
+       // fault/message label and a third interface fault reference that has a 
null fault and is 
+       // defined second.
+       try
+       {
+         InterfaceFault fault = new InterfaceFaultImpl();
+         InterfaceFaultReferenceImpl faultReference = new 
InterfaceFaultReferenceImpl();
+         faultReference.setInterfaceFault(fault);
+         faultReference.setMessageLabel(MessageLabel.IN);
+         InterfaceFaultReferenceImpl faultReference2 = new 
InterfaceFaultReferenceImpl();
+         faultReference2.setInterfaceFault(fault);
+         faultReference2.setMessageLabel(MessageLabel.IN);
+         InterfaceFaultReferenceImpl faultReference3 = new 
InterfaceFaultReferenceImpl();
+         faultReference3.setMessageLabel(MessageLabel.OUT);
+         if(val.testAssertionInterfaceFaultReference0045(new 
InterfaceFaultReference[]{faultReference, faultReference3, faultReference2}, 
reporter))
+         {
+           fail("The testAssertionInterfaceFaultReference0045 method returned 
true for two interface fault references that have the same fault and message 
label and a third interface fault reference that has a null fault and is 
defined second.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionFeatureRef0046 method returns
+   * true if the feature ref is absolute, false otherwise.
+   */
+  public void testTestAssertionFeatureRef0046()
+  {
+    // Test that the assertion returns true for a feature with an absolute ref.
+       try
+       {
+         FeatureImpl feature = new FeatureImpl();
+         feature.setRef(new URI("http://www.sample.org";));
+         if(!val.testAssertionFeatureRef0046(feature, reporter))
+         {
+           fail("The testAssertionFeatureRef0046 method returned false for a 
feature with an absolute ref.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns false for a feature with a relative ref.
+       try
+       {
+         FeatureImpl feature = new FeatureImpl();
+         feature.setRef(new URI("sample.org"));
+         if(val.testAssertionFeatureRef0046(feature, reporter))
+         {
+           fail("The testAssertionFeatureRef0046 method returned true for a 
feature with a relative ref.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns true for a feature with a null ref. 
This will be
+       // caught be schema validation.
+       try
+       {
+         FeatureImpl feature = new FeatureImpl();
+         if(!val.testAssertionFeatureRef0046(feature, reporter))
+         {
+           fail("The testAssertionFeatureRef0046 method returned false for a 
feature with a null ref.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionFeatureRef0047 method returns
+   * true if all the features in the list have unique refs, false otherwise.
+   */
+  public void testTestAssertionFeatureRef0047()
+  {
+       // Test that the assertion returns true for an empty list. 
+       try
+       {
+         if(!val.testAssertionFeatureRef0047(new Feature[]{}, reporter))
+         {
+           fail("The testAssertionFeatureRef0047 method returned false for an 
empty feature list.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns true for only one feature.
+       try
+       {
+         FeatureImpl feature = new FeatureImpl();
+         feature.setRef(new URI("http://www.sample.org";));
+         if(!val.testAssertionFeatureRef0047(new Feature[]{feature}, reporter))
+         {
+           fail("The testAssertionFeatureRef0047 method returned false for a 
feature list with only one feature.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for multiple features with 
different refs.
+       try
+       {
+         FeatureImpl feature = new FeatureImpl();
+         feature.setRef(new URI("http://www.sample.org";));
+         FeatureImpl feature2 = new FeatureImpl();
+         feature2.setRef(new URI("http://www.sample2.org";));
+         FeatureImpl feature3 = new FeatureImpl();
+         feature3.setRef(new URI("http://www.sample3.org";));
+         if(!val.testAssertionFeatureRef0047(new Feature[]{feature, feature2, 
feature3}, reporter))
+         {
+           fail("The testAssertionFeatureRef0047 method returned false for a 
feature list with three features with unique refs.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns false for two features with the same 
ref.
+       try
+       {
+         FeatureImpl feature = new FeatureImpl();
+         feature.setRef(new URI("http://www.sample.org";));
+         FeatureImpl feature2 = new FeatureImpl();
+         feature2.setRef(new URI("http://www.sample.org";));
+         if(val.testAssertionFeatureRef0047(new Feature[]{feature, feature2}, 
reporter))
+         {
+           fail("The testAssertionFeatureRef0047 method returned true for a 
feature list with two features with the same ref.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionPropertyRef0048 method returns
+   * true if the property ref is absolute, false otherwise.
+   */
+  public void testTestAssertionPropertyRef0048()
+  {
+    // Test that the assertion returns true for a property with an absolute 
ref.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setRef(new URI("http://www.sample.org";));
+         if(!val.testAssertionPropertyRef0048(property, reporter))
+         {
+           fail("The testAssertionPropertyRef0048 method returned false for a 
property with an absolute ref.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns false for a feature with a relative ref.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setRef(new URI("sample.org"));
+         if(val.testAssertionPropertyRef0048(property, reporter))
+         {
+           fail("The testAssertionPropertyRef0048 method returned true for a 
property with a relative ref.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns true for a feature with a null ref. 
This will be
+       // caught be schema validation.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         if(!val.testAssertionPropertyRef0048(property, reporter))
+         {
+           fail("The testAssertionPropertyRef0048 method returned false for a 
property with a null ref.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionProperty0050 method returns
+   * true if all the properties in the list have unique refs, false otherwise.
+   */
+  public void testTestAssertionProperty0050()
+  {
+       // Test that the assertion returns true for an empty list. 
+       try
+       {
+         if(!val.testAssertionProperty0050(new Property[]{}, reporter))
+         {
+           fail("The testAssertionProperty0050 method returned false for an 
empty property list.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns true for only one property.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setRef(new URI("http://www.sample.org";));
+         if(!val.testAssertionProperty0050(new Property[]{property}, reporter))
+         {
+           fail("The testAssertionProperty0050 method returned false for a 
property list with only one property.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for multiple property with 
different refs.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setRef(new URI("http://www.sample.org";));
+         PropertyImpl property2 = new PropertyImpl();
+         property2.setRef(new URI("http://www.sample2.org";));
+         PropertyImpl property3 = new PropertyImpl();
+         property3.setRef(new URI("http://www.sample3.org";));
+         if(!val.testAssertionProperty0050(new Property[]{property, property2, 
property3}, reporter))
+         {
+           fail("The testAssertionProperty0050 method returned false for a 
property list with three property with unique refs.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns false for two property with the same 
ref.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setRef(new URI("http://www.sample.org";));
+         PropertyImpl property2 = new PropertyImpl();
+         property2.setRef(new URI("http://www.sample.org";));
+         if(val.testAssertionProperty0050(new Property[]{property, property2}, 
reporter))
+         {
+           fail("The testAssertionProperty0050 method returned true for a 
property list with two property with the same ref.");
+         }
+       }
+       catch(URISyntaxException e)
+       {
+         fail("There was a problem creating the ref URI for the test method " 
+ e);
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionProperty0049 method returns
+   * true if the type reference is valid, false otherwise.
+   */
+  public void testTestAssertionProperty0049()
+  {
+       // Test that the assertion returns true for a valid type.
+       try
+       {
+         DescriptionImpl desc = new DescriptionImpl();
+         TypeDefinitionImpl type = new TypeDefinitionImpl();
+         type.setName(new QName("http://www.sample.org";, "myType"));
+         desc.addTypeDefinition(type);
+         PropertyImpl property = new PropertyImpl();
+         property.setHasValueToken(false);
+         property.setConstraintName(new QName("http://www.sample.org";, 
"myType"));
+         if(!val.testAssertionProperty0049(property, desc, reporter))
+         {
+               fail("The testAssertionProperty0049 method returned false for a 
property with a constraint with a valid type.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns false for a type that does not exist.
+       try
+       {
+         DescriptionImpl desc = new DescriptionImpl();
+         TypeDefinitionImpl type = new TypeDefinitionImpl();
+         type.setName(new QName("http://www.sample.org";, "myType"));
+         desc.addTypeDefinition(type);
+         PropertyImpl property = new PropertyImpl();
+         property.setHasValueToken(false);
+         property.setConstraintName(new QName("http://www.sample.org";, 
"myType2"));
+         if(val.testAssertionProperty0049(property, desc, reporter))
+         {
+               fail("The testAssertionProperty0049 method returned true for a 
property with a constraint with an invalid type.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+       // Test that the assertion returns true for a null type.
+       try
+       {
+         DescriptionImpl desc = new DescriptionImpl();
+         TypeDefinitionImpl type = new TypeDefinitionImpl();
+         type.setName(new QName("http://www.sample.org";, "myType"));
+         desc.addTypeDefinition(type);
+         PropertyImpl property = new PropertyImpl();
+         property.setHasValueToken(false);
+         property.setConstraintName(null);
+         if(!val.testAssertionProperty0049(property, desc, reporter))
+         {
+               fail("The testAssertionProperty0049 method returned false for a 
property with a constraint with null type.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+  }
+  
+  /**
+   * Test that the testAssertionProperty0049b method returns
+   * true if constraint is #value if value is set, false otherwise.
+   */
+  public void testTestAssertionProperty0049b()
+  {
+    // Test that the assertion returns true for a constraint that is not 
#value when value is
+       // not set.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setHasValueToken(false);
+         property.setValueConstraint(new TypeDefinitionImpl());
+         if(!val.testAssertionProperty0049b(property, reporter))
+         {
+           fail("The testAssertionProperty0049b method returned false for a 
property with a constraint and no value.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns true for a constraint that is #value 
when value is
+       // set.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setHasValueToken(true);
+         property.setValue(new TypeDefinitionImpl());
+         if(!val.testAssertionProperty0049b(property, reporter))
+         {
+           fail("The testAssertionProperty0049b method returned false for a 
property with a value and constraint set to #value.");
+         }
+       }
+       catch(WSDLException e)
+       {
+         fail("There was a problem running the test assertion method " + e);
+       }
+       
+    // Test that the assertion returns false for a constraint that is not 
#value when value is
+       // set.
+       try
+       {
+         PropertyImpl property = new PropertyImpl();
+         property.setHasValueToken(false);
+         property.setValueConstraint(new TypeDefinitionImpl());
+         property.setValue(new TypeDefinitionImpl());
+         if(val.testAssertionProperty0049b(property, reporter))
+         {
+           fail("The testAssertionProperty0049b method returned true for a 
property with a value and constraint not set to #value.");
          }
        }
        catch(WSDLException e)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to