Skip to content

Commit 4d18501

Browse files
committed
Merge branch 'develop'
2 parents cebc9ec + 4723d3f commit 4d18501

File tree

13 files changed

+56
-29
lines changed

13 files changed

+56
-29
lines changed

.github/renovate.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"github>wcm-io/renovate-config:maven",
5+
"github>wcm-io/renovate-config:automerge-parent"
6+
],
7+
"ignoreDeps": [
8+
"com.day.commons:day-commons-gfx",
9+
"com.ibm.icu:icu4j"
10+
]
11+
}

changes.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@
2424
xsi:schemaLocation="http://maven.apache.org/changes/2.0.0 https://maven.apache.org/xsd/changes-2.0.0.xsd">
2525
<body>
2626

27+
<release version="5.6.10" date="2025-03-20">
28+
<action type="update" dev="sseifert" issue="40">
29+
MockAsset: Do not extend from ResourceWrapper to not rely on its adaptTo() implementation.
30+
</action>
31+
<action type="update" dev="sseifert">
32+
Update to latest Sling Mock.
33+
</action>
34+
</release>
35+
2736
<release version="5.6.8" date="2025-03-05">
2837
<action type="update" dev="sseifert" issue="54">
2938
MockAemBindingsValuesProvider: Avoid clash with org.apache.sling.scripting.core 2.4.10 by using a different service property name for passing the AemContext object.

core/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.testing.aem-mock.parent</artifactId>
28-
<version>5.6.8</version>
28+
<version>5.6.10</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

@@ -211,20 +211,20 @@
211211
<dependency>
212212
<groupId>com.twelvemonkeys.imageio</groupId>
213213
<artifactId>imageio-tiff</artifactId>
214-
<version>3.10.1</version>
214+
<version>3.12.0</version>
215215
<scope>test</scope>
216216
</dependency>
217217
<!-- Java ImageIO Support for SVG -->
218218
<dependency>
219219
<groupId>com.twelvemonkeys.imageio</groupId>
220220
<artifactId>imageio-batik</artifactId>
221-
<version>3.10.1</version>
221+
<version>3.12.0</version>
222222
<scope>test</scope>
223223
</dependency>
224224
<dependency>
225225
<groupId>org.apache.xmlgraphics</groupId>
226226
<artifactId>batik-transcoder</artifactId>
227-
<version>1.17</version>
227+
<version>1.18</version>
228228
<scope>test</scope>
229229
</dependency>
230230

@@ -291,7 +291,7 @@
291291
<dependency>
292292
<groupId>org.awaitility</groupId>
293293
<artifactId>awaitility</artifactId>
294-
<version>4.2.0</version>
294+
<version>4.3.0</version>
295295
<scope>test</scope>
296296
</dependency>
297297

core/src/main/java/io/wcm/testing/mock/aem/dam/MockAemDamAdapterFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private void activate(BundleContext context) {
7777
private @Nullable <AdapterType> AdapterType getAdapter(@NotNull final Resource resource, @NotNull final Class<AdapterType> type) {
7878
if (DamUtil.isAsset(resource)) {
7979
if (type == com.adobe.granite.asset.api.Asset.class) {
80-
return type.cast(new MockGraniteAssetWrapper(new MockAsset(resource, eventAdmin, bundleContext)));
80+
return type.cast(new MockGraniteAssetWrapper(new MockAsset(resource, eventAdmin, bundleContext), resource));
8181
}
8282
else if (type == Asset.class) {
8383
return type.cast(new MockAsset(resource, eventAdmin, bundleContext));

core/src/main/java/io/wcm/testing/mock/aem/dam/MockAsset.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
import org.apache.commons.collections4.IteratorUtils;
3333
import org.apache.commons.lang3.StringUtils;
3434
import org.apache.jackrabbit.api.security.user.User;
35+
import org.apache.sling.api.adapter.SlingAdaptable;
3536
import org.apache.sling.api.resource.PersistenceException;
3637
import org.apache.sling.api.resource.Resource;
3738
import org.apache.sling.api.resource.ResourceResolver;
3839
import org.apache.sling.api.resource.ResourceUtil;
39-
import org.apache.sling.api.resource.ResourceWrapper;
4040
import org.apache.sling.api.resource.ValueMap;
4141
import org.apache.sling.testing.mock.sling.loader.ContentLoader;
4242
import org.jetbrains.annotations.NotNull;
@@ -59,18 +59,17 @@
5959
"null",
6060
"java:S112" // allow throwing RuntimException
6161
})
62-
class MockAsset extends ResourceWrapper implements Asset {
62+
class MockAsset extends SlingAdaptable implements Asset {
6363

6464
private final ResourceResolver resourceResolver;
65-
private final Resource resource;
65+
protected final Resource resource;
6666
private final ValueMap contentProps;
6767
private final Resource renditionsResource;
6868
private final EventAdmin eventAdmin;
6969
private final BundleContext bundleContext;
7070
private boolean batchMode;
7171

7272
MockAsset(@NotNull Resource resource, EventAdmin eventAdmin, BundleContext bundleContext) {
73-
super(resource);
7473
this.resourceResolver = resource.getResourceResolver();
7574
this.resource = resource;
7675
Resource contentResource = resource.getChild(JcrConstants.JCR_CONTENT);
@@ -81,13 +80,13 @@ class MockAsset extends ResourceWrapper implements Asset {
8180
}
8281

8382
@Override
84-
public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
83+
public <AdapterType> AdapterType adaptTo(@NotNull Class<AdapterType> type) {
8584
if (type == Resource.class) {
8685
return type.cast(resource);
8786
}
8887
//to be able to adapt to granite asset
8988
if (type == com.adobe.granite.asset.api.Asset.class) {
90-
return type.cast(new MockGraniteAssetWrapper(this));
89+
return type.cast(new MockGraniteAssetWrapper(this, resource));
9190
}
9291
return super.adaptTo(type);
9392
}
@@ -103,6 +102,16 @@ public Object getMetadata(String name) {
103102
return getMetadata().get(name);
104103
}
105104

105+
@Override
106+
public String getPath() {
107+
return resource.getPath();
108+
}
109+
110+
@Override
111+
public String getName() {
112+
return resource.getName();
113+
}
114+
106115
@Override
107116
public String getMetadataValue(String name) {
108117
Object value = getMetadata(name);

core/src/main/java/io/wcm/testing/mock/aem/dam/MockGraniteAssetManagerWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public final class MockGraniteAssetManagerWrapper implements AssetManager {
4848
@Override
4949
public Asset createAsset(String s) {
5050
com.day.cq.dam.api.Asset asset = cqAssetManager.createAsset(s, null, null, false);
51-
return new MockGraniteAssetWrapper(asset);
51+
return new MockGraniteAssetWrapper(asset, ((MockAsset)asset).resource);
5252
}
5353

5454
@Override

core/src/main/java/io/wcm/testing/mock/aem/dam/MockGraniteAssetWrapper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public final class MockGraniteAssetWrapper extends ResourceWrapper implements As
4747
private final com.day.cq.dam.api.Asset asset;
4848

4949
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // adaption to Resource will always work
50-
MockGraniteAssetWrapper(com.day.cq.dam.api.Asset asset) {
51-
super(asset.adaptTo(Resource.class));
50+
MockGraniteAssetWrapper(com.day.cq.dam.api.Asset asset, Resource resource) {
51+
super(resource);
5252
this.asset = asset;
5353
}
5454

core/src/test/java/io/wcm/testing/mock/aem/dam/MockAssetTest.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,6 @@ public void testGraniteAdaptation() {
229229

230230
@Test
231231
public void testAdaptTo() {
232-
assertSame(asset, asset.adaptTo(Asset.class));
233232
assertSame(asset, asset.adaptTo(com.adobe.granite.asset.api.Asset.class).adaptTo(Asset.class));
234233
}
235-
236234
}

junit4/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.testing.aem-mock.parent</artifactId>
28-
<version>5.6.8</version>
28+
<version>5.6.10</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

@@ -54,7 +54,7 @@
5454
<dependency>
5555
<groupId>io.wcm</groupId>
5656
<artifactId>io.wcm.testing.aem-mock.core</artifactId>
57-
<version>5.6.8</version>
57+
<version>5.6.10</version>
5858
<scope>compile</scope>
5959
</dependency>
6060

@@ -87,7 +87,7 @@
8787
<dependency>
8888
<groupId>io.wcm</groupId>
8989
<artifactId>io.wcm.testing.aem-mock.core</artifactId>
90-
<version>5.6.8</version>
90+
<version>5.6.10</version>
9191
<classifier>tests</classifier>
9292
<scope>test</scope>
9393
</dependency>

junit5/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.testing.aem-mock.parent</artifactId>
28-
<version>5.6.8</version>
28+
<version>5.6.10</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

@@ -54,14 +54,14 @@
5454
<dependency>
5555
<groupId>io.wcm</groupId>
5656
<artifactId>io.wcm.testing.aem-mock.core</artifactId>
57-
<version>5.6.8</version>
57+
<version>5.6.10</version>
5858
<scope>compile</scope>
5959
</dependency>
6060

6161
<dependency>
6262
<groupId>io.wcm</groupId>
6363
<artifactId>io.wcm.testing.aem-mock.core</artifactId>
64-
<version>5.6.8</version>
64+
<version>5.6.10</version>
6565
<classifier>tests</classifier>
6666
<scope>test</scope>
6767
</dependency>

parent/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
<groupId>io.wcm</groupId>
3333
<artifactId>io.wcm.testing.aem-mock.parent</artifactId>
34-
<version>5.6.8</version>
34+
<version>5.6.10</version>
3535
<packaging>pom</packaging>
3636

3737
<name>AEM Mocks</name>
@@ -59,7 +59,7 @@
5959
<resourceresolver-mock.version>1.5.0</resourceresolver-mock.version>
6060

6161
<!-- Sling Mock -->
62-
<sling-mock.version>3.5.2</sling-mock.version>
62+
<sling-mock.version>3.5.4</sling-mock.version>
6363

6464
<!-- Servlet Helpers -->
6565
<servlet-helpers.version>1.4.6</servlet-helpers.version>
@@ -71,7 +71,7 @@
7171
<logging-logback.version>1.0.0</logging-logback.version>
7272

7373
<!-- Enable reproducible builds -->
74-
<project.build.outputTimestamp>2025-03-05T08:43:18Z</project.build.outputTimestamp>
74+
<project.build.outputTimestamp>2025-03-20T18:24:20Z</project.build.outputTimestamp>
7575

7676
</properties>
7777

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.testing.aem-mock.parent</artifactId>
28-
<version>5.6.8</version>
28+
<version>5.6.10</version>
2929
<relativePath>parent/pom.xml</relativePath>
3030
</parent>
3131

3232
<groupId>io.wcm</groupId>
3333
<artifactId>io.wcm.testing.aem-mock.root</artifactId>
3434
<packaging>pom</packaging>
35-
<version>5.6.8</version>
35+
<version>5.6.10</version>
3636

3737
<name>AEM Mocks</name>
3838
<url>${site.url}/${site.url.module.prefix}/</url>

relocate/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<parent>
2626
<groupId>io.wcm</groupId>
2727
<artifactId>io.wcm.testing.aem-mock.parent</artifactId>
28-
<version>5.6.8</version>
28+
<version>5.6.10</version>
2929
<relativePath>../parent/pom.xml</relativePath>
3030
</parent>
3131

0 commit comments

Comments
 (0)