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

zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 13703d887ce Add test cases on TaskExecuteCallback (#33398)
13703d887ce is described below

commit 13703d887ced994912b45e798714e9a3ecbe6f48
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Oct 25 12:37:34 2024 +0800

    Add test cases on TaskExecuteCallback (#33398)
    
    * Add test cases on InventoryTask
    
    * Add test cases on TaskExecuteCallback
---
 .../core/task/TaskExecuteCallbackTest.java         | 33 ++++++++++++++++++++++
 .../core/src/test/resources/logback-test.xml       |  1 +
 2 files changed, 34 insertions(+)

diff --git 
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/TaskExecuteCallbackTest.java
 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/TaskExecuteCallbackTest.java
new file mode 100644
index 00000000000..c5a9588c693
--- /dev/null
+++ 
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/TaskExecuteCallbackTest.java
@@ -0,0 +1,33 @@
+/*
+ * 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.shardingsphere.data.pipeline.core.task;
+
+import org.junit.jupiter.api.Test;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+class TaskExecuteCallbackTest {
+    
+    @Test
+    void assertOnFailure() {
+        PipelineTask task = mock(PipelineTask.class);
+        new TaskExecuteCallback(task).onFailure(new RuntimeException(""));
+        verify(task).stop();
+    }
+}
diff --git a/kernel/data-pipeline/core/src/test/resources/logback-test.xml 
b/kernel/data-pipeline/core/src/test/resources/logback-test.xml
index 3e541402c02..37d07d0f7c2 100644
--- a/kernel/data-pipeline/core/src/test/resources/logback-test.xml
+++ b/kernel/data-pipeline/core/src/test/resources/logback-test.xml
@@ -28,6 +28,7 @@
     </logger>
     <logger 
name="org.apache.shardingsphere.data.pipeline.core.datasource.PipelineDataSource"
 level="off" />
     <logger 
name="org.apache.shardingsphere.data.pipeline.core.query.JDBCStreamQueryBuilder"
 level="off" />
+    <logger 
name="org.apache.shardingsphere.data.pipeline.core.task.TaskExecuteCallback" 
level="off" />
     
     <root>
         <level value="error" />

Reply via email to