From 8e6d764d6bb4391532e5376c795f634ee3898872 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 10 Oct 2018 00:09:58 +0300 Subject: ActivityPub: Mentions and Hashtags --- .../java/com/juick/server/tests/ServerTests.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'juick-server/src/test/java') diff --git a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java index 58596850..8a49d96a 100644 --- a/juick-server/src/test/java/com/juick/server/tests/ServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/ServerTests.java @@ -18,6 +18,7 @@ package com.juick.server.tests; import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.gargoylesoftware.htmlunit.CookieManager; @@ -33,12 +34,13 @@ import com.juick.model.PrivateChats; import com.juick.model.TagStats; import com.juick.server.*; import com.juick.server.api.activity.model.Context; -import com.juick.server.api.activity.model.Note; -import com.juick.server.api.activity.model.Person; import com.juick.server.api.activity.model.activities.Create; import com.juick.server.api.activity.model.activities.Delete; import com.juick.server.api.activity.model.activities.Follow; import com.juick.server.api.activity.model.activities.Undo; +import com.juick.server.api.activity.model.objects.Mention; +import com.juick.server.api.activity.model.objects.Note; +import com.juick.server.api.activity.model.objects.Person; import com.juick.server.util.HttpUtils; import com.juick.server.util.ImageUtils; import com.juick.server.xmpp.helpers.XMPPStatus; @@ -138,7 +140,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. "ios_app_id=12345678.com.juick.ExampleApp", "xmppbot_jid=juick@localhost/Juick", "hostname=localhost", - "componentname=localhost" + "componentname=localhost", + "spring.jackson.default-property-inclusion=non_default" }) @AutoConfigureMockMvc public class ServerTests { @@ -1714,6 +1717,18 @@ public class ServerTests { assertThat(replyNote.getInReplyTo(), equalTo(extMessageUri)); } @Test + public void activitySerialization() throws JsonProcessingException { + Message msg = new Message(); + msg.setMid(1); + User user = new User(); + user.setName("ugnich"); + msg.setUser(user); + msg.setReplyToUri(URI.create("http://localhost:8080/n/1")); + msg.setTags(Collections.singletonList(new Tag("YO"))); + Note note = activityPubManager.makeNote(msg); + String json = jsonMapper.writeValueAsString(Context.build(note)); + } + @Test public void signingSpec() throws IOException { Person from = (Person) signatureManager.getContext(URI.create("http://localhost:8080/u/freefd")).get(); Person to = (Person) signatureManager.getContext(URI.create("http://localhost:8080/u/ugnich")).get(); -- cgit v1.2.3