diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowService.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowService.kt similarity index 89% rename from src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowService.kt rename to src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowService.kt index 40e45767..378b0db6 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowService.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowService.kt @@ -5,7 +5,7 @@ import dev.usbharu.hideout.domain.model.ap.Follow import dev.usbharu.hideout.domain.model.job.ReceiveFollowJob import kjob.core.job.JobProps -interface ActivityPubFollowService { +interface ActivityPubReceiveFollowService { suspend fun receiveFollow(follow: Follow): ActivityPubResponse suspend fun receiveFollowJob(props: JobProps) } diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowServiceImpl.kt similarity index 96% rename from src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowServiceImpl.kt rename to src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowServiceImpl.kt index 478629d8..31a64738 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowServiceImpl.kt @@ -16,12 +16,12 @@ import kjob.core.job.JobProps import org.koin.core.annotation.Single @Single -class ActivityPubFollowServiceImpl( +class ActivityPubReceiveFollowServiceImpl( private val jobQueueParentService: JobQueueParentService, private val activityPubUserService: ActivityPubUserService, private val userService: IUserService, private val httpClient: HttpClient -) : ActivityPubFollowService { +) : ActivityPubReceiveFollowService { override suspend fun receiveFollow(follow: Follow): ActivityPubResponse { // TODO: Verify HTTP Signature jobQueueParentService.schedule(ReceiveFollowJob) { diff --git a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt index 38bb6bf4..dbcc3af2 100644 --- a/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt +++ b/src/main/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubServiceImpl.kt @@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory @Single class ActivityPubServiceImpl( - private val activityPubFollowService: ActivityPubFollowService, + private val activityPubReceiveFollowService: ActivityPubReceiveFollowService, private val activityPubNoteService: ActivityPubNoteService, private val activityPubUndoService: ActivityPubUndoService ) : ActivityPubService { @@ -50,7 +50,7 @@ class ActivityPubServiceImpl( ActivityType.Delete -> TODO() ActivityType.Dislike -> TODO() ActivityType.Flag -> TODO() - ActivityType.Follow -> activityPubFollowService.receiveFollow( + ActivityType.Follow -> activityPubReceiveFollowService.receiveFollow( Config.configData.objectMapper.readValue( json, Follow::class.java @@ -82,7 +82,7 @@ class ActivityPubServiceImpl( override suspend fun processActivity(job: JobContextWithProps, hideoutJob: HideoutJob) { logger.debug("processActivity: ${hideoutJob.name}") when (hideoutJob) { - ReceiveFollowJob -> activityPubFollowService.receiveFollowJob(job.props as JobProps) + ReceiveFollowJob -> activityPubReceiveFollowService.receiveFollowJob(job.props as JobProps) DeliverPostJob -> activityPubNoteService.createNoteJob(job.props as JobProps) } } diff --git a/src/test/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowServiceImplTest.kt b/src/test/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowServiceImplTest.kt similarity index 96% rename from src/test/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowServiceImplTest.kt rename to src/test/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowServiceImplTest.kt index 2e5b3af0..29525057 100644 --- a/src/test/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubFollowServiceImplTest.kt +++ b/src/test/kotlin/dev/usbharu/hideout/service/activitypub/ActivityPubReceiveFollowServiceImplTest.kt @@ -25,13 +25,14 @@ import org.mockito.kotlin.* import utils.JsonObjectMapper import java.time.Instant -class ActivityPubFollowServiceImplTest { +class ActivityPubReceiveFollowServiceImplTest { @Test fun `receiveFollow フォロー受付処理`() = runTest { val jobQueueParentService = mock { onBlocking { schedule(eq(ReceiveFollowJob), any()) } doReturn Unit } - val activityPubFollowService = ActivityPubFollowServiceImpl(jobQueueParentService, mock(), mock(), mock()) + val activityPubFollowService = + ActivityPubReceiveFollowServiceImpl(jobQueueParentService, mock(), mock(), mock()) activityPubFollowService.receiveFollow( Follow( emptyList(), @@ -118,7 +119,7 @@ class ActivityPubFollowServiceImplTest { onBlocking { follow(any(), any()) } doReturn false } val activityPubFollowService = - ActivityPubFollowServiceImpl( + ActivityPubReceiveFollowServiceImpl( mock(), activityPubUserService, userService,