You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/10/15 00:55:26 UTC

[shardingsphere] branch master updated: Add unit test in GovernanceRepositoryAPIImplTest (#28747)

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

zhaojinchao 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 b8427b81e0a Add unit test in GovernanceRepositoryAPIImplTest (#28747)
b8427b81e0a is described below

commit b8427b81e0aece4ef4801cfefc66dbfa441b5a7e
Author: Pavan Baloju <pa...@gmail.com>
AuthorDate: Sun Oct 15 06:25:20 2023 +0530

    Add unit test in GovernanceRepositoryAPIImplTest (#28747)
    
    * Add unit test in GovernanceRepositoryAPIImplTest for persistJobOffsetInfo and getJobOffsetInfo
    
    * Fix style check
---
 .../core/job/service/GovernanceRepositoryAPIImplTest.java        | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
index 2b28e2d95c5..d151d0221cc 100644
--- a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
+++ b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
@@ -147,6 +147,15 @@ class GovernanceRepositoryAPIImplTest {
         assertThat(shardingItems.get(0), is(jobItemContext.getShardingItem()));
     }
     
+    @Test
+    void assertPersistJobOffsetInfo() {
+        assertFalse(governanceRepositoryAPI.getJobOffsetInfo("1").isPresent());
+        governanceRepositoryAPI.persistJobOffsetInfo("1", "testValue");
+        Optional<String> actual = governanceRepositoryAPI.getJobOffsetInfo("1");
+        assertTrue(actual.isPresent());
+        assertThat(actual.get(), is("testValue"));
+    }
+    
     private MigrationJobItemContext mockJobItemContext() {
         MigrationJobItemContext result = PipelineContextUtils.mockMigrationJobItemContext(JobConfigurationBuilder.createJobConfiguration());
         MigrationTaskConfiguration taskConfig = result.getTaskConfig();