How to specify the specific packages for the 'jacoco-check'? - jacoco

My project is built using Maven. I use the 'Jacoco' plugin to perform quality checks.
For a project I would like to check the test coverage on line basis. I would like to check the line coverage only for only 3 packages. How can I specify this check?
I tried 'including' a number of packages, but that does not work.
I also tried to include the root package level and exclude a number of other packages. Also not working.
How can I have the package A, B and C checked? See my example below:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
...
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<includes>
<include>nl.abc.xyz.package-a.**</include>
<include>nl.abc.xyz.package-b.**</include>
<include>nl.abc.xyz.package-c.**</include>
</includes>
...
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.30</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>

includes and excludes of rule are about name of the corresponding element.
In case of <element>PACKAGE</element> they are about package name.
And therefore
<includes>
<include>nl.abc.xyz.package-a.**</include>
<include>nl.abc.xyz.package-b.**</include>
<include>nl.abc.xyz.package-c.**</include>
</includes>
Matches for example package named nl.abc.xyz.package-a.something, but doesn't match nl.abc.xyz.package-a.
Given
src/main/java/org/example/a/A.java
package org.example.a;
public class A {
}
src/main/java/org/example/a/B.java
package org.example.b;
public class B {
}
src/test/java/ExampleTest.java
public class ExampleTest {
#org.junit.Test
public void test() {
new org.example.a.A();
}
}
and pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>example</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.2</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>PACKAGE</element>
<includes>
<include>org.example.b</include>
</includes>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>0.90</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Execution of mvn verify will fail as expected
[INFO] --- jacoco-maven-plugin:0.8.2:check (check) # example ---
[INFO] Loading execution data file /private/tmp/j/target/jacoco.exec
[INFO] Analyzed bundle 'example' with 2 classes
[WARNING] Rule violated for package org.example.b: lines covered ratio is 0.00, but expected minimum is 0.90
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
and after replacement of <include>org.example.b</include> on <include>org.example.*</include> will also fail with the same message, because org.example.* matches org.example.b. And after replacement on <include>org.example.a</include> will succeed as expected.

Related

nar-maven-plugin eclipse API Incompatibility

I'm using eclipse to compile/run my projects. I tried to use maven on c++ projects with nar-maven-plugin to build them. It works well as i launch maven goals in command line.
But when i import my maven project in eclipse, i have the following errors :
Execution default-nar-compile of goal
com.github.maven-nar:nar-maven-plugin:3.2.3:nar-compile failed: An API
incompatibility was encountered while executing
com.github.maven-nar:nar-maven-plugin:3.2.3:nar-compile:
java.lang.NoSuchMethodError:
org.codehaus.plexus.util.DirectoryScanner.setupMatchPatterns()V
----------------------------------------------------- realm = plugin>com.github.maven-nar:nar-maven-plugin:3.2.3 strategy =
org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
...
Moreover, eclipse seems to manage my project as a Java project instead of a C project.
Note : i'm using
Eclipse 4.3.1
M2E 1.4.0
CDT 8.3.0
My pom.xml
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sample</groupId>
<artifactId>helloworld-cplusplus-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>nar</packaging>
<name>Helloworld</name>
<properties>
<rootdir>${project.basedir}</rootdir>
<nar.linker>gpp</nar.linker>
<nar.arch>x86</nar.arch>
<nar.os>Windows</nar.os>
</properties>
<build>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<versionRange>[3.2.3,)</versionRange>
<goals>
<goal>nar-test-unpack</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<fork>true</fork>
<compilerVersion>1.8</compilerVersion>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.2.3</version>
<extensions>true</extensions>
<configuration>
<linker>
<name>g++</name>
</linker>
<libraries>
<library>
<type>executable</type>
</library>
</libraries>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sample</groupId>
<artifactId>helloworld-shared-library-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>nar</type>
</dependency>
</dependencies>
</project>
If someone is using nar-maven-plugin with eclipse can help me :). I would really like to use it on eclipse.
Thanks!

maven-ear-plugin unpack, filter and repack jarModule

a jarModule that is packaged in my ear file contains a persistence.xml file that I need to remove as part of the package phase. The best I can do is with:
<JarModule>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<unpack>true</unpack> -->
</JarModule>
<packagingExcludes>*/META-INF/persistence.xml,*/META-INF/orm.xml</packagingExcludes>
but I need the jar to be repacked before the packaging the ear.
Any suggestions?
Thanks
You can use the TrueZIP Maven PLugin to remove files from an archive:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>remove-from-jar</id>
<phase>prepare-package</phase>
<goals>
<goal>remove</goal>
</goals>
<configuration>
<fileset>
<directory>${project.build.directory}\<someFolders>\<I-contain-persistence-xml.jar></directory>
<includes>
<include>**\persistence.xml</include>
<include>**\orm.xml</include>
</includes>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Archives (*.jar, *.war, ...) can be used like directories with TrueZIP. As shown on the usage page you can move or copy files in archives easily.

Cobertura code coverage is wrong

I am have been trying to setup code coverage on my local Jenkins server with Maven. It would seem that my tests are not being included in the coverage reports.
I have the following in my pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<check>
<haltOnFailure>false</haltOnFailure>
<totalLineRate>85</totalLineRate>
</check>
<formats>
<format>xml</format>
<format>html</format>
</formats>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>pre-site</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>instrument</id>
<phase>site</phase>
<goals>
<goal>instrument</goal>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
and here is where I define the tests to be run
<plugin>
<!-- Separates the unit tests from the integration tests. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<trimStackTrace>false</trimStackTrace>
</configuration>
<executions>
<execution>
<id>unit-tests</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*Test*.java</include>
</includes>
<excludes>
<exclude>**/*IT.java</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
<includes>
<include>**/*IT.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
And on my Jenkins server I am have the following:
Jenkins Configuration:
Sonar
Sonar name:sonar local 3.5.1
server url: http://local host:9000
Project level:
publish Cobertura Coverate Report:
xml report pattern: **/target/site.covertura/coverage.xml
But when I run either the maven task "mvn cobertura:cobertura" or view the sonar reports in Jenkins, all the coverage is at 0%, which makes me think my unit and integration tests are not being seen.
Is this a problem with the way my pom separates unit and integration tests?
cobertura can't look into integration test to see code coverage.
Try a look at code coverage by integration tests with sonar
and at separating integration and unit tests
To make a short story : you must launch the jacoco maven plugin who will set two properties, one for unit tests, the another for it tests, and launch surefire and failsafe with these properties.
And after, you can show result in sonar in separated applet.
In my own pom file, you will se a part for enabled jacoco :
<properties>
<!-- Coverage and report -->
<jacoco.destFile.unit>${project.build.directory}/jacoco-unit.target</jacoco.destFile.unit>
<jacoco.destFile.it>${project.build.directory}/jacoco-it.target</jacoco.destFile.it>
<coverage.reports.dir>${project.build.directory}/coverage-reports</coverage.reports.dir>
<version.surefire>2.12.4</version.surefire>
<!-- Sonar -->
<sonar.jacoco.itReportPath>${jacoco.destFile.it}</sonar.jacoco.itReportPath>
<sonar.jacoco.reportPath>${jacoco.destFile.unit}</sonar.jacoco.reportPath>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
</properties>
<build>
....
<plugins>
<!-- Jacoco configuration -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.0.201210061924</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.argLine.unit</propertyName>
<destFile>${jacoco.destFile.unit}</destFile>
</configuration>
</execution>
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.argLine.it</propertyName>
<destFile>${jacoco.destFile.it}</destFile>
</configuration>
</execution>
</executions>
</plugin>
<!-- And in the surefire and failsafe plugins you need to enable jacoco like this ->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${version.surefire}</version>
</dependency>
</dependencies>
<configuration>
<argLine>${jacoco.argLine.unit}
-Dfile.encoding=${project.build.sourceEncoding} -Xmx512m</argLine>
<forkMode>always</forkMode>
<parallel>classes</parallel>
</configuration>
</plugin-->
<!-- Play the /src/test/java/**IT.java with goal verify -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version.surefire}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${version.surefire}</version>
</dependency>
</dependencies>
<configuration>
<forkMode>pertest</forkMode>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<argLine>${jacoco.argLine.it}
-Dfile.encoding=${project.build.sourceEncoding} -Xmx512m</argLine>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
In Jenkins, you must setup the "postbuild" JaCoCo plugins with
"**/**.target" for path to exec files
Hope this will help you.

wsimport fail with maven

I'm trying to create an ssl webservice client using maven and netbeans(7.2).
The webservice is perfectly working and I test it using an ant project.
When I try to build the project and generate webservice stubs I get this error:
Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsimport (wsimport-generate-test_project_ws_v1) on project mavenproject3: Error executing: wsimport [-keep, -s, C:\Users\no_name\Documents\NetBeansProjects\mavenproject3\target\generated-sources\jaxws-wsimport, -verbose, -encoding, UTF-8, -extension, -Xnocompile, -catalog, C:\Users\no_name\Documents\NetBeansProjects\mavenproject3\src\jax-ws-catalog.xml, -wsdllocation, https://localhost:8181/test_project_ws_v1/test_project_ws_v1?wsdl, file:/C:/Users/no_name/Documents/NetBeansProjects/mavenproject3/src/wsdl/localhost_8181/test_project_ws_v1/test_project_ws_v1.wsdl]: UndeclaredThrowableException: javax.xml.bind.annotation.XmlElementRef.required() -> [Help 1]
This is my pom (generated by netbeans)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.procc</groupId>
<artifactId>mavenproject3</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>mavenproject3</name>
<url>http://maven.apache.org</url>
<build>
<resources>
<resource>
<targetPath>META-INF</targetPath>
<directory>src</directory>
<includes>
<include>jax-ws-catalog.xml</include>
<include>wsdl/**</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>localhost_8181/test_project_ws_v1/test_project_ws_v1.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>https://localhost:8181/test_project_ws_v1/test_project_ws_v1?wsdl</wsdlLocation>
<staleFile>${project.build.directory}/jaxws/stale/test_project_ws_v1.stale</staleFile>
</configuration>
<id>wsimport-generate-test_project_ws_v1</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>webservices-rt</artifactId>
<version>1.4</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Thanks.
I was having the same error recently.
It seems that it happens because wsimport messes with 2.1 and 2.2 versions of jaxb.
I was able to generate the Web Services sources correctly by editing the project pom.xml and adding a <target>2.1</target> tag to the configuration of each imported wsdl, like this:
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>path/to/file.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>http://path/to/webservice?wsdl</wsdlLocation>
<staleFile>path/to/file.stale</staleFile>
<target>2.1</target>
</configuration>
<id>wsimport-generate-WebServiceName</id>
<phase>generate-sources</phase>
</execution>
Hope it helps whoever is having this issue.
We had a similar issue. When doing a wsimport we got a command line error stating -encoding was an invalid parameter.
Looking in the POM, and the plugin section for jaxws-maven-plugin the following dependency existed:
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.5</version>
</dependency>
</dependencies>
Removing this fixed the issue. We were also using version 2.3 of jaxws-maven-plugin
I could build on one machine but not another - the issue was caused by environment variables
Check your maven environment variables, M2 and M2_HOME
M2_HOME - "<Apache-maven-root-directory>" e.g. ("C:\Tools\apach-maven")
M2 - "%M2_HOME%\bin" (For windows machine)

accessing a web service using axis and maven

Im trying to figure out how to access Web Services in Java using Axis.
As far as I understand, Here's what I need to do :
Use WSDL File + Axis tools to generate Java files.
Compile and package generated Java files and then consume those objects by using connection methods on these.
In trying to do this, here's where I'm stuck:
I picked a random Web Service from http://www.service-repository.com/
I used the axistools-maven-plugin in the following manner:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<configuration>
<urls>
<!--<url>http://soap.amazon.com/schemas2/AmazonWebServices.wsdl</url>-->
<!--<url>http://ws.xwebservices.com/XWebEmailValidation/V2/XWebEmailValidation.wsdl</url>-->
<url>http://mathertel.de/AJAXEngine/S02_AJAXCoreSamples/OrteLookup.asmx?WSDL</url>
</urls>
<!--<sourceDirectory>${project.build.sourceDirectory}/wsdl</sourceDirectory>-->
<packageSpace>com.company.wsdl</packageSpace>
<testCases>true</testCases>
<serverSide>true</serverSide>
<subPackageByFileName>true</subPackageByFileName>
<outputDirectory>${project.build.directory}/src/generated-sources</outputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the issue:
I can successfully run mvn generate-sources and it does generate the Java files. But I can't seem to compile these Java files.
When I run mvn clean install it gives me a bunch of compile errors. What step am I missing ?
Based on your answer to one of my comment, my suggestion would be to use a JAX-WS implementation like JAX-WS RI - which is included in Java 6 - or Apache CXF (both are IMO much better WS stacks than the outdated Axis).
Here is an example based on JAX-WS RI and its jaxws-maven-plugin:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.stackoverflow</groupId>
<artifactId>Q3479139</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Q3479139</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven 2</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<url>http://download.java.net/maven/2</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlUrls>
<wsdlUrl>http://ws.xwebservices.com/XWebEmailValidation/V2/XWebEmailValidation.wsdl</wsdlUrl>
</wsdlUrls>
<!-- The name of your generated source package -->
<packageName>com.example.myschema</packageName>
<!-- generate artifacts that run with JAX-WS 2.0 runtime -->
<target>2.0</target>
<!-- Specify where to place generated source files -->
<sourceDestDir>${project.build.directory}/generated-sources/wsimport</sourceDestDir>
</configuration>
</execution>
</executions>
<!-- if you want to use a specific version of JAX-WS, you can do so like this -->
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And here is a very basic test case (part of the maven project) demonstrating the invocation of the web service using the generated classes:
package com.example.myschema;
import junit.framework.TestCase;
public class EmailValidationTest extends TestCase {
XWebEmailValidationInterface service = new EmailValidation().getEmailValidation();
ValidateEmailRequest request = new ValidateEmailRequest();
ValidateEmailResponse response = null;
public void testEmails() {
request.setEmail("foo#bar.com");
response = service.validateEmail(request);
assertEquals("EMAIL_SERVER_NOT_FOUND", response.getStatus());
request.setEmail("foo#gmail.com");
response = service.validateEmail(request);
assertEquals("NOT_VALID", response.getStatus());
}
}