@Test(groups = INTEGRATION) @SpecAssertion(section = APPLICATION_CONTEXT_EE, id = "aa") public void testApplicationScopeActiveDuringServiceMethod() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "TestServlet?test=servlet"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = APPLICATION_CONTEXT_EE, id = "af") public void testApplicationScopeActiveDuringServletRequestListenerInvocation() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "TestServlet?test=servletRequestListener"); }
@Test(groups = { "contexts", "servlet", "integration" }) @SpecAssertion(section = "6.7.2", id = "ab") public void testSessionScopeActiveDuringDoFilterMethod() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(getContextPath() + "SimplePage.html"); }
@Test(groups = {INTEGRATION, ASYNC_SERVLET}) @SpecAssertion(section = APPLICATION_CONTEXT_EE, id = "ae") public void testApplicationContextActiveOnTimeout() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(false); webClient.getPage(getPath(AsyncServlet.TEST_TIMEOUT)); TextPage results = webClient.getPage(contextPath + "Status"); assertTrue(results.getContent().contains("onTimeout: true")); }
@Test(groups = {INTEGRATION, ASYNC_SERVLET}) @SpecAssertion(section = REQUEST_CONTEXT_EE, id = "ad") public void testRequestContextActiveOnError() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(false); webClient.getPage(getPath(AsyncServlet.TEST_ERROR)); TextPage results = webClient.getPage(contextPath + "Status"); assertTrue(results.getContent().contains("onError: true")); }
@Test @SpecAssertion(section = "5.5.2", id = "aj") public void testServletListenerInitializerMethodCalled() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(getContextPath() + "Test/ServletListener?test=initializer"); }
@Test @SpecAssertion(section = "5.5.2", id="at") public void testTagLibraryListenerInitializerMethodCalled() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(getContextPath() + "Test/TagLibraryListener?test=initializer"); }
@Test(groups = { "contexts", "integration" }) @SpecAssertion(section = "6.7.3", id = "ac") public void testApplicationScopeActiveDuringServletContextListenerInvocation() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(getContextPath() + "TestServlet?test=servletContextListener"); }
@Test(groups = { "contexts", "integration" }) @SpecAssertion(section = "6.7.3", id = "af") public void testApplicationScopeActiveDuringServletRequestListenerInvocation() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(getContextPath() + "TestServlet?test=servletRequestListener"); }
/** * The request scope is active during the service() method of any Servlet in the web application. */ @Test @SpecAssertion(section = REQUEST_CONTEXT_EE, id = "aa") @SpecAssertion(section = REQUEST_CONTEXT_EE, id = "ac") public void testRequestScopeActiveDuringServiceMethod() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "test"); }
@Test(groups = INTEGRATION) @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "br") public void testFilterInitCalledAfterResourceInjection() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "TestFilter?test=resource"); webClient.getPage(contextPath + "TestFilter?test=ejb"); }
@Test(groups = INTEGRATION) @SpecAssertions({ @SpecAssertion(section = SESSION_CONTEXT_EE, id = "aa"), @SpecAssertion(section = SESSION_CONTEXT_EE, id = "ae") }) public void testSessionScopeActiveDuringServiceMethod() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "test"); }
@Test(groups = INTEGRATION) @SpecAssertions({ @SpecAssertion(section = INJECTION, id = "d"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "au"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "av"), @SpecAssertion(section = INJECTED_FIELDS_EE, id = "b") }) public void testInjectionIntoJSFManagedBean() throws Exception { WebClient webclient = new WebClient(); webclient.setThrowExceptionOnFailingStatusCode(true); String content = webclient.getPage(contextPath + "ManagedBeanTestPage.jsf").getWebResponse().getContentAsString(); assert content.contains("Injection works"); assert content.contains("Initializer works"); } }
WebClient client = new WebClient(BrowserVersion.FIREFOX_3_6); client.setTimeout(60000); client.setRedirectEnabled(true); client.setJavaScriptEnabled(true); client.setThrowExceptionOnFailingStatusCode(false); client.setThrowExceptionOnScriptError(false); client.setCssEnabled(false); client.setUseInsecureSSL(true);
@Test(groups = INTEGRATION) @SpecAssertions({ @SpecAssertion(section = INJECTION_EE, id = "ec"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "as"), @SpecAssertion(section = INJECTED_FIELDS_EE, id = "b") }) public void testInjectionIntoTagLibraryListener() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "Test/TagLibraryListener?test=injection"); }
@Test(groups = INTEGRATION) @SpecAssertions({ @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "ah"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "bp"), @SpecAssertion(section = INITIALIZER_METHODS_EE, id = "b") }) public void testFilterInitializerMethodCalled() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "TestFilter?test=initializer"); }
@Test(groups = INTEGRATION) @SpecAssertions({ @SpecAssertion(section = INJECTION_EE, id = "ea"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "ai"), @SpecAssertion(section = INJECTED_FIELDS_EE, id = "b") }) public void testInjectionIntoServletListener() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "Test/ServletListener?test=injection"); }
@Test @SpecAssertions( { @SpecAssertion(section = "5.5", id = "eg"), @SpecAssertion(section = "5.5.2", id = "ag"), @SpecAssertion(section = "5.5.2", id = "bq") }) public void testInjectionIntoFilter() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(getContextPath() + "TestFilter?test=injection"); }
@Test(groups = INTEGRATION) @SpecAssertions({ @SpecAssertion(section = INJECTION_EE, id = "eg"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "ag"), @SpecAssertion(section = FIELDS_INITIALIZER_METHODS_EE, id = "bq"), @SpecAssertion(section = INJECTED_FIELDS_EE, id = "b") }) public void testInjectionIntoFilter() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(true); webClient.getPage(contextPath + "TestFilter?test=injection"); }
@Test @Ignore //enable when WELD-1774 is fixed public void testOnErrorCalledSuccesfully() throws Exception { WebClient webClient = new WebClient(); webClient.setThrowExceptionOnFailingStatusCode(false); webClient.getPage(getPath(AsyncServlet.TEST_ERROR)); Page results = webClient.getPage(contextPath + "Status"); assertTrue(results.getWebResponse().getContentAsString(), results.getWebResponse().getContentAsString().contains("onError: true")); }