mirror of https://github.com/usbharu/Hideout.git
refactor: Repository実装のクラス名を統一
This commit is contained in:
parent
e43e1575cf
commit
900ed51d09
|
@ -31,7 +31,7 @@ import org.springframework.stereotype.Repository
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
class CustomEmojiRepositoryImpl : CustomEmojiRepository,
|
class ExposedCustomEmojiRepository : CustomEmojiRepository,
|
||||||
AbstractRepository() {
|
AbstractRepository() {
|
||||||
override val logger: Logger
|
override val logger: Logger
|
||||||
get() = Companion.logger
|
get() = Companion.logger
|
||||||
|
@ -76,7 +76,7 @@ class CustomEmojiRepositoryImpl : CustomEmojiRepository,
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(CustomEmojiRepositoryImpl::class.java)
|
private val logger = LoggerFactory.getLogger(ExposedCustomEmojiRepository::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ import java.net.URI
|
||||||
import dev.usbharu.hideout.core.domain.model.instance.Instance as InstanceEntity
|
import dev.usbharu.hideout.core.domain.model.instance.Instance as InstanceEntity
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
class InstanceRepositoryImpl : InstanceRepository,
|
class ExposedInstanceRepository : InstanceRepository,
|
||||||
AbstractRepository() {
|
AbstractRepository() {
|
||||||
override val logger: Logger
|
override val logger: Logger
|
||||||
get() = Companion.logger
|
get() = Companion.logger
|
||||||
|
@ -66,7 +66,7 @@ class InstanceRepositoryImpl : InstanceRepository,
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(InstanceRepositoryImpl::class.java)
|
private val logger = LoggerFactory.getLogger(ExposedInstanceRepository::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory
|
||||||
import org.springframework.stereotype.Repository
|
import org.springframework.stereotype.Repository
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
class UserDetailRepositoryImpl(override val domainEventPublisher: DomainEventPublisher) :
|
class ExposedUserDetailRepository(override val domainEventPublisher: DomainEventPublisher) :
|
||||||
UserDetailRepository,
|
UserDetailRepository,
|
||||||
AbstractRepository(),
|
AbstractRepository(),
|
||||||
DomainEventPublishableRepository<UserDetail> {
|
DomainEventPublishableRepository<UserDetail> {
|
||||||
|
@ -105,7 +105,7 @@ class UserDetailRepositoryImpl(override val domainEventPublisher: DomainEventPub
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val logger = LoggerFactory.getLogger(UserDetailRepositoryImpl::class.java)
|
private val logger = LoggerFactory.getLogger(ExposedUserDetailRepository::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ import kotlin.test.assertNull
|
||||||
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Instance as InstanceTable
|
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Instance as InstanceTable
|
||||||
|
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
||||||
class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun save_idが同じレコードがない場合はinsertされる() = runTest {
|
fun save_idが同じレコードがない場合はinsertされる() = runTest {
|
||||||
InstanceRepositoryImpl().save(
|
ExposedInstanceRepository().save(
|
||||||
Instance(
|
Instance(
|
||||||
id = InstanceId(1),
|
id = InstanceId(1),
|
||||||
name = InstanceName("test"),
|
name = InstanceName("test"),
|
||||||
|
@ -78,7 +78,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
|
|
||||||
InstanceRepositoryImpl().save(
|
ExposedInstanceRepository().save(
|
||||||
Instance(
|
Instance(
|
||||||
id = InstanceId(1),
|
id = InstanceId(1),
|
||||||
name = InstanceName("test"),
|
name = InstanceName("test"),
|
||||||
|
@ -130,7 +130,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val actual = InstanceRepositoryImpl().findById(InstanceId(1))
|
val actual = ExposedInstanceRepository().findById(InstanceId(1))
|
||||||
val expected = Instance(
|
val expected = Instance(
|
||||||
id = InstanceId(1),
|
id = InstanceId(1),
|
||||||
name = InstanceName("test"),
|
name = InstanceName("test"),
|
||||||
|
@ -151,7 +151,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findById_指定したIDで存在しないとnull() = runTest {
|
fun findById_指定したIDで存在しないとnull() = runTest {
|
||||||
assertNull(InstanceRepositoryImpl().findById(InstanceId(1)))
|
assertNull(ExposedInstanceRepository().findById(InstanceId(1)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -178,7 +178,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
}
|
}
|
||||||
}.launch()
|
}.launch()
|
||||||
|
|
||||||
val actual = InstanceRepositoryImpl().findByUrl(URI.create("https://www.example.com"))
|
val actual = ExposedInstanceRepository().findByUrl(URI.create("https://www.example.com"))
|
||||||
val expected = Instance(
|
val expected = Instance(
|
||||||
id = InstanceId(1),
|
id = InstanceId(1),
|
||||||
name = InstanceName("test"),
|
name = InstanceName("test"),
|
||||||
|
@ -199,7 +199,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun findByUrl_指定したURLで存在しないとnull() = runTest {
|
fun findByUrl_指定したURLで存在しないとnull() = runTest {
|
||||||
assertNull(InstanceRepositoryImpl().findByUrl(URI.create("https://www.example.com")))
|
assertNull(ExposedInstanceRepository().findByUrl(URI.create("https://www.example.com")))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -243,7 +243,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
|
||||||
|
|
||||||
change.setStartPointNow()
|
change.setStartPointNow()
|
||||||
|
|
||||||
InstanceRepositoryImpl().delete(instance)
|
ExposedInstanceRepository().delete(instance)
|
||||||
|
|
||||||
change.setEndPointNow()
|
change.setEndPointNow()
|
||||||
|
|
|
@ -25,10 +25,10 @@ import kotlin.test.assertNotNull
|
||||||
import kotlin.test.assertNull
|
import kotlin.test.assertNull
|
||||||
|
|
||||||
@ExtendWith(MockitoExtension::class)
|
@ExtendWith(MockitoExtension::class)
|
||||||
class UserDetailRepositoryImplTest : AbstractRepositoryTest(UserDetails) {
|
class ExposedUserDetailRepositoryTest : AbstractRepositoryTest(UserDetails) {
|
||||||
|
|
||||||
@InjectMocks
|
@InjectMocks
|
||||||
lateinit var userDetailRepository: UserDetailRepositoryImpl
|
lateinit var userDetailRepository: ExposedUserDetailRepository
|
||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
lateinit var domainEventPublisher: DomainEventPublisher
|
lateinit var domainEventPublisher: DomainEventPublisher
|
|
@ -49,7 +49,7 @@ abstract class AbstractRepositoryTest(private val exposedTable: org.jetbrains.ex
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
dbSetup(to = dataSource) {
|
dbSetup(to = dataSource) {
|
||||||
execute(Operations.sql("SET REFERENTIAL_INTEGRITY TRUE"))
|
execute(Operations.sql("SET REFERENTIAL_INTEGRITY TRUE"))
|
||||||
}
|
}.launch()
|
||||||
transaction.rollback()
|
transaction.rollback()
|
||||||
transaction.close()
|
transaction.close()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue