use of com.datastax.oss.sink.pulsar.PulsarRecordImpl in project pulsar-sink by datastax.
the class SslEndToEndCCMIT method raw_bigint_value_using_base64_encoded_keystore.
@Test
void raw_bigint_value_using_base64_encoded_keystore() throws Exception {
Map<String, String> extras = ImmutableMap.<String, String>builder().put(SslConfig.PROVIDER_OPT, "JDK").put(SslConfig.KEYSTORE_PATH_OPT, encodeFile(CcmBridge.DEFAULT_CLIENT_KEYSTORE_FILE)).put(SslConfig.KEYSTORE_PASSWORD_OPT, CcmBridge.DEFAULT_CLIENT_KEYSTORE_PASSWORD).put(SslConfig.HOSTNAME_VALIDATION_OPT, "false").put(SslConfig.TRUSTSTORE_PATH_OPT, encodeFile(CcmBridge.DEFAULT_CLIENT_TRUSTSTORE_FILE)).put(SslConfig.TRUSTSTORE_PASSWORD_OPT, CcmBridge.DEFAULT_CLIENT_TRUSTSTORE_PASSWORD).build();
taskConfigs.add(makeConnectorProperties(extras));
PulsarRecordImpl record = new PulsarRecordImpl("persistent://tenant/namespace/mytopic", null, new GenericRecordImpl().put("bigint", 5725368L), recordType);
runTaskWithRecords(record);
// Verify that the record was inserted properly in the database.
List<Row> results = session.execute("SELECT bigintcol FROM types").all();
assertThat(results.size()).isEqualTo(1);
Row row = results.get(0);
assertThat(row.getLong("bigintcol")).isEqualTo(5725368L);
}
use of com.datastax.oss.sink.pulsar.PulsarRecordImpl in project pulsar-sink by datastax.
the class SslEndToEndCCMIT method raw_bigint_value_with_openssl_without_hostname_validation.
@Test
void raw_bigint_value_with_openssl_without_hostname_validation() {
Map<String, String> extras = ImmutableMap.<String, String>builder().put(SslConfig.PROVIDER_OPT, "OpenSSL").put(SslConfig.HOSTNAME_VALIDATION_OPT, "false").put(SslConfig.OPENSSL_KEY_CERT_CHAIN_OPT, CcmBridge.DEFAULT_CLIENT_CERT_CHAIN_FILE.getAbsolutePath()).put(SslConfig.OPENSSL_PRIVATE_KEY_OPT, CcmBridge.DEFAULT_CLIENT_PRIVATE_KEY_FILE.getAbsolutePath()).put(SslConfig.TRUSTSTORE_PATH_OPT, CcmBridge.DEFAULT_CLIENT_TRUSTSTORE_FILE.getAbsolutePath()).put(SslConfig.TRUSTSTORE_PASSWORD_OPT, CcmBridge.DEFAULT_CLIENT_TRUSTSTORE_PASSWORD).build();
taskConfigs.add(makeConnectorProperties(extras));
PulsarRecordImpl record = new PulsarRecordImpl("persistent://tenant/namespace/mytopic", null, new GenericRecordImpl().put("bigint", 5725368L), recordType);
runTaskWithRecords(record);
// Verify that the record was inserted properly in the database.
List<Row> results = session.execute("SELECT bigintcol FROM types").all();
assertThat(results.size()).isEqualTo(1);
Row row = results.get(0);
assertThat(row.getLong("bigintcol")).isEqualTo(5725368L);
}
use of com.datastax.oss.sink.pulsar.PulsarRecordImpl in project pulsar-sink by datastax.
the class CloudSniEndToEndIT method performInsert.
private void performInsert(ConsistencyLevel cl, Map<String, String> extras) {
taskConfigs.add(makeCloudConnectorProperties("bigintcol=value.bigint", "types", extras, "mytopic", cl));
PulsarRecordImpl record = new PulsarRecordImpl("persistent://tenant/namespace/mytopic", null, new GenericRecordImpl().put("bigint", 5725368L), recordType);
runTaskWithRecords(record);
// Verify that the record was inserted properly in the database.
List<Row> results = session.execute("SELECT bigintcol FROM types").all();
assertThat(results.size()).isEqualTo(1);
Row row = results.get(0);
assertThat(row.getLong("bigintcol")).isEqualTo(5725368L);
}
use of com.datastax.oss.sink.pulsar.PulsarRecordImpl in project pulsar-sink by datastax.
the class JsonEndToEndCCMIT method timezone_and_locale_UNITS_SINCE_EPOCH.
@Test
void timezone_and_locale_UNITS_SINCE_EPOCH() {
taskConfigs.add(makeConnectorProperties("bigintcol=value.key, " + "datecol=value.vdate, " + "timecol=value.vtime, " + "secondscol=value.vseconds", ImmutableMap.<String, String>builder().put("topic.mytopic.codec.timeZone", "Europe/Paris").put("topic.mytopic.codec.locale", "fr_FR").put("topic.mytopic.codec.date", "cccc, d MMMM uuuu").put("topic.mytopic.codec.time", "HHmmssSSS").put("topic.mytopic.codec.timestamp", "UNITS_SINCE_EPOCH").put("topic.mytopic.codec.unit", "SECONDS").build()));
String value = "{\n" + " \"key\": 4376,\n" + " \"vdate\": \"vendredi, 9 mars 2018\",\n" + " \"vtime\": 171232584,\n" + " \"vseconds\": 1520611952\n" + "}";
PulsarRecordImpl record = new PulsarRecordImpl("persistent://tenant/namespace/mytopic", null, value, Schema.STRING);
runTaskWithRecords(record);
// Verify that the record was inserted properly in the database.
List<Row> results = session.execute("SELECT datecol, timecol, secondscol FROM types").all();
assertThat(results.size()).isEqualTo(1);
Row row = results.get(0);
assertThat(row.getLocalDate("datecol")).isEqualTo(LocalDate.of(2018, 3, 9));
assertThat(row.getLocalTime("timecol")).isEqualTo(LocalTime.of(17, 12, 32, 584_000_000));
assertThat(row.getInstant("secondscol")).isEqualTo(Instant.parse("2018-03-09T16:12:32Z"));
}
use of com.datastax.oss.sink.pulsar.PulsarRecordImpl in project pulsar-sink by datastax.
the class JsonEndToEndCCMIT method raw_udt_value_and_cherry_pick_from_json_string.
@Test
void raw_udt_value_and_cherry_pick_from_json_string() {
taskConfigs.add(makeConnectorProperties("bigintcol=key, udtcol=value, intcol=value.udtmem1"));
PulsarRecordImpl record = new PulsarRecordImpl("persistent://tenant/namespace/mytopic", "98761234", "{\"udtmem1\": 42, \"udtmem2\": \"the answer\"}", Schema.STRING);
runTaskWithRecords(record);
// Verify that the record was inserted properly in the database.
List<Row> results = session.execute("SELECT bigintcol, udtcol, intcol FROM types").all();
assertThat(results.size()).isEqualTo(1);
Row row = results.get(0);
assertThat(row.getLong("bigintcol")).isEqualTo(98761234L);
UserDefinedType udt = new UserDefinedTypeBuilder(keyspaceName, "myudt").withField("udtmem1", DataTypes.INT).withField("udtmem2", DataTypes.TEXT).build();
udt.attach(session.getContext());
assertThat(row.getUdtValue("udtcol")).isEqualTo(udt.newValue(42, "the answer"));
assertThat(row.getInt("intcol")).isEqualTo(42);
}
Aggregations