From 49a3df983725904f58c2511eae15c5be161f66b3 Mon Sep 17 00:00:00 2001 From: zhangliang Date: Thu, 23 Nov 2023 14:55:57 +0800 Subject: [PATCH] Remove useless codes --- .../PipelineJobOffsetGovernanceRepository.java | 14 -------------- .../service/GovernanceRepositoryAPIImplTest.java | 10 ---------- 2 files changed, 24 deletions(-) diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/registrycenter/repository/PipelineJobOffsetGovernanceRepository.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/registrycenter/repository/PipelineJobOffsetGovernanceRepository.java index 412f78e4e6e14..c007b67574f9c 100644 --- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/registrycenter/repository/PipelineJobOffsetGovernanceRepository.java +++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/common/registrycenter/repository/PipelineJobOffsetGovernanceRepository.java @@ -26,9 +26,6 @@ import org.apache.shardingsphere.infra.util.yaml.YamlEngine; import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository; -import java.util.List; -import java.util.stream.Collectors; - /** * Pipeline job offset governance repository. */ @@ -57,15 +54,4 @@ public JobOffsetInfo load(final String jobId) { String value = repository.getDirectly(PipelineMetaDataNode.getJobOffsetPath(jobId)); return new YamlJobOffsetInfoSwapper().swapToObject(Strings.isNullOrEmpty(value) ? new YamlJobOffsetInfo() : YamlEngine.unmarshal(value, YamlJobOffsetInfo.class)); } - - /** - * Get sharding items of job. - * - * @param jobId job id - * @return sharding items - */ - public List getShardingItems(final String jobId) { - List result = repository.getChildrenKeys(PipelineMetaDataNode.getJobOffsetPath(jobId)); - return result.stream().map(Integer::parseInt).collect(Collectors.toList()); - } } 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 0e3e0ff9312e9..0ff4eaa627321 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 @@ -43,7 +43,6 @@ import java.util.Collections; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.concurrent.CountDownLatch; @@ -155,15 +154,6 @@ void assertPersistJobOffset() { assertTrue(governanceRepositoryAPI.getJobOffsetGovernanceRepository().load("1").isTargetSchemaTableCreated()); } - @Test - void assertGetShardingItems() { - MigrationJobItemContext jobItemContext = mockJobItemContext(); - governanceRepositoryAPI.getJobItemProcessGovernanceRepository().persist(jobItemContext.getJobId(), jobItemContext.getShardingItem(), "testValue"); - List shardingItems = governanceRepositoryAPI.getJobOffsetGovernanceRepository().getShardingItems(jobItemContext.getJobId()); - assertThat(shardingItems.size(), is(1)); - assertThat(shardingItems.get(0), is(jobItemContext.getShardingItem())); - } - private ClusterPersistRepository getClusterPersistRepository() { ContextManager contextManager = PipelineContextManager.getContext(PipelineContextUtils.getContextKey()).getContextManager(); return (ClusterPersistRepository) contextManager.getMetaDataContexts().getPersistService().getRepository();