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 | |
parent | 22ee9166d87a9b6a853c25c5f2bb3ff95aacad35 (diff) |
xmpp: move to library project
Diffstat (limited to 'juick-www')
-rw-r--r-- | juick-www/build.gradle | 2 | ||||
-rw-r--r-- | juick-www/src/main/java/com/juick/Application.java | 1 | ||||
-rw-r--r-- | juick-www/src/test/java/com/juick/WebAppTests.java | 19 |
3 files changed, 10 insertions, 12 deletions
diff --git a/juick-www/build.gradle b/juick-www/build.gradle index 5cad742f..cf7da5bd 100644 --- a/juick-www/build.gradle +++ b/juick-www/build.gradle @@ -23,7 +23,7 @@ apply plugin: 'org.springframework.boot' dependencies { compile project(':juick-server-jdbc') - providedCompile project(':juick-server') + providedCompile project(':juick-server-xmpp') compile 'com.github.ben-manes.caffeine:caffeine:2.6.2' compile("org.springframework.boot:spring-boot-starter-cache") compile ('org.springframework.boot:spring-boot-starter-security') diff --git a/juick-www/src/main/java/com/juick/Application.java b/juick-www/src/main/java/com/juick/Application.java index a7a7a654..cb132ae9 100644 --- a/juick-www/src/main/java/com/juick/Application.java +++ b/juick-www/src/main/java/com/juick/Application.java @@ -5,7 +5,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Primary; import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication 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") |