Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ddc8a97
ENG-5566 Version bunmp. Added reload status verification when reloadi…
MEM2677 Jul 7, 2025
7e29e04
ENG-5566 Updated pipeline cache versions to v4
MEM2677 Jul 7, 2025
fccb187
ENG-5566 Updated entando-engine version to 6.5.5-ENG-5566-PR-340
MEM2677 Jul 8, 2025
fba6b55
ENG-5566 Test updated
MEM2677 Jul 8, 2025
6c11798
ENG-5566 cosmetic change on test for debugging purposes
MEM2677 Jul 8, 2025
b4c71ba
ENG-5566 Updated test
MEM2677 Jul 8, 2025
2091863
ENG-5566 Updated test
MEM2677 Jul 9, 2025
44a3b73
ENG-5566 Updated mockito dependency
MEM2677 Jul 9, 2025
24fdef2
ENG-5566 Code cleaning and test updated
MEM2677 Jul 9, 2025
5b32c17
ENG-5566 Added reload report, test updated
MEM2677 Jul 10, 2025
f0a3efc
ENG-5566 Code cleaning
MEM2677 Jul 10, 2025
966470b
ENG-5566 Test improved
MEM2677 Jul 10, 2025
9886668
ENG-5566 Test improved
MEM2677 Jul 10, 2025
81a2ec9
ENG-5566 Code cleaning (fix code duplication in the JSP)
MEM2677 Jul 10, 2025
d6f4b7b
ENG-5566 Replaced reload link with a POST form to improve request han…
MEM2677 Jul 14, 2025
2ed1403
ENG-5566 Fix UI error reported by Sonar
MEM2677 Jul 14, 2025
4dd51c0
ENG-5566 Added auto-refresh when reloading progress
MEM2677 Jul 14, 2025
8d22795
ENG-5566 Added auto-refresh when reloading the configuration reload i…
MEM2677 Jul 14, 2025
099e4dd
ENG-5566 Fix test
MEM2677 Jul 14, 2025
8271475
ENG-5566 Fix UI following quality gate recommendations
MEM2677 Jul 15, 2025
2209fa7
ENG-5566 Added reload message
MEM2677 Jul 21, 2025
f01fe5b
ENG-5566 Introduced constants for BaseAdminAction action returns
MEM2677 Oct 9, 2025
b863adb
ENG-5566 Update entando-engine dependency to 6.5.5
MEM2677 Oct 9, 2025
a55d112
ENG-5566 Disabled SNYK
MEM2677 Oct 10, 2025
bfebd6d
ENG-5566 Temp refactor for test error tracing
MEM2677 Oct 10, 2025
8759d63
ENG-5566 Reverted enhanced for refactor
MEM2677 Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ga-publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
--id "CHECKOUT FOR GA PUBLICATION" \
--lcd "$LOCAL_CLONE_DIR"
- name: "Cache Maven packages"
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,21 @@ jobs:
java-version: 11
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
#~ BUILD CACHE
- name: "Cache Build Dir"
id: build-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: "${{ env.LOCAL_CLONE_DIR }}/target/"
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }}
#~ SONAR CACHE
- name: Cache SonarCloud packages
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
#~ MAVEN CACHE
- name: "Cache Maven packages"
id: maven-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-matrix-${{ matrix.scan-type }}
Expand All @@ -162,7 +162,7 @@ jobs:
#~ BUILD CACHE
- name: "Cache Build Dir"
id: build-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: "${{ env.LOCAL_CLONE_DIR}}/target/"
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }}
Expand All @@ -177,6 +177,7 @@ jobs:
export ENTANDO_OPT_SONAR_PROJECT_KEY="${{ secrets.ENTANDO_OPT_SONAR_PROJECT_KEY }}"
;;
MTX-SCAN-SNYK)
exit 0
export SNYK_TOKEN="${{ secrets.SNYK_TOKEN }}"
;;
MTX-MVN-POST-DEPLOYMENT-TESTS)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publication.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ jobs:
java-version: 11
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
#~ BUILD CACHE
- name: "Cache Build Dir"
id: build-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: "${{ env.LOCAL_CLONE_DIR }}/target/"
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -131,15 +131,15 @@ jobs:
java-version: 11
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
#~ BUILD CACHE
- name: "Cache Build Dir"
id: build-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: "${{ env.LOCAL_CLONE_DIR }}/target/"
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }}
Expand Down Expand Up @@ -177,15 +177,15 @@ jobs:
java-version: 11
#~ MAVEN CACHE
- name: "Cache Maven packages"
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2
restore-keys: ${{ runner.os }}-m2
#~ BUILD CACHE
- name: "Cache Build Dir"
id: build-cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: "${{ env.LOCAL_CLONE_DIR }}/target/"
key: ${{ runner.os }}-build-${{ env.BUILD_CACHE_KEY }}
Expand Down
28 changes: 25 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>org.entando</groupId>
<artifactId>entando-core-parent</artifactId>
<version>6.5.0-ENG-5128-PR-156</version>
<version>6.5.0</version>
</parent>
<groupId>org.entando.entando</groupId>
<artifactId>entando-admin-console</artifactId>
<version>6.5.2</version>
<version>6.5.3</version>
<packaging>war</packaging>
<name>Entando Core: Administration Console</name>
<description>Entando Administration Console: an agile, modern and user-centric open source Portal platform.
Expand Down Expand Up @@ -88,6 +88,22 @@
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>tests</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>tests</classifier>
<classesDirectory>${project.build.test-classes}</classesDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
Expand Down Expand Up @@ -212,7 +228,7 @@
<dependency>
<groupId>org.entando</groupId>
<artifactId>entando-core-bom</artifactId>
<version>6.5.0-ENG-5128</version>
<version>6.5.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand All @@ -222,12 +238,14 @@
<dependency>
<groupId>org.entando.entando</groupId>
<artifactId>entando-engine</artifactId>
<version>6.5.5</version>
</dependency>
<dependency>
<groupId>org.entando.entando</groupId>
<artifactId>entando-engine</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>6.5.5</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
Expand Down Expand Up @@ -273,6 +291,10 @@
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
Expand Down
87 changes: 70 additions & 17 deletions src/main/java/com/agiletec/apsadmin/admin/BaseAdminAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@
*/
package com.agiletec.apsadmin.admin;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.springframework.web.context.WebApplicationContext;
import static com.agiletec.apsadmin.admin.reload.ReloadConfigThread.RELOAD_THREAD;

import com.agiletec.aps.system.SystemConstants;
import com.agiletec.aps.system.common.entity.event.ReloadingEntitiesReferencesEvent;
Expand All @@ -31,7 +23,18 @@
import com.agiletec.aps.system.services.page.IPage;
import com.agiletec.aps.system.services.page.IPageManager;
import com.agiletec.aps.util.ApsWebApplicationUtils;
import com.agiletec.apsadmin.admin.reload.ReloadConfigThread;
import com.agiletec.apsadmin.system.BaseAction;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.springframework.web.context.WebApplicationContext;

/**
* This base action implements the default actions available for the system
Expand All @@ -43,23 +46,61 @@ public class BaseAdminAction extends BaseAction {

private static final EntLogger logger = EntLogFactory.getSanitizedLogger(BaseAdminAction.class);

public static final String RELOAD_ERROR = "reloadError";
public static final String IN_PROGRESS = "inProgress";
public static final String NEW_PARAM_MARKER = "_newParamMarker";

/**
* Reload the system configuration.
*
* @return the result code.
*/
public String reloadConfig() {
try {
ApsWebApplicationUtils.executeSystemRefresh(this.getRequest());
logger.info("Reload config started");
this.setReloadingResult(SUCCESS_RELOADING_RESULT_CODE);
} catch (Throwable t) {
logger.error("error in reloadConfig", t);
if (!ApsWebApplicationUtils.isReloadInProgress()) {
ReloadConfigThread rct = new ReloadConfigThread(this.getRequest());
logger.info("Starting reload configuration thread");
rct.start();
} else {
logger.info("Reload operation already in progress!");
}
this.setReloadingResult(PROGRESS_RELOADING_RESULT_CODE);
} catch (Exception e) {
logger.error("unexpected error while launching system reload", e);
this.setReloadingResult(FAILURE_RELOADING_RESULT_CODE);
return RELOAD_ERROR;
}
return SUCCESS;
}

public String reloadStatus() {
if (ApsWebApplicationUtils.isReloadInProgress()) {
this.setReloadingResult(PROGRESS_RELOADING_RESULT_CODE);
return IN_PROGRESS;
}
updateReloadStatusResult();
return SUCCESS;
}

public String reloadStatusJson() {
return SUCCESS;
}

public boolean isReloadingErrorDetect() {
return ApsWebApplicationUtils.getReloadInfo()
.values()
.stream()
.anyMatch(StringUtils::isNotBlank);
}

public int getReloadProgress() {
return ApsWebApplicationUtils.getReloadProgress();
}

public Map<String, String> getReloadInfo() {
return new HashMap<>(ApsWebApplicationUtils.getReloadInfo());
}

/**
* Reload the references of all the existing entities.
*
Expand Down Expand Up @@ -87,7 +128,7 @@ public void setReloadingResult(int reloadingResult) {
}

/**
* Get the system parameters in order to edit them.
* Get the system parameters to edit them.
*
* @return the result code.
*/
Expand Down Expand Up @@ -144,7 +185,7 @@ protected String getConfigParameter() {
* Refresh the map of parameters with values fetched from the request
*
* @param keepOldParam when true, when a system parameter is not found in
* request, the previous system parameter will be stored
* the request, the previous system parameter will be stored
*/
protected void updateLocalParams(boolean keepOldParam) {
Iterator<String> paramNames = this.getSystemParams().keySet().iterator();
Expand Down Expand Up @@ -205,6 +246,16 @@ private void addFreePublicPages(IPage page, List<IPage> pages) {
}
}

protected void updateReloadStatusResult() {
if (ApsWebApplicationUtils.getReloadInfo().containsKey(RELOAD_THREAD)) {
this.setReloadingResult(FAILURE_RELOADING_RESULT_CODE);
} else if (isReloadingErrorDetect()) {
this.setReloadingResult(WARNING_RELOADING_RESULT_CODE);
} else {
this.setReloadingResult(SUCCESS_RELOADING_RESULT_CODE);
}
}

protected ConfigInterface getConfigManager() {
return _configManager;
}
Expand All @@ -230,7 +281,7 @@ public void setSystemParams(Map<String, String> systemParams) {
}

public String getExternalParamMarker() {
return "_newParamMarker";
return NEW_PARAM_MARKER;
}

private ConfigInterface _configManager;
Expand All @@ -242,5 +293,7 @@ public String getExternalParamMarker() {

public static final int FAILURE_RELOADING_RESULT_CODE = 0;
public static final int SUCCESS_RELOADING_RESULT_CODE = 1;
public static final int PROGRESS_RELOADING_RESULT_CODE = 2;
public static final int WARNING_RELOADING_RESULT_CODE = 3;

}
28 changes: 26 additions & 2 deletions src/main/java/com/agiletec/apsadmin/admin/baseAdmin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@

<package name="core_do/BaseAdmin" namespace="/do/BaseAdmin" extends="entando-default">

<interceptors>
<interceptor name="json" class="org.apache.struts2.json.JSONInterceptor" />
<interceptor-stack name="jsonStack">
<interceptor-ref name="json">
<param name="enableSMD">true</param>
</interceptor-ref>
</interceptor-stack>
</interceptors>

<action name="settings" class="baseAdminAction">
<result type="tiles">admin.BaseAdmin.settings</result>
<interceptor-ref name="entandoDefaultStack"><param name="requestAuth.requiredPermission">superuser</param></interceptor-ref>
Expand All @@ -16,11 +25,26 @@
<result type="tiles">admin.BaseAdmin.reloadConfigChoose</result>
<interceptor-ref name="entandoDefaultStack"><param name="requestAuth.requiredPermission">superuser</param></interceptor-ref>
</action>

<action name="reloadConfig" class="baseAdminAction" method="reloadConfig">
<result type="tiles">admin.BaseAdmin.reloadConfigResult</result>
<result type="tiles">admin.BaseAdmin.reloadInProgress</result>
<result type="tiles" name="reloadError">admin.BaseAdmin.reloadConfigResult</result>
<interceptor-ref name="entandoDefaultStack"><param name="requestAuth.requiredPermission">superuser</param></interceptor-ref>
</action>

<action name="reloadStatus" class="baseAdminAction" method="reloadStatus">
<result type="tiles">admin.BaseAdmin.reloadConfigResult</result>
<result type="tiles" name="inProgress">admin.BaseAdmin.reloadInProgress</result>
<interceptor-ref name="entandoDefaultStack"><param name="requestAuth.requiredPermission">superuser</param></interceptor-ref>
</action>

<action name="reloadStatusJson" class="baseAdminAction" method="reloadStatusJson">
<result type="json" >
<param name="root">reloadProgress</param>
</result>
<interceptor-ref name="entandoDefaultStack"><param name="requestAuth.requiredPermission">superuser</param></interceptor-ref>
</action>

<action name="reloadEntitiesReferences" class="baseAdminAction" method="reloadEntitiesReferences">
<result type="tiles">admin.BaseAdmin.reloadEntitiesReferencesResult</result>
<interceptor-ref name="entandoDefaultStack"><param name="requestAuth.requiredPermission">superuser</param></interceptor-ref>
Expand All @@ -47,4 +71,4 @@

</package>

</struts>
</struts>
Loading
Loading