From c9ffc9e14a08744966c0f0ae7d2acb92bbb04139 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 28 Nov 2019 19:15:28 +0100 Subject: [PATCH] =?utf8?q?=F0=9F=94=A5=20Remove=20trust=20settings=20from?= =?utf8?q?=20preferences?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../pterodactylus/sone/core/PreferencesLoader.java | 21 -------- .../net/pterodactylus/sone/core/Preferences.kt | 21 -------- .../sone/core/PreferencesLoaderTest.java | 7 --- .../net/pterodactylus/sone/core/PreferencesTest.kt | 63 ---------------------- 4 files changed, 112 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/PreferencesLoader.java b/src/main/java/net/pterodactylus/sone/core/PreferencesLoader.java index a730983..5fa33e4 100644 --- a/src/main/java/net/pterodactylus/sone/core/PreferencesLoader.java +++ b/src/main/java/net/pterodactylus/sone/core/PreferencesLoader.java @@ -23,9 +23,6 @@ public class PreferencesLoader { loadCharactersPerPost(configuration); loadPostCutOffLength(configuration); loadRequireFullAccess(configuration); - loadPositiveTrust(configuration); - loadNegativeTrust(configuration); - loadTrustComment(configuration); loadFcpInterfaceActive(configuration); loadFcpFullAccessRequired(configuration); } @@ -69,24 +66,6 @@ public class PreferencesLoader { .getValue(null)); } - private void loadPositiveTrust(Configuration configuration) { - preferences.setNewPositiveTrust( - configuration.getIntValue("Option/PositiveTrust") - .getValue(null)); - } - - private void loadNegativeTrust(Configuration configuration) { - preferences.setNewNegativeTrust( - configuration.getIntValue("Option/NegativeTrust") - .getValue(null)); - } - - private void loadTrustComment(Configuration configuration) { - preferences.setNewTrustComment( - configuration.getStringValue("Option/TrustComment") - .getValue(null)); - } - private void loadFcpInterfaceActive(Configuration configuration) { preferences.setNewFcpInterfaceActive(configuration.getBooleanValue( "Option/ActivateFcpInterface").getValue(null)); diff --git a/src/main/kotlin/net/pterodactylus/sone/core/Preferences.kt b/src/main/kotlin/net/pterodactylus/sone/core/Preferences.kt index 783552e..7363ed0 100644 --- a/src/main/kotlin/net/pterodactylus/sone/core/Preferences.kt +++ b/src/main/kotlin/net/pterodactylus/sone/core/Preferences.kt @@ -77,24 +77,6 @@ class Preferences(private val eventBus: EventBus) { get() = unsupported set(value) = _requireFullAccess.set(value) - private val _positiveTrust = DefaultOption(75, range(0, 100)) - val positiveTrust: Int get() = _positiveTrust.get() - var newPositiveTrust: Int? - get() = unsupported - set(value) = _positiveTrust.set(value) - - private val _negativeTrust = DefaultOption(-25, range(-100, 100)) - val negativeTrust: Int get() = _negativeTrust.get() - var newNegativeTrust: Int? - get() = unsupported - set(value) = _negativeTrust.set(value) - - private val _trustComment = DefaultOption("Set from Sone Web Interface") - val trustComment: String get() = _trustComment.get() - var newTrustComment: String? - get() = unsupported - set(value) = _trustComment.set(value) - private val _fcpInterfaceActive = DefaultOption(false) val fcpInterfaceActive: Boolean get() = _fcpInterfaceActive.get() var newFcpInterfaceActive: Boolean? @@ -125,9 +107,6 @@ class Preferences(private val eventBus: EventBus) { configuration.getIntValue("Option/CharactersPerPost").value = _charactersPerPost.real configuration.getIntValue("Option/PostCutOffLength").value = _postCutOffLength.real configuration.getBooleanValue("Option/RequireFullAccess").value = _requireFullAccess.real - configuration.getIntValue("Option/PositiveTrust").value = _positiveTrust.real - configuration.getIntValue("Option/NegativeTrust").value = _negativeTrust.real - configuration.getStringValue("Option/TrustComment").value = _trustComment.real configuration.getBooleanValue("Option/ActivateFcpInterface").value = _fcpInterfaceActive.real configuration.getIntValue("Option/FcpFullAccessRequired").value = toInt(_fcpFullAccessRequired.real) } diff --git a/src/test/java/net/pterodactylus/sone/core/PreferencesLoaderTest.java b/src/test/java/net/pterodactylus/sone/core/PreferencesLoaderTest.java index d550f25..72831fc 100644 --- a/src/test/java/net/pterodactylus/sone/core/PreferencesLoaderTest.java +++ b/src/test/java/net/pterodactylus/sone/core/PreferencesLoaderTest.java @@ -33,10 +33,6 @@ public class PreferencesLoaderTest { setupIntValue("CharactersPerPost", 150); setupIntValue("PostCutOffLength", 300); setupBooleanValue("RequireFullAccess", true); - setupIntValue("PositiveTrust", 50); - setupIntValue("NegativeTrust", -50); - when(configuration.getStringValue("Option/TrustComment")).thenReturn( - TestValue.from("Trusted")); setupBooleanValue("ActivateFcpInterface", true); setupIntValue("FcpFullAccessRequired", 1); } @@ -62,9 +58,6 @@ public class PreferencesLoaderTest { assertThat(preferences.getCharactersPerPost(), is(150)); assertThat(preferences.getPostCutOffLength(), is(300)); assertThat(preferences.getRequireFullAccess(), is(true)); - assertThat(preferences.getPositiveTrust(), is(50)); - assertThat(preferences.getNegativeTrust(), is(-50)); - assertThat(preferences.getTrustComment(), is("Trusted")); assertThat(preferences.getFcpInterfaceActive(), is(true)); assertThat(preferences.getFcpFullAccessRequired(), is(WRITING)); } diff --git a/src/test/kotlin/net/pterodactylus/sone/core/PreferencesTest.kt b/src/test/kotlin/net/pterodactylus/sone/core/PreferencesTest.kt index 199604b..6da6658 100644 --- a/src/test/kotlin/net/pterodactylus/sone/core/PreferencesTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/core/PreferencesTest.kt @@ -180,69 +180,6 @@ class PreferencesTest { } @Test - fun `preferences retain positive trust`() { - preferences.newPositiveTrust = 15 - assertThat(preferences.positiveTrust, equalTo(15)) - } - - @Test(expected = IllegalArgumentException::class) - fun `invalid positive trust is rejected`() { - preferences.newPositiveTrust = -15 - } - - @Test - fun `preferences return default value when positive trust is set to null`() { - preferences.newPositiveTrust = null - assertThat(preferences.positiveTrust, equalTo(75)) - } - - @Test - fun `preferences start with positive trust default value`() { - assertThat(preferences.positiveTrust, equalTo(75)) - } - - @Test - fun `preferences retain negative trust`() { - preferences.newNegativeTrust = -15 - assertThat(preferences.negativeTrust, equalTo(-15)) - } - - @Test(expected = IllegalArgumentException::class) - fun `invalid negative trust is rejected`() { - preferences.newNegativeTrust = 150 - } - - @Test - fun `preferences return default value when negative trust is set to null`() { - preferences.newNegativeTrust = null - assertThat(preferences.negativeTrust, equalTo(-25)) - } - - @Test - fun `preferences start with negative trust default value`() { - assertThat(preferences.negativeTrust, equalTo(-25)) - } - - @Test - fun `preferences retain trust comment`() { - preferences.newTrustComment = "Trust" - assertThat(preferences.trustComment, equalTo("Trust")) - } - - @Test - fun `preferences return default value when trust comment is set to null`() { - preferences.newTrustComment = null - assertThat(preferences.trustComment, - equalTo("Set from Sone Web Interface")) - } - - @Test - fun `preferences start with trust comment default value`() { - assertThat(preferences.trustComment, - equalTo("Set from Sone Web Interface")) - } - - @Test fun `preferences retain fcp interface active of true`() { preferences.newFcpInterfaceActive = true assertThat(preferences.fcpInterfaceActive, equalTo(true)) -- 2.7.4