Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .idea/libraries/Maven__cglib_cglib_nodep_2_1_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__io_netty_netty_3_5_2_Final.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__junit_junit_4_11.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__log4j_log4j_1_2_17.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_hamcrest_hamcrest_all_1_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_w3c_css_sac_1_3.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_webbitserver_webbit_0_4_14.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__xerces_xercesImpl_2_11_0.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__xml_apis_xml_apis_1_4_01.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Config>
<BASE_URL>http://localhost:8080/bodgeit/</BASE_URL>
<LOGOUT_URL>http://localhost:8080/bodgeit/logout.jsp</LOGOUT_URL>
</Config>
37 changes: 37 additions & 0 deletions src/main/java/net/continuumsecurity/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package net.continuumsecurity;

import org.w3c.dom.Document;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import org.apache.log4j.Logger;


public class Config {
static Logger log = Logger.getLogger(Config.class.getName());

private File XmlFile = new File("Config.xml");
private Document doc;

public Config() {
try {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
doc = dBuilder.parse(XmlFile);
doc.getDocumentElement().normalize();
} catch (Exception e) {
log.info(e);
}
}

public String GetNodeByName(String nodeName) {
try {
return doc.getElementsByTagName(nodeName).item(0).getTextContent();
}
catch (Exception e){
log.info(String.format("Can't find node by nodeName: [%1$]", nodeName));
return null;
}
}
}
11 changes: 8 additions & 3 deletions src/main/java/net/continuumsecurity/MyAppNavigation.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@

import java.util.concurrent.TimeUnit;


public class MyAppNavigation {
private Config config;

WebDriver driver;
final static String BASE_URL = "http://localhost:8080/bodgeit/";
final static String LOGOUT_URL = "http://localhost:8080/bodgeit/logout.jsp";
String BASE_URL;
String LOGOUT_URL;
final static String USERNAME = "[email protected]";
final static String PASSWORD = "tables";

public MyAppNavigation(WebDriver driver) {
this.driver = driver;
this.driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS);
this.driver.manage().timeouts().implicitlyWait(5,TimeUnit.SECONDS);

config = new Config();
BASE_URL = config.GetNodeByName("BASE_URL");
LOGOUT_URL = config.GetNodeByName("LOGOUT_URL");
}

public void login() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/continuumsecurity/ZapScanTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ZapScanTest {
private final static String ZAP_APIKEY = null;

// Change this to the appropriate driver for the OS, alternatives in the drivers directory
private final static String CHROME_DRIVER_PATH = "drivers/chromedriver-mac";
private final static String CHROME_DRIVER_PATH = "drivers/chromedriver.exe";
private final static String MEDIUM = "MEDIUM";
private final static String HIGH = "HIGH";
private ScanningProxy zapScanner;
Expand Down
Binary file added target/classes/net/continuumsecurity/Config.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
8 changes: 8 additions & 0 deletions target/test-classes/log4j.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
log4j.rootLogger=INFO, console

#console appender
log4j.appender.console=org.apache.log4j.ConsoleAppender

#define patternlayour for console appender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n
Binary file not shown.
1 change: 0 additions & 1 deletion zap-webdriver.iml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
Expand Down