Skip to content

Commit

Permalink
Remove useless codes
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Nov 23, 2023
1 parent 3aff42f commit 49a3df9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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<Integer> getShardingItems(final String jobId) {
List<String> result = repository.getChildrenKeys(PipelineMetaDataNode.getJobOffsetPath(jobId));
return result.stream().map(Integer::parseInt).collect(Collectors.toList());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Integer> 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();
Expand Down

0 comments on commit 49a3df9

Please sign in to comment.