SLING-9111 Update Pax Exam to 4.13.2
Update Pax Exam and clean up configurations
diff --git a/pom.xml b/pom.xml
index 3093a08..91fdded 100644
--- a/pom.xml
+++ b/pom.xml
@@ -106,31 +106,31 @@
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam</artifactId>
- <version>4.13.1</version>
+ <version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-cm</artifactId>
- <version>4.13.1</version>
+ <version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
- <version>4.13.1</version>
+ <version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
- <version>4.13.1</version>
+ <version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
- <version>4.13.1</version>
+ <version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -219,7 +219,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.repoinit.parser</artifactId>
- <version>1.4.2</version>
+ <version>1.4.3-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
index 4019d65..6f1f3fc 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTestSupport.java
@@ -16,7 +16,10 @@
*/
package org.apache.sling.jcr.repoinit.it;
-import org.apache.commons.lang3.ArrayUtils;
+import javax.inject.Inject;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
import org.apache.sling.jcr.api.SlingRepository;
import org.apache.sling.testing.paxexam.SlingOptions;
import org.apache.sling.testing.paxexam.TestSupport;
@@ -24,30 +27,17 @@
import org.junit.Before;
import org.ops4j.pax.exam.Configuration;
import org.ops4j.pax.exam.Option;
-import org.ops4j.pax.exam.options.CompositeOption;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import static org.ops4j.pax.exam.CoreOptions.keepCaches;
-import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-import static org.ops4j.pax.exam.CoreOptions.when;
-import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
+import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
import static org.apache.sling.testing.paxexam.SlingOptions.versionResolver;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import javax.inject.Inject;
-import javax.jcr.Session;
-import javax.jcr.SimpleCredentials;
-
import static org.ops4j.pax.exam.CoreOptions.composite;
import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
import static org.ops4j.pax.exam.CoreOptions.vmOption;
-import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar;
+import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
public abstract class RepoInitTestSupport extends TestSupport {
@@ -64,32 +54,28 @@
public Option[] configuration() {
SlingOptions.versionResolver.setVersionFromProject("org.apache.jackrabbit", "jackrabbit-api");
SlingOptions.versionResolver.setVersionFromProject("org.apache.sling", "org.apache.sling.repoinit.parser");
- final String localRepo = System.getProperty("maven.repo.local", "");
- final Option[] options =
- remove(new Option[] {
- vmOption(System.getProperty("pax.vm.options")),
- baseConfiguration(),
- slingQuickstart(),
- testBundle("bundle.filename"),
- keepCaches(),
- systemProperty("org.ops4j.pax.url.mvn.repositories").value(repositoriesURL),
- when(localRepo.length() > 0).useOptions(
- systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
- ),
- junitBundles(),
- newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
- .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
- .asOption()
- },
- // remove our bundle under test to avoid duplication
- mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.jcr.repoinit").version(versionResolver)
+ return options(
+ composite(
+ super.baseConfiguration(),
+ vmOption(System.getProperty("pax.vm.options")),
+ slingQuickstart(),
+ testBundle("bundle.filename"),
+ mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.repoinit.parser").versionAsInProject(),
+ junitBundles(),
+ newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
+ .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
+ .asOption()
+ ).add(
+ additionalOptions()
+ ).remove(
+ // remove our bundle under test to avoid duplication
+ mavenBundle().groupId("org.apache.sling").artifactId("org.apache.sling.jcr.repoinit").version(versionResolver)
+ )
);
- final Option[] allOptions = ArrayUtils.addAll(options, additionalOptions());
- return allOptions;
}
protected Option[] additionalOptions() {
- return new Option[] {};
+ return new Option[]{};
}
protected Option slingQuickstart() {
@@ -106,46 +92,16 @@
@Before
public void setupSession() throws Exception {
- if(session == null) {
+ if (session == null) {
session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()));
}
}
@After
public void cleanupSession() {
- if(session != null) {
+ if (session != null) {
session.logout();
}
}
- // TODO should come from org.apache.sling.testing.paxexam
- private static List<Option> expand(final Option[] options) {
- final List<Option> expanded = new ArrayList<>();
- if (options != null) {
- for (final Option option : options) {
- if (option != null) {
- if (option instanceof CompositeOption) {
- expanded.addAll(Arrays.asList(((CompositeOption) option).getOptions()));
- } else {
- expanded.add(option);
- }
- }
- }
- }
- return expanded;
- }
-
- // TODO should come from org.apache.sling.testing.paxexam
- private static Option[] remove(final Option[] options, final Option... removables) {
- final List<Option> expanded = expand(options);
- for (final Option removable : removables) {
- if (removable instanceof CompositeOption) {
- expanded.removeAll(Arrays.asList(((CompositeOption) removable).getOptions()));
- } else {
- expanded.removeAll(Collections.singleton(removable));
- }
- }
- return expanded.toArray(new Option[0]);
- }
-
}