1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.compress.osgi;
20
21 import static org.ops4j.pax.exam.CoreOptions.bundle;
22 import static org.ops4j.pax.exam.CoreOptions.composite;
23 import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
24 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
25
26 import java.util.Arrays;
27
28 import org.junit.jupiter.api.Assertions;
29 import org.ops4j.pax.exam.Option;
30 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
31
32 final class Configurations {
33
34
35
36
37 private static MavenArtifactProvisionOption getCommonsCodec() {
38 return mavenBundle().groupId("commons-codec").artifactId("commons-codec").version("1.16.0");
39 }
40
41
42
43
44 private static MavenArtifactProvisionOption getCommonsIO() {
45 return mavenBundle().groupId("commons-io").artifactId("commons-io").version("2.15.1");
46 }
47
48 public static Option[] getConfigWithoutOptionals() {
49 final Option[] defaultConfig = getDefaultConfig();
50
51 final Option[] result = Arrays.stream(defaultConfig)
52 .filter(o -> !getCommonsCodec().equals(o))
53 .filter(o -> !getCommonsIO().equals(o))
54 .toArray(Option[]::new);
55
56 Assertions.assertTrue(result.length < defaultConfig.length, "Expected to have removed options.");
57 return result;
58 }
59
60 public static Option[] getDefaultConfig() {
61
62 return new Option[]{systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
63 systemProperty("org.ops4j.pax.url.mvn.useFallbackRepositories").value("false"),
64 systemProperty("org.ops4j.pax.url.mvn.repositories").value("https://repo.maven.apache.org/maven2"),
65 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.scr").version("2.0.14"),
66 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.8.16"),
67 getCommonsCodec(),
68 getCommonsIO(),
69 composite(systemProperty("pax.exam.invoker").value("junit"),
70 bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link"),
71 bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link"),
72 mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").version("1.3_1")),
73 bundle("reference:file:target/classes/").start()};
74
75 }
76
77 private Configurations() {
78
79 }
80 }