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 java.util.Collection;
24
25 import static org.apache.maven.surefire.booter.Classpath.join;
26
27
28
29
30
31 public class ModularClasspathConfiguration extends AbstractPathConfiguration {
32 private final ModularClasspath modularClasspath;
33 private final Classpath testClasspathUrls;
34
35
36
37
38 private final Classpath inprocClasspath;
39
40 public ModularClasspathConfiguration(
41 @Nonnull ModularClasspath modularClasspath,
42 @Nonnull Classpath testClasspathUrls,
43 @Nonnull Classpath surefireClasspathUrls,
44 @Nonnull Classpath inprocClasspath,
45 boolean enableAssertions,
46 boolean childDelegation) {
47 super(surefireClasspathUrls, enableAssertions, childDelegation);
48 this.modularClasspath = modularClasspath;
49 this.testClasspathUrls = testClasspathUrls;
50 this.inprocClasspath = inprocClasspath;
51 }
52
53 @Override
54 public Classpath getTestClasspath() {
55 return testClasspathUrls;
56 }
57
58 @Override
59 public final boolean isModularPathConfig() {
60 return true;
61 }
62
63 @Override
64 public final boolean isClassPathConfig() {
65 return !isModularPathConfig();
66 }
67
68 public ModularClasspath getModularClasspath() {
69 return modularClasspath;
70 }
71
72 public ClassLoader createMergedClassLoader() throws SurefireExecutionException {
73 Collection<String> modulePath = getModularClasspath().getModulePath();
74 return createMergedClassLoader(join(getInprocTestClasspath(), new Classpath(modulePath)));
75 }
76
77 @Override
78 protected Classpath getInprocClasspath() {
79 return inprocClasspath;
80 }
81 }