Skip to content

Commit 0d47207

Browse files
committed
Fix spotless formatting
- upgrade plugins com.diffplug.spotless and io.gitlab.arturbosch.detekt - apply spotless to format correctly project files - reapply ktfmt in spotless gradle tasks
1 parent cc8342d commit 0d47207

File tree

15 files changed

+1571
-1641
lines changed

15 files changed

+1571
-1641
lines changed

api/src/integrationTest/kotlin/com/cosmotech/api/home/ControllerTestBase.kt

Lines changed: 59 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import org.junit.jupiter.api.extension.ExtendWith
1919
import org.slf4j.LoggerFactory
2020
import org.springframework.beans.factory.annotation.Autowired
2121
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs
22-
import org.testcontainers.containers.PostgreSQLContainer.POSTGRESQL_PORT
2322
import org.springframework.http.HttpHeaders
2423
import org.springframework.restdocs.RestDocumentationContextProvider
2524
import org.springframework.restdocs.RestDocumentationExtension
@@ -33,8 +32,9 @@ import org.springframework.test.web.servlet.MockMvc
3332
import org.springframework.test.web.servlet.setup.DefaultMockMvcBuilder
3433
import org.springframework.test.web.servlet.setup.MockMvcBuilders
3534
import org.springframework.web.context.WebApplicationContext
36-
import org.testcontainers.junit.jupiter.Testcontainers
3735
import org.testcontainers.containers.PostgreSQLContainer
36+
import org.testcontainers.containers.PostgreSQLContainer.POSTGRESQL_PORT
37+
import org.testcontainers.junit.jupiter.Testcontainers
3838
import org.testcontainers.utility.MountableFile
3939

4040
@Testcontainers
@@ -101,77 +101,76 @@ abstract class ControllerTestBase : AbstractTestcontainersRedisTestBase() {
101101
private const val DEFAULT_REDIS_PORT = 6379
102102
private const val REDIS_STACK_LASTEST_TAG_WITH_GRAPH = "6.2.6-v18"
103103

104+
var postgres: PostgreSQLContainer<*> =
105+
PostgreSQLContainer("postgres:alpine3.19")
106+
.withCopyFileToContainer(
107+
MountableFile.forClasspathResource("init-db.sql"), "/docker-entrypoint-initdb.d/")
104108

105-
var postgres: PostgreSQLContainer<*> =
106-
PostgreSQLContainer("postgres:alpine3.19")
107-
.withCopyFileToContainer(
108-
MountableFile.forClasspathResource("init-db.sql"), "/docker-entrypoint-initdb.d/")
109-
110-
var redisStackServer =
109+
var redisStackServer =
111110
RedisStackContainer(
112111
RedisStackContainer.DEFAULT_IMAGE_NAME.withTag(REDIS_STACK_LASTEST_TAG_WITH_GRAPH))
113112

114-
init {
115-
redisStackServer.start()
116-
postgres.start()
117-
}
113+
init {
114+
redisStackServer.start()
115+
postgres.start()
116+
}
118117

119118
@JvmStatic
120119
@DynamicPropertySource
121120
fun connectionProperties(registry: DynamicPropertyRegistry) {
122121
initPostgresConfiguration(registry)
123-
initRedisConfiguration(registry)
124-
}
125-
126-
private fun initRedisConfiguration(registry: DynamicPropertyRegistry) {
127-
val containerIp =
128-
redisStackServer.containerInfo.networkSettings.networks.entries
129-
.elementAt(0)
130-
.value
131-
.ipAddress
132-
133-
registry.add("spring.data.redis.host") { containerIp }
134-
registry.add("spring.data.redis.port") { DEFAULT_REDIS_PORT }
135-
}
136-
137-
private fun initPostgresConfiguration(registry: DynamicPropertyRegistry) {
138-
registry.add("csm.platform.internalResultServices.storage.host") { postgres.host }
139-
registry.add("csm.platform.internalResultServices.storage.port") {
140-
postgres.getMappedPort(POSTGRESQL_PORT)
141-
}
142-
registry.add("csm.platform.internalResultServices.storage.admin.username") {
143-
ADMIN_USER_CREDENTIALS
144-
}
145-
registry.add("csm.platform.internalResultServices.storage.admin.password") {
146-
ADMIN_USER_CREDENTIALS
147-
}
148-
registry.add("csm.platform.internalResultServices.storage.writer.username") {
149-
WRITER_USER_CREDENTIALS
150-
}
151-
registry.add("csm.platform.internalResultServices.storage.writer.password") {
152-
WRITER_USER_CREDENTIALS
153-
}
154-
registry.add("csm.platform.internalResultServices.storage.reader.username") {
155-
READER_USER_CREDENTIALS
156-
}
157-
registry.add("csm.platform.internalResultServices.storage.reader.password") {
158-
READER_USER_CREDENTIALS
159-
}
160-
}
122+
initRedisConfiguration(registry)
161123
}
162124

163-
@BeforeAll
164-
fun beforeAll() {
165-
redisStackServer.start()
166-
postgres.start()
167-
}
125+
private fun initRedisConfiguration(registry: DynamicPropertyRegistry) {
126+
val containerIp =
127+
redisStackServer.containerInfo.networkSettings.networks.entries
128+
.elementAt(0)
129+
.value
130+
.ipAddress
168131

169-
@AfterAll
170-
fun afterAll() {
171-
postgres.stop()
132+
registry.add("spring.data.redis.host") { containerIp }
133+
registry.add("spring.data.redis.port") { DEFAULT_REDIS_PORT }
172134
}
173135

174-
override fun redisServers(): MutableCollection<RedisServer> {
175-
return mutableListOf(redisStackServer)
136+
private fun initPostgresConfiguration(registry: DynamicPropertyRegistry) {
137+
registry.add("csm.platform.internalResultServices.storage.host") { postgres.host }
138+
registry.add("csm.platform.internalResultServices.storage.port") {
139+
postgres.getMappedPort(POSTGRESQL_PORT)
140+
}
141+
registry.add("csm.platform.internalResultServices.storage.admin.username") {
142+
ADMIN_USER_CREDENTIALS
143+
}
144+
registry.add("csm.platform.internalResultServices.storage.admin.password") {
145+
ADMIN_USER_CREDENTIALS
146+
}
147+
registry.add("csm.platform.internalResultServices.storage.writer.username") {
148+
WRITER_USER_CREDENTIALS
149+
}
150+
registry.add("csm.platform.internalResultServices.storage.writer.password") {
151+
WRITER_USER_CREDENTIALS
152+
}
153+
registry.add("csm.platform.internalResultServices.storage.reader.username") {
154+
READER_USER_CREDENTIALS
155+
}
156+
registry.add("csm.platform.internalResultServices.storage.reader.password") {
157+
READER_USER_CREDENTIALS
158+
}
176159
}
160+
}
161+
162+
@BeforeAll
163+
fun beforeAll() {
164+
redisStackServer.start()
165+
postgres.start()
166+
}
167+
168+
@AfterAll
169+
fun afterAll() {
170+
postgres.stop()
171+
}
172+
173+
override fun redisServers(): MutableCollection<RedisServer> {
174+
return mutableListOf(redisStackServer)
175+
}
177176
}

0 commit comments

Comments
 (0)