From c5734598ee88c40467f586de702a67ccabd0af92 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 30 Jul 2019 22:12:06 +0200 Subject: [PATCH] =?utf8?q?=F0=9F=94=A5=20Remove=20fetching=20of=20custom?= =?utf8?q?=20edition=20from=20rescuer?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/core/SoneRescuer.java | 2 +- src/test/java/net/pterodactylus/sone/core/SoneRescuerTest.java | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java index 4d706ca..93c77c2 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneRescuer.java @@ -158,7 +158,7 @@ public class SoneRescuer extends AbstractService { } if (fetching) { core.lockSone(sone); - FreenetURI soneUri = sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + currentEdition).setMetaString(new String[] { "sone.xml" }); + FreenetURI soneUri = sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + getNextEdition()).setMetaString(new String[] { "sone.xml" }); System.out.println("URI: " + soneUri); Sone fetchedSone = soneDownloader.fetchSone(sone, soneUri, true); System.out.println("Sone: " + fetchedSone); diff --git a/src/test/java/net/pterodactylus/sone/core/SoneRescuerTest.java b/src/test/java/net/pterodactylus/sone/core/SoneRescuerTest.java index ff49a4c..92748e8 100644 --- a/src/test/java/net/pterodactylus/sone/core/SoneRescuerTest.java +++ b/src/test/java/net/pterodactylus/sone/core/SoneRescuerTest.java @@ -25,7 +25,6 @@ import org.mockito.stubbing.Answer; public class SoneRescuerTest { private static final long CURRENT_EDITION = 12L; - private static final long SOME_OTHER_EDITION = 15L; private final Core core = mock(Core.class); private final SoneDownloader soneDownloader = mock(SoneDownloader.class); private final Sone sone = mock(Sone.class); @@ -71,12 +70,6 @@ public class SoneRescuerTest { } @Test - public void currentEditionCanBeSet() { - soneRescuer.setEdition(SOME_OTHER_EDITION); - assertThat(soneRescuer.getCurrentEdition(), is(SOME_OTHER_EDITION)); - } - - @Test public void lastFetchOfANewSoneRescuerWasSuccessful() { assertThat(soneRescuer.isLastFetchSuccessful(), is(true)); } @@ -126,7 +119,7 @@ public class SoneRescuerTest { FreenetURI keyWithDocName = mock(FreenetURI.class); FreenetURI keyWithMetaStrings = mock(FreenetURI.class); when(keyWithDocName.setMetaString(eq(new String[] { "sone.xml" }))).thenReturn(keyWithMetaStrings); - when(sskKey.setDocName(eq("Sone-" + CURRENT_EDITION))).thenReturn(keyWithDocName); + when(sskKey.setDocName(eq("Sone-" + (CURRENT_EDITION - 1)))).thenReturn(keyWithDocName); when(sone.getRequestUri().setKeyType(eq("SSK"))).thenReturn(sskKey); return keyWithMetaStrings; } -- 2.7.4