diff options
author | Vitaly Takmazov | 2018-04-02 16:47:02 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-02 16:47:02 +0300 |
commit | 5b5ca32a22e2e8e95c9bca86ce23d19c4a69f83d (patch) | |
tree | b65bd56a0a7fdd59ced863e4a0063ed6510840c0 /juick-www/src/test/java/com/juick/WebAppTests.java | |
parent | 22ee9166d87a9b6a853c25c5f2bb3ff95aacad35 (diff) |
xmpp: move to library project
Diffstat (limited to 'juick-www/src/test/java/com/juick/WebAppTests.java')
-rw-r--r-- | juick-www/src/test/java/com/juick/WebAppTests.java | 19 |
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") |