Skip to content

Commit

Permalink
parameterize locations for smoke tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Nov 19, 2014
1 parent f88aa40 commit 083558c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

package org.opennms.smoketest;

import java.net.InetSocketAddress;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
Expand All @@ -39,7 +41,8 @@
public class AlarmsPageTest extends OpenNMSSeleniumTestCase {
@BeforeClass
public static void createAlarm() throws Exception {
final EventProxy eventProxy = new TcpEventProxy();

final EventProxy eventProxy = new TcpEventProxy(new InetSocketAddress(OPENNMS_EVENT_HOST, OPENNMS_EVENT_PORT));
final EventBuilder builder = new EventBuilder(EventConstants.IMPORT_FAILED_UEI, "AlarmsPageTest");
builder.setParam("importResource", "foo");
eventProxy.send(builder.getEvent());
Expand Down Expand Up @@ -120,7 +123,7 @@ public void testAlarmIdNotFoundPage() throws InterruptedException {
selenium.open("/opennms/alarm/detail.htm?id=999999999");
waitForText("Alarm ID Not Found");
}

private boolean hasAlarmDetailLink() {
return selenium.isElementPresent("//a[contains(@href,'alarm/detail.htm')]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,30 @@
import com.thoughtworks.selenium.webdriven.WebDriverBackedSelenium;

public class OpenNMSSeleniumTestCase extends SeleneseTestBase {
protected static final long LOAD_TIMEOUT = 60000;
protected static final String BASE_URL = "http://localhost:8980/";
private static final Logger LOG = LoggerFactory.getLogger(OpenNMSSeleniumTestCase.class);

protected static final long LOAD_TIMEOUT = Long.getLong("org.opennms.smoketest.web-timeout", 60000l);
protected static final String OPENNMS_WEB_HOST = System.getProperty("org.opennms.smoketest.web-host", "localhost");
protected static final int OPENNMS_WEB_PORT = Integer.getInteger("org.opennms.smoketest.web-port", 8980);
protected static final String OPENNMS_EVENT_HOST = System.getProperty("org.opennms.smoketest.event-host", OPENNMS_WEB_HOST);
protected static final int OPENNMS_EVENT_PORT = Integer.getInteger("org.opennms.smoketest.event-port", 5817);

protected static final String BASE_URL = "http://" + OPENNMS_WEB_HOST + ":" + OPENNMS_WEB_PORT + "/";

protected static final boolean usePhantomJS = Boolean.getBoolean("org.opennms.smoketest.webdriver.use-phantomjs") || Boolean.getBoolean("smoketest.usePhantomJS");

private WebDriver m_driver = null;
private static final boolean usePhantomJS = Boolean.getBoolean("smoketest.usePhantomJS");

@Before
public void setUp() throws Exception {
final String logLevel = System.getProperty("org.opennms.smoketest.logLevel", "DEBUG");
//ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger) org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
final Logger logger = org.slf4j.LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
if (logger instanceof ch.qos.logback.classic.Logger) {
final ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) logger;
logbackLogger.setLevel(ch.qos.logback.classic.Level.valueOf(logLevel));
}

final String driverClass = System.getProperty("webdriver.class");
final String driverClass = System.getProperty("org.opennms.smoketest.webdriver.class", System.getProperty("webdriver.class"));
if (driverClass != null) {
m_driver = (WebDriver)Class.forName(driverClass).newInstance();
}
Expand Down

0 comments on commit 083558c

Please sign in to comment.