This is an automated email from the ASF dual-hosted git repository. bdelacretaz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git
commit ef6a3108265435e6c6d558ffa2288612b5cfc019 Author: Bertrand Delacretaz <[email protected]> AuthorDate: Thu Oct 31 16:00:17 2019 +0100 SLING-8740 - basic sling.testing.paxexam setup --- pom.xml | 55 ++++++++++++++++++++++ .../sling/jcr/repoinit/it/RepoInitTextIT.java | 48 ++++++++++++++++++- 2 files changed, 101 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 02a8802..b27e4b8 100644 --- a/pom.xml +++ b/pom.xml @@ -50,6 +50,10 @@ <build> <plugins> <plugin> + <groupId>org.apache.servicemix.tooling</groupId> + <artifactId>depends-maven-plugin</artifactId> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <configuration> @@ -77,12 +81,63 @@ </goals> </execution> </executions> + <configuration> + <redirectTestOutputToFile>true</redirectTestOutputToFile> + <systemProperties> + <property> + <name>bundle.filename</name> + <value>${basedir}/target/${project.build.finalName}.jar</value> + </property> + </systemProperties> + </configuration> </plugin> </plugins> </build> <dependencies> <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-cm</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-container-forked</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-junit4</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.ops4j.pax.exam</groupId> + <artifactId>pax-exam-link-mvn</artifactId> + <version>4.13.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.testing.paxexam</artifactId> + <version>3.0.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.apache.felix.framework</artifactId> + <version>6.0.3</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.testing.osgi-mock</artifactId> <version>2.3.6</version> diff --git a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java index 856d040..7ed20db 100644 --- a/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java +++ b/src/test/java/org/apache/sling/jcr/repoinit/it/RepoInitTextIT.java @@ -23,21 +23,36 @@ import static org.junit.Assert.assertTrue; import java.io.InputStream; import java.io.InputStreamReader; +import javax.inject.Inject; import javax.jcr.Session; +import javax.jcr.SimpleCredentials; import org.apache.sling.jcr.api.SlingRepository; import org.apache.sling.jcr.repoinit.JcrRepoInitOpsProcessor; import org.apache.sling.junit.rules.TeleporterRule; import org.apache.sling.repoinit.parser.RepoInitParser; +import org.apache.sling.testing.paxexam.TestSupport; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; +import org.junit.runner.RunWith; +import org.ops4j.pax.exam.Configuration; +import org.ops4j.pax.exam.Option; +import org.ops4j.pax.exam.junit.PaxExam; +import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; +import org.ops4j.pax.exam.spi.reactors.PerClass; +import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration; +import static org.ops4j.pax.exam.CoreOptions.composite; +import static org.ops4j.pax.exam.CoreOptions.junitBundles; +import static org.apache.sling.testing.paxexam.SlingOptions.slingQuickstartOakTar; /** Basic integration test of the repoinit parser and execution * services, reading statements from a text file. */ -public class RepoInitTextIT { +@RunWith(PaxExam.class) +@ExamReactorStrategy(PerClass.class) +public class RepoInitTextIT extends TestSupport { private Session session; private static final String FRED_WILMA = "fredWilmaService"; @@ -45,9 +60,33 @@ public class RepoInitTextIT { public static final String REPO_INIT_FILE = "/repoinit.txt"; + @Inject + private SlingRepository repository; + + @Configuration + public Option[] configuration() { + return new Option[]{ + baseConfiguration(), + slingQuickstart(), + //testBundle("bundle.filename"), + junitBundles(), + newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist") + .put("whitelist.bundles.regexp", "^PAXEXAM.*$") + .asOption(), + }; + } + + protected Option slingQuickstart() { + final String workingDirectory = workingDirectory(); + final int httpPort = findFreePort(); + return composite( + slingQuickstartOakTar(workingDirectory, httpPort) + ); + } + @Before public void setup() throws Exception { - session = null; // TODO + session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); // Execute some repoinit statements final InputStream is = getClass().getResourceAsStream(REPO_INIT_FILE); @@ -72,6 +111,11 @@ public class RepoInitTextIT { } } + @Test + public void TODO() throws Exception { + assertNotNull(session); + } + /* @Test public void serviceUserCreated() throws Exception {
