@BeforeClass public static void setUpBeforeClass() throws Exception { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); jmxPropertiesFile = classLoader.getResource("test.properties").getPath(); path = getPulseWarPath(); server = Server.createServer(9999, jmxPropertiesFile); String host = "localhost"; // InetAddress.getLocalHost().getHostAddress(); int port = 8080; String context = "/pulse"; jetty = JettyHelper.initJetty(host, port, false, false, null, null, null); JettyHelper.addWebApplication(jetty, context, getPulseWarPath()); jetty.start(); pulseURL = "http://" + host + ":" + port + context; Thread.sleep(5000); // wait till the container settles down driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); driver.get(pulseURL); WebElement userNameElement = driver.findElement(By.id("user_name")); WebElement passwordElement = driver.findElement(By.id("user_password")); userNameElement.sendKeys(userName); passwordElement.sendKeys(pasword); passwordElement.submit(); Thread.sleep(3000); WebElement userNameOnPulsePage = (new WebDriverWait(driver, 10)) .until( new ExpectedCondition<WebElement>() { @Override public WebElement apply(WebDriver d) { return d.findElement(By.id("userName")); } }); Assert.assertNotNull(userNameOnPulsePage); driver.navigate().refresh(); Thread.sleep(7000); }
public static void main(final String... args) throws Exception { if (args.length > 1) { System.out.printf("Temporary Directory @ ($1%s)%n", USER_DIR); final Server jetty = JettyHelper.initJetty(null, 8090, false, false, null, null, null); for (int index = 0; index < args.length; index += 2) { final String webAppContext = args[index]; final String webAppArchivePath = args[index + 1]; JettyHelper.addWebApplication( jetty, normalizeWebAppContext(webAppContext), normalizeWebAppArchivePath(webAppArchivePath)); } JettyHelper.startJetty(jetty); latch.await(); } else { System.out.printf( "usage:%n>java com.gemstone.gemfire.management.internal.TomcatHelper <web-app-context> <war-file-path> [<web-app-context> <war-file-path>]*"); } }