From e290ff72d0e073b997d1a1efe280bca35c56b029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Wed, 8 Apr 2026 13:35:02 +0200 Subject: [PATCH 01/16] run correct service in case of Modulith test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../org/zowe/apiml/functional/caching/JGroupStabilityTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 2e50493198..b8fbcd6152 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -194,7 +194,7 @@ public void start() { env.put("attlsEnabledOnInfinispanTest", isAttls ? "true" : "false"); env.put("ZWE_zowe_network_client_tls_attls", isAttls ? "true" : "false"); - ProcessBuilder builder = new ProcessBuilder("caching-service-package/src/main/resources/bin/start.sh"); + ProcessBuilder builder = new ProcessBuilder((isModulith ? "apiml" : "caching-service") + "-package/src/main/resources/bin/start.sh"); builder.environment().putAll(env); File binFolder = new File("../"); From 7b8520708db93fca56fe228f3dd3ee51c904c235 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Wed, 8 Apr 2026 14:46:17 +0200 Subject: [PATCH 02/16] fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../apiml/functional/caching/JGroupStabilityTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index b8fbcd6152..907e79d380 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -167,7 +167,9 @@ static class CachingService { public void start() { int basePort = BASE_PORTS[index]; - log.info("Starting caching service on port {}", basePort); + String service = isModulith ? "apiml" : "caching-service"; + + log.info("Starting {} on port {}", service, basePort); var env = new HashMap(); env.put("ZWE_haInstance_id", "localhost" + String.valueOf(basePort).charAt(0)); @@ -194,7 +196,11 @@ public void start() { env.put("attlsEnabledOnInfinispanTest", isAttls ? "true" : "false"); env.put("ZWE_zowe_network_client_tls_attls", isAttls ? "true" : "false"); - ProcessBuilder builder = new ProcessBuilder((isModulith ? "apiml" : "caching-service") + "-package/src/main/resources/bin/start.sh"); + if (isAttls) { + env.put("ZWE_configs_internal_discovery_port", String.valueOf(basePort + 1)); + } + + ProcessBuilder builder = new ProcessBuilder(service + "-package/src/main/resources/bin/start.sh"); builder.environment().putAll(env); File binFolder = new File("../"); From a41de6f9d72b3d081cb50c158ed61055f6f7ac34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Wed, 8 Apr 2026 18:05:25 +0200 Subject: [PATCH 03/16] log error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../caching/JGroupStabilityTest.java | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 907e79d380..852aa5f0d8 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -214,22 +214,35 @@ public void start() { } } + void readLogs(InputStream inputStream, Consumer onPid, Consumer logConsumer) throws IOException { + try ( + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)) + ) { + String line; + while ((line = bufferedReader.readLine()) != null) { + if (line.startsWith("pid=")) { + onPid.accept(line.substring("pid=".length()).trim()); + } + logConsumer.accept(line); + } + } catch (IOException ioException) { + log.error("Cannot read log", ioException); + } + } + void readLogs(Process process, Consumer onPid) { executorService.submit(() -> { - try ( - InputStream inputStream = process.getInputStream(); - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)) - ) { - String line; - while ((line = bufferedReader.readLine()) != null) { - if (line.startsWith("pid=")) { - onPid.accept(line.substring("pid=".length()).trim()); - } - log.info(line); - } + try (InputStream inputStream = process.getInputStream()) { + readLogs(inputStream, onPid, log::info); } catch (IOException ioException) { log.error("Cannot read log", ioException); } + + try (InputStream inputStream = process.getErrorStream()) { + readLogs(inputStream, pid -> {}, log::info); + } catch (IOException ioException) { + log.error("Cannot read error log", ioException); + } }); } From 944c3fb7a66d6b0f5651382363d633cb0ee449f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Wed, 8 Apr 2026 18:28:04 +0200 Subject: [PATCH 04/16] log error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../caching/JGroupStabilityTest.java | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 852aa5f0d8..424a958682 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -214,40 +214,28 @@ public void start() { } } - void readLogs(InputStream inputStream, Consumer onPid, Consumer logConsumer) throws IOException { - try ( - BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)) - ) { - String line; - while ((line = bufferedReader.readLine()) != null) { - if (line.startsWith("pid=")) { - onPid.accept(line.substring("pid=".length()).trim()); - } - logConsumer.accept(line); - } - } catch (IOException ioException) { - log.error("Cannot read log", ioException); - } - } - void readLogs(Process process, Consumer onPid) { executorService.submit(() -> { - try (InputStream inputStream = process.getInputStream()) { - readLogs(inputStream, onPid, log::info); + try ( + InputStream inputStream = process.getInputStream(); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)) + ) { + String line; + while ((line = bufferedReader.readLine()) != null) { + if (line.startsWith("pid=")) { + onPid.accept(line.substring("pid=".length()).trim()); + } + log.info(line); + } } catch (IOException ioException) { log.error("Cannot read log", ioException); } - - try (InputStream inputStream = process.getErrorStream()) { - readLogs(inputStream, pid -> {}, log::info); - } catch (IOException ioException) { - log.error("Cannot read error log", ioException); - } }); } void issue(String... parts) { ProcessBuilder builder = new ProcessBuilder(parts); + builder.redirectErrorStream(true); try { var process = builder.start(); readLogs(process, pid -> { From 96ba5b444bc11ec602e15160ed09f701308e47e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Thu, 9 Apr 2026 13:13:24 +0200 Subject: [PATCH 05/16] fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../zowe/apiml/functional/caching/JGroupStabilityTest.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 424a958682..3e6af117cf 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -174,8 +174,8 @@ public void start() { var env = new HashMap(); env.put("ZWE_haInstance_id", "localhost" + String.valueOf(basePort).charAt(0)); env.put("APIML_ENABLED", isModulith ? "true" : "false"); - env.put("logbackService", "ZWEACS" + (index + 1)); - env.put("LAUNCH_COMPONENT", "caching-service/build/libs"); + env.put("logbackService", (isModulith ? "ZWEGW" : "ZWEACS") + (index + 1)); + env.put("LAUNCH_COMPONENT", service + "/build/libs"); env.put("ZWE_configs_port", String.valueOf(basePort + 25)); @@ -196,8 +196,9 @@ public void start() { env.put("attlsEnabledOnInfinispanTest", isAttls ? "true" : "false"); env.put("ZWE_zowe_network_client_tls_attls", isAttls ? "true" : "false"); - if (isAttls) { + if (isModulith) { env.put("ZWE_configs_internal_discovery_port", String.valueOf(basePort + 1)); + env.put("ZWE_configs_apiml_security_authorization_provider", "dummy"); } ProcessBuilder builder = new ProcessBuilder(service + "-package/src/main/resources/bin/start.sh"); From ae7e4710b83f3f0befcb72f2a2c55aee4835b050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Thu, 23 Apr 2026 17:51:27 +0200 Subject: [PATCH 06/16] disable cache metrics endpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- apiml/src/main/java/org/zowe/apiml/ApimlApplication.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apiml/src/main/java/org/zowe/apiml/ApimlApplication.java b/apiml/src/main/java/org/zowe/apiml/ApimlApplication.java index 174d94a367..cc9212973b 100644 --- a/apiml/src/main/java/org/zowe/apiml/ApimlApplication.java +++ b/apiml/src/main/java/org/zowe/apiml/ApimlApplication.java @@ -12,6 +12,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.actuate.autoconfigure.logging.OpenTelemetryLoggingAutoConfiguration; +import org.springframework.boot.actuate.autoconfigure.metrics.cache.CacheMetricsAutoConfiguration; import org.springframework.boot.actuate.autoconfigure.opentelemetry.OpenTelemetryAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration; @@ -28,7 +29,8 @@ ReactiveOAuth2ClientAutoConfiguration.class, OpenTelemetryAutoConfiguration.class, OpenTelemetryLoggingAutoConfiguration.class, - io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration.class + io.opentelemetry.instrumentation.spring.autoconfigure.OpenTelemetryAutoConfiguration.class, + CacheMetricsAutoConfiguration.class }, scanBasePackages = { "org.zowe.apiml.filter", From 26e943cd0a4491ae54962ed831992f0227e79ff6 Mon Sep 17 00:00:00 2001 From: nxhafa Date: Fri, 24 Apr 2026 10:53:20 +0200 Subject: [PATCH 07/16] fix Signed-off-by: nxhafa --- .../caching/JGroupStabilityTest.java | 17 +++++---- .../service/AuthenticationService.java | 36 ++++++++++++++----- .../service/AuthenticationServiceTest.java | 4 +-- 3 files changed, 40 insertions(+), 17 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 3e6af117cf..04e65c6116 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -82,7 +82,7 @@ void givenTwoInstances_whenOneHasADelay_thenClusterIsRebuilt(boolean isModulith, cachingServices.forEach(CachingService::start); await() .pollDelay(10, TimeUnit.SECONDS) - .timeout(2, TimeUnit.MINUTES) + .timeout(isModulith ? 8 : 2, TimeUnit.MINUTES) .until(() -> cachingServices.stream().allMatch(CachingService::isUp)); cachingServices.get(0).pause(); @@ -169,10 +169,10 @@ public void start() { int basePort = BASE_PORTS[index]; String service = isModulith ? "apiml" : "caching-service"; - log.info("Starting {} on port {}", service, basePort); + log.info("Starting {} on ports based on {}", service, basePort); var env = new HashMap(); - env.put("ZWE_haInstance_id", "localhost" + String.valueOf(basePort).charAt(0)); + env.put("ZWE_haInstance_id", "localhost" + (index + 1)); env.put("APIML_ENABLED", isModulith ? "true" : "false"); env.put("logbackService", (isModulith ? "ZWEGW" : "ZWEACS") + (index + 1)); env.put("LAUNCH_COMPONENT", service + "/build/libs"); @@ -180,7 +180,8 @@ public void start() { env.put("ZWE_configs_port", String.valueOf(basePort + 25)); env.put("ZWE_configs_storage_infinispan_jgroups_port", String.valueOf(basePort + 600)); - env.put("ZWE_configs_storage_infinispan_jgroups_keyExchange_port", String.valueOf(BASE_PORTS[0] + 601)); + env.put("ZWE_configs_storage_infinispan_jgroups_host", "localhost"); + env.put("ZWE_configs_storage_infinispan_jgroups_keyExchange_port", String.valueOf(basePort + 601)); env.put("ZWE_configs_storage_infinispan_initialHosts", Arrays.stream(BASE_PORTS).mapToObj(bp -> "localhost[" + (bp + 600) + "]").collect(Collectors.joining(","))); env.put("ZWE_configs_storage_mode", "infinispan"); @@ -194,11 +195,13 @@ public void start() { env.put("ZWE_configs_apiml_health_protected", "false"); env.put("attlsEnabledOnInfinispanTest", isAttls ? "true" : "false"); - env.put("ZWE_zowe_network_client_tls_attls", isAttls ? "true" : "false"); if (isModulith) { + env.put("CMMN_LB", "build/libs/api-layer-lite-lib-all.jar"); env.put("ZWE_configs_internal_discovery_port", String.valueOf(basePort + 1)); env.put("ZWE_configs_apiml_security_authorization_provider", "dummy"); + env.put("ZWE_components_gateway_apiml_security_auth_provider", "saf"); + env.put("ZWE_DISCOVERY_SERVICES_LIST", Arrays.stream(BASE_PORTS).mapToObj(bp -> "https://localhost:" + (bp + 1) + "/eureka/").collect(Collectors.joining(","))); } ProcessBuilder builder = new ProcessBuilder(service + "-package/src/main/resources/bin/start.sh"); @@ -271,7 +274,7 @@ public void kill() { public boolean isUp() { int basePort = BASE_PORTS[index]; - HttpGet request = new HttpGet("https://localhost:" + (basePort + 25) + "/cachingservice/application/health"); + HttpGet request = new HttpGet("https://localhost:" + (basePort + 25) + (isModulith ? "" : "/cachingservice") + "/application/health"); request.addHeader(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE); try (CloseableHttpClient client = HttpClients.custom().setSSLContext(ignoreSslContext()).setSSLHostnameVerifier(new NoopHostnameVerifier()).build()) { final HttpResponse response = client.execute(request); @@ -279,7 +282,7 @@ public boolean isUp() { log.trace("URI: {}, JsonResponse is {}", request.getURI().toString(), jsonResponse); if (StringUtils.isNotEmpty(jsonResponse)) { - var status = JsonPath.parse(jsonResponse).read("components.caching.details.infinispan.cluster.status", String.class); + var status = JsonPath.parse(jsonResponse).read(isModulith ? "components.infinispan.status" : "components.caching.details.infinispan.cluster.status", String.class); return "UP".equals(status); } return false; diff --git a/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java b/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java index 99a3a2d317..717c713db6 100644 --- a/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java +++ b/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java @@ -51,12 +51,7 @@ import org.zowe.apiml.zaas.security.service.zosmf.ZosmfService; import java.text.ParseException; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import static org.zowe.apiml.security.common.util.JwtUtils.getJwtClaims; import static org.zowe.apiml.security.common.util.JwtUtils.handleJwtParserException; @@ -95,8 +90,28 @@ public class AuthenticationService { @PostConstruct public void afterPropertiesSet() { isModulithMode = applicationContext.containsBean("modulithConfig"); - validatedJwtTokensCache = cacheManager.getCache(CACHE_VALIDATED_JWT_TOKENS); - invalidatedJwtTokensCache = cacheManager.getCache(CACHE_INVALIDATED_JWT_TOKENS); + } + + private Cache getValidatedJwtTokensCache() { + if (validatedJwtTokensCache == null) { + synchronized (AuthenticationService.class) { + if (validatedJwtTokensCache == null) { + validatedJwtTokensCache = cacheManager.getCache(CACHE_VALIDATED_JWT_TOKENS); + } + } + } + return validatedJwtTokensCache; + } + + private Cache getInvalidatedJwtTokensCache() { + if (invalidatedJwtTokensCache == null) { + synchronized (AuthenticationService.class) { + if (invalidatedJwtTokensCache == null) { + invalidatedJwtTokensCache = cacheManager.getCache(CACHE_INVALIDATED_JWT_TOKENS); + } + } + } + return invalidatedJwtTokensCache; } /** @@ -229,18 +244,21 @@ private Boolean doInvalidate(String jwtToken, boolean distribute, Application ap } private void putValidationCache(String jwtToken, TokenAuthentication tokenAuthentication) { + var validatedJwtTokensCache = getValidatedJwtTokensCache(); if (jwtToken != null && validatedJwtTokensCache != null) { validatedJwtTokensCache.put(jwtToken, tokenAuthentication); } } private void evictValidationCache(String jwtToken) { + var validatedJwtTokensCache = getValidatedJwtTokensCache(); if (validatedJwtTokensCache != null) { validatedJwtTokensCache.evict(jwtToken); } } private void putInvalidatedCache(String jwtToken) { + var invalidatedJwtTokensCache = getInvalidatedJwtTokensCache(); if (invalidatedJwtTokensCache != null) { invalidatedJwtTokensCache.put(jwtToken, Boolean.TRUE); } @@ -307,6 +325,7 @@ private boolean invalidateTokenOnAnotherInstance(String jwtToken, Application ap * @return true - token is invalidated, otherwise token is still valid */ public boolean isInvalidated(String jwtToken) { + var invalidatedJwtTokensCache = getInvalidatedJwtTokensCache(); if (invalidatedJwtTokensCache == null) { return false; } @@ -361,6 +380,7 @@ public TokenAuthentication validateJwtToken(String jwtToken) { throw new TokenNotValidException("Token ...%s was invalidated.".formatted(StringUtils.right(jwtToken, 15))); } + var validatedJwtTokensCache = getValidatedJwtTokensCache(); if (validatedJwtTokensCache != null) { Cache.ValueWrapper cached = validatedJwtTokensCache.get(jwtToken); if (cached != null) { diff --git a/zaas-service/src/test/java/org/zowe/apiml/zaas/security/service/AuthenticationServiceTest.java b/zaas-service/src/test/java/org/zowe/apiml/zaas/security/service/AuthenticationServiceTest.java index 6eeffda6c4..e2fe08c42c 100644 --- a/zaas-service/src/test/java/org/zowe/apiml/zaas/security/service/AuthenticationServiceTest.java +++ b/zaas-service/src/test/java/org/zowe/apiml/zaas/security/service/AuthenticationServiceTest.java @@ -127,8 +127,8 @@ void setup() { authConfigurationProperties = new AuthConfigurationProperties(); authConfigurationProperties.getZosmf().setServiceId(ZOSMF); - when(cacheManager.getCache("validatedJwtTokens")).thenReturn(validatedJwtTokensCache); - when(cacheManager.getCache("invalidatedJwtTokens")).thenReturn(invalidatedJwtTokensCache); + lenient().when(cacheManager.getCache("validatedJwtTokens")).thenReturn(validatedJwtTokensCache); + lenient().when(cacheManager.getCache("invalidatedJwtTokens")).thenReturn(invalidatedJwtTokensCache); authService = new AuthenticationService( applicationContext, authConfigurationProperties, jwtSecurityInitializer, From 1de55ef168175d9c65b15f901f687cc4fa74bb6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 12:58:28 +0200 Subject: [PATCH 08/16] improve logs about health state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../apiml/functional/caching/JGroupStabilityTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 04e65c6116..19700cd869 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -81,7 +81,7 @@ void givenTwoInstances_whenOneHasADelay_thenClusterIsRebuilt(boolean isModulith, try { cachingServices.forEach(CachingService::start); await() - .pollDelay(10, TimeUnit.SECONDS) + .pollDelay(20, TimeUnit.SECONDS) .timeout(isModulith ? 8 : 2, TimeUnit.MINUTES) .until(() -> cachingServices.stream().allMatch(CachingService::isUp)); @@ -283,7 +283,11 @@ public boolean isUp() { if (StringUtils.isNotEmpty(jsonResponse)) { var status = JsonPath.parse(jsonResponse).read(isModulith ? "components.infinispan.status" : "components.caching.details.infinispan.cluster.status", String.class); - return "UP".equals(status); + boolean isUp = "UP".equals(status); + if (!isUp) { + log.warn("URI: {}, JsonResponse is {}", request.getURI().toString(), jsonResponse); + } + return isUp; } return false; } catch (Exception e) { From c3cb00f4ac7fcc57a22c2c368faf7606d1ad8aed Mon Sep 17 00:00:00 2001 From: nxhafa Date: Fri, 24 Apr 2026 14:57:16 +0200 Subject: [PATCH 09/16] fix Signed-off-by: nxhafa --- .../zowe/apiml/functional/caching/JGroupStabilityTest.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index 19700cd869..f1d1c28f9a 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -31,6 +31,7 @@ import javax.net.ssl.*; import java.io.*; import java.net.Socket; +import java.nio.file.Paths; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; @@ -172,7 +173,7 @@ public void start() { log.info("Starting {} on ports based on {}", service, basePort); var env = new HashMap(); - env.put("ZWE_haInstance_id", "localhost" + (index + 1)); + env.put("ZWE_haInstance_id", "localhost_" + (isModulith ? "Single" : "Multi") + "_" + (isAttls ? "Attls" : "NativeTls") + "_" + (index + 1)); env.put("APIML_ENABLED", isModulith ? "true" : "false"); env.put("logbackService", (isModulith ? "ZWEGW" : "ZWEACS") + (index + 1)); env.put("LAUNCH_COMPONENT", service + "/build/libs"); @@ -184,6 +185,7 @@ public void start() { env.put("ZWE_configs_storage_infinispan_jgroups_keyExchange_port", String.valueOf(basePort + 601)); env.put("ZWE_configs_storage_infinispan_initialHosts", Arrays.stream(BASE_PORTS).mapToObj(bp -> "localhost[" + (bp + 600) + "]").collect(Collectors.joining(","))); env.put("ZWE_configs_storage_mode", "infinispan"); + env.put("ZWE_zowe_workspaceDirectory", Paths.get(".").toAbsolutePath().normalize().toString()); env.put("ZWE_zowe_certificate_keystore_file", "keystore/localhost/localhost.keystore.p12"); env.put("ZWE_zowe_certificate_keystore_password", "password"); From a247851a7d5db5aadc575ead097fdb68c85d0824 Mon Sep 17 00:00:00 2001 From: nxhafa Date: Fri, 24 Apr 2026 15:38:16 +0200 Subject: [PATCH 10/16] fix sonarqube issue; add debug logs for failing JGroupsStabilityTest Signed-off-by: nxhafa --- .../zowe/apiml/functional/caching/JGroupStabilityTest.java | 1 + .../apiml/zaas/security/service/AuthenticationService.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java index f1d1c28f9a..b7663270c8 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java +++ b/integration-tests/src/test/java/org/zowe/apiml/functional/caching/JGroupStabilityTest.java @@ -173,6 +173,7 @@ public void start() { log.info("Starting {} on ports based on {}", service, basePort); var env = new HashMap(); + env.put("ZWE_configs_debug", "true"); env.put("ZWE_haInstance_id", "localhost_" + (isModulith ? "Single" : "Multi") + "_" + (isAttls ? "Attls" : "NativeTls") + "_" + (index + 1)); env.put("APIML_ENABLED", isModulith ? "true" : "false"); env.put("logbackService", (isModulith ? "ZWEGW" : "ZWEACS") + (index + 1)); diff --git a/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java b/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java index 717c713db6..2fc155c3ff 100644 --- a/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java +++ b/zaas-service/src/main/java/org/zowe/apiml/zaas/security/service/AuthenticationService.java @@ -84,8 +84,8 @@ public class AuthenticationService { private final CacheManager cacheManager; private final CacheUtils cacheUtils; private boolean isModulithMode; - private Cache validatedJwtTokensCache; - private Cache invalidatedJwtTokensCache; + private volatile Cache validatedJwtTokensCache; + private volatile Cache invalidatedJwtTokensCache; @PostConstruct public void afterPropertiesSet() { From 90705266a96f9264d949f370807b01619e8dd0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 16:26:06 +0200 Subject: [PATCH 11/16] update log levels for Infinispan in debug mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- apiml/src/main/resources/application.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apiml/src/main/resources/application.yml b/apiml/src/main/resources/application.yml index 89e89b4496..9d04d8d6be 100644 --- a/apiml/src/main/resources/application.yml +++ b/apiml/src/main/resources/application.yml @@ -346,7 +346,9 @@ logging: org.apache.tomcat.util.net: DEBUG org.apache.tomcat.util.net.jsse.JSSESupport: INFO org.ehcache: INFO - org.jgroups: DEBUG + org.jgroups: TRACE + org.jgroups.protocols: ERROR + org.infinispan: DEBUG org.springframework.context.support.[PostProcessorRegistrationDelegate$BeanPostProcessorChecker]: DEBUG org.springframework.security: TRACE org.springframework.security.web: TRACE From 6691a85815d445e0f163c8c83d9ad37b6f585e1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 17:08:50 +0200 Subject: [PATCH 12/16] simplifying the distributed cache configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../service/infinispan/config/InfinispanConfig.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java b/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java index f82908a5a0..1510774408 100644 --- a/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java +++ b/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java @@ -211,12 +211,11 @@ synchronized LazyCacheManager cacheManager(ResourceLoader resourceLoader, Applic System.setProperty("infinispan.ssl.trustStore", trustStore); System.setProperty("infinispan.ssl.trustStorePassword", trustStorePass); - var caches = Stream.of(CACHE_ZOWE, CACHE_ZOWE_INVALIDATED_TOKEN) - .collect(Collectors.toMap( cacheName -> cacheName, cacheName -> getDistributedCacheConfig())); + var caches = new HashMap(); + caches.put(CACHE_ZOWE, getDistributedCacheConfig()); + caches.put(CACHE_ZOWE_INVALIDATED_TOKEN, getDistributedCacheConfig()); if (applicationInfo.isModulith()) { - caches.put(CACHE_ZOWE, getDistributedCacheConfig()); - caches.put(CACHE_ZOWE_INVALIDATED_TOKEN, getDistributedCacheConfig()); caches.put("invalidatedJwtTokens", getDistributedCacheConfig()); // 1 minute to force zosmf tokens validation against zosmf for invalidated tokens From aea3e87ef06905dbb382e52f2772e5865d36e10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 17:26:30 +0200 Subject: [PATCH 13/16] clean up IT configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .github/workflows/integration-tests.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 41262afd59..3e3969594b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -997,7 +997,6 @@ jobs: caching-service: image: ghcr.io/balhar-jakub/caching-service:${{ github.run_id }}-${{ github.run_number }} env: - ZWE_CACHING_SERVICE_PERSISTENT: 'infinispan' CACHING_STORAGE_MODE: "infinispan" JGROUPS_BIND_ADDRESS: "caching-service" JGROUPS_BIND_PORT: "7600" @@ -2164,7 +2163,6 @@ jobs: caching-service: image: ghcr.io/balhar-jakub/caching-service:${{ github.run_id }}-${{ github.run_number }} env: - ZWE_CACHING_SERVICE_PERSISTENT: 'infinispan' JGROUPS_BIND_PORT: "7600" SERVER_SSL_KEYSTORETYPE: "PKCS12" CACHING_STORAGE_INFINISPAN_PERSISTENCE_DATALOCATION: "data_replica" @@ -2175,7 +2173,6 @@ jobs: caching-service-2: image: ghcr.io/balhar-jakub/caching-service:${{ github.run_id }}-${{ github.run_number }} env: - ZWE_CACHING_SERVICE_PERSISTENT: 'infinispan' JGROUPS_BIND_PORT: "7600" SERVER_SSL_KEYSTORETYPE: "PKCS12" CACHING_STORAGE_INFINISPAN_PERSISTENCE_DATALOCATION: "data" @@ -2250,13 +2247,13 @@ jobs: APIML_SECURITY_X509_ENABLED: true APIML_SECURITY_SSL_NONSTRICTVERIFYSSLCERTIFICATESOFSERVICES: true APIML_DISCOVERY_ALLPEERSURLS: https://apiml-2:10011/eureka,https://apiml:10011/eureka - ZWE_CACHING_SERVICE_PERSISTENT: 'infinispan' - JGROUPS_BIND_PORT: "7600" SERVER_SSL_KEYSTORETYPE: "PKCS12" - CACHING_STORAGE_INFINISPAN_INITIALHOSTS: "apiml[7600],apiml-2[7600]" + CACHING_STORAGE_INFINISPAN_NUMSEGMENTS: "16" CACHING_STORAGE_MODE: "infinispan" + CACHING_STORAGE_INFINISPAN_INITIALHOSTS: "apiml[7600],apiml-2[7600]" + JGROUPS_BIND_PORT: "7600" JGROUPS_BIND_ADDRESS: "apiml" - CACHING_STORAGE_INFINISPAN_NUMSEGMENTS: "16" + JGROUPS_KEYEXCHANGE_PORT: 7601 apiml-2: image: ghcr.io/balhar-jakub/apiml:${{ github.run_id }}-${{ github.run_number }} env: @@ -2264,15 +2261,15 @@ jobs: APIML_GATEWAY_SERVICESTOLIMITREQUESTRATE: discoverableclient APIML_SECURITY_SSL_NONSTRICTVERIFYSSLCERTIFICATESOFSERVICES: true APIML_DISCOVERY_ALLPEERSURLS: https://apiml:10011/eureka,https://apiml-2:10011/eureka - ZWE_CACHING_SERVICE_PERSISTENT: 'infinispan' - JGROUPS_BIND_PORT: "7600" SERVER_SSL_KEYSTORETYPE: "PKCS12" - CACHING_STORAGE_INFINISPAN_INITIALHOSTS: "apiml[7600],apiml-2[7600]" - CACHING_STORAGE_MODE: "infinispan" - JGROUPS_BIND_ADDRESS: "apiml-2" APIML_SERVICE_HOSTNAME: "apiml-2" logbackService: ZWEAGW2 CACHING_STORAGE_INFINISPAN_NUMSEGMENTS: "16" + CACHING_STORAGE_MODE: "infinispan" + CACHING_STORAGE_INFINISPAN_INITIALHOSTS: "apiml[7600],apiml-2[7600]" + JGROUPS_BIND_PORT: "7600" + JGROUPS_BIND_ADDRESS: "apiml-2" + JGROUPS_KEYEXCHANGE_PORT: 7601 api-catalog-services: image: ghcr.io/balhar-jakub/api-catalog-services:${{ github.run_id }}-${{ github.run_number }} volumes: From 8d7c6eb9a23fbf15aa122493da34c8b85a252e79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 17:45:40 +0200 Subject: [PATCH 14/16] fix imports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../caching/service/infinispan/config/InfinispanConfig.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java b/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java index 1510774408..0f66feb596 100644 --- a/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java +++ b/caching-service/src/main/java/org/zowe/apiml/caching/service/infinispan/config/InfinispanConfig.java @@ -43,11 +43,9 @@ import java.io.InputStream; import java.nio.file.Paths; import java.time.Duration; -import java.util.*; +import java.util.HashMap; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static org.zowe.apiml.security.SecurityUtils.formatKeyringUrl; import static org.zowe.apiml.security.SecurityUtils.isKeyring; From a44ebf0f036b7470c5d360e4bc4f695ce871e08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 17:46:05 +0200 Subject: [PATCH 15/16] clean up workflow (unnecessary value) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .github/workflows/integration-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 3e3969594b..5ad870c6f0 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -2247,7 +2247,6 @@ jobs: APIML_SECURITY_X509_ENABLED: true APIML_SECURITY_SSL_NONSTRICTVERIFYSSLCERTIFICATESOFSERVICES: true APIML_DISCOVERY_ALLPEERSURLS: https://apiml-2:10011/eureka,https://apiml:10011/eureka - SERVER_SSL_KEYSTORETYPE: "PKCS12" CACHING_STORAGE_INFINISPAN_NUMSEGMENTS: "16" CACHING_STORAGE_MODE: "infinispan" CACHING_STORAGE_INFINISPAN_INITIALHOSTS: "apiml[7600],apiml-2[7600]" @@ -2261,7 +2260,6 @@ jobs: APIML_GATEWAY_SERVICESTOLIMITREQUESTRATE: discoverableclient APIML_SECURITY_SSL_NONSTRICTVERIFYSSLCERTIFICATESOFSERVICES: true APIML_DISCOVERY_ALLPEERSURLS: https://apiml:10011/eureka,https://apiml-2:10011/eureka - SERVER_SSL_KEYSTORETYPE: "PKCS12" APIML_SERVICE_HOSTNAME: "apiml-2" logbackService: ZWEAGW2 CACHING_STORAGE_INFINISPAN_NUMSEGMENTS: "16" From ce206f1b8aa4bcc452870f3012749a35d77189e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pavel=20Jare=C5=A1?= Date: Fri, 24 Apr 2026 18:13:41 +0200 Subject: [PATCH 16/16] minor fix of startup check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pavel Jareš --- .../apiml/startup/impl/ApiMediationLayerStartupChecker.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/integration-tests/src/test/java/org/zowe/apiml/startup/impl/ApiMediationLayerStartupChecker.java b/integration-tests/src/test/java/org/zowe/apiml/startup/impl/ApiMediationLayerStartupChecker.java index 0c8c1a2e39..8ac60c2e02 100644 --- a/integration-tests/src/test/java/org/zowe/apiml/startup/impl/ApiMediationLayerStartupChecker.java +++ b/integration-tests/src/test/java/org/zowe/apiml/startup/impl/ApiMediationLayerStartupChecker.java @@ -14,6 +14,7 @@ import com.jayway.jsonpath.JsonPath; import io.netty.handler.codec.http.HttpHeaderValues; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.extern.slf4j.Slf4j; import net.minidev.json.JSONArray; import org.apache.commons.lang3.StringUtils; @@ -21,8 +22,8 @@ import org.apache.http.HttpHeaders; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; -import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.client.methods.HttpGet; +import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; @@ -74,6 +75,7 @@ public void waitUntilReady() { } @Data + @EqualsAndHashCode(of = {"hostname", "port", "serviceId"}) private static class Instance { private final String scheme; @@ -199,6 +201,7 @@ private ApimlInstance(Predicate instanceMatcher) { } return i; }) + .distinct() .filter(instanceMatcher) .collect(Collectors.toList()); }