From b6a76493f1711ad42cc8543bc73ae70b3d75868e Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 24 Dec 2022 08:15:43 +0300 Subject: ActivityPub: compatibility with Honk server --- src/test/java/com/juick/server/tests/ServerTests.java | 7 ++++++- src/test/resources/to_as_string.json | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/to_as_string.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 290e07fe..7d0aa019 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -324,6 +324,8 @@ public class ServerTests { private Resource hubzillaActivity; @Value("classpath:hubzilla_follow.json") private Resource hubzillaFollow; + @Value("classpath:to_as_string.json") + private Resource honkFollow; @Value("classpath:announce.json") private Resource noteWithDocument; @Value("classpath:note_with_attachment.json") @@ -2528,12 +2530,15 @@ public class ServerTests { } @Test - public void hubzillaActor() throws Exception { + public void hubzillaAndHonkActor() 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); Follow follow = jsonMapper.readValue(followData, Follow.class); assertThat(follow.getActor(), is("https://ussr.win/channel/zlax")); + 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")); } @Test diff --git a/src/test/resources/to_as_string.json b/src/test/resources/to_as_string.json new file mode 100644 index 00000000..cb48336c --- /dev/null +++ b/src/test/resources/to_as_string.json @@ -0,0 +1 @@ +{ "@context": "https://www.w3.org/ns/activitystreams", "actor": "https://me.spectrum.im/u/vt", "id": "https://me.spectrum.im/u/vt/sub/944HVdt81833mx32sy", "object": "https://juick.com/u/vt", "published": "2022-12-24T04:59:08Z", "to": "https://juick.com/u/vt", "type": "Follow" } \ No newline at end of file -- cgit v1.2.3