From f67d0cbb1bc328c0072fe5f795ffb31cf1b987bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 12 Sep 2014 22:54:26 +0200 Subject: [PATCH] Remove Sone instance from SoneUpdater interface. This will probably allow the Sone parameter in the registerUsk() method in the FreenetInterface to be removed rather soonish. --- src/main/java/net/pterodactylus/sone/core/FreenetInterface.java | 2 +- src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java | 4 ++-- src/main/java/net/pterodactylus/sone/core/SoneUpdater.java | 2 +- src/test/java/net/pterodactylus/sone/core/FreenetInterfaceTest.java | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index b0c108a..b389587 100644 --- a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java +++ b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java @@ -191,7 +191,7 @@ public class FreenetInterface { @SuppressWarnings("synthetic-access") public void onFoundEdition(long edition, USK key, ObjectContainer objectContainer, ClientContext clientContext, boolean metadata, short codec, byte[] data, boolean newKnownGood, boolean newSlotToo) { logger.log(Level.FINE, String.format("Found USK update for Sone “%s” at %s, new known good: %s, new slot too: %s.", sone, key, newKnownGood, newSlotToo)); - soneUpdater.updateSone(sone, edition); + soneUpdater.updateSone(edition); } @Override diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java index fed6528..d59f1f5 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java @@ -99,13 +99,13 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade * The Sone to add */ @Override - public void addSone(Sone sone) { + public void addSone(final Sone sone) { if (!sones.add(sone)) { freenetInterface.unregisterUsk(sone); } freenetInterface.registerUsk(sone, new SoneUpdater() { @Override - public void updateSone(Sone sone, long edition) { + public void updateSone(long edition) { if (edition > sone.getLatestEdition()) { sone.setLatestEdition(edition); new Thread(fetchSoneAction(sone), diff --git a/src/main/java/net/pterodactylus/sone/core/SoneUpdater.java b/src/main/java/net/pterodactylus/sone/core/SoneUpdater.java index 58c38f5..5cdefbe 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneUpdater.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneUpdater.java @@ -10,6 +10,6 @@ import net.pterodactylus.sone.data.Sone; */ public interface SoneUpdater { - void updateSone(Sone sone, long edition); + void updateSone(long edition); } diff --git a/src/test/java/net/pterodactylus/sone/core/FreenetInterfaceTest.java b/src/test/java/net/pterodactylus/sone/core/FreenetInterfaceTest.java index e92054a..d2a1121 100644 --- a/src/test/java/net/pterodactylus/sone/core/FreenetInterfaceTest.java +++ b/src/test/java/net/pterodactylus/sone/core/FreenetInterfaceTest.java @@ -293,7 +293,7 @@ public class FreenetInterfaceTest { public void callbackForRegisteredSoneWithHigherEditionTriggersDownload() throws InterruptedException { freenetInterface.registerUsk(sone, soneUpdater); callbackCaptor.getValue().onFoundEdition(1, null, null, null, false, (short) 0, null, false, false); - verify(soneUpdater).updateSone(sone, 1); + verify(soneUpdater).updateSone(1); } @Test -- 2.7.4