|  | 
| 11 | 11 | 
 | 
| 12 | 12 | package org.opensearch.replication.task.shard | 
| 13 | 13 | 
 | 
| 14 |  | -import org.opensearch.replication.action.changes.GetChangesResponse | 
| 15 |  | -import org.opensearch.replication.action.replay.ReplayChangesAction | 
| 16 |  | -import org.opensearch.replication.action.replay.ReplayChangesRequest | 
| 17 |  | -import org.opensearch.replication.action.replay.ReplayChangesResponse | 
| 18 |  | -import org.opensearch.replication.metadata.ReplicationOverallState | 
| 19 |  | -import org.opensearch.replication.metadata.store.ReplicationContext | 
| 20 |  | -import org.opensearch.replication.metadata.store.ReplicationMetadata | 
| 21 |  | -import org.opensearch.replication.metadata.store.ReplicationStoreMetadataType | 
| 22 | 14 | import kotlinx.coroutines.ExperimentalCoroutinesApi | 
| 23 | 15 | import kotlinx.coroutines.ObsoleteCoroutinesApi | 
| 24 | 16 | import kotlinx.coroutines.test.runBlockingTest | 
| 25 | 17 | import org.assertj.core.api.Assertions.assertThat | 
|  | 18 | +import org.mockito.Mockito | 
| 26 | 19 | import org.opensearch.action.ActionListener | 
| 27 | 20 | import org.opensearch.action.ActionRequest | 
| 28 | 21 | import org.opensearch.action.ActionResponse | 
| 29 | 22 | import org.opensearch.action.ActionType | 
| 30 | 23 | import org.opensearch.action.support.replication.ReplicationResponse.ShardInfo | 
| 31 | 24 | import org.opensearch.common.settings.Settings | 
|  | 25 | +import org.opensearch.index.IndexService | 
|  | 26 | +import org.opensearch.index.shard.IndexShard | 
| 32 | 27 | import org.opensearch.index.shard.ShardId | 
| 33 | 28 | import org.opensearch.index.translog.Translog | 
|  | 29 | +import org.opensearch.indices.IndicesService | 
|  | 30 | +import org.opensearch.replication.action.changes.GetChangesResponse | 
|  | 31 | +import org.opensearch.replication.action.replay.ReplayChangesAction | 
|  | 32 | +import org.opensearch.replication.action.replay.ReplayChangesRequest | 
|  | 33 | +import org.opensearch.replication.action.replay.ReplayChangesResponse | 
|  | 34 | +import org.opensearch.replication.metadata.ReplicationOverallState | 
|  | 35 | +import org.opensearch.replication.metadata.store.ReplicationContext | 
|  | 36 | +import org.opensearch.replication.metadata.store.ReplicationMetadata | 
|  | 37 | +import org.opensearch.replication.metadata.store.ReplicationStoreMetadataType | 
|  | 38 | +import org.opensearch.replication.util.indicesService | 
| 34 | 39 | import org.opensearch.tasks.TaskId.EMPTY_TASK_ID | 
| 35 | 40 | import org.opensearch.test.OpenSearchTestCase | 
| 36 |  | -import org.opensearch.test.OpenSearchTestCase.randomList | 
| 37 | 41 | import org.opensearch.test.client.NoOpClient | 
| 38 | 42 | import java.util.Locale | 
| 39 | 43 | 
 | 
|  | 44 | + | 
| 40 | 45 | @ObsoleteCoroutinesApi | 
| 41 | 46 | class TranslogSequencerTests : OpenSearchTestCase() { | 
| 42 | 47 | 
 | 
| @@ -83,6 +88,11 @@ class TranslogSequencerTests : OpenSearchTestCase() { | 
| 83 | 88 |         val stats = FollowerClusterStats() | 
| 84 | 89 |         stats.stats[followerShardId]  = FollowerShardMetric() | 
| 85 | 90 |         val startSeqNo = randomNonNegativeLong() | 
|  | 91 | +        indicesService = Mockito.mock(IndicesService::class.java) | 
|  | 92 | +        val followerIndexService = Mockito.mock(IndexService::class.java) | 
|  | 93 | +        val indexShard = Mockito.mock(IndexShard::class.java) | 
|  | 94 | +        Mockito.`when`(indicesService.indexServiceSafe(followerShardId.index)).thenReturn(followerIndexService) | 
|  | 95 | +        Mockito.`when`(followerIndexService.getShard(followerShardId.id)).thenReturn(indexShard) | 
| 86 | 96 |         val sequencer = TranslogSequencer(this, replicationMetadata, followerShardId, leaderAlias, leaderIndex, EMPTY_TASK_ID, | 
| 87 | 97 |                                           client, startSeqNo, stats) | 
| 88 | 98 | 
 | 
|  | 
0 commit comments