diff options
author | Vitaly Takmazov | 2017-10-09 15:27:48 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-10-10 09:37:31 +0300 |
commit | 448fc7e84732422011186a9a4633c345e9c6208e (patch) | |
tree | 7ec23a9f29939fecf6456956ead6cebd1338871d /juick-xmpp/src/test/java/com/juick/xmpp/server | |
parent | 443daa747298de315840cdd6ee6992519707e61a (diff) |
xmpp:ConnectionOut -> StreamServerDialback
Diffstat (limited to 'juick-xmpp/src/test/java/com/juick/xmpp/server')
-rw-r--r-- | juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java b/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java new file mode 100644 index 00000000..99264613 --- /dev/null +++ b/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java @@ -0,0 +1,52 @@ +package com.juick.xmpp.server; + +import com.juick.components.XMPPServer; +import com.juick.components.configuration.XmppAppConfiguration; +import com.juick.configuration.MockDataConfiguration; +import com.juick.server.configuration.BaseWebConfiguration; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; + +import javax.inject.Inject; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@RunWith(SpringJUnit4ClassRunner.class) +@WebAppConfiguration +@ContextConfiguration +public class XMPPServerTests { + @Configuration + @Import(value = { + BaseWebConfiguration.class, XmppAppConfiguration.class, MockDataConfiguration.class + }) + static class Config { } + + @Inject + private WebApplicationContext wac; + @Inject + private XMPPServer server; + + private MockMvc mockMvc; + + @Before + public void setup() { + mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); + } + @Test + public void statusPageIsUp() throws Exception { + mockMvc.perform(get("http://localhost:8080/status")).andExpect(status().isOk()); + assertThat(server.getJid().toEscapedString(), equalTo("juick.com")); + } +} |