I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 6a91918e authored by str4d's avatar str4d
Browse files

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.
parent a99bf60c
No related branches found
No related tags found
No related merge requests found
Showing
with 365 additions and 0 deletions
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
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)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment