use of com.acgist.snail.downloader.magnet.MagnetDownloader in project snail by acgist.
the class TaskContextTest method testRestart.
@Test
void testRestart() throws DownloadException {
SnailBuilder.newBuilder().enableAllProtocol().buildSync();
final var taskContext = TaskContext.getInstance();
ITaskSession taskSession = taskContext.download("1234567890123456789012345678901234567890");
assertNotNull(taskSession);
assertTrue(taskContext.allTask().size() > 0);
this.log(taskSession.getClass());
taskSession.setType(Type.TORRENT);
taskSession.setStatus(Status.AWAIT);
assertTrue(taskSession.buildDownloader() instanceof MagnetDownloader);
taskSession.setTorrent("E://snail/902FFAA29EE632C8DC966ED9AB573409BA9A518E.torrent");
taskSession.restart();
assertNotNull(taskSession);
assertTrue(taskContext.allTask().size() > 0);
assertTrue(taskSession.buildDownloader() instanceof TorrentDownloader);
this.log(taskSession.getClass());
FileUtils.delete(taskSession.getFile());
taskSession.delete();
}
Aggregations