import freenet.crypt.*
import freenet.keys.InsertableClientSSK.*
import net.pterodactylus.sone.data.*
+import net.pterodactylus.sone.data.impl.AlbumImpl
import net.pterodactylus.sone.database.memory.*
import net.pterodactylus.sone.freenet.wot.*
import net.pterodactylus.sone.test.*
whenever(sone.identity).thenReturn(identity)
whenever(sone.requestUri).thenAnswer { clientSSK.uri.setKeyType("USK").setDocName("Sone") }
whenever(sone.time).thenReturn(currentTimeMillis() - DAYS.toMillis(1))
+ whenever(sone.rootAlbum).thenReturn(AlbumImpl(sone))
}
@Test
fun `unsuccessful parsing does not add a histogram entry`() {
val inputStream = javaClass.getResourceAsStream("sone-parser-with-invalid-image-height.xml")
assertThat(soneParser.parseSone(sone, inputStream), nullValue())
- val histogram = metricRegistry.histogram("sone.parsing.duration")
+ val histogram = metricRegistry.histogram("sone.parse.duration")
assertThat(histogram.count, equalTo(0L))
}
fun `successful parsing adds histogram entry`() {
val inputStream = javaClass.getResourceAsStream("sone-parser-without-images.xml")
assertThat(soneParser.parseSone(sone, inputStream), notNullValue())
- val histogram = metricRegistry.histogram("sone.parsing.duration")
+ val histogram = metricRegistry.histogram("sone.parse.duration")
assertThat(histogram.count, equalTo(1L))
}