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=477689&r1=477688&r2=477689 ============================================================================== --- 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 Tue Nov 21 06:45:11 2006 @@ -33,15 +33,12 @@ import org.apache.woden.internal.wsdl20.DescriptionImpl; import org.apache.woden.internal.wsdl20.ElementDeclarationImpl; import org.apache.woden.internal.wsdl20.EndpointImpl; -import org.apache.woden.internal.wsdl20.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.ServiceImpl; -import org.apache.woden.internal.wsdl20.TypeDefinitionImpl; import org.apache.woden.internal.wsdl20.extensions.PopulatedExtensionRegistry; import org.apache.woden.tests.TestErrorHandler; import org.apache.woden.types.NCName; @@ -52,13 +49,11 @@ import org.apache.woden.wsdl20.BindingOperation; import org.apache.woden.wsdl20.Description; import org.apache.woden.wsdl20.Endpoint; -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.Service; import org.apache.woden.wsdl20.enumeration.MessageLabel; import org.apache.woden.wsdl20.xml.BindingElement; @@ -1213,420 +1208,6 @@ if(val.testAssertionInterfaceFaultReference0045(new InterfaceFaultReference[]{(InterfaceFaultReferenceImpl)faultReference, (InterfaceFaultReferenceImpl)faultReference3, (InterfaceFaultReferenceImpl)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() - { - QName name1 = new QName("http://www.sample.org", "name1"); - - // 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.setConstraintName(name1); - 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 Object()); - 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.setConstraintName(name1); - property.setValue(new Object()); - 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]
