This is an automated email from the ASF dual-hosted git repository.

wuchunfu pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new c5a23024f [Hotfix][API] env required option can not set default value 
(#3584)
c5a23024f is described below

commit c5a23024f6c4ad4b787bb581aac1db8c750784f4
Author: Eric <[email protected]>
AuthorDate: Sun Nov 27 15:09:02 2022 +0800

    [Hotfix][API] env required option can not set default value (#3584)
    
    * required option can not set default value
    
    * add option rules ut
---
 .../apache/seatunnel/api/env/EnvCommonOptions.java |  6 ++--
 .../seatunnel/api/env/EnvOptionRuleTest.java       | 34 ++++++++++++++++++
 .../AmazonDynamoDBSourceFactoryTest.java           | 42 ++++++++++++++++++++++
 3 files changed, 79 insertions(+), 3 deletions(-)

diff --git 
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/env/EnvCommonOptions.java
 
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/env/EnvCommonOptions.java
index bc188c416..52a716add 100644
--- 
a/seatunnel-api/src/main/java/org/apache/seatunnel/api/env/EnvCommonOptions.java
+++ 
b/seatunnel-api/src/main/java/org/apache/seatunnel/api/env/EnvCommonOptions.java
@@ -34,14 +34,14 @@ public class EnvCommonOptions {
     public static final Option<String> JOB_NAME =
         Options.key("job.name")
             .stringType()
-            .defaultValue("SeaTunnel Job")
+            .noDefaultValue()
             .withDescription("The job name of this job");
 
     public static final Option<JobMode> JOB_MODE =
         Options.key("job.mode")
             .enumType(JobMode.class)
-            .defaultValue(JobMode.BATCH)
-            .withDescription("The job mode of this job, support Batch and 
Stream, Default value is Batch");
+            .noDefaultValue()
+            .withDescription("The job mode of this job, support Batch and 
Stream");
 
     public static final Option<Long> CHECKPOINT_INTERVAL =
         Options.key("checkpoint.interval")
diff --git 
a/seatunnel-api/src/test/java/org/apache/seatunnel/api/env/EnvOptionRuleTest.java
 
b/seatunnel-api/src/test/java/org/apache/seatunnel/api/env/EnvOptionRuleTest.java
new file mode 100644
index 000000000..c322a66b2
--- /dev/null
+++ 
b/seatunnel-api/src/test/java/org/apache/seatunnel/api/env/EnvOptionRuleTest.java
@@ -0,0 +1,34 @@
+/*
+ * 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.api.env;
+
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class EnvOptionRuleTest {
+    /**
+     * Method: getEnvOptionRules()
+     */
+    @Test
+    public void testGetEnvOptionRules() throws Exception {
+        OptionRule envOptionRules = EnvOptionRule.getEnvOptionRules();
+        Assertions.assertNotNull(envOptionRules);
+    }
+}
diff --git 
a/seatunnel-connectors-v2/connector-amazondynamodb/src/test/java/org/apache/seatunnel/connectors/seatunnel/amazondynamodb/AmazonDynamoDBSourceFactoryTest.java
 
b/seatunnel-connectors-v2/connector-amazondynamodb/src/test/java/org/apache/seatunnel/connectors/seatunnel/amazondynamodb/AmazonDynamoDBSourceFactoryTest.java
new file mode 100644
index 000000000..7a552198c
--- /dev/null
+++ 
b/seatunnel-connectors-v2/connector-amazondynamodb/src/test/java/org/apache/seatunnel/connectors/seatunnel/amazondynamodb/AmazonDynamoDBSourceFactoryTest.java
@@ -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.connectors.seatunnel.amazondynamodb;
+
+import org.apache.seatunnel.api.configuration.util.OptionRule;
+import 
org.apache.seatunnel.connectors.seatunnel.amazondynamodb.sink.AmazonDynamoDBSinkFactory;
+import 
org.apache.seatunnel.connectors.seatunnel.amazondynamodb.source.AmazonDynamoDBSourceFactory;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+public class AmazonDynamoDBSourceFactoryTest {
+
+    /**
+     * Method: optionRule()
+     */
+    @Test
+    public void testOptionRule() throws Exception {
+        AmazonDynamoDBSourceFactory amazonDynamoDBSourceFactory = new 
AmazonDynamoDBSourceFactory();
+        OptionRule sourceOptionRule = amazonDynamoDBSourceFactory.optionRule();
+        Assertions.assertNotNull(sourceOptionRule);
+
+        AmazonDynamoDBSinkFactory amazonDynamoDBSinkFactory = new 
AmazonDynamoDBSinkFactory();
+        OptionRule sinkOptionRule = amazonDynamoDBSinkFactory.optionRule();
+        Assertions.assertNotNull(sinkOptionRule);
+    }
+}

Reply via email to