Skip to content

Commit 0b3c563

Browse files
Changing ReplicationPluginInterface to static object
Signed-off-by: aggarwalShivani <shivani.aggarwal@nokia.com>
1 parent 833d9af commit 0b3c563

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main/kotlin/org/opensearch/commons/replication/ReplicationPluginInterface.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,19 @@
55
package org.opensearch.commons.replication
66

77
import org.opensearch.action.support.clustermanager.AcknowledgedResponse
8-
import org.opensearch.transport.client.Client
9-
import org.opensearch.transport.client.node.NodeClient
108
import org.opensearch.commons.replication.action.ReplicationActions.INTERNAL_STOP_REPLICATION_ACTION_TYPE
119
import org.opensearch.commons.replication.action.StopIndexReplicationRequest
1210
import org.opensearch.commons.utils.recreateObject
1311
import org.opensearch.core.action.ActionListener
1412
import org.opensearch.core.action.ActionResponse
1513
import org.opensearch.core.common.io.stream.Writeable
14+
import org.opensearch.transport.client.Client
15+
import org.opensearch.transport.client.node.NodeClient
1616

1717
/**
1818
* Transport action plugin interfaces for the cross-cluster-replication plugin.
1919
*/
20-
open class ReplicationPluginInterface {
20+
object ReplicationPluginInterface {
2121

2222
/**
2323
* Stop replication.
@@ -26,7 +26,7 @@ open class ReplicationPluginInterface {
2626
* @param listener The listener for getting response
2727
*/
2828

29-
open fun stopReplication(
29+
fun stopReplication(
3030
client: Client,
3131
request: StopIndexReplicationRequest,
3232
listener: ActionListener<AcknowledgedResponse>

src/test/kotlin/org/opensearch/commons/replication/ReplicationPluginInterfaceTests.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import org.mockito.Mockito.mock
1313
import org.mockito.Mockito.verify
1414
import org.mockito.junit.jupiter.MockitoExtension
1515
import org.opensearch.action.support.clustermanager.AcknowledgedResponse
16-
import org.opensearch.transport.client.node.NodeClient
1716
import org.opensearch.commons.replication.action.StopIndexReplicationRequest
1817
import org.opensearch.core.action.ActionListener
1918
import org.opensearch.core.action.ActionResponse
19+
import org.opensearch.transport.client.node.NodeClient
2020

2121
@ExtendWith(MockitoExtension::class)
2222
internal class ReplicationPluginInterfaceTests {
@@ -36,9 +36,8 @@ internal class ReplicationPluginInterfaceTests {
3636
actionListener.onResponse(acknowledgedResponse) // Simulate success
3737
}
3838

39-
val replicationPluginInterface = ReplicationPluginInterface()
4039
// Call method under test
41-
replicationPluginInterface.stopReplication(client, request, listener)
40+
ReplicationPluginInterface.stopReplication(client, request, listener)
4241
// Verify that listener.onResponse is called with the correct response
4342
verify(listener).onResponse(acknowledgedResponse)
4443
}
@@ -58,9 +57,8 @@ internal class ReplicationPluginInterfaceTests {
5857
actionListener.onFailure(exception) // Simulate failure
5958
}
6059

61-
val replicationPluginInterface = ReplicationPluginInterface()
6260
// Call method under test
63-
replicationPluginInterface.stopReplication(client, request, listener)
61+
ReplicationPluginInterface.stopReplication(client, request, listener)
6462
// Verify that listener.onResponse is called with the correct response
6563
verify(listener).onFailure(exception)
6664
}

0 commit comments

Comments
 (0)