Class PauseConnectorHandlerTestBuilder


  • public class PauseConnectorHandlerTestBuilder
    extends Object
    Test builder for the PauseConnectorHandler.

    Allows for customization of the following handler components:

    • PauseConnectorStateValidator
    • PauseConnectorCallback
    • ConnectorErrorHelper
    • LifecycleService
    • PauseConnectorSdkCallback
    • PauseTaskReactorService
    • Constructor Detail

      • PauseConnectorHandlerTestBuilder

        public PauseConnectorHandlerTestBuilder()
        Creates a new, empty PauseConnectorHandlerTestBuilder.

        Properties of the new builder instance must be fully customized before a handler instance can be built.

      • PauseConnectorHandlerTestBuilder

        public PauseConnectorHandlerTestBuilder​(Session session)
        Creates a new PauseConnectorHandlerTestBuilder.

        The properties of this builder are initialised with:

        • a default implementation of PauseConnectorStateValidator
        • a default implementation of PauseConnectorCallback
        • ConnectorErrorHelper built using buildDefault
        • a default implementation of LifecycleService, with STARTED state as post-rollback status
        • a default implementation of PauseConnectorSdkCallback
        • a default implementation of PauseTaskReactorService
        Parameters:
        session - Snowpark session object
        Throws:
        NullPointerException - if the provided session object is null
    • Method Detail

      • withStateValidator

        public PauseConnectorHandlerTestBuilder withStateValidator​(com.snowflake.connectors.application.lifecycle.pause.PauseConnectorStateValidator stateValidator)
        Sets the state validator used to build the handler instance.
        Parameters:
        stateValidator - connector state validator
        Returns:
        this builder
      • withCallback

        public PauseConnectorHandlerTestBuilder withCallback​(com.snowflake.connectors.application.lifecycle.pause.PauseConnectorCallback callback)
        Sets the callback used to build the handler instance.
        Parameters:
        callback - pause connector callback
        Returns:
        this builder
      • withErrorHelper

        public PauseConnectorHandlerTestBuilder withErrorHelper​(com.snowflake.connectors.common.exception.helper.ConnectorErrorHelper errorHelper)
        Sets the error helper used to build the handler instance.
        Parameters:
        errorHelper - connector error helper
        Returns:
        this builder
      • withLifecycleService

        public PauseConnectorHandlerTestBuilder withLifecycleService​(com.snowflake.connectors.application.lifecycle.LifecycleService lifecycleService)
        Sets the lifecycle service used to build the handler instance.
        Parameters:
        lifecycleService - lifecycle service
        Returns:
        this builder
      • withSdkCallback

        public PauseConnectorHandlerTestBuilder withSdkCallback​(com.snowflake.connectors.application.lifecycle.pause.PauseConnectorSdkCallback sdkCallback)
        Sets the internal sdk callback used to build the handler instance.
        Parameters:
        sdkCallback - internal sdk callback
        Returns:
        this builder
      • withPauseTaskReactorService

        public PauseConnectorHandlerTestBuilder withPauseTaskReactorService​(com.snowflake.connectors.taskreactor.lifecycle.PauseTaskReactorService pauseTaskReactorService)
        Sets the service used to pause Task Reactor instances.
        Parameters:
        pauseTaskReactorService - service which pauses Task Reactor
        Returns:
        this builder
      • build

        public com.snowflake.connectors.application.lifecycle.pause.PauseConnectorHandler build()
        Builds a new handler instance.
        Returns:
        new handler instance
        Throws:
        NullPointerException - if any property for the new handler is null