import com.google.inject.name.Names.*
import com.google.inject.spi.*
import freenet.l10n.*
+import net.pterodactylus.sone.core.*
import net.pterodactylus.sone.database.*
import net.pterodactylus.sone.database.memory.*
import net.pterodactylus.sone.freenet.wot.*
})
}
+ @Provides
+ fun getCore(configuration: Configuration, freenetInterface: FreenetInterface, identityManager: IdentityManager, soneDownloader: SoneDownloader, imageInserter: ImageInserter, updateChecker: UpdateChecker, webOfTrustUpdater: WebOfTrustUpdater, eventBus: EventBus, database: Database) =
+ Core(configuration, freenetInterface, identityManager, soneDownloader, imageInserter, updateChecker, webOfTrustUpdater, eventBus, database).apply {
+ debugInformation.showVersionInformation = configuration.getBooleanValue("Debug/ShowVersionInformation").getValue(false)
+ }
+
}
private fun String.parseVersion(): Version = Version.parse(this)
import com.google.inject.Guice.*
import com.google.inject.name.Names.*
import freenet.l10n.*
+import freenet.node.*
+import freenet.pluginmanager.*
+import net.pterodactylus.sone.core.*
import net.pterodactylus.sone.database.*
import net.pterodactylus.sone.database.memory.*
import net.pterodactylus.sone.freenet.wot.*
whenever(l10n()).thenReturn(l10n)
}
- private val injector by lazy { createInjector(SoneModule(sonePlugin)) }
+ private val injector by lazy { createInjector(
+ SoneModule(sonePlugin),
+ FreenetInterface::class.isProvidedByDeepMock(),
+ PluginRespirator::class.isProvidedByDeepMock()
+ ) }
@AfterTest
fun removePropertiesFromCurrentDirectory() {
}
@Test
+ fun `debug information flag is read from config`() {
+ File(currentDir, "sone.properties").writeText("Debug/ShowVersionInformation=true")
+ assertThat(injector.getInstance<Core>().debugInformation.showVersionInformation, equalTo(true))
+ }
+
+ @Test
fun `event bus is bound`() {
assertThat(injector.getInstance<EventBus>(), notNullValue())
}