diff --git a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/DummyHandlerSpec.scala b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/DummyHandlerSpec.scala index 4124119294fc00a08b5ddb8cd287deb7ea0c3d93..92c2349adcffbdce5fcc8a7fd8b1eebeae0128cf 100644 --- a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/DummyHandlerSpec.scala +++ b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/DummyHandlerSpec.scala @@ -3,7 +3,11 @@ package net.i2p.router.update import org.scalatest.FunSpec import org.scalatest.mock.MockitoSugar +import java.util.ArrayList + import net.i2p.router.RouterContext +import net.i2p.update.UpdateMethod +import net.i2p.update.UpdateType /** * @author str4d @@ -16,9 +20,21 @@ class DummyHandlerSpec extends FunSpec with CheckerBehaviors with UpdaterBehavio dh } + def validTypes = { + val vt = new ArrayList[UpdateType] + vt.add(UpdateType.ROUTER_UNSIGNED) + vt + } + + def validMethods = { + val vm = new ArrayList[UpdateMethod] + vm.add(UpdateMethod.HTTP) + vm + } + describe("A DummyHandler") { it should behave like checker(dummyHandler) - it should behave like updater(dummyHandler) + it should behave like updater(dummyHandler, validTypes, validMethods) } } diff --git a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/NewsHandlerSpec.scala b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/NewsHandlerSpec.scala index 03867b38c4b60cc192d0314a240f6fd186e626b8..a8144c5fc833fab4dd186ea51a8f7b67e4148261 100644 --- a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/NewsHandlerSpec.scala +++ b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/NewsHandlerSpec.scala @@ -3,7 +3,11 @@ package net.i2p.router.update import org.scalatest.FunSpec import org.scalatest.mock.MockitoSugar +import java.util.ArrayList + import net.i2p.router.RouterContext +import net.i2p.update.UpdateMethod +import net.i2p.update.UpdateType /** * @author str4d @@ -16,7 +20,19 @@ class NewsHandlerSpec extends FunSpec with UpdaterBehaviors with MockitoSugar { nh } + def validTypes = { + val vt = new ArrayList[UpdateType] + vt.add(UpdateType.ROUTER_UNSIGNED) + vt + } + + def validMethods = { + val vm = new ArrayList[UpdateMethod] + vm.add(UpdateMethod.HTTP) + vm + } + describe("A NewsHandler") { - it should behave like updater(newsHandler) + it should behave like updater(newsHandler, validTypes, validMethods) } } diff --git a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/PluginUpdateHandlerSpec.scala b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/PluginUpdateHandlerSpec.scala index 279a0ce5f517a81b09cda043a2976414df137926..6593d0872f41ea1731ce1b97e919f4299f4ff135 100644 --- a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/PluginUpdateHandlerSpec.scala +++ b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/PluginUpdateHandlerSpec.scala @@ -3,7 +3,11 @@ package net.i2p.router.update import org.scalatest.FunSpec import org.scalatest.mock.MockitoSugar +import java.util.ArrayList + import net.i2p.router.RouterContext +import net.i2p.update.UpdateMethod +import net.i2p.update.UpdateType /** * @author str4d @@ -16,9 +20,21 @@ class PluginUpdateHandlerSpec extends FunSpec with CheckerBehaviors with Updater puh } + def validTypes = { + val vt = new ArrayList[UpdateType] + vt.add(UpdateType.ROUTER_UNSIGNED) + vt + } + + def validMethods = { + val vm = new ArrayList[UpdateMethod] + vm.add(UpdateMethod.HTTP) + vm + } + describe("A PluginUpdateHandler") { it should behave like checker(pluginUpdateHandler) - it should behave like updater(pluginUpdateHandler) + it should behave like updater(pluginUpdateHandler, validTypes, validMethods) } } diff --git a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UnsignedUpdateHandlerSpec.scala b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UnsignedUpdateHandlerSpec.scala index 14a766d93bbad1406fcfafeb9db744df8c0fc255..e7d4d703533b9b9435e12da3257328f08e9aed69 100644 --- a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UnsignedUpdateHandlerSpec.scala +++ b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UnsignedUpdateHandlerSpec.scala @@ -3,7 +3,7 @@ package net.i2p.router.update import org.scalatest.FunSpec import org.scalatest.mock.MockitoSugar -import java.util.TreeSet +import java.util.ArrayList import net.i2p.router.RouterContext import net.i2p.update.UpdateMethod @@ -21,13 +21,13 @@ class UnsignedUpdateHandlerSpec extends FunSpec with CheckerBehaviors with Updat } def validTypes = { - val vt = new TreeSet<UpdateType> + val vt = new ArrayList[UpdateType] vt.add(UpdateType.ROUTER_UNSIGNED) vt } def validMethods = { - val vm = new TreeSet<UpdateMethod> + val vm = new ArrayList[UpdateMethod] vm.add(UpdateMethod.HTTP) vm } diff --git a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdateHandlerSpec.scala b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdateHandlerSpec.scala index 2b533813af536fe9b601dac75d658a305e8f14a9..999f5a2689ed96baee0722a4425f751aee95c9cb 100644 --- a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdateHandlerSpec.scala +++ b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdateHandlerSpec.scala @@ -3,7 +3,11 @@ package net.i2p.router.update import org.scalatest.FunSpec import org.scalatest.mock.MockitoSugar +import java.util.ArrayList + import net.i2p.router.RouterContext +import net.i2p.update.UpdateMethod +import net.i2p.update.UpdateType /** * @author str4d @@ -16,7 +20,19 @@ class UpdateHandlerSpec extends FunSpec with UpdaterBehaviors with MockitoSugar uh } + def validTypes = { + val vt = new ArrayList[UpdateType] + vt.add(UpdateType.ROUTER_UNSIGNED) + vt + } + + def validMethods = { + val vm = new ArrayList[UpdateMethod] + vm.add(UpdateMethod.HTTP) + vm + } + describe("An UpdateHandler") { - it should behave like updater(updateHandler) + it should behave like updater(updateHandler, validTypes, validMethods) } } diff --git a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdaterBehaviors.scala b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdaterBehaviors.scala index b68299dcc7f0f2e5d250fa7ca871061d70a0c1f0..3bf44df9bed3e74edd8b9ac618a8cac443cbba7e 100644 --- a/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdaterBehaviors.scala +++ b/apps/routerconsole/java/test/scalatest/net/i2p/router/update/UpdaterBehaviors.scala @@ -2,8 +2,9 @@ package net.i2p.router.update import org.scalatest.FunSpec +import java.net.URI import java.util.Collections -import java.util.Set +import java.util.List import net.i2p.update.UpdateMethod import net.i2p.update.UpdateType @@ -13,13 +14,14 @@ import net.i2p.update.Updater * @author str4d */ trait UpdaterBehaviors { this: FunSpec => - def updater(newUpdater: => Updater, validTypes: => Set<UpdateType>, - validMethods: => Set<UpdateMethod>) { + def updater(newUpdater: => Updater, validTypes: => List[UpdateType], + validMethods: => List[UpdateMethod]) { it("should return null if no updateSources are provided") { - val updateSources = Collections.emptyList - val updateTask = newUpdater.update(validTypes[0], validMethods[0], + val updateSources = Collections.emptyList[URI] + val updateTask = newUpdater.update(validTypes.iterator().next(), + validMethods.iterator().next(), updateSources, "", "", 1000) - updateTask should be (null) + assert(updateTask == null) } } }