You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2025/02/24 19:12:18 UTC
(sling-org-apache-sling-jcr-repoinit) branch feature/parent-62 created (now 8723b75)
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a change to branch feature/parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git
at 8723b75 SLING-12670 apply spotless formatting
This branch includes the following new commits:
new 94c8e0b SLING-12670 Update to parent 62
new 8723b75 SLING-12670 apply spotless formatting
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(sling-org-apache-sling-jcr-repoinit) 01/02: SLING-12670 Update to parent 62
Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch feature/parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git
commit 94c8e0b8fa138797ddfb34ee4172cdb9d9db988d
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Mon Feb 24 20:08:12 2025 +0100
SLING-12670 Update to parent 62
---
.sling-module.json | 8 ++++----
pom.xml | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/.sling-module.json b/.sling-module.json
index 329bc9d..cfad4d2 100644
--- a/.sling-module.json
+++ b/.sling-module.json
@@ -1,5 +1,5 @@
{
- "jenkins": {
- "operatingSystems": ["windows", "linux"]
- }
-}
+ "jenkins": {
+ "jdks": [17, 21]
+ }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5e0b831..fe8649e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>52</version>
+ <version>62</version>
<relativePath />
</parent>
@@ -43,6 +43,7 @@
<pax.vm.options>-Xmx512M</pax.vm.options>
<junit-jupiter.version>5.10.0</junit-jupiter.version>
<sling.java.version>8</sling.java.version>
+ <project.build.outputTimestamp>2025-02-24T00:00:00Z</project.build.outputTimestamp>
</properties>
<scm>
(sling-org-apache-sling-jcr-repoinit) 02/02: SLING-12670 apply spotless formatting
Posted by ss...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sseifert pushed a commit to branch feature/parent-62
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git
commit 8723b75270317fb68ec1bc7ac31647a74d7e2eda
Author: Stefan Seifert <st...@users.noreply.github.com>
AuthorDate: Mon Feb 24 20:12:07 2025 +0100
SLING-12670 apply spotless formatting
---
pom.xml | 168 ++++++++++-----------
.../apache/sling/jcr/repoinit/impl/AclUtil.java | 45 ++++--
.../apache/sling/jcr/repoinit/impl/AclVisitor.java | 2 +-
.../sling/jcr/repoinit/impl/SessionContext.java | 29 ++--
.../sling/jcr/repoinit/PrincipalBasedAclTest.java | 2 +-
.../sling/jcr/repoinit/impl/AclUtilTest.java | 34 ++---
.../sling/jcr/repoinit/it/RepoInitTestSupport.java | 67 +++++---
7 files changed, 191 insertions(+), 156 deletions(-)
diff --git a/pom.xml b/pom.xml
index fe8649e..7abac4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -18,85 +18,38 @@
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.sling</groupId>
- <artifactId>sling-bundle-parent</artifactId>
- <version>62</version>
- <relativePath />
- </parent>
+ <parent>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>sling-bundle-parent</artifactId>
+ <version>62</version>
+ <relativePath />
+ </parent>
- <artifactId>org.apache.sling.jcr.repoinit</artifactId>
- <version>1.1.53-SNAPSHOT</version>
- <name>Apache Sling Repoinit JCR</name>
- <description>
- Initializes a JCR repository based on the output
- of the RepoInit Language parser.
- </description>
+ <artifactId>org.apache.sling.jcr.repoinit</artifactId>
+ <version>1.1.53-SNAPSHOT</version>
+ <name>Apache Sling Repoinit JCR</name>
+ <description>Initializes a JCR repository based on the output
+ of the RepoInit Language parser.</description>
- <properties>
- <jackrabbit.version>2.18.2</jackrabbit.version>
- <oak.version>1.44.0</oak.version>
- <org.ops4j.pax.exam.version>4.13.3</org.ops4j.pax.exam.version>
- <!-- To debug the pax process, override this with -D -->
- <pax.vm.options>-Xmx512M</pax.vm.options>
- <junit-jupiter.version>5.10.0</junit-jupiter.version>
- <sling.java.version>8</sling.java.version>
- <project.build.outputTimestamp>2025-02-24T00:00:00Z</project.build.outputTimestamp>
- </properties>
+ <scm>
+ <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git</connection>
+ <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git</developerConnection>
+ <tag>org.apache.sling.jcr.repoinit-1.1.24</tag>
+ <url>https://github.com/apache/sling-org-apache-sling-jcr-repoinit.git</url>
+ </scm>
- <scm>
- <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git</connection>
- <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-jcr-repoinit.git</developerConnection>
- <url>https://github.com/apache/sling-org-apache-sling-jcr-repoinit.git</url>
- <tag>org.apache.sling.jcr.repoinit-1.1.24</tag>
- </scm>
-
- <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>
- <excludePackageNames>
- org.apache.sling.jcr.repoinit.impl
- </excludePackageNames>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-failsafe-plugin</artifactId>
- <executions>
- <execution>
- <id>integration-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>integration-test</goal>
- </goals>
- </execution>
- <execution>
- <id>verify</id>
- <phase>integration-test</phase>
- <goals>
- <goal>verify</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <redirectTestOutputToFile>true</redirectTestOutputToFile>
- <systemPropertyVariables>
- <bundle.filename>${basedir}/target/${project.build.finalName}.jar</bundle.filename>
- <pax.vm.options>${pax.vm.options}</pax.vm.options>
- </systemPropertyVariables>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <properties>
+ <jackrabbit.version>2.18.2</jackrabbit.version>
+ <oak.version>1.44.0</oak.version>
+ <org.ops4j.pax.exam.version>4.13.3</org.ops4j.pax.exam.version>
+ <!-- To debug the pax process, override this with -D -->
+ <pax.vm.options>-Xmx512M</pax.vm.options>
+ <junit-jupiter.version>5.10.0</junit-jupiter.version>
+ <sling.java.version>8</sling.java.version>
+ <project.build.outputTimestamp>2025-02-24T00:00:00Z</project.build.outputTimestamp>
+ </properties>
<dependencies>
<dependency>
@@ -146,14 +99,16 @@
<artifactId>org.apache.sling.testing.sling-mock.junit4</artifactId>
<version>3.5.2</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.jackrabbit</groupId><artifactId>oak-jcr</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.jackrabbit</groupId><artifactId>oak-jackrabbit-api</artifactId>
- </exclusion>
- </exclusions>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-jcr</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>oak-jackrabbit-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
@@ -254,8 +209,8 @@
<dependency>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>oak-core</artifactId>
- <classifier>tests</classifier>
<version>${oak.version}</version>
+ <classifier>tests</classifier>
<scope>provided</scope>
</dependency>
<dependency>
@@ -318,4 +273,47 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <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>
+ <excludePackageNames>org.apache.sling.jcr.repoinit.impl</excludePackageNames>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>true</redirectTestOutputToFile>
+ <systemPropertyVariables>
+ <bundle.filename>${basedir}/target/${project.build.finalName}.jar</bundle.filename>
+ <pax.vm.options>${pax.vm.options}</pax.vm.options>
+ </systemPropertyVariables>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ <phase>integration-test</phase>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ <phase>integration-test</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
index 215032a..6278ce0 100644
--- a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclUtil.java
@@ -132,7 +132,11 @@ public class AclUtil {
}
public static void setAcl(
- SessionContext context, List<String> principals, List<String> paths, List<String> privileges, boolean isAllow)
+ SessionContext context,
+ List<String> principals,
+ List<String> paths,
+ List<String> privileges,
+ boolean isAllow)
throws RepositoryException {
setAcl(context, principals, paths, privileges, isAllow, Collections.emptyList(), Collections.emptyList());
}
@@ -168,7 +172,7 @@ public class AclUtil {
AccessControlManager acMgr = context.getAccessControlManager();
final String[] privArray = privileges.toArray(new String[0]);
-
+
JackrabbitAccessControlList acl = getAccessControlList(acMgr, jcrPath, true);
checkState(acl != null, "No JackrabbitAccessControlList available for path {0}", jcrPath);
@@ -335,8 +339,8 @@ public class AclUtil {
if (!principalNames.contains(principal.getName())) {
continue;
}
- LocalAccessControlEntry entry =
- new LocalAccessControlEntry(context, ace.getPrincipal(), privileges.toArray(new String[0]), isAllow, restr);
+ LocalAccessControlEntry entry = new LocalAccessControlEntry(
+ context, ace.getPrincipal(), privileges.toArray(new String[0]), isAllow, restr);
if (entry.isEqual(ace)) {
acl.removeAccessControlEntry(ace);
modified = true;
@@ -394,7 +398,8 @@ public class AclUtil {
modified = true;
}
} else if (action == AclLine.Action.ALLOW) {
- final String[] privilegeNames = line.getProperty(PROP_PRIVILEGES).toArray(new String[0]);
+ final String[] privilegeNames =
+ line.getProperty(PROP_PRIVILEGES).toArray(new String[0]);
for (String effectivePath : jcrPaths) {
if (acl == null) {
// no PrincipalAccessControlList available: don't fail if an equivalent path-based entry with
@@ -414,7 +419,8 @@ public class AclUtil {
createLocalRestrictions(line.getRestrictions(), acl, context.getSession());
final boolean added = acl.addEntry(
effectivePath,
- context.privilegeCollectionFromNames(privilegeNames).getPrivileges(),
+ context.privilegeCollectionFromNames(privilegeNames)
+ .getPrivileges(),
restrictions.getRestrictions(),
restrictions.getMVRestrictions());
if (!added) {
@@ -436,7 +442,8 @@ public class AclUtil {
}
}
- public static void removePrincipalEntries(@NotNull SessionContext context, String principalName, Collection<AclLine> lines)
+ public static void removePrincipalEntries(
+ @NotNull SessionContext context, String principalName, Collection<AclLine> lines)
throws RepositoryException {
final JackrabbitAccessControlManager acMgr = context.getAccessControlManager();
Principal principal = context.getPrincipalWithSave(principalName);
@@ -452,8 +459,12 @@ public class AclUtil {
if (!jcrPaths.contains(entry.getEffectivePath())) {
return false;
}
- LocalAccessControlEntry lace = new LocalAccessControlEntry(context,
- entry.getPrincipal(), privNames.toArray(new String[0]), line.getAction() == AclLine.Action.ALLOW, restr);
+ LocalAccessControlEntry lace = new LocalAccessControlEntry(
+ context,
+ entry.getPrincipal(),
+ privNames.toArray(new String[0]),
+ line.getAction() == AclLine.Action.ALLOW,
+ restr);
return lace.isEqual(entry);
};
if (removePrincipalEntries(acl, principalName, predicate)) {
@@ -505,7 +516,7 @@ public class AclUtil {
*
* @param acMgr the access control manager
* @param path
- * @param includeApplicable
+ * @param includeApplicable
* @return the first available {@link PrincipalAccessControlList} bound to the given principal or {@code null} of <a href="https://jackrabbit.apache.org/oak/docs/security/authorization/principalbased.html">principal-based authorization</a> is not enabled for the given principal
* @throws RepositoryException
*/
@@ -621,9 +632,10 @@ public class AclUtil {
}
for (AccessControlPolicy policy : context.getAccessControlManager().getPolicies(absPath)) {
if (policy instanceof JackrabbitAccessControlList) {
- LocalRestrictions lr =
- createLocalRestrictions(restrictionList, ((JackrabbitAccessControlList) policy), context.getSession());
- LocalAccessControlEntry newEntry = new LocalAccessControlEntry(context, principal, privilegeNames, isAllow, lr);
+ LocalRestrictions lr = createLocalRestrictions(
+ restrictionList, ((JackrabbitAccessControlList) policy), context.getSession());
+ LocalAccessControlEntry newEntry =
+ new LocalAccessControlEntry(context, principal, privilegeNames, isAllow, lr);
if (contains(((JackrabbitAccessControlList) policy).getAccessControlEntries(), newEntry)) {
LOG.info(
"Equivalent path-based entry exists for principal {} and effective path {} ",
@@ -695,7 +707,7 @@ public class AclUtil {
private final boolean isAllow;
private final LocalRestrictions restrictions;
private final SessionContext context;
-
+
private PrivilegeCollection privilegeCollection;
LocalAccessControlEntry(SessionContext context, Principal principal, String[] privilegeNames, boolean isAllow) {
@@ -764,11 +776,12 @@ public class AclUtil {
return false;
}
- private static boolean contains(PrivilegeCollection collection, String[] privilegeNames) throws RepositoryException {
+ private static boolean contains(PrivilegeCollection collection, String[] privilegeNames)
+ throws RepositoryException {
// we need to ensure that the privilege order is not taken into account, so we use sets
return collection.includes(privilegeNames);
}
-
+
private @NotNull PrivilegeCollection getPrivilegeCollection() throws RepositoryException {
if (privilegeCollection == null) {
privilegeCollection = context.privilegeCollectionFromNames(privilegeNames);
diff --git a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
index a1d1acb..b5ee74d 100644
--- a/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/AclVisitor.java
@@ -68,7 +68,7 @@ class AclVisitor extends DoNothingVisitor {
* @param s must have sufficient rights to create users
* and set ACLs.
*/
- public AclVisitor(Session s) {
+ public AclVisitor(Session s) {
super(s);
context = new SessionContext(s);
}
diff --git a/src/main/java/org/apache/sling/jcr/repoinit/impl/SessionContext.java b/src/main/java/org/apache/sling/jcr/repoinit/impl/SessionContext.java
index 805beda..7c2c764 100644
--- a/src/main/java/org/apache/sling/jcr/repoinit/impl/SessionContext.java
+++ b/src/main/java/org/apache/sling/jcr/repoinit/impl/SessionContext.java
@@ -18,33 +18,35 @@
*/
package org.apache.sling.jcr.repoinit.impl;
-import org.apache.jackrabbit.api.JackrabbitSession;
-import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
-import org.apache.jackrabbit.api.security.authorization.PrivilegeCollection;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
import javax.jcr.RepositoryException;
import javax.jcr.Session;
+
import java.security.Principal;
import java.util.HashMap;
import java.util.Map;
+import org.apache.jackrabbit.api.JackrabbitSession;
+import org.apache.jackrabbit.api.security.JackrabbitAccessControlManager;
+import org.apache.jackrabbit.api.security.authorization.PrivilegeCollection;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
/**
- * A simple wrapper around a session, which can cache the principal lookup and resolves privilege names to
+ * A simple wrapper around a session, which can cache the principal lookup and resolves privilege names to
* {@code PrivilegeCollection} objects.
*/
public class SessionContext {
JackrabbitSession session;
JackrabbitAccessControlManager acMgr;
- Map<String,Principal> nameToPrincipal = new HashMap<>();
+ Map<String, Principal> nameToPrincipal = new HashMap<>();
public SessionContext(@NotNull Session session) {
- AclUtil.checkState(session instanceof JackrabbitSession,"A Jackrabbit Session is required");
+ AclUtil.checkState(session instanceof JackrabbitSession, "A Jackrabbit Session is required");
this.session = (JackrabbitSession) session;
try {
- AclUtil.checkState(session.getAccessControlManager() instanceof JackrabbitAccessControlManager,
+ AclUtil.checkState(
+ session.getAccessControlManager() instanceof JackrabbitAccessControlManager,
"A Jackrabbit AccessControlManager is required");
this.acMgr = (JackrabbitAccessControlManager) session.getAccessControlManager();
} catch (RepositoryException e) {
@@ -60,11 +62,12 @@ public class SessionContext {
return acMgr;
}
- public @NotNull PrivilegeCollection privilegeCollectionFromNames(@NotNull String... privilegeNames) throws RepositoryException {
+ public @NotNull PrivilegeCollection privilegeCollectionFromNames(@NotNull String... privilegeNames)
+ throws RepositoryException {
return acMgr.privilegeCollectionFromNames(privilegeNames);
}
- public @Nullable Principal getPrincipal (@NotNull String principalName) throws RepositoryException {
+ public @Nullable Principal getPrincipal(@NotNull String principalName) throws RepositoryException {
if (nameToPrincipal.containsKey(principalName)) {
return nameToPrincipal.get(principalName);
}
@@ -75,7 +78,7 @@ public class SessionContext {
}
return p;
}
-
+
public @Nullable Principal getPrincipalWithSave(@NotNull String principalName) throws RepositoryException {
Principal principal = getPrincipal(principalName);
if (principal == null) {
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java b/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
index 694f32e..ac00b3f 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/PrincipalBasedAclTest.java
@@ -57,8 +57,8 @@ import org.apache.jackrabbit.oak.spi.security.principal.SystemUserPrincipal;
import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
import org.apache.sling.jcr.repoinit.impl.AclUtil;
-import org.apache.sling.jcr.repoinit.impl.SessionContext;
import org.apache.sling.jcr.repoinit.impl.RepoInitException;
+import org.apache.sling.jcr.repoinit.impl.SessionContext;
import org.apache.sling.jcr.repoinit.impl.TestUtil;
import org.apache.sling.repoinit.parser.RepoInitParsingException;
import org.apache.sling.repoinit.parser.operations.AclLine;
diff --git a/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java b/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java
index 4efc51b..58ace9b 100644
--- a/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java
+++ b/src/test/java/org/apache/sling/jcr/repoinit/impl/AclUtilTest.java
@@ -18,6 +18,19 @@
*/
package org.apache.sling.jcr.repoinit.impl;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.ValueFactory;
+import javax.jcr.security.Privilege;
+
+import java.security.Principal;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
import org.apache.jackrabbit.api.JackrabbitSession;
import org.apache.jackrabbit.api.security.JackrabbitAccessControlList;
import org.apache.jackrabbit.api.security.user.Group;
@@ -37,18 +50,6 @@ import org.junit.Test;
import org.junit.function.ThrowingRunnable;
import org.junit.jupiter.api.Assertions;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.Value;
-import javax.jcr.ValueFactory;
-import javax.jcr.security.Privilege;
-import java.security.Principal;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
@@ -485,8 +486,7 @@ public class AclUtilTest {
/**
* @param groupId the id of the group to create
*/
- protected void assertSetAclWithHomePath(String groupId)
- throws RepositoryException{
+ protected void assertSetAclWithHomePath(String groupId) throws RepositoryException {
UserManager uMgr = ((JackrabbitSession) U.adminSession).getUserManager();
Group gr = uMgr.createGroup(groupId);
@@ -601,8 +601,8 @@ public class AclUtilTest {
boolean isAllow,
boolean contained)
throws RepositoryException {
- AclUtil.LocalAccessControlEntry localAce =
- new AclUtil.LocalAccessControlEntry(toPCSessionWrapper(U.adminSession),principal(username), privilegeNames, isAllow);
+ AclUtil.LocalAccessControlEntry localAce = new AclUtil.LocalAccessControlEntry(
+ toPCSessionWrapper(U.adminSession), principal(username), privilegeNames, isAllow);
if (contained) {
assertTrue(
@@ -618,7 +618,7 @@ public class AclUtilTest {
return AccessControlUtils.getPrincipal(U.adminSession, principalName);
}
- private static SessionContext toPCSessionWrapper (Session session) {
+ private static SessionContext toPCSessionWrapper(Session session) {
return new SessionContext(session);
}
}
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 5214bc8..538ee82 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
@@ -22,6 +22,9 @@ import javax.inject.Inject;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
+import java.util.Collection;
+import java.util.HashSet;
+
import org.apache.sling.jcr.api.SlingRepository;
import org.apache.sling.testing.paxexam.SlingOptions;
import org.apache.sling.testing.paxexam.TestSupport;
@@ -41,13 +44,10 @@ 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.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.vmOption;
import static org.ops4j.pax.exam.cm.ConfigurationAdminOptions.newConfiguration;
-import java.util.Collection;
-import java.util.HashSet;
-
public abstract class RepoInitTestSupport extends TestSupport {
protected Session session;
@@ -59,14 +59,33 @@ public abstract class RepoInitTestSupport extends TestSupport {
private static final String JR_GID = "org.apache.jackrabbit";
// artifact ID of all relevant oak bundles
- private static final String[] OAK_BUNDLES = new String[] {"oak-api","oak-blob",
- "oak-blob-plugins","oak-commons","oak-core","oak-core-spi","oak-jcr",
- "oak-lucene","oak-query-spi","oak-security-spi","oak-segment-tar","oak-store-composite",
- "oak-store-document","oak-store-spi", "oak-jackrabbit-api"};
+ private static final String[] OAK_BUNDLES = new String[] {
+ "oak-api",
+ "oak-blob",
+ "oak-blob-plugins",
+ "oak-commons",
+ "oak-core",
+ "oak-core-spi",
+ "oak-jcr",
+ "oak-lucene",
+ "oak-query-spi",
+ "oak-security-spi",
+ "oak-segment-tar",
+ "oak-store-composite",
+ "oak-store-document",
+ "oak-store-spi",
+ "oak-jackrabbit-api"
+ };
private static final String TARGET_OAK_VERSION = "1.44.0";
- private static final String[] JACKRABBIT_2x_BUNDLES = new String[] {"jackrabbit-data","jackrabbit-jcr-commons",
- "jackrabbit-jcr-rmi","jackrabbit-spi-commons","jackrabbit-spi","jackrabbit-webdav"};
+ private static final String[] JACKRABBIT_2x_BUNDLES = new String[] {
+ "jackrabbit-data",
+ "jackrabbit-jcr-commons",
+ "jackrabbit-jcr-rmi",
+ "jackrabbit-spi-commons",
+ "jackrabbit-spi",
+ "jackrabbit-webdav"
+ };
private static final String TARGET_JACKRABBIT_VERSION = "2.22.0";
@Inject
@@ -88,12 +107,12 @@ public abstract class RepoInitTestSupport extends TestSupport {
junitBundles(),
SlingOptions.logback(),
systemProperty("logback.configurationFile")
- .value("file:" + PathUtils.getBaseDir() + "/src/test/resources/logback-it.xml"),
+ .value("file:" + PathUtils.getBaseDir() + "/src/test/resources/logback-it.xml"),
awaitility(),
testBundle("bundle.filename"),
newConfiguration("org.apache.sling.jcr.base.internal.LoginAdminWhitelist")
- .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
- .asOption(),
+ .put("whitelist.bundles.regexp", "^PAXEXAM.*$")
+ .asOption(),
mavenBundle()
.groupId("org.apache.sling")
.artifactId("org.apache.sling.repoinit.parser")
@@ -102,8 +121,7 @@ public abstract class RepoInitTestSupport extends TestSupport {
.groupId("org.apache.sling")
.artifactId("org.apache.sling.commons.threads")
.versionAsInProject(),
- bundlesForNewerRepository()
- )
+ bundlesForNewerRepository())
.add(additionalOptions())
.remove(nonExistingJackrabbitBundles)
.remove(mavenBundle()
@@ -126,7 +144,7 @@ public abstract class RepoInitTestSupport extends TestSupport {
*/
private static Collection<Option> updateRepositoryBundleVersions() {
SlingOptions.versionResolver.setVersion("org.apache.sling", "org.apache.sling.jcr.oak.server", "1.2.10");
- for (int i=0;i< OAK_BUNDLES.length;i++) {
+ for (int i = 0; i < OAK_BUNDLES.length; i++) {
try {
SlingOptions.versionResolver.setVersionFromProject(JR_GID, OAK_BUNDLES[i]);
} catch (IllegalArgumentException e) {
@@ -135,11 +153,12 @@ public abstract class RepoInitTestSupport extends TestSupport {
}
}
Collection<Option> nonExistingBundles = new HashSet<>();
- for (int i=0;i< JACKRABBIT_2x_BUNDLES.length;i++) {
+ for (int i = 0; i < JACKRABBIT_2x_BUNDLES.length; i++) {
Option existingBundle = null;
try {
- String artifactId=JACKRABBIT_2x_BUNDLES[i];
- existingBundle = mavenBundle().groupId(JR_GID).artifactId(artifactId).versionAsInProject();
+ String artifactId = JACKRABBIT_2x_BUNDLES[i];
+ existingBundle =
+ mavenBundle().groupId(JR_GID).artifactId(artifactId).versionAsInProject();
SlingOptions.versionResolver.setVersion(JR_GID, artifactId, TARGET_JACKRABBIT_VERSION);
} catch (IllegalArgumentException e) {
nonExistingBundles.add(existingBundle);
@@ -156,13 +175,15 @@ public abstract class RepoInitTestSupport extends TestSupport {
return composite(
mavenBundle().groupId(JR_GID).artifactId("oak-jackrabbit-api").version(SlingOptions.versionResolver),
mavenBundle().groupId(JR_GID).artifactId("oak-store-spi").version(SlingOptions.versionResolver),
- mavenBundle().groupId("commons-codec").artifactId("commons-codec").version("1.14"),
+ mavenBundle()
+ .groupId("commons-codec")
+ .artifactId("commons-codec")
+ .version("1.14"),
mavenBundle().groupId("commons-io").artifactId("commons-io").version("2.11.0"),
mavenBundle().groupId("org.apache.tika").artifactId("tika-core").version("1.24.1"),
- mavenBundle().groupId(JR_GID).artifactId("jackrabbit-api").version(versionResolver)
- );
+ mavenBundle().groupId(JR_GID).artifactId("jackrabbit-api").version(versionResolver));
}
-
+
protected Option[] additionalOptions() {
return new Option[] {};
}