forked from I2P_Developers/i2p.i2p
Stubbed out Specs for net.i2p.router.update.* in routerconsole
*Behaviors.scala should really go in net.i2p.update.* in core, but ScalaTest doesn't seem to be picking up the cross-dependency properly and just ignores any Spec which includes them; they will move once the build.xml is fixed.
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
|
||||
import net.i2p.update.Checker
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
trait CheckerBehaviors { this: FunSpec =>
|
||||
def checker(newChecker: => Checker) {
|
||||
it("should provide a method to check for updates") (pending)
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class ConsoleUpdateManagerSpec extends FunSpec with UpdateManagerBehaviors with MockitoSugar {
|
||||
def consoleUpdateManager = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val cum = new ConsoleUpdateManager(mockCtx)
|
||||
cum
|
||||
}
|
||||
|
||||
describe("A ConsoleUpdateManager") {
|
||||
it should behave like updateManager(consoleUpdateManager)
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class DummyHandlerSpec extends FunSpec with CheckerBehaviors with UpdaterBehaviors with MockitoSugar {
|
||||
def dummyHandler = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val dh = new DummyHandler(mockCtx, mockMgr)
|
||||
dh
|
||||
}
|
||||
|
||||
describe("A DummyHandler") {
|
||||
it should behave like checker(dummyHandler)
|
||||
|
||||
it should behave like updater(dummyHandler)
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import java.net.URI
|
||||
import java.util.Collections
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class NewsFetcherSpec extends FunSpec with UpdateRunnerBehaviors with MockitoSugar {
|
||||
def newsFetcher = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val mockUri = mock[URI]
|
||||
val uris = Collections.singletonList(mockUri)
|
||||
val nf = new NewsFetcher(mockCtx, mockMgr, uris)
|
||||
nf
|
||||
}
|
||||
|
||||
describe("A NewsFetcher") {
|
||||
it should behave like updateRunner(newsFetcher)
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class NewsHandlerSpec extends FunSpec with UpdaterBehaviors with MockitoSugar {
|
||||
def newsHandler = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val nh = new NewsHandler(mockCtx, mockMgr)
|
||||
nh
|
||||
}
|
||||
|
||||
describe("A NewsHandler") {
|
||||
it should behave like updater(newsHandler)
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class NewsTimerTaskSpec extends FunSpec with MockitoSugar {
|
||||
describe("A NewsTimerTask") {
|
||||
it("should keep track of time") (pending)
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import java.net.URI
|
||||
import java.util.Collections
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class PluginUpdateCheckerSpec extends FunSpec with UpdateRunnerBehaviors with MockitoSugar {
|
||||
def pluginUpdateChecker = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val mockUri = mock[URI]
|
||||
val uris = Collections.singletonList(mockUri)
|
||||
val puc = new PluginUpdateChecker(mockCtx, mockMgr, uris, "appName", "appVersion")
|
||||
puc
|
||||
}
|
||||
|
||||
describe("A PluginUpdateChecker") {
|
||||
it should behave like updateRunner(pluginUpdateChecker)
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class PluginUpdateHandlerSpec extends FunSpec with CheckerBehaviors with UpdaterBehaviors with MockitoSugar {
|
||||
def pluginUpdateHandler = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val puh = new PluginUpdateHandler(mockCtx, mockMgr)
|
||||
puh
|
||||
}
|
||||
|
||||
describe("A PluginUpdateHandler") {
|
||||
it should behave like checker(pluginUpdateHandler)
|
||||
|
||||
it should behave like updater(pluginUpdateHandler)
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import java.net.URI
|
||||
import java.util.Collections
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class PluginUpdateRunnerSpec extends FunSpec with UpdateRunnerBehaviors with MockitoSugar {
|
||||
def pluginUpdateRunner = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val mockUri = mock[URI]
|
||||
val uris = Collections.singletonList(mockUri)
|
||||
val pur = new PluginUpdateRunner(mockCtx, mockMgr, uris, "appName", "appVersion")
|
||||
pur
|
||||
}
|
||||
|
||||
describe("A PluginUpdateRunner") {
|
||||
it should behave like updateRunner(pluginUpdateRunner)
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import java.net.URI
|
||||
import java.util.Collections
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class UnsignedUpdateCheckerSpec extends FunSpec with UpdateRunnerBehaviors with MockitoSugar {
|
||||
def unsignedUpdateChecker = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val mockUri = mock[URI]
|
||||
val uris = Collections.singletonList(mockUri)
|
||||
val uuc = new UnsignedUpdateChecker(mockCtx, mockMgr, uris, 0)
|
||||
uuc
|
||||
}
|
||||
|
||||
describe("An UnsignedUpdateChecker") {
|
||||
it should behave like updateRunner(unsignedUpdateChecker)
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class UnsignedUpdateHandlerSpec extends FunSpec with CheckerBehaviors with UpdaterBehaviors with MockitoSugar {
|
||||
def unsignedUpdateHandler = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val uuh = new UnsignedUpdateHandler(mockCtx, mockMgr)
|
||||
uuh
|
||||
}
|
||||
|
||||
describe("An UnsignedUpdateHandler") {
|
||||
it should behave like checker(unsignedUpdateHandler)
|
||||
|
||||
it should behave like updater(unsignedUpdateHandler)
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import java.net.URI
|
||||
import java.util.Collections
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class UnsignedUpdateRunnerSpec extends FunSpec with UpdateRunnerBehaviors with MockitoSugar {
|
||||
def unsignedUpdateRunner = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val mockUri = mock[URI]
|
||||
val uris = Collections.singletonList(mockUri)
|
||||
val uur = new UnsignedUpdateRunner(mockCtx, mockMgr, uris)
|
||||
uur
|
||||
}
|
||||
|
||||
describe("An UnsignedUpdateRunner") {
|
||||
it should behave like updateRunner(unsignedUpdateRunner)
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
class UpdateHandlerSpec extends FunSpec with UpdaterBehaviors with MockitoSugar {
|
||||
def updateHandler = {
|
||||
val mockCtx = mock[RouterContext]
|
||||
val mockMgr = mock[ConsoleUpdateManager]
|
||||
val uh = new UpdateHandler(mockCtx, mockMgr)
|
||||
uh
|
||||
}
|
||||
|
||||
describe("An UpdateHandler") {
|
||||
it should behave like updater(updateHandler)
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
|
||||
import net.i2p.update.UpdateManager
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
trait UpdateManagerBehaviors { this: FunSpec =>
|
||||
def updateManager(newUpdateManager: => UpdateManager) {
|
||||
it("should provide a method to register updaters") (pending)
|
||||
|
||||
it("should provide a method to unregister updaters") (pending)
|
||||
|
||||
it("should provide a method to register checkers") (pending)
|
||||
|
||||
it("should provide a method to unregister checkers") (pending)
|
||||
|
||||
it("should provide a start method") (pending)
|
||||
|
||||
it("should provide a shutdown method") (pending)
|
||||
|
||||
it("should notify when a new version is available") (pending)
|
||||
|
||||
it("should notify when a check is complete") (pending)
|
||||
|
||||
it("should provide a method to notify progress") (pending)
|
||||
|
||||
it("should provide a method to notify progress with completion status") (pending)
|
||||
|
||||
it("should notify when a single update attempt fails") (pending)
|
||||
|
||||
it("should notify when an entire task finishes and has failed") (pending)
|
||||
|
||||
it("should notify when an update has been downloaded, and verify it") (pending)
|
||||
|
||||
it("should notify when") (pending)
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
trait UpdateRunnerBehaviors { this: FunSpec =>
|
||||
def updateRunner(newUpdateRunner: => UpdateRunner) {
|
||||
it("should provide a method to run updates") (pending)
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
|
||||
import net.i2p.update.Updater
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
trait UpdaterBehaviors { this: FunSpec =>
|
||||
def updater(newUpdater: => Updater) {
|
||||
it("should provide a method to perform updates") (pending)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user