Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 34a923b

Browse files
committed
adjust to review comments by @Abacn
1 parent ab02e24 commit 34a923b

File tree

5 files changed

+31
-16
lines changed

5 files changed

+31
-16
lines changed

buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,8 @@ class BeamModulePlugin implements Plugin<Project> {
674674
activemq_junit : "org.apache.activemq.tooling:activemq-junit:$activemq_version",
675675
activemq_kahadb_store : "org.apache.activemq:activemq-kahadb-store:$activemq_version",
676676
activemq_mqtt : "org.apache.activemq:activemq-mqtt:$activemq_version",
677-
antlr : "org.antlr:antlr4:4.10",
678-
antlr_runtime : "org.antlr:antlr4-runtime:4.10",
677+
antlr : "org.antlr:antlr4:4.7",
678+
antlr_runtime : "org.antlr:antlr4-runtime:4.7",
679679
args4j : "args4j:args4j:2.33",
680680
auto_value_annotations : "com.google.auto.value:auto-value-annotations:$autovalue_version",
681681
// TODO: https://github.com/apache/beam/issues/34993 after stopping supporting Java 8

sdks/java/io/debezium/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ applyJavaNature(
2525
[id: 'io.confluent', url: 'https://packages.confluent.io/maven/']
2626
],
2727
enableSpotbugs: false,
28-
requireJavaVersion = JavaVersion.VERSION_17,
28+
requireJavaVersion: JavaVersion.VERSION_17,
2929
)
3030
provideIntegrationTestingDependencies()
3131

@@ -43,8 +43,6 @@ dependencies {
4343

4444
// Kafka connect dependencies
4545
implementation "org.apache.kafka:connect-api:3.9.0"
46-
implementation "org.apache.kafka:connect-json:3.9.0"
47-
// permitUnusedDeclared "org.apache.kafka:connect-json:3.9.0"
4846

4947
// Debezium dependencies
5048
implementation group: 'io.debezium', name: 'debezium-core', version: '3.1.1.Final'
@@ -70,6 +68,14 @@ dependencies {
7068
testImplementation group: 'io.debezium', name: 'debezium-connector-postgres', version: '3.1.1.Final'
7169
}
7270

71+
// TODO: Remove pin after Beam has unpinned it
72+
// Pin the Antlr version
73+
configurations.all {
74+
resolutionStrategy {
75+
force 'org.antlr:antlr4:4.10', 'org.antlr:antlr4-runtime:4.10'
76+
}
77+
}
78+
7379
// TODO: Remove pin after upgrading Beam's Jackson version
7480
// Force Jackson versions for the test runtime classpath
7581
configurations.named("testRuntimeClasspath") {

sdks/java/io/debezium/expansion-service/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ applyJavaNature(
2525
exportJavadoc: false,
2626
validateShadowJar: false,
2727
shadowClosure: {},
28-
requireJavaVersion = JavaVersion.VERSION_17,
28+
requireJavaVersion: JavaVersion.VERSION_17,
2929
)
3030

3131
description = "Apache Beam :: SDKs :: Java :: IO :: Debezium :: Expansion Service"

sdks/java/io/debezium/src/test/java/org/apache/beam/io/debezium/DebeziumIOMySqlConnectorIT.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import static org.apache.beam.sdk.testing.SerializableMatchers.hasItem;
2222
import static org.hamcrest.MatcherAssert.assertThat;
2323
import static org.hamcrest.Matchers.equalTo;
24+
import static org.junit.jupiter.api.Assertions.fail;
2425

2526
import com.zaxxer.hikari.HikariConfig;
2627
import com.zaxxer.hikari.HikariDataSource;
@@ -110,7 +111,7 @@ public static DataSource getMysqlDatasource(Void unused) {
110111
return new HikariDataSource(hikariConfig);
111112
}
112113

113-
private void monitorEssentialMetrics() {
114+
private void monitorEssentialMetrics() throws SQLException {
114115
DataSource ds = getMysqlDatasource(null);
115116
try {
116117
Connection conn = ds.getConnection();
@@ -128,6 +129,7 @@ private void monitorEssentialMetrics() {
128129
}
129130
} catch (SQLException ex) {
130131
LOG.error("SQL error in monitoring thread. Shutting down.", ex);
132+
throw (ex);
131133
} catch (InterruptedException ex) {
132134
LOG.info("Monitoring thread interrupted. Shutting down.");
133135
Thread.currentThread().interrupt();
@@ -207,7 +209,16 @@ public void testDebeziumSchemaTransformMysqlRead() throws InterruptedException {
207209
return null;
208210
});
209211
Thread writeThread = new Thread(() -> writePipeline.run().waitUntilFinish());
210-
Thread monitorThread = new Thread(this::monitorEssentialMetrics);
212+
Thread monitorThread =
213+
new Thread(
214+
() -> {
215+
try {
216+
monitorEssentialMetrics();
217+
} catch (SQLException e) {
218+
e.printStackTrace();
219+
fail("Failed because of SQLException in monitorEssentialMetrics!");
220+
}
221+
});
211222
monitorThread.start();
212223
writeThread.start();
213224

sdks/java/io/debezium/src/test/java/org/apache/beam/io/debezium/DebeziumReadSchemaTransformTest.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import static org.hamcrest.MatcherAssert.assertThat;
2121
import static org.junit.Assert.assertThrows;
22-
import java.nio.file.Path;
22+
2323
import io.debezium.DebeziumException;
2424
import java.time.Duration;
2525
import java.util.Arrays;
@@ -33,7 +33,7 @@
3333
import org.hamcrest.Matchers;
3434
import org.junit.ClassRule;
3535
import org.junit.Test;
36-
import org.junit.jupiter.api.io.TempDir;
36+
import org.junit.rules.TemporaryFolder;
3737
import org.junit.runner.RunWith;
3838
import org.junit.runners.Parameterized;
3939
import org.testcontainers.containers.Container;
@@ -45,11 +45,7 @@
4545
@RunWith(Parameterized.class)
4646
public class DebeziumReadSchemaTransformTest {
4747

48-
@TempDir
49-
Path tempDir;
50-
51-
@ClassRule
52-
Path schemaHistoryFile = tempDir.resolve("schema_history.dat");
48+
@ClassRule public static TemporaryFolder tempFolder = new TemporaryFolder();
5349

5450
@ClassRule
5551
public static final PostgreSQLContainer<?> POSTGRES_SQL_CONTAINER =
@@ -116,7 +112,9 @@ private PTransform<PCollectionRowTuple, PCollectionRowTuple> makePtransform(
116112
Lists.newArrayList(
117113
"database.server.id=579676",
118114
"schema.history.internal=io.debezium.storage.file.history.FileSchemaHistory",
119-
String.format("schema.history.internal.file.filename=%s", schemaHistoryFile.toString())))
115+
String.format(
116+
"schema.history.internal.file.filename=%s",
117+
tempFolder.getRoot().toPath().resolve("schema_history.dat"))))
120118
.build());
121119
}
122120

0 commit comments

Comments
 (0)