nullStrings) {
30 | super(jsonCodec, objectMapper, nullStrings);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/executor/reactor/src/main/java/com/datastax/oss/dsbulk/executor/reactor/ReactorBulkExecutor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.reactor;
17 |
18 | import com.datastax.oss.dsbulk.executor.api.BulkExecutor;
19 | import com.datastax.oss.dsbulk.executor.reactor.reader.ReactorBulkReader;
20 | import com.datastax.oss.dsbulk.executor.reactor.writer.ReactorBulkWriter;
21 |
22 | /**
23 | * An execution unit for {@link ReactorBulkWriter bulk writes} and {@link ReactorBulkReader bulk
24 | * reads} that operates in reactive mode using Reactor.
25 | */
26 | public interface ReactorBulkExecutor extends ReactorBulkWriter, ReactorBulkReader, BulkExecutor {}
27 |
--------------------------------------------------------------------------------
/runner/src/main/java/com/datastax/oss/dsbulk/runner/cli/GlobalHelpRequestException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.runner.cli;
17 |
18 | import edu.umd.cs.findbugs.annotations.Nullable;
19 |
20 | /** Simple exception indicating that the user wants the main help output. */
21 | public class GlobalHelpRequestException extends Exception {
22 |
23 | private final String connectorName;
24 |
25 | GlobalHelpRequestException() {
26 | this(null);
27 | }
28 |
29 | GlobalHelpRequestException(@Nullable String connectorName) {
30 | this.connectorName = connectorName;
31 | }
32 |
33 | @Nullable
34 | public String getConnectorName() {
35 | return connectorName;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/url/src/test/java/com/datastax/oss/dsbulk/url/UncloseableOutputStreamTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import static org.mockito.Mockito.never;
19 | import static org.mockito.Mockito.spy;
20 | import static org.mockito.Mockito.verify;
21 |
22 | import java.io.ByteArrayOutputStream;
23 | import org.junit.jupiter.api.Test;
24 |
25 | class UncloseableOutputStreamTest {
26 |
27 | @Test
28 | void should_not_close_output_stream() throws Exception {
29 | ByteArrayOutputStream delegate = spy(new ByteArrayOutputStream());
30 | UncloseableOutputStream is = new UncloseableOutputStream(delegate);
31 | is.close();
32 | verify(delegate, never()).close();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/utils/MemoryUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.utils;
17 |
18 | import com.sun.management.OperatingSystemMXBean;
19 | import java.lang.management.ManagementFactory;
20 |
21 | public class MemoryUtils {
22 |
23 | /**
24 | * Returns the system's free memory in megabytes.
25 | *
26 | * This includes the free physical memory + the free swap memory.
27 | */
28 | public static long getFreeMemoryMB() {
29 | OperatingSystemMXBean bean =
30 | (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
31 | return (bean.getFreePhysicalMemorySize() + bean.getFreeSwapSpaceSize()) / 1024 / 1024;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/executor/api/src/main/java/com/datastax/oss/dsbulk/executor/api/BulkExecutor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.api;
17 |
18 | import com.datastax.oss.dsbulk.executor.api.reader.BulkReader;
19 | import com.datastax.oss.dsbulk.executor.api.writer.BulkWriter;
20 |
21 | /**
22 | * An execution unit for {@link BulkWriter bulk writes} and {@link BulkReader bulk reads} that
23 | * operates in 3 distinct modes: {@link SyncBulkExecutor synchronous} (blocking), {@link
24 | * AsyncBulkExecutor asynchronous} (non-blocking), and {@link ReactiveBulkExecutor reactive}.
25 | */
26 | public interface BulkExecutor
27 | extends BulkWriter, BulkReader, SyncBulkExecutor, AsyncBulkExecutor, ReactiveBulkExecutor {}
28 |
--------------------------------------------------------------------------------
/runner/src/it/resources/number.csv:
--------------------------------------------------------------------------------
1 | key;vdouble;vdecimal
2 |
3 | # Scientific notation
4 | scientific_notation;1.0e+7;1.0e+7
5 |
6 | # 1e+7 in regular notation
7 | regular_notation;10000000;10000000
8 |
9 | # Hexadecimal floating point notation
10 | hex_notation;0x1.fffffffffffffP+1023;0x1.fffffffffffffP+1023
11 |
12 | # Cannot be represented exactly with IEEE 754
13 | irrational;0.1;0.1
14 |
15 | # Double.NaN
16 | Double.NaN;NaN;
17 |
18 | # Double.POSITIVE_INFINITY
19 | Double.POSITIVE_INFINITY;+Infinity;
20 |
21 | # Double.NEGATIVE_INFINITY
22 | Double.NEGATIVE_INFINITY;-Infinity;
23 |
24 | # Double.MAX_VALUE
25 | Double.MAX_VALUE;1.7976931348623157E308;1.7976931348623157E308
26 |
27 | # Double.MIN_VALUE
28 | Double.MIN_VALUE;4.9E-324;4.9E-324
29 |
30 | # Double.MIN_NORMAL
31 | Double.MIN_NORMAL;2.2250738585072014E-308;2.2250738585072014E-308
32 |
33 | # Float.MAX_VALUE, in regular notation
34 | Float.MAX_VALUE;340,282,350,000,000,000,000,000,000,000,000,000,000;340,282,350,000,000,000,000,000,000,000,000,000,000
35 |
36 | # Float.MIN_VALUE, in regular notation
37 | Float.MIN_VALUE;0.0000000000000000000000000000000000000000000014;0.0000000000000000000000000000000000000000000014
38 |
39 | # Too many precision digits (> 16), will be rejected or truncated
40 | too_many_digits;0.12345678901234567890123456789;0.12345678901234567890123456789
41 |
42 |
--------------------------------------------------------------------------------
/url/README.md:
--------------------------------------------------------------------------------
1 | # DataStax Bulk Loader URL Utilities
2 |
3 | This module contains URL utilities for DSBulk, among which:
4 |
5 | 1. DSBulk's `BulkLoaderURLStreamHandlerFactory`, which is DSBulk's default factory for URL handlers;
6 | 2. A URL stream handler for reading / writing to standard input / output.
7 | 3. A URL stream handler for reading from AWS S3 URLs.
8 | 1. Every S3 URL must contain the proper query parameters from which an `S3Client` can be built. These parameters are:
9 | 1. `region` (required): The AWS region, such as `us-west-1`.
10 | 2. `profile` (optional, preferred): The profile to use to provide credentials. See [the AWS SDK credentials documentation](https://docs.aws.amazon.com/sdk-for-java/latest/developer-guide/credentials.html) for more information.
11 | 3. `accessKeyId` and `secretKeyId` (optional, discouraged): In case you don't have a profile set up, you can use this less-secure method. Both parameters are required if you choose this.
12 | 2. If only the `region` is provided, DSBulk will fall back to the default AWS credentials provider, which handles role-based credentials.
13 | 3. To prevent unnecessary client re-creation when using many URLs from a `urlfile`, `S3Client`s are cached by the query parameters. The size of the cache is controlled by the `dsbulk.s3.clientCacheSize` option (default: 20).
14 |
--------------------------------------------------------------------------------
/url/src/test/java/com/datastax/oss/dsbulk/url/UncloseableInputStreamTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import static org.mockito.Mockito.never;
19 | import static org.mockito.Mockito.spy;
20 | import static org.mockito.Mockito.verify;
21 |
22 | import java.io.ByteArrayInputStream;
23 | import org.junit.jupiter.api.Test;
24 |
25 | class UncloseableInputStreamTest {
26 |
27 | @Test
28 | void should_not_close_input_stream() throws Exception {
29 | ByteArrayInputStream delegate = spy(new ByteArrayInputStream(new byte[] {1, 2, 3}));
30 | UncloseableInputStream is = new UncloseableInputStream(delegate);
31 | is.close();
32 | verify(delegate, never()).close();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/connectors/api/src/main/java/com/datastax/oss/dsbulk/connectors/api/Resource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.connectors.api;
17 |
18 | import edu.umd.cs.findbugs.annotations.NonNull;
19 | import java.net.URI;
20 | import org.reactivestreams.Publisher;
21 |
22 | /**
23 | * A resource that can be read from or written to. It could be a file, a database table, etc.
24 | *
25 | *
Resources are sources of records, and are identified by a unique URI.
26 | */
27 | public interface Resource {
28 |
29 | /** @return The URI of this resource. */
30 | @NonNull
31 | URI getURI();
32 |
33 | /** @return A publisher that will emit records from this resource. */
34 | @NonNull
35 | Publisher read();
36 | }
37 |
--------------------------------------------------------------------------------
/codecs/api/src/main/java/com/datastax/oss/dsbulk/codecs/api/ConversionContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.api;
17 |
18 | import edu.umd.cs.findbugs.annotations.NonNull;
19 | import java.util.concurrent.ConcurrentHashMap;
20 | import java.util.concurrent.ConcurrentMap;
21 |
22 | public class ConversionContext {
23 |
24 | private final ConcurrentMap attributes = new ConcurrentHashMap<>();
25 |
26 | public void addAttribute(@NonNull String key, Object value) {
27 | attributes.put(key, value);
28 | }
29 |
30 | @SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
31 | public T getAttribute(@NonNull String key) {
32 | return (T) attributes.get(key);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/distribution/src/assembly/sources.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 | sources
21 |
22 | jar
23 |
24 | false
25 |
26 |
27 | ${project.build.directory}/sources
28 | ./
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/runner/src/main/java/com/datastax/oss/dsbulk/runner/cli/ParsedCommandLine.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.runner.cli;
17 |
18 | import com.datastax.oss.dsbulk.workflow.api.WorkflowProvider;
19 | import com.typesafe.config.Config;
20 |
21 | public class ParsedCommandLine {
22 |
23 | private final WorkflowProvider workflowProvider;
24 | private final Config config;
25 |
26 | ParsedCommandLine(WorkflowProvider workflowProvider, Config config) {
27 | this.workflowProvider = workflowProvider;
28 | this.config = config;
29 | }
30 |
31 | public WorkflowProvider getWorkflowProvider() {
32 | return workflowProvider;
33 | }
34 |
35 | public Config getConfig() {
36 | return config;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/utils/StringUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.commons.utils;
17 |
18 | public class StringUtils {
19 |
20 | /**
21 | * Left pad a string with spaces to a size of {@code size}.
22 | *
23 | * @param s String to pad.
24 | * @param size the size.
25 | * @return the padded string.
26 | */
27 | public static String leftPad(String s, int size) {
28 | int repeat = size - s.length();
29 | if (repeat <= 0) {
30 | return s;
31 | }
32 | char[] buf = new char[repeat];
33 | for (int i = 0; i < repeat; i++) {
34 | buf[i] = ' ';
35 | }
36 | return new String(buf).concat(s);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/io/src/test/java/com/datastax/oss/dsbulk/io/IOUtilsTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.io;
17 |
18 | import static org.assertj.core.api.Assertions.assertThat;
19 |
20 | import com.datastax.oss.dsbulk.url.BulkLoaderURLStreamHandlerFactory;
21 | import java.net.MalformedURLException;
22 | import java.net.URL;
23 | import org.junit.jupiter.api.Test;
24 |
25 | class IOUtilsTest {
26 |
27 | static {
28 | BulkLoaderURLStreamHandlerFactory.install();
29 | }
30 |
31 | @Test
32 | void should_detect_standard_stream_url() throws MalformedURLException {
33 | assertThat(IOUtils.isStandardStream(new URL("http://acme.com"))).isFalse();
34 | assertThat(IOUtils.isStandardStream(new URL("std:/"))).isTrue();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/appveyor.ps1:
--------------------------------------------------------------------------------
1 | Add-Type -AssemblyName System.IO.Compression.FileSystem
2 |
3 | $dep_dir="C:\Users\appveyor\deps"
4 | If (!(Test-Path $dep_dir)) {
5 | Write-Host "Creating $($dep_dir)"
6 | New-Item -Path $dep_dir -ItemType Directory -Force
7 | }
8 |
9 | $openssl_platform = "Win32"
10 | $vc_platform = "x86"
11 | If ($env:PLATFORM -eq "X64") {
12 | $vc_platform = "x64"
13 | }
14 |
15 | $env:JAVA_HOME="C:\Program Files\Java\jdk$($env:java_version)"
16 | # The configured java version to test with.
17 |
18 | $maven_base = "$($dep_dir)\maven"
19 | $maven_path = "$($maven_base)\apache-maven-3.2.5"
20 | If (!(Test-Path $maven_path)) {
21 | Write-Host "Installing Maven"
22 | $maven_url = "https://www.dropbox.com/s/fh9kffmexprsmha/apache-maven-3.2.5-bin.zip?raw=1"
23 | $maven_zip = "C:\Users\appveyor\apache-maven-3.2.5-bin.zip"
24 | (new-object System.Net.WebClient).DownloadFile($maven_url, $maven_zip)
25 | [System.IO.Compression.ZipFile]::ExtractToDirectory($maven_zip, $maven_base)
26 | }
27 | $env:M2_HOME="$($maven_path)"
28 | $env:PATH="$($maven_path)\bin;$($env:PATH)"
29 |
30 | # Environment variables for Publisher Verification tests (Reactive Streams TCK)
31 | $env:DEFAULT_TIMEOUT_MILLIS=1000
32 | $env:DEFAULT_NO_SIGNALS_TIMEOUT_MILLIS=1000
33 | $env:PUBLISHER_REFERENCE_GC_TIMEOUT_MILLIS=1000
34 |
35 | Copy-Item ./ci/settings.xml -Destination "$($maven_path)\conf\settings.xml"
--------------------------------------------------------------------------------
/executor/reactor/src/main/java/com/datastax/oss/dsbulk/executor/reactor/DefaultReactorBulkExecutorBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.reactor;
17 |
18 | import com.datastax.oss.driver.api.core.CqlSession;
19 | import com.datastax.oss.dsbulk.executor.api.AbstractBulkExecutorBuilder;
20 |
21 | /** A builder for {@link DefaultReactorBulkExecutor} instances. */
22 | public class DefaultReactorBulkExecutorBuilder
23 | extends AbstractBulkExecutorBuilder {
24 |
25 | DefaultReactorBulkExecutorBuilder(CqlSession session) {
26 | super(session);
27 | }
28 |
29 | @Override
30 | public DefaultReactorBulkExecutor build() {
31 | return new DefaultReactorBulkExecutor(this);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/logging/LogInterceptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.logging;
17 |
18 | import ch.qos.logback.classic.spi.ILoggingEvent;
19 | import java.util.List;
20 | import java.util.stream.Collectors;
21 |
22 | public interface LogInterceptor {
23 |
24 | List getLoggedEvents();
25 |
26 | default List getLoggedMessages() {
27 | return getLoggedEvents().stream()
28 | .map(ILoggingEvent::getFormattedMessage)
29 | .collect(Collectors.toList());
30 | }
31 |
32 | default String getAllMessagesAsString() {
33 | return getLoggedMessages().stream().collect(Collectors.joining(System.lineSeparator()));
34 | }
35 |
36 | void clear();
37 | }
38 |
--------------------------------------------------------------------------------
/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/statement/MappedStatement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.commons.statement;
17 |
18 | import com.datastax.oss.dsbulk.connectors.api.Record;
19 | import edu.umd.cs.findbugs.annotations.NonNull;
20 |
21 | /**
22 | * A statement that has been produced by mapping fields of a {@link Record} to variables in the
23 | * query.
24 | *
25 | * @see com.datastax.oss.dsbulk.workflow.commons.schema.DefaultRecordMapper
26 | */
27 | public interface MappedStatement {
28 |
29 | /**
30 | * Returns the record that this statement was mapped from.
31 | *
32 | * @return the record of this statement.
33 | */
34 | @NonNull
35 | Record getRecord();
36 | }
37 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/driver/annotations/SessionFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.driver.annotations;
17 |
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Annotation that marks a method as being a factory for {@link
26 | * com.datastax.oss.driver.api.core.CqlSession} instances.
27 | *
28 | * Such methods must be static and their return type must be {@link
29 | * com.datastax.oss.driver.api.core.CqlSessionBuilder}.
30 | */
31 | @Retention(RUNTIME)
32 | @Target(METHOD)
33 | public @interface SessionFactory {}
34 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/ccm/annotations/CCMFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.ccm.annotations;
17 |
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import com.datastax.oss.dsbulk.tests.ccm.CCMCluster;
22 | import com.datastax.oss.dsbulk.tests.ccm.DefaultCCMCluster.Builder;
23 | import java.lang.annotation.Retention;
24 | import java.lang.annotation.Target;
25 |
26 | /**
27 | * Annotation that marks a method as being a factory for {@link CCMCluster} instances.
28 | *
29 | *
Such methods must be static and their return type must be {@link Builder}.
30 | */
31 | @Retention(RUNTIME)
32 | @Target(METHOD)
33 | public @interface CCMFactory {}
34 |
--------------------------------------------------------------------------------
/connectors/api/src/main/java/com/datastax/oss/dsbulk/connectors/api/DefaultResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.connectors.api;
17 |
18 | import edu.umd.cs.findbugs.annotations.NonNull;
19 | import java.net.URI;
20 | import org.reactivestreams.Publisher;
21 |
22 | public class DefaultResource implements Resource {
23 |
24 | private final URI uri;
25 | private final Publisher records;
26 |
27 | public DefaultResource(@NonNull URI uri, @NonNull Publisher records) {
28 | this.uri = uri;
29 | this.records = records;
30 | }
31 |
32 | @NonNull
33 | @Override
34 | public URI getURI() {
35 | return uri;
36 | }
37 |
38 | @NonNull
39 | @Override
40 | public Publisher read() {
41 | return records;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/partitioner/src/main/java/com/datastax/oss/dsbulk/partitioner/BulkTokenRange.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.partitioner;
17 |
18 | import com.datastax.oss.driver.api.core.metadata.EndPoint;
19 | import com.datastax.oss.driver.api.core.metadata.token.TokenRange;
20 | import edu.umd.cs.findbugs.annotations.NonNull;
21 | import java.math.BigInteger;
22 | import java.util.Set;
23 |
24 | public interface BulkTokenRange extends TokenRange {
25 |
26 | /** @return The replicas that own this range. */
27 | @NonNull
28 | Set replicas();
29 |
30 | /** @return The range size (i.e. the number of tokens it contains). */
31 | @NonNull
32 | BigInteger size();
33 |
34 | /** @return The ring fraction covered by this range. */
35 | double fraction();
36 | }
37 |
--------------------------------------------------------------------------------
/sampler/src/main/java/com/datastax/oss/dsbulk/sampler/Sizeable.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.sampler;
17 |
18 | /**
19 | * A data container that can report the size of its contents.
20 | *
21 | * This interface is used by {@link DataSizes} to determine the size of the data. It is meant to
22 | * be implemented by {@link com.datastax.oss.driver.api.core.cql.Row Row} and {@link
23 | * com.datastax.oss.driver.api.core.cql.Statement Statement} implementations wishing to optimize or
24 | * cache the data size computation.
25 | *
26 | * @see SizeableRow
27 | * @see SizeableBoundStatement
28 | * @see SizeableBatchStatement
29 | */
30 | public interface Sizeable {
31 |
32 | /** @return the size of the container data in bytes. */
33 | long getDataSize();
34 | }
35 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/ccm/annotations/CCMWorkload.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.ccm.annotations;
17 |
18 | import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import com.datastax.oss.dsbulk.tests.ccm.CCMCluster.Workload;
22 | import java.lang.annotation.Retention;
23 | import java.lang.annotation.Target;
24 |
25 | /** A set of workloads to assign to a specific node. */
26 | @Retention(RUNTIME)
27 | @Target(ANNOTATION_TYPE)
28 | public @interface CCMWorkload {
29 |
30 | /**
31 | * The workloads to assign to a specific node.
32 | *
33 | * @return The workloads to assign to a specifc node.
34 | */
35 | Workload[] value() default {};
36 | }
37 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/simulacron/annotations/SimulacronFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.simulacron.annotations;
17 |
18 | import static java.lang.annotation.ElementType.METHOD;
19 | import static java.lang.annotation.RetentionPolicy.RUNTIME;
20 |
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.Target;
23 |
24 | /**
25 | * Annotation that marks a method as being a factory for {@link
26 | * com.datastax.oss.simulacron.server.BoundCluster Simulacron} instances.
27 | *
28 | *
Such methods must be static and their return type must be {@link
29 | * com.datastax.oss.simulacron.common.cluster.ClusterSpec}.
30 | */
31 | @Retention(RUNTIME)
32 | @Target(METHOD)
33 | public @interface SimulacronFactory {}
34 |
--------------------------------------------------------------------------------
/tests/src/main/resources/ssl/client.crt:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE-----
2 | MIIDqTCCApGgAwIBAgIERLZiJzANBgkqhkiG9w0BAQsFADCBhDELMAkGA1UEBhMCVVMxEzARBgNV
3 | BAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRhIENsYXJhMRYwFAYDVQQKEw1EYXRhU3RheCBJ
4 | bmMuMRowGAYDVQQLExFEcml2ZXJzIGFuZCBUb29sczEWMBQGA1UEAxMNRHJpdmVyIENsaWVudDAe
5 | Fw0xNTAzMTIwMTA4MjRaFw0xNTA2MTAwMTA4MjRaMIGEMQswCQYDVQQGEwJVUzETMBEGA1UECBMK
6 | Q2FsaWZvcm5pYTEUMBIGA1UEBxMLU2FudGEgQ2xhcmExFjAUBgNVBAoTDURhdGFTdGF4IEluYy4x
7 | GjAYBgNVBAsTEURyaXZlcnMgYW5kIFRvb2xzMRYwFAYDVQQDEw1Ecml2ZXIgQ2xpZW50MIIBIjAN
8 | BgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq0J0EoZQnOv2KRrvwA+1ZL9VZ3hDdQMwkDfitoGN
9 | B6upvMUZpf8W+ReQmaY6yacYJthHzsZTd3G97Bw81/3VNHQB9PnXGmbupMLVXeFXysSCs1nPEdJl
10 | TBbJXWHSh41AE4ejJaoCoTuigKGwI9lTbOOPDz/WMcio9nagsCJdsdG2+TxmR7RlyzEIANJ0wpnL
11 | JEIeJmRS2loLVuCU4lZ9hDLN57cP9jEVD4Hk2kJD4Exx7G9HQFH+/63H6XtEDZsJcYldR7yBNsGr
12 | pz9CupULCS1R40ePQEIlUXhM4ft/hsljQybLQvvfXNVTvk5WgY7LNaBJy6A/Tfg32SXEn3wUvwID
13 | AQABoyEwHzAdBgNVHQ4EFgQUt+JDOeziZzHNYTFU/FL9PhDGqSQwDQYJKoZIhvcNAQELBQADggEB
14 | ADOYpa1f9dPcVLq3RiMytajHo3YJ0AQqGRzVgngkeRFSdhyy/y+/8D0/V5s6QbNt/l6x3FxkoiTR
15 | 1Lptf96eylnS5AkGQTgogJP53cSNrqkDL0IyyvErSiATEXNpBKz6ivY+e5J1GLTfX9Ylu8limzIq
16 | Y6YBnr8fMLD6XWraxtzzkJ9NIPhhaz696rxqr8ix6uy0mgxR/7/jUglreimZkLW40/qiABgX7Evw
17 | UqpuJWmqNbQP9UXecx/UJ0hdxxxuxkZsoRoQwWYhkeT4aGCLJv/hjiNTfFAt23uHe0LVfW/HqykW
18 | KoEj8F08mJVe5ZfpjF974i5qO9PU9XxvLfLjNvo=
19 | -----END CERTIFICATE-----
20 |
--------------------------------------------------------------------------------
/url/src/test/java/com/datastax/oss/dsbulk/url/StdinStdoutURLStreamHandlerProviderTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import static org.assertj.core.api.Assertions.assertThat;
19 |
20 | import org.junit.jupiter.api.Test;
21 |
22 | class StdinStdoutURLStreamHandlerProviderTest {
23 |
24 | @Test
25 | void should_handle_std_protocol() {
26 | StdinStdoutURLStreamHandlerProvider provider = new StdinStdoutURLStreamHandlerProvider();
27 | assertThat(provider.maybeCreateURLStreamHandler("std", null))
28 | .isNotNull()
29 | .containsInstanceOf(StdinStdoutURLStreamHandler.class);
30 | assertThat(provider.maybeCreateURLStreamHandler("STD", null))
31 | .isNotNull()
32 | .containsInstanceOf(StdinStdoutURLStreamHandler.class);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/batcher/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 | 4.0.0
21 |
22 | dsbulk-parent
23 | com.datastax.oss
24 | 1.11.1-SNAPSHOT
25 |
26 | dsbulk-batcher
27 | pom
28 | DataStax Bulk Loader - Batcher
29 | Batcher API for the DataStax Bulk Loader.
30 |
31 | api
32 | reactor
33 |
34 |
35 |
--------------------------------------------------------------------------------
/connectors/csv/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/connectors/json/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/distribution/src/conf/driver.conf:
--------------------------------------------------------------------------------
1 | ####################################################################################################
2 | # Java Driver configuration for DSBulk.
3 | #
4 | # See the Java Driver configuration reference for instructions on how to configure the driver
5 | # properly:
6 | # https://docs.datastax.com/en/developer/java-driver/latest/
7 | # https://docs.datastax.com/en/developer/java-driver-dse/latest/
8 | #
9 | # This file is written in HOCON format; see
10 | # https://github.com/typesafehub/config/blob/master/HOCON.md
11 | # for more information on its syntax.
12 | #
13 | # This file is not meant as the main configuration file for DSBulk, but rather to be included from
14 | # the main configuration file. We recommend that this file be named driver.conf and placed in the
15 | # /conf directory, alongside with another configuration file for DSBulk itself, named
16 | # application.conf. Also, for this setup to work, application.conf should include driver.conf, for
17 | # example by using an import directive. For other ways to configure this tool, refer to DataStax
18 | # Bulk Loader online documentation:
19 | # https://docs.datastax.com/en/dsbulk/doc/dsbulk/dsbulkRef.html
20 | ####################################################################################################
21 |
22 | datastax-java-driver {
23 | # Example to set contact points:
24 | # basic.contact-points = [ "host1.com:9042" , "host2.com:9042" ]
25 | }
26 |
--------------------------------------------------------------------------------
/executor/api/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/executor/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 | 4.0.0
21 |
22 | dsbulk-parent
23 | com.datastax.oss
24 | 1.11.1-SNAPSHOT
25 |
26 | dsbulk-executor
27 | pom
28 | DataStax Bulk Loader - Executor
29 | Bulk Executor for the DataStax Bulk Loader.
30 |
31 | api
32 | reactor
33 |
34 |
35 |
--------------------------------------------------------------------------------
/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/auth/BulkGssApiAuthProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.commons.auth;
17 |
18 | import com.datastax.dse.driver.api.core.auth.DseGssApiAuthProviderBase;
19 | import com.datastax.oss.driver.api.core.metadata.EndPoint;
20 | import edu.umd.cs.findbugs.annotations.NonNull;
21 |
22 | public class BulkGssApiAuthProvider extends DseGssApiAuthProviderBase {
23 |
24 | private final GssApiOptions options;
25 |
26 | public BulkGssApiAuthProvider(GssApiOptions options) {
27 | super("");
28 | this.options = options;
29 | }
30 |
31 | @NonNull
32 | @Override
33 | protected GssApiOptions getOptions(
34 | @NonNull EndPoint endPoint, @NonNull String serverAuthenticator) {
35 | return options;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/url/src/main/java/com/datastax/oss/dsbulk/url/UncloseableInputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import java.io.FilterInputStream;
19 | import java.io.IOException;
20 | import java.io.InputStream;
21 |
22 | /**
23 | * An input stream that cannot be closed.
24 | *
25 | *
This is useful in rare situations where the underlying stream is being shared among consumers
26 | * and therefore should not be closed accidentally by one of them.
27 | */
28 | @SuppressWarnings("WeakerAccess")
29 | public class UncloseableInputStream extends FilterInputStream {
30 |
31 | public UncloseableInputStream(InputStream in) {
32 | super(in);
33 | }
34 |
35 | @Override
36 | public void close() throws IOException {
37 | // do not forward the call to the delegate InputStream
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/workflow/commons/src/test/resources/logback-test.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/codecs/api/src/main/java/com/datastax/oss/dsbulk/codecs/api/ConvertingCodecProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.api;
17 |
18 | import com.datastax.oss.driver.api.core.type.DataType;
19 | import com.datastax.oss.driver.api.core.type.reflect.GenericType;
20 | import edu.umd.cs.findbugs.annotations.NonNull;
21 | import java.util.Optional;
22 |
23 | /**
24 | * A provider for {@link ConvertingCodec}s. Providers are discovered by {@link
25 | * ConvertingCodecFactory} using the Service Loader API.
26 | */
27 | public interface ConvertingCodecProvider {
28 |
29 | @NonNull
30 | Optional> maybeProvide(
31 | @NonNull DataType cqlType,
32 | @NonNull GenericType> externalJavaType,
33 | @NonNull ConvertingCodecFactory codecFactory,
34 | boolean rootCodec);
35 | }
36 |
--------------------------------------------------------------------------------
/codecs/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 | 4.0.0
21 |
22 | dsbulk-parent
23 | com.datastax.oss
24 | 1.11.1-SNAPSHOT
25 |
26 | dsbulk-codecs
27 | pom
28 | DataStax Bulk Loader - Codecs
29 | Codecs for the DataStax Bulk Loader.
30 |
31 | api
32 | jdk
33 | text
34 |
35 |
36 |
--------------------------------------------------------------------------------
/url/src/main/java/com/datastax/oss/dsbulk/url/UncloseableOutputStream.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import java.io.FilterOutputStream;
19 | import java.io.IOException;
20 | import java.io.OutputStream;
21 |
22 | /**
23 | * An output stream that cannot be closed.
24 | *
25 | * This is useful in rare situations where the underlying stream is being shared among consumers
26 | * and therefore should not be closed accidentally by one of them.
27 | */
28 | @SuppressWarnings("WeakerAccess")
29 | public class UncloseableOutputStream extends FilterOutputStream {
30 |
31 | public UncloseableOutputStream(OutputStream out) {
32 | super(out);
33 | }
34 |
35 | @Override
36 | public void close() throws IOException {
37 | // do not forward the call to the delegate OutputStream
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tests/src/main/java/com/datastax/oss/dsbulk/tests/logging/LogConfigurationResource.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.tests.logging;
17 |
18 | import java.lang.annotation.ElementType;
19 | import java.lang.annotation.Retention;
20 | import java.lang.annotation.RetentionPolicy;
21 | import java.lang.annotation.Target;
22 |
23 | /**
24 | * The classpath resource that should be used to configure Logback. If this annotation is present,
25 | * {@link LogInterceptingExtension} will reset Logback's configuration and use this resource to
26 | * configure it. This can be useful in situations where a test is sensitive to Logback's
27 | * configuration.
28 | */
29 | @Retention(RetentionPolicy.RUNTIME)
30 | @Target(ElementType.TYPE)
31 | public @interface LogConfigurationResource {
32 |
33 | String value() default "logback-test.xml";
34 | }
35 |
--------------------------------------------------------------------------------
/executor/reactor/src/test/java/com/datastax/oss/dsbulk/executor/reactor/DefaultReactorBulkExecutorTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.reactor;
17 |
18 | import com.datastax.oss.dsbulk.executor.api.AbstractBulkExecutorBuilder;
19 | import com.datastax.oss.dsbulk.executor.api.BulkExecutor;
20 | import com.datastax.oss.dsbulk.executor.api.NonContinuousBulkExecutorTestBase;
21 |
22 | public class DefaultReactorBulkExecutorTest extends NonContinuousBulkExecutorTestBase {
23 |
24 | @Override
25 | protected BulkExecutor newBulkExecutor(boolean failSafe) {
26 | AbstractBulkExecutorBuilder builder =
27 | DefaultReactorBulkExecutor.builder(session).withExecutionListener(listener);
28 | if (failSafe) {
29 | builder.failSafe();
30 | }
31 | return builder.build();
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/workflow/api/src/main/java/com/datastax/oss/dsbulk/workflow/api/error/TooManyErrorsException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.api.error;
17 |
18 | /**
19 | * Thrown when the engine encounters too many errors. This exception triggers the operation
20 | * abortion.
21 | */
22 | public class TooManyErrorsException extends RuntimeException {
23 |
24 | private final ErrorThreshold threshold;
25 |
26 | public TooManyErrorsException(ErrorThreshold threshold) {
27 | super(createErrorMessage(threshold));
28 | this.threshold = threshold;
29 | }
30 |
31 | private static String createErrorMessage(ErrorThreshold threshold) {
32 | return "Too many errors, the maximum allowed is " + threshold.thresholdAsString() + ".";
33 | }
34 |
35 | public ErrorThreshold getThreshold() {
36 | return threshold;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/executor/reactor/src/main/java/com/datastax/oss/dsbulk/executor/reactor/ContinuousReactorBulkExecutorBuilder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.reactor;
17 |
18 | import com.datastax.oss.driver.api.core.CqlSession;
19 | import com.datastax.oss.dsbulk.executor.api.AbstractBulkExecutorBuilder;
20 |
21 | /** A builder for {@link ContinuousReactorBulkExecutor} instances. */
22 | public class ContinuousReactorBulkExecutorBuilder
23 | extends AbstractBulkExecutorBuilder {
24 |
25 | final CqlSession cqlSession;
26 |
27 | ContinuousReactorBulkExecutorBuilder(CqlSession cqlSession) {
28 | super(cqlSession);
29 | this.cqlSession = cqlSession;
30 | }
31 |
32 | @Override
33 | public ContinuousReactorBulkExecutor build() {
34 | return new ContinuousReactorBulkExecutor(this);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/connectors/api/src/main/java/com/datastax/oss/dsbulk/connectors/api/RecordMetadata.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.connectors.api;
17 |
18 | import com.datastax.oss.driver.api.core.type.DataType;
19 | import com.datastax.oss.driver.api.core.type.reflect.GenericType;
20 | import edu.umd.cs.findbugs.annotations.NonNull;
21 |
22 | /**
23 | * Defines metadata applicable to a {@link Record record}, in particular which field types it
24 | * contains.
25 | */
26 | public interface RecordMetadata {
27 |
28 | /**
29 | * Returns the type of the given field.
30 | *
31 | * @param field the field to get the type from.
32 | * @param cqlType the CQL type associated with the given field.
33 | * @return the type of the given field.
34 | */
35 | @NonNull
36 | GenericType> getFieldType(@NonNull Field field, @NonNull DataType cqlType);
37 | }
38 |
--------------------------------------------------------------------------------
/codecs/jdk/src/test/java/com/datastax/oss/dsbulk/codecs/jdk/bool/BooleanToStringCodecTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.jdk.bool;
17 |
18 | import static com.datastax.oss.dsbulk.tests.assertions.TestAssertions.assertThat;
19 |
20 | import org.junit.jupiter.api.Test;
21 |
22 | class BooleanToStringCodecTest {
23 |
24 | private BooleanToStringCodec codec = new BooleanToStringCodec();
25 |
26 | @Test
27 | void should_convert_when_valid_input() {
28 | assertThat(codec)
29 | .convertsFromExternal(true)
30 | .toInternal("true")
31 | .convertsFromExternal(false)
32 | .toInternal("false")
33 | .convertsFromExternal(null)
34 | .toInternal(null)
35 | .convertsFromInternal(null)
36 | .toExternal(null)
37 | .convertsFromInternal("")
38 | .toExternal(null);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/connectors/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 | 4.0.0
21 |
22 | dsbulk-parent
23 | com.datastax.oss
24 | 1.11.1-SNAPSHOT
25 |
26 | dsbulk-connectors
27 | pom
28 | DataStax Bulk Loader - Connectors
29 | Connectors for the DataStax Bulk Loader.
30 |
31 | api
32 | commons
33 | csv
34 | json
35 |
36 |
37 |
--------------------------------------------------------------------------------
/codecs/api/src/main/java/com/datastax/oss/dsbulk/codecs/api/format/binary/HexBinaryFormat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.api.format.binary;
17 |
18 | import com.datastax.oss.driver.api.core.data.ByteUtils;
19 | import java.nio.ByteBuffer;
20 |
21 | public class HexBinaryFormat implements BinaryFormat {
22 |
23 | public static final HexBinaryFormat INSTANCE = new HexBinaryFormat();
24 |
25 | private HexBinaryFormat() {}
26 |
27 | @Override
28 | public ByteBuffer parse(String s) {
29 | if (s == null) {
30 | return null;
31 | }
32 | // DAT-573: consider empty string as empty byte array
33 | if (s.isEmpty()) {
34 | return ByteBuffer.allocate(0);
35 | }
36 | return ByteUtils.fromHexString(s);
37 | }
38 |
39 | @Override
40 | public String format(ByteBuffer bb) {
41 | return ByteUtils.toHexString(bb);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/config/src/main/java/com/datastax/oss/dsbulk/config/model/FixedSettingsGroup.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.config.model;
17 |
18 | import java.util.List;
19 | import java.util.Set;
20 | import java.util.TreeSet;
21 |
22 | /** A group of particular settings. */
23 | class FixedSettingsGroup implements SettingsGroup {
24 |
25 | private final Set settings;
26 |
27 | FixedSettingsGroup(List fixedSettings) {
28 | settings = new TreeSet<>(new SettingsComparator(fixedSettings));
29 | settings.addAll(fixedSettings);
30 | }
31 |
32 | @Override
33 | public boolean addSetting(String settingName) {
34 | // Always return false because we want other groups to have a chance to add this
35 | // setting as well.
36 | return false;
37 | }
38 |
39 | @Override
40 | public Set getSettings() {
41 | return settings;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/codecs/text/src/main/java/com/datastax/oss/dsbulk/codecs/text/string/StringToVectorCodec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.text.string;
17 |
18 | import com.datastax.oss.driver.api.core.data.CqlVector;
19 | import com.datastax.oss.driver.internal.core.type.codec.VectorCodec;
20 | import java.util.List;
21 |
22 | public class StringToVectorCodec
23 | extends StringConvertingCodec> {
24 |
25 | public StringToVectorCodec(VectorCodec targetCodec, List nullStrings) {
26 | super(targetCodec, nullStrings);
27 | }
28 |
29 | @Override
30 | public CqlVector externalToInternal(String s) {
31 | return this.internalCodec.parse(s);
32 | }
33 |
34 | @Override
35 | public String internalToExternal(CqlVector cqlVector) {
36 | return this.internalCodec.format(cqlVector);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/workflow/api/src/main/java/com/datastax/oss/dsbulk/workflow/api/error/AbsoluteErrorThreshold.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.api.error;
17 |
18 | import edu.umd.cs.findbugs.annotations.NonNull;
19 |
20 | public class AbsoluteErrorThreshold implements ErrorThreshold {
21 |
22 | private final long maxErrors;
23 |
24 | AbsoluteErrorThreshold(long maxErrors) {
25 | if (maxErrors < 0) {
26 | throw new IllegalArgumentException("maxErrors must be >= 0");
27 | }
28 | this.maxErrors = maxErrors;
29 | }
30 |
31 | @Override
32 | public boolean checkThresholdExceeded(long errorCount, @NonNull Number totalItems) {
33 | return errorCount > maxErrors;
34 | }
35 |
36 | @Override
37 | public String thresholdAsString() {
38 | return Long.toString(maxErrors);
39 | }
40 |
41 | public long getMaxErrors() {
42 | return maxErrors;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/codecs/text/src/main/java/com/datastax/oss/dsbulk/codecs/text/TextConversionContext.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.text;
17 |
18 | import com.datastax.oss.dsbulk.codecs.api.CommonConversionContext;
19 | import com.datastax.oss.dsbulk.codecs.text.json.JsonCodecUtils;
20 | import com.fasterxml.jackson.databind.ObjectMapper;
21 | import edu.umd.cs.findbugs.annotations.NonNull;
22 | import java.util.Objects;
23 |
24 | public class TextConversionContext extends CommonConversionContext {
25 |
26 | public static final String OBJECT_MAPPER = "OBJECT_MAPPER";
27 |
28 | public TextConversionContext() {
29 | addAttribute(OBJECT_MAPPER, JsonCodecUtils.getObjectMapper());
30 | }
31 |
32 | public TextConversionContext setObjectMapper(@NonNull ObjectMapper objectMapper) {
33 | addAttribute(OBJECT_MAPPER, Objects.requireNonNull(objectMapper));
34 | return this;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/executor/api/src/main/java/com/datastax/oss/dsbulk/executor/api/BulkExecutorBuilderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.api;
17 |
18 | import com.datastax.oss.driver.api.core.CqlSession;
19 | import edu.umd.cs.findbugs.annotations.NonNull;
20 |
21 | /** A factory for {@link BulkExecutorBuilder} instances. */
22 | public interface BulkExecutorBuilderFactory {
23 |
24 | /**
25 | * Creates a new {@link BulkExecutorBuilder} for the given session.
26 | *
27 | * @param session The session to create an executor for.
28 | * @param useContinuousPagingForReads whether the builder should create executors using continuous
29 | * paging for reads.
30 | * @return A newly-allocated bulk executor builder.
31 | */
32 | @NonNull
33 | BulkExecutorBuilder extends BulkExecutor> create(
34 | @NonNull CqlSession session, boolean useContinuousPagingForReads);
35 | }
36 |
--------------------------------------------------------------------------------
/executor/reactor/src/main/java/com/datastax/oss/dsbulk/executor/reactor/ReactorBulkExecutorBuilderFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.executor.reactor;
17 |
18 | import com.datastax.oss.driver.api.core.CqlSession;
19 | import com.datastax.oss.dsbulk.executor.api.BulkExecutorBuilder;
20 | import com.datastax.oss.dsbulk.executor.api.BulkExecutorBuilderFactory;
21 | import edu.umd.cs.findbugs.annotations.NonNull;
22 |
23 | public class ReactorBulkExecutorBuilderFactory implements BulkExecutorBuilderFactory {
24 |
25 | @Override
26 | @NonNull
27 | public BulkExecutorBuilder extends ReactorBulkExecutor> create(
28 | @NonNull CqlSession session, boolean useContinuousPagingForReads) {
29 | return useContinuousPagingForReads
30 | ? ContinuousReactorBulkExecutor.continuousPagingBuilder(session)
31 | : DefaultReactorBulkExecutor.builder(session);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/runner/src/main/java/com/datastax/oss/dsbulk/runner/cli/SectionHelpRequestException.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.runner.cli;
17 |
18 | import edu.umd.cs.findbugs.annotations.NonNull;
19 | import edu.umd.cs.findbugs.annotations.Nullable;
20 |
21 | /** Simple exception indicating that the user wants the help for a particular section. */
22 | public class SectionHelpRequestException extends Exception {
23 |
24 | private final String sectionName;
25 | @Nullable private final String connectorName;
26 |
27 | public SectionHelpRequestException(@NonNull String sectionName, @Nullable String connectorName) {
28 | this.sectionName = sectionName;
29 | this.connectorName = connectorName;
30 | }
31 |
32 | public String getSectionName() {
33 | return sectionName;
34 | }
35 |
36 | @Nullable
37 | public String getConnectorName() {
38 | return connectorName;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/workflow/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 | 4.0.0
21 |
22 | dsbulk-parent
23 | com.datastax.oss
24 | 1.11.1-SNAPSHOT
25 |
26 | dsbulk-workflow
27 | pom
28 | DataStax Bulk Loader - Workflow
29 | Workflows for the DataStax Bulk Loader.
30 |
31 | api
32 | commons
33 | load
34 | unload
35 | count
36 |
37 |
38 |
--------------------------------------------------------------------------------
/codecs/text/src/main/java/com/datastax/oss/dsbulk/codecs/text/string/StringToStringCodec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.text.string;
17 |
18 | import com.datastax.oss.driver.api.core.type.codec.TypeCodec;
19 | import java.util.List;
20 |
21 | public class StringToStringCodec extends StringConvertingCodec {
22 |
23 | public StringToStringCodec(TypeCodec innerCodec, List nullStrings) {
24 | super(innerCodec, nullStrings);
25 | }
26 |
27 | @Override
28 | public String externalToInternal(String s) {
29 | // DAT-297: do not convert empty strings to null so do not use isNullOrEmpty() here
30 | if (isNull(s)) {
31 | return null;
32 | }
33 | return s;
34 | }
35 |
36 | @Override
37 | public String internalToExternal(String value) {
38 | if (value == null) {
39 | return nullString();
40 | }
41 | return value;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/codecs/text/src/main/java/com/datastax/oss/dsbulk/codecs/text/string/StringToDurationCodec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.text.string;
17 |
18 | import com.datastax.oss.driver.api.core.data.CqlDuration;
19 | import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
20 | import java.util.List;
21 |
22 | public class StringToDurationCodec extends StringConvertingCodec {
23 |
24 | public StringToDurationCodec(List nullStrings) {
25 | super(TypeCodecs.DURATION, nullStrings);
26 | }
27 |
28 | @Override
29 | public CqlDuration externalToInternal(String s) {
30 | if (isNullOrEmpty(s)) {
31 | return null;
32 | }
33 | return CqlDuration.from(s);
34 | }
35 |
36 | @Override
37 | public String internalToExternal(CqlDuration value) {
38 | if (value == null) {
39 | return nullString();
40 | }
41 | return value.toString();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/settings/RowType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.commons.settings;
17 |
18 | public enum RowType {
19 | REGULAR {
20 | @Override
21 | public String singular() {
22 | return "row";
23 | }
24 |
25 | @Override
26 | public String plural() {
27 | return "rows";
28 | }
29 | },
30 | VERTEX {
31 | @Override
32 | public String singular() {
33 | return "vertex";
34 | }
35 |
36 | @Override
37 | public String plural() {
38 | return "vertices";
39 | }
40 | },
41 | EDGE {
42 | @Override
43 | public String singular() {
44 | return "edge";
45 | }
46 |
47 | @Override
48 | public String plural() {
49 | return "edges";
50 | }
51 | };
52 |
53 | public abstract String singular();
54 |
55 | public abstract String plural();
56 | }
57 |
--------------------------------------------------------------------------------
/url/src/test/java/com/datastax/oss/dsbulk/url/S3URLStreamHandlerProviderTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import static org.assertj.core.api.Assertions.assertThat;
19 | import static org.mockito.Mockito.mock;
20 | import static org.mockito.Mockito.when;
21 |
22 | import com.typesafe.config.Config;
23 | import org.junit.jupiter.api.Test;
24 |
25 | class S3URLStreamHandlerProviderTest {
26 |
27 | @Test
28 | void should_handle_s3_protocol() {
29 | Config config = mock(Config.class);
30 | when(config.hasPath("dsbulk.s3.clientCacheSize")).thenReturn(true);
31 | when(config.getInt("dsbulk.s3.clientCacheSize")).thenReturn(25);
32 |
33 | S3URLStreamHandlerProvider provider = new S3URLStreamHandlerProvider();
34 |
35 | assertThat(provider.maybeCreateURLStreamHandler("s3", config))
36 | .isNotNull()
37 | .containsInstanceOf(S3URLStreamHandler.class);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/tests/src/main/resources/logback-template.xml:
--------------------------------------------------------------------------------
1 |
2 |
19 |
20 |
21 |
22 | %-5level [%thread] %logger{40} - %msg%n
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/mapping/src/test/java/com/datastax/oss/dsbulk/mapping/TypedCQLLiteralTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.mapping;
17 |
18 | import static org.assertj.core.api.Assertions.assertThat;
19 |
20 | import com.datastax.oss.driver.api.core.type.DataTypes;
21 | import org.junit.jupiter.api.Test;
22 |
23 | class TypedCQLLiteralTest {
24 |
25 | @Test
26 | void should_render() {
27 | TypedCQLLiteral literal = new TypedCQLLiteral("123", DataTypes.INT);
28 | assertThat(literal.render(CQLRenderMode.UNALIASED_SELECTOR)).isEqualTo("(int)123");
29 | assertThat(literal.render(CQLRenderMode.ALIASED_SELECTOR))
30 | .isEqualTo("(int)123 AS \"(int)123\"");
31 | assertThat(literal.render(CQLRenderMode.INTERNAL)).isEqualTo("(int)123");
32 | assertThat(literal.render(CQLRenderMode.NAMED_ASSIGNMENT)).isEqualTo("123");
33 | assertThat(literal.render(CQLRenderMode.POSITIONAL_ASSIGNMENT)).isEqualTo("123");
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/workflow/api/src/main/java/com/datastax/oss/dsbulk/workflow/api/utils/ConsoleUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.api.utils;
17 |
18 | public class ConsoleUtils {
19 |
20 | /** The console's line length, if could be detected, otherwise this will report 150. */
21 | public static final int LINE_LENGTH = ConsoleUtils.getLineLength();
22 |
23 | private static final String COLUMNS_ENV_NAME = "COLUMNS";
24 |
25 | private static final int DEFAULT_LINE_LENGTH = 150;
26 |
27 | private static int getLineLength() {
28 | int columns = DEFAULT_LINE_LENGTH;
29 | String columnsStr = System.getenv(COLUMNS_ENV_NAME);
30 | if (columnsStr != null) {
31 | try {
32 | columns = Integer.parseInt(columnsStr);
33 | } catch (NumberFormatException ignored) {
34 | }
35 | if (PlatformUtils.isWindows()) {
36 | columns--;
37 | }
38 | }
39 | return columns;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/codecs/text/src/main/java/com/datastax/oss/dsbulk/codecs/text/json/JsonNodeToListCodec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.text.json;
17 |
18 | import com.datastax.oss.driver.api.core.type.codec.TypeCodec;
19 | import com.datastax.oss.driver.shaded.guava.common.collect.ImmutableList;
20 | import com.datastax.oss.dsbulk.codecs.api.ConvertingCodec;
21 | import com.fasterxml.jackson.databind.JsonNode;
22 | import com.fasterxml.jackson.databind.ObjectMapper;
23 | import java.util.ArrayList;
24 | import java.util.List;
25 |
26 | public class JsonNodeToListCodec extends JsonNodeToCollectionCodec> {
27 |
28 | public JsonNodeToListCodec(
29 | TypeCodec> collectionCodec,
30 | ConvertingCodec eltCodec,
31 | ObjectMapper objectMapper,
32 | List nullStrings) {
33 | super(collectionCodec, eltCodec, objectMapper, ArrayList::new, nullStrings, ImmutableList.of());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/codecs/jdk/src/main/java/com/datastax/oss/dsbulk/codecs/jdk/bool/BooleanToStringCodec.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.jdk.bool;
17 |
18 | import com.datastax.oss.driver.api.core.type.codec.TypeCodecs;
19 | import com.datastax.oss.dsbulk.codecs.api.ConvertingCodec;
20 |
21 | public class BooleanToStringCodec extends ConvertingCodec {
22 |
23 | public BooleanToStringCodec() {
24 | super(TypeCodecs.TEXT, Boolean.class);
25 | }
26 |
27 | @Override
28 | public Boolean internalToExternal(String value) {
29 | if (value == null || value.isEmpty()) {
30 | return null;
31 | }
32 | throw new UnsupportedOperationException(
33 | "This codec does not support converting from string to boolean");
34 | }
35 |
36 | @Override
37 | public String externalToInternal(Boolean value) {
38 | if (value == null) {
39 | return null;
40 | }
41 | return value.toString();
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/workflow/api/src/main/java/com/datastax/oss/dsbulk/workflow/api/log/OperationDirectory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.api.log;
17 |
18 | import edu.umd.cs.findbugs.annotations.NonNull;
19 | import java.nio.file.Path;
20 | import java.nio.file.Paths;
21 | import java.util.Optional;
22 |
23 | public class OperationDirectory {
24 |
25 | private static final String OPERATION_DIRECTORY_KEY =
26 | "com.datastax.oss.dsbulk.OPERATION_DIRECTORY";
27 |
28 | public static void setCurrentOperationDirectory(@NonNull Path operationDirectory) {
29 | System.setProperty(OPERATION_DIRECTORY_KEY, operationDirectory.toFile().getAbsolutePath());
30 | }
31 |
32 | @NonNull
33 | public static Optional getCurrentOperationDirectory() {
34 | String path = System.getProperty(OPERATION_DIRECTORY_KEY);
35 | if (path == null) {
36 | return Optional.empty();
37 | }
38 | return Optional.of(Paths.get(path));
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/codecs/api/src/main/java/com/datastax/oss/dsbulk/codecs/api/format/binary/BinaryFormat.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.codecs.api.format.binary;
17 |
18 | import edu.umd.cs.findbugs.annotations.Nullable;
19 | import java.nio.ByteBuffer;
20 |
21 | /** An utility for parsing and formatting binary data. */
22 | public interface BinaryFormat {
23 |
24 | /**
25 | * Parses the given string as a {@link ByteBuffer}.
26 | *
27 | * @param s the string to parse, may be {@code null}.
28 | * @return a {@link ByteBuffer} or {@code null} if the string was {@code null}.
29 | */
30 | @Nullable
31 | ByteBuffer parse(@Nullable String s);
32 |
33 | /**
34 | * Formats the given {@link ByteBuffer} as a string.
35 | *
36 | * @param bytes the value to format, may be {@code null}.
37 | * @return the formatted value or {@code null} if the value was {@code null}.
38 | */
39 | @Nullable
40 | String format(@Nullable ByteBuffer bytes);
41 | }
42 |
--------------------------------------------------------------------------------
/workflow/commons/src/main/java/com/datastax/oss/dsbulk/workflow/commons/statement/UnmappableStatement.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.workflow.commons.statement;
17 |
18 | import com.datastax.oss.driver.api.core.cql.SimpleStatement;
19 | import com.datastax.oss.driver.shaded.guava.common.base.MoreObjects;
20 | import com.datastax.oss.dsbulk.connectors.api.Record;
21 |
22 | public class UnmappableStatement extends MappedSimpleStatement {
23 |
24 | private final Throwable error;
25 |
26 | public UnmappableStatement(Record record, Throwable error) {
27 | super(record, SimpleStatement.newInstance(error.getMessage()));
28 | this.error = error;
29 | }
30 |
31 | public Throwable getError() {
32 | return error;
33 | }
34 |
35 | @Override
36 | public String toString() {
37 | return MoreObjects.toStringHelper(this)
38 | .add("record", getRecord())
39 | .add("error", error)
40 | .toString();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/url/src/main/java/com/datastax/oss/dsbulk/url/StdinStdoutURLStreamHandlerProvider.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.url;
17 |
18 | import com.typesafe.config.Config;
19 | import edu.umd.cs.findbugs.annotations.NonNull;
20 | import java.net.URLStreamHandler;
21 | import java.util.Optional;
22 |
23 | public class StdinStdoutURLStreamHandlerProvider implements URLStreamHandlerProvider {
24 |
25 | /**
26 | * The protocol for standard input and standard output URLs. The only supported URL with such
27 | * scheme is {@code std:/}.
28 | */
29 | public static final String STANDARD_STREAM_PROTOCOL = "std";
30 |
31 | @Override
32 | @NonNull
33 | public Optional maybeCreateURLStreamHandler(
34 | @NonNull String protocol, Config config) {
35 | if (STANDARD_STREAM_PROTOCOL.equalsIgnoreCase(protocol)) {
36 | return Optional.of(new StdinStdoutURLStreamHandler());
37 | }
38 | return Optional.empty();
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/partitioner/src/it/java/com/datastax/oss/dsbulk/partitioner/M3PTokenPartitionerCCMIT.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright DataStax, Inc.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.datastax.oss.dsbulk.partitioner;
17 |
18 | import com.datastax.oss.driver.api.core.CqlSession;
19 | import com.datastax.oss.dsbulk.tests.ccm.CCMCluster;
20 | import com.datastax.oss.dsbulk.tests.ccm.annotations.CCMConfig;
21 | import com.datastax.oss.dsbulk.tests.driver.annotations.SessionConfig;
22 | import com.datastax.oss.dsbulk.tests.driver.annotations.SessionConfig.UseKeyspaceMode;
23 | import org.junit.jupiter.api.Tag;
24 |
25 | @CCMConfig(numberOfNodes = 3)
26 | @Tag("long")
27 | class M3PTokenPartitionerCCMIT extends PartitionerCCMITBase {
28 |
29 | M3PTokenPartitionerCCMIT(
30 | CCMCluster ccm,
31 | @SessionConfig(
32 | useKeyspace = UseKeyspaceMode.NONE,
33 | settings = "basic.load-balancing-policy.slow-replica-avoidance=false")
34 | CqlSession session) {
35 | super(ccm, session, false);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------