This is an automated email from the ASF dual-hosted git repository. sseifert pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-testing.git
commit e111008701c2d76ee77f18a0512b92701076d2e0 Author: Stefan Seifert <[email protected]> AuthorDate: Thu Dec 18 10:42:35 2025 +0100 SLING-13036 Update to parent 64, update various dependencies and fix dependency scopes --- .sling-module.json | 6 +- pom.xml | 72 ++++++++++++++-------- .../sling/commons/testing/jcr/RepositoryUtil.java | 12 +++- .../testing/sling/MockResourceResolver.java | 71 +++++++++++++++++++++ .../testing/sling/MockSlingHttpServletRequest.java | 7 +++ 5 files changed, 138 insertions(+), 30 deletions(-) diff --git a/.sling-module.json b/.sling-module.json index 7f9d118..cfad4d2 100644 --- a/.sling-module.json +++ b/.sling-module.json @@ -1,7 +1,5 @@ { "jenkins": { - "jdks": [ - 11 - ] + "jdks": [17, 21] } -} +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 1c407a2..50135ec 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.sling</groupId> - <artifactId>sling</artifactId> + <artifactId>sling-bundle-parent</artifactId> <version>64</version> <relativePath /> </parent> @@ -45,8 +45,8 @@ <connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-testing.git</connection> <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-testing.git</developerConnection> <url>https://github.com/apache/sling-org-apache-sling-commons-testing.git</url> - <tag>HEAD</tag> - </scm> + <tag>HEAD</tag> + </scm> <dependencies> <dependency> @@ -56,17 +56,25 @@ </dependency> <dependency> <groupId>org.osgi</groupId> - <artifactId>osgi.core</artifactId> - <version>7.0.0</version> + <artifactId>org.osgi.framework</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.osgi</groupId> - <artifactId>osgi.cmpn</artifactId> - <version>7.0.0</version> + <artifactId>org.osgi.service.cm</artifactId> <scope>provided</scope> </dependency> - + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.service.component</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>javax.jcr</groupId> + <artifactId>jcr</artifactId> + <scope>provided</scope> + </dependency> + <!-- Dependencies required for testing and provided transitively to modules using this artifact @@ -74,19 +82,13 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.api</artifactId> - <version>2.4.2</version> + <version>2.25.4</version> <scope>compile</scope> </dependency> <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.jcr.api</artifactId> - <version>2.0.6</version> - <scope>compile</scope> - </dependency> - <dependency> - <groupId>javax.jcr</groupId> - <artifactId>jcr</artifactId> - <version>2.0</version> + <version>2.4.0</version> <scope>compile</scope> </dependency> <dependency> @@ -114,7 +116,7 @@ <dependency> <groupId>org.apache.sling</groupId> <artifactId>org.apache.sling.adapter</artifactId> - <version>2.0.4</version> + <version>2.2.0</version> <scope>compile</scope> </dependency> <dependency> @@ -141,25 +143,24 @@ </exclusions> </dependency> <dependency> - <groupId>org.apache.sling</groupId> - <artifactId>org.apache.sling.commons.johnzon</artifactId> - <version>2.0.0</version> - <scope>compile</scope> + <groupId>org.apache.sling</groupId> + <artifactId>org.apache.sling.commons.johnzon</artifactId> + <version>2.0.0</version> + <scope>compile</scope> </dependency> - <!-- Logging for tests --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> - <scope>compile</scope> + <scope>test</scope> </dependency> <!-- Basic Test Controller JUnit --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> - <scope>compile</scope> + <scope>provided</scope> </dependency> <!-- Provide for Test Mocks --> @@ -167,7 +168,28 @@ <groupId>org.jmock</groupId> <artifactId>jmock-junit4</artifactId> <version>2.12.0</version> - <scope>compile</scope> + <scope>test</scope> </dependency> + + <!-- Running jackrabbit tests --> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.17.1.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derbyshared</artifactId> + <version>10.17.1.0</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derbytools</artifactId> + <version>10.17.1.0</version> + <scope>test</scope> + </dependency> + </dependencies> </project> diff --git a/src/main/java/org/apache/sling/commons/testing/jcr/RepositoryUtil.java b/src/main/java/org/apache/sling/commons/testing/jcr/RepositoryUtil.java index 1981bfc..c289a14 100644 --- a/src/main/java/org/apache/sling/commons/testing/jcr/RepositoryUtil.java +++ b/src/main/java/org/apache/sling/commons/testing/jcr/RepositoryUtil.java @@ -134,7 +134,7 @@ public class RepositoryUtil { * with the node type manager available from the given <code>session</code>. * <p> * This method is not synchronized. It is up to the calling method to - * prevent paralell execution. + * prevent parallel execution. * * @param session The <code>Session</code> providing the node type manager * through which the node type is to be registered. @@ -226,5 +226,15 @@ public class RepositoryUtil { return wrapped.isStandardDescriptor(key); } + @Override + public Session loginService(String subServiceName, String workspace) throws LoginException, RepositoryException { + throw new UnsupportedOperationException(); + } + + @Override + public Session impersonateFromService(String subServiceName, Credentials credentials, String workspaceName) throws LoginException, RepositoryException { + throw new UnsupportedOperationException(); + } + } } diff --git a/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java b/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java index f0ba860..847412d 100644 --- a/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java +++ b/src/main/java/org/apache/sling/commons/testing/sling/MockResourceResolver.java @@ -30,6 +30,8 @@ import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * @deprecated Please use the Mock Resource Resolver Implementation from testing/resourceresolver-mock instead. @@ -43,33 +45,40 @@ public class MockResourceResolver implements ResourceResolver { private Map<String, Collection<Resource>> children = new LinkedHashMap<String, Collection<Resource>>(); + @Deprecated public void addResource(Resource resource) { this.resources.put(resource.getPath(), resource); } + @Deprecated public void addChildren(Resource parent, Collection<Resource> children) { this.children.put(parent.getPath(), children); } + @Deprecated public Resource resolve(HttpServletRequest request) { throw new UnsupportedOperationException("Not implemented"); } + @Deprecated public Resource resolve(String absPath) { throw new UnsupportedOperationException("Not implemented"); } + @Deprecated public String map(String resourcePath) { return resourcePath; // a rather simplistic 1:1 map... } + @Deprecated public Resource getResource(String path) { return resources.get(path); } + @Deprecated public Resource getResource(Resource base, String path) { if (!path.startsWith("/")) { path = base.getPath() + "/" + path; @@ -77,11 +86,13 @@ public class MockResourceResolver implements ResourceResolver { return getResource(path); } + @Deprecated public String[] getSearchPath() { return searchPath.clone(); } + @Deprecated public Iterator<Resource> listChildren(final Resource parent) { Collection<Resource> childCollection = children.get(parent.getPath()); if (childCollection != null) { @@ -127,22 +138,26 @@ public class MockResourceResolver implements ResourceResolver { }; } + @Deprecated public Iterator<Resource> findResources(String query, String language) { throw new UnsupportedOperationException("Not implemented"); } + @Deprecated public Iterator<Map<String, Object>> queryResources(String query, String language) { throw new UnsupportedOperationException("Not implemented"); } + @Deprecated public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) { throw new UnsupportedOperationException("Not implemented"); } + @Deprecated public void setSearchPath(String... searchPath) { if (searchPath == null) { this.searchPath = new String[0]; @@ -158,73 +173,129 @@ public class MockResourceResolver implements ResourceResolver { } } + @Deprecated public String map(HttpServletRequest request, String resourcePath) { return request.getContextPath() + resourcePath; } + @Deprecated public Resource resolve(HttpServletRequest request, String absPath) { throw new UnsupportedOperationException("Not implemented"); } + @Deprecated public void close() { // nothing to do } + @Deprecated public String getUserID() { return null; } + @Deprecated public boolean isLive() { return true; } + @Deprecated public ResourceResolver clone(Map<String, Object> authenticationInfo) throws LoginException { return null; } + @Deprecated public Object getAttribute(String name) { return null; } + @Deprecated public Iterator<String> getAttributeNames() { return null; } + @Deprecated public void commit() throws PersistenceException { } + @Deprecated public Resource create(Resource arg0, String arg1, Map<String, Object> arg2) throws PersistenceException { return null; } + @Deprecated public void delete(Resource arg0) throws PersistenceException { } + @Deprecated public Iterable<Resource> getChildren(Resource arg0) { return null; } + @Deprecated public String getParentResourceType(Resource arg0) { return null; } + @Deprecated public String getParentResourceType(String arg0) { return null; } + @Deprecated public boolean hasChanges() { return false; } + @Deprecated public boolean isResourceType(Resource arg0, String arg1) { return false; } + @Deprecated public void refresh() { } + @Deprecated public void revert() { } + + @Deprecated + @Override + public @Nullable Resource getParent(@NotNull Resource child) { + throw new UnsupportedOperationException(); + } + + @Deprecated + @Override + public boolean hasChildren(@NotNull Resource resource) { + throw new UnsupportedOperationException(); + } + + @Deprecated + @Override + public boolean orderBefore(@NotNull Resource parent, @NotNull String name, + @Nullable String followingSiblingName) + throws UnsupportedOperationException, PersistenceException, IllegalArgumentException { + throw new UnsupportedOperationException(); + } + + @Deprecated + @Override + public Resource copy(String srcAbsPath, String destAbsPath) throws PersistenceException { + throw new UnsupportedOperationException(); + } + + @Deprecated + @Override + public Resource move(String srcAbsPath, String destAbsPath) throws PersistenceException { + throw new UnsupportedOperationException(); + } + + @Deprecated + @Override + public @NotNull Map<String, Object> getPropertyMap() { + throw new UnsupportedOperationException(); + } } diff --git a/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java b/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java index 1524477..0e18172 100644 --- a/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java +++ b/src/main/java/org/apache/sling/commons/testing/sling/MockSlingHttpServletRequest.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.security.Principal; import java.util.Collection; import java.util.Enumeration; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.ResourceBundle; @@ -50,6 +51,7 @@ import org.apache.sling.api.request.RequestProgressTracker; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.api.resource.SyntheticResource; +import org.jetbrains.annotations.NotNull; /** * Mock request object. This does not do anything useful, it just returns the @@ -576,4 +578,9 @@ public class MockSlingHttpServletRequest implements SlingHttpServletRequest { // TODO Auto-generated method stub return null; } + + @Override + public @NotNull List<RequestParameter> getRequestParameterList() { + throw new UnsupportedOperationException(); + } }
