Fix build and tests

This commit is contained in:
Nathan Mascitelli 2020-02-07 10:55:14 -05:00
parent 1eaecf8358
commit bbc994fc9b
3 changed files with 6 additions and 7 deletions

View File

@ -120,8 +120,7 @@ public class DownloadServiceTest {
assertFalse("The media in test should not yet been downloaded", assertFalse("The media in test should not yet been downloaded",
DBReader.getFeedMedia(testMedia11.getId()).isDownloaded()); DBReader.getFeedMedia(testMedia11.getId()).isDownloaded());
DownloadRequester.getInstance().downloadMedia(false, InstrumentationRegistry.getTargetContext(), DownloadRequester.getInstance().downloadMedia(false, InstrumentationRegistry.getTargetContext(), false, testMedia11.getItem());
testMedia11.getItem());
Awaitility.await() Awaitility.await()
.atMost(5000, TimeUnit.MILLISECONDS) .atMost(5000, TimeUnit.MILLISECONDS)
.until(() -> feedItemEventListener.getEvents().size() >= numEventsExpected); .until(() -> feedItemEventListener.getEvents().size() >= numEventsExpected);
@ -166,7 +165,7 @@ public class DownloadServiceTest {
} }
withFeedItemEventListener(feedItemEventListener -> { withFeedItemEventListener(feedItemEventListener -> {
DownloadRequester.getInstance().downloadMedia(false, context, testMedia11.getItem()); DownloadRequester.getInstance().downloadMedia(false, context, false, testMedia11.getItem());
withDownloadEventListener(downloadEventListener -> withDownloadEventListener(downloadEventListener ->
Awaitility.await("download is actually running") Awaitility.await("download is actually running")
.atMost(5000, TimeUnit.MILLISECONDS) .atMost(5000, TimeUnit.MILLISECONDS)

View File

@ -77,7 +77,7 @@ public class HttpDownloaderTest {
private Downloader download(String url, String title, boolean expectedResult, boolean deleteExisting, String username, String password, boolean deleteOnFail) { private Downloader download(String url, String title, boolean expectedResult, boolean deleteExisting, String username, String password, boolean deleteOnFail) {
FeedFile feedFile = setupFeedFile(url, title, deleteExisting); FeedFile feedFile = setupFeedFile(url, title, deleteExisting);
DownloadRequest request = new DownloadRequest(feedFile.getFile_url(), url, title, 0, feedFile.getTypeAsInt(), username, password, deleteOnFail, null); DownloadRequest request = new DownloadRequest(feedFile.getFile_url(), url, title, 0, feedFile.getTypeAsInt(), username, password, deleteOnFail, null, false);
Downloader downloader = new HttpDownloader(request); Downloader downloader = new HttpDownloader(request);
downloader.call(); downloader.call();
DownloadStatus status = downloader.getResult(); DownloadStatus status = downloader.getResult();
@ -113,7 +113,7 @@ public class HttpDownloaderTest {
public void testCancel() { public void testCancel() {
final String url = httpServer.getBaseUrl() + "/delay/3"; final String url = httpServer.getBaseUrl() + "/delay/3";
FeedFileImpl feedFile = setupFeedFile(url, "delay", true); FeedFileImpl feedFile = setupFeedFile(url, "delay", true);
final Downloader downloader = new HttpDownloader(new DownloadRequest(feedFile.getFile_url(), url, "delay", 0, feedFile.getTypeAsInt())); final Downloader downloader = new HttpDownloader(new DownloadRequest(feedFile.getFile_url(), url, "delay", 0, feedFile.getTypeAsInt(), false));
Thread t = new Thread() { Thread t = new Thread() {
@Override @Override
public void run() { public void run() {

View File

@ -45,13 +45,13 @@ public class DownloadRequestTest {
FeedFile item1 = createFeedItem(1); FeedFile item1 = createFeedItem(1);
Bundle arg1 = new Bundle(); Bundle arg1 = new Bundle();
arg1.putString("arg1", "value1"); arg1.putString("arg1", "value1");
DownloadRequest request1 = new DownloadRequest.Builder(destStr, item1) DownloadRequest request1 = new DownloadRequest.Builder(destStr, item1, false)
.withAuthentication(username1, password1) .withAuthentication(username1, password1)
.withArguments(arg1) .withArguments(arg1)
.build(); .build();
FeedFile item2 = createFeedItem(2); FeedFile item2 = createFeedItem(2);
DownloadRequest request2 = new DownloadRequest.Builder(destStr, item2) DownloadRequest request2 = new DownloadRequest.Builder(destStr, item2, true)
.withAuthentication(username2, password2) .withAuthentication(username2, password2)
.build(); .build();