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 e167bf17d0c Add test cases on InventoryTask (#33397)
e167bf17d0c is described below

commit e167bf17d0c1a14a7870c4a975552fe232776de5
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Oct 25 11:34:30 2024 +0800

    Add test cases on InventoryTask (#33397)
---
 .../data/pipeline/core/task/InventoryTaskTest.java         | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskTest.java
 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskTest.java
index 3dcf4159bcd..12e9afa625e 100644
--- 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskTest.java
+++ 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/data/pipeline/core/task/InventoryTaskTest.java
@@ -46,6 +46,7 @@ import java.util.concurrent.atomic.AtomicReference;
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 class InventoryTaskTest {
     
@@ -103,4 +104,17 @@ class InventoryTaskTest {
                 : 
taskConfig.getDumperContext().getCommonContext().getPosition());
         return result;
     }
+    
+    @Test
+    void assertStop() {
+        Dumper dumper = mock(Dumper.class);
+        Importer importer = mock(Importer.class);
+        InventoryDumperContext inventoryDumperContext = 
createInventoryDumperContext("t_order", "t_order");
+        AtomicReference<IngestPosition> position = new 
AtomicReference<>(inventoryDumperContext.getCommonContext().getPosition());
+        InventoryTask inventoryTask = new 
InventoryTask(PipelineTaskUtils.generateInventoryTaskId(inventoryDumperContext),
+                PipelineContextUtils.getExecuteEngine(), 
PipelineContextUtils.getExecuteEngine(), dumper, importer, position);
+        inventoryTask.stop();
+        verify(dumper).stop();
+        verify(importer).stop();
+    }
 }

Reply via email to