From ead101470957bbcc083ce4bc35f028d9a1117bf1 Mon Sep 17 00:00:00 2001 From: Walter Caffiero Date: Fri, 11 Jul 2025 11:16:13 +0200 Subject: [PATCH 01/15] ESB-669 fix pipelined reload configuration Fixes but introduced by ENG-5542 --- pom.xml | 2 +- .../aps/system/services/cache/IFCacheWithPipeline.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 1b455d61a..a7f346d69 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.entando.entando entando-engine jar - 6.5.4 + 6.5.4-fix.1 Entando Core: Engine Entando Engine: an agile, modern and user-centric open source Portal platform. http://www.entando.com/ diff --git a/src/main/java/org/entando/entando/aps/system/services/cache/IFCacheWithPipeline.java b/src/main/java/org/entando/entando/aps/system/services/cache/IFCacheWithPipeline.java index 66fe2d5f4..0ff69a6e9 100644 --- a/src/main/java/org/entando/entando/aps/system/services/cache/IFCacheWithPipeline.java +++ b/src/main/java/org/entando/entando/aps/system/services/cache/IFCacheWithPipeline.java @@ -52,10 +52,10 @@ static void pipelined(Object cache, Consumer pipelinedBlock openPipeline(cache); pipelinedBlock.accept((IFCacheWithPipeline) cache); closePipeline(cache); + return; } - } else { - pipelinedBlock.accept(null); } + pipelinedBlock.accept(null); } default boolean isEnabled() { From c2def987f0b2fd1cde82c63d5d8a0bcd7d4947e2 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Mon, 7 Jul 2025 14:30:35 +0200 Subject: [PATCH 02/15] ENG-5566 Version bump. Added progress indicator index for the reload configuration --- pom.xml | 2 +- .../aps/util/ApsWebApplicationUtils.java | 39 ++++++++++++------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/pom.xml b/pom.xml index a7f346d69..096339003 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.entando.entando entando-engine jar - 6.5.4-fix.1 + 6.5.5-pre.1 Entando Core: Engine Entando Engine: an agile, modern and user-centric open source Portal platform. http://www.entando.com/ diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index ecfa8cffa..c5f803de3 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -19,6 +19,7 @@ import com.agiletec.aps.system.common.RefreshableBean; import java.io.IOException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.jsp.PageContext; @@ -35,6 +36,7 @@ public class ApsWebApplicationUtils { private static final AtomicBoolean isReloadInProgress = new AtomicBoolean(false); + private static final AtomicInteger reloadProgress = new AtomicInteger(); private static final EntLogger logger = EntLogFactory.getSanitizedLogger(ApsWebApplicationUtils.class); @@ -143,43 +145,49 @@ public static void executeSystemRefresh(ServletContext svCtx) throws Throwable { WebApplicationContext wac = getWebApplicationContext(svCtx); executeSystemRefresh(wac); } - - private static void executeSystemRefresh(WebApplicationContext wac) throws Throwable { + private static void executeSystemRefresh(WebApplicationContext wac) throws Throwable { if (!isReloadInProgress.compareAndSet(false, true)) { ApsDeepDebug.print("service-reload","!!! " + Thread.currentThread().getName() + " tried to reload system services but another reload is in progress, aborting!!!"); logger.info("rejecting the reload of the configuration while still executing the previous one!"); return; } - long startTime = System.currentTimeMillis(); + final long startTime = System.currentTimeMillis(); + + reloadProgress.set(0); try { - RefreshableBean configManager = (RefreshableBean) wac.getBean(SystemConstants.BASE_CONFIG_MANAGER); - reloadRefreshableBean(configManager, SystemConstants.BASE_CONFIG_MANAGER); + final RefreshableBean configManager = (RefreshableBean) wac.getBean(SystemConstants.BASE_CONFIG_MANAGER); + final String[] beansNames = wac.getBeanNamesForType(RefreshableBean.class); + final int beansCount = beansNames.length; - String[] defNames = wac.getBeanNamesForType(RefreshableBean.class); - for (int i = 0; i < defNames.length; i++) { + reloadRefreshableBean(configManager, SystemConstants.BASE_CONFIG_MANAGER, + (int) ( 100.0 / beansCount)); + for (int i = 0; i < beansCount; i++) { Object bean = null; try { - if (defNames[i].equals(SystemConstants.BASE_CONFIG_MANAGER)) { + if (beansNames[i].equals(SystemConstants.BASE_CONFIG_MANAGER)) { continue; } - bean = wac.getBean(defNames[i]); - reloadRefreshableBean(bean, defNames[i]); + bean = wac.getBean(beansNames[i]); + final int progress = (int)(((i + 1) * 100.0) / beansCount); + reloadProgress.set(progress); + reloadRefreshableBean(bean, beansNames[i], progress); } catch (Exception t) { - ApsDeepDebug.print("service-reload", "RELOADING " + defNames[i] + " COMPLETED WITH ERRORS"); + ApsDeepDebug.print("service-reload", "RELOADING " + beansNames[i] + " COMPLETED WITH ERRORS"); logger.error("error in executeSystemRefresh", t); } } } finally { isReloadInProgress.set(false); + reloadProgress.set(0); long endTime = System.currentTimeMillis(); ApsDeepDebug.print("service-reload", "Tempo di esecuzione: " + (endTime - startTime) + " ms"); logger.info("reload configuration completed in {} ms", (endTime - startTime)); } } - private static void reloadRefreshableBean(final Object bean, final String name) throws Throwable { + private static void reloadRefreshableBean(final Object bean, final String name, final int progress) throws Throwable { if (bean != null) { long currentServiceStart =0; long currentServiceEnd = 0; @@ -188,7 +196,7 @@ private static void reloadRefreshableBean(final Object bean, final String name) currentServiceStart = System.currentTimeMillis(); ((RefreshableBean) bean).refresh(); currentServiceEnd = System.currentTimeMillis(); - ApsDeepDebug.print("service-reload", "RELOADING " + name + " completed in " + (currentServiceEnd - currentServiceStart) + " ms"); + ApsDeepDebug.print("service-reload", "RELOADING " + name + " completed in " + (currentServiceEnd - currentServiceStart) + " ms, " + progress + "% completed"); } else { ApsDeepDebug.print("service-reload", "THE BEAN WITH NAME " + name + " DOES NOT EXIST"); } @@ -197,5 +205,8 @@ private static void reloadRefreshableBean(final Object bean, final String name) public static boolean isReloadInProgress() { return isReloadInProgress.get(); } - + + public static int getReloadProgress() { + return reloadProgress.get(); + } } From 8ba76f9648d94113b79396d871071be569a4701e Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Mon, 7 Jul 2025 15:51:29 +0200 Subject: [PATCH 03/15] ENG-5566 Version bump --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 096339003..5dcb41870 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.entando.entando entando-engine jar - 6.5.5-pre.1 + 6.5.5 Entando Core: Engine Entando Engine: an agile, modern and user-centric open source Portal platform. http://www.entando.com/ From 104b0186832b7b9b0a4e839c3739cb3c3d303193 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Tue, 8 Jul 2025 15:54:49 +0200 Subject: [PATCH 04/15] ENG-5566 Updated tests --- .../system/services/lang/LangManagerTest.java | 2 +- .../services/actionlog/TestActionLogDAO.java | 126 +++++++++--------- .../actionlog/TestActionLogManager.java | 72 +++++----- .../TestSearchEngineManager.java | 2 +- 4 files changed, 100 insertions(+), 102 deletions(-) diff --git a/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java b/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java index 16ba0c384..481ae38ab 100644 --- a/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java +++ b/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java @@ -47,7 +47,7 @@ class LangManagerTest { private LangManager langManager; @BeforeEach - public static void setUp() throws Exception { + public void setUp() throws Exception { MockitoAnnotations.initMocks(LangManagerTest.class); } diff --git a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java index 384e3bfd8..ab6b9bee8 100644 --- a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java +++ b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java @@ -17,100 +17,98 @@ import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.fail; -import java.util.List; - -import javax.sql.DataSource; - import com.agiletec.aps.BaseTestCase; import com.agiletec.aps.util.DateConverter; +import java.util.List; +import javax.sql.DataSource; import org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord; import org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordSearchBean; import org.entando.entando.aps.system.services.actionlog.model.IActionLogRecordSearchBean; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; class TestActionLogDAO extends BaseTestCase { - - @Test + + @Test public void testGetActionRecords() { + IActionLogRecordSearchBean bean = null; - List ids = this._actionLoggerDAO.getActionRecords(bean); - // this.compareIds(new Integer[]{}, ids); - ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", - "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1"); - ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", - "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2"); - ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", - "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123"); - this._helper.addActionRecord(record1); - this._helper.addActionRecord(record2); - this._helper.addActionRecord(record3); - // - // ids = this._actionLoggerDAO.getActionRecords(bean); - // this.compareIds(new Integer[]{1, 2, 3}, ids); - - ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", null, null); - ids = this._actionLoggerDAO.getActionRecords(searchBean); + List ids = _actionLoggerDAO.getActionRecords(bean); + this.compareIds(new Integer[]{}, ids); + ActionLogRecord record1 = _helper.createActionRecord(1, "username1", "actionName1", + "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1"); + ActionLogRecord record2 = _helper.createActionRecord(2, "username2", "actionName2", + "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2"); + ActionLogRecord record3 = _helper.createActionRecord(3, "username123", "actionName123", + "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123"); + _helper.addActionRecord(record1); + _helper.addActionRecord(record2); + _helper.addActionRecord(record3); + +// ids = this._actionLoggerDAO.getActionRecords(bean); +// this.compareIds(new Integer[]{1, 2, 3}, ids); + + ActionLogRecordSearchBean searchBean = _helper.createSearchBean("name", "Name", "space", "arams", null, null); + ids = _actionLoggerDAO.getActionRecords(searchBean); this.compareIds(new Integer[]{1, 2, 3}, ids); - searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null); - ids = this._actionLoggerDAO.getActionRecords(searchBean); + searchBean = _helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null); + ids = _actionLoggerDAO.getActionRecords(searchBean); this.compareIds(new Integer[]{3}, ids); - searchBean = this._helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm")); - ids = this._actionLoggerDAO.getActionRecords(searchBean); + searchBean = _helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm")); + ids = _actionLoggerDAO.getActionRecords(searchBean); this.compareIds(new Integer[]{1, 2}, ids); - searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), + searchBean = _helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm")); - ids = this._actionLoggerDAO.getActionRecords(searchBean); + ids = _actionLoggerDAO.getActionRecords(searchBean); this.compareIds(new Integer[]{2}, ids); - } @Test public void testActionLogSearch() { IActionLogRecordSearchBean bean = null; - List ids = this._actionLoggerDAO.getActionRecords(bean); + List ids = _actionLoggerDAO.getActionRecords(bean); this.compareIds(new Integer[]{}, ids); - ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", + ActionLogRecord record1 = _helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1"); - ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", + ActionLogRecord record2 = _helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2"); - ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", + ActionLogRecord record3 = _helper.createActionRecord(3, "username123", "actionName123", "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123"); - this._helper.addActionRecord(record1); - this._helper.addActionRecord(record2); - this._helper.addActionRecord(record3); + _helper.addActionRecord(record1); + _helper.addActionRecord(record2); + _helper.addActionRecord(record3); - ActionLogRecordSearchBean searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("02/01/2009 10:01", "dd/MM/yyyy HH:mm"), + ActionLogRecordSearchBean searchBean = _helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("02/01/2009 10:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("02/01/2009 14:01", "dd/MM/yyyy HH:mm")); - ids = this._actionLoggerDAO.getActionRecords(searchBean); + ids = _actionLoggerDAO.getActionRecords(searchBean); this.compareIds(new Integer[]{3}, ids); } @Test public void testAddGetDeleteActionRecord() { - ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", + ActionLogRecord record1 = _helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1"); - ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", + ActionLogRecord record2 = _helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/02/2009 00:00", "dd/MM/yyyy HH:mm"), "params2"); - this._actionLoggerDAO.addActionRecord(record1); - this._actionLoggerDAO.addActionRecord(record2); - ActionLogRecord addedRecord1 = this._actionLoggerDAO.getActionRecord(record1.getId()); + _actionLoggerDAO.addActionRecord(record1); + _actionLoggerDAO.addActionRecord(record2); + ActionLogRecord addedRecord1 = _actionLoggerDAO.getActionRecord(record1.getId()); this.compareActionRecords(record1, addedRecord1); - ActionLogRecord addedRecord2 = this._actionLoggerDAO.getActionRecord(record2.getId()); + ActionLogRecord addedRecord2 = _actionLoggerDAO.getActionRecord(record2.getId()); this.compareActionRecords(record2, addedRecord2); - this._actionLoggerDAO.deleteActionRecord(record1.getId()); - assertNull(this._actionLoggerDAO.getActionRecord(record1.getId())); + _actionLoggerDAO.deleteActionRecord(record1.getId()); + assertNull(_actionLoggerDAO.getActionRecord(record1.getId())); - this._actionLoggerDAO.deleteActionRecord(record2.getId()); - assertNull(this._actionLoggerDAO.getActionRecord(record2.getId())); + _actionLoggerDAO.deleteActionRecord(record2.getId()); + assertNull(_actionLoggerDAO.getActionRecord(record2.getId())); } - + private void compareIds(Integer[] expected, List received) { assertEquals(expected.length, received.size()); for (Integer id : expected) { @@ -130,22 +128,22 @@ private void compareActionRecords(ActionLogRecord expected, ActionLogRecord rece DateConverter.getFormattedDate(received.getActionDate(), "ddMMyyyyHHmm")); } - @BeforeAll - private void init() { + @BeforeEach + public void init() { ActionLogDAO actionLoggerDAO = new ActionLogDAO(); - DataSource dataSource = (DataSource) this.getApplicationContext().getBean("servDataSource"); + DataSource dataSource = (DataSource) TestActionLogDAO.getApplicationContext().getBean("servDataSource"); actionLoggerDAO.setDataSource(dataSource); - this._actionLoggerDAO = actionLoggerDAO; - this._helper = new ActionLoggerTestHelper(this.getApplicationContext()); - this._helper.cleanRecords(); + TestActionLogDAO._actionLoggerDAO = actionLoggerDAO; + _helper = new ActionLoggerTestHelper(TestActionLogDAO.getApplicationContext()); + _helper.cleanRecords(); } - - @AfterAll - protected void destroy() throws Exception { - this._helper.cleanRecords(); + + @AfterAll + protected static void destroy() throws Exception { + TestActionLogDAO._helper.cleanRecords(); } - - private IActionLogDAO _actionLoggerDAO; - private ActionLoggerTestHelper _helper; + + private static IActionLogDAO _actionLoggerDAO; + private static ActionLoggerTestHelper _helper; } diff --git a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java index d14e2949d..0e0ba4540 100644 --- a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java +++ b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java @@ -33,60 +33,60 @@ class TestActionLogManager extends BaseTestCase { @Test public void testGetActionRecords() throws Throwable { - List ids = this._actionLoggerManager.getActionRecords(null); + List ids = _actionLoggerManager.getActionRecords(null); this.compareIds(new Integer [] {}, ids); - ActionLogRecord record1 = this._helper.createActionRecord(1, "username1", "actionName1", + ActionLogRecord record1 = _helper.createActionRecord(1, "username1", "actionName1", "namespace1", DateConverter.parseDate("01/01/2009 00:00", "dd/MM/yyyy HH:mm"), "params1"); - ActionLogRecord record2 = this._helper.createActionRecord(2, "username2", "actionName2", + ActionLogRecord record2 = _helper.createActionRecord(2, "username2", "actionName2", "namespace2", DateConverter.parseDate("01/01/2009 10:00", "dd/MM/yyyy HH:mm"), "params2"); - ActionLogRecord record3 = this._helper.createActionRecord(3, "username123", "actionName123", + ActionLogRecord record3 = _helper.createActionRecord(3, "username123", "actionName123", "namespace123", DateConverter.parseDate("02/01/2009 12:00", "dd/MM/yyyy HH:mm"), "params123"); - this._helper.addActionRecord(record1); - this._helper.addActionRecord(record2); - this._helper.addActionRecord(record3); + _helper.addActionRecord(record1); + _helper.addActionRecord(record2); + _helper.addActionRecord(record3); - ids = this._actionLoggerManager.getActionRecords(null); + ids = _actionLoggerManager.getActionRecords(null); this.compareIds(new Integer [] { 1, 2, 3 }, ids); - ActionLogRecordSearchBean searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", null, null); - ids = this._actionLoggerManager.getActionRecords(searchBean); + ActionLogRecordSearchBean searchBean = _helper.createSearchBean("name", "Name", "space", "arams", null, null); + ids = _actionLoggerManager.getActionRecords(searchBean); this.compareIds(new Integer [] { 1, 2, 3 }, ids); - searchBean = this._helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null); - ids = this._actionLoggerManager.getActionRecords(searchBean); + searchBean = _helper.createSearchBean("name", "Name", "space", "arams", DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm"), null); + ids = _actionLoggerManager.getActionRecords(searchBean); this.compareIds(new Integer [] { 3 }, ids); - searchBean = this._helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm")); - ids = this._actionLoggerManager.getActionRecords(searchBean); + searchBean = _helper.createSearchBean(null, null, null, null, null, DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm")); + ids = _actionLoggerManager.getActionRecords(searchBean); this.compareIds(new Integer [] { 1, 2 }, ids); - searchBean = this._helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), + searchBean = _helper.createSearchBean(null, "Name", null, null, DateConverter.parseDate("01/01/2009 09:01", "dd/MM/yyyy HH:mm"), DateConverter.parseDate("01/01/2009 10:01", "dd/MM/yyyy HH:mm")); - ids = this._actionLoggerManager.getActionRecords(searchBean); + ids = _actionLoggerManager.getActionRecords(searchBean); this.compareIds(new Integer [] { 2 }, ids); } @Test public void testAddGetDeleteActionRecord() throws Throwable { - ActionLogRecord record1 = this._helper.createActionRecord(0, "username1", "actionName1", "namespace1", null, "params1"); - ActionLogRecord record2 = this._helper.createActionRecord(0, "username2", "actionName2", "namespace2", null, "params2"); + ActionLogRecord record1 = _helper.createActionRecord(0, "username1", "actionName1", "namespace1", null, "params1"); + ActionLogRecord record2 = _helper.createActionRecord(0, "username2", "actionName2", "namespace2", null, "params2"); - this._actionLoggerManager.addActionRecord(record1); - this._actionLoggerManager.addActionRecord(record2); - super.waitThreads(IActionLogManager.LOG_APPENDER_THREAD_NAME_PREFIX); + _actionLoggerManager.addActionRecord(record1); + _actionLoggerManager.addActionRecord(record2); + waitThreads(IActionLogManager.LOG_APPENDER_THREAD_NAME_PREFIX); - ActionLogRecord addedRecord1 = this._actionLoggerManager.getActionRecord(record1.getId()); + ActionLogRecord addedRecord1 = _actionLoggerManager.getActionRecord(record1.getId()); this.compareActionRecords(record1, addedRecord1); - ActionLogRecord addedRecord2 = this._actionLoggerManager.getActionRecord(record2.getId()); + ActionLogRecord addedRecord2 = _actionLoggerManager.getActionRecord(record2.getId()); this.compareActionRecords(record2, addedRecord2); - this._actionLoggerManager.deleteActionRecord(record1.getId()); - assertNull(this._actionLoggerManager.getActionRecord(record1.getId())); + _actionLoggerManager.deleteActionRecord(record1.getId()); + assertNull(_actionLoggerManager.getActionRecord(record1.getId())); - this._actionLoggerManager.deleteActionRecord(record2.getId()); - assertNull(this._actionLoggerManager.getActionRecord(record2.getId())); + _actionLoggerManager.deleteActionRecord(record2.getId()); + assertNull(_actionLoggerManager.getActionRecord(record2.getId())); } private void compareIds(Integer[] expected, List received) { @@ -109,18 +109,18 @@ private void compareActionRecords(ActionLogRecord expected, ActionLogRecord rece } @BeforeAll - private void init() { - this._actionLoggerManager = (IActionLogManager) this.getService(SystemConstants.ACTION_LOGGER_MANAGER); - this._helper = new ActionLoggerTestHelper(this.getApplicationContext()); - this._helper.cleanRecords(); + public static void init() { + _actionLoggerManager = (IActionLogManager) getService(SystemConstants.ACTION_LOGGER_MANAGER); + _helper = new ActionLoggerTestHelper(getApplicationContext()); + _helper.cleanRecords(); } @AfterAll - protected void destroy() throws Exception { - this._helper.cleanRecords(); + protected static void destroy() throws Exception { + _helper.cleanRecords(); } - private IActionLogManager _actionLoggerManager; - private ActionLoggerTestHelper _helper; + private static IActionLogManager _actionLoggerManager; + private static ActionLoggerTestHelper _helper; -} \ No newline at end of file +} diff --git a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java index b99db2fdd..822e94bb6 100644 --- a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java +++ b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java @@ -387,7 +387,7 @@ private DataObject createDataObject_3() { } @BeforeEach - private void init() throws Exception { + public void init() throws Exception { try { this.dataObjectSearchEngineManager = (IDataObjectSearchEngineManager) this.getService("DataObjectSearchEngineManager"); this._categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER); From 6cf4479a202516910b600bdbcd9345360c9c8f71 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Tue, 8 Jul 2025 15:55:47 +0200 Subject: [PATCH 05/15] ENG-5566 Modified IT Localization for widget 'parent_widget' --- src/test/resources/sql/entandoPort_data_test.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/sql/entandoPort_data_test.sql b/src/test/resources/sql/entandoPort_data_test.sql index 4ec9b50f5..702360d52 100644 --- a/src/test/resources/sql/entandoPort_data_test.sql +++ b/src/test/resources/sql/entandoPort_data_test.sql @@ -438,7 +438,7 @@ INSERT INTO widgetcatalog (code, titles, parameters, plugincode, parenttypecode, INSERT INTO widgetcatalog (code, titles, parameters, plugincode, parenttypecode, defaultconfig, locked, maingroup, readonlypagewidgetconfig, widgetcategory) VALUES ('parent_widget', ' Parent Widget -Parent Widget em Italiano +Widget Genitore ', ' Description of the Widget Parameter From cda827b3937c9704ded7d45dd88a8befb1cc3953 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Tue, 8 Jul 2025 16:22:48 +0200 Subject: [PATCH 06/15] ENG-5566 The system reload now tracks which services encountered exceptions during the reload operation --- .../aps/util/ApsWebApplicationUtils.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index c5f803de3..6a189f1d8 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -18,6 +18,7 @@ import com.agiletec.aps.system.common.AbstractService; import com.agiletec.aps.system.common.RefreshableBean; import java.io.IOException; +import java.util.ArrayList; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletContext; @@ -133,26 +134,30 @@ private static AbstractService getService(String serviceName, WebApplicationCont /** * Esegue il refresh del sistema. + * * @param request La request. + * @return * @throws Throwable In caso di errori in fase di aggiornamento del sistema. */ - public static void executeSystemRefresh(HttpServletRequest request) throws Throwable { + public static ArrayList executeSystemRefresh(HttpServletRequest request) throws Throwable { WebApplicationContext wac = getWebApplicationContext(request); - executeSystemRefresh(wac); + return executeSystemRefresh(wac); } - public static void executeSystemRefresh(ServletContext svCtx) throws Throwable { + public static ArrayList executeSystemRefresh(ServletContext svCtx) throws Throwable { WebApplicationContext wac = getWebApplicationContext(svCtx); - executeSystemRefresh(wac); + return executeSystemRefresh(wac); } - private static void executeSystemRefresh(WebApplicationContext wac) throws Throwable { + private static ArrayList executeSystemRefresh(WebApplicationContext wac) throws Throwable { + final long startTime = System.currentTimeMillis(); + final ArrayList problematicBeans = new ArrayList<>(); + if (!isReloadInProgress.compareAndSet(false, true)) { ApsDeepDebug.print("service-reload","!!! " + Thread.currentThread().getName() + " tried to reload system services but another reload is in progress, aborting!!!"); logger.info("rejecting the reload of the configuration while still executing the previous one!"); - return; + return problematicBeans; } - final long startTime = System.currentTimeMillis(); reloadProgress.set(0); try { @@ -174,10 +179,12 @@ private static void executeSystemRefresh(WebApplicationContext wac) throws Throw reloadProgress.set(progress); reloadRefreshableBean(bean, beansNames[i], progress); } catch (Exception t) { + problematicBeans.add(beansNames[i]); ApsDeepDebug.print("service-reload", "RELOADING " + beansNames[i] + " COMPLETED WITH ERRORS"); logger.error("error in executeSystemRefresh", t); } } + return problematicBeans; } finally { isReloadInProgress.set(false); reloadProgress.set(0); From f5fbc06358619b34bc30519b6a6cfd78becea2ce Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Wed, 9 Jul 2025 16:10:52 +0200 Subject: [PATCH 07/15] ENG-5566 Code cleaning --- .../agiletec/aps/util/ApsWebApplicationUtils.java | 13 +++++++------ .../aps/system/services/lang/LangManagerTest.java | 2 +- .../system/services/actionlog/TestActionLogDAO.java | 8 ++++---- .../services/actionlog/TestActionLogManager.java | 8 ++++---- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index 6a189f1d8..3a0b96700 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -154,7 +154,8 @@ private static ArrayList executeSystemRefresh(WebApplicationContext wac) final ArrayList problematicBeans = new ArrayList<>(); if (!isReloadInProgress.compareAndSet(false, true)) { - ApsDeepDebug.print("service-reload","!!! " + Thread.currentThread().getName() + " tried to reload system services but another reload is in progress, aborting!!!"); + ApsDeepDebug.print("service-reload","!!! " + Thread.currentThread().getName() + + " tried to reload system services but another reload is in progress, aborting!!!"); // NOSONAR logger.info("rejecting the reload of the configuration while still executing the previous one!"); return problematicBeans; } @@ -180,7 +181,7 @@ private static ArrayList executeSystemRefresh(WebApplicationContext wac) reloadRefreshableBean(bean, beansNames[i], progress); } catch (Exception t) { problematicBeans.add(beansNames[i]); - ApsDeepDebug.print("service-reload", "RELOADING " + beansNames[i] + " COMPLETED WITH ERRORS"); + ApsDeepDebug.print("service-reload", "RELOADING " + beansNames[i] + " COMPLETED WITH ERRORS"); // NOSONAR logger.error("error in executeSystemRefresh", t); } } @@ -189,7 +190,7 @@ private static ArrayList executeSystemRefresh(WebApplicationContext wac) isReloadInProgress.set(false); reloadProgress.set(0); long endTime = System.currentTimeMillis(); - ApsDeepDebug.print("service-reload", "Tempo di esecuzione: " + (endTime - startTime) + " ms"); + ApsDeepDebug.print("service-reload", "Tempo di esecuzione: " + (endTime - startTime) + " ms"); // NOSONAR logger.info("reload configuration completed in {} ms", (endTime - startTime)); } } @@ -199,13 +200,13 @@ private static void reloadRefreshableBean(final Object bean, final String name, long currentServiceStart =0; long currentServiceEnd = 0; - ApsDeepDebug.print("service-reload", "RELOADING " + name + " start..."); + ApsDeepDebug.print("service-reload", "RELOADING " + name + " start..."); // NOSONAR currentServiceStart = System.currentTimeMillis(); ((RefreshableBean) bean).refresh(); currentServiceEnd = System.currentTimeMillis(); - ApsDeepDebug.print("service-reload", "RELOADING " + name + " completed in " + (currentServiceEnd - currentServiceStart) + " ms, " + progress + "% completed"); + ApsDeepDebug.print("service-reload", "RELOADING " + name + " completed in " + (currentServiceEnd - currentServiceStart) + " ms, " + progress + "% completed"); // NOSONAR } else { - ApsDeepDebug.print("service-reload", "THE BEAN WITH NAME " + name + " DOES NOT EXIST"); + ApsDeepDebug.print("service-reload", "THE BEAN WITH NAME " + name + " DOES NOT EXIST"); // NOSONAR } } diff --git a/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java b/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java index 481ae38ab..4da2e7c9e 100644 --- a/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java +++ b/src/test/java/com/agiletec/aps/system/services/lang/LangManagerTest.java @@ -47,7 +47,7 @@ class LangManagerTest { private LangManager langManager; @BeforeEach - public void setUp() throws Exception { + void setUp() { MockitoAnnotations.initMocks(LangManagerTest.class); } diff --git a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java index ab6b9bee8..41af46db2 100644 --- a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java +++ b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogDAO.java @@ -129,7 +129,7 @@ private void compareActionRecords(ActionLogRecord expected, ActionLogRecord rece } @BeforeEach - public void init() { + void init() { ActionLogDAO actionLoggerDAO = new ActionLogDAO(); DataSource dataSource = (DataSource) TestActionLogDAO.getApplicationContext().getBean("servDataSource"); actionLoggerDAO.setDataSource(dataSource); @@ -139,11 +139,11 @@ public void init() { } @AfterAll - protected static void destroy() throws Exception { + static void destroy() { TestActionLogDAO._helper.cleanRecords(); } - private static IActionLogDAO _actionLoggerDAO; - private static ActionLoggerTestHelper _helper; + private static IActionLogDAO _actionLoggerDAO; // NOSONAR + private static ActionLoggerTestHelper _helper; // NOSONAR } diff --git a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java index 0e0ba4540..36ec2409f 100644 --- a/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java +++ b/src/test/java/org/entando/entando/aps/system/services/actionlog/TestActionLogManager.java @@ -109,18 +109,18 @@ private void compareActionRecords(ActionLogRecord expected, ActionLogRecord rece } @BeforeAll - public static void init() { + static void init() { _actionLoggerManager = (IActionLogManager) getService(SystemConstants.ACTION_LOGGER_MANAGER); _helper = new ActionLoggerTestHelper(getApplicationContext()); _helper.cleanRecords(); } @AfterAll - protected static void destroy() throws Exception { + static void destroy() { _helper.cleanRecords(); } - private static IActionLogManager _actionLoggerManager; - private static ActionLoggerTestHelper _helper; + private static IActionLogManager _actionLoggerManager; // NOSONAR + private static ActionLoggerTestHelper _helper; // NOSONAR } From 1735bb95f385389ebf1ad72f9b067bf2c8cb0b46 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Wed, 9 Jul 2025 16:35:53 +0200 Subject: [PATCH 08/15] ENG-5566 Code cleaning --- .../java/com/agiletec/aps/util/ApsWebApplicationUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index 3a0b96700..a1bf30933 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -19,6 +19,7 @@ import com.agiletec.aps.system.common.RefreshableBean; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletContext; @@ -139,17 +140,17 @@ private static AbstractService getService(String serviceName, WebApplicationCont * @return * @throws Throwable In caso di errori in fase di aggiornamento del sistema. */ - public static ArrayList executeSystemRefresh(HttpServletRequest request) throws Throwable { + public static List executeSystemRefresh(HttpServletRequest request) throws Throwable { WebApplicationContext wac = getWebApplicationContext(request); return executeSystemRefresh(wac); } - public static ArrayList executeSystemRefresh(ServletContext svCtx) throws Throwable { + public static List executeSystemRefresh(ServletContext svCtx) throws Throwable { WebApplicationContext wac = getWebApplicationContext(svCtx); return executeSystemRefresh(wac); } - private static ArrayList executeSystemRefresh(WebApplicationContext wac) throws Throwable { + private static List executeSystemRefresh(WebApplicationContext wac) throws Throwable { final long startTime = System.currentTimeMillis(); final ArrayList problematicBeans = new ArrayList<>(); From d3b781bdbb907716346c12a7e8ef5eb72814b198 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Wed, 9 Jul 2025 19:28:05 +0200 Subject: [PATCH 09/15] ENG-5566 Added reload information --- .../aps/util/ApsWebApplicationUtils.java | 39 ++++++++++--------- .../TestSearchEngineManager.java | 2 +- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index a1bf30933..ae1ab55a2 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -18,8 +18,8 @@ import com.agiletec.aps.system.common.AbstractService; import com.agiletec.aps.system.common.RefreshableBean; import java.io.IOException; -import java.util.ArrayList; -import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletContext; @@ -39,6 +39,7 @@ public class ApsWebApplicationUtils { private static final AtomicBoolean isReloadInProgress = new AtomicBoolean(false); private static final AtomicInteger reloadProgress = new AtomicInteger(); + private static final Map reloadInfo = new ConcurrentHashMap<>(); private static final EntLogger logger = EntLogFactory.getSanitizedLogger(ApsWebApplicationUtils.class); @@ -121,8 +122,7 @@ public static Object getBean(String beanName, PageContext pageContext) { */ public static WebApplicationContext getWebApplicationContext(HttpServletRequest request) { ServletContext svCtx = request.getSession().getServletContext(); - WebApplicationContext wac = getWebApplicationContext(svCtx); - return wac; + return getWebApplicationContext(svCtx); } private static WebApplicationContext getWebApplicationContext(ServletContext svCtx) { @@ -137,30 +137,27 @@ private static AbstractService getService(String serviceName, WebApplicationCont * Esegue il refresh del sistema. * * @param request La request. - * @return * @throws Throwable In caso di errori in fase di aggiornamento del sistema. */ - public static List executeSystemRefresh(HttpServletRequest request) throws Throwable { + public static void executeSystemRefresh(HttpServletRequest request) throws Throwable { WebApplicationContext wac = getWebApplicationContext(request); - return executeSystemRefresh(wac); + executeSystemRefresh(wac); } - public static List executeSystemRefresh(ServletContext svCtx) throws Throwable { + public static void executeSystemRefresh(ServletContext svCtx) throws Throwable { WebApplicationContext wac = getWebApplicationContext(svCtx); - return executeSystemRefresh(wac); + executeSystemRefresh(wac); } - private static List executeSystemRefresh(WebApplicationContext wac) throws Throwable { + private static void executeSystemRefresh(WebApplicationContext wac) throws Throwable { final long startTime = System.currentTimeMillis(); - final ArrayList problematicBeans = new ArrayList<>(); if (!isReloadInProgress.compareAndSet(false, true)) { - ApsDeepDebug.print("service-reload","!!! " + Thread.currentThread().getName() + - " tried to reload system services but another reload is in progress, aborting!!!"); // NOSONAR + ApsDeepDebug.print("service-reload","!!! " + Thread.currentThread().getName() + " tried to reload system services but another reload is in progress, aborting!!!"); // NOSONAR logger.info("rejecting the reload of the configuration while still executing the previous one!"); - return problematicBeans; + return; } - + reloadInfo.clear(); reloadProgress.set(0); try { final RefreshableBean configManager = (RefreshableBean) wac.getBean(SystemConstants.BASE_CONFIG_MANAGER); @@ -180,18 +177,18 @@ private static List executeSystemRefresh(WebApplicationContext wac) thro final int progress = (int)(((i + 1) * 100.0) / beansCount); reloadProgress.set(progress); reloadRefreshableBean(bean, beansNames[i], progress); + reloadInfo.put(beansNames[i], ""); } catch (Exception t) { - problematicBeans.add(beansNames[i]); + reloadInfo.put(beansNames[i], t.getMessage()); ApsDeepDebug.print("service-reload", "RELOADING " + beansNames[i] + " COMPLETED WITH ERRORS"); // NOSONAR logger.error("error in executeSystemRefresh", t); } } - return problematicBeans; } finally { isReloadInProgress.set(false); reloadProgress.set(0); long endTime = System.currentTimeMillis(); - ApsDeepDebug.print("service-reload", "Tempo di esecuzione: " + (endTime - startTime) + " ms"); // NOSONAR + ApsDeepDebug.print("service-reload", "Execution time: " + (endTime - startTime) + " ms"); // NOSONAR logger.info("reload configuration completed in {} ms", (endTime - startTime)); } } @@ -207,7 +204,7 @@ private static void reloadRefreshableBean(final Object bean, final String name, currentServiceEnd = System.currentTimeMillis(); ApsDeepDebug.print("service-reload", "RELOADING " + name + " completed in " + (currentServiceEnd - currentServiceStart) + " ms, " + progress + "% completed"); // NOSONAR } else { - ApsDeepDebug.print("service-reload", "THE BEAN WITH NAME " + name + " DOES NOT EXIST"); // NOSONAR + ApsDeepDebug.print("service-reload", "the bean '" + name + "' DOES NOT EXIST!"); // NOSONAR } } @@ -218,4 +215,8 @@ public static boolean isReloadInProgress() { public static int getReloadProgress() { return reloadProgress.get(); } + + public static Map getReloadInfo() { + return reloadInfo; + } } diff --git a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java index 822e94bb6..b9434e43e 100644 --- a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java +++ b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java @@ -387,7 +387,7 @@ private DataObject createDataObject_3() { } @BeforeEach - public void init() throws Exception { + void init() throws Exception { try { this.dataObjectSearchEngineManager = (IDataObjectSearchEngineManager) this.getService("DataObjectSearchEngineManager"); this._categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER); From 4a062d1b8354ab9e30a87299628265b9e95a89e4 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Wed, 9 Jul 2025 19:41:22 +0200 Subject: [PATCH 10/15] ENG-5566 Code cleaning --- .../TestSearchEngineManager.java | 465 ++++++++---------- 1 file changed, 210 insertions(+), 255 deletions(-) diff --git a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java index b9434e43e..c4bf3cbe2 100644 --- a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java +++ b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java @@ -48,285 +48,244 @@ class TestSearchEngineManager extends BaseTestCase { @Test void testSearchAllContents() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - Set allowedGroup = new HashSet(); - SearchEngineFilter[] filters = {}; - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - List freeContentsId = sem.searchEntityId(filters, null, allowedGroup); - assertNotNull(freeContentsId); - allowedGroup.add(Group.ADMINS_GROUP_NAME); - List allContentsId = sem.searchEntityId(filters, null, allowedGroup); - assertNotNull(allContentsId); - assertTrue(allContentsId.size() > freeContentsId.size()); - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + Set allowedGroup = new HashSet(); + SearchEngineFilter[] filters = {}; + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + List freeContentsId = sem.searchEntityId(filters, null, allowedGroup); + assertNotNull(freeContentsId); + allowedGroup.add(Group.ADMINS_GROUP_NAME); + List allContentsId = sem.searchEntityId(filters, null, allowedGroup); + assertNotNull(allContentsId); + assertTrue(allContentsId.size() > freeContentsId.size()); + } @Test void testSearchContentsId_1() throws Throwable { - try { - DataObject content_1 = this.createDataObject_1(); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_1); - - DataObject content_2 = this.createDataObject_2(); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_2); - - List contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", null); - assertNotNull(contentsId); - assertTrue(contentsId.contains(content_1.getId())); - contentsId = this.dataObjectSearchEngineManager.searchEntityId("en", "Petersburg wonderful", null); - assertNotNull(contentsId); - assertTrue(contentsId.contains(content_1.getId())); - contentsId = this.dataObjectSearchEngineManager.searchEntityId("en", "meravigliosa", null); - assertNotNull(contentsId); - assertFalse(contentsId.contains(content_1.getId())); - } catch (Throwable t) { - throw t; - } - } + DataObject content_1 = this.createDataObject_1(); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_1); + + DataObject content_2 = this.createDataObject_2(); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_2); + + List contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", null); + assertNotNull(contentsId); + assertTrue(contentsId.contains(content_1.getId())); + contentsId = this.dataObjectSearchEngineManager.searchEntityId("en", "Petersburg wonderful", null); + assertNotNull(contentsId); + assertTrue(contentsId.contains(content_1.getId())); + contentsId = this.dataObjectSearchEngineManager.searchEntityId("en", "meravigliosa", null); + assertNotNull(contentsId); + assertFalse(contentsId.contains(content_1.getId())); + } @Test void testSearchContentsId_2() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - - Set allowedGroup = new HashSet(); - List contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "Corpo coach", allowedGroup); - assertNotNull(contentsId); - assertFalse(contentsId.contains("ART104")); - - allowedGroup.add("coach"); - contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "testo coach", allowedGroup); - assertNotNull(contentsId); - assertTrue(contentsId.contains("ART104"));//coach content - - contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "Titolo Evento 4", allowedGroup); - assertNotNull(contentsId); - assertTrue(contentsId.contains("EVN194"));//free content - - Set allowedGroup2 = new HashSet(); - allowedGroup2.add(Group.ADMINS_GROUP_NAME); - contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "testo coach", allowedGroup2); - assertNotNull(contentsId); - assertTrue(contentsId.contains("ART104"));//coach content - - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + + Set allowedGroup = new HashSet(); + List contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "Corpo coach", allowedGroup); + assertNotNull(contentsId); + assertFalse(contentsId.contains("ART104")); + + allowedGroup.add("coach"); + contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "testo coach", allowedGroup); + assertNotNull(contentsId); + assertTrue(contentsId.contains("ART104"));//coach content + + contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "Titolo Evento 4", allowedGroup); + assertNotNull(contentsId); + assertTrue(contentsId.contains("EVN194"));//free content + + Set allowedGroup2 = new HashSet(); + allowedGroup2.add(Group.ADMINS_GROUP_NAME); + contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "testo coach", allowedGroup2); + assertNotNull(contentsId); + assertTrue(contentsId.contains("ART104"));//coach content + } @Test void testSearchContentsId_3() throws Throwable { - try { - DataObject content_1 = this.createDataObject_1(); - content_1.setMainGroup(Group.ADMINS_GROUP_NAME); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_1); - - DataObject content_2 = this.createDataObject_2(); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_2); - - List allowedGroup = new ArrayList(); - allowedGroup.add(Group.FREE_GROUP_NAME); - List contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", allowedGroup); - assertNotNull(contentsId); - assertFalse(contentsId.contains(content_1.getId())); - allowedGroup.add("secondaryGroup"); - contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", allowedGroup); - assertNotNull(contentsId); - assertTrue(contentsId.contains(content_1.getId())); - } catch (Throwable t) { - throw t; - } - } + DataObject content_1 = this.createDataObject_1(); + content_1.setMainGroup(Group.ADMINS_GROUP_NAME); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_1); + + DataObject content_2 = this.createDataObject_2(); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_2); + + List allowedGroup = new ArrayList<>(); + allowedGroup.add(Group.FREE_GROUP_NAME); + List contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", allowedGroup); + assertNotNull(contentsId); + assertFalse(contentsId.contains(content_1.getId())); + allowedGroup.add("secondaryGroup"); + contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", allowedGroup); + assertNotNull(contentsId); + assertTrue(contentsId.contains(content_1.getId())); + } @Test void testSearchContentsId_4() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - SearchEngineFilter filterByType = new SearchEngineFilter(IIndexerDAO.DATAOBJECT_TYPE_FIELD_NAME, "ART"); - SearchEngineFilter[] filters = {filterByType}; - List allowedGroup = new ArrayList(); - allowedGroup.add(Group.FREE_GROUP_NAME); - List contentsId = sem.searchEntityId(filters, null, allowedGroup); - assertNotNull(contentsId); - String[] expected1 = {"ART180", "ART1", "ART187", "ART121"}; - this.verify(contentsId, expected1); - Category cat1 = this._categoryManager.getCategory("cat1"); - List categories = new ArrayList(); - categories.add(cat1); - contentsId = sem.searchEntityId(filters, categories, allowedGroup); - assertNotNull(contentsId); - String[] expected2 = {"ART180"}; - this.verify(contentsId, expected2); - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + SearchEngineFilter filterByType = new SearchEngineFilter(IIndexerDAO.DATAOBJECT_TYPE_FIELD_NAME, "ART"); + SearchEngineFilter[] filters = {filterByType}; + List allowedGroup = new ArrayList(); + allowedGroup.add(Group.FREE_GROUP_NAME); + List contentsId = sem.searchEntityId(filters, null, allowedGroup); + assertNotNull(contentsId); + String[] expected1 = {"ART180", "ART1", "ART187", "ART121"}; + this.verify(contentsId, expected1); + Category cat1 = this._categoryManager.getCategory("cat1"); + List categories = new ArrayList(); + categories.add(cat1); + contentsId = sem.searchEntityId(filters, categories, allowedGroup); + assertNotNull(contentsId); + String[] expected2 = {"ART180"}; + this.verify(contentsId, expected2); + } @Test void testSearchContentsId_5() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - Category general_cat2 = this._categoryManager.getCategory("general_cat2"); - List categories = new ArrayList(); - categories.add(general_cat2); - List allowedGroup = new ArrayList(); - allowedGroup.add(Group.FREE_GROUP_NAME); - List contentsId = sem.searchEntityId(null, categories, allowedGroup); - assertNotNull(contentsId); - assertTrue(contentsId.isEmpty()); - allowedGroup.add(Group.ADMINS_GROUP_NAME); - contentsId = sem.searchEntityId(null, categories, allowedGroup); - String[] expected1 = {"ART111", "ART120"}; - this.verify(contentsId, expected1); - Category general_cat1 = this._categoryManager.getCategory("general_cat1"); - categories.add(general_cat1); - contentsId = sem.searchEntityId(null, categories, allowedGroup); - assertNotNull(contentsId); - String[] expected2 = {"ART111"}; - this.verify(contentsId, expected2); - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + Category general_cat2 = this._categoryManager.getCategory("general_cat2"); + List categories = new ArrayList<>(); + categories.add(general_cat2); + List allowedGroup = new ArrayList<>(); + allowedGroup.add(Group.FREE_GROUP_NAME); + List contentsId = sem.searchEntityId(null, categories, allowedGroup); + assertNotNull(contentsId); + assertTrue(contentsId.isEmpty()); + allowedGroup.add(Group.ADMINS_GROUP_NAME); + contentsId = sem.searchEntityId(null, categories, allowedGroup); + String[] expected1 = {"ART111", "ART120"}; + this.verify(contentsId, expected1); + Category general_cat1 = this._categoryManager.getCategory("general_cat1"); + categories.add(general_cat1); + contentsId = sem.searchEntityId(null, categories, allowedGroup); + assertNotNull(contentsId); + String[] expected2 = {"ART111"}; + this.verify(contentsId, expected2); + } @Disabled("temporary disabling") @Test void testSearchContentsId_6() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - Category general = this._categoryManager.getCategory("general"); - List categories = new ArrayList(); - categories.add(general); - List allowedGroup = new ArrayList(); - allowedGroup.add(Group.ADMINS_GROUP_NAME); - List contentsId = sem.searchEntityId(null, categories, allowedGroup); - assertNotNull(contentsId); - String[] expected1 = {"ART122", "ART102", "ART111", "ART120"}; - this.verify(contentsId, expected1); - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + Category general = this._categoryManager.getCategory("general"); + List categories = new ArrayList<>(); + categories.add(general); + List allowedGroup = new ArrayList<>(); + allowedGroup.add(Group.ADMINS_GROUP_NAME); + List contentsId = sem.searchEntityId(null, categories, allowedGroup); + assertNotNull(contentsId); + String[] expected1 = {"ART122", "ART102", "ART111", "ART120"}; + this.verify(contentsId, expected1); + } @Test void testSearchContentsId_7() throws Throwable { - try { - DataObject content_1 = this.createDataObject_1(); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_1); - - DataObject content_2 = this.createDataObject_2(); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_2); - - DataObject content_3 = this.createDataObject_3(); - this.dataObjectSearchEngineManager.deleteIndexedEntity(content_3.getId()); - this.dataObjectSearchEngineManager.addEntityToIndex(content_3); - - //San Pietroburgo è una città meravigliosa W3C-WAI - //100 - //Il turismo ha incrementato più del 20 per cento nel 2011-2013, quando la Croazia ha aderito all'Unione europea. Consegienda di questo aumento è una serie di modernizzazione di alloggi di recente costruzione, tra cui circa tre dozzine di ostelli. - //101 - //La vita è una cosa meravigliosa - //103 - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - - List allowedGroup = new ArrayList(); - allowedGroup.add(Group.FREE_GROUP_NAME); - SearchEngineFilter filter1 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.ALL_WORDS); - SearchEngineFilter[] filters1 = {filter1}; - List contentsId = sem.searchEntityId(filters1, null, allowedGroup); - assertNotNull(contentsId); - assertEquals(1, contentsId.size()); - assertTrue(contentsId.contains(content_1.getId())); - - SearchEngineFilter filter2 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.AT_LEAST_ONE_WORD); - SearchEngineFilter[] filters2 = {filter2}; - contentsId = sem.searchEntityId(filters2, null, allowedGroup); - assertNotNull(contentsId); - assertEquals(2, contentsId.size()); - assertTrue(contentsId.contains(content_1.getId())); - assertTrue(contentsId.contains(content_3.getId())); - - SearchEngineFilter filter3 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.EXACT); - SearchEngineFilter[] filters3 = {filter3}; - contentsId = sem.searchEntityId(filters3, null, allowedGroup); - assertNotNull(contentsId); - assertEquals(0, contentsId.size()); - - SearchEngineFilter filter4 = new SearchEngineFilter("it", "una cosa meravigliosa", SearchEngineFilter.TextSearchOption.EXACT); - SearchEngineFilter[] filters4 = {filter4}; - contentsId = sem.searchEntityId(filters4, null, allowedGroup); - assertNotNull(contentsId); - assertEquals(1, contentsId.size()); - assertTrue(contentsId.contains(content_3.getId())); - } catch (Throwable t) { - throw t; - } - } + DataObject content_1 = this.createDataObject_1(); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_1); + + DataObject content_2 = this.createDataObject_2(); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_2); + + DataObject content_3 = this.createDataObject_3(); + this.dataObjectSearchEngineManager.deleteIndexedEntity(content_3.getId()); + this.dataObjectSearchEngineManager.addEntityToIndex(content_3); + + //San Pietroburgo è una città meravigliosa W3C-WAI + //100 + //Il turismo ha incrementato più del 20 per cento nel 2011-2013, quando la Croazia ha aderito all'Unione europea. Consegienda di questo aumento è una serie di modernizzazione di alloggi di recente costruzione, tra cui circa tre dozzine di ostelli. + //101 + //La vita è una cosa meravigliosa + //103 + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + + List allowedGroup = new ArrayList(); + allowedGroup.add(Group.FREE_GROUP_NAME); + SearchEngineFilter filter1 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.ALL_WORDS); + SearchEngineFilter[] filters1 = {filter1}; + List contentsId = sem.searchEntityId(filters1, null, allowedGroup); + assertNotNull(contentsId); + assertEquals(1, contentsId.size()); + assertTrue(contentsId.contains(content_1.getId())); + + SearchEngineFilter filter2 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.AT_LEAST_ONE_WORD); + SearchEngineFilter[] filters2 = {filter2}; + contentsId = sem.searchEntityId(filters2, null, allowedGroup); + assertNotNull(contentsId); + assertEquals(2, contentsId.size()); + assertTrue(contentsId.contains(content_1.getId())); + assertTrue(contentsId.contains(content_3.getId())); + + SearchEngineFilter filter3 = new SearchEngineFilter("it", "San meravigliosa", SearchEngineFilter.TextSearchOption.EXACT); + SearchEngineFilter[] filters3 = {filter3}; + contentsId = sem.searchEntityId(filters3, null, allowedGroup); + assertNotNull(contentsId); + assertEquals(0, contentsId.size()); + + SearchEngineFilter filter4 = new SearchEngineFilter("it", "una cosa meravigliosa", SearchEngineFilter.TextSearchOption.EXACT); + SearchEngineFilter[] filters4 = {filter4}; + contentsId = sem.searchEntityId(filters4, null, allowedGroup); + assertNotNull(contentsId); + assertEquals(1, contentsId.size()); + assertTrue(contentsId.contains(content_3.getId())); + } @Test void testFacetedAllContents() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - Set allowedGroup = new HashSet(); - allowedGroup.add(Group.ADMINS_GROUP_NAME); - SearchEngineFilter[] filters = {}; - FacetedContentsResult result = sem.searchFacetedEntities(filters, null, allowedGroup); - assertNotNull(result); - assertNotNull(result.getContentsId()); - assertNotNull(result.getOccurrences()); - assertTrue(result.getContentsId().size() > 0); - assertTrue(result.getOccurrences().size() > 0); - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + Set allowedGroup = new HashSet<>(); + allowedGroup.add(Group.ADMINS_GROUP_NAME); + SearchEngineFilter[] filters = {}; + FacetedContentsResult result = sem.searchFacetedEntities(filters, null, allowedGroup); + assertNotNull(result); + assertNotNull(result.getContentsId()); + assertNotNull(result.getOccurrences()); + assertTrue(result.getContentsId().size() > 0); + assertTrue(result.getOccurrences().size() > 0); + } @Test void testSearchFacetedContents_1() throws Throwable { - try { - Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); - thread.join(); - SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; - Category general = this._categoryManager.getCategory("general"); - List categories = new ArrayList(); - categories.add(general); - List allowedGroup = new ArrayList(); - allowedGroup.add(Group.FREE_GROUP_NAME); - allowedGroup.add(Group.ADMINS_GROUP_NAME); - FacetedContentsResult result = sem.searchFacetedEntities(null, categories, allowedGroup); - assertNotNull(result); - String[] expected1 = {"ART122", "ART102", "ART111", "ART120"}; - this.verify(result.getContentsId(), expected1); - assertEquals(4, result.getOccurrences().size()); - } catch (Throwable t) { - throw t; - } - } + Thread thread = this.dataObjectSearchEngineManager.startReloadDataObjectsReferences(); + thread.join(); + SearchEngineManager sem = (SearchEngineManager) this.dataObjectSearchEngineManager; + Category general = this._categoryManager.getCategory("general"); + List categories = new ArrayList<>(); + categories.add(general); + List allowedGroup = new ArrayList<>(); + allowedGroup.add(Group.FREE_GROUP_NAME); + allowedGroup.add(Group.ADMINS_GROUP_NAME); + FacetedContentsResult result = sem.searchFacetedEntities(null, categories, allowedGroup); + assertNotNull(result); + String[] expected1 = {"ART122", "ART102", "ART111", "ART120"}; + this.verify(result.getContentsId(), expected1); + assertEquals(4, result.getOccurrences().size()); + } private void verify(List contentsId, String[] array) { assertEquals(array.length, contentsId.size()); - for (int i = 0; i < array.length; i++) { - assertTrue(contentsId.contains(array[i])); - } + for (String s : array) { + assertTrue(contentsId.contains(s)); + } } private DataObject createDataObject_1() { @@ -388,13 +347,9 @@ private DataObject createDataObject_3() { @BeforeEach void init() throws Exception { - try { - this.dataObjectSearchEngineManager = (IDataObjectSearchEngineManager) this.getService("DataObjectSearchEngineManager"); - this._categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER); - } catch (Exception e) { - throw e; - } - } + this.dataObjectSearchEngineManager = (IDataObjectSearchEngineManager) this.getService("DataObjectSearchEngineManager"); + this._categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER); + } private IDataObjectSearchEngineManager dataObjectSearchEngineManager = null; private ICategoryManager _categoryManager; From 4514486d3e220e01545e25d79ceb92940c57621b Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Mon, 14 Jul 2025 17:06:04 +0200 Subject: [PATCH 11/15] ENG-5566 Modified exit value for reloading configuration operation --- .../java/com/agiletec/aps/util/ApsWebApplicationUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index ae1ab55a2..7ee843761 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -186,7 +186,7 @@ private static void executeSystemRefresh(WebApplicationContext wac) throws Throw } } finally { isReloadInProgress.set(false); - reloadProgress.set(0); + reloadProgress.set(-1); long endTime = System.currentTimeMillis(); ApsDeepDebug.print("service-reload", "Execution time: " + (endTime - startTime) + " ms"); // NOSONAR logger.info("reload configuration completed in {} ms", (endTime - startTime)); @@ -195,8 +195,8 @@ private static void executeSystemRefresh(WebApplicationContext wac) throws Throw private static void reloadRefreshableBean(final Object bean, final String name, final int progress) throws Throwable { if (bean != null) { - long currentServiceStart =0; - long currentServiceEnd = 0; + long currentServiceStart; + long currentServiceEnd; ApsDeepDebug.print("service-reload", "RELOADING " + name + " start..."); // NOSONAR currentServiceStart = System.currentTimeMillis(); From 3c392ebe6304fdc9f16ae3086d1287a39da24b23 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Mon, 14 Jul 2025 17:06:32 +0200 Subject: [PATCH 12/15] ENG-5566 Code cleaning --- .../TestSearchEngineManager.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java index c4bf3cbe2..862042075 100644 --- a/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java +++ b/src/test/java/org/entando/entando/aps/system/services/dataobjectsearchengine/TestSearchEngineManager.java @@ -18,11 +18,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - import com.agiletec.aps.BaseTestCase; import com.agiletec.aps.system.SystemConstants; import com.agiletec.aps.system.common.entity.model.attribute.TextAttribute; @@ -31,6 +26,10 @@ import com.agiletec.aps.system.services.category.Category; import com.agiletec.aps.system.services.category.ICategoryManager; import com.agiletec.aps.system.services.group.Group; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.entando.entando.aps.system.services.dataobject.model.DataObject; import org.entando.entando.aps.system.services.searchengine.FacetedContentsResult; import org.entando.entando.aps.system.services.searchengine.SearchEngineFilter; @@ -346,7 +345,7 @@ private DataObject createDataObject_3() { } @BeforeEach - void init() throws Exception { + void init() { this.dataObjectSearchEngineManager = (IDataObjectSearchEngineManager) this.getService("DataObjectSearchEngineManager"); this._categoryManager = (ICategoryManager) this.getService(SystemConstants.CATEGORY_MANAGER); } From 98f7226ea3694350a36b42694f09e20a1b633436 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Mon, 14 Jul 2025 17:23:27 +0200 Subject: [PATCH 13/15] ENG-5566 Imposed initial value of the reload progress value --- src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java index 7ee843761..5ab3e02e9 100644 --- a/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java +++ b/src/main/java/com/agiletec/aps/util/ApsWebApplicationUtils.java @@ -38,7 +38,7 @@ public class ApsWebApplicationUtils { private static final AtomicBoolean isReloadInProgress = new AtomicBoolean(false); - private static final AtomicInteger reloadProgress = new AtomicInteger(); + private static final AtomicInteger reloadProgress = new AtomicInteger(-1); private static final Map reloadInfo = new ConcurrentHashMap<>(); private static final EntLogger logger = EntLogFactory.getSanitizedLogger(ApsWebApplicationUtils.class); From 002c128ad6c39ba26a80b1958d4bc7fc9d7159f4 Mon Sep 17 00:00:00 2001 From: "Matteo E. Minnai" Date: Thu, 18 Sep 2025 16:17:08 +0200 Subject: [PATCH 14/15] ENG-5566: NIO error suppression feature flag --- .../aps/servlet/IFSuppressNIOException.java | 32 +++++++++++++++++++ .../ProtectedResourceWardenServlet.java | 6 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/entando/entando/aps/servlet/IFSuppressNIOException.java diff --git a/src/main/java/org/entando/entando/aps/servlet/IFSuppressNIOException.java b/src/main/java/org/entando/entando/aps/servlet/IFSuppressNIOException.java new file mode 100644 index 000000000..f143520d3 --- /dev/null +++ b/src/main/java/org/entando/entando/aps/servlet/IFSuppressNIOException.java @@ -0,0 +1,32 @@ +package org.entando.entando.aps.servlet; + +import java.io.IOException; +import org.entando.entando.aps.system.services.IFeatureFlag; + +public interface IFSuppressNIOException { + boolean SUPPRESS_NIO_EXCEPTIONS = IFeatureFlag.readEnablementStatus("SUPPRESS_NIO_EXCEPTIONS"); + + static boolean isBrokenPipeOrConnectionReset(Throwable t) { + Throwable cause = t; + + while (cause != null) { + if (cause instanceof IOException) { + String message = cause.getMessage(); + if (message != null) { + String lowerMsg = message.toLowerCase(); + if (lowerMsg.contains("broken pipe") + || lowerMsg.contains("connection reset")) { + return true; + } + } + } + cause = cause.getCause(); + } + return false; + } + + + default boolean isEnabled() { + return SUPPRESS_NIO_EXCEPTIONS ; + } +} diff --git a/src/main/java/org/entando/entando/aps/servlet/ProtectedResourceWardenServlet.java b/src/main/java/org/entando/entando/aps/servlet/ProtectedResourceWardenServlet.java index d0afda883..9864ae695 100644 --- a/src/main/java/org/entando/entando/aps/servlet/ProtectedResourceWardenServlet.java +++ b/src/main/java/org/entando/entando/aps/servlet/ProtectedResourceWardenServlet.java @@ -29,7 +29,7 @@ * This servlet handles the requests for protected resources. * @author E.Santoboni */ -public class ProtectedResourceWardenServlet extends HttpServlet { +public class ProtectedResourceWardenServlet extends HttpServlet implements IFSuppressNIOException { private static final EntLogger _logger = EntLogFactory.getSanitizedLogger(ProtectedResourceWardenServlet.class); @@ -49,7 +49,9 @@ protected void service(HttpServletRequest request, HttpServletResponse response) } } } catch (Throwable t) { - _logger.error("Error providing protected resource", t); + if (!isEnabled()) { + _logger.error("Error providing protected resource", t); + } throw new ServletException("Error providing protected resource", t); } } From 2b07218f2b90ac8a0cc4ec202fce6b00b79f8c12 Mon Sep 17 00:00:00 2001 From: Elia Mezzano Date: Tue, 21 Oct 2025 16:25:12 +0200 Subject: [PATCH 15/15] Bump version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 560f9348f..a95fd4489 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.entando.entando entando-engine jar - 6.6.0 + 6.6.1 Entando Core: Engine Entando Engine: an agile, modern and user-centric open source Portal platform. http://www.entando.com/