Search in sources :

Example 56 with CqlSession

use of com.datastax.oss.driver.api.core.CqlSession in project cdc-apache-cassandra by datastax.

the class PulsarSingleNodeTests method testSchema.

@Test
@SuppressWarnings("unchecked")
public void testSchema() throws IOException, InterruptedException {
    final String pulsarServiceUrl = "pulsar://pulsar:" + pulsarContainer.BROKER_PORT;
    try (CassandraContainer<?> cassandraContainer1 = createCassandraContainer(1, pulsarServiceUrl, testNetwork)) {
        cassandraContainer1.start();
        try (CqlSession cqlSession = cassandraContainer1.getCqlSession()) {
            cqlSession.execute("CREATE KEYSPACE IF NOT EXISTS ks2 WITH replication = {'class':'SimpleStrategy','replication_factor':'1'};");
            cqlSession.execute("CREATE TABLE IF NOT EXISTS ks2.table1 (" + "xtext text, xascii ascii, xboolean boolean, xblob blob, xtimestamp timestamp, xtime time, xdate date, xuuid uuid, xtimeuuid timeuuid, xtinyint tinyint, xsmallint smallint, xint int, xbigint bigint, xvarint varint, xdecimal decimal, xdouble double, xfloat float, xinet4 inet, xinet6 inet, " + "primary key (xtext, xascii, xboolean, xblob, xtimestamp, xtime, xdate, xuuid, xtimeuuid, xtinyint, xsmallint, xint, xbigint, xvarint, xdecimal, xdouble, xfloat, xinet4, xinet6)) " + "WITH CLUSTERING ORDER BY (xascii ASC, xboolean DESC, xblob ASC, xtimestamp DESC, xtime DESC, xdate ASC, xuuid DESC, xtimeuuid ASC, xtinyint DESC, xsmallint ASC, xint DESC, xbigint ASC, xvarint DESC, xdecimal ASC, xdouble DESC, xfloat ASC, xinet4 ASC, xinet6 DESC) AND cdc=true");
            cqlSession.execute("INSERT INTO ks2.table1 (xtext, xascii, xboolean, xblob, xtimestamp, xtime, xdate, xuuid, xtimeuuid, xtinyint, xsmallint, xint, xbigint, xvarint, xdecimal, xdouble, xfloat, xinet4, xinet6) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", dataSpecMap.get("text").cqlValue, dataSpecMap.get("ascii").cqlValue, dataSpecMap.get("boolean").cqlValue, dataSpecMap.get("blob").cqlValue, dataSpecMap.get("timestamp").cqlValue, dataSpecMap.get("time").cqlValue, dataSpecMap.get("date").cqlValue, dataSpecMap.get("uuid").cqlValue, dataSpecMap.get("timeuuid").cqlValue, dataSpecMap.get("tinyint").cqlValue, dataSpecMap.get("smallint").cqlValue, dataSpecMap.get("int").cqlValue, dataSpecMap.get("bigint").cqlValue, dataSpecMap.get("varint").cqlValue, dataSpecMap.get("decimal").cqlValue, dataSpecMap.get("double").cqlValue, dataSpecMap.get("float").cqlValue, dataSpecMap.get("inet4").cqlValue, dataSpecMap.get("inet6").cqlValue);
        }
        drain(cassandraContainer1);
        try (PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarContainer.getPulsarBrokerUrl()).build();
            Consumer<GenericRecord> consumer = pulsarClient.newConsumer(Schema.AUTO_CONSUME()).topic("events-ks2.table1").subscriptionName("sub1").subscriptionType(SubscriptionType.Key_Shared).subscriptionMode(SubscriptionMode.Durable).subscriptionInitialPosition(SubscriptionInitialPosition.Earliest).subscribe()) {
            Message<GenericRecord> msg = consumer.receive(60, TimeUnit.SECONDS);
            Assert.assertNotNull("Expecting one message, check the agent log", msg);
            GenericRecord gr = msg.getValue();
            KeyValue<GenericRecord, GenericRecord> kv = (KeyValue<GenericRecord, GenericRecord>) gr.getNativeObject();
            GenericRecord key = kv.getKey();
            System.out.println("Consumer Record: topicName=" + msg.getTopicName() + " key=" + AgentTestUtil.genericRecordToString(key));
            Map<String, Object> keyMap = AgentTestUtil.genericRecordToMap(key);
            for (Field field : key.getFields()) {
                String vKey = field.getName().substring(1);
                Assert.assertTrue("Unknown field " + vKey, dataSpecMap.containsKey(vKey));
                if (keyMap.get(field.getName()) instanceof GenericRecord) {
                    AgentTestUtil.assertGenericRecords(vKey, (GenericRecord) keyMap.get(field.getName()), dataSpecMap);
                } else {
                    Assert.assertEquals("Wrong value for PK field " + field.getName(), dataSpecMap.get(vKey).avroValue, keyMap.get(field.getName()));
                }
            }
            consumer.acknowledgeAsync(msg);
        }
    }
}
Also used : Field(org.apache.pulsar.client.api.schema.Field) KeyValue(org.apache.pulsar.common.schema.KeyValue) PulsarClient(org.apache.pulsar.client.api.PulsarClient) GenericRecord(org.apache.pulsar.client.api.schema.GenericRecord) CqlSession(com.datastax.oss.driver.api.core.CqlSession) Test(org.junit.jupiter.api.Test)

Example 57 with CqlSession

use of com.datastax.oss.driver.api.core.CqlSession in project cdc-apache-cassandra by datastax.

the class PulsarSingleNodeTests method testStaticColumn.

@Test
@SuppressWarnings("unchecked")
public void testStaticColumn() throws IOException, InterruptedException {
    String pulsarServiceUrl = "pulsar://pulsar:" + pulsarContainer.BROKER_PORT;
    try (CassandraContainer<?> cassandraContainer1 = createCassandraContainer(1, pulsarServiceUrl, testNetwork)) {
        cassandraContainer1.start();
        try (CqlSession cqlSession = cassandraContainer1.getCqlSession()) {
            cqlSession.execute("CREATE KEYSPACE IF NOT EXISTS ks3 WITH replication = {'class':'SimpleStrategy','replication_factor':'1'};");
            cqlSession.execute("CREATE TABLE IF NOT EXISTS ks3.table1 (a text, b text, c text, d text static, PRIMARY KEY ((a), b)) with cdc=true;");
            cqlSession.execute("INSERT INTO ks3.table1 (a,b,c,d) VALUES ('a','b','c','d1');");
            cqlSession.execute("INSERT INTO ks3.table1 (a,d) VALUES ('a','d2');");
            cqlSession.execute("DELETE FROM ks3.table1 WHERE a = 'a'");
        }
        drain(cassandraContainer1);
        try (PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarContainer.getPulsarBrokerUrl()).build();
            Consumer<GenericRecord> consumer = pulsarClient.newConsumer(Schema.AUTO_CONSUME()).topic("events-ks3.table1").subscriptionName("sub1").subscriptionType(SubscriptionType.Key_Shared).subscriptionMode(SubscriptionMode.Durable).subscriptionInitialPosition(SubscriptionInitialPosition.Earliest).subscribe()) {
            Message<GenericRecord> msg = consumer.receive(120, TimeUnit.SECONDS);
            Assert.assertNotNull("Expecting one message, check the agent log", msg);
            GenericRecord gr = msg.getValue();
            KeyValue<GenericRecord, GenericRecord> kv = (KeyValue<GenericRecord, GenericRecord>) gr.getNativeObject();
            GenericRecord key = kv.getKey();
            Assert.assertEquals("a", key.getField("a"));
            Assert.assertEquals("b", key.getField("b"));
            consumer.acknowledgeAsync(msg);
            msg = consumer.receive(90, TimeUnit.SECONDS);
            Assert.assertNotNull("Expecting one message, check the agent log", msg);
            GenericRecord gr2 = msg.getValue();
            KeyValue<GenericRecord, GenericRecord> kv2 = (KeyValue<GenericRecord, GenericRecord>) gr2.getNativeObject();
            GenericRecord key2 = kv2.getKey();
            Assert.assertEquals("a", key2.getField("a"));
            Assert.assertEquals(null, key2.getField("b"));
            consumer.acknowledgeAsync(msg);
            msg = consumer.receive(90, TimeUnit.SECONDS);
            Assert.assertNotNull("Expecting one message, check the agent log", msg);
            GenericRecord gr3 = msg.getValue();
            KeyValue<GenericRecord, GenericRecord> kv3 = (KeyValue<GenericRecord, GenericRecord>) gr3.getNativeObject();
            GenericRecord key3 = kv3.getKey();
            Assert.assertEquals("a", key3.getField("a"));
            Assert.assertEquals(null, key3.getField("b"));
            consumer.acknowledgeAsync(msg);
        }
    }
}
Also used : KeyValue(org.apache.pulsar.common.schema.KeyValue) PulsarClient(org.apache.pulsar.client.api.PulsarClient) GenericRecord(org.apache.pulsar.client.api.schema.GenericRecord) CqlSession(com.datastax.oss.driver.api.core.CqlSession) Test(org.junit.jupiter.api.Test)

Example 58 with CqlSession

use of com.datastax.oss.driver.api.core.CqlSession in project cdc-apache-cassandra by datastax.

the class PulsarSingleNodeTests method testPartitionedTopic.

@Test
@SuppressWarnings("unchecked")
public void testPartitionedTopic() throws IOException, InterruptedException {
    final String pulsarServiceUrl = "pulsar://pulsar:" + pulsarContainer.BROKER_PORT;
    Container.ExecResult result = pulsarContainer.execInContainer("/pulsar/bin/pulsar-admin", "topics", "create-partitioned-topic", "persistent://public/default/events-pt.table1", "--partitions", "3");
    assertEquals(0, result.getExitCode(), "create-partitioned-topic failed:" + result.getStdout());
    int numMutation = 100;
    try (CassandraContainer<?> cassandraContainer1 = createCassandraContainer(1, pulsarServiceUrl, testNetwork)) {
        cassandraContainer1.start();
        try (CqlSession cqlSession = cassandraContainer1.getCqlSession()) {
            cqlSession.execute("CREATE KEYSPACE IF NOT EXISTS pt WITH replication = {'class':'SimpleStrategy','replication_factor':'1'};");
            cqlSession.execute("CREATE TABLE IF NOT EXISTS pt.table1 (a int, b blob, PRIMARY KEY (a)) with cdc=true;");
            for (int i = 0; i < 100; i++) cqlSession.execute("INSERT INTO pt.table1 (a,b) VALUES (?, ?);", i, AgentTestUtil.randomizeBuffer(i));
        }
        drain(cassandraContainer1);
        try (PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarContainer.getPulsarBrokerUrl()).build();
            Consumer<GenericRecord> consumer = pulsarClient.newConsumer(Schema.AUTO_CONSUME()).topic("events-pt.table1").subscriptionName("sub1").subscriptionType(SubscriptionType.Key_Shared).subscriptionMode(SubscriptionMode.Durable).subscriptionInitialPosition(SubscriptionInitialPosition.Earliest).subscribe()) {
            Message msg;
            int numMessage = 0;
            while ((msg = consumer.receive(60, TimeUnit.SECONDS)) != null && numMessage < numMutation) {
                numMessage++;
                consumer.acknowledge(msg);
            }
            assertEquals(numMutation, numMessage);
        }
    }
}
Also used : Container(org.testcontainers.containers.Container) ChaosNetworkContainer(com.datastax.testcontainers.ChaosNetworkContainer) CassandraContainer(com.datastax.testcontainers.cassandra.CassandraContainer) PulsarContainer(com.datastax.testcontainers.PulsarContainer) Message(org.apache.pulsar.client.api.Message) PulsarClient(org.apache.pulsar.client.api.PulsarClient) GenericRecord(org.apache.pulsar.client.api.schema.GenericRecord) CqlSession(com.datastax.oss.driver.api.core.CqlSession) Test(org.junit.jupiter.api.Test)

Example 59 with CqlSession

use of com.datastax.oss.driver.api.core.CqlSession in project cdc-apache-cassandra by datastax.

the class PulsarCassandraSourceTests method testCompoundPk.

// docker exec -it pulsar cat /pulsar/logs/functions/public/default/cassandra-source-ks1-table2/cassandra-source-ks1-table2-0.log
public void testCompoundPk(String ksName, Class<? extends Converter> keyConverter, Class<? extends Converter> valueConverter) throws InterruptedException, IOException {
    try {
        try (CqlSession cqlSession = cassandraContainer1.getCqlSession()) {
            cqlSession.execute("CREATE KEYSPACE IF NOT EXISTS " + ksName + " WITH replication = {'class':'SimpleStrategy','replication_factor':'2'};");
            cqlSession.execute("CREATE TABLE IF NOT EXISTS " + ksName + ".table2 (a text, b int, c int, PRIMARY KEY(a,b)) WITH cdc=true");
            cqlSession.execute("INSERT INTO " + ksName + ".table2 (a,b,c) VALUES('1',1,1)");
            cqlSession.execute("INSERT INTO " + ksName + ".table2 (a,b,c) VALUES('2',1,1)");
            cqlSession.execute("INSERT INTO " + ksName + ".table2 (a,b,c) VALUES('3',1,1)");
        }
        deployConnector(ksName, "table2", keyConverter, valueConverter);
        try (PulsarClient pulsarClient = PulsarClient.builder().serviceUrl(pulsarContainer.getPulsarBrokerUrl()).build()) {
            Map<String, Integer> mutationTable2 = new HashMap<>();
            try (Consumer<GenericRecord> consumer = pulsarClient.newConsumer(org.apache.pulsar.client.api.Schema.AUTO_CONSUME()).topic(String.format(Locale.ROOT, "data-%s.table2", ksName)).subscriptionName("sub1").subscriptionType(SubscriptionType.Key_Shared).subscriptionMode(SubscriptionMode.Durable).subscriptionInitialPosition(SubscriptionInitialPosition.Earliest).subscribe()) {
                Message<GenericRecord> msg;
                while ((msg = consumer.receive(60, TimeUnit.SECONDS)) != null && mutationTable2.values().stream().mapToInt(i -> i).sum() < 4) {
                    GenericObject genericObject = msg.getValue();
                    assertEquals(SchemaType.KEY_VALUE, genericObject.getSchemaType());
                    KeyValue<GenericRecord, GenericRecord> kv = (KeyValue<GenericRecord, GenericRecord>) genericObject.getNativeObject();
                    GenericRecord key = kv.getKey();
                    GenericRecord value = kv.getValue();
                    assertEquals((Integer) 0, mutationTable2.computeIfAbsent((String) key.getField("a"), k -> 0));
                    assertEquals(1, key.getField("b"));
                    assertEquals(1, value.getField("c"));
                    mutationTable2.compute((String) key.getField("a"), (k, v) -> v + 1);
                    consumer.acknowledge(msg);
                }
                assertEquals((Integer) 1, mutationTable2.get("1"));
                assertEquals((Integer) 1, mutationTable2.get("2"));
                assertEquals((Integer) 1, mutationTable2.get("3"));
                // trigger a schema update
                try (CqlSession cqlSession = cassandraContainer1.getCqlSession()) {
                    cqlSession.execute("CREATE TYPE " + ksName + ".type2 (a2 int, b2 boolean);");
                    cqlSession.execute("ALTER TABLE " + ksName + ".table2 ADD d type2");
                    cqlSession.execute("INSERT INTO " + ksName + ".table2 (a,b,c,d) VALUES('1',1,1,{a2:1,b2:true})");
                }
                while ((msg = consumer.receive(30, TimeUnit.SECONDS)) != null && mutationTable2.values().stream().mapToInt(i -> i).sum() < 5) {
                    GenericObject genericObject = msg.getValue();
                    assertEquals(SchemaType.KEY_VALUE, genericObject.getSchemaType());
                    KeyValue<GenericRecord, GenericRecord> kv = (KeyValue<GenericRecord, GenericRecord>) genericObject.getNativeObject();
                    GenericRecord key = kv.getKey();
                    GenericRecord value = kv.getValue();
                    assertEquals("1", key.getField("a"));
                    assertEquals(1, key.getField("b"));
                    assertEquals(1, value.getField("c"));
                    GenericRecord udtGenericRecord = (GenericRecord) value.getField("d");
                    assertEquals(1, udtGenericRecord.getField("a2"));
                    assertEquals(true, udtGenericRecord.getField("b2"));
                    mutationTable2.compute((String) key.getField("a"), (k, v) -> v + 1);
                    consumer.acknowledge(msg);
                }
                assertEquals((Integer) 2, mutationTable2.get("1"));
                assertEquals((Integer) 1, mutationTable2.get("2"));
                assertEquals((Integer) 1, mutationTable2.get("3"));
                // delete a row
                try (CqlSession cqlSession = cassandraContainer1.getCqlSession()) {
                    cqlSession.execute("DELETE FROM " + ksName + ".table2 WHERE a = '1' AND b = 1");
                }
                while ((msg = consumer.receive(30, TimeUnit.SECONDS)) != null && mutationTable2.values().stream().mapToInt(i -> i).sum() < 6) {
                    GenericObject genericObject = msg.getValue();
                    assertEquals(SchemaType.KEY_VALUE, genericObject.getSchemaType());
                    KeyValue<GenericRecord, GenericRecord> kv = (KeyValue<GenericRecord, GenericRecord>) genericObject.getNativeObject();
                    GenericRecord key = kv.getKey();
                    GenericRecord value = kv.getValue();
                    assertEquals("1", key.getField("a"));
                    assertEquals(1, key.getField("b"));
                    assertNull(value);
                    mutationTable2.compute((String) key.getField("a"), (k, v) -> v + 1);
                    consumer.acknowledge(msg);
                }
                assertEquals((Integer) 3, mutationTable2.get("1"));
                assertEquals((Integer) 1, mutationTable2.get("2"));
                assertEquals((Integer) 1, mutationTable2.get("3"));
            }
        }
    } finally {
        dumpFunctionLogs("cassandra-source-" + ksName + "-table2");
        undeployConnector(ksName, "table2");
    }
}
Also used : BatchStatementBuilder(com.datastax.oss.driver.api.core.cql.BatchStatementBuilder) DockerImageName(org.testcontainers.utility.DockerImageName) SubscriptionMode(org.apache.pulsar.client.api.SubscriptionMode) Field(org.apache.pulsar.client.api.schema.Field) Network(org.testcontainers.containers.Network) ByteBuffer(java.nio.ByteBuffer) AfterAll(org.junit.jupiter.api.AfterAll) BigDecimal(java.math.BigDecimal) GenericArray(org.apache.pulsar.shade.org.apache.avro.generic.GenericArray) BatchType(com.datastax.oss.driver.api.core.cql.BatchType) BeforeAll(org.junit.jupiter.api.BeforeAll) Locale(java.util.Locale) Duration(java.time.Duration) Map(java.util.Map) BigInteger(java.math.BigInteger) GenericData(org.apache.pulsar.shade.org.apache.avro.generic.GenericData) Conversion(org.apache.pulsar.shade.org.apache.avro.Conversion) GenericObject(org.apache.pulsar.client.api.schema.GenericObject) Schema(org.apache.pulsar.shade.org.apache.avro.Schema) Collection(java.util.Collection) SchemaBuilder(org.apache.pulsar.shade.org.apache.avro.SchemaBuilder) Set(java.util.Set) Collectors(java.util.stream.Collectors) UdtValue(com.datastax.oss.driver.api.core.data.UdtValue) StandardCharsets(java.nio.charset.StandardCharsets) Executors(java.util.concurrent.Executors) Test(org.junit.jupiter.api.Test) IOUtils(org.apache.commons.io.IOUtils) Consumer(org.apache.pulsar.client.api.Consumer) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) CassandraContainer(com.datastax.testcontainers.cassandra.CassandraContainer) Optional(java.util.Optional) Container(org.testcontainers.containers.Container) ImmutableSet(com.datastax.oss.driver.shaded.guava.common.collect.ImmutableSet) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) HashMap(java.util.HashMap) Message(org.apache.pulsar.client.api.Message) LogicalType(org.apache.pulsar.shade.org.apache.avro.LogicalType) SubscriptionInitialPosition(org.apache.pulsar.client.api.SubscriptionInitialPosition) GenericRecordBuilder(org.apache.pulsar.shade.org.apache.avro.generic.GenericRecordBuilder) SchemaType(org.apache.pulsar.common.schema.SchemaType) KeyValue(org.apache.pulsar.common.schema.KeyValue) CqlSession(com.datastax.oss.driver.api.core.CqlSession) NativeAvroConverter(com.datastax.oss.pulsar.source.converters.NativeAvroConverter) IndexedRecord(org.apache.pulsar.shade.org.apache.avro.generic.IndexedRecord) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) PulsarClient(org.apache.pulsar.client.api.PulsarClient) Utf8(org.apache.pulsar.shade.org.apache.avro.util.Utf8) CassandraSourceConnectorConfig(com.datastax.oss.cdc.CassandraSourceConnectorConfig) IOException(java.io.IOException) BatchStatement(com.datastax.oss.driver.api.core.cql.BatchStatement) PreparedStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement) SubscriptionType(org.apache.pulsar.client.api.SubscriptionType) ChaosNetworkContainer(com.datastax.testcontainers.ChaosNetworkContainer) GenericRecord(org.apache.pulsar.client.api.schema.GenericRecord) TimeUnit(java.util.concurrent.TimeUnit) UserDefinedType(com.datastax.oss.driver.api.core.type.UserDefinedType) PulsarContainer(com.datastax.testcontainers.PulsarContainer) DataSpec.dataSpecMap(com.datastax.oss.cdc.DataSpec.dataSpecMap) CqlDuration(com.datastax.oss.driver.api.core.data.CqlDuration) Assert(org.junit.Assert) KeyValue(org.apache.pulsar.common.schema.KeyValue) HashMap(java.util.HashMap) CqlSession(com.datastax.oss.driver.api.core.CqlSession) BigInteger(java.math.BigInteger) GenericObject(org.apache.pulsar.client.api.schema.GenericObject) PulsarClient(org.apache.pulsar.client.api.PulsarClient) GenericRecord(org.apache.pulsar.client.api.schema.GenericRecord)

Example 60 with CqlSession

use of com.datastax.oss.driver.api.core.CqlSession in project cdc-apache-cassandra by datastax.

the class CassandraClient method selectRowAsync.

/**
 * Try to read with downgraded consistency
 * @param pkValues primary key column
 * @param nodeId coordinator node id
 * @param consistencyLevels list of consistency to retry
 * @param preparedStatement CQL prepared statement
 * @param md5Digest mutation MD5 digest
 */
public CompletionStage<Tuple3<Row, ConsistencyLevel, UUID>> selectRowAsync(List<Object> pkValues, UUID nodeId, List<ConsistencyLevel> consistencyLevels, PreparedStatement preparedStatement, String md5Digest) {
    BoundStatement statement = preparedStatement.bind(pkValues.toArray(new Object[pkValues.size()]));
    // set the coordinator node
    Node node = null;
    if (nodeId != null) {
        node = cqlSession.getMetadata().getNodes().get(nodeId);
        if (node != null && node.getState().equals(NodeState.UP)) {
            statement = statement.setNode(node);
        }
    }
    log.debug("Fetching md5Digest={} coordinator={} query={} pk={} ", md5Digest, node, preparedStatement.getQuery(), pkValues);
    return executeWithDowngradeConsistencyRetry(cqlSession, statement, consistencyLevels).thenApply(tuple -> {
        log.debug("Read cl={} coordinator={} pk={}", tuple._2, tuple._1.getExecutionInfo().getCoordinator().getHostId(), pkValues);
        Row row = tuple._1.one();
        return new Tuple3<>(row, tuple._2, tuple._1.getExecutionInfo().getCoordinator().getHostId());
    }).whenComplete((tuple, error) -> {
        if (error != null) {
            log.warn("Failed to retrieve row: {}", error);
        }
    });
}
Also used : SessionBuilder(com.datastax.oss.common.sink.ssl.SessionBuilder) CqlIdentifier(com.datastax.oss.driver.api.core.CqlIdentifier) ProgrammaticDriverConfigLoaderBuilder(com.datastax.oss.driver.api.core.config.ProgrammaticDriverConfigLoaderBuilder) AUTH_PROVIDER_SERVICE(com.datastax.dse.driver.api.core.config.DseDriverOption.AUTH_PROVIDER_SERVICE) AsyncResultSet(com.datastax.oss.driver.api.core.cql.AsyncResultSet) NonNull(edu.umd.cs.findbugs.annotations.NonNull) ConsistencyLevel(com.datastax.oss.driver.api.core.ConsistencyLevel) AuthenticatorConfig(com.datastax.oss.common.sink.config.AuthenticatorConfig) Path(java.nio.file.Path) Select(com.datastax.oss.driver.api.querybuilder.select.Select) DseDriverOption(com.datastax.dse.driver.api.core.config.DseDriverOption) SslConfig(com.datastax.oss.common.sink.config.SslConfig) TypedDriverOption(com.datastax.oss.driver.api.core.config.TypedDriverOption) QueryBuilder.bindMarker(com.datastax.oss.driver.api.querybuilder.QueryBuilder.bindMarker) CqlSessionBuilder(com.datastax.oss.driver.api.core.CqlSessionBuilder) BoundStatement(com.datastax.oss.driver.api.core.cql.BoundStatement) QueryBuilder.selectFrom(com.datastax.oss.driver.api.querybuilder.QueryBuilder.selectFrom) InetSocketAddress(java.net.InetSocketAddress) KeyspaceMetadata(com.datastax.oss.driver.api.core.metadata.schema.KeyspaceMetadata) Slf4j(lombok.extern.slf4j.Slf4j) CompletionStage(java.util.concurrent.CompletionStage) DriverConfigLoader(com.datastax.oss.driver.api.core.config.DriverConfigLoader) PlainTextAuthProvider(com.datastax.oss.driver.internal.core.auth.PlainTextAuthProvider) Node(com.datastax.oss.driver.api.core.metadata.Node) DseGssApiAuthProvider(com.datastax.dse.driver.internal.core.auth.DseGssApiAuthProvider) java.util(java.util) Getter(lombok.Getter) Function(java.util.function.Function) ImmutableMap(com.datastax.oss.driver.shaded.guava.common.collect.ImmutableMap) OptionsMap(com.datastax.oss.driver.api.core.config.OptionsMap) AUTH_PROVIDER_SASL_PROPERTIES(com.datastax.dse.driver.api.core.config.DseDriverOption.AUTH_PROVIDER_SASL_PROPERTIES) DefaultDriverOption(com.datastax.oss.driver.api.core.config.DefaultDriverOption) CqlSession(com.datastax.oss.driver.api.core.CqlSession) ConfigFactory(com.typesafe.config.ConfigFactory) Metadata(com.datastax.oss.driver.api.core.metadata.Metadata) Row(com.datastax.oss.driver.api.core.cql.Row) TableMetadata(com.datastax.oss.driver.api.core.metadata.schema.TableMetadata) NodeState(com.datastax.oss.driver.api.core.metadata.NodeState) Config(com.typesafe.config.Config) UnavailableException(com.datastax.oss.driver.api.core.servererrors.UnavailableException) ContactPointsValidator(com.datastax.oss.common.sink.config.ContactPointsValidator) PreparedStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement) ColumnMetadata(com.datastax.oss.driver.api.core.metadata.schema.ColumnMetadata) DefaultDriverConfigLoader(com.datastax.oss.driver.internal.core.config.typesafe.DefaultDriverConfigLoader) DefaultProgrammaticDriverConfigLoaderBuilder(com.datastax.oss.driver.internal.core.config.typesafe.DefaultProgrammaticDriverConfigLoaderBuilder) ExecutionException(java.util.concurrent.ExecutionException) Tuple2(io.vavr.Tuple2) SchemaChangeListener(com.datastax.oss.driver.api.core.metadata.schema.SchemaChangeListener) Tuple3(io.vavr.Tuple3) UUIDUtil.generateClientId(com.datastax.oss.common.sink.util.UUIDUtil.generateClientId) Node(com.datastax.oss.driver.api.core.metadata.Node) Row(com.datastax.oss.driver.api.core.cql.Row) BoundStatement(com.datastax.oss.driver.api.core.cql.BoundStatement)

Aggregations

CqlSession (com.datastax.oss.driver.api.core.CqlSession)577 Test (org.junit.Test)286 ResultSet (com.datastax.oss.driver.api.core.cql.ResultSet)118 Row (com.datastax.oss.driver.api.core.cql.Row)98 PreparedStatement (com.datastax.oss.driver.api.core.cql.PreparedStatement)82 Test (org.junit.jupiter.api.Test)78 DriverConfigLoader (com.datastax.oss.driver.api.core.config.DriverConfigLoader)65 List (java.util.List)54 Map (java.util.Map)52 SimpleStatement (com.datastax.oss.driver.api.core.cql.SimpleStatement)51 Node (com.datastax.oss.driver.api.core.metadata.Node)50 ArrayList (java.util.ArrayList)49 BeforeClass (org.junit.BeforeClass)43 Metadata (com.datastax.oss.driver.api.core.metadata.Metadata)41 HashMap (java.util.HashMap)37 UUID (java.util.UUID)36 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)32 CqlIdentifier (com.datastax.oss.driver.api.core.CqlIdentifier)30 BoundStatement (com.datastax.oss.driver.api.core.cql.BoundStatement)30 AsyncResultSet (com.datastax.oss.driver.api.core.cql.AsyncResultSet)27