wip on HostPool and tests

This commit is contained in:
Zlatin Balevsky
2018-07-10 05:52:57 +01:00
parent e549e96657
commit 9960ea9d28
3 changed files with 38 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
package com.muwire.hostcache
class Host {
def destination
def verifyTime
}

View File

@@ -0,0 +1,20 @@
package com.muwire.hostcache
class HostPool {
def verified = new HashSet()
synchronized def getVerified(int max) {
def asList = verified.asList()
Collections.shuffle(asList)
return asList[0..max].collect { it -> it.destination }
}
synchronized def addUnverified(host) {
}
synchronized def verify(host) {
}
}

View File

@@ -0,0 +1,11 @@
package com.muwire.hostcache
import org.junit.Test
class HostPoolTest {
@Test
def testGetVerified() {
}
}