aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-02-06 16:36:36 +0300
committerGravatar Vitaly Takmazov2017-02-06 16:36:36 +0300
commit2befd7c98f9932d1aab6d72477490d0224000d62 (patch)
treefbafe6bf43242790f06021669124f958c8030df3
parent10d9407032b0eadeabc25ac7cd16a72b03be41bb (diff)
juick-xmpp: move ugnich xmpp extensions to tests
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java)11
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/XMPPServer.java4
-rw-r--r--juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java6
-rw-r--r--src/test/java/com/juick/tests/SerializationTests.java6
-rw-r--r--src/test/java/com/juick/xmpp/extensions/JuickMessage.java (renamed from juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java)0
-rw-r--r--src/test/java/com/juick/xmpp/extensions/JuickUser.java (renamed from juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java)0
6 files changed, 14 insertions, 13 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java b/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java
index ef89671f..a082c4cb 100644
--- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java
+++ b/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java
@@ -1,7 +1,6 @@
-package com.juick.components.s2s;
+package com.juick.components;
import com.juick.User;
-import com.juick.components.XMPPServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rocks.xmpp.addr.Jid;
@@ -25,14 +24,14 @@ import java.util.List;
/**
* @author ugnich
*/
-public class ConnectionRouter implements AutoCloseable {
+public class XMPPConnection implements AutoCloseable {
- private static final Logger logger = LoggerFactory.getLogger(ConnectionRouter.class);
+ private static final Logger logger = LoggerFactory.getLogger(XMPPConnection.class);
private ExternalComponent router;
private XMPPServer xmpp;
- public ConnectionRouter(XMPPServer s2s, String componentName, int componentPort, String password) {
+ public XMPPConnection(XMPPServer s2s, String componentName, int componentPort, String password) {
this.xmpp = s2s;
logger.info("stream router start");
router = ExternalComponent.create(componentName, password, xmpp.getSession().getConfiguration(), "localhost", componentPort);
@@ -93,7 +92,7 @@ public class ConnectionRouter implements AutoCloseable {
}
- void sendStanza(Stanza xml) {
+ public void sendStanza(Stanza xml) {
router.send(xml);
}
diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
index ffb7e260..b5518e33 100644
--- a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
+++ b/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java
@@ -51,7 +51,7 @@ public class XMPPServer implements AutoCloseable {
@Inject
- private ConnectionRouter router;
+ private XMPPConnection router;
@Inject
public MessagesService messagesService;
@Inject
@@ -258,7 +258,7 @@ public class XMPPServer implements AutoCloseable {
}
}
- public ConnectionRouter getRouter() {
+ public XMPPConnection getRouter() {
return router;
}
diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
index 9d6fc041..22b4cc41 100644
--- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
+++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java
@@ -6,7 +6,7 @@ package com.juick.components.configuration;
import com.juick.components.XMPPServer;
import com.juick.components.s2s.CleaningUp;
-import com.juick.components.s2s.ConnectionRouter;
+import com.juick.components.XMPPConnection;
import com.juick.components.s2s.JuickBot;
import com.juick.configuration.DataConfiguration;
import org.apache.commons.lang3.BooleanUtils;
@@ -48,9 +48,9 @@ public class XmppAppConfiguration {
return new JuickBot(xmpp());
}
@Bean
- public ConnectionRouter router() {
+ public XMPPConnection router() {
boolean disabled = BooleanUtils.toBoolean(env.getProperty("xmpp_disabled", "false"));
- return disabled ? null : new ConnectionRouter(xmpp(), env.getProperty("componentname"),
+ return disabled ? null : new XMPPConnection(xmpp(), env.getProperty("componentname"),
NumberUtils.toInt(env.getProperty("component_port"), 5347),
env.getProperty("xmpp_password"));
}
diff --git a/src/test/java/com/juick/tests/SerializationTests.java b/src/test/java/com/juick/tests/SerializationTests.java
index 61b86c5f..022a1bc7 100644
--- a/src/test/java/com/juick/tests/SerializationTests.java
+++ b/src/test/java/com/juick/tests/SerializationTests.java
@@ -6,7 +6,6 @@ import com.juick.Message;
import com.juick.Tag;
import com.juick.User;
import com.juick.json.MessageSerializer;
-import com.juick.json.UserSerializer;
import com.juick.xmpp.extensions.JuickMessage;
import org.json.JSONObject;
import org.junit.Test;
@@ -14,7 +13,10 @@ import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
-import javax.xml.bind.*;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java b/src/test/java/com/juick/xmpp/extensions/JuickMessage.java
index ae7fc89c..ae7fc89c 100644
--- a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java
+++ b/src/test/java/com/juick/xmpp/extensions/JuickMessage.java
diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java b/src/test/java/com/juick/xmpp/extensions/JuickUser.java
index 08e38c41..08e38c41 100644
--- a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java
+++ b/src/test/java/com/juick/xmpp/extensions/JuickUser.java