Class JCoRecManagedConnectionFactory

  • All Implemented Interfaces:
    JCoManagedConnectionFactory

    public class JCoRecManagedConnectionFactory
    extends java.lang.Object
    implements JCoManagedConnectionFactory
    If this Class is registered as ManagedConnectionFactory in the -spring.xml then JCoRec is enabled.

    Make sure to provide parameters record (OFF, RECORDING or PLAYBACK) and path (the path where to save/load) in the correspondent Test Files.

    • Field Detail

      • ENVIRONMENT_VARIABLE_FORCE_RECORDING

        public static final java.lang.String ENVIRONMENT_VARIABLE_FORCE_RECORDING
        Environment variable for forcing recording.
        See Also:
        Constant Field Values
      • ENVIRONMENT_VARIABLE_DISABLE_RECORDING

        public static final java.lang.String ENVIRONMENT_VARIABLE_DISABLE_RECORDING
        Environment variable for disabling recorder.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JCoRecManagedConnectionFactory

        public JCoRecManagedConnectionFactory​(JCoManagedConnectionFactory factory)
        Constructor for the spring definition. Called as soon as the test class SapcoreJCoRecJUnitTest is initialized.
        Parameters:
        factory - the JCoManagedConnectionFactory to wrap.
    • Method Detail

      • getManagedConnection

        public JCoConnection getManagedConnection​(java.lang.String connectionName,
                                                  java.lang.String callerId)
        Description copied from interface: JCoManagedConnectionFactory
        Returns a managed connection by a given connection name.
        Specified by:
        getManagedConnection in interface JCoManagedConnectionFactory
        Parameters:
        connectionName - name of the connection
        callerId - id for identifying the caller used for debugging
        Returns:
        managed connection instance
      • getManagedConnection

        public JCoConnection getManagedConnection​(java.lang.String connectionName,
                                                  java.lang.String callerId,
                                                  java.lang.String destinationName)
        Description copied from interface: JCoManagedConnectionFactory
        Returns a managed connection by a given connection name.
        Specified by:
        getManagedConnection in interface JCoManagedConnectionFactory
        Parameters:
        connectionName - name of the connection
        callerId - id for identifying the caller used for debugging
        destinationName - name of the destination to be used
        Returns:
        managed connection instance
      • getRecordingMode

        protected JCoRecMode getRecordingMode()
        Getter for the local attribute recordingMode.
        Returns:
        the current value of mode.
      • startRecorder

        public void startRecorder​(JCoRecMode recordingMode,
                                  java.lang.String directoryPath,
                                  java.lang.String key)
        Starts recorder.
        Parameters:
        recordingMode - recording mode
        directoryPath - directory path
        key - unique key for creating the repository file name
      • stopRecorder

        public void stopRecorder()
        Stops recorder. In case of recorder mode recording the repository is saved.
      • testFailed

        public void testFailed()
        Notify recorder that the test has failed.
      • isForceRecording

        public boolean isForceRecording()
        Returns if force recording is set.
        Considers environment variable which overrules settings in coding.
        Returns:
        the forceRecording
      • setForceRecording

        public void setForceRecording​(boolean forceRecording)
        Setter for force recording.
        Parameters:
        forceRecording - the forceRecording to set
      • isDisableRecorder

        public boolean isDisableRecorder()
        Returns if recorder is disabled.
        Considers environment variable which overrules settings in coding.
        Returns:
        the disableRecorder
      • setDisableRecorder

        public void setDisableRecorder​(boolean disableRecorder)
        Setter for disable recorder.
        Parameters:
        disableRecorder - the disableRecorder to set