aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/test')
-rw-r--r--juick-www/src/test/java/com/juick/WebAppTests.java19
1 files changed, 9 insertions, 10 deletions
diff --git a/juick-www/src/test/java/com/juick/WebAppTests.java b/juick-www/src/test/java/com/juick/WebAppTests.java
index f644bef8..a9eb6926 100644
--- a/juick-www/src/test/java/com/juick/WebAppTests.java
+++ b/juick-www/src/test/java/com/juick/WebAppTests.java
@@ -23,10 +23,10 @@ import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.css.StyleElement;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.juick.server.CommandsManager;
import com.juick.server.XMPPConnection;
-import com.juick.server.xmpp.router.XMPPRouter;
import com.juick.server.XMPPServer;
-import com.juick.server.configuration.ApiAppConfiguration;
+import com.juick.server.xmpp.router.XMPPRouter;
import com.juick.service.*;
import com.juick.util.MessageUtils;
import com.juick.www.WebApp;
@@ -39,11 +39,9 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
-import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.mock.web.MockMultipartFile;
@@ -76,7 +74,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
*/
@RunWith(SpringRunner.class)
@AutoConfigureMockMvc
-@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {Application.class, XMPPRouter.class})
+@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = {Application.class, XMPPRouter.class, XMPPServer.class, XMPPConnection.class, CommandsManager.class})
public class WebAppTests {
@MockBean
private ImagesService imagesService;
@@ -98,6 +96,12 @@ public class WebAppTests {
private JdbcTemplate jdbcTemplate;
@Inject
private SubscriptionService subscriptionService;
+ @Inject
+ private XMPPServer xmpp;
+ @Inject
+ private XMPPConnection routerConnection;
+ @Inject
+ private XMPPRouter xmppRouter;
@Inject
private PebbleEngine pebbleEngine;
@@ -239,11 +243,6 @@ public class WebAppTests {
}
@Test
public void postMessageTests() throws Exception {
- ConfigurableApplicationContext context = new SpringApplicationBuilder(
- ApiServer.class)
- .properties("server.port=8081")
- .run();
- XMPPServer xmpp = context.getBean(XMPPServer.class);
assertThat(xmpp.getInConnections().size(), is(0));
mockMvc.perform(post("/post2").param("body", "yo")).andExpect(redirectedUrl("http://localhost/login"));
MvcResult loginResult = mockMvc.perform(post("/login")