Skip to content

Commit

Permalink
Fix ktlint issues for replication libs
Browse files Browse the repository at this point in the history
Signed-off-by: aggarwalShivani <shivani.aggarwal@nokia.com>
  • Loading branch information
aggarwalShivani committed Jul 8, 2024
1 parent e46f3b6 commit 72a4fdf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ package org.opensearch.commons.replication

import org.opensearch.action.support.master.AcknowledgedResponse
import org.opensearch.client.node.NodeClient
import org.opensearch.commons.replication.action.StopIndexReplicationRequest
import org.opensearch.commons.replication.action.ReplicationActions.UNFOLLOW_REPLICATION_ACTION_TYPE
import org.opensearch.commons.replication.action.StopIndexReplicationRequest
import org.opensearch.commons.utils.recreateObject
import org.opensearch.core.action.ActionListener
import org.opensearch.core.action.ActionResponse
import org.opensearch.core.common.io.stream.Writeable


/**
* Transport action plugin interfaces for the cross-cluster-replication plugin.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@ object ReplicationActions {
ActionType(STOP_REPLICATION_ACTION_NAME, ::AcknowledgedResponse)
val UNFOLLOW_REPLICATION_ACTION_TYPE =
ActionType(UNFOLLOW_REPLICATION_ACTION_NAME, ::AcknowledgedResponse)

}
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
package org.opensearch.commons.replication.action

import org.opensearch.action.ActionRequestValidationException
import org.apache.logging.log4j.LogManager
import org.opensearch.action.IndicesRequest
import org.opensearch.action.support.IndicesOptions
import org.opensearch.action.support.master.AcknowledgedRequest
import org.opensearch.core.common.io.stream.StreamInput
import org.opensearch.core.common.io.stream.StreamOutput
import org.opensearch.core.xcontent.*
class StopIndexReplicationRequest : AcknowledgedRequest<StopIndexReplicationRequest>, IndicesRequest.Replaceable, ToXContentObject {
import org.opensearch.core.xcontent.ObjectParser
import org.opensearch.core.xcontent.ToXContent
import org.opensearch.core.xcontent.ToXContentObject
import org.opensearch.core.xcontent.XContentBuilder
import org.opensearch.core.xcontent.XContentParser

class StopIndexReplicationRequest :
AcknowledgedRequest<StopIndexReplicationRequest>, IndicesRequest.Replaceable, ToXContentObject {
lateinit var indexName: String
constructor(indexName: String) {
this.indexName = indexName
Expand All @@ -17,7 +22,7 @@ class StopIndexReplicationRequest : AcknowledgedRequest<StopIndexReplicationRequ
private constructor() {
}

constructor(inp: StreamInput): super(inp) {
constructor(inp: StreamInput) : super(inp) {
indexName = inp.readString()
}
companion object {
Expand All @@ -30,7 +35,6 @@ class StopIndexReplicationRequest : AcknowledgedRequest<StopIndexReplicationRequ
stopIndexReplicationRequest.indexName = followerIndex
return stopIndexReplicationRequest
}
private val log = LogManager.getLogger(StopIndexReplicationRequest::class.java)
}

override fun validate(): ActionRequestValidationException? {
Expand Down Expand Up @@ -59,4 +63,4 @@ class StopIndexReplicationRequest : AcknowledgedRequest<StopIndexReplicationRequ
super.writeTo(out)
out.writeString(indexName)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ internal class ReplicationPluginInterfaceTests {

@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private lateinit var client: NodeClient

@Test
fun stopReplication() {
val request = Mockito.mock(StopIndexReplicationRequest::class.java)
Expand All @@ -40,4 +41,4 @@ internal class ReplicationPluginInterfaceTests {
ReplicationPluginInterface.stopReplication(client, request, listener)
Mockito.verify(listener, Mockito.times(1)).onResponse(ArgumentMatchers.eq(response))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ internal class StopIndexReplicationRequestTests {
assertEquals(request.indexName, recreatedRequest.indexName)
assertNull(recreatedRequest.validate())
}
}
}

0 comments on commit 72a4fdf

Please sign in to comment.