diff --git a/bundle/pom.xml b/bundle/pom.xml index 636143b142..63aca3d5a9 100644 --- a/bundle/pom.xml +++ b/bundle/pom.xml @@ -306,6 +306,12 @@ jsr305 provided + + org.jetbrains + annotations + provided + + javax.annotation @@ -372,7 +378,7 @@ javax.mail - mail + javax.mail-api provided @@ -581,6 +587,12 @@ 1.7 test + + com.sun.mail + javax.mail + 1.6.2 + test + org.apache.sling @@ -609,12 +621,6 @@ jackrabbit-jcr-commons test - - jackrabbit-api - 2.16.3 - org.apache.jackrabbit - test - org.apache.commons commons-imaging @@ -679,6 +685,10 @@ org.apache.tika tika-core + + org.apache.jackrabbit + jackrabbit-api + @@ -732,7 +742,6 @@ com.adobe.aem uber-jar - apis provided diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java index fee9f8cfd5..8c7698bf3e 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockContentFragment.java @@ -26,6 +26,8 @@ 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; @@ -33,6 +35,7 @@ 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 @@ -156,5 +159,11 @@ public AdapterType adaptTo(@Nonnull Class aClass) { @Override public void removeVariation(String name) throws ContentFragmentException { } + + @NotNull + @Override + public Calendar getLastModifiedDeep() throws ContentFragmentException { + return Calendar.getInstance(); + } } diff --git a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockDataType.java b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockDataType.java index 035c78290d..82f2ccf1d1 100755 --- a/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockDataType.java +++ b/bundle/src/test/java/com/adobe/acs/commons/mcp/impl/processes/cfi/MockDataType.java @@ -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 { @@ -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; + } } diff --git a/bundle/src/test/java/com/adobe/acs/commons/remoteassets/impl/RemoteAssetDecoratorTest.java b/bundle/src/test/java/com/adobe/acs/commons/remoteassets/impl/RemoteAssetDecoratorTest.java index 9e3226449a..3d25f844b2 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/remoteassets/impl/RemoteAssetDecoratorTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/remoteassets/impl/RemoteAssetDecoratorTest.java @@ -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"; @@ -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 { @@ -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 { @@ -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) { @@ -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 @@ -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 diff --git a/bundle/src/test/java/com/adobe/acs/commons/workflow/impl/WorkflowPackageManagerImplTest.java b/bundle/src/test/java/com/adobe/acs/commons/workflow/impl/WorkflowPackageManagerImplTest.java index 68c9c326ac..775b3e27bf 100644 --- a/bundle/src/test/java/com/adobe/acs/commons/workflow/impl/WorkflowPackageManagerImplTest.java +++ b/bundle/src/test/java/com/adobe/acs/commons/workflow/impl/WorkflowPackageManagerImplTest.java @@ -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; + } }; } \ No newline at end of file diff --git a/oakpal-checks/pom.xml b/oakpal-checks/pom.xml index 29e4a3eafd..9ee24c10b9 100644 --- a/oakpal-checks/pom.xml +++ b/oakpal-checks/pom.xml @@ -177,7 +177,7 @@ - 6.4 + 6.5 ${pom.basedir}/src/main/script/ExtractBundleInfo.groovy @@ -194,51 +194,6 @@ - - webster-aem64 - - - - - net.adamcin.oakpal - oakpal-maven-plugin - - - - src/main/resources/OAKPAL-INF/checklist/content-class-aem64.json - - - - granite - http://www.adobe.com/jcr/granite/1.0 - - - - granite:PublicArea - granite:FinalArea - granite:InternalArea - granite:AbstractArea - - - - exclude - nt:file - - - exclude - nt:resource - - - - - - - - - - webster-aem65 + io.wcm.maven io.wcm.maven.aem-dependencies - 6.4.0.0004 + 6.5.10.0002 pom import @@ -515,7 +514,12 @@ Bundle-DocURL: https://adobe-consulting-services.github.io/acs-aem-commons/ com.day.cq cq-commons 5.8.32 - + + + + org.osgi + org.osgi.util.converter + 1.0.9 @@ -544,6 +548,12 @@ Bundle-DocURL: https://adobe-consulting-services.github.io/acs-aem-commons/ org.apache.felix.scr.annotations 1.12.0 + + + org.jetbrains + annotations + 23.0.0 + com.google.code.findbugs jsr305 @@ -553,7 +563,7 @@ Bundle-DocURL: https://adobe-consulting-services.github.io/acs-aem-commons/ biz.aQute.bnd biz.aQute.bnd.annotation - 3.4.0 + 6.1.0 @@ -604,7 +614,7 @@ Bundle-DocURL: https://adobe-consulting-services.github.io/acs-aem-commons/ org.mockito mockito-core - 3.2.0 + 4.11.0 test @@ -617,32 +627,32 @@ Bundle-DocURL: https://adobe-consulting-services.github.io/acs-aem-commons/ org.apache.sling org.apache.sling.testing.sling-mock-oak - 3.1.2-1.40.0 + 3.1.8-1.44.0 test org.apache.sling org.apache.sling.testing.osgi-mock.junit4 - 3.2.2 + 3.3.6 test org.apache.sling org.apache.sling.testing.osgi-mock.core - 3.2.2 + 3.3.6 test org.apache.sling org.apache.sling.testing.sling-mock.junit4 - 3.2.2 + 3.4.4 test io.wcm io.wcm.testing.aem-mock.junit4 - 4.1.8 + 5.1.2 test diff --git a/ui.apps/pom.xml b/ui.apps/pom.xml index a32ce34f33..537597844c 100644 --- a/ui.apps/pom.xml +++ b/ui.apps/pom.xml @@ -51,7 +51,12 @@ day/cq60/product cq-content - [6.3.64,) + [6.5.6,) + + + adobe/cq650/servicepack + aem-service-pkg + [6.5.10,) @@ -107,19 +112,6 @@ - - oakpal-scan-content-class-aem64 - - scan - - - ${project.build.directory}/oakpal-plugin/reports/content-class-aem64.json - - - content-class-aem64 - - - oakpal-verify @@ -127,8 +119,6 @@ - ${project.build.directory}/oakpal-plugin/reports/content-class-aem64.json - ${project.build.directory}/oakpal-plugin/reports/content-class-aem65.json @@ -214,7 +204,6 @@ com.adobe.aem uber-jar - apis provided diff --git a/ui.content/pom.xml b/ui.content/pom.xml index a7be54d955..49e0a0d4a7 100644 --- a/ui.content/pom.xml +++ b/ui.content/pom.xml @@ -134,19 +134,6 @@ - - oakpal-scan-content-class-aem64 - - scan - - - ${project.build.directory}/oakpal-plugin/reports/content-class-aem64.json - - - content-class-aem64 - - - oakpal-verify @@ -154,8 +141,6 @@ - ${project.build.directory}/oakpal-plugin/reports/content-class-aem64.json - ${project.build.directory}/oakpal-plugin/reports/content-class-aem65.json @@ -191,7 +176,6 @@ com.adobe.aem uber-jar - apis provided