use of com.gargoylesoftware.htmlunit.WebClient in project testcases by coheigea.
the class FederationTest method login.
private static String login(String url, String user, String password, String idpPort) throws IOException {
final WebClient webClient = new WebClient();
webClient.getOptions().setUseInsecureSSL(true);
webClient.getCredentialsProvider().setCredentials(new AuthScope("localhost", Integer.parseInt(idpPort)), new UsernamePasswordCredentials(user, password));
webClient.getOptions().setJavaScriptEnabled(false);
final HtmlPage idpPage = webClient.getPage(url);
webClient.getOptions().setJavaScriptEnabled(true);
Assert.assertEquals("IDP SignIn Response Form", idpPage.getTitleText());
final HtmlForm form = idpPage.getFormByName("signinresponseform");
final HtmlSubmitInput button = form.getInputByName("_eventId_submit");
final XmlPage rpPage = button.click();
return rpPage.asXml();
}
use of com.gargoylesoftware.htmlunit.WebClient in project jackrabbit-oak by apache.
the class TomcatIT method setUp.
protected void setUp() throws Exception {
File war = null;
for (File f : new File("target").listFiles()) {
if (f.isDirectory() && new File(f, "WEB-INF/web.xml").isFile()) {
war = f;
break;
}
}
assertNotNull(war);
rewriteWebXml(war);
File bootstrap = new File("target", "bootstrap.properties");
bootstrap.delete();
File baseDir = new File("target", "tomcat");
FileUtils.deleteQuietly(baseDir);
File repoDir = new File("target", "repository");
FileUtils.deleteQuietly(repoDir);
url = new URL("http://localhost:" + getPort() + "/");
tomcat = new Tomcat();
tomcat.setSilent(true);
tomcat.setBaseDir(baseDir.getPath());
tomcat.setHostname(url.getHost());
tomcat.setPort(url.getPort());
tomcat.addWebapp("", war.getAbsolutePath());
tomcat.start();
client = new WebClient();
}
use of com.gargoylesoftware.htmlunit.WebClient in project archiva by apache.
the class AbstractRepositoryServletTestCase method newClient.
protected static WebClient newClient() {
final WebClient webClient = new WebClient();
webClient.getOptions().setJavaScriptEnabled(false);
webClient.getOptions().setCssEnabled(false);
webClient.getOptions().setAppletEnabled(false);
webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
return webClient;
}
use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class WeldSeBuilderTest method test.
private void test(ServletContextHandler context) throws Exception {
Server server = new Server(8080);
context.setContextPath("/");
server.setHandler(context);
context.addServlet(TestServlet.class, "/test");
server.start();
try {
WebClient webClient = new WebClient();
webClient.setThrowExceptionOnFailingStatusCode(true);
Page page = webClient.getPage("http://localhost:8080/test");
assertEquals("Kitty", page.getWebResponse().getContentAsString().trim());
} finally {
// no need to stop Weld here, it is stopped by weld-servlet
server.stop();
}
}
use of com.gargoylesoftware.htmlunit.WebClient in project core by weld.
the class SimpleAsyncListenerTest method testOnCompleteCalledSuccesfully.
@Test
public void testOnCompleteCalledSuccesfully() throws Exception {
WebClient webClient = new WebClient();
webClient.getPage(getPath(AsyncServlet.TEST_COMPLETE));
Page results = webClient.getPage(contextPath + "Status");
assertTrue(results.getWebResponse().getContentAsString().contains("onComplete: true"));
}
Aggregations