import com.google.inject.Module;
import com.google.inject.name.*;
import kotlin.jvm.functions.*;
+import org.flywaydb.core.Flyway;
/**
* This class interfaces with Freenet. It is the class that is loaded by the
this.pluginRespirator = pluginRespirator;
Injector injector = createInjector();
+
+ Flyway flyway = injector.getInstance(Flyway.class);
+ flyway.migrate();
+
core = injector.getInstance(Core.class);
/* create web of trust connector. */
import java.io.*
import java.util.concurrent.atomic.*
import kotlin.test.*
+import org.flywaydb.core.Flyway
+import org.junit.Rule
+import org.junit.rules.TemporaryFolder
/**
* Unit test for [SonePlugin].
private val clientCore = deepMock<NodeClientCore>()
private val uskManager = deepMock<USKManager>()
+ @Rule
+ @JvmField
+ val tempFolder = TemporaryFolder()
+
init {
whenever(node.getClientCore()).thenReturn(clientCore)
whenever(pluginRespirator.node).thenReturn(node)
whenever(clientCore.getClientContext()).thenReturnMock()
}
+ @BeforeTest
+ fun setNodeUserDir() {
+ whenever(node.userDir).thenReturn(tempFolder.root)
+ }
+
@Test
fun `sone plugin can be started`() {
sonePlugin.setLanguage(ENGLISH)
assertThat(getInjected(TickerShutdown::class.java), notNullValue())
}
+ @Test
+ fun `flyway is told to migrate`() {
+ sonePlugin.runPlugin(pluginRespirator)
+ assertThat(getInjected(Flyway::class.java), notNullValue())
+ verify(getInjected(Flyway::class.java))!!.migrate()
+ }
+
private class FirstStartListener(private val firstStartReceived: AtomicBoolean) {
@Subscribe
fun firstStart(@Suppress("UNUSED_PARAMETER") firstStart: FirstStart) {