Skip to content

Commit 768bb39

Browse files
[2.x] Changing ReplicationPluginInterface from open class to static object (opensearch-project#798)
Signed-off-by: aggarwalShivani <[email protected]>
1 parent 81fce39 commit 768bb39

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ import org.opensearch.core.common.io.stream.Writeable
1717
/**
1818
* Transport action plugin interfaces for the cross-cluster-replication plugin.
1919
*/
20-
open class ReplicationPluginInterface {
21-
20+
object ReplicationPluginInterface {
2221
/**
2322
* Stop replication.
2423
* @param client Node client for making transport action
2524
* @param request The request object
2625
* @param listener The listener for getting response
2726
*/
2827

29-
open fun stopReplication(
28+
fun stopReplication(
3029
client: Client,
3130
request: StopIndexReplicationRequest,
3231
listener: ActionListener<AcknowledgedResponse>

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -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)