1 package org.apache.maven.surefire.its;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.apache.maven.surefire.its.fixture.OutputValidator;
23 import org.junit.Test;
24
25 import java.io.File;
26
27 import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME;
28 import static org.apache.maven.surefire.its.fixture.SurefireLauncher.EXT_JDK_HOME_KEY;
29 import static org.hamcrest.Matchers.anyOf;
30 import static org.hamcrest.Matchers.greaterThanOrEqualTo;
31 import static org.hamcrest.Matchers.is;
32
33
34
35
36
37
38
39
40 public class Java9FullApiIT
41 extends AbstractJigsawIT
42 {
43
44 @Test
45 public void shouldLoadMultipleJavaModules_JavaHome() throws Exception
46 {
47 OutputValidator validator = assumeJigsaw()
48 .setForkJvm()
49 .debugLogging()
50 .execute( "verify" )
51 .verifyErrorFree( 1 );
52
53 validator.verifyTextInLog( "loaded class java.sql.SQLException" )
54 .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
55 .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
56 .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
57 .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
58 .assertThatLogLine( anyOf( is( "java.specification.version=9" ),
59 is( "java.specification.version=10" ),
60 is( "java.specification.version=11" ) ),
61 greaterThanOrEqualTo( 1 ) );
62 }
63
64 @Test
65 public void shouldLoadMultipleJavaModules_JvmParameter() throws Exception
66 {
67 OutputValidator validator = assumeJava9Property()
68 .setForkJvm()
69 .debugLogging()
70 .sysProp( EXT_JDK_HOME_KEY, new File( EXT_JDK_HOME ).getCanonicalPath() )
71 .execute( "verify" )
72 .verifyErrorFree( 1 );
73
74 validator.verifyTextInLog( "loaded class java.sql.SQLException" )
75 .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
76 .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
77 .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
78 .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
79 .assertThatLogLine( anyOf( is( "java.specification.version=9" ),
80 is( "java.specification.version=10" ),
81 is( "java.specification.version=11" ) ),
82 greaterThanOrEqualTo( 1 ) );
83 }
84
85 @Test
86 public void shouldLoadMultipleJavaModules_ToolchainsXML() throws Exception
87 {
88 OutputValidator validator = assumeJava9Property()
89 .setForkJvm()
90 .activateProfile( "use-toolchains" )
91 .addGoal( "--toolchains" )
92 .addGoal( System.getProperty( "maven.toolchains.file" ) )
93 .execute( "verify" )
94 .verifyErrorFree( 1 );
95
96 validator.verifyTextInLog( "loaded class java.sql.SQLException" )
97 .verifyTextInLog( "loaded class javax.xml.ws.Holder" )
98 .verifyTextInLog( "loaded class javax.xml.bind.JAXBException" )
99 .verifyTextInLog( "loaded class javax.transaction.TransactionManager" )
100 .verifyTextInLog( "loaded class javax.transaction.InvalidTransactionException" )
101 .assertThatLogLine( anyOf( is( "java.specification.version=9" ),
102 is( "java.specification.version=10" ),
103 is( "java.specification.version=11" ) ),
104 greaterThanOrEqualTo( 1 ) );
105 }
106
107 @Override
108 protected String getProjectDirectoryName()
109 {
110 return "java9-full-api";
111 }
112 }