Index: jackrabbit-jcr-server/pom.xml
===================================================================
--- jackrabbit-jcr-server/pom.xml (revision 1907912)
+++ jackrabbit-jcr-server/pom.xml (working copy)
@@ -25,9 +25,9 @@
org.apache.jackrabbit
- jackrabbit-parent
+ jackrabbit-jcr-server-project
2.21.16-SNAPSHOT
- ../jackrabbit-parent/pom.xml
+ ../jackrabbit-jcr-server-project
jackrabbit-jcr-server
Jackrabbit JCR Server
@@ -190,108 +190,15 @@
- javax.jcr
- jcr
-
-
org.apache.jackrabbit
- jackrabbit-spi-commons
- ${project.version}
-
-
- org.apache.jackrabbit
- jackrabbit-jcr-commons
- ${project.version}
-
-
- org.apache.jackrabbit
jackrabbit-webdav
${project.version}
- org.apache.tika
- tika-core
-
-
- org.slf4j
- slf4j-api
-
-
javax.servlet
javax.servlet-api
provided
-
- commons-fileupload
- commons-fileupload
-
-
-
-
- org.osgi
- org.osgi.compendium
- 5.0.0
- provided
-
-
- org.apache.felix
- org.apache.felix.scr.annotations
- 1.12.0
- provided
-
-
- org.osgi
- org.osgi.annotation
- provided
-
-
-
- junit
- junit
- test
-
-
- org.easymock
- easymock
- test
-
-
- org.apache.jackrabbit
- jackrabbit-core
- ${project.version}
- test
-
-
- org.apache.jackrabbit
- jackrabbit-jcr-tests
- ${project.version}
- test
-
-
- org.eclipse.jetty
- jetty-server
- test
-
-
- org.eclipse.jetty
- jetty-servlet
- test
-
-
- ch.qos.logback
- logback-classic
- test
-
-
- org.mockito
- mockito-core
- test
-
-
- org.apache.derby
- derby
- test
-
Index: jackrabbit-jcr-server-jakarta/pom.xml
===================================================================
--- jackrabbit-jcr-server-jakarta/pom.xml (nonexistent)
+++ jackrabbit-jcr-server-jakarta/pom.xml (working copy)
@@ -0,0 +1,105 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-jcr-server-jakarta
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav-jakarta
+ ${project.version}
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 5.0.0
+ provided
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-server-jakarta
===================================================================
--- jackrabbit-jcr-server-jakarta (nonexistent)
+++ jackrabbit-jcr-server-jakarta (working copy)
Property changes on: jackrabbit-jcr-server-jakarta
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-jcr-server-jakarta/pom.xml
===================================================================
--- jackrabbit-jcr-server-jakarta/pom.xml (nonexistent)
+++ jackrabbit-jcr-server-jakarta/pom.xml (working copy)
@@ -0,0 +1,105 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-jcr-server-jakarta
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav-jakarta
+ ${project.version}
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 5.0.0
+ provided
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-server-project/pom.xml
===================================================================
--- jackrabbit-jcr-server-project/pom.xml (nonexistent)
+++ jackrabbit-jcr-server-project/pom.xml (working copy)
@@ -0,0 +1,125 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-jcr-server-project
+ pom
+
+ ../jackrabbit-jcr-server
+ ../jackrabbit-jcr-server-jakarta
+
+
+
+ javax.jcr
+ jcr
+
+
+ org.apache.jackrabbit
+ jackrabbit-spi-commons
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-commons
+ ${project.version}
+
+
+ org.apache.tika
+ tika-core
+
+
+ org.slf4j
+ slf4j-api
+
+
+ commons-fileupload
+ commons-fileupload
+
+
+
+ org.osgi
+ org.osgi.compendium
+ 5.0.0
+ provided
+
+
+ org.apache.felix
+ org.apache.felix.scr.annotations
+ 1.12.0
+ provided
+
+
+ org.osgi
+ org.osgi.annotation
+ provided
+
+
+ junit
+ junit
+ test
+
+
+ org.easymock
+ easymock
+ test
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+ test
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-tests
+ ${project.version}
+ test
+
+
+ org.eclipse.jetty
+ jetty-server
+ test
+
+
+ org.eclipse.jetty
+ jetty-servlet
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+ org.apache.derby
+ derby
+ test
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-server-project
===================================================================
--- jackrabbit-jcr-server-project (nonexistent)
+++ jackrabbit-jcr-server-project (working copy)
Property changes on: jackrabbit-jcr-server-project
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-jcr-server-project/pom.xml
===================================================================
--- jackrabbit-jcr-server-project/pom.xml (nonexistent)
+++ jackrabbit-jcr-server-project/pom.xml (working copy)
@@ -0,0 +1,125 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-jcr-server-project
+ pom
+
+ ../jackrabbit-jcr-server
+ ../jackrabbit-jcr-server-jakarta
+
+
+
+ javax.jcr
+ jcr
+
+
+ org.apache.jackrabbit
+ jackrabbit-spi-commons
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-commons
+ ${project.version}
+
+
+ org.apache.tika
+ tika-core
+
+
+ org.slf4j
+ slf4j-api
+
+
+ commons-fileupload
+ commons-fileupload
+
+
+
+ org.osgi
+ org.osgi.compendium
+ 5.0.0
+ provided
+
+
+ org.apache.felix
+ org.apache.felix.scr.annotations
+ 1.12.0
+ provided
+
+
+ org.osgi
+ org.osgi.annotation
+ provided
+
+
+ junit
+ junit
+ test
+
+
+ org.easymock
+ easymock
+ test
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+ test
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-tests
+ ${project.version}
+ test
+
+
+ org.eclipse.jetty
+ jetty-server
+ test
+
+
+ org.eclipse.jetty
+ jetty-servlet
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+ org.mockito
+ mockito-core
+ test
+
+
+ org.apache.derby
+ derby
+ test
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-servlet/pom.xml
===================================================================
--- jackrabbit-jcr-servlet/pom.xml (revision 1907912)
+++ jackrabbit-jcr-servlet/pom.xml (working copy)
@@ -21,9 +21,9 @@
4.0.0
org.apache.jackrabbit
- jackrabbit-parent
+ jackrabbit-jcr-servlet-project
2.21.16-SNAPSHOT
- ../jackrabbit-parent/pom.xml
+ ../jackrabbit-jcr-servlet-project
jackrabbit-jcr-servlet
@@ -36,31 +36,10 @@
- javax.jcr
- jcr
-
-
javax.servlet
javax.servlet-api
provided
-
- org.apache.jackrabbit
- jackrabbit-jcr-commons
- ${project.version}
-
-
- org.apache.jackrabbit
- jackrabbit-jcr-rmi
- ${project.version}
- true
-
-
- org.apache.jackrabbit
- jackrabbit-core
- ${project.version}
- true
-
Index: jackrabbit-jcr-servlet-jakarta/pom.xml
===================================================================
--- jackrabbit-jcr-servlet-jakarta/pom.xml (nonexistent)
+++ jackrabbit-jcr-servlet-jakarta/pom.xml (working copy)
@@ -0,0 +1,100 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-jcr-servlet-jakarta
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 5.0.0
+ provided
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-servlet-jakarta
===================================================================
--- jackrabbit-jcr-servlet-jakarta (nonexistent)
+++ jackrabbit-jcr-servlet-jakarta (working copy)
Property changes on: jackrabbit-jcr-servlet-jakarta
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-jcr-servlet-jakarta/pom.xml
===================================================================
--- jackrabbit-jcr-servlet-jakarta/pom.xml (nonexistent)
+++ jackrabbit-jcr-servlet-jakarta/pom.xml (working copy)
@@ -0,0 +1,100 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-jcr-servlet-jakarta
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 5.0.0
+ provided
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-servlet-project/pom.xml
===================================================================
--- jackrabbit-jcr-servlet-project/pom.xml (nonexistent)
+++ jackrabbit-jcr-servlet-project/pom.xml (working copy)
@@ -0,0 +1,56 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-jcr-servlet-project
+ pom
+ Jackrabbit WebDAV Project
+
+ ../jackrabbit-jcr-servlet
+ ../jackrabbit-jcr-servlet-jakarta
+
+
+
+ javax.jcr
+ jcr
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-commons
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-rmi
+ ${project.version}
+ true
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+ true
+
+
+
\ No newline at end of file
Index: jackrabbit-jcr-servlet-project
===================================================================
--- jackrabbit-jcr-servlet-project (nonexistent)
+++ jackrabbit-jcr-servlet-project (working copy)
Property changes on: jackrabbit-jcr-servlet-project
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-jcr-servlet-project/pom.xml
===================================================================
--- jackrabbit-jcr-servlet-project/pom.xml (nonexistent)
+++ jackrabbit-jcr-servlet-project/pom.xml (working copy)
@@ -0,0 +1,56 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-jcr-servlet-project
+ pom
+ Jackrabbit WebDAV Project
+
+ ../jackrabbit-jcr-servlet
+ ../jackrabbit-jcr-servlet-jakarta
+
+
+
+ javax.jcr
+ jcr
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-commons
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-rmi
+ ${project.version}
+ true
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+ true
+
+
+
\ No newline at end of file
Index: jackrabbit-webapp/pom.xml
===================================================================
--- jackrabbit-webapp/pom.xml (revision 1908148)
+++ jackrabbit-webapp/pom.xml (working copy)
@@ -1,5 +1,4 @@
-
-
4.0.0
-
org.apache.jackrabbit
- jackrabbit-parent
+ jackrabbit-webapp-project
2.21.16-SNAPSHOT
- ../jackrabbit-parent/pom.xml
+ ../jackrabbit-webapp-project
jackrabbit-webapp
war
Jackrabbit Web Application
Web application that hosts and serves a Jackrabbit content repository
-
-
- 8.5.86
-
-
- javax.jcr
- jcr
- compile
-
-
org.apache.jackrabbit
- jackrabbit-core
- ${project.version}
-
-
- org.apache.tika
- tika-parsers-standard-package
-
-
- org.slf4j
- jcl-over-slf4j
-
-
- org.apache.jackrabbit
jackrabbit-jcr-server
${project.version}
@@ -68,32 +42,7 @@
${project.version}
- org.apache.jackrabbit
- jackrabbit-jcr-rmi
- ${project.version}
-
-
- ch.qos.logback
- logback-classic
-
-
- commons-beanutils
- commons-beanutils
-
-
org.apache.tomcat
- tomcat-servlet-api
- ${tomcat.version}
- provided
-
-
-
- junit
- junit
- test
-
-
- org.apache.tomcat
tomcat-catalina
${tomcat.version}
test
@@ -111,35 +60,20 @@
test
- net.sourceforge.htmlunit
- htmlunit
- 2.70.0
- test
-
-
- commons-logging
- commons-logging
-
-
+ org.apache.tika
+ tika-parsers-standard-package
+
+
+ org.bouncycastle
+ bcmail-jdk15on
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
-
- org.slf4j
- jul-to-slf4j
- ${slf4j.version}
- test
-
-
- com.google.guava
- guava
- 31.1-jre
- test
-
-
- org.apache.derby
- derby
-
-
@@ -191,21 +125,5 @@
-
-
-
- maven-failsafe-plugin
-
-
-
- derby.stream.error.file
- target/derby.log
-
-
-
-
-
-
-
Index: jackrabbit-webapp-jakarta/pom.xml
===================================================================
--- jackrabbit-webapp-jakarta/pom.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/pom.xml (working copy)
@@ -0,0 +1,153 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-webapp-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-webapp-jakarta
+ war
+
+ 10.1.6
+
+
+
+
+ maven-war-plugin
+
+ true
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-war
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webapp
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webapp
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server-jakarta
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet-jakarta
+ ${project.version}
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-core
+ ${tomcat.version}
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-jasper
+ ${tomcat.version}
+
+
+ org.apache.tomcat
+ tomcat-jasper
+ ${tomcat.version}
+
+
+ org.apache.tomcat
+ tomcat-jasper-el
+ ${tomcat.version}
+
+
+ org.apache.tomcat
+ tomcat-jsp-api
+ ${tomcat.version}
+
+
+ org.apache.tika
+ tika-parsers-standard-package
+
+
+ org.bouncycastle
+ bcmail-jdk15on
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
+
+
+
\ No newline at end of file
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml
===================================================================
--- jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (working copy)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ target/jcr.log
+
+ %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n
+
+
+
+
+
+
+
+
Index: jackrabbit-webapp-jakarta
===================================================================
--- jackrabbit-webapp-jakarta (nonexistent)
+++ jackrabbit-webapp-jakarta (working copy)
Property changes on: jackrabbit-webapp-jakarta
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml
===================================================================
--- jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (working copy)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ target/jcr.log
+
+ %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n
+
+
+
+
+
+
+
+
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml
===================================================================
--- jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (working copy)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ target/jcr.log
+
+ %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n
+
+
+
+
+
+
+
+
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java
===================================================================
--- jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/java/org/apache/jackrabbit/j2ee/TomcatIT.java (working copy)
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.j2ee;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.io.IOUtils;
+import org.slf4j.bridge.SLF4JBridgeHandler;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlElement;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.google.common.io.Files;
+
+import junit.framework.TestCase;
+
+public class TomcatIT extends TestCase {
+
+ static {
+ SLF4JBridgeHandler.install();
+ }
+
+ private URL url;
+
+ private Tomcat tomcat;
+
+ private WebClient client;
+
+ protected void setUp() throws Exception {
+ File war = null;
+ for (File f : new File("target").listFiles()) {
+ if (f.isFile() && f.getName().endsWith("war")) {
+ war = extractWarFile(f);
+ break;
+ }
+ }
+ assertNotNull(war);
+ rewriteWebXml(war);
+
+ File bootstrap = new File("target", "bootstrap.properties");
+ bootstrap.delete();
+
+ File baseDir = new File("target", "tomcat");
+ FileUtils.deleteQuietly(baseDir);
+
+ File repoDir = new File("target", "repository");
+ FileUtils.deleteQuietly(repoDir);
+
+ url = new URL("http://localhost:12856/");
+
+ tomcat = new Tomcat();
+ tomcat.setSilent(true);
+ tomcat.setBaseDir(baseDir.getPath());
+ tomcat.setHostname(url.getHost());
+ tomcat.setPort(url.getPort());
+ tomcat.getConnector();
+ tomcat.addWebapp("", war.getAbsolutePath());
+
+ tomcat.start();
+
+ client = new WebClient();
+ }
+
+ private File extractWarFile(File warFile) throws IOException{
+ String fileBaseName = FilenameUtils.getBaseName(warFile.getName());
+ Path destFolderPath = Paths.get(warFile.getParent(), fileBaseName);
+ if (!java.nio.file.Files.exists(destFolderPath)) {
+ try (ZipFile zipFile = new ZipFile(warFile, ZipFile.OPEN_READ)){
+ Enumeration extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ ZipEntry entry = entries.nextElement();
+ Path entryPath = destFolderPath.resolve(entry.getName());
+ if (entryPath.normalize().startsWith(destFolderPath.normalize())){
+ if (entry.isDirectory()) {
+ java.nio.file.Files.createDirectories(entryPath);
+ } else {
+ java.nio.file.Files.createDirectories(entryPath.getParent());
+ try (InputStream in = zipFile.getInputStream(entry)){
+ try (OutputStream out = new FileOutputStream(entryPath.toFile())){
+ IOUtils.copy(in, out);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return destFolderPath.toFile();
+ }
+
+ protected void mkdirs(File dir, String errorMessageFormat) {
+ if (dir.exists() && dir.isDirectory()) {
+ return;
+ }
+ dir.mkdirs();
+ if (!dir.exists()) {
+ throw new RuntimeException(String.format(errorMessageFormat, dir.getPath()));
+ }
+ }
+
+ public void testTomcat() throws Exception {
+ HtmlPage page = client.getPage(url);
+ assertEquals("Content Repository Setup", page.getTitleText());
+
+ page = submitNewRepositoryForm(page);
+ assertEquals("Content Repository Ready", page.getTitleText());
+
+ page = page.getAnchorByText("home").click();
+ assertEquals("Apache Jackrabbit JCR Server", page.getTitleText());
+ }
+
+ private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException {
+ for (HtmlForm form : page.getForms()) {
+ for (HtmlInput mode : form.getInputsByName("mode")) {
+ if ("new".equals(mode.getValueAttribute())) {
+ for (HtmlInput home : form.getInputsByName("repository_home")) {
+ home.setValueAttribute("target/repository");
+ for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) {
+ return submit.click();
+ }
+ }
+ }
+ }
+ }
+ fail();
+ return null;
+ }
+
+ private void rewriteWebXml(File war) throws IOException {
+ File webXml = new File(war, new File("WEB-INF","web.xml").getPath());
+ assertTrue(webXml.exists());
+ List lines = Files.readLines(webXml, StandardCharsets.UTF_8);
+ BufferedWriter writer = Files.newWriter(webXml, StandardCharsets.UTF_8);
+ try {
+ for (String line : lines) {
+ line = line.replace("jackrabbit/bootstrap.properties",
+ "target/bootstrap.properties");
+ writer.write(line);
+ writer.write(System.lineSeparator());
+ }
+ } finally {
+ writer.close();
+ }
+ }
+
+ protected void tearDown() throws Exception {
+ client.close();
+
+ tomcat.stop();
+ }
+
+}
Index: jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml
===================================================================
--- jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (working copy)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ target/jcr.log
+
+ %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n
+
+
+
+
+
+
+
+
Index: jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml
===================================================================
--- jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/src/test/resources/logback-test.xml (working copy)
@@ -0,0 +1,31 @@
+
+
+
+
+
+ target/jcr.log
+
+ %date{HH:mm:ss.SSS} %-5level %-40([%thread] %F:%L) %msg%n
+
+
+
+
+
+
+
+
Index: jackrabbit-webapp-jakarta/pom.xml
===================================================================
--- jackrabbit-webapp-jakarta/pom.xml (nonexistent)
+++ jackrabbit-webapp-jakarta/pom.xml (working copy)
@@ -0,0 +1,153 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-webapp-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-webapp-jakarta
+ war
+
+ 10.1.6
+
+
+
+
+ maven-war-plugin
+
+ true
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-war
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webapp
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webapp
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-server-jakarta
+ ${project.version}
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-servlet-jakarta
+ ${project.version}
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-core
+ ${tomcat.version}
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-jasper
+ ${tomcat.version}
+
+
+ org.apache.tomcat
+ tomcat-jasper
+ ${tomcat.version}
+
+
+ org.apache.tomcat
+ tomcat-jasper-el
+ ${tomcat.version}
+
+
+ org.apache.tomcat
+ tomcat-jsp-api
+ ${tomcat.version}
+
+
+ org.apache.tika
+ tika-parsers-standard-package
+
+
+ org.bouncycastle
+ bcmail-jdk15on
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+
+
+
+
+
\ No newline at end of file
Index: jackrabbit-webapp-project/pom.xml
===================================================================
--- jackrabbit-webapp-project/pom.xml (nonexistent)
+++ jackrabbit-webapp-project/pom.xml (working copy)
@@ -0,0 +1,124 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-webapp-project
+ pom
+
+ ../jackrabbit-webapp
+ ../jackrabbit-webapp-jakarta
+
+
+ 8.5.86
+
+
+
+ javax.jcr
+ jcr
+ compile
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+
+
+ org.apache.tika
+ tika-parsers-standard-package
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-rmi
+ ${project.version}
+
+
+ ch.qos.logback
+ logback-classic
+
+
+ commons-beanutils
+ commons-beanutils
+
+
+ org.apache.tomcat
+ tomcat-servlet-api
+ ${tomcat.version}
+ provided
+
+
+ junit
+ junit
+ test
+
+
+ net.sourceforge.htmlunit
+ htmlunit
+ 2.67.0
+ test
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ org.slf4j
+ jul-to-slf4j
+ ${slf4j.version}
+ test
+
+
+ com.google.guava
+ guava
+ 31.1-jre
+ test
+
+
+ org.apache.derby
+ derby
+
+
+
+
+
+
+ maven-failsafe-plugin
+
+
+
+ derby.stream.error.file
+ target/derby.log
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: jackrabbit-webapp-project
===================================================================
--- jackrabbit-webapp-project (nonexistent)
+++ jackrabbit-webapp-project (working copy)
Property changes on: jackrabbit-webapp-project
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-webapp-project/pom.xml
===================================================================
--- jackrabbit-webapp-project/pom.xml (nonexistent)
+++ jackrabbit-webapp-project/pom.xml (working copy)
@@ -0,0 +1,124 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-webapp-project
+ pom
+
+ ../jackrabbit-webapp
+ ../jackrabbit-webapp-jakarta
+
+
+ 8.5.86
+
+
+
+ javax.jcr
+ jcr
+ compile
+
+
+ org.apache.jackrabbit
+ jackrabbit-core
+ ${project.version}
+
+
+ org.apache.tika
+ tika-parsers-standard-package
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ org.apache.jackrabbit
+ jackrabbit-jcr-rmi
+ ${project.version}
+
+
+ ch.qos.logback
+ logback-classic
+
+
+ commons-beanutils
+ commons-beanutils
+
+
+ org.apache.tomcat
+ tomcat-servlet-api
+ ${tomcat.version}
+ provided
+
+
+ junit
+ junit
+ test
+
+
+ net.sourceforge.htmlunit
+ htmlunit
+ 2.67.0
+ test
+
+
+ commons-logging
+ commons-logging
+
+
+
+
+ org.slf4j
+ jul-to-slf4j
+ ${slf4j.version}
+ test
+
+
+ com.google.guava
+ guava
+ 31.1-jre
+ test
+
+
+ org.apache.derby
+ derby
+
+
+
+
+
+
+ maven-failsafe-plugin
+
+
+
+ derby.stream.error.file
+ target/derby.log
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: jackrabbit-webdav/pom.xml
===================================================================
--- jackrabbit-webdav/pom.xml (revision 1907912)
+++ jackrabbit-webdav/pom.xml (working copy)
@@ -25,9 +25,9 @@
org.apache.jackrabbit
- jackrabbit-parent
+ jackrabbit-webdav-project
2.21.16-SNAPSHOT
- ../jackrabbit-parent/pom.xml
+ ../jackrabbit-webdav-project
jackrabbit-webdav
bundle
@@ -56,43 +56,9 @@
- org.osgi
- org.osgi.annotation
- provided
-
-
- org.slf4j
- slf4j-api
-
-
javax.servlet
javax.servlet-api
provided
-
- org.apache.httpcomponents
- httpcore
- 4.4.16
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.14
-
-
- org.slf4j
- jcl-over-slf4j
-
-
-
- junit
- junit
- test
-
-
- ch.qos.logback
- logback-classic
- test
-
Index: jackrabbit-webdav-jakarta/pom.xml
===================================================================
--- jackrabbit-webdav-jakarta/pom.xml (nonexistent)
+++ jackrabbit-webdav-jakarta/pom.xml (working copy)
@@ -0,0 +1,100 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-webdav-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-webdav-jakarta
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 5.0.0
+ provided
+
+
+
\ No newline at end of file
Index: jackrabbit-webdav-jakarta
===================================================================
--- jackrabbit-webdav-jakarta (nonexistent)
+++ jackrabbit-webdav-jakarta (working copy)
Property changes on: jackrabbit-webdav-jakarta
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-webdav-jakarta/pom.xml
===================================================================
--- jackrabbit-webdav-jakarta/pom.xml (nonexistent)
+++ jackrabbit-webdav-jakarta/pom.xml (working copy)
@@ -0,0 +1,100 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-webdav-project
+ 2.21.16-SNAPSHOT
+
+ jackrabbit-webdav-jakarta
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ default-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav
+ ${project.version}
+
+
+
+
+
+
+
+
+
+ apache-release
+
+
+
+ org.eclipse.transformer
+ transformer-maven-plugin
+ 0.5.0
+ true
+
+
+ true
+
+
+
+
+ source-jar
+
+ jar
+
+
+
+ org.apache.jackrabbit
+ jackrabbit-webdav
+ ${project.version}
+ sources
+
+
+
+
+
+
+
+
+
+
+
+ jakarta.servlet
+ jakarta.servlet-api
+ 5.0.0
+ provided
+
+
+
\ No newline at end of file
Index: jackrabbit-webdav-project/pom.xml
===================================================================
--- jackrabbit-webdav-project/pom.xml (nonexistent)
+++ jackrabbit-webdav-project/pom.xml (working copy)
@@ -0,0 +1,73 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-webdav-project
+ pom
+ Jackrabbit JCR Servlet Project
+
+ ../jackrabbit-webdav
+ ../jackrabbit-webdav-jakarta
+
+
+
+ org.osgi
+ org.osgi.annotation
+ provided
+
+
+ org.slf4j
+ slf4j-api
+
+
+ javax.servlet
+ javax.servlet-api
+ provided
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.16
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.14
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ junit
+ junit
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+
\ No newline at end of file
Index: jackrabbit-webdav-project
===================================================================
--- jackrabbit-webdav-project (nonexistent)
+++ jackrabbit-webdav-project (working copy)
Property changes on: jackrabbit-webdav-project
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,5 ##
+.*
+target
+*.iml
+*.ipr
+*.iws
Index: jackrabbit-webdav-project/pom.xml
===================================================================
--- jackrabbit-webdav-project/pom.xml (nonexistent)
+++ jackrabbit-webdav-project/pom.xml (working copy)
@@ -0,0 +1,73 @@
+
+
+
+ 4.0.0
+
+ org.apache.jackrabbit
+ jackrabbit-parent
+ 2.21.16-SNAPSHOT
+ ../jackrabbit-parent/pom.xml
+
+ jackrabbit-webdav-project
+ pom
+ Jackrabbit JCR Servlet Project
+
+ ../jackrabbit-webdav
+ ../jackrabbit-webdav-jakarta
+
+
+
+ org.osgi
+ org.osgi.annotation
+ provided
+
+
+ org.slf4j
+ slf4j-api
+
+
+ javax.servlet
+ javax.servlet-api
+ provided
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.16
+
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.14
+
+
+ org.slf4j
+ jcl-over-slf4j
+
+
+ junit
+ junit
+ test
+
+
+ ch.qos.logback
+ logback-classic
+ test
+
+
+
\ No newline at end of file
Index: pom.xml
===================================================================
--- pom.xml (revision 1907912)
+++ pom.xml (working copy)
@@ -43,11 +43,11 @@
jackrabbit-aws-ext
jackrabbit-vfs-ext
jackrabbit-core
- jackrabbit-webdav
- jackrabbit-jcr-server
+ jackrabbit-webdav-project
+ jackrabbit-jcr-server-project
jackrabbit-jcr-rmi
- jackrabbit-jcr-servlet
- jackrabbit-webapp
+ jackrabbit-jcr-servlet-project
+ jackrabbit-webapp-project
jackrabbit-jca
jackrabbit-spi
jackrabbit-spi-commons