-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#508] add test project for fluent-api plugin
- Loading branch information
1 parent
4dff06f
commit e2ad412
Showing
6 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<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/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-plugins-tests</artifactId> | ||
<version>4.0.6-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>jaxb-plugins-test-fluentapi</artifactId> | ||
<packaging>jar</packaging> | ||
<name>JAXB Tools :: JAXB Plugins :: Test [fluent-api]</name> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin-testing</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<defaultGoal>test</defaultGoal> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-maven-plugin</artifactId> | ||
<configuration> | ||
<extension>true</extension> | ||
<args> | ||
<arg>-Xfluent-api</arg> | ||
</args> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.jvnet.jaxb</groupId> | ||
<artifactId>jaxb-plugins</artifactId> | ||
</plugin> | ||
</plugins> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
28 changes: 28 additions & 0 deletions
28
jaxb-plugins-parent/tests/fluentapi/src/main/resources/Person.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> | ||
<xs:element name="Person"> | ||
<xs:complexType> | ||
<xs:sequence> | ||
<xs:element name="firstName" type="xs:string"/> | ||
<xs:element name="middleName" type="xs:string"/> | ||
<xs:element name="lastName" type="xs:string"/> | ||
|
||
<xs:element name="residentialAddress" type="Address" minOccurs="1" maxOccurs="1"/> | ||
<xs:element name="mailingAddress" type="Address" minOccurs="0" maxOccurs="1"/> | ||
<xs:element name="mailingAddressIdentical" type="xs:boolean" default="true"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:element> | ||
|
||
<xs:complexType name="Address"> | ||
<xs:sequence> | ||
<xs:element name="careOf" type="xs:string" default="none" /> | ||
<xs:element name="street" type="xs:string"/> | ||
<xs:element name="number" type="xs:int" default="42"/> | ||
<xs:element name="apt" type="xs:string"/> | ||
<xs:element name="city" type="xs:string"/> | ||
<xs:element name="state" type="xs:string"/> | ||
<xs:element name="ZIP" type="xs:string"/> | ||
</xs:sequence> | ||
</xs:complexType> | ||
</xs:schema> |
20 changes: 20 additions & 0 deletions
20
...gins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/AddressTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.jvnet.jaxb.tests.fluentapi; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import generated.Address; | ||
|
||
public class AddressTest { | ||
|
||
@Test | ||
public void testAddress() { | ||
Address a = new Address(); | ||
a.withNumber(10).withStreet("MyStreet").withCity("MyCity"); | ||
|
||
Assert.assertEquals(10, a.getNumber()); | ||
Assert.assertNull(a.getCareOf()); | ||
Assert.assertEquals("MyStreet", a.getStreet()); | ||
Assert.assertEquals("MyCity", a.getCity()); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ugins-parent/tests/fluentapi/src/test/java/org/jvnet/jaxb/tests/fluentapi/PersonTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.jvnet.jaxb.tests.fluentapi; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import generated.Person; | ||
|
||
public class PersonTest { | ||
|
||
@Test | ||
public void testPerson() { | ||
Person p = new Person() | ||
.withMailingAddressIdentical(true).withFirstName("John").withLastName("Doe"); | ||
Assert.assertEquals(true, p.isMailingAddressIdentical()); | ||
Assert.assertEquals("John", p.getFirstName()); | ||
Assert.assertEquals("Doe", p.getLastName()); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
jaxb-plugins-parent/tests/fluentapi/src/test/resources/log4j.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
log4j.rootCategory=DEBUG, stdout | ||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender | ||
log4j.appender.stdout.target=system.out | ||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters