forked from I2P_Developers/i2p.i2p
Started filling out UpdaterBehaviors
This commit is contained in:
@ -3,7 +3,11 @@ package net.i2p.router.update
|
||||
import org.scalatest.FunSpec
|
||||
import org.scalatest.mock.MockitoSugar
|
||||
|
||||
import java.util.TreeSet
|
||||
|
||||
import net.i2p.router.RouterContext
|
||||
import net.i2p.update.UpdateMethod
|
||||
import net.i2p.update.UpdateType
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
@ -16,9 +20,21 @@ class UnsignedUpdateHandlerSpec extends FunSpec with CheckerBehaviors with Updat
|
||||
uuh
|
||||
}
|
||||
|
||||
def validTypes = {
|
||||
val vt = new TreeSet<UpdateType>
|
||||
vt.add(UpdateType.ROUTER_UNSIGNED)
|
||||
vt
|
||||
}
|
||||
|
||||
def validMethods = {
|
||||
val vm = new TreeSet<UpdateMethod>
|
||||
vm.add(UpdateMethod.HTTP)
|
||||
vm
|
||||
}
|
||||
|
||||
describe("An UnsignedUpdateHandler") {
|
||||
it should behave like checker(unsignedUpdateHandler)
|
||||
|
||||
it should behave like updater(unsignedUpdateHandler)
|
||||
it should behave like updater(unsignedUpdateHandler, validTypes, validMethods)
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,24 @@ package net.i2p.router.update
|
||||
|
||||
import org.scalatest.FunSpec
|
||||
|
||||
import java.util.Collections
|
||||
import java.util.Set
|
||||
|
||||
import net.i2p.update.UpdateMethod
|
||||
import net.i2p.update.UpdateType
|
||||
import net.i2p.update.Updater
|
||||
|
||||
/**
|
||||
* @author str4d
|
||||
*/
|
||||
trait UpdaterBehaviors { this: FunSpec =>
|
||||
def updater(newUpdater: => Updater) {
|
||||
it("should provide a method to perform updates") (pending)
|
||||
def updater(newUpdater: => Updater, validTypes: => Set<UpdateType>,
|
||||
validMethods: => Set<UpdateMethod>) {
|
||||
it("should return null if no updateSources are provided") {
|
||||
val updateSources = Collections.emptyList
|
||||
val updateTask = newUpdater.update(validTypes[0], validMethods[0],
|
||||
updateSources, "", "", 1000)
|
||||
updateTask should be (null)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user