Class ConnectorTestingExtension

java.lang.Object
org.apache.flink.connector.testframe.junit.extensions.ConnectorTestingExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback, org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.Extension

@Internal public class ConnectorTestingExtension extends Object implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
A JUnit 5 Extension for supporting running of connector testing framework.

This extension is responsible for searching test resources annotated by TestEnv, TestExternalSystem and TestContext, storing them into storage provided by JUnit, and manage lifecycle of these resources.

The extension uses ExtensionContext.Store for handing over test resources to TestCaseInvocationContextProvider, which will inject these resources into test cases as parameters.

The order of initialization is promised to be:

  1. Test environment annotated by TestEnv, before all test cases in this extension
  2. External system annotated by TestExternalSystem, before all test cases in this extension
  3. External contexts annotated by TestContext, before each test case in TestCaseInvocationContextProvider
  • Field Details

    • TEST_RESOURCE_NAMESPACE

      public static final org.junit.jupiter.api.extension.ExtensionContext.Namespace TEST_RESOURCE_NAMESPACE
    • TEST_ENV_STORE_KEY

      public static final String TEST_ENV_STORE_KEY
      See Also:
    • EXTERNAL_SYSTEM_STORE_KEY

      public static final String EXTERNAL_SYSTEM_STORE_KEY
      See Also:
    • EXTERNAL_CONTEXT_FACTORIES_STORE_KEY

      public static final String EXTERNAL_CONTEXT_FACTORIES_STORE_KEY
      See Also:
    • SUPPORTED_SEMANTIC_STORE_KEY

      public static final String SUPPORTED_SEMANTIC_STORE_KEY
      See Also:
  • Constructor Details

    • ConnectorTestingExtension

      public ConnectorTestingExtension()
  • Method Details

    • beforeAll

      public void beforeAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      beforeAll in interface org.junit.jupiter.api.extension.BeforeAllCallback
      Throws:
      Exception
    • afterAll

      public void afterAll(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      afterAll in interface org.junit.jupiter.api.extension.AfterAllCallback
      Throws:
      Exception