-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature][Connector-V2-e2e][LocalFile] Add local file connector e2e
- Loading branch information
1 parent
26f2437
commit d0fff1a
Showing
9 changed files
with
428 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
seatunnel-e2e/seatunnel-connector-v2-e2e/connector-file-local-e2e/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>seatunnel-connector-v2-e2e</artifactId> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<version>${revision}</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>connector-file-local-e2e</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.seatunnel</groupId> | ||
<artifactId>connector-file-local</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
42 changes: 42 additions & 0 deletions
42
...le-local-e2e/src/test/java/org/apache/seatunnel/e2e/connector/file/local/LocalFileIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.seatunnel.e2e.connector.file.local; | ||
|
||
import org.apache.seatunnel.e2e.common.TestSuiteBase; | ||
import org.apache.seatunnel.e2e.common.container.TestContainer; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.TestTemplate; | ||
import org.testcontainers.containers.Container; | ||
|
||
import java.io.IOException; | ||
|
||
public class LocalFileIT extends TestSuiteBase { | ||
|
||
@TestTemplate | ||
public void testLocalFileWrite(TestContainer container) throws IOException, InterruptedException { | ||
Container.ExecResult textResult = container.executeJob("/text/fake_to_local_file_text.conf"); | ||
Assertions.assertEquals(0, textResult.getExitCode()); | ||
Container.ExecResult jsonResult = container.executeJob("/json/fake_to_local_file_json.conf"); | ||
Assertions.assertEquals(0, jsonResult.getExitCode()); | ||
Container.ExecResult orcResult = container.executeJob("/orc/fake_to_local_file_orc.conf"); | ||
Assertions.assertEquals(0, orcResult.getExitCode()); | ||
Container.ExecResult parquetResult = container.executeJob("/parquet/fake_to_local_file_parquet.conf"); | ||
Assertions.assertEquals(0, parquetResult.getExitCode()); | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...ctor-v2-e2e/connector-file-local-e2e/src/test/resources/json/fake_to_local_file_json.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
env { | ||
execution.parallelism = 1 | ||
spark.app.name = "SeaTunnel" | ||
spark.executor.instances = 2 | ||
spark.executor.cores = 1 | ||
spark.executor.memory = "1g" | ||
spark.master = local | ||
job.mode = "BATCH" | ||
} | ||
|
||
source { | ||
FakeSource { | ||
schema { | ||
fields { | ||
c_map = "map<string, string>" | ||
c_array = "array<boolean>" | ||
c_string = string | ||
c_boolean = boolean | ||
c_tinyint = tinyint | ||
c_smallint = smallint | ||
c_int = int | ||
c_bigint = bigint | ||
c_float = float | ||
c_double = double | ||
c_decimal = "decimal(30, 8)" | ||
c_bytes = bytes | ||
c_date = date | ||
c_timestamp = timestamp | ||
} | ||
} | ||
result_table_name = "fake" | ||
} | ||
} | ||
|
||
transform { | ||
} | ||
|
||
sink { | ||
LocalFile { | ||
path = "/tmp/seatunnel/json" | ||
row_delimiter = "\n" | ||
partition_dir_expression = "${k0}=${v0}" | ||
is_partition_field_write_in_file = true | ||
file_name_expression = "${transactionId}_${now}" | ||
file_format = "json" | ||
filename_time_format = "yyyy.MM.dd" | ||
is_enable_transaction = true | ||
save_mode = "error" | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...e/seatunnel-connector-v2-e2e/connector-file-local-e2e/src/test/resources/log4j.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Set everything to be logged to the console | ||
log4j.rootCategory=INFO, console | ||
log4j.appender.console=org.apache.log4j.ConsoleAppender | ||
log4j.appender.console.target=System.err | ||
log4j.appender.console.layout=org.apache.log4j.PatternLayout | ||
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n |
67 changes: 67 additions & 0 deletions
67
...nector-v2-e2e/connector-file-local-e2e/src/test/resources/orc/fake_to_local_file_orc.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
env { | ||
execution.parallelism = 1 | ||
spark.app.name = "SeaTunnel" | ||
spark.executor.instances = 2 | ||
spark.executor.cores = 1 | ||
spark.executor.memory = "1g" | ||
spark.master = local | ||
job.mode = "BATCH" | ||
} | ||
|
||
source { | ||
FakeSource { | ||
schema { | ||
fields { | ||
c_map = "map<string, string>" | ||
c_array = "array<boolean>" | ||
c_string = string | ||
c_boolean = boolean | ||
c_tinyint = tinyint | ||
c_smallint = smallint | ||
c_int = int | ||
c_bigint = bigint | ||
c_float = float | ||
c_double = double | ||
c_decimal = "decimal(30, 8)" | ||
c_bytes = bytes | ||
c_date = date | ||
c_timestamp = timestamp | ||
} | ||
} | ||
result_table_name = "fake" | ||
} | ||
} | ||
|
||
transform { | ||
} | ||
|
||
sink { | ||
LocalFile { | ||
path = "/tmp/seatunnel/orc" | ||
row_delimiter = "\n" | ||
partition_dir_expression = "${k0}=${v0}" | ||
is_partition_field_write_in_file = true | ||
file_name_expression = "${transactionId}_${now}" | ||
file_format = "orc" | ||
filename_time_format = "yyyy.MM.dd" | ||
is_enable_transaction = true | ||
save_mode = "error" | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...2-e2e/connector-file-local-e2e/src/test/resources/parquet/fake_to_local_file_parquet.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
env { | ||
execution.parallelism = 1 | ||
spark.app.name = "SeaTunnel" | ||
spark.executor.instances = 2 | ||
spark.executor.cores = 1 | ||
spark.executor.memory = "1g" | ||
spark.master = local | ||
job.mode = "BATCH" | ||
} | ||
|
||
source { | ||
FakeSource { | ||
schema { | ||
fields { | ||
c_map = "map<string, string>" | ||
c_array = "array<boolean>" | ||
c_string = string | ||
c_boolean = boolean | ||
c_tinyint = tinyint | ||
c_smallint = smallint | ||
c_int = int | ||
c_bigint = bigint | ||
c_float = float | ||
c_double = double | ||
c_decimal = "decimal(30, 8)" | ||
c_bytes = bytes | ||
c_date = date | ||
c_timestamp = timestamp | ||
} | ||
} | ||
result_table_name = "fake" | ||
} | ||
} | ||
|
||
transform { | ||
} | ||
|
||
sink { | ||
LocalFile { | ||
path = "/tmp/seatunnel/parquet" | ||
row_delimiter = "\n" | ||
partition_dir_expression = "${k0}=${v0}" | ||
is_partition_field_write_in_file = true | ||
file_name_expression = "${transactionId}_${now}" | ||
file_format = "parquet" | ||
filename_time_format = "yyyy.MM.dd" | ||
is_enable_transaction = true | ||
save_mode = "error" | ||
} | ||
} |
67 changes: 67 additions & 0 deletions
67
...ctor-v2-e2e/connector-file-local-e2e/src/test/resources/text/fake_to_local_file_text.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
env { | ||
execution.parallelism = 1 | ||
spark.app.name = "SeaTunnel" | ||
spark.executor.instances = 2 | ||
spark.executor.cores = 1 | ||
spark.executor.memory = "1g" | ||
spark.master = local | ||
job.mode = "BATCH" | ||
} | ||
|
||
source { | ||
FakeSource { | ||
schema { | ||
fields { | ||
c_map = "map<string, string>" | ||
c_array = "array<boolean>" | ||
c_string = string | ||
c_boolean = boolean | ||
c_tinyint = tinyint | ||
c_smallint = smallint | ||
c_int = int | ||
c_bigint = bigint | ||
c_float = float | ||
c_double = double | ||
c_decimal = "decimal(30, 8)" | ||
c_bytes = bytes | ||
c_date = date | ||
c_timestamp = timestamp | ||
} | ||
} | ||
result_table_name = "fake" | ||
} | ||
} | ||
|
||
transform { | ||
} | ||
|
||
sink { | ||
LocalFile { | ||
path = "/tmp/seatunnel/text" | ||
row_delimiter = "\n" | ||
partition_dir_expression = "${k0}=${v0}" | ||
is_partition_field_write_in_file = true | ||
file_name_expression = "${transactionId}_${now}" | ||
file_format = "text" | ||
filename_time_format = "yyyy.MM.dd" | ||
is_enable_transaction = true | ||
save_mode = "error" | ||
} | ||
} |
Oops, something went wrong.