diff --git a/core/libs/transdroid-connect.jar b/core/libs/transdroid-connect.jar
index d3f9e9d4..4fb67c71 100644
Binary files a/core/libs/transdroid-connect.jar and b/core/libs/transdroid-connect.jar differ
diff --git a/core/res/values/strings.xml b/core/res/values/strings.xml
index 7703fa51..84e2540e 100644
--- a/core/res/values/strings.xml
+++ b/core/res/values/strings.xml
@@ -219,6 +219,7 @@
Buffalo NAS -1.31Deluge 1.2+DLink Router BT
+ DummyKtorrentqBittorrentrTorrent
@@ -234,6 +235,7 @@
daemon_buffalonasdaemon_delugedaemon_dlinkrouterbt
+ daemon_dummydaemon_ktorrentdaemon_qbittorrentdaemon_rtorrent
diff --git a/lib/src/org/transdroid/daemon/Daemon.java b/lib/src/org/transdroid/daemon/Daemon.java
index edd9301b..847175f2 100644
--- a/lib/src/org/transdroid/daemon/Daemon.java
+++ b/lib/src/org/transdroid/daemon/Daemon.java
@@ -59,6 +59,11 @@ public enum Daemon {
return new DelugeAdapter(settings);
}
},
+ Dummy {
+ public IDaemonAdapter createAdapter(DaemonSettings settings) {
+ return new DummyAdapter(settings);
+ }
+ },
DLinkRouterBT {
public IDaemonAdapter createAdapter(DaemonSettings settings) {
return new DLinkRouterBTAdapter(settings);
@@ -132,6 +137,8 @@ public enum Daemon {
return "daemon_deluge";
case DLinkRouterBT:
return "daemon_dlinkrouterbt";
+ case Dummy:
+ return "daemon_dummy";
case KTorrent:
return "daemon_ktorrent";
case qBittorrent:
@@ -178,6 +185,9 @@ public enum Daemon {
if (daemonCode.equals("daemon_dlinkrouterbt")) {
return DLinkRouterBT;
}
+ if (daemonCode.equals("daemon_dummy")) {
+ return Dummy;
+ }
if (daemonCode.equals("daemon_ktorrent")) {
return KTorrent;
}
@@ -217,6 +227,7 @@ public enum Daemon {
case BuffaloNas:
return 8080;
case DLinkRouterBT:
+ case Dummy:
case rTorrent:
case Tfb4rt:
case BitComet:
@@ -240,19 +251,19 @@ public enum Daemon {
}
public static boolean supportsStats(Daemon type) {
- return type == Transmission || type == Bitflu;
+ return type == Transmission || type == Bitflu || type == Dummy;
}
public static boolean supportsAvailability(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == DLinkRouterBT || type == Transmission || type == Vuze || type == BuffaloNas;
+ return type == uTorrent || type == BitTorrent || type == DLinkRouterBT || type == Transmission || type == Vuze || type == BuffaloNas || type == Dummy;
}
public static boolean supportsFileListing(Daemon type) {
- return type == Synology || type == Transmission || type == uTorrent || type == BitTorrent || type == KTorrent || type == Deluge || type == rTorrent || type == Vuze || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas || type == BitComet;
+ return type == Synology || type == Transmission || type == uTorrent || type == BitTorrent || type == KTorrent || type == Deluge || type == rTorrent || type == Vuze || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas || type == BitComet || type == Dummy;
}
public static boolean supportsFineDetails(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == Daemon.Transmission || type == Deluge || type == rTorrent || type == qBittorrent;
+ return type == uTorrent || type == BitTorrent || type == Daemon.Transmission || type == Deluge || type == rTorrent || type == qBittorrent || type == Dummy;
}
public static boolean needsManualPathSpecified(Daemon type) {
@@ -260,23 +271,23 @@ public enum Daemon {
}
public static boolean supportsFilePaths(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == Vuze || type == Deluge || type == Transmission || type == rTorrent || type == KTorrent || type == BuffaloNas;
+ return type == uTorrent || type == BitTorrent || type == Vuze || type == Deluge || type == Transmission || type == rTorrent || type == KTorrent || type == BuffaloNas || type == Dummy;
}
public static boolean supportsStoppingStarting(Daemon type) {
- return type == uTorrent || type == rTorrent || type == BitTorrent || type == BitComet;
+ return type == uTorrent || type == rTorrent || type == BitTorrent || type == BitComet || type == Dummy;
}
public static boolean supportsForcedStarting(Daemon type) {
- return type == uTorrent || type == BitTorrent;
+ return type == uTorrent || type == BitTorrent || type == Dummy;
}
public static boolean supportsCustomFolder(Daemon type) {
- return type == rTorrent || type == Tfb4rt || type == Bitflu || type == Deluge || type == Transmission;
+ return type == rTorrent || type == Tfb4rt || type == Bitflu || type == Deluge || type == Transmission || type == Dummy;
}
public static boolean supportsSetTransferRates(Daemon type) {
- return type == Deluge || type == Transmission || type == uTorrent || type == BitTorrent || type == Deluge || type == rTorrent || type == Vuze || type == BuffaloNas || type == BitComet;
+ return type == Deluge || type == Transmission || type == uTorrent || type == BitTorrent || type == Deluge || type == rTorrent || type == Vuze || type == BuffaloNas || type == BitComet || type == Dummy;
}
public static boolean supportsAddByFile(Daemon type) {
@@ -285,39 +296,39 @@ public enum Daemon {
}
public static boolean supportsAddByMagnetUrl(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == Transmission || type == Synology || type == Deluge || type == Bitflu || type == KTorrent || type == rTorrent || type == qBittorrent || type == BitComet;
+ return type == uTorrent || type == BitTorrent || type == Transmission || type == Synology || type == Deluge || type == Bitflu || type == KTorrent || type == rTorrent || type == qBittorrent || type == BitComet || type == Dummy;
}
public static boolean supportsRemoveWithData(Daemon type) {
- return type == uTorrent || type == Vuze || type == Transmission || type == Deluge || type == BitTorrent || type == Tfb4rt || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas || type == BitComet || type == rTorrent;
+ return type == uTorrent || type == Vuze || type == Transmission || type == Deluge || type == BitTorrent || type == Tfb4rt || type == DLinkRouterBT || type == Bitflu || type == qBittorrent || type == BuffaloNas || type == BitComet || type == rTorrent || type == Dummy;
}
public static boolean supportsFilePrioritySetting(Daemon type) {
- return type == BitTorrent || type == uTorrent || type == Transmission || type == KTorrent || type == rTorrent || type == Vuze || type == Deluge || type == qBittorrent;
+ return type == BitTorrent || type == uTorrent || type == Transmission || type == KTorrent || type == rTorrent || type == Vuze || type == Deluge || type == qBittorrent || type == Dummy;
}
public static boolean supportsDateAdded(Daemon type) {
- return type == Vuze || type == Transmission || type == rTorrent || type == Bitflu || type == BitComet;
+ return type == Vuze || type == Transmission || type == rTorrent || type == Bitflu || type == BitComet || type == Dummy;
}
public static boolean supportsLabels(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == Deluge || type == BitComet || type == rTorrent; // || type == Vuze
+ return type == uTorrent || type == BitTorrent || type == Deluge || type == BitComet || type == rTorrent || type == Dummy; // || type == Vuze
}
public static boolean supportsSetLabel(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == rTorrent;
+ return type == uTorrent || type == BitTorrent || type == rTorrent || type == Dummy;
}
public static boolean supportsSetDownloadLocation(Daemon type) {
- return type == Transmission || type == Deluge;
+ return type == Transmission || type == Deluge || type == Dummy;
}
public static boolean supportsSetAlternativeMode(Daemon type) {
- return type == Transmission;
+ return type == Transmission || type == Dummy;
}
public static boolean supportsSetTrackers(Daemon type) {
- return type == uTorrent || type == BitTorrent || type == Deluge;
+ return type == uTorrent || type == BitTorrent || type == Deluge || type == Dummy;
}
public static boolean supportsExtraPassword(Daemon type) {
diff --git a/lib/src/org/transdroid/daemon/DummyAdapter.java b/lib/src/org/transdroid/daemon/DummyAdapter.java
new file mode 100644
index 00000000..746f66b8
--- /dev/null
+++ b/lib/src/org/transdroid/daemon/DummyAdapter.java
@@ -0,0 +1,276 @@
+/*
+ * This file is part of Transdroid
+ *
+ * Transdroid is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Transdroid is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Transdroid. If not, see .
+ *
+ */
+package org.transdroid.daemon;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Random;
+
+import org.transdroid.daemon.DaemonException.ExceptionType;
+import org.transdroid.daemon.task.AddByFileTask;
+import org.transdroid.daemon.task.AddByMagnetUrlTask;
+import org.transdroid.daemon.task.AddByUrlTask;
+import org.transdroid.daemon.task.DaemonTask;
+import org.transdroid.daemon.task.DaemonTaskFailureResult;
+import org.transdroid.daemon.task.DaemonTaskResult;
+import org.transdroid.daemon.task.DaemonTaskSuccessResult;
+import org.transdroid.daemon.task.GetFileListTask;
+import org.transdroid.daemon.task.GetFileListTaskSuccessResult;
+import org.transdroid.daemon.task.GetTorrentDetailsTask;
+import org.transdroid.daemon.task.GetTorrentDetailsTaskSuccessResult;
+import org.transdroid.daemon.task.RetrieveTask;
+import org.transdroid.daemon.task.RetrieveTaskSuccessResult;
+import org.transdroid.daemon.task.SetFilePriorityTask;
+import org.transdroid.daemon.task.SetLabelTask;
+import org.transdroid.daemon.util.DLog;
+
+import android.net.Uri;
+
+/**
+ * A dummy adapter that does not communicate with some server, but maintains a local list of dummy data (reset every
+ * time it is recreated) to simplify testing.
+ * @author erickok
+ */
+public class DummyAdapter implements IDaemonAdapter {
+
+ private static final String LOG_NAME = "Dummy daemon";
+
+ private DaemonSettings settings;
+ private List dummyTorrents;
+ private List