Index: TestHarness4LAMS2/.classpath
===================================================================
diff -u -r41955af92f3e17f2f11c07d94ae1a5f92b0d998f -r457bede6fb8b69e25fa9a899ed66a32407bf80e9
--- TestHarness4LAMS2/.classpath (.../.classpath) (revision 41955af92f3e17f2f11c07d94ae1a5f92b0d998f)
+++ TestHarness4LAMS2/.classpath (.../.classpath) (revision 457bede6fb8b69e25fa9a899ed66a32407bf80e9)
@@ -1,7 +1,6 @@
-
@@ -14,5 +13,6 @@
+
Index: TestHarness4LAMS2/build.xml
===================================================================
diff -u -r41955af92f3e17f2f11c07d94ae1a5f92b0d998f -r457bede6fb8b69e25fa9a899ed66a32407bf80e9
--- TestHarness4LAMS2/build.xml (.../build.xml) (revision 41955af92f3e17f2f11c07d94ae1a5f92b0d998f)
+++ TestHarness4LAMS2/build.xml (.../build.xml) (revision 457bede6fb8b69e25fa9a899ed66a32407bf80e9)
@@ -16,7 +16,7 @@
+ debug="on" source="1.6" target="1.6" includeantruntime="false" >
Index: TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java
===================================================================
diff -u -r41955af92f3e17f2f11c07d94ae1a5f92b0d998f -r457bede6fb8b69e25fa9a899ed66a32407bf80e9
--- TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java (.../Call.java) (revision 41955af92f3e17f2f11c07d94ae1a5f92b0d998f)
+++ TestHarness4LAMS2/src/org/lamsfoundation/testharness/Call.java (.../Call.java) (revision 457bede6fb8b69e25fa9a899ed66a32407bf80e9)
@@ -23,9 +23,19 @@
package org.lamsfoundation.testharness;
import java.io.InputStream;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.util.Date;
+import javax.net.ssl.KeyManager;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+
import org.apache.log4j.Logger;
import com.meterware.httpunit.GetMethodWebRequest;
@@ -35,10 +45,13 @@
import com.meterware.httpunit.WebForm;
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
+import com.sun.net.ssl.HostnameVerifier;
+import com.sun.net.ssl.HttpsURLConnection;
/**
* @author Fei Yang, Marcin Cieslak
*/
+@SuppressWarnings("deprecation")
public class Call {
static class CallRecord {
@@ -100,15 +113,51 @@
}
private static final Logger log = Logger.getLogger(Call.class);
+
private WebConversation wc;
private AbstractTest test;
private String description;
private String url;
private WebForm form;
private InputStream is;
-
private String contentType; // for WEB POST method
+ static {
+
+ TrustManager defaultTrustManager = new X509TrustManager() {
+ @Override
+ public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException {
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ };
+
+ try {
+ SSLContext ctx = SSLContext.getInstance("TLS");
+ ctx.init(new KeyManager[0], new TrustManager[] { defaultTrustManager }, new SecureRandom());
+ SSLContext.setDefault(ctx);
+
+ HostnameVerifier hv = new HostnameVerifier() {
+ @Override
+ public boolean verify(String urlHostName, String other) {
+ return true;
+ }
+ };
+ HttpsURLConnection.setDefaultHostnameVerifier(hv);
+ } catch (NoSuchAlgorithmException e) {
+ Call.log.error("Error while setting Trust Manager", e);
+ } catch (KeyManagementException e) {
+ Call.log.error("Error while setting Trust Manager", e);
+ }
+ }
+
public Call(WebConversation wc, AbstractTest test, String description, String url) {
this.wc = wc;
this.test = test;
@@ -236,18 +285,17 @@
}
private String getAbsoluteURL(String url) {
- if (url.startsWith("http://")) {
+ if (url.startsWith("http")) {
return url;
}
String withSlash = url.startsWith("/") ? url : "/" + url;
String context = url.startsWith(test.getTestSuite().getContextRoot()) ? "" : test.getTestSuite()
.getContextRoot();
- if (test.getTestSuite().getHttpPort() != 80) {
- return "http://" + test.getTestSuite().getTargetServer() + ":" + test.getTestSuite().getHttpPort()
- + context + withSlash;
- } else {
- return "http://" + test.getTestSuite().getTargetServer() + context + withSlash;
+ String targetServer = test.getTestSuite().getTargetServer();
+ if (!targetServer.startsWith("http")) {
+ targetServer = "http://" + targetServer;
}
+ return targetServer + context + withSlash;
}
}
\ No newline at end of file
Index: TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestManager.java
===================================================================
diff -u -r41955af92f3e17f2f11c07d94ae1a5f92b0d998f -r457bede6fb8b69e25fa9a899ed66a32407bf80e9
--- TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestManager.java (.../TestManager.java) (revision 41955af92f3e17f2f11c07d94ae1a5f92b0d998f)
+++ TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestManager.java (.../TestManager.java) (revision 457bede6fb8b69e25fa9a899ed66a32407bf80e9)
@@ -59,7 +59,6 @@
private static final String NUMBER_OF_TEST_SUITES = "NumberOfTestSuites";
private static final String TARGET_SERVER = "TargetServer";
private static final String CONTEXT_ROOT = "ContextRoot";
- private static final String HTTP_PORT = "HttpPort";
private static final String ADMIN_PROPERTY_FILE = "AdminTestPropertyFile";
private static final String AUTHOR_PROPERTY_FILE = "AuthorTestPropertyFile";
private static final String MONITOR_PROPERTY_FILE = "MonitorTestPropertyFile";
@@ -306,7 +305,7 @@
LearnerTest test = new LearnerTest(testName, minDelay, maxDelay, getLessonURL, getLearningDesignURL,
joinLessonURL, getProgressURL, lessonEntryURL, filesToUpload == null ? null : filesToUpload.split(";"));
-
+
if (userIdOffset != null) {
userIdOffset--;
}
@@ -376,8 +375,6 @@
TestManager.buildPropertyKey(TestManager.TARGET_SERVER, suiteIndex), true);
String contextRoot = TestManager.getStringProperty(testPropertyFileName, testProperties,
TestManager.buildPropertyKey(TestManager.CONTEXT_ROOT, suiteIndex), true);
- Integer httpPort = TestManager.getIntegerProperty(testPropertyFileName, testProperties,
- TestManager.buildPropertyKey(TestManager.HTTP_PORT, suiteIndex), true);
String adminTestPropertyFileName = TestManager.getStringProperty(testPropertyFileName, testProperties,
TestManager.buildPropertyKey(TestManager.ADMIN_PROPERTY_FILE, suiteIndex), true);
AdminTest adminTest = adminTestPropertyFileName == null ? null : createAdminTest(adminTestPropertyFileName);
@@ -394,7 +391,7 @@
LearnerTest learnerTest = learnerTestPropertyFileName == null ? null
: createLearnerTest(learnerTestPropertyFileName);
- TestSuite suite = new TestSuite(this, suiteIndex, targetServer, contextRoot, httpPort, adminTest, authorTest,
+ TestSuite suite = new TestSuite(this, suiteIndex, targetServer, contextRoot, adminTest, authorTest,
monitorTest, learnerTest);
TestManager.log.info("Finished creating test suite " + suite.toString());
Index: TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestSuite.java
===================================================================
diff -u -r41955af92f3e17f2f11c07d94ae1a5f92b0d998f -r457bede6fb8b69e25fa9a899ed66a32407bf80e9
--- TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestSuite.java (.../TestSuite.java) (revision 41955af92f3e17f2f11c07d94ae1a5f92b0d998f)
+++ TestHarness4LAMS2/src/org/lamsfoundation/testharness/TestSuite.java (.../TestSuite.java) (revision 457bede6fb8b69e25fa9a899ed66a32407bf80e9)
@@ -41,20 +41,18 @@
private int suiteIndex;
private String targetServer;
private String contextRoot;
- private Integer httpPort;
private AdminTest adminTest;
private AuthorTest authorTest;
private MonitorTest monitorTest;
private LearnerTest learnerTest;
private boolean finished = false;
- public TestSuite(TestManager manager, int suiteIndex, String targetServer, String contextRoot, Integer httpPort,
+ public TestSuite(TestManager manager, int suiteIndex, String targetServer, String contextRoot,
AdminTest adminTest, AuthorTest authorTest, MonitorTest monitorTest, LearnerTest learnerTest) {
this.manager = manager;
this.suiteIndex = suiteIndex;
this.targetServer = targetServer == null ? "localhost" : targetServer;
this.contextRoot = (contextRoot == null) || contextRoot.equals("/") ? "" : contextRoot;
- this.httpPort = httpPort == null ? 80 : httpPort;
this.adminTest = adminTest;
adminTest.setTestSuite(this);
@@ -85,13 +83,6 @@
}
/**
- * @return Returns the httpPort.
- */
- public final int getHttpPort() {
- return httpPort;
- }
-
- /**
* @return Returns the learnerTest.
*/
public final LearnerTest getLearnerTest() {
Index: TestHarness4LAMS2/test.properties
===================================================================
diff -u -re893e1cd8139e463fcc451988a5123b5c3e95cbd -r457bede6fb8b69e25fa9a899ed66a32407bf80e9
--- TestHarness4LAMS2/test.properties (.../test.properties) (revision e893e1cd8139e463fcc451988a5123b5c3e95cbd)
+++ TestHarness4LAMS2/test.properties (.../test.properties) (revision 457bede6fb8b69e25fa9a899ed66a32407bf80e9)
@@ -22,7 +22,6 @@
# Each test suite definition typically involves:
# one TargetServer.,
# one ContextRoot.,
-# one RMIRegistryServicePort.,
# one HttpPort.,
# one AdminTestPropertyFile.,
# one AuthorTestPropertyFile.,
@@ -37,7 +36,6 @@
#
# TargetServer.1=saturn.melcoe.mq.edu.au
# ContextRoot.1=/lams
-# RMIRegistryServicePort.1=12345
# HttpPort.1=8080
# AdminTestPropertyFile.1=adminTest1.properties
# AuthorTestPropertyFile.1=authorTest1.properties
@@ -46,7 +44,6 @@
#
# TargetServer.2=lams.melcoe.mq.edu.au
# ContextRoot.2=/
-# RMIRegistryServicePort.2=54321
# HttpPort.2=1080
# MonitorTestPropertyFile.2=monitorTest2.properties
# LearnerTestPropertyFile.2=learnerTest2.properties
@@ -60,8 +57,9 @@
#---------------------------------------------------------
# if TargetServer is not specified, localhost will be used.
+# Target server must include protocol and port, if custom.
#---------------------------------------------------------
-# TargetServer.1=shaun.melcoe.mq.edu.au
+# TargetServer.1=https://shaun.melcoe.mq.edu.au:8443
#----------------------------------------------------------
# LAMS central web application context root
@@ -75,18 +73,7 @@
#----------------------------------------------------------
ContextRoot.1=/lams
-#--------------------------------------------------------------
-# if RMIRegistryServicePort is not specified, 1099 will be used.
-#--------------------------------------------------------------
-# RMIRegistryServicePort.1=12345
-
-#--------------------------------------------------------------
-# if HttpPort is not specified, 80 will be used.
-#--------------------------------------------------------------
-HttpPort.1=8080
-
AdminTestPropertyFile.1=adminTest1.properties
AuthorTestPropertyFile.1=authorTest1.properties
MonitorTestPropertyFile.1=monitorTest1.properties
-LearnerTestPropertyFile.1=learnerTest1.properties
-
+LearnerTestPropertyFile.1=learnerTest1.properties
\ No newline at end of file