diff options
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") |