refactor: POJOの変更を反映

This commit is contained in:
usbharu 2023-11-28 11:58:30 +09:00
parent 7a34b11147
commit 2e1cee4e1a
24 changed files with 56 additions and 123 deletions

View File

@ -4,18 +4,16 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import dev.usbharu.hideout.activitypub.domain.model.objects.Object import dev.usbharu.hideout.activitypub.domain.model.objects.Object
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
open class Delete : Object, HasId, HasActor, HasName { open class Delete : Object, HasId, HasActor {
@JsonDeserialize(using = ObjectDeserializer::class) @JsonDeserialize(using = ObjectDeserializer::class)
@Suppress("VariableNaming") @Suppress("VariableNaming")
var `object`: Object? = null var `object`: Object? = null
var published: String? = null var published: String? = null
override val actor: String override val actor: String
override val id: String override val id: String
override val name: String
constructor( constructor(
type: List<String> = emptyList(), type: List<String> = emptyList(),
name: String = "Delete",
actor: String, actor: String,
id: String, id: String,
`object`: Object, `object`: Object,
@ -23,7 +21,6 @@ open class Delete : Object, HasId, HasActor, HasName {
) : super(add(type, "Delete")) { ) : super(add(type, "Delete")) {
this.`object` = `object` this.`object` = `object`
this.published = published this.published = published
this.name = name
this.actor = actor this.actor = actor
this.id = id this.id = id
} }
@ -39,7 +36,6 @@ open class Delete : Object, HasId, HasActor, HasName {
if (published != other.published) return false if (published != other.published) return false
if (actor != other.actor) return false if (actor != other.actor) return false
if (id != other.id) return false if (id != other.id) return false
if (name != other.name) return false
return true return true
} }
@ -50,10 +46,9 @@ open class Delete : Object, HasId, HasActor, HasName {
result = 31 * result + (published?.hashCode() ?: 0) result = 31 * result + (published?.hashCode() ?: 0)
result = 31 * result + actor.hashCode() result = 31 * result + actor.hashCode()
result = 31 * result + id.hashCode() result = 31 * result + id.hashCode()
result = 31 * result + name.hashCode()
return result return result
} }
override fun toString(): String = override fun toString(): String =
"Delete(`object`=$`object`, published=$published, actor='$actor', id='$id', name='$name') ${super.toString()}" "Delete(`object`=$`object`, published=$published, actor='$actor', id='$id') ${super.toString()}"
} }

View File

@ -2,24 +2,18 @@ package dev.usbharu.hideout.activitypub.domain.model
import dev.usbharu.hideout.activitypub.domain.model.objects.Object import dev.usbharu.hideout.activitypub.domain.model.objects.Object
open class Document : Object, HasName { open class Document(
type: List<String> = emptyList(),
override val name: String = "",
mediaType: String,
url: String
) : Object(
type = add(type, "Document")
),
HasName {
var mediaType: String? = null var mediaType: String? = mediaType
var url: String? = null var url: String? = url
override val name: String
constructor(
type: List<String> = emptyList(),
name: String,
mediaType: String,
url: String
) : super(
type = add(type, "Document")
) {
this.mediaType = mediaType
this.url = url
this.name = name
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true

View File

@ -2,24 +2,17 @@ package dev.usbharu.hideout.activitypub.domain.model
import dev.usbharu.hideout.activitypub.domain.model.objects.Object import dev.usbharu.hideout.activitypub.domain.model.objects.Object
open class Emoji : Object { open class Emoji(
var updated: String? = null type: List<String>,
var icon: Image? = null override val name: String,
override val id: String,
protected constructor() : super() var updated: String?,
constructor( var icon: Image?
type: List<String>, ) : Object(
name: String?, type = add(type, "Emoji")
actor: String?, ),
id: String?, HasName,
updated: String?, HasId {
icon: Image?
) : super(
type = add(type, "Emoji")
) {
this.updated = updated
this.icon = icon
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true

View File

@ -3,7 +3,6 @@ package dev.usbharu.hideout.activitypub.domain.model
import com.fasterxml.jackson.databind.annotation.JsonDeserialize import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import dev.usbharu.hideout.activitypub.domain.model.objects.Object import dev.usbharu.hideout.activitypub.domain.model.objects.Object
import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer import dev.usbharu.hideout.activitypub.domain.model.objects.ObjectDeserializer
import java.time.Instant
open class Undo : Object, HasId, HasActor { open class Undo : Object, HasId, HasActor {
@ -19,10 +18,10 @@ open class Undo : Object, HasId, HasActor {
actor: String, actor: String,
id: String, id: String,
`object`: Object, `object`: Object,
published: Instant published: String
) : super(add(type, "Undo")) { ) : super(add(type, "Undo")) {
this.`object` = `object` this.`object` = `object`
this.published = published.toString() this.published = published
this.id = id this.id = id
this.actor = actor this.actor = actor
} }

View File

@ -15,9 +15,6 @@ class ObjectDeserializer : JsonDeserializer<Object>() {
if (treeNode.isValueNode) { if (treeNode.isValueNode) {
return ObjectValue( return ObjectValue(
emptyList(), emptyList(),
null,
null,
null,
treeNode.asText() treeNode.asText()
) )
} else if (treeNode.isObject) { } else if (treeNode.isObject) {

View File

@ -3,30 +3,25 @@ package dev.usbharu.hideout.activitypub.domain.model.objects
import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonCreator
@Suppress("VariableNaming") @Suppress("VariableNaming")
open class ObjectValue : Object { open class ObjectValue @JsonCreator constructor(type: List<String>, var `object`: String) : Object(
type
lateinit var `object`: String ) {
@JsonCreator
constructor(type: List<String>) : super(
type
) {
this.`object` = `object`
}
override fun equals(other: Any?): Boolean { override fun equals(other: Any?): Boolean {
if (this === other) return true if (this === other) return true
if (other !is ObjectValue) return false if (javaClass != other?.javaClass) return false
if (!super.equals(other)) return false if (!super.equals(other)) return false
other as ObjectValue
return `object` == other.`object` return `object` == other.`object`
} }
override fun hashCode(): Int { override fun hashCode(): Int {
var result = super.hashCode() var result = super.hashCode()
result = 31 * result + (`object`?.hashCode() ?: 0) result = 31 * result + `object`.hashCode()
return result return result
} }
override fun toString(): String = "ObjectValue(`object`=$`object`) ${super.toString()}" override fun toString(): String = "ObjectValue(`object`='$`object`') ${super.toString()}"
} }

View File

@ -64,7 +64,6 @@ class NoteQueryServiceImpl(private val postRepository: PostRepository, private v
this[Users.followers] this[Users.followers]
) )
return Note( return Note(
name = "Post",
id = this[Posts.apId], id = this[Posts.apId],
attributedTo = this[Users.url], attributedTo = this[Users.url],
content = this[Posts.text], content = this[Posts.text],

View File

@ -2,6 +2,7 @@ package dev.usbharu.hideout.activitypub.service.activity.delete
import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException import dev.usbharu.hideout.activitypub.domain.exception.IllegalActivityPubObjectException
import dev.usbharu.hideout.activitypub.domain.model.Delete import dev.usbharu.hideout.activitypub.domain.model.Delete
import dev.usbharu.hideout.activitypub.domain.model.HasId
import dev.usbharu.hideout.activitypub.service.common.AbstractActivityPubProcessor import dev.usbharu.hideout.activitypub.service.common.AbstractActivityPubProcessor
import dev.usbharu.hideout.activitypub.service.common.ActivityPubProcessContext import dev.usbharu.hideout.activitypub.service.common.ActivityPubProcessContext
import dev.usbharu.hideout.activitypub.service.common.ActivityType import dev.usbharu.hideout.activitypub.service.common.ActivityType
@ -17,7 +18,11 @@ class APDeleteProcessor(
) : ) :
AbstractActivityPubProcessor<Delete>(transaction) { AbstractActivityPubProcessor<Delete>(transaction) {
override suspend fun internalProcess(activity: ActivityPubProcessContext<Delete>) { override suspend fun internalProcess(activity: ActivityPubProcessContext<Delete>) {
val deleteId = activity.activity.`object`?.id ?: throw IllegalActivityPubObjectException("object.id is null") val value = activity.activity.`object`
if (value !is HasId) {
throw IllegalActivityPubObjectException("object hasn't id")
}
val deleteId = value.id
val post = try { val post = try {
postQueryService.findByApId(deleteId) postQueryService.findByApId(deleteId)

View File

@ -15,7 +15,6 @@ class APSendFollowServiceImpl(
) : APSendFollowService { ) : APSendFollowService {
override suspend fun sendFollow(sendFollowDto: SendFollowDto) { override suspend fun sendFollow(sendFollowDto: SendFollowDto) {
val follow = Follow( val follow = Follow(
name = "Follow",
`object` = sendFollowDto.followTargetUserId.url, `object` = sendFollowDto.followTargetUserId.url,
actor = sendFollowDto.userId.url actor = sendFollowDto.userId.url
) )

View File

@ -21,7 +21,6 @@ class ApReactionJobProcessor(
apRequestService.apPost( apRequestService.apPost(
param.inbox, param.inbox,
Like( Like(
name = "Like",
actor = param.actor, actor = param.actor,
`object` = param.postUrl, `object` = param.postUrl,
id = "${applicationConfig.url}/liek/note/${param.id}", id = "${applicationConfig.url}/liek/note/${param.id}",

View File

@ -28,11 +28,10 @@ class ApRemoveReactionJobProcessor(
apRequestService.apPost( apRequestService.apPost(
param.inbox, param.inbox,
Undo( Undo(
name = "Undo Reaction",
actor = param.actor, actor = param.actor,
`object` = like, `object` = like,
id = "${applicationConfig.url}/undo/like/${param.id}", id = "${applicationConfig.url}/undo/like/${param.id}",
published = Instant.now() published = Instant.now().toString()
), ),
signer signer
) )

View File

@ -57,13 +57,11 @@ class APUserServiceImpl(
url = userUrl, url = userUrl,
icon = Image( icon = Image(
type = emptyList(), type = emptyList(),
name = "$userUrl/icon.png",
mediaType = "image/png", mediaType = "image/png",
url = "$userUrl/icon.png" url = "$userUrl/icon.png"
), ),
publicKey = Key( publicKey = Key(
type = emptyList(), type = emptyList(),
name = "Public Key",
id = userEntity.keyId, id = userEntity.keyId,
owner = userUrl, owner = userUrl,
publicKeyPem = userEntity.publicKey publicKeyPem = userEntity.publicKey
@ -127,13 +125,11 @@ class APUserServiceImpl(
url = id, url = id,
icon = Image( icon = Image(
type = emptyList(), type = emptyList(),
name = "$id/icon.png",
mediaType = "image/png", mediaType = "image/png",
url = "$id/icon.png" url = "$id/icon.png"
), ),
publicKey = Key( publicKey = Key(
type = emptyList(), type = emptyList(),
name = "Public Key",
id = userEntity.keyId, id = userEntity.keyId,
owner = id, owner = id,
publicKeyPem = userEntity.publicKey publicKeyPem = userEntity.publicKey

View File

@ -25,6 +25,7 @@ class ActivityPubConfig {
.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY) .enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY)
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY) .setSerializationInclusion(JsonInclude.Include.NON_EMPTY)
.setDefaultSetterInfo(JsonSetter.Value.forContentNulls(Nulls.AS_EMPTY)) .setDefaultSetterInfo(JsonSetter.Value.forContentNulls(Nulls.AS_EMPTY))
.setDefaultSetterInfo(JsonSetter.Value.forValueNulls(Nulls.AS_EMPTY))
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
.configure(JsonParser.Feature.ALLOW_COMMENTS, true) .configure(JsonParser.Feature.ALLOW_COMMENTS, true)
.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true) .configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true)

View File

@ -46,7 +46,6 @@ class DeleteSerializeTest {
val readValue = objectMapper.readValue<Delete>(json) val readValue = objectMapper.readValue<Delete>(json)
val expected = Delete( val expected = Delete(
name = null,
actor = "https://misskey.usbharu.dev/users/97ws8y3rj6", actor = "https://misskey.usbharu.dev/users/97ws8y3rj6",
id = "https://misskey.usbharu.dev/4b5b6ed5-9269-45f3-8403-cba1e74b4b69", id = "https://misskey.usbharu.dev/4b5b6ed5-9269-45f3-8403-cba1e74b4b69",
`object` = Tombstone( `object` = Tombstone(
@ -61,7 +60,6 @@ class DeleteSerializeTest {
@Test @Test
fun シリアライズできる() { fun シリアライズできる() {
val delete = Delete( val delete = Delete(
name = null,
actor = "https://misskey.usbharu.dev/users/97ws8y3rj6", actor = "https://misskey.usbharu.dev/users/97ws8y3rj6",
id = "https://misskey.usbharu.dev/4b5b6ed5-9269-45f3-8403-cba1e74b4b69", id = "https://misskey.usbharu.dev/4b5b6ed5-9269-45f3-8403-cba1e74b4b69",
`object` = Tombstone( `object` = Tombstone(
@ -75,7 +73,7 @@ class DeleteSerializeTest {
val actual = objectMapper.writeValueAsString(delete) val actual = objectMapper.writeValueAsString(delete)
val expected = val expected =
"""{"type":"Delete","actor":"https://misskey.usbharu.dev/users/97ws8y3rj6","id":"https://misskey.usbharu.dev/4b5b6ed5-9269-45f3-8403-cba1e74b4b69","object":{"type":"Tombstone","name":"Tombstone","id":"https://misskey.usbharu.dev/notes/9lkwqnwqk9"},"published":"2023-11-02T15:30:34.160Z"}""" """{"type":"Delete","actor":"https://misskey.usbharu.dev/users/97ws8y3rj6","id":"https://misskey.usbharu.dev/4b5b6ed5-9269-45f3-8403-cba1e74b4b69","object":{"type":"Tombstone","id":"https://misskey.usbharu.dev/notes/9lkwqnwqk9"},"published":"2023-11-02T15:30:34.160Z"}"""
assertEquals(expected, actual) assertEquals(expected, actual)
} }
} }

View File

@ -10,7 +10,6 @@ class NoteSerializeTest {
@Test @Test
fun Noteのシリアライズができる() { fun Noteのシリアライズができる() {
val note = Note( val note = Note(
name = "Note",
id = "https://example.com", id = "https://example.com",
attributedTo = "https://example.com/actor", attributedTo = "https://example.com/actor",
content = "Hello", content = "Hello",
@ -22,7 +21,7 @@ class NoteSerializeTest {
val writeValueAsString = objectMapper.writeValueAsString(note) val writeValueAsString = objectMapper.writeValueAsString(note)
assertEquals( assertEquals(
"{\"type\":\"Note\",\"name\":\"Note\",\"id\":\"https://example.com\",\"attributedTo\":\"https://example.com/actor\",\"content\":\"Hello\",\"published\":\"2023-05-20T10:28:17.308Z\",\"sensitive\":false}", """{"type":"Note","id":"https://example.com","attributedTo":"https://example.com/actor","content":"Hello","published":"2023-05-20T10:28:17.308Z","sensitive":false}""",
writeValueAsString writeValueAsString
) )
} }
@ -65,7 +64,6 @@ class NoteSerializeTest {
val readValue = objectMapper.readValue<Note>(json) val readValue = objectMapper.readValue<Note>(json)
val note = Note( val note = Note(
name = "",
id = "https://misskey.usbharu.dev/notes/9f2i9cm88e", id = "https://misskey.usbharu.dev/notes/9f2i9cm88e",
type = listOf("Note"), type = listOf("Note"),
attributedTo = "https://misskey.usbharu.dev/users/97ws8y3rj6", attributedTo = "https://misskey.usbharu.dev/users/97ws8y3rj6",
@ -77,7 +75,6 @@ class NoteSerializeTest {
inReplyTo = "https://calckey.jp/notes/9f2i7ymf1d", inReplyTo = "https://calckey.jp/notes/9f2i7ymf1d",
attachment = emptyList() attachment = emptyList()
) )
note.name = null
assertEquals(note, readValue) assertEquals(note, readValue)
} }
} }

View File

@ -1,8 +1,8 @@
package dev.usbharu.hideout.activitypub.domain.model package dev.usbharu.hideout.activitypub.domain.model
import dev.usbharu.hideout.application.config.ActivityPubConfig
import org.intellij.lang.annotations.Language import org.intellij.lang.annotations.Language
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import utils.JsonObjectMapper
import java.time.Clock import java.time.Clock
import java.time.Instant import java.time.Instant
import java.time.ZoneId import java.time.ZoneId
@ -12,18 +12,16 @@ class UndoTest {
fun Undoのシリアライズができる() { fun Undoのシリアライズができる() {
val undo = Undo( val undo = Undo(
emptyList(), emptyList(),
"Undo Follow",
"https://follower.example.com/", "https://follower.example.com/",
"https://follower.example.com/undo/1", "https://follower.example.com/undo/1",
Follow( Follow(
emptyList(), emptyList(),
null,
"https://follower.example.com/users/", "https://follower.example.com/users/",
actor = "https://follower.exaple.com/users/1" actor = "https://follower.exaple.com/users/1"
), ),
Instant.now(Clock.tickMillis(ZoneId.systemDefault())) Instant.now(Clock.tickMillis(ZoneId.systemDefault())).toString()
) )
val writeValueAsString = JsonObjectMapper.objectMapper.writeValueAsString(undo) val writeValueAsString = ActivityPubConfig().objectMapper().writeValueAsString(undo)
println(writeValueAsString) println(writeValueAsString)
} }
@ -70,7 +68,7 @@ class UndoTest {
""".trimIndent() """.trimIndent()
val undo = JsonObjectMapper.objectMapper.readValue(json, Undo::class.java) val undo = ActivityPubConfig().objectMapper().readValue(json, Undo::class.java)
println(undo) println(undo)
} }
} }

View File

@ -16,10 +16,7 @@ class ObjectSerializeTest {
val readValue = objectMapper.readValue<Object>(json) val readValue = objectMapper.readValue<Object>(json)
val expected = Object( val expected = Object(
listOf("Object"), listOf("Object")
null,
null,
null
) )
assertEquals(expected, readValue) assertEquals(expected, readValue)
} }
@ -34,10 +31,7 @@ class ObjectSerializeTest {
val readValue = objectMapper.readValue<Object>(json) val readValue = objectMapper.readValue<Object>(json)
val expected = Object( val expected = Object(
listOf("Hoge", "Object"), listOf("Hoge", "Object")
null,
null,
null
) )
assertEquals(expected, readValue) assertEquals(expected, readValue)
@ -53,10 +47,7 @@ class ObjectSerializeTest {
val readValue = objectMapper.readValue<Object>(json) val readValue = objectMapper.readValue<Object>(json)
val expected = Object( val expected = Object(
emptyList(), emptyList()
null,
null,
null
) )
assertEquals(expected, readValue) assertEquals(expected, readValue)

View File

@ -49,12 +49,10 @@ class UserAPControllerImplTest {
outbox = "https://example.com/users/hoge/outbox", outbox = "https://example.com/users/hoge/outbox",
url = "https://example.com/users/hoge", url = "https://example.com/users/hoge",
icon = Image( icon = Image(
name = "icon",
mediaType = "image/jpeg", mediaType = "image/jpeg",
url = "https://example.com/users/hoge/icon.jpg" url = "https://example.com/users/hoge/icon.jpg"
), ),
publicKey = Key( publicKey = Key(
name = "Public Key",
id = "https://example.com/users/hoge#pubkey", id = "https://example.com/users/hoge#pubkey",
owner = "https://example.com/users/hoge", owner = "https://example.com/users/hoge",
publicKeyPem = "-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----", publicKeyPem = "-----BEGIN PUBLIC KEY-----...-----END PUBLIC KEY-----",

View File

@ -53,7 +53,6 @@ class NoteApControllerImplTest {
fun `postAP 匿名で取得できる`() = runTest { fun `postAP 匿名で取得できる`() = runTest {
SecurityContextHolder.clearContext() SecurityContextHolder.clearContext()
val note = Note( val note = Note(
name = "Note",
id = "https://example.com/users/hoge/posts/1234", id = "https://example.com/users/hoge/posts/1234",
attributedTo = "https://example.com/users/hoge", attributedTo = "https://example.com/users/hoge",
content = "Hello", content = "Hello",
@ -90,7 +89,6 @@ class NoteApControllerImplTest {
@Test @Test
fun `postAP 認証に成功している場合userIdがnullでない`() = runTest { fun `postAP 認証に成功している場合userIdがnullでない`() = runTest {
val note = Note( val note = Note(
name = "Note",
id = "https://example.com/users/hoge/posts/1234", id = "https://example.com/users/hoge/posts/1234",
attributedTo = "https://example.com/users/hoge", attributedTo = "https://example.com/users/hoge",
content = "Hello", content = "Hello",

View File

@ -52,7 +52,6 @@ class ApSendCreateServiceImplTest {
val post = PostBuilder.of() val post = PostBuilder.of()
val user = UserBuilder.localUserOf(id = post.userId) val user = UserBuilder.localUserOf(id = post.userId)
val note = Note( val note = Note(
name = "Post",
id = post.apId, id = post.apId,
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,

View File

@ -24,7 +24,6 @@ class APSendFollowServiceImplTest {
apSendFollowServiceImpl.sendFollow(sendFollowDto) apSendFollowServiceImpl.sendFollow(sendFollowDto)
val value = Follow( val value = Follow(
name = "Follow",
`object` = sendFollowDto.followTargetUserId.url, `object` = sendFollowDto.followTargetUserId.url,
actor = sendFollowDto.userId.url actor = sendFollowDto.userId.url
) )

View File

@ -39,7 +39,7 @@ class APRequestServiceImplTest {
assertDoesNotThrow { assertDoesNotThrow {
dateTimeFormatter.parse(it.headers["Date"]) dateTimeFormatter.parse(it.headers["Date"])
} }
respond("{}") respond("""{"type":"Follow","object": "https://example.com","actor": "https://example.com"}""")
}), }),
objectMapper, objectMapper,
mock(), mock(),
@ -47,7 +47,6 @@ class APRequestServiceImplTest {
) )
val responseClass = Follow( val responseClass = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -65,7 +64,7 @@ class APRequestServiceImplTest {
assertDoesNotThrow { assertDoesNotThrow {
dateTimeFormatter.parse(it.headers["Date"]) dateTimeFormatter.parse(it.headers["Date"])
} }
respond("{}") respond("""{"type":"Follow","object": "https://example.com","actor": "https://example.com"}""")
}), }),
objectMapper, objectMapper,
mock(), mock(),
@ -73,7 +72,6 @@ class APRequestServiceImplTest {
) )
val responseClass = Follow( val responseClass = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -106,7 +104,7 @@ class APRequestServiceImplTest {
assertDoesNotThrow { assertDoesNotThrow {
dateTimeFormatter.parse(it.headers["Date"]) dateTimeFormatter.parse(it.headers["Date"])
} }
respond("{}") respond("""{"type":"Follow","object": "https://example.com","actor": "https://example.com"}""")
}), }),
objectMapper, objectMapper,
httpSignatureSigner, httpSignatureSigner,
@ -114,7 +112,6 @@ class APRequestServiceImplTest {
) )
val responseClass = Follow( val responseClass = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -166,7 +163,6 @@ class APRequestServiceImplTest {
}), objectMapper, mock(), dateTimeFormatter) }), objectMapper, mock(), dateTimeFormatter)
val body = Follow( val body = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -213,7 +209,6 @@ class APRequestServiceImplTest {
}), objectMapper, mock(), dateTimeFormatter) }), objectMapper, mock(), dateTimeFormatter)
val body = Follow( val body = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -244,7 +239,6 @@ class APRequestServiceImplTest {
}), objectMapper, mock(), dateTimeFormatter) }), objectMapper, mock(), dateTimeFormatter)
val body = Follow( val body = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -286,7 +280,6 @@ class APRequestServiceImplTest {
}), objectMapper, httpSignatureSigner, dateTimeFormatter) }), objectMapper, httpSignatureSigner, dateTimeFormatter)
val body = Follow( val body = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )
@ -337,7 +330,6 @@ class APRequestServiceImplTest {
}), objectMapper, mock(), dateTimeFormatter) }), objectMapper, mock(), dateTimeFormatter)
val body = Follow( val body = Follow(
name = "Follow",
`object` = "https://example.com", `object` = "https://example.com",
actor = "https://example.com" actor = "https://example.com"
) )

View File

@ -56,7 +56,6 @@ class APNoteServiceImplTest {
onBlocking { findById(eq(post.userId)) } doReturn user onBlocking { findById(eq(post.userId)) } doReturn user
} }
val expected = Note( val expected = Note(
name = "Post",
id = post.apId, id = post.apId,
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,
@ -98,7 +97,6 @@ class APNoteServiceImplTest {
onBlocking { findById(eq(post.userId)) } doReturn user onBlocking { findById(eq(post.userId)) } doReturn user
} }
val note = Note( val note = Note(
name = "Post",
id = post.apId, id = post.apId,
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,
@ -124,13 +122,11 @@ class APNoteServiceImplTest {
url = user.url, url = user.url,
icon = Image( icon = Image(
type = emptyList(), type = emptyList(),
name = user.url + "/icon.png",
mediaType = "image/png", mediaType = "image/png",
url = user.url + "/icon.png" url = user.url + "/icon.png"
), ),
publicKey = Key( publicKey = Key(
type = emptyList(), type = emptyList(),
name = "Public Key",
id = user.keyId, id = user.keyId,
owner = user.url, owner = user.url,
publicKeyPem = user.publicKey publicKeyPem = user.publicKey
@ -177,7 +173,6 @@ class APNoteServiceImplTest {
onBlocking { findById(eq(post.userId)) } doReturn user onBlocking { findById(eq(post.userId)) } doReturn user
} }
val note = Note( val note = Note(
name = "Post",
id = post.apId, id = post.apId,
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,
@ -246,11 +241,11 @@ class APNoteServiceImplTest {
outbox = user.outbox, outbox = user.outbox,
url = user.url, url = user.url,
icon = Image( icon = Image(
name = user.url + "/icon.png", mediaType = "image/png", url = user.url + "/icon.png" mediaType = "image/png",
url = user.url + "/icon.png"
), ),
publicKey = Key( publicKey = Key(
type = emptyList(), type = emptyList(),
name = "Public Key",
id = user.keyId, id = user.keyId,
owner = user.url, owner = user.url,
publicKeyPem = user.publicKey publicKeyPem = user.publicKey
@ -278,7 +273,6 @@ class APNoteServiceImplTest {
) )
val note = Note( val note = Note(
name = "Post",
id = post.apId, id = post.apId,
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,
@ -311,7 +305,6 @@ class APNoteServiceImplTest {
onBlocking { findById(eq(user.id)) } doReturn user onBlocking { findById(eq(user.id)) } doReturn user
} }
val note = Note( val note = Note(
name = "Post",
id = post.apId, id = post.apId,
attributedTo = user.url, attributedTo = user.url,
content = post.text, content = post.text,

View File

@ -13,7 +13,6 @@ class ContextSerializerTest {
name = "aaa", name = "aaa",
actor = "bbb", actor = "bbb",
`object` = Follow( `object` = Follow(
name = "ccc",
`object` = "ddd", `object` = "ddd",
actor = "aaa" actor = "aaa"
) )