Commit e2ad412 1 parent 4dff06f commit e2ad412 Copy full SHA for e2ad412
File tree 6 files changed +113
-0
lines changed
jaxb-plugins-parent/tests
java/org/jvnet/jaxb/tests/fluentapi
6 files changed +113
-0
lines changed Original file line number Diff line number Diff line change
1
+ <project xmlns =" http://maven.apache.org/POM/4.0.0"
2
+ xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
3
+ xsi:schemaLocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" >
4
+ <modelVersion >4.0.0</modelVersion >
5
+ <parent >
6
+ <groupId >org.jvnet.jaxb</groupId >
7
+ <artifactId >jaxb-plugins-tests</artifactId >
8
+ <version >4.0.6-SNAPSHOT</version >
9
+ </parent >
10
+ <artifactId >jaxb-plugins-test-fluentapi</artifactId >
11
+ <packaging >jar</packaging >
12
+ <name >JAXB Tools :: JAXB Plugins :: Test [fluent-api]</name >
13
+ <dependencies >
14
+ <dependency >
15
+ <groupId >org.jvnet.jaxb</groupId >
16
+ <artifactId >jaxb-maven-plugin-testing</artifactId >
17
+ <scope >test</scope >
18
+ </dependency >
19
+ </dependencies >
20
+ <build >
21
+ <defaultGoal >test</defaultGoal >
22
+ <plugins >
23
+ <plugin >
24
+ <groupId >org.jvnet.jaxb</groupId >
25
+ <artifactId >jaxb-maven-plugin</artifactId >
26
+ <configuration >
27
+ <extension >true</extension >
28
+ <args >
29
+ <arg >-Xfluent-api</arg >
30
+ </args >
31
+ <plugins >
32
+ <plugin >
33
+ <groupId >org.jvnet.jaxb</groupId >
34
+ <artifactId >jaxb-plugins</artifactId >
35
+ </plugin >
36
+ </plugins >
37
+ </configuration >
38
+ </plugin >
39
+ </plugins >
40
+ </build >
41
+ </project >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <xs : schema xmlns : xs =" http://www.w3.org/2001/XMLSchema" elementFormDefault =" qualified" >
3
+ <xs : element name =" Person" >
4
+ <xs : complexType >
5
+ <xs : sequence >
6
+ <xs : element name =" firstName" type =" xs:string" />
7
+ <xs : element name =" middleName" type =" xs:string" />
8
+ <xs : element name =" lastName" type =" xs:string" />
9
+
10
+ <xs : element name =" residentialAddress" type =" Address" minOccurs =" 1" maxOccurs =" 1" />
11
+ <xs : element name =" mailingAddress" type =" Address" minOccurs =" 0" maxOccurs =" 1" />
12
+ <xs : element name =" mailingAddressIdentical" type =" xs:boolean" default =" true" />
13
+ </xs : sequence >
14
+ </xs : complexType >
15
+ </xs : element >
16
+
17
+ <xs : complexType name =" Address" >
18
+ <xs : sequence >
19
+ <xs : element name =" careOf" type =" xs:string" default =" none" />
20
+ <xs : element name =" street" type =" xs:string" />
21
+ <xs : element name =" number" type =" xs:int" default =" 42" />
22
+ <xs : element name =" apt" type =" xs:string" />
23
+ <xs : element name =" city" type =" xs:string" />
24
+ <xs : element name =" state" type =" xs:string" />
25
+ <xs : element name =" ZIP" type =" xs:string" />
26
+ </xs : sequence >
27
+ </xs : complexType >
28
+ </xs : schema >
Original file line number Diff line number Diff line change
1
+ package org .jvnet .jaxb .tests .fluentapi ;
2
+
3
+ import org .junit .Assert ;
4
+ import org .junit .Test ;
5
+
6
+ import generated .Address ;
7
+
8
+ public class AddressTest {
9
+
10
+ @ Test
11
+ public void testAddress () {
12
+ Address a = new Address ();
13
+ a .withNumber (10 ).withStreet ("MyStreet" ).withCity ("MyCity" );
14
+
15
+ Assert .assertEquals (10 , a .getNumber ());
16
+ Assert .assertNull (a .getCareOf ());
17
+ Assert .assertEquals ("MyStreet" , a .getStreet ());
18
+ Assert .assertEquals ("MyCity" , a .getCity ());
19
+ }
20
+ }
Original file line number Diff line number Diff line change
1
+ package org .jvnet .jaxb .tests .fluentapi ;
2
+
3
+ import org .junit .Assert ;
4
+ import org .junit .Test ;
5
+
6
+ import generated .Person ;
7
+
8
+ public class PersonTest {
9
+
10
+ @ Test
11
+ public void testPerson () {
12
+ Person p = new Person ()
13
+ .withMailingAddressIdentical (true ).withFirstName ("John" ).withLastName ("Doe" );
14
+ Assert .assertEquals (true , p .isMailingAddressIdentical ());
15
+ Assert .assertEquals ("John" , p .getFirstName ());
16
+ Assert .assertEquals ("Doe" , p .getLastName ());
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ log4j.rootCategory =DEBUG, stdout
2
+ log4j.appender.stdout =org.apache.log4j.ConsoleAppender
3
+ log4j.appender.stdout.target =system.out
4
+ log4j.appender.stdout.layout =org.apache.log4j.PatternLayout
5
+ log4j.appender.stdout.layout.ConversionPattern =%d %p [%c] - <%m>%n
Original file line number Diff line number Diff line change 20
20
<module >defaultvalue</module >
21
21
<module >elementwrapper</module >
22
22
<module >episodes</module >
23
+ <module >fluentapi</module >
23
24
<module >ignoring</module >
24
25
<module >issues</module >
25
26
<module >issues-legacy-ns</module >
You can’t perform that action at this time.
0 commit comments