refactor: Repository実装のクラス名を統一

This commit is contained in:
usbharu 2024-09-14 11:45:59 +09:00
parent e43e1575cf
commit 900ed51d09
Signed by: usbharu
GPG Key ID: 6556747BF94EEBC8
6 changed files with 17 additions and 17 deletions

View File

@ -31,7 +31,7 @@ import org.springframework.stereotype.Repository
import java.net.URI
@Repository
class CustomEmojiRepositoryImpl : CustomEmojiRepository,
class ExposedCustomEmojiRepository : CustomEmojiRepository,
AbstractRepository() {
override val logger: Logger
get() = Companion.logger
@ -76,7 +76,7 @@ class CustomEmojiRepositoryImpl : CustomEmojiRepository,
}
companion object {
private val logger = LoggerFactory.getLogger(CustomEmojiRepositoryImpl::class.java)
private val logger = LoggerFactory.getLogger(ExposedCustomEmojiRepository::class.java)
}
}

View File

@ -28,7 +28,7 @@ import java.net.URI
import dev.usbharu.hideout.core.domain.model.instance.Instance as InstanceEntity
@Repository
class InstanceRepositoryImpl : InstanceRepository,
class ExposedInstanceRepository : InstanceRepository,
AbstractRepository() {
override val logger: Logger
get() = Companion.logger
@ -66,7 +66,7 @@ class InstanceRepositoryImpl : InstanceRepository,
}
companion object {
private val logger = LoggerFactory.getLogger(InstanceRepositoryImpl::class.java)
private val logger = LoggerFactory.getLogger(ExposedInstanceRepository::class.java)
}
}

View File

@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory
import org.springframework.stereotype.Repository
@Repository
class UserDetailRepositoryImpl(override val domainEventPublisher: DomainEventPublisher) :
class ExposedUserDetailRepository(override val domainEventPublisher: DomainEventPublisher) :
UserDetailRepository,
AbstractRepository(),
DomainEventPublishableRepository<UserDetail> {
@ -105,7 +105,7 @@ class UserDetailRepositoryImpl(override val domainEventPublisher: DomainEventPub
)
companion object {
private val logger = LoggerFactory.getLogger(UserDetailRepositoryImpl::class.java)
private val logger = LoggerFactory.getLogger(ExposedUserDetailRepository::class.java)
}
}

View File

@ -20,12 +20,12 @@ import kotlin.test.assertNull
import dev.usbharu.hideout.core.infrastructure.exposedrepository.Instance as InstanceTable
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
class ExposedInstanceRepositoryTest : AbstractRepositoryTest(InstanceTable) {
@Test
fun save_idが同じレコードがない場合はinsertされる() = runTest {
InstanceRepositoryImpl().save(
ExposedInstanceRepository().save(
Instance(
id = InstanceId(1),
name = InstanceName("test"),
@ -78,7 +78,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
}.launch()
InstanceRepositoryImpl().save(
ExposedInstanceRepository().save(
Instance(
id = InstanceId(1),
name = InstanceName("test"),
@ -130,7 +130,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
}
}.launch()
val actual = InstanceRepositoryImpl().findById(InstanceId(1))
val actual = ExposedInstanceRepository().findById(InstanceId(1))
val expected = Instance(
id = InstanceId(1),
name = InstanceName("test"),
@ -151,7 +151,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
@Test
fun findById_指定したIDで存在しないとnull() = runTest {
assertNull(InstanceRepositoryImpl().findById(InstanceId(1)))
assertNull(ExposedInstanceRepository().findById(InstanceId(1)))
}
@Test
@ -178,7 +178,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
}
}.launch()
val actual = InstanceRepositoryImpl().findByUrl(URI.create("https://www.example.com"))
val actual = ExposedInstanceRepository().findByUrl(URI.create("https://www.example.com"))
val expected = Instance(
id = InstanceId(1),
name = InstanceName("test"),
@ -199,7 +199,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
@Test
fun findByUrl_指定したURLで存在しないとnull() = runTest {
assertNull(InstanceRepositoryImpl().findByUrl(URI.create("https://www.example.com")))
assertNull(ExposedInstanceRepository().findByUrl(URI.create("https://www.example.com")))
}
@Test
@ -243,7 +243,7 @@ class InstanceRepositoryImplTest : AbstractRepositoryTest(InstanceTable) {
change.setStartPointNow()
InstanceRepositoryImpl().delete(instance)
ExposedInstanceRepository().delete(instance)
change.setEndPointNow()

View File

@ -25,10 +25,10 @@ import kotlin.test.assertNotNull
import kotlin.test.assertNull
@ExtendWith(MockitoExtension::class)
class UserDetailRepositoryImplTest : AbstractRepositoryTest(UserDetails) {
class ExposedUserDetailRepositoryTest : AbstractRepositoryTest(UserDetails) {
@InjectMocks
lateinit var userDetailRepository: UserDetailRepositoryImpl
lateinit var userDetailRepository: ExposedUserDetailRepository
@Mock
lateinit var domainEventPublisher: DomainEventPublisher

View File

@ -49,7 +49,7 @@ abstract class AbstractRepositoryTest(private val exposedTable: org.jetbrains.ex
fun tearDown() {
dbSetup(to = dataSource) {
execute(Operations.sql("SET REFERENTIAL_INTEGRITY TRUE"))
}
}.launch()
transaction.rollback()
transaction.close()
}