So, usually I apply JAXB annotations in the code as follows:
package com.example;
#XmlRootElement(name = "Foo", namespace = "example.com")
#XmlType(name = "Foo", namespace = "example.com")
public class Foo {
...
}
Foo is a java class that is used to communicate with web services (via Spring/CXF). The above annotations, help generate the XML Schema in the wsdl appropriately.
I have hit a situation where I can not modify the class itself, but I can provide an jaxb external binding file to the code that generates the schema. Note that the #XmlRootElement exists in the class.
How do I write an equivalent binding file that does what the above annotations do?
If you just need to add #XmlType(name = "Foo", namespace = "example.com") annotation to the generated class you can use JAXB Annotate Plugin.
Here is documentation about how to define annotations in external binding files.
If you're using CXF and maven you can also you cxf-codegen-plugin somehow like this
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>wsdl2java</goal>
</goals>
<configuration>
<sourceRoot>${service.src.dir}</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>service.wsdl</wsdl>
<extraargs>
<extraarg>-xjc-Xannotate</extraarg>
<extraarg>-b</extraarg>
<extraarg>${wsdl.dir}/bindings.xjb</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>${jaxb.commons.version}</version>
</dependency>
</dependencies>
</plugin>
You can also use maven-jaxb2-plugin:
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>${maven-jaxb2.version}</version>
<executions>
<execution>
<id>process-xsd</id>
<goals>
<goal>generate</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<schemaIncludes>
<include>**/*.xsd</include>
</schemaIncludes>
<bindingIncludes>
<include>**/*.xjb</include>
</bindingIncludes>
<generateDirectory>${jaxb.src.dir}</generateDirectory>
<extension>true</extension>
<args>
<arg>-Xannotate</arg>
</args>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>${jaxb.commons.version}</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
Here is sample binding file:
<jaxb:bindings
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:annox="http://annox.dev.java.net"
version="2.0">
<jaxb:bindings schemaLocation="schema.xsd" node="/xs:schema">
<jaxb:bindings node="//xs:complexType[#name='Foo']">
<annox:annotate target="class">
<annox:annotate annox:class="javax.xml.bind.annotation.XmlType" name="Foo" namespace = "example.com"/>
</annox:annotate>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
If you need to modify #XmlRootElement too, just add another one annox:annotate element:
<annox:annotate annox:class="javax.xml.bind.annotation.XmlRootElement" name="Foo" namespace = "example.com"/>
Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.
The MOXy implementation of JAXB has an external mapping file that you can use to provide the metadata.
<?xml version="1.0"?>
<xml-bindings
xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
package-name="com.example">
<java-types>
<java-type name="Customer">
<xml-type name="Foo" namespace="example.com"/>
</java-type>
</java-types>
</xml-bindings>
For More Information
http://blog.bdoughan.com/2010/12/extending-jaxb-representing-annotations.html
Related
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.
I am using AWS SQS for the first time. I work in certain company which blocks us via firewall to connect from our local network to SQS for some reasons beyond my control. I can upload anything I have developed to our TomCat in AWS or even run via our Linux command line with our ec2-user (upload via WinSCP and trigger via Putty).
Since I need to provide certain solution using sqs but I can't debug accessing it from my Eclipse I am interested to mock sqs. Additionally, I see advantages on such approach from test perspective. That said, after few hours searching I found exactly what I need: http://www.schibsted.pl/blog/mocking-amazon-sqs-with-elasticmq/
I downloaded the example (https://github.com/JanGurda/elastc-mq-rule-sample) but I can't start it. I understand that there is an elasticmq embbeded which should be started together with such jar. I tried other way by downloading the elasticmq and started it before running the sample but I am still getting the same output.
Basically, I am getting this output
usage: java -jar project.jar [-h] [-v] {server,check} ...
positional arguments:
{server,check} available commands
optional arguments:
-h, --help show this help message and exit
-v, --version show the application version and exit
It seems I am doing something very silly but I didn't find a north.
PS. I checked and the pom has lombok and elasticmq properly settup.
pom
<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>pl.schibsted.spid</groupId>
<artifactId>elastc-mq-rule-sample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>0.8.0</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-sqs</artifactId>
<version>1.10.1</version>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>0.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.elasticmq</groupId>
<artifactId>elasticmq-rest-sqs_2.11</artifactId>
<version>0.8.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>pl.schibsted.spid.elasticmq.server.ElasticMqRuleSampleApplication</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<includes>
<include>**/ITest*.java</include>
</includes>
</configuration>
<executions>
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
DropwizardAppRule:
public class ITestPingResource {
#ClassRule
public static DropwizardAppRule<ElasticMqRuleSampleApplicationConfiguration> app =
new DropwizardAppRule<>(ElasticMqRuleSampleApplication.class,
ITestPingResource.class.getClassLoader().getResource("test.yml").getPath());
#ClassRule
public static SqsRule sqs = new SqsRule(SqsRuleConfiguration.builder()
.queue("sample-queue").port(8888).build());
private Client client = ClientBuilder.newClient();
#After
public void tearDown() {
sqs.purgeAllQueues();
}
#Test
public void shouldPublishProcessedRequestPayload() throws Exception {
// given
String toSend = "abcdefgh";
// when
Response response = client
.target("http://127.0.0.1:" + app.getLocalPort() + "/ping")
.request().post(Entity.json(toSend));
// then
assertEquals(Status.NO_CONTENT.getStatusCode(), response.getStatus());
List<Message> messagesFromQueue = sqs.getQueue("sample-queue").read(10);
assertEquals(1, messagesFromQueue.size());
assertEquals("ABCDEFGH", messagesFromQueue.get(0).getBody());
}
}
test.yml
queueUrl: http://localhost:8888/queue/sample-queue
awsAccessKey: x
awsSecretKey: x
main:
public class ElasticMqRuleSampleApplication extends Application<ElasticMqRuleSampleApplicationConfiguration> {
public static void main(String[] args) throws Exception {
new ElasticMqRuleSampleApplication().run(args);
}
#Override
public void run(ElasticMqRuleSampleApplicationConfiguration configuration, Environment environment) throws Exception {
PingResource resource = new PingResource(configuration);
environment.jersey().register(resource);
}
}
Demetrio,
The error you get is simply standard output of Dropwizard. You should use “server” parameter to start Dropwizard application. So command you use to start Dropwizard is java -jar <> server.
If you however would like to run sample integration test (which I discussed in my article) just use Maven. Type mvn clean install. It’ll build project and run integration test.
Thanks
I use cxf-codgen-plugin in maven to generate classes for web services. Here is a part of my pom.xml
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.1</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/wsdl/ws1.wsdl</wsdl>
</wsdlOption>
<wsdlOption>
<wsdl>${basedir}/wsdl/ws2.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
The problem is every time I want to add a new WSDL I had to add a line in the pom.xml like this:
<wsdlOption>
<wsdl>${basedir}/wsdl/ws2.wsdl</wsdl>
</wsdlOption>
What I want to do is to specify a directory and cxf will generate classes for all the WSDL files in this directory.
Is there a way to do this?
Thanks.
I found the way to do this:
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<wsdlRoot>${basedir}/wsdl</wsdlRoot>
<includes>
<include>*.wsdl</include>
</includes>
I am developing RESTFul services in my application. We are using 'cxf-codegen-plugin' to generate the JAXB classes from the schema. For a given requirement, I need to add some annotation to the generated JAXB classes and I was trying to use Annotate Plugin(Annox) for this but having issue in using it. I am getting org.xml.sax.SAXParseException: Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch to enable this plug-in.
This is how I have the setup in my codebase:
1. The WSDL refer to a XSD where I have the definitions of annotations.
2. pom.xml is using 'cxf-codegen-plugin' to generate the jabx classes.
3. The RESTFul service need some additional annotation on the generated classes, so I am trying ti use Annox to get the work done.
This is the snippet from the XSD:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="gov.nih.nci.po.webservices.types"
xmlns:tns="gov.nih.nci.po.webservices.types" elementFormDefault="qualified"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1"
xmlns:annox="http://annox.dev.java.net"
xmlns:ja="http://annox.dev.java.net/org.codehaus.jackson.annotate"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd
http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd"
jaxb:extensionBindingPrefixes="xjc annox">
<complexType name="PersonRole" abstract="true">
<annotation>
<appinfo>
<annox:annotate>
<ja:JsonTypeInfo use="CLASS" include="PROPERTY" property="#class"/>
</annox:annotate>
</appinfo>
</annotation>
<complexContent>
<extension base="tns:Role">
<sequence>
<element name="personId" type="long" />
</sequence>
</extension>
</complexContent>
</complexType>
</schema>
and this is how I want my generated class to look like:
#XmlAccessorType(XmlAccessType.FIELD)
#XmlType(name = "PersonRole", propOrder = { "personId" })
#XmlSeeAlso({ HealthCareProvider.class, OrganizationalContact.class,
ClinicalResearchStaff.class })
#JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "#class")
public abstract class PersonRole extends Role {
And below is the entry from pom.xml:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.build.directory}/generated-sources</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/PersonService.wsdl</wsdl>
<extraargs>
<extraarg>-xjc-Xannotate</extraarg> </extraargs>
</wsdlOption>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics-annotate</artifactId>
<version>0.6.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
Also I noticed that if I give some wrong value/configuration in xsd under JsonTypeInfo section, the build fail & complains (like mandatory field 'use' is missing etc) -- so I am assuming that the Annox plug-in is enabled & trying to do something. but then when I use above configurations, the build is failing with SAXParseException: Using "http://annox.dev.java.net" customizations requires the "-Xannotate" switch to enable this plug-in.
Could anybody please suggest as how this can be fixed?
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());
}
}