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
33 final class Configurations {
34
35
36
37
38 private static MavenArtifactProvisionOption getCommonsCodec() {
39 return mavenBundle().groupId("commons-codec").artifactId("commons-codec").version("1.16.0");
40 }
41
42 public static Option[] getConfigWithoutCommonsCodec() {
43 final Option[] defaultConfig = getDefaultConfig();
44 final Option[] result = Arrays.stream(defaultConfig)
45 .filter(o -> !getCommonsCodec().equals(o))
46 .toArray(Option[]::new);
47 Assertions.assertTrue(result.length < defaultConfig.length, "Expected to have removed an option.");
48 return result;
49 }
50
51 public static Option[] getDefaultConfig() {
52 return new Option[]{systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
53 systemProperty("org.ops4j.pax.url.mvn.useFallbackRepositories").value("false"),
54 systemProperty("org.ops4j.pax.url.mvn.repositories").value("https://repo.maven.apache.org/maven2"),
55 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.scr").version("2.0.14"),
56 mavenBundle().groupId("org.apache.felix").artifactId("org.apache.felix.configadmin").version("1.8.16"),
57 getCommonsCodec(),
58 mavenBundle().groupId("commons-io").artifactId("commons-io").version("2.15.1"),
59 composite(systemProperty("pax.exam.invoker").value("junit"), bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link"),
60 bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link"),
61 mavenBundle().groupId("org.apache.servicemix.bundles").artifactId("org.apache.servicemix.bundles.hamcrest").version("1.3_1")),
62 bundle("reference:file:target/classes/").start()};
63 }
64
65 private Configurations() {
66
67 }
68 }