1- // Copyright (c) 2018, 2021 , Oracle and/or its affiliates.
1+ // Copyright (c) 2018, 2022 , Oracle and/or its affiliates.
22// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
33
44package oracle .kubernetes .operator .helpers ;
@@ -224,7 +224,7 @@ public abstract class PodHelperTestBase extends DomainValidationBaseTest {
224224 private Memento hashMemento ;
225225 private final Map <String , Map <String , KubernetesEventObjects >> domainEventObjects = new ConcurrentHashMap <>();
226226
227- private TestUtils .ConsoleHandlerMemento consoleHandlerMemento = TestUtils . silenceOperatorLogger () ;
227+ private TestUtils .ConsoleHandlerMemento consoleHandlerMemento ;
228228
229229 PodHelperTestBase (String serverName , int listenPort ) {
230230 this .serverName = serverName ;
@@ -302,8 +302,8 @@ public void setUp() throws Exception {
302302 mementos .add (hashMemento = UnitTestHash .install ());
303303 mementos .add (InMemoryCertificates .install ());
304304 mementos .add (setProductVersion (TEST_PRODUCT_VERSION ));
305- mementos .add (
306- TestUtils .silenceOperatorLogger ()
305+ mementos .add (consoleHandlerMemento
306+ = TestUtils .silenceOperatorLogger ()
307307 .collectLogMessages (logRecords , getMessageKeys ())
308308 .withLogLevel (Level .FINE )
309309 .ignoringLoggedExceptions (ApiException .class ));
@@ -328,6 +328,10 @@ public void setUp() throws Exception {
328328 new PassthroughPodAwaiterStepFactory ());
329329 }
330330
331+ TestUtils .ConsoleHandlerMemento getConsoleHandlerMemento () {
332+ return consoleHandlerMemento ;
333+ }
334+
331335 private Memento setProductVersion (String productVersion ) throws NoSuchFieldException {
332336 return StaticStubSupport .install (PodStepContext .class , "productVersion" , productVersion );
333337 }
@@ -2153,7 +2157,7 @@ void whenImageChanged_domainRollStartEventCreatedWithCorrectMessage()
21532157 @ Test
21542158 void whenImageChanged_expectedLogMessageFound ()
21552159 throws NoSuchMethodException , IllegalAccessException , InvocationTargetException {
2156- consoleHandlerMemento .collectLogMessages (logRecords , getDomainRollStartingKey ());
2160+ getConsoleHandlerMemento () .collectLogMessages (logRecords , getDomainRollStartingKey ());
21572161 initializeExistingPod ();
21582162 getConfiguredDomainSpec ().setImage ("adfgg" );
21592163
@@ -2245,7 +2249,7 @@ void whenDomainZipHashChanged_butIsMIIDynamicUpdate_dontCreateDomainRollStartEve
22452249 @ Test
22462250 void whenImageDomainHomeAndRestartVersionChanged_expectedLogMessageFound ()
22472251 throws NoSuchMethodException , IllegalAccessException , InvocationTargetException {
2248- consoleHandlerMemento .collectLogMessages (logRecords , getDomainRollStartingKey ());
2252+ getConsoleHandlerMemento () .collectLogMessages (logRecords , getDomainRollStartingKey ());
22492253 initializeExistingPod ();
22502254 getConfiguredDomainSpec ().setImage ("adfgg" );
22512255 getConfiguredDomainSpec ().setDomainHome ("12345" );
@@ -2260,7 +2264,7 @@ void whenImageDomainHomeAndRestartVersionChanged_expectedLogMessageFound()
22602264 @ Test
22612265 void whenImageDomainHomeAndRestartVersionChanged_domainRollStartEventCreatedWithCorrectMessage ()
22622266 throws NoSuchMethodException , IllegalAccessException , InvocationTargetException {
2263- consoleHandlerMemento .collectLogMessages (logRecords , getDomainRollStartingKey ());
2267+ getConsoleHandlerMemento () .collectLogMessages (logRecords , getDomainRollStartingKey ());
22642268 initializeExistingPod ();
22652269 getConfiguredDomainSpec ().setImage ("adfgg" );
22662270 getConfiguredDomainSpec ().setDomainHome ("12345" );
@@ -2287,7 +2291,7 @@ void whenImageDomainHomeAndRestartVersionChanged_domainRollStartEventCreatedWith
22872291 @ Test
22882292 void whenImageDomainHomeAndWebLogicZipHashChanged_domainRollStartEventCreatedWithCorrectMessage ()
22892293 throws NoSuchMethodException , IllegalAccessException , InvocationTargetException {
2290- consoleHandlerMemento .collectLogMessages (logRecords , getDomainRollStartingKey ());
2294+ getConsoleHandlerMemento () .collectLogMessages (logRecords , getDomainRollStartingKey ());
22912295 initializeExistingPod ();
22922296 getConfiguredDomainSpec ().setImage ("adfgg" );
22932297 getConfiguredDomainSpec ().setDomainHome ("12345" );
0 commit comments