Package io.debezium.connector.cassandra
Class EmbeddedCassandraConnectorTestBase
- java.lang.Object
-
- io.debezium.connector.cassandra.EmbeddedCassandraConnectorTestBase
-
- Direct Known Subclasses:
CommitLogPostProcessorTest,CommitLogProcessorTest,QueueProcessorTest,SnapshotProcessorTest
public abstract class EmbeddedCassandraConnectorTestBase extends Object
Base class used to automatically spin up a single-node embedded Cassandra cluster before tests and handle clean up after tests.
-
-
Field Summary
Fields Modifier and Type Field Description static longSTARTUP_TIMEOUT_IN_SECONDSstatic StringTEST_CASSANDRA_HOSTSstatic intTEST_CASSANDRA_PORTstatic StringTEST_CASSANDRA_YAML_CONFIGstatic StringTEST_CONNECTOR_NAMEstatic StringTEST_KAFKA_SERVERSstatic StringTEST_KAFKA_TOPIC_PREFIXstatic StringTEST_KEYSPACEstatic StringTEST_SCHEMA_REGISTRY_URL
-
Constructor Summary
Constructors Constructor Description EmbeddedCassandraConnectorTestBase()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidclearCommitLogFromDirectory(File directory, boolean recursive)Delete all commit log files in directoryprivate static voidcreateTestKeyspace()protected static voiddeleteTestKeyspaceTables()Drop all tables in TEST_KEYSPACEprotected static voiddeleteTestOffsets(io.debezium.connector.cassandra.CassandraConnectorContext context)Delete all files in offset backing store directoryprivate static voiddestroyTestKeyspace()protected static FilegenerateCommitLogFile()Generate a commit log file with current timestamp in memoryprotected static PropertiesgenerateDefaultConfigMap()protected static io.debezium.connector.cassandra.CassandraConnectorContextgenerateTaskContext()Generate a task context with default test configsprotected static io.debezium.connector.cassandra.CassandraConnectorContextgenerateTaskContext(Map<String,Object> configs)General a task context with default and custom test configsprotected static StringkeyspaceTable(String tableName)Return the full name of the test table in the form of. protected static voidpopulateFakeCommitLogsForDirectory(int numOfFiles, File directory)Generate commit log files in directorystatic voidsetUpClass()private static voidstartEmbeddedCassandra()private static voidstopEmbeddedCassandra()static voidtearDownClass()protected static voidtruncateTestKeyspaceTableData()Truncate data in all tables in TEST_KEYSPACE, but do not drop the tables
-
-
-
Field Detail
-
TEST_CONNECTOR_NAME
public static final String TEST_CONNECTOR_NAME
- See Also:
- Constant Field Values
-
TEST_KEYSPACE
public static final String TEST_KEYSPACE
- See Also:
- Constant Field Values
-
STARTUP_TIMEOUT_IN_SECONDS
public static final long STARTUP_TIMEOUT_IN_SECONDS
- See Also:
- Constant Field Values
-
TEST_CASSANDRA_YAML_CONFIG
public static final String TEST_CASSANDRA_YAML_CONFIG
- See Also:
- Constant Field Values
-
TEST_CASSANDRA_HOSTS
public static final String TEST_CASSANDRA_HOSTS
- See Also:
- Constant Field Values
-
TEST_CASSANDRA_PORT
public static final int TEST_CASSANDRA_PORT
- See Also:
- Constant Field Values
-
TEST_KAFKA_SERVERS
public static final String TEST_KAFKA_SERVERS
- See Also:
- Constant Field Values
-
TEST_SCHEMA_REGISTRY_URL
public static final String TEST_SCHEMA_REGISTRY_URL
- See Also:
- Constant Field Values
-
TEST_KAFKA_TOPIC_PREFIX
public static final String TEST_KAFKA_TOPIC_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
tearDownClass
public static void tearDownClass()
-
truncateTestKeyspaceTableData
protected static void truncateTestKeyspaceTableData()
Truncate data in all tables in TEST_KEYSPACE, but do not drop the tables
-
deleteTestKeyspaceTables
protected static void deleteTestKeyspaceTables()
Drop all tables in TEST_KEYSPACE
-
generateTaskContext
protected static io.debezium.connector.cassandra.CassandraConnectorContext generateTaskContext() throws ExceptionGenerate a task context with default test configs- Throws:
Exception
-
generateTaskContext
protected static io.debezium.connector.cassandra.CassandraConnectorContext generateTaskContext(Map<String,Object> configs) throws Exception
General a task context with default and custom test configs- Throws:
Exception
-
deleteTestOffsets
protected static void deleteTestOffsets(io.debezium.connector.cassandra.CassandraConnectorContext context) throws IOExceptionDelete all files in offset backing store directory- Throws:
IOException
-
keyspaceTable
protected static String keyspaceTable(String tableName)
Return the full name of the test table in the form of. -
generateCommitLogFile
protected static File generateCommitLogFile()
Generate a commit log file with current timestamp in memory
-
populateFakeCommitLogsForDirectory
protected static void populateFakeCommitLogsForDirectory(int numOfFiles, File directory) throws IOExceptionGenerate commit log files in directory- Throws:
IOException
-
clearCommitLogFromDirectory
protected static void clearCommitLogFromDirectory(File directory, boolean recursive) throws IOException
Delete all commit log files in directory- Throws:
IOException
-
generateDefaultConfigMap
protected static Properties generateDefaultConfigMap() throws IOException
- Throws:
IOException
-
startEmbeddedCassandra
private static void startEmbeddedCassandra() throws Exception- Throws:
Exception
-
stopEmbeddedCassandra
private static void stopEmbeddedCassandra()
-
createTestKeyspace
private static void createTestKeyspace()
-
destroyTestKeyspace
private static void destroyTestKeyspace()
-
-
-