Skip to content

Commit

Permalink
Use separate Spring profile in integration tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarkkoka committed Oct 18, 2023
1 parent afe58eb commit d4d7525
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
14 changes: 14 additions & 0 deletions src/test/kotlin/fi/hsl/jore4/timetables/IntTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package fi.hsl.jore4.timetables

import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.ActiveProfiles

/**
* A custom annotation which configures integration tests which use the test database settings.
*/
@Target(AnnotationTarget.CLASS)
@Retention(AnnotationRetention.RUNTIME)
@MustBeDocumented
@SpringBootTest
@ActiveProfiles("test")
annotation class IntTest
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package fi.hsl.jore4.timetables.service

import fi.hsl.jore.jore4.jooq.vehicle_schedule.tables.pojos.VehicleScheduleFrame
import fi.hsl.jore4.timetables.IntTest
import fi.hsl.jore4.timetables.TimetablesDataset
import fi.hsl.jore4.timetables.enumerated.TimetablesPriority
import fi.hsl.jore4.timetables.extensions.deepClone
Expand All @@ -12,15 +13,14 @@ import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import java.util.UUID
import kotlin.test.assertContains
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull
import kotlin.test.assertNull

@SpringBootTest
@IntTest
class CombineTimetablesServiceTest @Autowired constructor(
val combineTimetablesService: CombineTimetablesService,
var timetablesDataInserterRunner: TimetablesDataInserterRunner,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
package fi.hsl.jore4.timetables.service

import fi.hsl.jore.jore4.jooq.vehicle_schedule.tables.pojos.VehicleScheduleFrame
import fi.hsl.jore4.timetables.IntTest
import fi.hsl.jore4.timetables.TimetablesDataset
import fi.hsl.jore4.timetables.enumerated.TimetablesPriority
import fi.hsl.jore4.timetables.extensions.deepClone
import fi.hsl.jore4.timetables.extensions.getNested
import fi.hsl.jore4.timetables.repository.VehicleScheduleFrameRepository
import mu.KotlinLogging
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import java.time.LocalDate
import java.util.UUID
import kotlin.test.assertContains
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
import kotlin.test.assertNotNull

private val LOGGER = KotlinLogging.logger {}

@SpringBootTest
@IntTest
class ReplaceTimetablesServiceTest @Autowired constructor(
val replaceTimetablesService: ReplaceTimetablesService,
var timetablesDataInserterRunner: TimetablesDataInserterRunner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@ [email protected]@
jore4.db.password[email protected]@
jore4.db.minConnections[email protected]@
jore4.db.maxConnections[email protected]@

jooq.sql.dialect[email protected]@

0 comments on commit d4d7525

Please sign in to comment.