Skip to content

Commit 62f89dc

Browse files
authored
Merge pull request #70 from Altinity/69-fix-github-workflow-to-run-unit-tests
69 fix GitHub workflow to run unit tests
2 parents fd3038e + 1afa50b commit 62f89dc

20 files changed

+23
-1280
lines changed

.github/workflows/maven.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ name: Java CI with Maven
55

66
on:
77
push:
8-
branches: [ main ]
8+
branches: [ main, develop]
99
pull_request:
10-
branches: [ main ]
10+
branches: [ main , develop]
1111

1212
jobs:
1313
build:

pom.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@
1919
<organization>Altinity</organization>
2020
<organizationUrl>https://altinity.com</organizationUrl>
2121
</developer>
22-
<developer>
23-
<name>Vladislav Klimenko</name>
24-
<email>[email protected]</email>
25-
</developer>
2622
</developers>
2723

2824
<licenses>
@@ -151,11 +147,15 @@
151147
<artifactId>maven-surefire-plugin</artifactId>
152148
<version>2.22.0</version>
153149
<configuration>
150+
<excludedGroups>IntegrationTest</excludedGroups>
154151
<excludes>
155152
<exclude>**/*IT.java</exclude>
156153
</excludes>
154+
<includes>
155+
<include>**/*Test.java</include>
156+
</includes>
157157
</configuration>
158-
<executions>
158+
<!-- <executions>
159159
<execution>
160160
<id>integration-test</id>
161161
<goals>
@@ -171,7 +171,7 @@
171171
</includes>
172172
</configuration>
173173
</execution>
174-
</executions>
174+
</executions> -->
175175
</plugin>
176176

177177
<plugin>

src/main/java/com/altinity/clickhouse/sink/connector/db/BaseDbWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected void createConnection(String url, String clientName, String userName,
6262
* Function that uses the DatabaseMetaData JDBC functionality
6363
* to get the column name and column data type as key/value pair.
6464
*/
65-
protected Map<String, String> getColumnsDataTypesForTable(String tableName) {
65+
public Map<String, String> getColumnsDataTypesForTable(String tableName) {
6666

6767
LinkedHashMap<String, String> result = new LinkedHashMap<>();
6868
try {

src/main/java/com/altinity/clickhouse/sink/connector/model/ClickHouseStruct.java

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
import org.slf4j.Logger;
1010
import org.slf4j.LoggerFactory;
1111

12-
import java.util.ArrayList;
13-
import java.util.List;
14-
import java.util.Map;
12+
import java.util.*;
1513

1614
import static com.altinity.clickhouse.sink.connector.model.SinkRecordColumns.*;
1715

@@ -176,29 +174,34 @@ public void setAdditionalMetaData(Map<String, Object> convertedValue) {
176174
}
177175
Struct source = (Struct) convertedValue.get(SOURCE);
178176

177+
List<Field> fields = source.schema().fields();
178+
HashSet<String> fieldNames = new HashSet<String>();
179+
for(Field f: fields) {
180+
fieldNames.add(f.name());
181+
}
179182
try {
180-
if (source.get(TS_MS) != null && source.get(TS_MS) instanceof Long) {
183+
if (fieldNames.contains(TS_MS) && source.get(TS_MS) != null && source.get(TS_MS) instanceof Long) {
181184
this.setTs_ms((Long) source.get(TS_MS));
182185
}
183-
if (source.get(SNAPSHOT) != null && source.get(SNAPSHOT) instanceof String) {
186+
if (fieldNames.contains(SNAPSHOT) && source.get(SNAPSHOT) != null && source.get(SNAPSHOT) instanceof String) {
184187
this.setSnapshot(Boolean.parseBoolean((String) source.get(SNAPSHOT)));
185188
}
186-
if (source.get(SERVER_ID) != null && source.get(SERVER_ID) instanceof Long) {
189+
if (fieldNames.contains(SERVER_ID) && source.get(SERVER_ID) != null && source.get(SERVER_ID) instanceof Long) {
187190
this.setServerId((Long) source.get(SERVER_ID));
188191
}
189-
if (source.get(BINLOG_FILE) != null && source.get(BINLOG_FILE) instanceof String) {
192+
if (fieldNames.contains(BINLOG_FILE) && source.get(BINLOG_FILE) != null && source.get(BINLOG_FILE) instanceof String) {
190193
this.setFile((String) source.get(BINLOG_FILE));
191194
}
192-
if (source.get(BINLOG_POS) != null && source.get(BINLOG_POS) instanceof Long) {
195+
if (fieldNames.contains(BINLOG_POS) && source.get(BINLOG_POS) != null && source.get(BINLOG_POS) instanceof Long) {
193196
this.setPos((Long) source.get(BINLOG_POS));
194197
}
195-
if (source.get(ROW) != null && source.get(ROW) instanceof Integer) {
198+
if (fieldNames.contains(ROW) && source.get(ROW) != null && source.get(ROW) instanceof Integer) {
196199
this.setRow((Integer) source.get(ROW));
197200
}
198-
if (source.get(SERVER_THREAD) != null && source.get(SERVER_THREAD) instanceof Integer) {
201+
if (fieldNames.contains(SERVER_THREAD) && source.get(SERVER_THREAD) != null && source.get(SERVER_THREAD) instanceof Integer) {
199202
this.setThread((Integer) convertedValue.get(SERVER_THREAD));
200203
}
201-
if(source.get(GTID) != null && source.get(GTID) instanceof String) {
204+
if(fieldNames.contains(GTID) && source.get(GTID) != null && source.get(GTID) instanceof String) {
202205
String[] gtidArray = ((String) source.get(GTID)).split(":");
203206
if(gtidArray.length == 2) {
204207
this.setGtid(Integer.parseInt(gtidArray[1]));

src/test/com/altinity/clickhouse/sink/connector/ClickHouseSinkConnectorTest.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/test/com/altinity/clickhouse/sink/connector/ClickHouseSinkTaskTest.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/test/com/altinity/clickhouse/sink/connector/UtilsTest.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/test/com/altinity/clickhouse/sink/connector/converters/ClickHouseConverterTest.java

Lines changed: 0 additions & 62 deletions
This file was deleted.

src/test/com/altinity/clickhouse/sink/connector/converters/ClickHouseDataTypeMapperTest.java

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/test/com/altinity/clickhouse/sink/connector/converters/DebeziumConverterTest.java

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)