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