Search in sources :

Example 1 with MYSQL_PORT

use of org.testcontainers.containers.MySQLContainer.MYSQL_PORT in project hazelcast by hazelcast.

the class MySqlCdcNetworkIntegrationTest method initMySql.

private MySQLContainer<?> initMySql(Network network, Integer fixedExposedPort) {
    MySQLContainer<?> mysql = namedTestContainer(new MySQLContainer<>(AbstractMySqlCdcIntegrationTest.DOCKER_IMAGE).withUsername("mysqluser").withPassword("mysqlpw"));
    if (fixedExposedPort != null) {
        Consumer<CreateContainerCmd> cmd = e -> e.withPortBindings(new PortBinding(Ports.Binding.bindPort(fixedExposedPort), new ExposedPort(MYSQL_PORT)));
        mysql = mysql.withCreateContainerCmdModifier(cmd);
    }
    if (network != null) {
        mysql = mysql.withNetwork(network);
    }
    mysql.start();
    return mysql;
}
Also used : CreateContainerCmd(com.github.dockerjava.api.command.CreateContainerCmd) Arrays(java.util.Arrays) Ports(com.github.dockerjava.api.model.Ports) Connection(java.sql.Connection) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) RunWith(org.junit.runner.RunWith) Parameters(org.junit.runners.Parameterized.Parameters) RetryStrategies(com.hazelcast.jet.retry.RetryStrategies) TimeoutException(java.util.concurrent.TimeoutException) HazelcastSerialParametersRunnerFactory(com.hazelcast.test.HazelcastSerialParametersRunnerFactory) StreamSource(com.hazelcast.jet.pipeline.StreamSource) Network(org.testcontainers.containers.Network) JetException(com.hazelcast.jet.JetException) CreateContainerCmd(com.github.dockerjava.api.command.CreateContainerCmd) SQLException(java.sql.SQLException) Util.entry(com.hazelcast.jet.Util.entry) After(org.junit.After) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) ExposedPort(com.github.dockerjava.api.model.ExposedPort) Assume(org.junit.Assume) Assert.fail(org.junit.Assert.fail) PortBinding(com.github.dockerjava.api.model.PortBinding) ChangeRecord(com.hazelcast.jet.cdc.ChangeRecord) AbstractCdcIntegrationTest(com.hazelcast.jet.cdc.AbstractCdcIntegrationTest) Job(com.hazelcast.jet.Job) Before(org.junit.Before) UseParametersRunnerFactory(org.junit.runners.Parameterized.UseParametersRunnerFactory) HazelcastInstance(com.hazelcast.core.HazelcastInstance) NightlyTest(com.hazelcast.test.annotation.NightlyTest) HazelcastParametrizedRunner(com.hazelcast.test.HazelcastParametrizedRunner) Pipeline(com.hazelcast.jet.pipeline.Pipeline) Parameter(org.junit.runners.Parameterized.Parameter) Collection(java.util.Collection) Sinks(com.hazelcast.jet.pipeline.Sinks) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) Category(org.junit.experimental.categories.Category) MySQLContainer(org.testcontainers.containers.MySQLContainer) ExecutionException(java.util.concurrent.ExecutionException) Consumer(java.util.function.Consumer) ToxiproxyContainer(org.testcontainers.containers.ToxiproxyContainer) Statement(java.sql.Statement) RUNNING(com.hazelcast.jet.core.JobStatus.RUNNING) RetryStrategy(com.hazelcast.jet.retry.RetryStrategy) MYSQL_PORT(org.testcontainers.containers.MySQLContainer.MYSQL_PORT) SECONDS(java.util.concurrent.TimeUnit.SECONDS) Assert.assertEquals(org.junit.Assert.assertEquals) ExposedPort(com.github.dockerjava.api.model.ExposedPort) PortBinding(com.github.dockerjava.api.model.PortBinding)

Aggregations

CreateContainerCmd (com.github.dockerjava.api.command.CreateContainerCmd)1 ExposedPort (com.github.dockerjava.api.model.ExposedPort)1 PortBinding (com.github.dockerjava.api.model.PortBinding)1 Ports (com.github.dockerjava.api.model.Ports)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 JetException (com.hazelcast.jet.JetException)1 Job (com.hazelcast.jet.Job)1 Util.entry (com.hazelcast.jet.Util.entry)1 AbstractCdcIntegrationTest (com.hazelcast.jet.cdc.AbstractCdcIntegrationTest)1 ChangeRecord (com.hazelcast.jet.cdc.ChangeRecord)1 RUNNING (com.hazelcast.jet.core.JobStatus.RUNNING)1 Pipeline (com.hazelcast.jet.pipeline.Pipeline)1 Sinks (com.hazelcast.jet.pipeline.Sinks)1 StreamSource (com.hazelcast.jet.pipeline.StreamSource)1 RetryStrategies (com.hazelcast.jet.retry.RetryStrategies)1 RetryStrategy (com.hazelcast.jet.retry.RetryStrategy)1 HazelcastParametrizedRunner (com.hazelcast.test.HazelcastParametrizedRunner)1 HazelcastSerialParametersRunnerFactory (com.hazelcast.test.HazelcastSerialParametersRunnerFactory)1 NightlyTest (com.hazelcast.test.annotation.NightlyTest)1 Connection (java.sql.Connection)1