Skip to content

Commit

Permalink
feat: Add project dashboard page #915 - fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanCizmar committed Apr 22, 2022
1 parent 4921168 commit 64eeef2
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
@@ -1,4 +1,4 @@
package io.tolgee
package io.tolgee.commandLineRunners

import io.tolgee.configuration.tolgee.TolgeeProperties
import io.tolgee.dtos.request.auth.SignUpDto
Expand All @@ -11,7 +11,7 @@ import org.springframework.context.event.ContextClosedEvent
import org.springframework.stereotype.Component

@Component
class InitialUserCreatorRunner(
class InitialUserCreatorCommandLineRunner(
private val properties: TolgeeProperties,
private val userAccountService: UserAccountService,
private val initialPasswordManager: InitialPasswordManager
Expand Down
@@ -1,4 +1,4 @@
package io.tolgee
package io.tolgee.commandLineRunners

import io.tolgee.jobs.migration.translationStats.TranslationsStatsUpdateJobRunner
import org.springframework.boot.CommandLineRunner
Expand Down
@@ -1,4 +1,4 @@
package io.tolgee
package io.tolgee.commandLineRunners

import com.corundumstudio.socketio.SocketIOServer
import io.tolgee.configuration.tolgee.TolgeeProperties
Expand Down
@@ -0,0 +1,23 @@
package io.tolgee.commandLineRunners

import io.tolgee.configuration.tolgee.TolgeeProperties
import io.tolgee.service.StartupImportService
import org.springframework.boot.CommandLineRunner
import org.springframework.context.ApplicationListener
import org.springframework.context.event.ContextClosedEvent
import org.springframework.stereotype.Component

@Component
class StartupImportCommandLineRunner(
val tolgeeProperties: TolgeeProperties,
val startupImportService: StartupImportService
) :
CommandLineRunner, ApplicationListener<ContextClosedEvent> {
override fun run(vararg args: String) {
startupImportService.importFiles()
}

override fun onApplicationEvent(event: ContextClosedEvent) {
// we don't need to do anything on context close
}
}
Expand Up @@ -4,6 +4,7 @@

package io.tolgee

import io.tolgee.commandLineRunners.StartupImportCommandLineRunner
import io.tolgee.configuration.tolgee.ImportProperties
import io.tolgee.configuration.tolgee.TolgeeProperties
import io.tolgee.testing.assertions.Assertions.assertThat
Expand All @@ -28,7 +29,7 @@ class StartupImportCommandLineRunnerTest : AbstractSpringTest() {
override lateinit var tolgeeProperties: TolgeeProperties

@Autowired
lateinit var startupImportCommandLineRunner: MigrationJobsCommandLineRunner
lateinit var startupImportCommandLineRunner: StartupImportCommandLineRunner

@BeforeAll
fun setup() {
Expand Down
Expand Up @@ -6,7 +6,7 @@ package io.tolgee.initial_user_creation

import io.tolgee.Application
import io.tolgee.CleanDbBeforeClass
import io.tolgee.InitialUserCreatorRunner
import io.tolgee.commandLineRunners.InitialUserCreatorCommandLineRunner
import io.tolgee.configuration.tolgee.TolgeeProperties
import io.tolgee.service.UserAccountService
import io.tolgee.testing.AbstractTransactionalTest
Expand Down Expand Up @@ -44,11 +44,11 @@ class CreateEnabledTest : AbstractTransactionalTest() {
private val passwordFile = File("./build/create-enabled-test-data/initial.pwd")

@Autowired
lateinit var initialUserCreatorRunner: InitialUserCreatorRunner
lateinit var initialUserCreatorCommandLineRunner: InitialUserCreatorCommandLineRunner

@BeforeAll
fun callTheRunner() {
initialUserCreatorRunner.run()
initialUserCreatorCommandLineRunner.run()
}

@Test
Expand Down

0 comments on commit 64eeef2

Please sign in to comment.