You are viewing a plain text version of this content. The canonical link for it is here.
Posted to woden-dev@ws.apache.org by lm...@apache.org on 2006/03/06 20:51:15 UTC
svn commit: r383639 - in /incubator/woden/java:
src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java
test/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidatorTest.java
Author: lmandel
Date: Mon Mar 6 11:51:13 2006
New Revision: 383639
URL: http://svn.apache.org/viewcvs?rev=383639&view=rev
Log:
Added tests for service and endpoint assertions Service-0063, Endpoint-0064, Endpoint-0065 and Endpoint-0066.
Modified:
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/wsdl20/validation/WSDLComponentValidator.java
URL: http://svn.apache.org/viewcvs/incubator/woden/java/src/org/apache/woden/internal/wsdl20/validation/WSDLComponentValidator.java?rev=383639&r1=383638&r2=383639&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 Mar 6 11:51:13 2006
@@ -26,12 +26,14 @@
import org.apache.woden.WSDLException;
import org.apache.woden.internal.ErrorLocatorImpl;
import org.apache.woden.internal.wsdl20.Constants;
+import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.Binding;
import org.apache.woden.wsdl20.BindingFault;
import org.apache.woden.wsdl20.BindingFaultReference;
import org.apache.woden.wsdl20.BindingMessageReference;
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;
@@ -39,6 +41,8 @@
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.WSDLComponent;
import org.apache.woden.wsdl20.enumeration.MessageLabel;
/**
@@ -56,15 +60,23 @@
*
* @param desc The description component of the WSDL 2.0 component model.
* @param errorReporter An error reporter to be used for reporting errors found with the model.
- * @throws WSDLException A WSDLException is thrown if there is a problem while validating the WSDL 2.0 component model.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the WSDL 2.0 component model.
*/
public void validate(Description desc, ErrorReporter errorReporter) throws WSDLException
{
validateInterfaces(desc.getInterfaces(), desc, errorReporter);
validateBindings(desc.getBindings(), desc, errorReporter);
-
+ validateServices(desc.getServices(), desc, errorReporter);
}
+ /**
+ * Validate the interfaces in the WSDL component model.
+ *
+ * @param interfaces The interfaces in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the interface components.
+ */
protected void validateInterfaces(Interface[] interfaces, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionInterface0030(interfaces, errorReporter);
@@ -170,6 +182,14 @@
}
+ /**
+ * Validate the bindings in the WSDL component model.
+ *
+ * @param bindings The bindings in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the binding components.
+ */
protected void validateBindings(Binding[] bindings, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionBinding0057(bindings, errorReporter);
@@ -191,6 +211,14 @@
}
}
+ /**
+ * Validate the binding operations in the WSDL component model.
+ *
+ * @param bindingOperations The bindings operations in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the binding operation components.
+ */
protected void validateBindingOperations(BindingOperation[] bindingOperations, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionBindingOperation0059(bindingOperations, errorReporter);
@@ -208,6 +236,14 @@
}
+ /**
+ * Validate the binding message references in the WSDL component model.
+ *
+ * @param bindingMessageReferences The bindings message references in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the binding message reference components.
+ */
protected void validateBindingMessageReferences(BindingMessageReference[] bindingMessageReferences, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionBindingMessageReference0060(bindingMessageReferences, errorReporter);
@@ -223,6 +259,14 @@
}
}
+ /**
+ * Validate the binding fault references in the WSDL component model.
+ *
+ * @param bindingFaultReferences The bindings fault references in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the binding fault reference components.
+ */
protected void validateBindingFaultReferences(BindingFaultReference[] bindingFaultReferences, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionBindingFaultReference0061(bindingFaultReferences, errorReporter);
@@ -238,6 +282,14 @@
}
}
+ /**
+ * Validate the binding faults in the WSDL component model.
+ *
+ * @param bindingFaults The bindings faults in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the binding fault components.
+ */
protected void validateBindingFault(BindingFault[] bindingFaults, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionBindingFault0058(bindingFaults, errorReporter);
@@ -253,6 +305,62 @@
}
}
+ /**
+ * Validate the services in the WSDL component model.
+ *
+ * @param services The services in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the service components.
+ */
+ protected void validateServices(Service[] services, Description desc, ErrorReporter errorReporter) throws WSDLException
+ {
+ testAssertionService0063(services, errorReporter);
+
+ int numServices = services.length;
+ for(int i = 0; i < numServices; i++)
+ {
+ Service service = services[i];
+
+ validateEndpoints(service.getEndpoints(), desc, errorReporter);
+
+ validateFeatures(service.getFeatures(), errorReporter);
+ validateProperties(service.getProperties(), desc, errorReporter);
+ }
+ }
+
+ /**
+ * Validate the endpoints in a service component in the WSDL component model.
+ *
+ * @param endpoints The endpoints in a service in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the endpoint components.
+ */
+ 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++)
+ {
+ Endpoint endpoint = endpoints[i];
+ testAssertionEndpoint0064(endpoint, errorReporter);
+ testAssertionEndpoint0066(endpoint, errorReporter);
+
+ validateFeatures(endpoint.getFeatures(), errorReporter);
+ validateProperties(endpoint.getProperties(), desc, errorReporter);
+ }
+ }
+
+ /**
+ * Validate the properties in the WSDL component model.
+ *
+ * @param properties The properties in the WSDL component model.
+ * @param desc The WSDL 2.0 description component.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the property components.
+ */
protected void validateProperties(Property[] properties, Description desc, ErrorReporter errorReporter) throws WSDLException
{
testAssertionProperty0050(properties, errorReporter);
@@ -269,6 +377,13 @@
}
}
+ /**
+ * Validate the features in the WSDL component model.
+ *
+ * @param features The features in the WSDL component model.
+ * @param errorReporter An error reporter to be used for reporting errors.
+ * @throws WSDLException A WSDLException is thrown if a problem occurs while validating the feature components.
+ */
protected void validateFeatures(Feature[] features, ErrorReporter errorReporter) throws WSDLException
{
testAssertionFeatureRef0047(features, errorReporter);
@@ -1024,7 +1139,125 @@
}
return true;
}
-
+
+ /**
+ * Test assertion Service-0063. For each Service component in the {services} property
+ * of a Description component, the {name} property MUST be unique.
+ *
+ * @param services An array containing all the services in the description component.
+ * @param errorReporter The error reporter.
+ * @return True if all services contain unique names, false otherwise.
+ * @throws WSDLException
+ */
+ protected boolean testAssertionService0063(Service[] services, ErrorReporter errorReporter) throws WSDLException
+ {
+ List names = new ArrayList();
+ int numServices = services.length;
+ for(int i = 0; i < numServices; i++)
+ {
+ QName name = services[i].getName();
+ if(names.contains(name))
+ {
+ errorReporter.reportError(new ErrorLocatorImpl(), "Service-0063", new Object[]{name}, ErrorReporter.SEVERITY_ERROR);
+ return false;
+ }
+ 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;
+ }
+
+ /**
+ * Test assertion Endpoint-0064. This xs:anyURI MUST be an absolute IRI as
+ * defined by [IETF RFC 3987]. This xs:anyURI refers to the address IRI.
+ *
+ * @param endpoint The endpoint of which the address should be checked.
+ * @param errorReporter The error reporter.
+ * @return True if the address IRI is absolute, false otherwise.
+ * @throws WSDLException
+ */
+ protected boolean testAssertionEndpoint0064(Endpoint endpoint, ErrorReporter errorReporter) throws WSDLException
+ {
+ URI address = endpoint.getAddress();
+ if(address != null && !address.isAbsolute())
+ {
+ errorReporter.reportError(new ErrorLocatorImpl(), "Endpoint-0064", new Object[]{address}, ErrorReporter.SEVERITY_ERROR);
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Test assertion Endpoint-0066. For each Endpoint component in the {endpoints} property
+ * of a Service component, the {binding} property MUST either be a Binding component with
+ * an unspecified {interface} property or a Binding component with an {interface} property
+ * equal to the {interface} property of the Service component.
+ *
+ * @param endpoint The endpoint of which the binding should be checked.
+ * @param desc The WSDL description component.
+ * @param errorReporter The error reporter.
+ * @return True if the binding specified the interface specified by the service or no interface, false otherwise.
+ * @throws WSDLException
+ */
+ protected boolean testAssertionEndpoint0066(Endpoint endpoint, ErrorReporter errorReporter) throws WSDLException
+ {
+ Binding binding = endpoint.getBinding();
+ // If no binding has been specified this assertion does not apply.
+ if(binding == null)
+ return true;
+
+ Interface bindingInterface = binding.getInterface();
+ WSDLComponent parent = endpoint.getParent();
+ if(parent != null)
+ {
+ Service service = (Service)parent;
+ Interface serviceInterface = service.getInterface();
+
+ // If an interface hasn't been specified on the service this assertion doesn't apply.
+ // If the binding interface is null this assertion passes.
+ if(serviceInterface != null && bindingInterface != null && !serviceInterface.equals(bindingInterface))
+ {
+ errorReporter.reportError(new ErrorLocatorImpl(), "Endpoint-0066", new Object[]{binding, bindingInterface, serviceInterface}, 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.
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=383639&r1=383638&r2=383639&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 Mar 6 11:51:13 2006
@@ -35,6 +35,7 @@
import org.apache.woden.internal.wsdl20.Constants;
import org.apache.woden.internal.wsdl20.DescriptionImpl;
import org.apache.woden.internal.wsdl20.ElementDeclarationImpl;
+import org.apache.woden.internal.wsdl20.EndpointImpl;
import org.apache.woden.internal.wsdl20.FeatureImpl;
import org.apache.woden.internal.wsdl20.InterfaceFaultImpl;
import org.apache.woden.internal.wsdl20.InterfaceFaultReferenceImpl;
@@ -42,13 +43,16 @@
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.tests.TestErrorHandler;
+import org.apache.woden.types.NCName;
import org.apache.woden.wsdl20.Binding;
import org.apache.woden.wsdl20.BindingFault;
import org.apache.woden.wsdl20.BindingFaultReference;
import org.apache.woden.wsdl20.BindingMessageReference;
import org.apache.woden.wsdl20.BindingOperation;
+import org.apache.woden.wsdl20.Endpoint;
import org.apache.woden.wsdl20.Feature;
import org.apache.woden.wsdl20.Interface;
import org.apache.woden.wsdl20.InterfaceFault;
@@ -56,6 +60,7 @@
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.BindingFaultElement;
import org.apache.woden.wsdl20.xml.BindingOperationElement;
@@ -385,13 +390,26 @@
QName name2 = new QName("http://www.sample.org", "name2");
QName name3 = new QName("http://www.sample.org", "name3");
- // Test that the assertion returns true for an empty list of interface operations.
+ // 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 empty list of interface operations.");
+ fail("The testAssertionInterfaceOperation0035 method returned false for an interface operation with no name.");
}
}
catch(WSDLException e)
@@ -2376,6 +2394,447 @@
if(val.testAssertionBindingFault0058(bindingFaults, reporter))
{
fail("The testAssertionBindingFault0058 method returned true for a list of binging faults that contains two binding faults defined with the same interface fault reference.");
+ }
+ }
+ catch(WSDLException e)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+ }
+
+ /**
+ * Test that the testAssertionService0063 method returns
+ * true if the list of services contains no services
+ * with duplicate names, false otherwise.
+ */
+ public void testTestAssertionService0063()
+ {
+ QName name1 = new QName("http://www.sample.org", "name1");
+ QName name2 = new QName("http://www.sample.org", "name2");
+ QName name3 = new QName("http://www.sample.org", "name3");
+
+ // Test that the assertion returns true for an empty list of services.
+ try
+ {
+ if(!val.testAssertionService0063(new Service[]{}, reporter))
+ {
+ fail("The testAssertionService0063 method returned false for an empty list of services.");
+ }
+ }
+ catch(WSDLException e)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+
+ // Test that the assertion returns true for a service with no name.
+ try
+ {
+ ServiceImpl service = new ServiceImpl();
+ if(!val.testAssertionService0063(new Service[]{service}, reporter))
+ {
+ fail("The testAssertionService0063 method returned false for a service 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 a service that is the only service defined.
+ try
+ {
+ ServiceImpl service = new ServiceImpl();
+ service.setName(name1);
+ if(!val.testAssertionService0063(new Service[]{service}, reporter))
+ {
+ fail("The testAssertionService0063 method returned false for a service that is the only service 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 services that contains no duplicate names.
+ try
+ {
+ ServiceImpl service = new ServiceImpl();
+ service.setName(name1);
+ ServiceImpl service2 = new ServiceImpl();
+ service2.setName(name2);
+ ServiceImpl service3 = new ServiceImpl();
+ service3.setName(name3);
+
+ Service[] services = new Service[]{service, service2, service3};
+
+ if(!val.testAssertionService0063(services, reporter))
+ {
+ fail("The testAssertionService0063 method returned false for a list of services 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 services that are defined with the same QName object.
+ try
+ {
+ ServiceImpl service = new ServiceImpl();
+ service.setName(name1);
+ ServiceImpl service2 = new ServiceImpl();
+ service2.setName(name2);
+ ServiceImpl service3 = new ServiceImpl();
+ service3.setName(name1);
+
+ Service[] services = new Service[]{service, service2, service3};
+
+ if(val.testAssertionService0063(services, reporter))
+ {
+ fail("The testAssertionService0063 method returned true for a list of services that contains two services 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 services that are defined with the same name and
+ // different QName objects.
+ try
+ {
+ ServiceImpl service = new ServiceImpl();
+ service.setName(name1);
+ ServiceImpl service2 = new ServiceImpl();
+ service2.setName(name2);
+ ServiceImpl service3 = new ServiceImpl();
+ service3.setName(new QName("http://www.sample.org", "name1"));
+
+ Service[] services = new Service[]{service, service2, service3};
+
+ if(val.testAssertionService0063(services, reporter))
+ {
+ fail("The testAssertionService0063 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)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+ }
+
+ /**
+ * Test that the testAssertionEndpoint0064 method returns
+ * true if the endpoint address is absolute, false otherwise.
+ */
+ public void testTestAssertionEndpoint0064()
+ {
+ // Test that the assertion returns true for an endpoint with an absolute address.
+ try
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ endpoint.setAddress(new URI("http://www.sample.org"));
+ if(!val.testAssertionEndpoint0064(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0064 method returned false for an endpoint with an absolute address.");
+ }
+ }
+ catch(URISyntaxException e)
+ {
+ fail("There was a problem creating the address 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 an endpoint with a relative address.
+ try
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ endpoint.setAddress(new URI("sample.org"));
+ if(val.testAssertionEndpoint0064(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0064 method returned true for an endpoint with a relative address.");
+ }
+ }
+ catch(URISyntaxException e)
+ {
+ fail("There was a problem creating the address 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 an endpoint with a null address. This will be
+ // caught be schema validation.
+ try
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ if(!val.testAssertionEndpoint0064(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0064 method returned false for an endpoint with a null address.");
+ }
+ }
+ catch(WSDLException e)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+ }
+
+ /**
+ * Test that the testAssertionEndpoint0066 method returns
+ * true if the endpoint binding does not specify an interface or
+ * specifies the same interface as the endpoint's parent service,
+ * false otherwise.
+ */
+ public void testTestAssertionEndpoint0066()
+ {
+ // Test that the assertion returns true for an endpoint with no binding or parent defined.
+ try
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ if(!val.testAssertionEndpoint0066(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0066 method returned false for an endpoint with no binding or parent defined.");
+ }
+ }
+ 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 binding defined.
+ try
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ ServiceImpl service = new ServiceImpl();
+ service.addEndpointElement(endpoint);
+ endpoint.setParentElement(service);
+ if(!val.testAssertionEndpoint0066(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0066 method returned false for an endpoint with no binding defined.");
+ }
+ }
+ 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 parent defined.
+ try
+ {
+ EndpointImpl endpoint = new EndpointImpl();
+ BindingImpl binding = new BindingImpl();
+ endpoint.setBindingElement(binding);
+ if(!val.testAssertionEndpoint0066(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0066 method returned false for an endpoint with no parent defined.");
+ }
+ }
+ catch(WSDLException e)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+
+ // Test that the assertion returns true for an endpoint that specifies a binding with no interface specified.
+ try
+ {
+ InterfaceImpl interfac = new InterfaceImpl();
+ EndpointImpl endpoint = new EndpointImpl();
+ ServiceImpl service = new ServiceImpl();
+ service.setInterfaceElement(interfac);
+ service.addEndpointElement(endpoint);
+ endpoint.setParentElement(service);
+ BindingImpl binding = new BindingImpl();
+ endpoint.setBindingElement(binding);
+ if(!val.testAssertionEndpoint0066(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0066 method returned false for an endpoint that specifies a binding with no specified interface.");
+ }
+ }
+ catch(WSDLException e)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+
+ // Test that the assertion returns true for an endpoint that specifies a binding with the same interface
+ // as the parent service specified.
+ try
+ {
+ InterfaceImpl interfac = new InterfaceImpl();
+ EndpointImpl endpoint = new EndpointImpl();
+ ServiceImpl service = new ServiceImpl();
+ service.setInterfaceElement(interfac);
+ service.addEndpointElement(endpoint);
+ endpoint.setParentElement(service);
+ BindingImpl binding = new BindingImpl();
+ binding.setInterfaceElement(interfac);
+ endpoint.setBindingElement(binding);
+ if(!val.testAssertionEndpoint0066(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0066 method returned false for an endpoint that specifies a binding with the same interface specified as the parent service specifies.");
+ }
+ }
+ catch(WSDLException e)
+ {
+ fail("There was a problem running the test assertion method " + e);
+ }
+
+ // Test that the assertion returns false for an endpoint that specifies a binding with a different interface
+ // than the parent service specified.
+ try
+ {
+ InterfaceImpl interfac = new InterfaceImpl();
+ InterfaceImpl interfac2 = new InterfaceImpl();
+ EndpointImpl endpoint = new EndpointImpl();
+ ServiceImpl service = new ServiceImpl();
+ service.setInterfaceElement(interfac);
+ service.addEndpointElement(endpoint);
+ endpoint.setParentElement(service);
+ BindingImpl binding = new BindingImpl();
+ binding.setInterfaceElement(interfac2);
+ endpoint.setBindingElement(binding);
+ if(val.testAssertionEndpoint0066(endpoint, reporter))
+ {
+ fail("The testAssertionEndpoint0066 method returned true for an endpoint that specifies a binding with a different interface specified than the parent service specifies.");
}
}
catch(WSDLException e)
---------------------------------------------------------------------
To unsubscribe, e-mail: woden-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: woden-dev-help@ws.apache.org