Class DebeziumContainer
- java.lang.Object
-
- org.testcontainers.containers.FailureDetectingExternalResource
-
- org.testcontainers.containers.GenericContainer<DebeziumContainer>
-
- io.debezium.testing.testcontainers.DebeziumContainer
-
- All Implemented Interfaces:
AutoCloseable,org.junit.rules.TestRule,org.testcontainers.containers.Container<DebeziumContainer>,org.testcontainers.containers.ContainerState,org.testcontainers.containers.traits.LinkableContainer,org.testcontainers.containers.wait.strategy.WaitStrategyTarget,org.testcontainers.lifecycle.Startable
public class DebeziumContainer extends org.testcontainers.containers.GenericContainer<DebeziumContainer>
Debezium Container main class.
-
-
Field Summary
Fields Modifier and Type Field Description protected static okhttp3.OkHttpClientCLIENTprivate static StringDEBEZIUM_VERSIONstatic okhttp3.MediaTypeJSONprivate static intKAFKA_CONNECT_PORTprotected static com.fasterxml.jackson.databind.ObjectMapperMAPPERprivate static StringTEST_PROPERTY_PREFIX
-
Constructor Summary
Constructors Constructor Description DebeziumContainer(String containerImageName)DebeziumContainer(org.testcontainers.utility.DockerImageName containerImage)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconnectorIsNotRegistered(String connectorName)private voiddefaultConfig()voiddeleteAllConnectors()voiddeleteConnector(String connectorName)protected voiddeleteDebeziumConnector(String connectorName)DebeziumContainerenableApicurioConverters()voidensureConnectorConfigProperty(String connectorName, String propertyName, String expectedValue)voidensureConnectorRegistered(String connectorName)voidensureConnectorState(String connectorName, Connector.State status)voidensureConnectorTaskState(String connectorName, int taskNumber, Connector.State status)protected static okhttp3.ResponseexecuteGETRequest(okhttp3.Request request)protected static okhttp3.ResponseexecuteGETRequestSuccessfully(okhttp3.Request request)private voidexecutePOSTRequestSuccessfully(String payload, String fullUrl)private voidexecutePUTRequestSuccessfully(String payload, String fullUrl)StringgetConnectorConfigProperty(String connectorName, String configPropertyName)StringgetConnectorConfigUri(String connectorName)Returns the "/connectors//config" endpoint. Connector.StategetConnectorState(String connectorName)StringgetConnectorStatusUri(String connectorName)Returns the "/connectors//status" endpoint. StringgetConnectorsUri()Returns the "/connectors/" endpoint. Connector.StategetConnectorTaskState(String connectorName, int taskNumber)StringgetConnectorUri(String connectorName)Returns the "/connectors/" endpoint. StringgetPauseConnectorUri(String connectorName)Returns the "/connectors//pause" endpoint. static ConnectorConfigurationgetPostgresConnectorConfiguration(org.testcontainers.containers.PostgreSQLContainer<?> postgresContainer, int id, String... options)List<String>getRegisteredConnectors()StringgetResumeConnectorUri(String connectorName)Returns the "/connectors//pause" endpoint. StringgetTarget()private static voidhandleFailedResponse(okhttp3.Response response)booleanisConnectorConfigured(String connectorName)static DebeziumContainerlatestStable()voidpauseConnector(String connectorName)voidregisterConnector(String name, ConnectorConfiguration configuration)voidresumeConnector(String connectorName)voidupdateOrCreateConnector(String name, ConnectorConfiguration newConfiguration)static intwaitTimeForRecords()DebeziumContainerwithKafka(org.testcontainers.containers.KafkaContainer kafkaContainer)DebeziumContainerwithKafka(org.testcontainers.containers.Network network, String bootstrapServers)-
Methods inherited from class org.testcontainers.containers.GenericContainer
addEnv, addExposedPort, addExposedPorts, addFileSystemBind, addFixedExposedPort, addFixedExposedPort, addLink, apply, canBeReused, configure, containerIsCreated, containerIsStarted, containerIsStarted, containerIsStarting, containerIsStarting, containerIsStopped, containerIsStopping, copyFileFromContainer, createVolumeDirectory, dependsOn, dependsOn, dependsOn, doStart, equals, failed, finished, getBinds, getCommandParts, getContainerId, getContainerInfo, getContainerName, getCopyToFileContainerPathMap, getCreateContainerCmdModifiers, getDependencies, getDockerClient, getDockerImageName, getEnv, getEnvMap, getExposedPorts, getExtraHosts, getImage, getIpAddress, getLabels, getLinkedContainers, getLivenessCheckPort, getLivenessCheckPortNumbers, getLivenessCheckPorts, getLogConsumers, getNetwork, getNetworkAliases, getNetworkMode, getPortBindings, getShmSize, getStartupAttempts, getStartupCheckStrategy, getTestHostIpAddress, getTmpFsMapping, getVolumesFroms, getWaitStrategy, getWorkingDirectory, hashCode, isHostAccessible, isPrivilegedMode, isShouldBeReused, logger, setBinds, setCommand, setCommand, setCommandParts, setCopyToFileContainerPathMap, setDockerImageName, setEnv, setExposedPorts, setExtraHosts, setHostAccessible, setImage, setLabels, setLinkedContainers, setLogConsumers, setNetwork, setNetworkAliases, setNetworkMode, setPortBindings, setPrivilegedMode, setShmSize, setStartupAttempts, setStartupCheckStrategy, setTmpFsMapping, setVolumesFroms, setWaitStrategy, setWorkingDirectory, start, starting, stop, succeeded, toString, waitingFor, waitUntilContainerStarted, withAccessToHost, withClasspathResourceMapping, withClasspathResourceMapping, withCommand, withCommand, withCopyFileToContainer, withCreateContainerCmdModifier, withEnv, withEnv, withExposedPorts, withExtraHost, withFileSystemBind, withImagePullPolicy, withLabel, withLabels, withLogConsumer, withMinimumRunningDuration, withNetwork, withNetworkAliases, withNetworkMode, withPrivilegedMode, withReuse, withSharedMemorySize, withStartupAttempts, withStartupCheckStrategy, withStartupTimeout, withTmpFs, withVolumesFrom, withWorkingDirectory
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.testcontainers.containers.Container
addFileSystemBind, followOutput, followOutput, self, withEnv, withFileSystemBind
-
Methods inherited from interface org.testcontainers.containers.ContainerState
copyFileFromContainer, copyFileToContainer, copyFileToContainer, execInContainer, execInContainer, getBoundPortNumbers, getContainerIpAddress, getCurrentContainerInfo, getFirstMappedPort, getHost, getLogs, getLogs, getMappedPort, isCreated, isHealthy, isRunning
-
-
-
-
Field Detail
-
DEBEZIUM_VERSION
private static final String DEBEZIUM_VERSION
-
KAFKA_CONNECT_PORT
private static final int KAFKA_CONNECT_PORT
- See Also:
- Constant Field Values
-
TEST_PROPERTY_PREFIX
private static final String TEST_PROPERTY_PREFIX
- See Also:
- Constant Field Values
-
JSON
public static final okhttp3.MediaType JSON
-
MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper MAPPER
-
CLIENT
protected static final okhttp3.OkHttpClient CLIENT
-
-
Constructor Detail
-
DebeziumContainer
public DebeziumContainer(org.testcontainers.utility.DockerImageName containerImage)
-
DebeziumContainer
public DebeziumContainer(String containerImageName)
-
-
Method Detail
-
latestStable
public static DebeziumContainer latestStable()
-
defaultConfig
private void defaultConfig()
-
withKafka
public DebeziumContainer withKafka(org.testcontainers.containers.KafkaContainer kafkaContainer)
-
withKafka
public DebeziumContainer withKafka(org.testcontainers.containers.Network network, String bootstrapServers)
-
enableApicurioConverters
public DebeziumContainer enableApicurioConverters()
-
waitTimeForRecords
public static int waitTimeForRecords()
-
getTarget
public String getTarget()
-
getConnectorsUri
public String getConnectorsUri()
Returns the "/connectors/" endpoint.
-
getConnectorUri
public String getConnectorUri(String connectorName)
Returns the "/connectors/" endpoint.
-
getPauseConnectorUri
public String getPauseConnectorUri(String connectorName)
Returns the "/connectors//pause" endpoint.
-
getResumeConnectorUri
public String getResumeConnectorUri(String connectorName)
Returns the "/connectors//pause" endpoint.
-
getConnectorStatusUri
public String getConnectorStatusUri(String connectorName)
Returns the "/connectors//status" endpoint.
-
getConnectorConfigUri
public String getConnectorConfigUri(String connectorName)
Returns the "/connectors//config" endpoint.
-
registerConnector
public void registerConnector(String name, ConnectorConfiguration configuration)
-
updateOrCreateConnector
public void updateOrCreateConnector(String name, ConnectorConfiguration newConfiguration)
-
handleFailedResponse
private static void handleFailedResponse(okhttp3.Response response)
-
executePOSTRequestSuccessfully
private void executePOSTRequestSuccessfully(String payload, String fullUrl)
-
executePUTRequestSuccessfully
private void executePUTRequestSuccessfully(String payload, String fullUrl)
-
executeGETRequest
protected static okhttp3.Response executeGETRequest(okhttp3.Request request)
-
executeGETRequestSuccessfully
protected static okhttp3.Response executeGETRequestSuccessfully(okhttp3.Request request)
-
connectorIsNotRegistered
public boolean connectorIsNotRegistered(String connectorName)
-
deleteDebeziumConnector
protected void deleteDebeziumConnector(String connectorName)
-
deleteConnector
public void deleteConnector(String connectorName)
-
isConnectorConfigured
public boolean isConnectorConfigured(String connectorName)
-
ensureConnectorRegistered
public void ensureConnectorRegistered(String connectorName)
-
deleteAllConnectors
public void deleteAllConnectors()
-
getConnectorState
public Connector.State getConnectorState(String connectorName)
-
getConnectorTaskState
public Connector.State getConnectorTaskState(String connectorName, int taskNumber)
-
getConnectorConfigProperty
public String getConnectorConfigProperty(String connectorName, String configPropertyName)
-
pauseConnector
public void pauseConnector(String connectorName)
-
resumeConnector
public void resumeConnector(String connectorName)
-
ensureConnectorState
public void ensureConnectorState(String connectorName, Connector.State status)
-
ensureConnectorTaskState
public void ensureConnectorTaskState(String connectorName, int taskNumber, Connector.State status)
-
ensureConnectorConfigProperty
public void ensureConnectorConfigProperty(String connectorName, String propertyName, String expectedValue)
-
getPostgresConnectorConfiguration
public static ConnectorConfiguration getPostgresConnectorConfiguration(org.testcontainers.containers.PostgreSQLContainer<?> postgresContainer, int id, String... options)
-
-