1 package org.apache.maven.surefire.booter;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import javax.annotation.Nonnull;
23
24 import static org.apache.maven.surefire.booter.Classpath.emptyClasspath;
25
26
27
28
29
30
31
32
33
34 public class ClasspathConfiguration extends AbstractPathConfiguration
35 {
36 private final Classpath testClasspathUrls;
37
38
39
40
41 private final Classpath inprocClasspath;
42
43 public ClasspathConfiguration( boolean enableAssertions, boolean childDelegation )
44 {
45 this( emptyClasspath(), emptyClasspath(), emptyClasspath(), enableAssertions, childDelegation );
46 }
47
48 ClasspathConfiguration( @Nonnull PropertiesWrapper properties )
49 {
50 this( properties.getClasspath( CLASSPATH ), properties.getClasspath( SUREFIRE_CLASSPATH ), emptyClasspath(),
51 properties.getBooleanProperty( ENABLE_ASSERTIONS ), properties.getBooleanProperty( CHILD_DELEGATION ) );
52 }
53
54 public ClasspathConfiguration( @Nonnull Classpath testClasspathUrls, @Nonnull Classpath surefireClassPathUrls,
55 @Nonnull Classpath inprocClasspath, boolean enableAssertions,
56 boolean childDelegation )
57 {
58 super( surefireClassPathUrls, enableAssertions, childDelegation );
59 this.testClasspathUrls = testClasspathUrls;
60 this.inprocClasspath = inprocClasspath;
61 }
62
63 @Override
64 protected Classpath getInprocClasspath()
65 {
66 return inprocClasspath;
67 }
68
69 public Classpath getTestClasspath()
70 {
71 return testClasspathUrls;
72 }
73
74 @Override
75 public final boolean isModularPathConfig()
76 {
77 return !isClassPathConfig();
78 }
79
80 @Override
81 public final boolean isClassPathConfig()
82 {
83 return true;
84 }
85
86 public void trickClassPathWhenManifestOnlyClasspath()
87 {
88 System.setProperty( "surefire.real.class.path", System.getProperty( "java.class.path" ) );
89 getTestClasspath().writeToSystemProperty( "java.class.path" );
90 }
91 }