Testing

AndroMDA generates unit and integration tests for the services, with stubbed implementations

Unit tests are run from the core and webservice project, against the service implementation classes. Integration webservice tests are run against a deployed and running webservice using a generated Java client. There is a stubbed implementation and stubbed response for each service.

Unit tests run as part of the core project build:

[INFO] Surefire report directory: C:\Workspaces\cxf34\core\target\surefire-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.andromda.cxf34.services.CXF34ServiceSEIImplTest
Invoking CXF34ServiceSEIImpl.getDates with org.andromda.cxf34.services.GetDates@4ac9131c[start=Thu May 05 17:42:26 EDT 2011,end=Thu May 05 17:42:26 EDT 2011]
INFO  [CXF34ServiceSEIImpl] CXF34ServiceSEIImpl.getDates: Executing with: Thu May 05 17:42:26 EDT 2011Thu May 05 17:42:26 EDT 2011
INFO  [CXF34ServiceSEIImpl] CXF34ServiceSEIImplgetDates: Returning CXF34Service.getDates: org.andromda.cxf34.valueobjects.Dates@2a9df354[start=Thu May 05 17:42:26 EDT 2011,end=Thu May 05 17:42:26 EDT 2011]
CXF34ServiceSEIImpl.getDates returned org.andromda.cxf34.valueobjects.Dates@2a9df354[start=Thu May 05 17:42:26 EDT 2011,end=Thu May 05 17:42:26 EDT 2011]
Invoking CXF34ServiceSEIImpl.getServiceStates

Jetty is started as part of the webservice and CXF project builds, to verify the generated Spring and web configurations and to provide a service endpoint stubbed implementation:

[INFO] [jetty:run {execution: start-jetty}]
[INFO] Configuring Jetty for project: CXF34 CXF Web Services
[INFO] Webapp source directory = C:\Workspaces\cxf34\webservice\src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = C:\Workspaces\cxf34\CXF\target\classes
[INFO] Context path = /cxf34-webservice
[INFO] Tmp directory = C:\Workspaces\cxf34\CXF\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = C:\Workspaces\cxf34/webservice/src/main/webapp/WEB-INF/web.xml
[INFO] web.xml file = file:/C:/Workspaces/cxf34/webservice/src/main/webapp/WEB-INF/web.xml
[INFO] Webapp directory = C:\Workspaces\cxf34\webservice\src\main\webapp
[INFO] Starting jetty 7.4.0.v20110414 ...
INFO  [ContextLoader] Root WebApplicationContext: initialization started
INFO  [XmlWebApplicationContext] Refreshing Root WebApplicationContext: startup date [Thu May 05 18:58:19 EDT 2011]; root of context hierarchy
INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext-CXF.xml]
INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-http.xml]
INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml]
INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2f1ada40: defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.service.factory.FactoryBeanListenerManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.transport.servlet.ServletTransportFactory,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,CXF34ServiceSEI,cxf.config0]; root of factory hierarchy
INFO  [ContextLoader] Root WebApplicationContext: initialization completed in 1000 ms
INFO  [BusApplicationContext] Refreshing org.apache.cxf.bus.spring.BusApplicationContext@c6d1896: startup date [Thu May 05 18:58:20 EDT 2011]; parent: Root WebApplicationContext
INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@319c4657: defining beans []; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@2f1ada40
[INFO] Started Jetty Server

Integration tests run as part of the CXF project build against the Jetty server:

[INFO] [failsafe:integration-test {execution: integration-test}]
[INFO] Failsafe report directory: C:\Workspaces\cxf34\CXF\target\failsafe-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Concurrency config is parallel='methods', perCoreThreadCount=true, threadCount=5, useUnlimitedThreads=false
Running org.andromda.cxf34.services.test.CXF34ServiceWSITCase
Starting test: getDates for null for CXF34ServiceClient
INFO  [ClassPathXmlApplicationContext] Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@4430d82d: startup date [Thu May 05 18:58:21 EDT 2011]; root of context hierarchy
INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from class path resource [cxf-client.xml]
INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6833f0de: defining beans [CXF34ServiceClient,CXF34ServiceProxyFactory]; root of factory hierarchy
INFO  [BusApplicationContext] Refreshing org.apache.cxf.bus.spring.BusApplicationContext@a0b1cd0: startup date [Thu May 05 18:58:21 EDT 2011]; root of context hierarchy
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-corba.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-jaxws.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-soap.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-xml.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-http.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-addr.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-javascript-client.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-local.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-management.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-http-jetty.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-http.xml]
INFO  [DefaultListableBeanFactory] Overriding bean definition for bean 'org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder': replacing [Generic bean: class [org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]] with [Generic bean: class [org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]]
INFO  [DefaultListableBeanFactory] Overriding bean definition for bean 'org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder': replacing [Generic bean: class [org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]] with [Generic bean: class [org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]]
INFO  [DefaultListableBeanFactory] Overriding bean definition for bean 'org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider': replacing [Generic bean: class [org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]] with [Generic bean: class [org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]]
INFO  [DefaultListableBeanFactory] Overriding bean definition for bean 'org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory': replacing [Generic bean: class [org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]] with [Generic bean: class [org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory]; scope=; abstract=false; lazyInit=true; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [META-INF/cxf/cxf-extension-http.xml]]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-jms.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-object-binding.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-http-binding.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-wstx-msv-validation.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-jaxrs-binding.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-ws-security.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-policy.xml]
INFO  [ControlledValidationXmlBeanDefinitionReader] Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-rm.xml]
INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2321b59a: defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.service.factory.FactoryBeanListenerManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.corba.CorbaBindingFactory,org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister#0,org.apache.cxf.jaxws.context.WebServiceContextResourceResolver,org.apache.cxf.jaxws.context.WebServiceContextImpl,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.binding.xml.XMLBindingFactory,org.apache.cxf.transport.http.policy.HTTPClientAssertionBuilder,org.apache.cxf.transport.http.policy.HTTPServerAssertionBuilder,org.apache.cxf.transport.http.policy.NoOpPolicyInterceptorProvider,org.apache.cxf.transport.http.ClientOnlyHTTPTransportFactory,org.apache.cxf.ws.addressing.policy.AddressingAssertionBuilder,org.apache.cxf.ws.addressing.policy.AddressingPolicyInterceptorProvider,org.apache.cxf.ws.addressing.policy.UsingAddressingAssertionBuilder,org.apache.cxf.javascript.JavascriptQueryHandler,org.apache.cxf.transport.local.LocalTransportFactory,org.apache.cxf.management.InstrumentationManager,org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory,org.apache.cxf.transport.jms.JMSTransportFactory,org.apache.cxf.binding.object.ObjectBindingFactory,org.apache.cxf.binding.http.HttpBindingFactory,org.apache.cxf.wstx_msv_validation.WoodstoxValidationImpl,org.apache.cxf.ws.security.policy.WSSecurityPolicyLoader,org.apache.cxf.ws.policy.AssertionBuilderRegistry,org.apache.cxf.ws.policy.PolicyInterceptorProviderRegistry,org.apache.cxf.ws.policy.attachment.external.DomainExpressionBuilderRegistry,org.apache.cxf.ws.policy.attachment.external.EndpointReferenceDomainExpressionBuilder,org.apache.cxf.ws.policy.PolicyBuilder,org.apache.cxf.ws.policy.PolicyEngine,org.apache.cxf.ws.policy.attachment.wsdl11.Wsdl11AttachmentPolicyProvider,org.apache.cxf.ws.policy.attachment.ServiceModelPolicyProvider,org.apache.cxf.ws.policy.mtom.MTOMAssertionBuilder,org.apache.cxf.ws.policy.mtom.MTOMPolicyInterceptorProvider,org.apache.cxf.ws.rm.RMManager,org.apache.cxf.ws.rm.policy.RMPolicyInterceptorProvider,org.apache.cxf.ws.rm.policy.RMAssertionBuilder]; root of factory hierarchy
INFO  [ReflectionServiceFactoryBean] Creating Service {http://services.cxf34.andromda.org/}CXF34ServiceSEIService from class org.andromda.cxf34.services.CXF34ServiceSEI
 Result = org.andromda.cxf34.valueobjects.Dates@3348bd9d
Finished test for CXF34Service.getDates(start, end)

Enumeration Modeling

If you model the service interface with String datatype, and draw a dependency to an Enumeration with the same name as the String attribute, the test cases will generate test data and mappings from the String value to/from the first Enumeration Literal value. This allows you to model the interface as a string and to validate that the incoming String value is a valid Enumeration value, while not forcing you to version the service interface every time a new Enumeration Literal is added.

Next

Now we can learn about the CXF generated client project CXF Client.