Skip to content

Commit

Permalink
Merge branch 'dev' into cy_bump
Browse files Browse the repository at this point in the history
  • Loading branch information
ravise5 committed Feb 1, 2024
2 parents 6bee0dc + e238678 commit f1161c1
Show file tree
Hide file tree
Showing 203 changed files with 7,973 additions and 818 deletions.
9 changes: 1 addition & 8 deletions .circleci/ci/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,7 @@ console.log(configuration);
ci.stage('Build Project');
// done to solve this, https://github.com/eirslett/frontend-maven-plugin/issues/882
ci.sh(`rm -rf ${eirslettM2Repository}`);
try {
ci.sh('mvn -B clean install -Pcloud');
} catch (ex) {
console.log(ex);
ci.stage('Retrying build due to eirslett flaky ci issue');
ci.sh('mvn -B clean install -Pcloud');
}

ci.sh('mvn -B clean install -Pcloud,build-cypress');
ci.stage('Collect test results');
const testFolder = path.resolve(process.cwd(), 'test-results/junit');
ci.sh(`mkdir -p ${testFolder}`);
Expand Down
8 changes: 6 additions & 2 deletions .circleci/ci/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ module.exports = class CI {
/**
* Run shell command and attach to process stdio.
*/
sh(command, returnStdout = false, print = true) {
sh(command, returnStdout = false, print = true, shellStr = '') {
if (print) {
console.log(command);
}
if (returnStdout) {
return e.execSync(command).toString().trim();
}
return e.execSync(command, {stdio: 'inherit'});
if (shellStr) {
return e.execSync(command, {stdio: 'inherit', shell: shellStr});
} else {
return e.execSync(command, {stdio: 'inherit'});
}
};

/**
Expand Down
18 changes: 14 additions & 4 deletions .circleci/ci/it-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,23 @@ const qpPath = '/home/circleci/cq';
const buildPath = '/home/circleci/build';
const { TYPE, BROWSER, AEM, PRERELEASE, FT } = process.env;
const isLatestAddon = AEM === 'addon-latest';
const jacocoAgent = '/home/circleci/.m2/repository/org/jacoco/org.jacoco.agent/0.8.3/org.jacoco.agent-0.8.3-runtime.jar';

try {
ci.stage("Integration Tests");
// # Define the image name
let image_name="docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-qp:6.4.6-openjdk11";
let qpContainerId = ci.sh(`docker ps --filter "ancestor=${image_name}" --quiet`, true);
console.log("container id for qp ", qpContainerId);

// moving the qp docker content and environment variable to host machine
ci.sh(`docker cp ${qpContainerId}:/home/circleci/cq ${qpPath}`);
ci.sh(`docker cp ${qpContainerId}:/home/circleci/.m2/repository/org/jacoco/org.jacoco.agent/0.8.3/ /home/circleci/.m2/repository/org/jacoco/org.jacoco.agent/0.8.3/`);

let wcmVersion = ci.sh('mvn help:evaluate -Dexpression=core.wcm.components.version -q -DforceStdout', true);
ci.stage("Integration Tests");
ci.dir(qpPath, () => {
// Connect to QP
ci.sh('./qp.sh -v bind --server-hostname localhost --server-port 55555');
ci.sh(`./qp.sh -v bind --server-hostname localhost --server-port 55555`);

let extras = ``, preleaseOpts = ``;
if (AEM === 'classic') {
Expand Down Expand Up @@ -64,7 +74,7 @@ try {

// Set an environment variable indicating test was executed
// this is used in case of re-run failed test scenario
ci.sh("sed -i 's/false/true/' /home/circleci/build/TEST_EXECUTION_STATUS.txt")
ci.sh("sed -i 's/false/true/' /home/circleci/build/TEST_EXECUTION_STATUS.txt");
// Start CQ
ci.sh(`./qp.sh -v start --id author --runmode author --port 4502 --qs-jar /home/circleci/cq/author/cq-quickstart.jar \
--bundle org.apache.sling:org.apache.sling.junit.core:1.0.23:jar \
Expand All @@ -82,7 +92,7 @@ try {
${ci.addQpFileDependency(config.modules['core-forms-components-it-tests-core'])} \
${ci.addQpFileDependency(config.modules['core-forms-components-it-tests-apps'])} \
${ci.addQpFileDependency(config.modules['core-forms-components-it-tests-content'])} \
--vm-options \\\"-Xmx4096m -XX:MaxPermSize=1024m -Djava.awt.headless=true -javaagent:${process.env.JACOCO_AGENT}=destfile=crx-quickstart/jacoco-it.exec\\\" \
--vm-options \\\"-Xmx4096m -XX:MaxPermSize=1024m -Djava.awt.headless=true -javaagent:${jacocoAgent}=destfile=crx-quickstart/jacoco-it.exec\\\" \
${preleaseOpts}`);
});

Expand Down
31 changes: 22 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ common:
restore_cache: &restore_cache
restore_cache:
keys:
- maven-repo-v2-{{ arch }}-{{ .Branch }}-{{ checksum "pom.xml" }}
- maven-repo-v2-{{ arch }}-{{ .Branch }}
- maven-repo-v2-{{ .Branch }}-{{ checksum "pom.xml" }}
- maven-repo-v2-{{ .Branch }}
- maven-repo-v2-

cypress_test_steps: &cypress_test_steps
Expand All @@ -24,6 +24,18 @@ common:
which google-chrome
name: Check browser installed
- *restore_cache
- run:
name: Docker compose
command: |
set +e # Disable exit on error
for i in $(seq 3); do
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin docker2-granite-release-local.dr-uw2.adobeitc.com
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USER" --password-stdin docker-adobe-cif-release.dr-uw2.adobeitc.com
docker-compose -f .circleci/docker-compose.yml down -v
docker-compose -f .circleci/docker-compose.yml up -d && break
sleep 10 # Add a delay between retries
done
set -e # Enable exit on error
- attach_workspace:
at: /home/circleci/build
- run:
Expand All @@ -49,6 +61,7 @@ common:
- run:
name: Install AXE HTML Reporter
command: npm install axe-html-reporter
- run: docker ps -a
- run:
name: UI tests
# Supports 'Re-run failed tests only'. See this for more info: https://circleci.com/docs/rerun-failed-tests-only/
Expand Down Expand Up @@ -89,7 +102,8 @@ common:
fi
- run:
name: Cleanup
command: rm -rf TEST_EXECUTION_STATUS.txt
command: |
rm -rf TEST_EXECUTION_STATUS.txt
# Save test results as artifacts
- store_artifacts:
path: ui.tests/test-module/target
Expand All @@ -112,11 +126,9 @@ executors:
docker:
- image: cimg/openjdk:8.0-browsers
test_executor_cloudready:
docker:
- image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-qp:6.4.6-openjdk11
<<: *docker_auth
- image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem-cloudready:13804-openjdk11
<<: *docker_auth
machine:
image: ubuntu-2204:2023.10.1
docker_layer_caching: true

jobs:
build-java-11:
Expand All @@ -137,7 +149,7 @@ jobs:
- save_cache:
paths:
- ~/.m2
key: maven-repo-v2-{{ arch }}-{{ .Branch }}-{{ checksum "pom.xml" }}
key: maven-repo-v2-{{ .Branch }}-{{ checksum "pom.xml" }}
- persist_to_workspace:
root: /home/circleci/build
paths:
Expand All @@ -154,6 +166,7 @@ jobs:
- it/content/target/*.zip
- it/config/target/*.zip
- jsdocs/target/jsapi
- ui.tests/test-module/node_modules
- store_test_results:
path: bundles/core/target/surefire-reports
- store_artifacts:
Expand Down
47 changes: 47 additions & 0 deletions .circleci/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
version: '3'

services:
circleci-qp:
image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-qp:6.4.6-openjdk11
entrypoint: tail -f /dev/null # Keeps the container running

circleci-aem-cloudready:
image: docker-adobe-cif-release.dr-uw2.adobeitc.com/circleci-aem-cloudready:13804-openjdk11
depends_on:
- circleci-qp
# Add any additional configurations or environment variables if needed
environment:
- FORMS_DOCUMENT_SERVICE=aem-formsdocservice-java:8080
ports:
- "3000:3000"
- "4502:4502"
- "55555:55555"
- "55556:55556"
volumes:
- /home/circleci/build:/home/circleci/build

aem-formsdocservice-native:
image: docker2-granite-release-local.dr-uw2.adobeitc.com/aem-ethos/formsdocservice-native:1.0.158
depends_on:
- circleci-aem-cloudready
environment:
- REGION_NAME=local
- ENVIRONMENT_NAME=CI
ports:
- "8007:8007"
- "8008:8008"
volumes:
- /tmp:/mnt/shared

aem-formsdocservice-java:
image: docker2-granite-release-local.dr-uw2.adobeitc.com/aem-ethos/formsdocservice-java:10.0.214
depends_on:
- aem-formsdocservice-native
environment:
- REGION_NAME=local
- ENVIRONMENT_NAME=CI
- NATIVE_SERVICE_HOST=aem-formsdocservice-native
ports:
- "8080:8080"
volumes:
- /tmp:/mnt/shared
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ private FormConstants() {
/** The resource type for checkbox v1 */
public static final String RT_FD_FORM_CHECKBOX_V1 = RT_FD_FORM_PREFIX + "checkbox/v1/checkbox";

/** The resource type for switch v1 */
public static final String RT_FD_FORM_SWITCH_V1 = RT_FD_FORM_PREFIX + "switch/v1/switch";

/** The resource type for date picker v1 */
public static final String RT_FD_FORM_DATE_PICKER_V1 = RT_FD_FORM_PREFIX + "datepicker/v1/datepicker";

Expand All @@ -62,6 +65,9 @@ private FormConstants() {
/** The resource type for file input v1 */
public static final String RT_FD_FORM_FILE_INPUT_V1 = RT_FD_FORM_PREFIX + "fileinput/v1/fileinput";

/** The resource type for file input v2 */
public static final String RT_FD_FORM_FILE_INPUT_V2 = RT_FD_FORM_PREFIX + "fileinput/v2/fileinput";

/** The resource type for check box group v1 */
public static final String RT_FD_FORM_CHECKBOX_GROUP_V1 = RT_FD_FORM_PREFIX + "checkboxgroup/v1/checkboxgroup";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2023 Adobe
~
~ 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
package com.adobe.cq.forms.core.components.internal.models.v1.form;

import javax.annotation.PostConstruct;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;

import com.adobe.cq.export.json.ComponentExporter;
import com.adobe.cq.export.json.ExporterConstants;
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
import com.adobe.cq.forms.core.components.models.form.Switch;
import com.adobe.cq.forms.core.components.util.AbstractCheckboxImpl;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { Switch.class,
ComponentExporter.class },
resourceType = { FormConstants.RT_FD_FORM_SWITCH_V1 })
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class SwitchImpl extends AbstractCheckboxImpl implements Switch {
@PostConstruct
public void initSwitchModel() {
if (enumNames != null) {
String[] enumNameArray = enumNames;
enumNames = Boolean.TRUE.equals(enableUncheckedValue) ? new String[] { enumNameArray[0], enumNameArray[1] }
: new String[] { enumNameArray[0] };
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ~ Copyright 2023 Adobe
* ~
* ~ 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.
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

package com.adobe.cq.forms.core.components.internal.models.v2.form;

import java.util.Map;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.models.annotations.Default;
import org.apache.sling.models.annotations.Exporter;
import org.apache.sling.models.annotations.Model;
import org.apache.sling.models.annotations.injectorspecific.InjectionStrategy;
import org.apache.sling.models.annotations.injectorspecific.ValueMapValue;
import org.jetbrains.annotations.NotNull;

import com.adobe.cq.export.json.ComponentExporter;
import com.adobe.cq.export.json.ExporterConstants;
import com.adobe.cq.forms.core.components.internal.form.FormConstants;
import com.adobe.cq.forms.core.components.internal.models.v1.form.FileInputImpl;
import com.adobe.cq.forms.core.components.models.form.FileInput;
import com.fasterxml.jackson.annotation.JsonIgnore;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { FileInput.class,
ComponentExporter.class },
resourceType = { FormConstants.RT_FD_FORM_FILE_INPUT_V2 })
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class FileInputImplV2 extends FileInputImpl {

private static final String DRAG_DROP_TEXT = "dragDropText";

@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = "dragDropText")
@Default(values = FileInput.DEFAULT_DRAGDROP_TEXT)
protected String dragDropText;

@JsonIgnore
public String getDragDropText() {
return dragDropText;
}

@Override
public @NotNull Map<String, Object> getProperties() {
Map<String, Object> customProperties = super.getProperties();
customProperties.put(DRAG_DROP_TEXT, getDragDropText());
return customProperties;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.osgi.annotation.versioning.ProviderType;

import com.adobe.cq.forms.core.components.util.DefaultValueSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

/**
Expand Down Expand Up @@ -47,6 +48,7 @@ default Boolean isReadOnly() {
* @return placeholder to show on the field
* @since com.adobe.cq.forms.core.components.models.form 0.0.1
*/
@JsonProperty("placeholder")
default String getPlaceHolder() {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
public interface FileInput extends Field, FileConstraint, ContainerConstraint {
String DEFAULT_BUTTON_TEXT = "Attach";

String DEFAULT_DRAGDROP_TEXT = "Drag and Drop To Upload";

/**
* Returns {@code true} if multiple files can be selected, {@code false} otherwise
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2023 Adobe
~
~ 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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
package com.adobe.cq.forms.core.components.models.form;

import org.osgi.annotation.versioning.ConsumerType;

/**
* Defines the {@code Switch} Sling Model used for the {@code /apps/core/fd/components/form/switch} component.
*
* @since com.adobe.cq.forms.core.components.models 4.7.0
*/
@ConsumerType
public interface Switch extends CheckBox {}

0 comments on commit f1161c1

Please sign in to comment.