sone, key, newKnownGood, newSlotToo));
if (edition > sone.getLatestEdition()) {
sone.setLatestEdition(edition);
- new Thread(fetchSoneAction(sone),
+ new Thread(fetchSoneAsSskAction(sone),
"Sone Downloader").start();
}
}
return (currentTimeMillis() - sone.getTime()) < DAYS.toMillis(7);
}
- private void fetchSone(Sone sone) {
+ private void fetchSoneAsSsk(Sone sone) {
fetchSone(sone, sone.getRequestUri().sskForUSK(), false);
}
}
@Override
- public Runnable fetchSoneWithUriAction(final Sone sone) {
+ public Runnable fetchSoneAsUskAction(final Sone sone) {
return new Runnable() {
@Override
public void run() {
}
@Override
- public Runnable fetchSoneAction(final Sone sone) {
+ public Runnable fetchSoneAsSskAction(final Sone sone) {
return new Runnable() {
@Override
public void run() {
- fetchSone(sone);
+ fetchSoneAsSsk(sone);
}
};
}
FreenetURI finalRequestUri = requestUri.sskForUSK()
.setMetaString(new String[] { "sone.xml" });
setupSoneAsUnknown();
- soneDownloader.fetchSoneAction(sone).run();
+ soneDownloader.fetchSoneAsSskAction(sone).run();
verify(freenetInterface).fetchUri(finalRequestUri);
verifyThatSoneStatusWasChangedToDownloadingAndBackTo(unknown);
verify(core, never()).updateSone(any(Sone.class));
public void notBeingAbleToFetchAKnownSoneDoesNotUpdateCore() {
FreenetURI finalRequestUri = requestUri.sskForUSK()
.setMetaString(new String[] { "sone.xml" });
- soneDownloader.fetchSoneAction(sone).run();
+ soneDownloader.fetchSoneAsSskAction(sone).run();
verify(freenetInterface).fetchUri(finalRequestUri);
verifyThatSoneStatusWasChangedToDownloadingAndBackTo(idle);
verify(core, never()).updateSone(any(Sone.class));
setupSoneAsUnknown();
when(freenetInterface.fetchUri(finalRequestUri)).thenThrow(NullPointerException.class);
try {
- soneDownloader.fetchSoneAction(sone).run();
+ soneDownloader.fetchSoneAsSskAction(sone).run();
} finally {
verify(freenetInterface).fetchUri(finalRequestUri);
verifyThatSoneStatusWasChangedToDownloadingAndBackTo(unknown);
.setMetaString(new String[] { "sone.xml" });
when(freenetInterface.fetchUri(finalRequestUri)).thenThrow( NullPointerException.class);
try {
- soneDownloader.fetchSoneAction(sone).run();
+ soneDownloader.fetchSoneAsSskAction(sone).run();
} finally {
verify(freenetInterface).fetchUri(finalRequestUri);
verifyThatSoneStatusWasChangedToDownloadingAndBackTo(idle);
public void fetchingSoneWithInvalidXmlWillNotUpdateTheCore() throws IOException {
final Fetched fetchResult = createFetchResult(requestUri, getClass().getResourceAsStream("sone-parser-not-xml.xml"));
when(freenetInterface.fetchUri(requestUri)).thenReturn(fetchResult);
- soneDownloader.fetchSoneAction(sone).run();
+ soneDownloader.fetchSoneAsSskAction(sone).run();
verify(core, never()).updateSone(any(Sone.class));
}
final Fetched fetchResult = createFetchResult(requestUri, getClass().getResourceAsStream("sone-parser-no-payload.xml"));
when(core.soneBuilder()).thenReturn(null);
when(freenetInterface.fetchUri(requestUri)).thenReturn(fetchResult);
- soneDownloader.fetchSoneAction(sone).run();
+ soneDownloader.fetchSoneAsSskAction(sone).run();
verify(core, never()).updateSone(any(Sone.class));
}