aboutsummaryrefslogtreecommitdiff
path: root/juick-server/src/test/java/com/juick
diff options
context:
space:
mode:
Diffstat (limited to 'juick-server/src/test/java/com/juick')
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java8
1 files changed, 4 insertions, 4 deletions
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 1ba65721..d30b1303 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
@@ -125,6 +125,8 @@ public class ServerTests {
private ImagesService imagesService;
@Value("${hostname:localhost}")
private Jid jid;
+ @Value("${xmppbot_jid:juick@localhost}")
+ private Jid botJid;
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String tmpDir;
@Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
@@ -531,12 +533,10 @@ public class ServerTests {
renhaId = userService.createUser("renha", "umnnbt");
Jid from = Jid.of("renha@serverstorageisfull.tld");
jdbcTemplate.update("INSERT INTO jids(user_id,jid,active) VALUES(?,?,?)", renhaId, from.toEscapedString(), 1);
- String xmlMessage = "<message xmlns=\"jabber:server\" from=\"renha@serverstorageisfull.tld\" to=\"juick@juick.com/Juick\" type=\"error\"><body>Reply by @LexX</body><juick xmlns=\"http://juick.com/message\" mid=\"2885759\" privacy=\"1\" replyto=\"0\" rid=\"8\" ts=\"2017-10-10 07:41:10\"><body>Похоже нынче можно публично заявлять о своем веганстве. </body><user xmlns=\"http://juick.com/user\" uname=\"LexX\" uid=\"6340\"></user></juick><error type=\"wait\"><resource-constraint xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></resource-constraint><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">Your contact offline message queue is full. The message has been discarded.</text></error></message>";
- Stanza msg = server.parse(xmlMessage);
- assertThat(from, equalTo(msg.getFrom()));
+ String xmlMessage = "<message xmlns=\"jabber:server\" from=\"renha@serverstorageisfull.tld\" to=\"" + botJid.toEscapedString() + "\" type=\"error\"><body>Reply by @LexX</body><juick xmlns=\"http://juick.com/message\" mid=\"2885759\" privacy=\"1\" replyto=\"0\" rid=\"8\" ts=\"2017-10-10 07:41:10\"><body>Похоже нынче можно публично заявлять о своем веганстве. </body><user xmlns=\"http://juick.com/user\" uname=\"LexX\" uid=\"6340\"></user></juick><error type=\"wait\"><resource-constraint xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"></resource-constraint><text xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\">Your contact offline message queue is full. The message has been discarded.</text></error></message>";
Function<Integer, Boolean> isActive = f -> jdbcTemplate.queryForObject("SELECT active FROM jids WHERE user_id=?", Integer.class, f) == 1;
assertThat(isActive.apply(renhaId), equalTo(true));
- router.incomingMessage((ServerMessage)msg);
+ server.onStanzaReceived(xmlMessage);
assertThat(isActive.apply(renhaId), equalTo(false));
commandsManager.processCommand(userService.getUserByJID(from.asBareJid().toEscapedString()), "On", URI.create(StringUtils.EMPTY));
assertTrue(isActive.apply(renhaId));