aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-03 12:57:07 +0300
committerGravatar Vitaly Takmazov2018-04-03 12:57:07 +0300
commit2df2c62ff29a61ef6c03ce162f90eeafa2beb5e9 (patch)
tree32a6492067898c77c9c72383feec0a77f8b08e3b
parentd2af7ac0bbdde07e0f0f8b68c56f370ed3c06fe6 (diff)
xmpp is autoconfigured now
-rw-r--r--juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java21
-rw-r--r--juick-server/src/test/java/com/juick/server/tests/ServerTests.java2
-rw-r--r--juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java7
3 files changed, 11 insertions, 19 deletions
diff --git a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
index b1fff9fd..3538077a 100644
--- a/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
+++ b/juick-server-xmpp/src/main/java/com/juick/server/XMPPConnection.java
@@ -104,8 +104,6 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
private int componentPort;
@Value("${xmpp_password:secret}")
private String password;
- @Value("${xmpp_disabled:false}")
- private boolean isXmppDisabled;
@Value("${upload_tmp_dir:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
private String tmpDir;
@Value("${img_path:#{systemEnvironment['TEMP'] ?: '/tmp'}}")
@@ -284,17 +282,14 @@ public class XMPPConnection implements StanzaListener, NotificationListener {
logger.info("component connected");
}
});
- if (!isXmppDisabled) {
- service.submit(() -> {
- try {
- Thread.sleep(3000);
- router.connect();
- broadcastPresence(null);
- } catch (InterruptedException | XmppException e) {
- logger.warn("xmpp exception", e);
- }
- });
- }
+ service.submit(() -> {
+ try {
+ router.connect();
+ broadcastPresence(null);
+ } catch (XmppException e) {
+ logger.warn("xmpp exception", e);
+ }
+ });
}
private String stanzaToString(Stanza stanza) throws XMLStreamException, JAXBException {
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 97c10380..28f7c645 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
@@ -83,7 +83,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
-@TestPropertySource(properties = {"broken_ssl_hosts=localhost,serverstorageisfull.tld", "xmpp_disabled=true"})
+@TestPropertySource(properties = {"broken_ssl_hosts=localhost,serverstorageisfull.tld"})
@AutoConfigureMockMvc
public class ServerTests {
diff --git a/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java
index c8efc9e9..8afddf2d 100644
--- a/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java
+++ b/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java
@@ -24,8 +24,6 @@ public class XMPPConfiguration {
private String xmppJid;
@Value("${xmpp_port:5347}")
private int xmppPort;
- @Value("${xmpp_disabled:false}")
- private boolean isXmppDisabled;
@Bean
@ConditionalOnMissingBean(type = "rocks.xmpp.extensions.component.accept.ExternalComponent")
public ExternalComponent xmpp() {
@@ -35,10 +33,9 @@ public class XMPPConfiguration {
.build();
ExternalComponent xmpp = ExternalComponent.create(xmppJid, xmppPassword, configuration, xmppHost, xmppPort);
xmpp.addConnectionListener(e -> logger.error(e.toString(), e.getCause()));
- if (!isXmppDisabled) try {
- Thread.sleep(3000);
+ try {
xmpp.connect();
- } catch (XmppException | InterruptedException e) {
+ } catch (XmppException e) {
logger.error("xmpp extension", e);
}
return xmpp;