Skip to content

Commit

Permalink
Update AEM dependencies to 6.5.10 (#3081)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwin authored Jun 10, 2023
1 parent 3edec67 commit 3698e61
Show file tree
Hide file tree
Showing 12 changed files with 2,780 additions and 1,489 deletions.
25 changes: 17 additions & 8 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,12 @@
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<scope>provided</scope>
</dependency>

<!-- @PostConstruct -->
<dependency>
<groupId>javax.annotation</groupId>
Expand Down Expand Up @@ -372,7 +378,7 @@
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<artifactId>javax.mail-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- for com.adobe.acs.commons.logging.impl.SyslogAppender -->
Expand Down Expand Up @@ -581,6 +587,12 @@
<version>1.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
<!-- needed to override the embedded commons.osgi in org.apache.sling.models.impl -->
<dependency>
<groupId>org.apache.sling</groupId>
Expand Down Expand Up @@ -609,12 +621,6 @@
<artifactId>jackrabbit-jcr-commons</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>jackrabbit-api</artifactId>
<version>2.16.3</version>
<groupId>org.apache.jackrabbit</groupId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-imaging</artifactId>
Expand Down Expand Up @@ -679,6 +685,10 @@
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>jackrabbit-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -732,7 +742,6 @@
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<classifier>apis</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@
import com.adobe.cq.dam.cfm.VariationTemplate;
import com.adobe.cq.dam.cfm.VersionDef;
import com.adobe.cq.dam.cfm.VersionedContent;

import java.util.Calendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import org.apache.sling.api.resource.Resource;
import org.jetbrains.annotations.NotNull;

/**
* Incomplete mock that provides just enough for basic testing
Expand Down Expand Up @@ -156,5 +159,11 @@ public <AdapterType> AdapterType adaptTo(@Nonnull Class<AdapterType> aClass) {
@Override
public void removeVariation(String name) throws ContentFragmentException {
}

@NotNull
@Override
public Calendar getLastModifiedDeep() throws ContentFragmentException {
return Calendar.getInstance();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.adobe.cq.dam.cfm.DataType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class MockDataType implements DataType {

Expand All @@ -38,4 +39,14 @@ public String getTypeString() {
public boolean isMultiValue() {
return false;
}

@Override
public @Nullable String getSemanticType() {
return type;
}

@Override
public @NotNull String getValueType() {
return type;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,54 @@
*/
package com.adobe.acs.commons.remoteassets.impl;

import com.adobe.acs.commons.testutil.LogTester;
import com.adobe.acs.commons.util.RequireAem;
import com.day.cq.commons.jcr.JcrConstants;
import com.day.cq.dam.api.DamConstants;
import io.wcm.testing.mock.aem.junit.AemContext;
import static com.adobe.acs.commons.remoteassets.impl.RemoteAssets.IS_REMOTE_ASSET;
import static com.adobe.acs.commons.remoteassets.impl.RemoteAssetsTestUtil.TEST_RETRY_DELAY;
import static com.adobe.acs.commons.remoteassets.impl.RemoteAssetsTestUtil.TEST_WHITELISTED_SVC_USER_A;
import static com.adobe.acs.commons.remoteassets.impl.RemoteAssetsTestUtil.getRemoteAssetsConfigs;
import static com.adobe.acs.commons.remoteassets.impl.RemoteAssetsTestUtil.setupRemoteAssetsServiceUser;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;

import java.lang.reflect.Field;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.ValueFactory;

import org.apache.jackrabbit.api.security.user.User;
import org.apache.jackrabbit.api.security.user.UserManager;
import org.apache.sling.api.resource.ModifiableValueMap;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
import org.apache.sling.resourceresolver.impl.CommonResourceResolverFactoryImpl;
import org.apache.sling.resourceresolver.impl.ResourceResolverFactoryImpl;
import org.apache.sling.testing.mock.sling.ResourceResolverType;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;

import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.ValueFactory;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import com.adobe.acs.commons.testutil.LogTester;
import com.adobe.acs.commons.util.RequireAem;
import com.day.cq.commons.jcr.JcrConstants;
import com.day.cq.dam.api.DamConstants;

import static com.adobe.acs.commons.remoteassets.impl.RemoteAssets.IS_REMOTE_ASSET;
import static com.adobe.acs.commons.remoteassets.impl.RemoteAssetsTestUtil.*;
import static org.junit.Assert.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import io.wcm.testing.mock.aem.junit.AemContext;

public class RemoteAssetDecoratorTest {
private static String TEST_MOCK_SYNC = "mocksync";
Expand All @@ -58,6 +75,7 @@ public class RemoteAssetDecoratorTest {

@Rule
public final AemContext context = new AemContext(ResourceResolverType.JCR_MOCK);
private ResourceResolver userResourceResolver = null;

@Before
public void setup() throws Exception {
Expand All @@ -77,6 +95,22 @@ public void setup() throws Exception {

remoteAssetDecorator = spy(new RemoteAssetDecorator());
remoteAssetsBinarySync = mock(RemoteAssetsBinarySyncImpl.class);
// workaround for https://issues.apache.org/jira/browse/SLING-11885 to bind the resource decorator
ResourceResolverFactory rrFactory = context.getService(ResourceResolverFactory.class);
if (rrFactory instanceof ResourceResolverFactoryImpl) {
// use reflection to get CommonResourceResolverFactoryImpl
Field crrFactoryField = ResourceResolverFactoryImpl.class.getDeclaredField("commonFactory");
crrFactoryField.setAccessible(true);
CommonResourceResolverFactoryImpl commonFactory = (CommonResourceResolverFactoryImpl) crrFactoryField.get(rrFactory);
commonFactory.getResourceDecoratorTracker().bindResourceDecorator(remoteAssetDecorator, Collections.emptyMap());
}
}

@After
public void tearDown() {
if (userResourceResolver != null) {
userResourceResolver.close();
}
}

private void setupCreateRemoteAsset(Node nodeDam, String damFolder, boolean isRemoteAsset) throws RepositoryException {
Expand Down Expand Up @@ -108,12 +142,14 @@ public Boolean answer(InvocationOnMock invocationOnMock) throws Throwable {
context.registerInjectActivateService(new RemoteAssetsConfigImpl(), getRemoteAssetsConfigs());
context.registerInjectActivateService(remoteAssetsBinarySync);
context.registerInjectActivateService(remoteAssetDecorator);

LogTester.reset();
}

private ResourceResolver getUserResourceResolver() {
return getUserResourceResolver("testuser", false);
if (userResourceResolver == null) {
userResourceResolver = getUserResourceResolver("testuser", false);
}
return userResourceResolver;
}

private ResourceResolver getUserResourceResolver(String username, boolean isServiceUser) {
Expand Down Expand Up @@ -160,8 +196,9 @@ public void testGetResourceSyncsRemoteAsset() {
@Test
public void testGetResourceSyncsAssetIfUserIsWhitelistedServiceUser() {
setupFinish();
ResourceResolver serviceResourceResolver = getUserResourceResolver(TEST_WHITELISTED_SVC_USER_A, true);
assertResourceSyncs(serviceResourceResolver, TEST_REMOTE_ASSET_CONTENT_PATH);
try (ResourceResolver serviceResourceResolver = getUserResourceResolver(TEST_WHITELISTED_SVC_USER_A, true)) {
assertResourceSyncs(serviceResourceResolver, TEST_REMOTE_ASSET_CONTENT_PATH);
}
}

@Test
Expand Down Expand Up @@ -208,9 +245,10 @@ public void testGetResourceDoesNotSyncAssetIfUserIsAdminUser() {
@Test
public void testGetResourceDoesNotSyncAssetIfUserIsServiceUser() {
setupFinish();
ResourceResolver serviceResourceResolver = getUserResourceResolver("serviceuser", true);
assertResourceDoesNotSync(serviceResourceResolver, TEST_REMOTE_ASSET_CONTENT_PATH);
LogTester.assertLogText("Avoiding binary sync b/c this is a non-whitelisted service user: serviceuser");
try (ResourceResolver serviceResourceResolver = getUserResourceResolver("serviceuser", true)) {
assertResourceDoesNotSync(serviceResourceResolver, TEST_REMOTE_ASSET_CONTENT_PATH);
LogTester.assertLogText("Avoiding binary sync b/c this is a non-whitelisted service user: serviceuser");
}
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,10 @@ public void stopRecording(final String s) {
public String getPath() {
return WORKFLOW_PACKAGE_PATH;
}

@Override
public boolean hasNode(String arg0) {
return false;
}
};
}
48 changes: 1 addition & 47 deletions oakpal-checks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
</goals>
<configuration>
<defaults>
<aemVersion>6.4</aemVersion>
<aemVersion>6.5</aemVersion>
</defaults>
<source>${pom.basedir}/src/main/script/ExtractBundleInfo.groovy</source>
</configuration>
Expand All @@ -194,51 +194,6 @@
</plugins>
</build>
</profile>
<profile>
<id>webster-aem64</id>
<!-- to be able to execute oakpal:webster with this profile, first create a profile with the same name in
your settings.xml file that sets a "webster.repositoryHome" property with an absolute path to the
crx-quickstart/repository directory of a locally-installed AEM 6.4 server. -->
<build>
<plugins>
<plugin>
<groupId>net.adamcin.oakpal</groupId>
<artifactId>oakpal-maven-plugin</artifactId>
<configuration>
<websterTargets>
<checklist>
<file>src/main/resources/OAKPAL-INF/checklist/content-class-aem64.json</file>
<config>
<jcrNamespaces>
<namespace>
<prefix>granite</prefix>
<uri>http://www.adobe.com/jcr/granite/1.0</uri>
</namespace>
</jcrNamespaces>
<selectNodeTypes>
<type>granite:PublicArea</type>
<type>granite:FinalArea</type>
<type>granite:InternalArea</type>
<type>granite:AbstractArea</type>
</selectNodeTypes>
<nodeTypeFilters>
<filter>
<type>exclude</type>
<pattern>nt:file</pattern>
</filter>
<filter>
<type>exclude</type>
<pattern>nt:resource</pattern>
</filter>
</nodeTypeFilters>
</config>
</checklist>
</websterTargets>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>webster-aem65</id>
<!-- to be able to execute oakpal:webster with this profile, first create a profile with the same name in
Expand Down Expand Up @@ -294,7 +249,6 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>18.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand Down
Loading

0 comments on commit 3698e61

Please sign in to comment.