From 4b6e60929bcaf830bba3423d66bb1f325e73fcb6 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 24 Oct 2018 17:17:19 +0300 Subject: AcitvityPub: fix Mention rendering --- .../java/com/juick/server/tests/ServerTests.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'juick-server/src/test/java/com/juick/server/tests') 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 8884beef..e9f42ee3 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 @@ -1720,15 +1720,25 @@ public class ServerTests { Note create2 = jsonMapper.readValue(noteStr, Note.class); } @Test - @Transactional public void activitySerialization() throws Exception { + Message msgNoTags = commandsManager.processCommand(ugnich, "people", emptyUri).getNewMessage().get(); + String json = jsonMapper.writeValueAsString(Context.build(activityPubManager.makeNote(msgNoTags))); Message msg = commandsManager.processCommand(ugnich, "*shit happens", emptyUri).getNewMessage().get(); Note note = activityPubManager.makeNote(msg); - String json = jsonMapper.writeValueAsString(Context.build(note)); - Message reply = commandsManager.processCommand(freefd, String.format("#%d HI", msg.getMid()), emptyUri).getNewMessage().get(); - json = jsonMapper.writeValueAsString(Context.build(activityPubManager.makeNote(reply))); - Message msgNoTags = commandsManager.processCommand(ugnich, "people", emptyUri).getNewMessage().get(); - json = jsonMapper.writeValueAsString(Context.build(activityPubManager.makeNote(msgNoTags))); + json = jsonMapper.writeValueAsString(Context.build(note)); + Note replyNote = new Note(); + replyNote.setId("http://localhost:8080/n/2-1"); + replyNote.setInReplyTo(activityPubManager.messageUri(msg)); + replyNote.setAttributedTo("http://localhost:8080/u/freefd"); + replyNote.setTo(Collections.singletonList(activityPubManager.personUri(ugnich))); + replyNote.setContent("HI"); + Create create = new Create(); + create.setActor("http://localhost:8080/u/freefd"); + create.setObject(replyNote); + signatureManager.post((Person) signatureManager.getContext(URI.create("http://localhost:8080/u/freefd")).get(), + (Person) signatureManager.getContext(URI.create("http://localhost:8080/u/ugnich")).get(), create); + Message replyToExt = commandsManager.processCommand(ugnich, String.format("#%d/1 PSSH YOBA ETO TI", msg.getMid()), emptyUri).getNewMessage().get(); + json = jsonMapper.writeValueAsString(Context.build(activityPubManager.makeNote(messagesService.getReply(replyToExt.getMid(), replyToExt.getRid())))); } @Test public void signingSpec() throws IOException { -- cgit v1.2.3