diff --git a/.cloudmanager/java-version b/.cloudmanager/java-version new file mode 100644 index 0000000..9d60796 --- /dev/null +++ b/.cloudmanager/java-version @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git a/build-deploy-author-and-publish.sh b/build-deploy-author-and-publish.sh new file mode 100644 index 0000000..2bb9f01 --- /dev/null +++ b/build-deploy-author-and-publish.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# #%L +# wcm.io +# %% +# Copyright (C) 2021 wcm.io +# %% +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# #L% + +# Builds the application, deploys it to local author, and then deploys it to local publish as well (without building it again) +# Deployment to author and publish runs in parallel + +# Display a pause message (only when the script was executed via double-click on windows) +pause_message() { + if [ "$DISPLAY_PAUSE_MESSAGE_WRAPPER" = true ]; then + echo "" + read -n1 -r -p "Press any key to continue..." + fi +} + +if [[ $0 == *":\\"* ]]; then + DISPLAY_PAUSE_MESSAGE_WRAPPER=true +fi + +# Build application +./build-deploy.sh build --maven.profiles=fast "$@" +if [ "$?" -ne "0" ]; then + pause_message + exit $? +fi + +# Deploy to author (in parallel) +./build-deploy.sh deploy --maven.profiles=fast --conga.node=aem-author "$@" & + +# Deploy to publish (in parallel) +./build-deploy.sh deploy --maven.profiles=fast,publish --conga.node=aem-publish "$@" & + +wait +pause_message diff --git a/build-deploy-author-and-publish_aem65.sh b/build-deploy-author-and-publish_aem65.sh new file mode 100644 index 0000000..3cbcfa9 --- /dev/null +++ b/build-deploy-author-and-publish_aem65.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# #%L +# wcm.io +# %% +# Copyright (C) 2022 wcm.io +# %% +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# #L% + +# Builds the application, deploys it to local author, and then deploys it to local publish as well (without building it again) +# Deployment to author and publish runs in parallel + +# Display a pause message (only when the script was executed via double-click on windows) +pause_message() { + if [ "$DISPLAY_PAUSE_MESSAGE_WRAPPER" = true ]; then + echo "" + read -n1 -r -p "Press any key to continue..." + fi +} + +if [[ $0 == *":\\"* ]]; then + DISPLAY_PAUSE_MESSAGE_WRAPPER=true +fi + +# Build application +./build-deploy.sh build --maven.profiles=fast,aem65 --conga.environment=local-aem65 "$@" +if [ "$?" -ne "0" ]; then + pause_message + exit $? +fi + +# Deploy to author (in parallel) +./build-deploy.sh deploy --maven.profiles=fast,aem65 --conga.node=aem-author --conga.environment=local-aem65 "$@" & + +# Deploy to publish (in parallel) +./build-deploy.sh deploy --maven.profiles=fast,publish,aem65 --conga.node=aem-publish --conga.environment=local-aem65 "$@" & + +wait +pause_message diff --git a/build-deploy-defaultpersistence.sh b/build-deploy-defaultpersistence.sh deleted file mode 100644 index 4e5be45..0000000 --- a/build-deploy-defaultpersistence.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# #%L -# wcm.io -# %% -# Copyright (C) 2017 wcm.io -# %% -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# #L% - -# Call with "help" parameter to display syntax information - -SLING_URL="http://localhost:4502" -CONGA_NODE="aem-author-default-persistence-strategy" - -if [[ $0 == *":\\"* ]]; then - DISPLAY_PAUSE_MESSAGE=true -fi - -./build-deploy.sh --sling.url=${SLING_URL} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" diff --git a/build-deploy-publish.sh b/build-deploy-publish.sh index 87089e5..30d36c1 100644 --- a/build-deploy-publish.sh +++ b/build-deploy-publish.sh @@ -2,7 +2,7 @@ # #%L # wcm.io # %% -# Copyright (C) 2017 wcm.io +# Copyright (C) 2017 - 2021 wcm.io # %% # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,11 +19,11 @@ # Call with "help" parameter to display syntax information -SLING_URL="http://localhost:4503" -CONGA_NODE="aem-publish-aempage-persistence-strategy" +MAVEN_PROFILES="fast,publish" +CONGA_NODE="aem-publish" if [[ $0 == *":\\"* ]]; then DISPLAY_PAUSE_MESSAGE=true fi -./build-deploy.sh --sling.url=${SLING_URL} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" +./build-deploy.sh --maven.profiles=${MAVEN_PROFILES} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" diff --git a/build-deploy-defaultpersistence-publish.sh b/build-deploy-publish_aem65.sh similarity index 70% rename from build-deploy-defaultpersistence-publish.sh rename to build-deploy-publish_aem65.sh index fb3aff5..c701ea0 100644 --- a/build-deploy-defaultpersistence-publish.sh +++ b/build-deploy-publish_aem65.sh @@ -2,7 +2,7 @@ # #%L # wcm.io # %% -# Copyright (C) 2017 wcm.io +# Copyright (C) 2022 wcm.io # %% # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,11 +19,12 @@ # Call with "help" parameter to display syntax information -SLING_URL="http://localhost:4503" -CONGA_NODE="aem-publish-default-persistence-strategy" +MAVEN_PROFILES="fast,publish,aem65" +CONGA_NODE="aem-publish" +CONGA_ENVIRONMENT="local-aem65" if [[ $0 == *":\\"* ]]; then DISPLAY_PAUSE_MESSAGE=true fi -./build-deploy.sh --sling.url=${SLING_URL} --conga.node=${CONGA_NODE} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" +./build-deploy.sh --maven.profiles=${MAVEN_PROFILES} --conga.node=${CONGA_NODE} --conga.environment=${CONGA_ENVIRONMENT} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" diff --git a/build-deploy.sh b/build-deploy.sh index c00a808..537ebe5 100644 --- a/build-deploy.sh +++ b/build-deploy.sh @@ -2,7 +2,7 @@ # #%L # wcm.io # %% -# Copyright (C) 2017 wcm.io +# Copyright (C) 2017 - 2022 wcm.io # %% # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,11 +20,12 @@ # Call with "help" parameter to display syntax information # defaults -SLING_URL="http://localhost:4502" -SLING_USER="admin" -SLING_PASSWORD="admin" -CONGA_ENVIRONMENT="development" -CONGA_NODE="aem-author-aempage-persistence-strategy" +MAVEN_PROFILES="fast" +SLING_URL="" +SLING_USER="" +SLING_PASSWORD="" +CONGA_ENVIRONMENT="local" +CONGA_NODE="aem-author" JVM_ARGS="" # display pause message only when script was executed via double-click on windows @@ -36,19 +37,18 @@ DEPLOY=false HELP=false DEFAULT_COMMANDS=true -#### - help_message_exit() { echo "" echo " Syntax " echo "" echo " Parameters:" - echo " --sling.url=${SLING_URL}" - echo " --sling.user=${SLING_USER}" - echo " --sling.password=${SLING_PASSWORD}" - echo " --conga.environment=${CONGA_ENVIRONMENT}" - echo " --conga.node=${CONGA_NODE}" - echo " --jvm.args=${JVM_ARGS}" + echo " --maven.profiles=${MAVEN_PROFILES} or -P${MAVEN_PROFILES}" + echo " --sling.url=${SLING_URL} or -Dsling.url=${SLING_URL}" + echo " --sling.user=${SLING_USER} or -Dsling.user=${SLING_USER}" + echo " --sling.password=${SLING_PASSWORD} or -Dsling.password=${SLING_PASSWORD}" + echo " --conga.environment=${CONGA_ENVIRONMENT} or -Dconga.environment=${CONGA_ENVIRONMENT}" + echo " --conga.node=${CONGA_NODE} or -Dconga.node=${CONGA_NODE}" + echo " --jvm.args=${JVM_ARGS} or -Djvm.args=${JVM_ARGS}" echo "" echo " Commands:" echo " build - Clean and install maven project" @@ -64,6 +64,10 @@ parse_parameters() { for i in "$@" do case $i in + --maven\.profiles=*|-P*) + MAVEN_PROFILES="${i#*=}" + shift # past argument=value + ;; --sling\.url=*|-Dsling\.url=*) SLING_URL="${i#*=}" shift # past argument=value @@ -119,74 +123,95 @@ parse_parameters() { } welcome_message() { - echo -e "********************************************************************\e[96m" + echo "********************************************************************" if ([ "$BUILD" = true ] && [ "$DEPLOY" = true ]) || [ "$HELP" = true ]; then - echo " ___ _ _ ___ _ ___ _ ___ ___ ___ _ _____ __" - echo " | _ ) | | |_ _| | | \ _| |_ | \| __| _ \ | / _ \ \ / /" - echo " | _ \ |_| || || |__| |) | |_ _| | |) | _|| _/ |_| (_) \ V /" - echo " |___/\___/|___|____|___/ |_| |___/|___|_| |____\___/ |_|" + echo -e "\e[96m ___ _ _ ___ _ ___ _ ___ ___ ___ _ _____ __\e[0m" + echo -e "\e[96m | _ ) | | |_ _| | | \ _| |_ | \| __| _ \ | / _ \ \ / /\e[0m" + echo -e "\e[96m | _ \ |_| || || |__| |) | |_ _| | |) | _|| _/ |_| (_) \ V /\e[0m" + echo -e "\e[96m |___/\___/|___|____|___/ |_| |___/|___|_| |____\___/ |_|\e[0m" elif [ "$BUILD" = true ]; then - echo " ___ _ _ ___ _ ___ " - echo " | _ ) | | |_ _| | | \\" - echo " | _ \ |_| || || |__| |) |" - echo " |___/\___/|___|____|___/" + echo -e "\e[96m ___ _ _ ___ _ ___ \e[0m" + echo -e "\e[96m | _ ) | | |_ _| | | \\ \e[0m" + echo -e "\e[96m | _ \ |_| || || |__| |) |\e[0m" + echo -e "\e[96m |___/\___/|___|____|___/\e[0m" elif [ "$DEPLOY" = true ]; then - echo " ___ ___ ___ _ _____ __" - echo " | \| __| _ \ | / _ \ \ / /" - echo " | |) | _|| _/ |_| (_) \ V /" - echo " |___/|___|_| |____\___/ |_|" + echo -e "\e[96m ___ ___ ___ _ _____ __\e[0m" + echo -e "\e[96m | \| __| _ \ | / _ \ \ / /\e[0m" + echo -e "\e[96m | |) | _|| _/ |_| (_) \ V /\e[0m" + echo -e "\e[96m |___/|___|_| |____\___/ |_|\e[0m" fi - echo -e "\e[0m" - echo -e " Destination: \e[1m${SLING_URL}\e[0m (\e[1m${CONGA_NODE}\e[0m)" + echo "" + echo -e " Destination: \e[1m${CONGA_NODE}\e[0m (${MAVEN_PROFILES})" echo "" echo "********************************************************************" } completion_message() { + ELAPSED_TIME=$(($SECONDS - $START_TIME)) + TOTAL_TIME="($(($ELAPSED_TIME/60)):$(printf "%02d" $(($ELAPSED_TIME%60))) min)" + echo "" if [ "$BUILD" = true ] && [ "$DEPLOY" = true ]; then - echo -e "*** \e[1mBuild+Deploy complete\e[0m ***" + echo -e "*** \e[1mBuild+Deploy complete\e[0m $TOTAL_TIME ***" elif [ "$BUILD" = true ]; then - echo -e "*** \e[1mBuild complete\e[0m ***" + echo -e "*** \e[1mBuild complete\e[0m $TOTAL_TIME ***" elif [ "$DEPLOY" = true ]; then - echo -e "*** \e[1mDeploy complete\e[0m ***" + echo -e "*** \e[1mDeploy complete\e[0m $TOTAL_TIME ***" fi echo "" pause_message } -#### - execute_build() { echo "" echo -e "*** \e[1mBuild application\e[0m ***" echo "" - mvn ${JVM_ARGS} \ - -Dconga.environments=${CONGA_ENVIRONMENT} \ - -Pfast clean install eclipse:eclipse + MAVEN_ARGS="" + if [ -n "$JVM_ARGS" ]; then + MAVEN_ARGS+="${JVM_ARGS} " + fi + if [ -n "${MAVEN_PROFILES}" ]; then + MAVEN_ARGS+="--activate-profiles ${MAVEN_PROFILES} " + fi + if [ -n "${CONGA_ENVIRONMENT}" ]; then + MAVEN_ARGS+="-Dconga.environments=${CONGA_ENVIRONMENT} " + fi + + mvn $MAVEN_ARGS clean install eclipse:eclipse if [ "$?" -ne "0" ]; then exit_with_error "*** BUILD FAILED ***" fi } -#### - execute_deploy() { echo "" echo -e "*** \e[1mDeploy to AEM\e[0m ***" echo "" - mvn -f config-definition \ - ${JVM_ARGS} \ - -Dconga.environments=${CONGA_ENVIRONMENT} \ - -Dconga.nodeDirectory=target/configuration/${CONGA_ENVIRONMENT}/${CONGA_NODE} \ - -Dsling.url=${SLING_URL} \ - -Dsling.user=${SLING_USER} \ - -Dsling.password=${SLING_PASSWORD} \ - conga-aem:package-install + MAVEN_ARGS="" + if [ -n "$JVM_ARGS" ]; then + MAVEN_ARGS+="${JVM_ARGS} " + fi + if [ -n "${MAVEN_PROFILES}" ]; then + MAVEN_ARGS+="--activate-profiles=${MAVEN_PROFILES} " + fi + if [ -n "${CONGA_ENVIRONMENT}" ]; then + MAVEN_ARGS+="-Dvault.file=target/${CONGA_ENVIRONMENT}.all.zip -Dvault.force=true" + fi + if [ -n "${SLING_URL}" ]; then + MAVEN_ARGS+="-Dsling.url=${SLING_URL} " + fi + if [ -n "${SLING_USER}" ]; then + MAVEN_ARGS+="-Dsling.user=${SLING_USER} " + fi + if [ -n "${SLING_PASSWORD}" ]; then + MAVEN_ARGS+="-Dsling.password=${SLING_PASSWORD} " + fi + + mvn $MAVEN_ARGS -f config-definition wcmio-content-package:install if [ "$?" -ne "0" ]; then exit_with_error "*** DEPLOY FAILED ***" @@ -194,8 +219,6 @@ execute_deploy() { } -#### - # Display a pause message (only when the script was executed via double-click on windows) pause_message() { if [ "$DISPLAY_PAUSE_MESSAGE" = true ]; then @@ -212,7 +235,8 @@ exit_with_error() { exit 1 } -#### + +START_TIME=$SECONDS parse_parameters "$@" welcome_message diff --git a/build-deploy_aem65.sh b/build-deploy_aem65.sh index 3842e94..3baa21b 100644 --- a/build-deploy_aem65.sh +++ b/build-deploy_aem65.sh @@ -2,7 +2,7 @@ # #%L # wcm.io # %% -# Copyright (C) 2021 wcm.io +# Copyright (C) 2022 wcm.io # %% # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,15 +17,11 @@ # limitations under the License. # #L% - -SLING_URL="http://localhost:45025" +MAVEN_PROFILES="fast,aem65" +CONGA_ENVIRONMENT="local-aem65" if [[ $0 == *":\\"* ]]; then DISPLAY_PAUSE_MESSAGE=true fi -if [ "$?" -ne "0" ]; then - exit -fi - -./build-deploy.sh --sling.url=${SLING_URL} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" +./build-deploy.sh --maven.profiles=${MAVEN_PROFILES} --conga.environment=${CONGA_ENVIRONMENT} --display.pause.message=${DISPLAY_PAUSE_MESSAGE} "$@" diff --git a/bundles/core/pom.xml b/bundles/core/pom.xml index 937844e..1461cf1 100644 --- a/bundles/core/pom.xml +++ b/bundles/core/pom.xml @@ -119,6 +119,7 @@ Import-Package: \ io.wcm.sling.commons.caservice;resolution:=optional,\ + org.apache.sling.models.caconfig.annotations;resolution:=optional,\ * diff --git a/bundles/core/src/test/java/io/wcm/caconfig/sample/impl/SampleConfigurationCategoryProviderTest.java b/bundles/core/src/test/java/io/wcm/caconfig/sample/impl/SampleConfigurationCategoryProviderTest.java new file mode 100644 index 0000000..00849ff --- /dev/null +++ b/bundles/core/src/test/java/io/wcm/caconfig/sample/impl/SampleConfigurationCategoryProviderTest.java @@ -0,0 +1,62 @@ +/* + * #%L + * wcm.io + * %% + * Copyright (C) 2024 wcm.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package io.wcm.caconfig.sample.impl; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; + +import java.util.Collections; + +import org.apache.sling.caconfig.spi.metadata.ConfigurationMetadata; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import io.wcm.caconfig.editor.ConfigurationCategory; +import io.wcm.testing.mock.aem.junit5.AemContext; +import io.wcm.testing.mock.aem.junit5.AemContextExtension; + +@ExtendWith(AemContextExtension.class) +class SampleConfigurationCategoryProviderTest { + + private final AemContext context = new AemContext(); + + private SampleConfigurationCategoryProvider underTest; + + @BeforeEach + void setUp() { + underTest = context.registerInjectActivateService(SampleConfigurationCategoryProvider.class); + } + + @Test + void testGetCategoryMetadata() { + ConfigurationCategory category = underTest.getCategoryMetadata("test"); + assertNotNull(category); + assertEquals("test", category.getCategory()); + assertEquals("Test", category.getLabel()); + } + + @Test + void testGetCategory() { + ConfigurationMetadata metadata = new ConfigurationMetadata("test", Collections.emptyList(), false); + assertEquals("default", underTest.getCategory(metadata)); + } + +} diff --git a/bundles/core/src/test/java/io/wcm/caconfig/sample/impl/SampleDropdownOptionProviderTest.java b/bundles/core/src/test/java/io/wcm/caconfig/sample/impl/SampleDropdownOptionProviderTest.java new file mode 100644 index 0000000..51649f6 --- /dev/null +++ b/bundles/core/src/test/java/io/wcm/caconfig/sample/impl/SampleDropdownOptionProviderTest.java @@ -0,0 +1,51 @@ +/* + * #%L + * wcm.io + * %% + * Copyright (C) 2024 wcm.io + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ +package io.wcm.caconfig.sample.impl; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; + +import com.day.cq.wcm.api.Page; + +import io.wcm.testing.mock.aem.junit5.AemContext; +import io.wcm.testing.mock.aem.junit5.AemContextExtension; + +@ExtendWith(AemContextExtension.class) +class SampleDropdownOptionProviderTest { + + private final AemContext context = new AemContext(); + + private SampleDropdownOptionProvider underTest; + + @BeforeEach + void setUp() { + underTest = context.registerInjectActivateService(SampleDropdownOptionProvider.class); + } + + @Test + void testGetDropdownOptions() { + Page page = context.create().page("/content/sample"); + assertEquals(underTest.getDropdownOptions(page.getContentResource()).size(), 3); + } + +} diff --git a/bundles/core/src/test/java/io/wcm/caconfig/sample/model/ConfigSampleNestedModelTest.java b/bundles/core/src/test/java/io/wcm/caconfig/sample/model/ConfigSampleNestedModelTest.java index bd58ac2..a8e6d78 100644 --- a/bundles/core/src/test/java/io/wcm/caconfig/sample/model/ConfigSampleNestedModelTest.java +++ b/bundles/core/src/test/java/io/wcm/caconfig/sample/model/ConfigSampleNestedModelTest.java @@ -66,6 +66,10 @@ void testContentComponent() { ConfigSampleNestedModel model = context.request().adaptTo(ConfigSampleNestedModel.class); assertNotNull(model); assertEquals("value1", model.getConfig().stringParam()); + + assertNotNull(model.getSub()); + assertNotNull(model.getSub2()); + assertNotNull(model.getSub2List()); } @Test diff --git a/config-definition/pom.xml b/config-definition/pom.xml index 9e79790..67f5fa0 100644 --- a/config-definition/pom.xml +++ b/config-definition/pom.xml @@ -50,9 +50,8 @@ io.wcm.samples - io.wcm.caconfig.sample-app.complete + io.wcm.caconfig.sample-app.core 1.0.0-SNAPSHOT - zip compile @@ -77,6 +76,50 @@ compile + + + org.apache.sling + org.apache.sling.caconfig.api + compile + + + org.apache.sling + org.apache.sling.caconfig.spi + compile + + + org.apache.sling + org.apache.sling.caconfig.impl + compile + + + org.apache.sling + org.apache.sling.models.caconfig + compile + + + + + io.wcm + io.wcm.caconfig.editor + compile + + + io.wcm + io.wcm.caconfig.extensions + compile + + + io.wcm + io.wcm.wcm.ui.granite + compile + + + io.wcm + io.wcm.sling.commons + compile + + @@ -88,37 +131,71 @@ conga-maven-plugin - + - dev-environment-config + environment-config generate-resources generate + + + + + + + io.wcm.devops.conga.plugins + conga-aem-maven-plugin + + + + + cloudmanager-all-package + generate-resources + + cloudmanager-all-package + - ${basedir}/src/main/dev-environments - - ${config.environment} - + wcm-io-samples + ELIMINATE_DUPLICATES + + + cloudmanager-dispatcher-config + generate-resources + + cloudmanager-dispatcher-config + + + - - io.wcm.devops.maven.plugins - eclipse-maven-plugin - - true - + com.adobe.aem + aemanalyser-maven-plugin + + + aem-analyser + + project-analyse + + + + + ${project.build.directory}/cloud.all.zip + + + + - + - org.apache.maven.plugins - maven-deploy-plugin + io.wcm.devops.maven.plugins + eclipse-maven-plugin true @@ -127,4 +204,20 @@ + + + + + fast + + false + + + true + true + + + + + diff --git a/config-definition/src/main/dev-environments/development.yaml b/config-definition/src/main/dev-environments/development.yaml deleted file mode 100644 index 0687f42..0000000 --- a/config-definition/src/main/dev-environments/development.yaml +++ /dev/null @@ -1,51 +0,0 @@ -# AEM configuration for local development environment - -nodes: - -- node: aem-author-default-persistence-strategy - roles: - - role: sample-aem-cms - variants: - - aem-author - - default-persistence-strategy - config: - replication.author.publishTargets: - - name: publish - url: http://localhost:4503 - transportUser: admin - # Has should be encrypted with the correct key, see http://www.wemblog.com/2012/03/how-to-use-crypto-support-in-cq55.html - transportPassword: admin - -- node: aem-publish-default-persistence-strategy - roles: - - role: sample-aem-cms - variants: - - aem-publish - - default-persistence-strategy - - -# --- Separate roles for AEM 6.3 including wcm.io CAConfig Extension AEM Page Persistence Strategy --- -- node: aem-author-aempage-persistence-strategy - roles: - - role: sample-aem-cms - variants: - - aem-author - - aempage-persistence-strategy - config: - replication.author.publishTargets: - - name: publish - url: http://localhost:4503 - transportUser: admin - # Has should be encrypted with the correct key, see http://www.wemblog.com/2012/03/how-to-use-crypto-support-in-cq55.html - transportPassword: admin - -- node: aem-publish-aempage-persistence-strategy - roles: - - role: sample-aem-cms - variants: - - aem-publish - - aempage-persistence-strategy - -config: - contentPackage.group: wcm-io-samples - app.sampleContent: true diff --git a/config-definition/src/main/environments/cloud.yaml b/config-definition/src/main/environments/cloud.yaml new file mode 100644 index 0000000..662d9b0 --- /dev/null +++ b/config-definition/src/main/environments/cloud.yaml @@ -0,0 +1,62 @@ +# AEM configuration for AEM Cloud Service (DEV/STAGE/PROD) + +nodes: + +- node: aem-author + roles: + - role: sample-aem-cms + variant: aem-author + +- node: aem-publish + roles: + - role: sample-aem-cms + variant: aem-publish + +- node: aem-dispatcher + roles: + - role: aem-dispatcher-cloud + variant: aem-publish + +config: + contentPackage.group: wcm-io-samples + + aem: + # Disable user tracking in author environment + disableAuthorUsageStatisticsCollection: false + + app: + # Default log level for application code + logLevel: info + logLevelCaConfig: trace + # Whether to use AEM Page persistence strategy + caconfigAemPagePersistence: true + # Whether to deploy latest Sling Models API/SPI/Models bundles + slingCaconfigLatest: false + # Whether to deploy bundle org.apache.sling.models.caconfig (not part of AEM out-of-the-box) + slingModelsCaconfig: true + + httpd: + headers: + # Set default expiration time for text/html responses (also affects dispatcher caching/invalidation) + htmlExpirationTimeSec: 5 + + # Replication configuration not required for AEM cloud service + replication: + author.generatePackage: false + publish.generatePackage: false + + +tenants: +- tenant: wcm-io-samples + config: + httpd: + # Simplified server name setup that can be deployed to any host name using "*" as server alias + serverName: publish + serverAliasNames: + - "*" + # Alternative: Use this setup to configure individual hostnames for dev/stage/prod in the cloud + #cloudManagerConditional: + # dev.serverName: publish-XXX.adobeaemcloud.com + # stage.serverName: publish-XXX.adobeaemcloud.com + # prod.serverName: publish-XXX.adobeaemcloud.com + rootRedirect.url: /content/contextaware-config-sample/en.html diff --git a/config-definition/src/main/environments/local-aem65.yaml b/config-definition/src/main/environments/local-aem65.yaml new file mode 100644 index 0000000..65cb3ee --- /dev/null +++ b/config-definition/src/main/environments/local-aem65.yaml @@ -0,0 +1,48 @@ +# AEM configuration for local development environment + +nodes: + +- node: aem-author + roles: + - role: sample-aem-cms + variant: aem-author + config: + replication.author.publishTargets: + - name: publish + url: ${maven::sling.publish.url} + transportUser: admin + transportPassword: admin + +- node: aem-publish + roles: + - role: sample-aem-cms + variant: aem-publish + + +config: + contentPackage.group: wcm-io-samples + + aem: + # Disable user tracking in author environment + disableAuthorUsageStatisticsCollection: true + + app: + # Default log level for application code + logLevel: info + logLevelCaConfig: trace + # Whether to use AEM Page persistence strategy + caconfigAemPagePersistence: true + # Whether to deploy latest Sling Models API/SPI/Models bundles + slingCaconfigLatest: true + # Whether to deploy bundle org.apache.sling.models.caconfig (not part of AEM out-of-the-box) + slingModelsCaconfig: true + # AEM 6.5 deployment + aem65: true + + quickstart: + # Enable Apache Sling DavEx Servlet to be able to use CRXDE Lite + enableDavEx: true + + # Not used for AEM cloud + cloudManager.target: + - none diff --git a/config-definition/src/main/environments/local.yaml b/config-definition/src/main/environments/local.yaml new file mode 100644 index 0000000..cd878f1 --- /dev/null +++ b/config-definition/src/main/environments/local.yaml @@ -0,0 +1,46 @@ +# AEM configuration for local development environment + +nodes: + +- node: aem-author + roles: + - role: sample-aem-cms + variant: aem-author + config: + replication.author.publishTargets: + - name: publish + url: ${maven::sling.publish.url} + transportUser: admin + transportPassword: admin + +- node: aem-publish + roles: + - role: sample-aem-cms + variant: aem-publish + + +config: + contentPackage.group: wcm-io-samples + + aem: + # Disable user tracking in author environment + disableAuthorUsageStatisticsCollection: true + + app: + # Default log level for application code + logLevel: info + logLevelCaConfig: trace + # Whether to use AEM Page persistence strategy + caconfigAemPagePersistence: true + # Whether to deploy latest Sling Models API/SPI/Models bundles + slingCaconfigLatest: false + # Whether to deploy bundle org.apache.sling.models.caconfig (not part of AEM out-of-the-box) + slingModelsCaconfig: true + + quickstart: + # Enable Apache Sling DavEx Servlet to be able to use CRXDE Lite + enableDavEx: true + + # Not used for AEM cloud + cloudManager.target: + - none diff --git a/config-definition/src/main/roles/sample-aem-cms.yaml b/config-definition/src/main/roles/sample-aem-cms.yaml index 5115805..028b6d1 100644 --- a/config-definition/src/main/roles/sample-aem-cms.yaml +++ b/config-definition/src/main/roles/sample-aem-cms.yaml @@ -7,21 +7,15 @@ inherits: variants: - variant: aem-author - variant: aem-publish -- variant: default-persistence-strategy - config: - app.caconfigAemPagePersistence: false -- variant: aempage-persistence-strategy - config: - app.caconfigAemPagePersistence: true templateDir: sample-aem-cms files: # AEM OSGi System Configuration -- file: sample-aem-cms-config.provisioning +- file: sample-aem-cms-config.osgiconfig.json dir: packages - template: sample-aem-cms-config.provisioning.hbs + template: sample-aem-cms-config.osgiconfig.hbs postProcessors: - aem-contentpackage-osgiconfig postProcessorOptions: @@ -31,22 +25,45 @@ files: filters: - filter: /apps/sample-aem-cms-config -# Application package -- url: mvn:io.wcm.samples/io.wcm.caconfig.sample-app.complete//zip +# Apache Sling +- url: mvn:org.apache.sling/org.apache.sling.caconfig.api + dir: bundles + condition: ${app.slingCaconfigLatest} +- url: mvn:org.apache.sling/org.apache.sling.caconfig.spi + dir: bundles + condition: ${app.slingCaconfigLatest} +- url: mvn:org.apache.sling/org.apache.sling.caconfig.impl + dir: bundles + condition: ${app.slingCaconfigLatest} +- url: mvn:org.apache.sling/org.apache.sling.models.caconfig + dir: bundles + condition: ${app.slingModelsCaconfig} + +# wcm.io +- url: mvn:io.wcm/io.wcm.caconfig.editor + dir: bundles +- url: mvn:io.wcm/io.wcm.caconfig.extensions + dir: bundles +- url: mvn:io.wcm/io.wcm.wcm.ui.granite + dir: bundles +- url: mvn:io.wcm/io.wcm.sling.commons + dir: bundles + +# Application bundles +- url: mvn:io.wcm.samples/io.wcm.caconfig.sample-app.core dir: packages + +# Application conf content package - url: mvn:io.wcm.samples/io.wcm.caconfig.sample-app.conf-content//zip dir: packages # Application sample content package - url: mvn:io.wcm.samples/io.wcm.caconfig.sample-app.sample-content-default//zip dir: packages - variants: - - default-persistence-strategy - + condition: ${!app.caconfigAemPagePersistence} - url: mvn:io.wcm.samples/io.wcm.caconfig.sample-app.sample-content-aempage//zip dir: packages - variants: - - aempage-persistence-strategy + condition: ${app.caconfigAemPagePersistence} # Defines configuration parameters and default values @@ -56,12 +73,9 @@ config: version: ${version} app: - sampleContent: false - - - # Example for config override configuration - #configOverrides: - # "/path/to/config/scope": - # siteUrl: - # siteUrlSecure: - # siteUrlAuthor: + # Whether to use AEM Page persistence strategy + caconfigAemPagePersistence: true + # Whether to deploy latest Sling Models API/SPI/Models bundles + slingCaconfigLatest: true + # Whether to deploy bundle org.apache.sling.models.caconfig (not part of AEM out-of-the-box) + slingModelsCaconfig: true diff --git a/config-definition/src/main/templates/sample-aem-cms/sample-aem-cms-config.osgiconfig.hbs b/config-definition/src/main/templates/sample-aem-cms/sample-aem-cms-config.osgiconfig.hbs new file mode 100644 index 0000000..62228d3 --- /dev/null +++ b/config-definition/src/main/templates/sample-aem-cms/sample-aem-cms-config.osgiconfig.hbs @@ -0,0 +1,66 @@ +{ + "configurations": { + + // Set log level for project-specific bundles + "org.apache.sling.commons.log.LogManager.factory.config-rnd-mediahandler-dynamicmedia": { + "org.apache.sling.commons.log.file": "logs/error.log", + "org.apache.sling.commons.log.level": "{{app.logLevel}}", + "org.apache.sling.commons.log.names": ["io.wcm","com.divae.rnd.mediahandlerdynamicmedia"] + }, + + // Log level for Context-Aware Config + "org.apache.sling.commons.log.LogManager.factory.config-rnd-mediahandler-dynamicmedia-mediahandler": { + "org.apache.sling.commons.log.file": "logs/error.log", + "org.apache.sling.commons.log.level": "{{app.logLevelCaConfig}}", + "org.apache.sling.commons.log.names": ["org.apache.sling.caconfig","io.wcm.caconfig"] + }, + + // Example for config override + "org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider-caconfig-sample": { + "description": "Override Example", + "overrides": [ + "[/content/contextaware-config-sample/en/sub-page/sub-page-override]io.wcm.caconfig.sample.config.ConfigSample={\"stringParam\":\"override-stringParam\",\"intParam\":999}", + "[/content/contextaware-config-sample/en/sub-page/sub-page-override]sample/configuration/2/stringParam=\"override2-stringParam\"", + "io.wcm.caconfig.sample.config.ConfigOverrideSample={\"stringParam\":\"global-override-stringParam\",\"intParam\":123}" + ], + "enabled": true + }, + + // Enable wcm.io CAConfig Extensions AEM Page Persistence + "io.wcm.caconfig.extensions.persistence.impl.PagePersistenceStrategy": { + "enabled": {{app.caconfigAemPagePersistence}} + } + + }, + + "configurations:author": { + + // Show "Sites" view in TouchUI after login + "com.day.cq.commons.servlets.RootMappingServlet": { + "rootmapping.target": "/sites.html" + } + + }, + + "configurations:publish": { + + // Disable Configuration Editor on publish + "io.wcm.caconfig.editor.impl.EditorConfig": { + "enabled": false + }, + + // Disable default renderings for Sling GET servlet on publish + "org.apache.sling.servlets.get.DefaultGetServlet": { + "enable.html": false, + "enable.json": true, + "enable.txt": false, + "enable.xml": false, + "index": false, + "index.files": ["index","index.html"], + "aliases": "xml:pdf", + "json.maximumresults": 100 + } + + } + +} diff --git a/config-definition/src/main/templates/sample-aem-cms/sample-aem-cms-config.provisioning.hbs b/config-definition/src/main/templates/sample-aem-cms/sample-aem-cms-config.provisioning.hbs deleted file mode 100644 index 32762b5..0000000 --- a/config-definition/src/main/templates/sample-aem-cms/sample-aem-cms-config.provisioning.hbs +++ /dev/null @@ -1,53 +0,0 @@ -[feature name=sample-aem-cms-config] - - -[configurations] - - # Default LogManager configuration - org.apache.sling.commons.log.LogManager - org.apache.sling.commons.log.pattern="{0,date,dd.MM.yyyy\ HH:mm:ss.SSS}\ *{4}*\ [{2}]\ {3}\ {5}" - org.apache.sling.commons.log.file="logs/error.log" - org.apache.sling.commons.log.level="warn" - org.apache.sling.commons.log.file.size="'.'yyyy-MM-dd" - org.apache.sling.commons.log.file.number=I"15" - - # Configure Sling Context-Aware Configuration for AEM 6.4 - org.apache.sling.caconfig.management.impl.ConfigurationManagementSettingsImpl - ignorePropertyNameRegex=["^(jcr|cq):.+$","^sling:resourceType$"] - configCollectionPropertiesResourceNames=["jcr:content","."] - - # Example for config override - org.apache.sling.caconfig.impl.override.OsgiConfigurationOverrideProvider-caconfig-sample - description="Override\ Example" - overrides=["[/content/contextaware-config-sample/en/sub-page/sub-page-override]io.wcm.caconfig.sample.config.ConfigSample\={\"stringParam\":\"override-stringParam\",\"intParam\":999}", - "[/content/contextaware-config-sample/en/sub-page/sub-page-override]sample/configuration/2/stringParam\=\"override2-stringParam\"", - "io.wcm.caconfig.sample.config.ConfigOverrideSample\={\"stringParam\":\"global-override-stringParam\",\"intParam\":123}"] - enabled=B"true" - - # Trace logging for Context-Aware Config - org.apache.sling.commons.log.LogManager.factory.config-slingconfig.log - org.apache.sling.commons.log.names=["org.apache.sling.caconfig","io.wcm.caconfig"] - org.apache.sling.commons.log.file="logs/contextaware-config.log" - org.apache.sling.commons.log.level="trace" - - # Enable wcm.io CAConfig Extensions AEM Page Persistence - io.wcm.caconfig.extensions.persistence.impl.PagePersistenceStrategy - enabled=B"{{app.caconfigAemPagePersistence}}" - - -[configurations runModes=author] - - # Show "Sites" view in TouchUI after login - com.day.cq.commons.servlets.RootMappingServlet - rootmapping.target="/sites.html" - - # Set TouchUI as primary authoring UI - com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl - authoringUIModeService.default="TOUCH" - - -[configurations runModes=publish] - - # Disable Configuration Editor on publish - io.wcm.caconfig.editor.impl.EditorConfig - enabled=B"false" diff --git a/content-packages/complete/META-INF/vault/definition/thumbnail.png b/content-packages/complete/META-INF/vault/definition/thumbnail.png deleted file mode 100644 index 1fa0e08..0000000 Binary files a/content-packages/complete/META-INF/vault/definition/thumbnail.png and /dev/null differ diff --git a/content-packages/complete/pom.xml b/content-packages/complete/pom.xml deleted file mode 100644 index 43d589b..0000000 --- a/content-packages/complete/pom.xml +++ /dev/null @@ -1,178 +0,0 @@ - - - - - 4.0.0 - - - io.wcm.samples - io.wcm.caconfig.sample-app.parent - 1.0.0-SNAPSHOT - ../../parent/pom.xml - - - io.wcm.samples - io.wcm.caconfig.sample-app.complete - 1.0.0-SNAPSHOT - content-package - - - contextaware-config-sample-complete - wcm-io-samples - - - - - - io.wcm.samples - io.wcm.caconfig.sample-app.core - 1.0.0-SNAPSHOT - compile - - - - org.apache.sling - org.apache.sling.caconfig.api - compile - - - org.apache.sling - org.apache.sling.caconfig.spi - compile - - - org.apache.sling - org.apache.sling.caconfig.impl - compile - - - org.apache.sling - org.apache.sling.models.caconfig - compile - - - - io.wcm - io.wcm.caconfig.editor - compile - - - io.wcm - io.wcm.caconfig.extensions - compile - - - io.wcm - io.wcm.wcm.ui.granite - compile - - - io.wcm - io.wcm.sling.commons - compile - - - - - - ${contentPackage.name}-${project.version} - - - - org.apache.jackrabbit - filevault-package-maven-plugin - true - - ${contentPackage.name} - ${contentPackage.group} - container - - - - /apps/${contentPackage.name} - - - - /apps/${contentPackage.name}/install - - - - io.wcm, - io.wcm.samples - - - - - org.apache.sling - - - org.apache.sling.caconfig.api, - org.apache.sling.caconfig.spi, - org.apache.sling.caconfig.impl, - org.apache.sling.models.caconfig - - - - - - - - - - io.wcm.devops.maven.plugins - eclipse-maven-plugin - - true - - - - - - org.apache.maven.plugins - maven-source-plugin - - false - - - - - - org.apache.maven.plugins - maven-site-plugin - - true - true - - - - - - org.apache.maven.plugins - maven-deploy-plugin - - true - - - - - - - diff --git a/content-packages/conf-content/pom.xml b/content-packages/conf-content/pom.xml index 6df092f..47e94a6 100644 --- a/content-packages/conf-content/pom.xml +++ b/content-packages/conf-content/pom.xml @@ -68,6 +68,11 @@ + + + + none + diff --git a/content-packages/sample-content-aempage/pom.xml b/content-packages/sample-content-aempage/pom.xml index 01978d1..3a75600 100644 --- a/content-packages/sample-content-aempage/pom.xml +++ b/content-packages/sample-content-aempage/pom.xml @@ -67,6 +67,11 @@ + + + + none + diff --git a/content-packages/sample-content-default/pom.xml b/content-packages/sample-content-default/pom.xml index bbbbf91..ed1a8c3 100644 --- a/content-packages/sample-content-default/pom.xml +++ b/content-packages/sample-content-default/pom.xml @@ -65,6 +65,11 @@ + + + + none + diff --git a/parent/pom.xml b/parent/pom.xml index 26a9e31..23ab680 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -39,6 +39,16 @@ 11 + + http://localhost:4502 + http://localhost:4503 + + + enabled + + + 2024-07-01T00:00:00Z + @@ -230,4 +240,82 @@ + + + + + aem65 + + + http://localhost:45025 + http://localhost:45035 + + + + + + cmBuild + + + env.CM_BUILD + + + + + + + oss-snapshots + https://oss.sonatype.org/content/repositories/snapshots + default + + false + + + true + always + + + + apache-snapshots + https://repository.apache.org/snapshots + default + + false + + + true + always + + + + + + oss-snapshots + https://oss.sonatype.org/content/repositories/snapshots + default + + false + + + true + always + + + + apache-snapshots + https://repository.apache.org/snapshots + default + + false + + + true + always + + + + + + + diff --git a/pom.xml b/pom.xml index 928698c..81bf8d0 100644 --- a/pom.xml +++ b/pom.xml @@ -42,7 +42,6 @@ parent bundles/core config-definition - content-packages/complete content-packages/conf-content content-packages/sample-content-default content-packages/sample-content-aempage