Package cz.xtf.junit5.extensions
Class OpenShiftRecorderHandler
- java.lang.Object
-
- cz.xtf.junit5.extensions.OpenShiftRecorderHandler
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension,org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler,org.junit.jupiter.api.extension.TestExecutionExceptionHandler,org.junit.jupiter.api.extension.TestWatcher
public class OpenShiftRecorderHandler extends Object implements org.junit.jupiter.api.extension.TestWatcher, org.junit.jupiter.api.extension.TestExecutionExceptionHandler, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler
Implements JUnit lifecycle events handling in order to record OCP state for different purposes (e.g.: debug). The operational logic to perform the steps to get the status from OCP is delegated toOpenShiftRecorderService. Based on the JUnit test life cycle event that is being handled, an instance of this class will either callOpenShiftRecorderService.initFilters(ExtensionContext)- beforeAllCallback: used to get information on what resources are on a cluster before a test class is processedOpenShiftRecorderService.updateFilters(ExtensionContext)- beforeEachCallback: used to get information on what resources are on a cluster before a test case is processedOpenShiftRecorderService.recordState(ExtensionContext)- on various events: used to record state of selected resources (by name) or make an estimation based on information collected when previous events like the two described above took placeOpenShift state is recorded in the following cases:
TestExecutionExceptionHandler.handleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext, java.lang.Throwable)LifecycleMethodExecutionExceptionHandler.handleBeforeAllMethodExecutionException(ExtensionContext, Throwable)andLifecycleMethodExecutionExceptionHandler.handleBeforeEachMethodExecutionException(ExtensionContext, Throwable)in casextf.record.beforeis setTestWatcher.testSuccessful(ExtensionContext)in casextf.record.beforeis set
-
-
Constructor Summary
Constructors Constructor Description OpenShiftRecorderHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context)voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)voidhandleBeforeAllMethodExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, Throwable throwable)voidhandleBeforeEachMethodExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, Throwable throwable)voidhandleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, Throwable throwable)voidtestSuccessful(org.junit.jupiter.api.extension.ExtensionContext context)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Method Detail
-
beforeAll
public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
handleTestExecutionException
public void handleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, Throwable throwable) throws Throwable- Specified by:
handleTestExecutionExceptionin interfaceorg.junit.jupiter.api.extension.TestExecutionExceptionHandler- Throws:
Throwable
-
handleBeforeAllMethodExecutionException
public void handleBeforeAllMethodExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, Throwable throwable) throws Throwable- Specified by:
handleBeforeAllMethodExecutionExceptionin interfaceorg.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler- Throws:
Throwable
-
handleBeforeEachMethodExecutionException
public void handleBeforeEachMethodExecutionException(org.junit.jupiter.api.extension.ExtensionContext context, Throwable throwable) throws Throwable- Specified by:
handleBeforeEachMethodExecutionExceptionin interfaceorg.junit.jupiter.api.extension.LifecycleMethodExecutionExceptionHandler- Throws:
Throwable
-
testSuccessful
public void testSuccessful(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
testSuccessfulin interfaceorg.junit.jupiter.api.extension.TestWatcher
-
-