aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp-wip
diff options
context:
space:
mode:
Diffstat (limited to 'juick-xmpp-wip')
-rw-r--r--juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java13
-rw-r--r--juick-xmpp-wip/src/main/java/com/juick/components/configuration/BotAppConfiguration.java2
-rw-r--r--juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java5
3 files changed, 15 insertions, 5 deletions
diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
index b551ff2b..fa097584 100644
--- a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
+++ b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPBot.java
@@ -37,6 +37,7 @@ import rocks.xmpp.extensions.vcard.temp.model.VCard;
import rocks.xmpp.extensions.version.SoftwareVersionManager;
import rocks.xmpp.extensions.version.model.SoftwareVersion;
+import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
@@ -49,17 +50,21 @@ import java.util.List;
public class XMPPBot implements AutoCloseable, ProtocolListener {
private static final Logger logger = LoggerFactory.getLogger(XMPPBot.class);
@Inject
- UserService userService;
+ private UserService userService;
@Inject
- PMQueriesService pmQueriesService;
+ private PMQueriesService pmQueriesService;
@Inject
- JuickProtocol juickProtocol;
+ private JuickProtocol juickProtocol;
+ @Inject
+ private Environment env;
Jid juickJid;
private ExternalComponent component;
- public XMPPBot(Environment env) {
+ @PostConstruct
+ @Inject
+ public void init() {
component = ExternalComponent.create(env.getProperty("component_name", "juick.com"),
env.getProperty("component_password", "secret"), env.getProperty("component_host", "localhost"),
NumberUtils.toInt(env.getProperty("component_port", "5347"), 5347));
diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/configuration/BotAppConfiguration.java b/juick-xmpp-wip/src/main/java/com/juick/components/configuration/BotAppConfiguration.java
index 7009f2b7..1de0a696 100644
--- a/juick-xmpp-wip/src/main/java/com/juick/components/configuration/BotAppConfiguration.java
+++ b/juick-xmpp-wip/src/main/java/com/juick/components/configuration/BotAppConfiguration.java
@@ -39,7 +39,7 @@ public class BotAppConfiguration extends WebMvcConfigurationSupport {
@Bean
public XMPPBot xmpp() {
- return new XMPPBot(env);
+ return new XMPPBot();
}
@Bean
public JuickProtocol juickProtocol() {
diff --git a/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java b/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java
index e513c5e7..971e849a 100644
--- a/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java
+++ b/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java
@@ -23,6 +23,7 @@ import com.juick.components.XMPPRouter;
import com.juick.components.configuration.XmppAppConfiguration;
import com.juick.configuration.MockDataConfiguration;
import com.juick.server.configuration.BaseWebConfiguration;
+import com.juick.service.PrivacyQueriesService;
import com.juick.service.ShowQueriesService;
import org.junit.Before;
import org.junit.Test;
@@ -65,6 +66,10 @@ public class XMPPTests {
public ShowQueriesService showQueriesService() {
return Mockito.mock(ShowQueriesService.class);
}
+ @Bean
+ public PrivacyQueriesService privacyQueriesService() {
+ return Mockito.mock(PrivacyQueriesService.class);
+ }
}
@Inject