🔥 Remove identifier from plugin connector interface
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 2 Nov 2019 00:01:28 +0000 (01:01 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 2 Nov 2019 00:05:53 +0000 (01:05 +0100)
src/main/kotlin/net/pterodactylus/sone/freenet/plugin/FredPluginConnector.kt
src/main/kotlin/net/pterodactylus/sone/freenet/plugin/PluginConnector.kt
src/main/kotlin/net/pterodactylus/sone/freenet/wot/PluginWebOfTrustConnector.kt
src/test/kotlin/net/pterodactylus/sone/freenet/plugin/FredPluginConnectorTest.kt
src/test/kotlin/net/pterodactylus/sone/freenet/wot/PluginWebOfTrustConnectorTest.kt

index 4dd8604..9852e61 100644 (file)
@@ -16,7 +16,7 @@ import javax.inject.*
  */
 class FredPluginConnector @Inject constructor(private val pluginRespiratorFacade: PluginRespiratorFacade) : PluginConnector {
 
-       override fun sendRequest(pluginName: String, identifier: String, fields: SimpleFieldSet, data: Bucket?): PluginReply {
+       override fun sendRequest(pluginName: String, fields: SimpleFieldSet, data: Bucket?): PluginReply {
                val receivedReply = Channel<PluginReply>()
                val responseReceiver = FredPluginTalker { _, _, responseFields, responseData ->
                        GlobalScope.launch {
index db48dc3..86b0378 100644 (file)
@@ -36,7 +36,7 @@ interface PluginConnector {
         * @throws PluginException if the plugin identified by [pluginName] does not exist
         */
        @Throws(PluginException::class)
-       fun sendRequest(pluginName: String, identifier: String, fields: SimpleFieldSet, data: Bucket? = null): PluginReply
+       fun sendRequest(pluginName: String, fields: SimpleFieldSet, data: Bucket? = null): PluginReply
 
 }
 
index e30cbb3..4557074 100644 (file)
@@ -82,7 +82,7 @@ class PluginWebOfTrustConnector @Inject constructor(private val pluginConnector:
 
        private fun performRequest(fields: SimpleFieldSet): PluginReply {
                logger.log(Level.FINE, format("Sending FCP Request: %s", fields.get("Message")))
-               return pluginConnector.sendRequest(WOT_PLUGIN_NAME, "", fields).also {
+               return pluginConnector.sendRequest(WOT_PLUGIN_NAME, fields).also {
                        logger.log(Level.FINEST, format("Received FCP Response for %s: %s", fields.get("Message"), it.fields.get("Message")))
                        if ("Error" == it.fields.get("Message")) {
                                throw PluginException("Could not perform request for " + fields.get("Message"))
index 959f680..1eaa91a 100644 (file)
@@ -42,14 +42,14 @@ class FredPluginConnectorTest {
        fun `connector throws exception if plugin can not be found`() = runBlocking {
                val pluginConnector = FredPluginConnector(pluginRespiratorFacade)
                expectedException.expect(PluginException::class.java)
-               pluginConnector.sendRequest("wrong.plugin", "", requestFields, requestData)
+               pluginConnector.sendRequest("wrong.plugin", requestFields, requestData)
                Unit
        }
 
        @Test
        fun `connector returns correct fields and data`() = runBlocking {
                val pluginConnector = FredPluginConnector(pluginRespiratorFacade)
-               val reply = pluginConnector.sendRequest("test.plugin", "", requestFields, requestData)
+               val reply = pluginConnector.sendRequest("test.plugin", requestFields, requestData)
                assertThat(reply.fields, equalTo(responseFields))
                assertThat(reply.data, equalTo(responseData))
        }
index 79587ee..5db7fe3 100644 (file)
@@ -305,7 +305,7 @@ private fun <R> PluginConnector.connect(block: PluginWebOfTrustConnector.() -> R
 
 fun createPluginConnector(message: String, fieldsMatcher: Matcher<SimpleFieldSet> = IsAnything<SimpleFieldSet>(), build: SimpleFieldSetBuilder.() -> Unit = {}) =
                object : PluginConnector {
-                       override fun sendRequest(pluginName: String, identifier: String, fields: SimpleFieldSet, data: Bucket?) =
+                       override fun sendRequest(pluginName: String, fields: SimpleFieldSet, data: Bucket?) =
                                        if ((pluginName != wotPluginName) || (fields.get("Message") != message)) {
                                                throw PluginException()
                                        } else {