Skip to content

Commit d374e0f

Browse files
authoredJul 3, 2024
[Improve][E2E][Doris] Add no schema test case for connector-doris-e2e (apache#7076)
1 parent be37f05 commit d374e0f

File tree

3 files changed

+91
-3
lines changed

3 files changed

+91
-3
lines changed
 

‎seatunnel-e2e/seatunnel-connector-v2-e2e/connector-doris-e2e/src/test/java/org/apache/seatunnel/e2e/connector/doris/DorisIT.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ private void checkAllTypeSinkData() {
224224
}
225225
}
226226

227-
private void checkSinkData() {
227+
protected void checkSinkData() {
228228
try {
229229
assertHasData(sourceDB, UNIQUE_TABLE);
230230
assertHasData(sinkDB, UNIQUE_TABLE);
@@ -371,7 +371,7 @@ private void clearDuplicateTable() {
371371
}
372372
}
373373

374-
private void initializeJdbcTable() {
374+
protected void initializeJdbcTable() {
375375
try {
376376
URLClassLoader urlClassLoader =
377377
new URLClassLoader(
@@ -528,7 +528,7 @@ private String createDuplicateTableForTest(String db) {
528528
return String.format(createDuplicateTableSql, db, DUPLICATE_TABLE);
529529
}
530530

531-
private void batchInsertUniqueTableData() {
531+
protected void batchInsertUniqueTableData() {
532532
List<SeaTunnelRow> rows = genUniqueTableTestData(100L);
533533
try {
534534
conn.setAutoCommit(false);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.seatunnel.e2e.connector.doris;
19+
20+
import org.apache.seatunnel.e2e.common.container.TestContainer;
21+
22+
import org.junit.jupiter.api.Assertions;
23+
import org.junit.jupiter.api.TestTemplate;
24+
import org.testcontainers.containers.Container;
25+
26+
import java.io.IOException;
27+
28+
public class DorisNoSchemaIT extends DorisIT {
29+
30+
@TestTemplate
31+
public void testDoris(TestContainer container) throws IOException, InterruptedException {
32+
initializeJdbcTable();
33+
batchInsertUniqueTableData();
34+
Container.ExecResult execResult1 = container.executeJob("/doris_source_no_schema.conf");
35+
Assertions.assertEquals(0, execResult1.getExitCode());
36+
checkSinkData();
37+
}
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
env{
19+
parallelism = 1
20+
job.mode = "BATCH"
21+
}
22+
23+
source{
24+
Doris {
25+
fenodes = "doris_e2e:8030"
26+
username = root
27+
password = ""
28+
database = "e2e_source"
29+
table = "doris_e2e_unique_table"
30+
doris.filter.query = "F_ID > 50"
31+
}
32+
}
33+
34+
transform {}
35+
36+
sink{
37+
Doris {
38+
fenodes = "doris_e2e:8030"
39+
schema_save_mode = "RECREATE_SCHEMA"
40+
username = root
41+
password = ""
42+
table.identifier = "e2e_sink.doris_e2e_unique_table"
43+
sink.enable-2pc = "false"
44+
sink.label-prefix = "no_schema"
45+
doris.config = {
46+
format="json"
47+
read_json_by_line="true"
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)
Please sign in to comment.