Skip to content

Commit 0a337d0

Browse files
DATAGO-116001 code complete
1 parent 5ce4699 commit 0a337d0

File tree

2 files changed

+8
-8
lines changed
  • service

2 files changed

+8
-8
lines changed

service/application/src/test/java/com/solace/maas/ep/event/management/agent/plugin/config/VMRPropertiesTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ void testNoGatewayConnectionProperties() {
266266
void testSetDefaultTrustStoreCalledWhenCustomCaCertsPresent() {
267267
// Spy on vmrProperties to mock getCustomCaCertsPresentEnv and verify setDefaultTrustStore is called
268268
VMRProperties spyVmrProperties = spy(vmrProperties);
269-
when(spyVmrProperties.getCustomCaCertsPresentEnv()).thenReturn("1");
269+
when(spyVmrProperties.isCustomCACertConfigured()).thenReturn(true);
270270
doNothing().when(spyVmrProperties).setDefaultTrustStore(any(Properties.class));
271271

272272
MessagingServiceConnectionProperties connectionProps = createConnectionProperties(false, null, null, null, null, null);
@@ -283,7 +283,7 @@ void testSetDefaultTrustStoreCalledWhenCustomCaCertsPresent() {
283283
void testSetDefaultTrustStoreNotCalledWhenCustomCaCertsNotPresent() {
284284
// Spy on vmrProperties to mock getCustomCaCertsPresentEnv and verify setDefaultTrustStore is NOT called
285285
VMRProperties spyVmrProperties = spy(vmrProperties);
286-
when(spyVmrProperties.getCustomCaCertsPresentEnv()).thenReturn(null);
286+
when(spyVmrProperties.isCustomCACertConfigured()).thenReturn(false);
287287

288288
MessagingServiceConnectionProperties connectionProps = createConnectionProperties(false, null, null, null, null, null);
289289
when(gatewayMessagingProperties.getConnections()).thenReturn(Collections.singletonList(connectionProps));

service/plugin/src/main/java/com/solace/maas/ep/event/management/agent/plugin/config/VMRProperties.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,19 +137,19 @@ private void configureDefaultTrustStore(Properties properties) {
137137
return;
138138
}
139139

140-
String customCaCertsPresent = getCustomCaCertsPresentEnv();
141-
if (!"1".equals(customCaCertsPresent)) {
142-
log.debug("Custom CA certificates not present (CUSTOM_CA_CERTS_PRESENT={}). Skipping explicit default truststore configuration.",
143-
customCaCertsPresent);
140+
if (!isCustomCACertConfigured()) {
141+
log.debug("Custom CA certificates not present. Skipping explicit default truststore configuration.");
144142
return;
145143
}
146144

147145
setDefaultTrustStore(properties);
148146
}
149147

150148

151-
String getCustomCaCertsPresentEnv() {
152-
return System.getenv("CUSTOM_CA_CERTS_PRESENT");
149+
boolean isCustomCACertConfigured() {
150+
String customCaCertsPresent = System.getenv("CUSTOM_CA_CERTS_PRESENT");
151+
152+
return ("1".equals(customCaCertsPresent));
153153
}
154154

155155
void setDefaultTrustStore(Properties properties) {

0 commit comments

Comments
 (0)