Skip to content

Commit

Permalink
Merge branch 'release/6.0.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruberrolandvaltech committed Jun 15, 2022
2 parents 7b97ad9 + c17933e commit 8b184b0
Show file tree
Hide file tree
Showing 35 changed files with 154 additions and 60 deletions.
8 changes: 8 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: "AECU CodeQL config"

queries:
- uses: security-and-quality

paths-ignore:
- '**/ui.apps.groovyconsole/**/*.*'
- '**/target/**/*.*'
14 changes: 11 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,21 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
Expand All @@ -63,4 +71,4 @@ jobs:
mvn clean install
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
48 changes: 48 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven

- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Build with Maven
run: mvn clean install javadoc:javadoc

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=aecu
19 changes: 0 additions & 19 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
6.0.3
- Improvements to cloud startup hook (190)

2022-06-03 6.0.2
- Improvements to cloud startup hook to avoid double execution and execution before Groovy Console is ready

Expand Down
32 changes: 31 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.api</artifactId>
Expand Down Expand Up @@ -45,6 +45,36 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public void filter_whenMultiValueFieldMatch_thenTrue() {

Map<String, Object> properties_multiValue_same_int = new HashMap<>();
properties_multiValue_same_int.put("testMultiValueInt", new Integer[] {1, 2, 3});
assertTrue(new FilterByProperties(properties_multiValue_same).filter(resource, new StringBuilder()));
assertTrue(new FilterByProperties(properties_multiValue_same_int).filter(resource, new StringBuilder()));

Map<String, Object> properties_multiValue_2 = new HashMap<>();
properties_multiValue_2.put("testMultiValue", new String[] {"val_1", "val_2"});
Expand Down
2 changes: 1 addition & 1 deletion cloud.startup.hook/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.cloud.startup.hook</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public class AecuCloudStartupService {

private static final Logger LOGGER = LoggerFactory.getLogger(AecuCloudStartupService.class);

private static final int WAIT_PERIOD = 10;
private static final int WAIT_INTERVALS = 30;
private static final int WAIT_PERIOD = 30;
private static final int WAIT_INTERVALS = 10;
// migration timeout in seconds
private static final int MIGRATION_TIMEOUT = 1800;

Expand All @@ -71,7 +71,16 @@ public class AecuCloudStartupService {
private ServiceComponentRuntime serviceComponentRuntime;

@Activate
public void checkAndRunMigration() {
public void activate() {
Runnable runnable = this::checkAndRunMigration;
Thread thread = new Thread(runnable);
thread.start();
}

/**
* Checks if the components are ready and starts the migration process.
*/
protected void checkAndRunMigration() {
ResourceResolver resourceResolver = getResourceResolver();
Session session = resourceResolver.adaptTo(Session.class);
boolean isCompositeNodeStore = RuntimeHelper.isCompositeNodeStore(session);
Expand All @@ -81,7 +90,7 @@ public void checkAndRunMigration() {
LOGGER.error("Groovy extension services seem to be not bound");
throw new IllegalStateException("Groovy extension services seem to be not bound");
}
Thread.sleep(1000L * WAIT_PERIOD);
Thread.sleep(1000L * WAIT_PERIOD * 2);
startAecuMigration();
} catch (InterruptedException e) {
LOGGER.error("Interrupted", e);
Expand Down
2 changes: 1 addition & 1 deletion complete-cloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.complete.cloud</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.core:aecu-admin\=aecu-admin"]
user.mapping=["de.valtech.aecu.core:aecu-admin\=[aecu-admin]"]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.cloud.startup.hook:aecu-admin\=aecu-admin"]
user.mapping=["de.valtech.aecu.cloud.startup.hook:aecu-admin\=[aecu-admin]"]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.core:aecu-content-migrator\=aecu-content-migrator"]
user.mapping=["de.valtech.aecu.core:aecu-content-migrator\=[aecu-content-migrator]"]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.core:aecu\=aecu-service"]
user.mapping=["de.valtech.aecu.core:aecu\=[aecu-service]"]
2 changes: 1 addition & 1 deletion complete/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.complete</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.core:aecu-admin\=aecu-admin"]
user.mapping=["de.valtech.aecu.core:aecu-admin\=[aecu-admin]"]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.core:aecu-content-migrator\=aecu-content-migrator"]
user.mapping=["de.valtech.aecu.core:aecu-content-migrator\=[aecu-content-migrator]"]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
user.mapping=["de.valtech.aecu.core:aecu\=aecu-service"]
user.mapping=["de.valtech.aecu.core:aecu\=[aecu-service]"]
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public String doAction(Resource resource) throws PersistenceException {
/**
* Returns the tags that need to be added.
*
* @param oldTags list of existing tags
* @return tags to add
* @throws PersistenceException invalid tag found
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public ContentUpgrade forResourcesByPropertyQuery(@Nonnull String path, Map<Stri
if (properties != null) {
properties.forEach((key, value) -> {
if (key == null || value == null) {
LOG.warn("Null key or value provided: Key: " + key + " Value: " + value);
LOG.warn("Null key or value provided: Key: {} Value: {}", key, value);
return;
}
if (value.contains("%")) {
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/java/de/valtech/aecu/core/history/HistoryUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ public void purgeHistory(ResourceResolver resolver, int daysToKeep) throws Persi
Resource base = resolver.getResource(HISTORY_BASE);
Calendar calendar = new GregorianCalendar();
calendar.add(Calendar.DAY_OF_MONTH, -daysToKeep);
LOG.debug("Starting purge with limit " + calendar.getTime().toString());
LOG.debug("Starting purge with limit {}", calendar.getTime());
deleteRecursive(base.listChildren(), calendar, new int[] {Calendar.YEAR, Calendar.MONTH, Calendar.DAY_OF_MONTH});
}

Expand All @@ -437,7 +437,7 @@ private void deleteRecursive(Iterator<Resource> resources, Calendar calendar, in
String name = resource.getName();
// skip extra nodes such as ACLs
if (!StringUtils.isNumeric(name)) {
LOG.debug("Skipping purge of other node: " + resource.getPath());
LOG.debug("Skipping purge of other node: {}", resource.getPath());
continue;
}
int nodeValue = Integer.parseInt(name);
Expand All @@ -447,9 +447,9 @@ private void deleteRecursive(Iterator<Resource> resources, Calendar calendar, in
limit++;
}
if (nodeValue > limit) {
LOG.debug("Skipping purge of too young node: " + resource.getPath());
LOG.debug("Skipping purge of too young node: {}", resource.getPath());
} else if (nodeValue == limit) {
LOG.debug("Skipping purge of too young node: " + resource.getPath());
LOG.debug("Skipping purge of too young node: {}", resource.getPath());
// check next level
if (fields.length == 1) {
return;
Expand All @@ -458,7 +458,7 @@ private void deleteRecursive(Iterator<Resource> resources, Calendar calendar, in
System.arraycopy(fields, 1, fieldsNew, 0, fieldsNew.length);
deleteRecursive(resource.listChildren(), calendar, fieldsNew);
} else {
LOG.debug("Purging node: " + resource.getPath());
LOG.debug("Purging node: {}", resource.getPath());
BatchResourceRemover remover = ResourceUtil.getBatchResourceRemover(1000);
remover.delete(resource);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void onMessage(Mode mode, String action, String path) {
}

if (!ACTIONS.contains(action) && isValid(path)) {
LOG.debug(String.format("Skipping %s due to non matching action '%s'", path, action));
LOG.debug("Skipping {} due to non matching action '{}'", path, action);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void setup() throws AecuException {
List<String> allowedScripts = aecuService.getFiles(path);
ResourceResolver resourceResolver = request.getResourceResolver();
for (String scriptPath : allowedScripts) {
entries.add(new ValueMapResource(resourceResolver, scriptPath, ITEM_TYPE, null));
entries.add(new ValueMapResource(resourceResolver, scriptPath, ITEM_TYPE));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private String getUserName(SlingHttpServletRequest request) {
/**
* Returns the AEM groups that belong to the user.
*
* @param user user
* @param request request
* @return group names
*/
private List<String> getUserGroupNames(SlingHttpServletRequest request) {
Expand Down
2 changes: 1 addition & 1 deletion examples-cloud/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.examples-cloud</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
println "AECU migration started"
println "AECU migration started"

aecu.contentUpgradeBuilder()
.forChildResourcesOf("/content/")
.printPath()
.run()
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aecu.contentUpgradeBuilder()
.forChildResourcesOf("/content/")
.printPath()
.run()
.printJson()
.run()
2 changes: 1 addition & 1 deletion examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.valtech.aecu</groupId>
<artifactId>aecu</artifactId>
<version>6.0.2</version>
<version>6.0.3</version>
</parent>

<artifactId>aecu.examples</artifactId>
Expand Down
Loading

0 comments on commit 8b184b0

Please sign in to comment.