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