From 0e20ca44eee0cb2726b575aed88a495206481973 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 4 Jan 2023 07:18:16 +0300 Subject: ActivityPub: handle Note updates --- src/test/java/com/juick/server/tests/ServerTests.java | 6 +++++- src/test/resources/friendica_update.json | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/friendica_update.json (limited to 'src/test') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 5eeeab3d..6e4bbcb5 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -255,6 +255,8 @@ public class ServerTests { private Resource sapeOutput; @Value("classpath:flag.json") private Resource flagPayload; + @Value("classpath:friendica_update.json") + private Resource friendicaUpdate; @Inject AppleClientSecretGenerator clientSecretGenerator; @Inject @@ -2449,7 +2451,7 @@ public class ServerTests { } @Test - public void hubzillaAndHonkActor() throws Exception { + public void hubzillaAndHonkActorAndFriendicaUpdate() throws Exception { String activity = IOUtils.toString(hubzillaActivity.getInputStream(), StandardCharsets.UTF_8); Create create = jsonMapper.readValue(activity, Create.class); String followData = IOUtils.toString(hubzillaFollow.getInputStream(), StandardCharsets.UTF_8); @@ -2458,6 +2460,8 @@ public class ServerTests { String honkData = IOUtils.toString(honkFollow.getInputStream(), StandardCharsets.UTF_8); Follow hfollow = jsonMapper.readValue(honkData, Follow.class); assertThat(hfollow.getTo().get(0), is("https://juick.com/u/vt")); + String updateString = IOUtils.toString(friendicaUpdate.getInputStream(), StandardCharsets.UTF_8); + Update update = jsonMapper.readValue(updateString, Update.class); } @Test diff --git a/src/test/resources/friendica_update.json b/src/test/resources/friendica_update.json new file mode 100644 index 00000000..6700261c --- /dev/null +++ b/src/test/resources/friendica_update.json @@ -0,0 +1 @@ +{"id":"https://friendica.ironbug.org/objects/3217dd65-1863-b450-5692-633751828658/Update","published":"2023-01-03T15:57:10Z","to":["https://s.zholnay.name/users/kirill","https://friendica.ironbug.org/followers/iron_bug","https://www.w3.org/ns/activitystreams#Public","https://juick.com/u/Strephil"],"actor":"https://friendica.ironbug.org/profile/iron_bug","object":{"id":"https://friendica.ironbug.org/objects/3217dd65-1863-b450-5692-633751828658","published":"2023-01-03T15:57:10Z","url":"https://friendica.ironbug.org/display/3217dd65-1863-b450-5692-633751828658","to":["https://s.zholnay.name/users/kirill","https://friendica.ironbug.org/followers/iron_bug","https://www.w3.org/ns/activitystreams#Public","https://juick.com/u/Strephil"],"content":"@kirill @Strephil вот разве что спиногрызы. а так, если никто не мешает ходить дома без штанов, то это самый комфортный вариант.
я когда ушла работать на удалёнку и избавилась от необходимости сидеть в одежде полдня, я стала просто счастлива. это было самым ужасным мучением из всех неприятностей работы в офисе. дома я одежду не ношу, если совсем не холодно.","attributedTo":"https://friendica.ironbug.org/profile/iron_bug","inReplyTo":"https://s.zholnay.name/users/kirill/statuses/109625978748200980","cc":["https://friends.deko.cloud/profile/shuro"],"type":"Note","tag":[{"href":"https://friendica.ironbug.org/profile/iron_bug","name":"@@iron_bug@friendica.ironbug.org@friendica.ironbug.org","type":"Mention"},{"href":"https://s.zholnay.name/users/kirill","name":"@@kirill@s.zholnay.name@s.zholnay.name","type":"Mention"},{"href":"https://juick.com/u/Strephil","name":"@@Strephil@juick.com@juick.com","type":"Mention"}]},"type":"Update","@context":["https://www.w3.org/ns/activitystreams","https://w3id.org/security/v1",{"vcard":"http://www.w3.org/2006/vcard/ns#","dfrn":"http://purl.org/macgirvin/dfrn/1.0/","diaspora":"https://diasporafoundation.org/ns/","litepub":"http://litepub.social/ns#","manuallyApprovesFollowers":"as:manuallyApprovesFollowers","sensitive":"as:sensitive","Hashtag":"as:Hashtag","directMessage":"litepub:directMessage"}]} -- cgit v1.2.3