diff --git a/framework/testtools/build.xml b/framework/testtools/build.xml
index db7707d8ac..dc070c48fd 100644
--- a/framework/testtools/build.xml
+++ b/framework/testtools/build.xml
@@ -32,8 +32,8 @@ under the License.
-
+
@@ -45,7 +45,12 @@ under the License.
+
+
+
+
+
@@ -58,10 +63,34 @@ under the License.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/framework/testtools/config/seleniumXml.properties b/framework/testtools/config/seleniumXml.properties
index 8cc918d10f..86de10698c 100644
--- a/framework/testtools/config/seleniumXml.properties
+++ b/framework/testtools/config/seleniumXml.properties
@@ -1,5 +1,5 @@
serverHost=localhost
proxyPort=4444
-browser=*firefox /usr/lib/firefox-3.0.14/firefox
+browser=*firefox /usr/lib/firefox-3.0.8/firefox
startUrl=http://localhost:8080/
log4jFile=./config/log4j.properties
\ No newline at end of file
diff --git a/framework/testtools/runSeleniumServer.bat b/framework/testtools/runSeleniumServer.bat
index 4025d39f51..594526350c 100644
--- a/framework/testtools/runSeleniumServer.bat
+++ b/framework/testtools/runSeleniumServer.bat
@@ -1 +1 @@
-java -jar ../../framework/testtools/lib/selenium-server.jar -timeout 240
+java -jar ../../framework/testtools/lib/selenium-server.jar -firefoxProfileTemplate ./config/firefox_profile -timeout 240
diff --git a/framework/testtools/runSeleniumServer.sh b/framework/testtools/runSeleniumServer.sh
index 50b5bc53b4..f59f1d720c 100755
--- a/framework/testtools/runSeleniumServer.sh
+++ b/framework/testtools/runSeleniumServer.sh
@@ -6,6 +6,5 @@ else
JAVA=java
fi
-"$JAVA" -jar ../../framework/testtools/lib/selenium-server.jar -singleWindow -trustAllSSLCertificates -timeout 240
-exit 0
-
+#"$JAVA" -jar ../../framework/testtools/lib/selenium-server.jar -firefoxProfileTemplate ./config/firefox_profile -singleWindow -trustAllSSLCertificates -timeout 240
+"$JAVA" -jar ../../framework/testtools/lib/selenium-server.jar -singleWindow -timeout 240
diff --git a/framework/testtools/runSeleniumXml.bat b/framework/testtools/runSeleniumXml.bat
index ed4dc0e227..4508faac7f 100644
--- a/framework/testtools/runSeleniumXml.bat
+++ b/framework/testtools/runSeleniumXml.bat
@@ -8,6 +8,8 @@ set CP=%CP%;%OFBIZ_HOME%/framework/base/lib/scripting/jython-nooro.jar
set CP=%CP%;%OFBIZ_HOME%/framework/base/lib/junit.jar
set CP=%CP%;%OFBIZ_HOME%/framework/base/lib/commons/commons-lang-2.3.jar
set CP=%CP%;%OFBIZ_HOME%/framework/base/lib/log4j-1.2.15.jar
+set CP=%CP%;%OFBIZ_HOME%/framework/base/lib/javolution-5.2.3.jar
+set CP=%CP%;%OFBIZ_HOME%/framework/base/build/lib/ofbiz-base.jar
echo %CP%
diff --git a/framework/testtools/runSeleniumXml.sh b/framework/testtools/runSeleniumXml.sh
index a0e7adea96..70a0515ddc 100755
--- a/framework/testtools/runSeleniumXml.sh
+++ b/framework/testtools/runSeleniumXml.sh
@@ -10,6 +10,7 @@ export CP=$CP:$OFBIZ_HOME/framework/base/lib/junit.jar
export CP=$CP:$OFBIZ_HOME/framework/base/lib/commons/commons-lang-2.3.jar
export CP=$CP:$OFBIZ_HOME/framework/base/lib/log4j-1.2.15.jar
export CP=$CP:$OFBIZ_HOME/framework/base/lib/javolution-5.2.3.jar
+export CP=$CP:$OFBIZ_HOME/framework/base/build/lib/ofbiz-base.jar
echo $CP
diff --git a/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java b/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java
index 11019f6b8c..2101337336 100644
--- a/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java
+++ b/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java
@@ -30,150 +30,150 @@ import net.sf.json.JSONObject;
public class VerifySeleniumSetups {
- public static final String module = VerifySeleniumSetups.class.getName();
- private static int currentValue = 0;
- private static int contentLength = 0;
- private static Map josonMap = null;
- private static String urlSite = "http://downloads.sourceforge.net/seleniumxml/selenium-server-1.0-SNAPSHOT-20081126.jar?use_mirror=";
- private static String libPath = "framework/testtools/lib/selenium-server.jar";
+ public static final String module = VerifySeleniumSetups.class.getName();
+ private static int currentValue = 0;
+ private static int contentLength = 0;
+ private static Map josonMap = null;
+ private static String urlSite = "http://downloads.sourceforge.net/seleniumxml/selenium-server-1.0-SNAPSHOT-20081126.jar?use_mirror=";
+ private static String libPath = "framework/testtools/lib/selenium-server.jar";
- public VerifySeleniumSetups(){
+ public VerifySeleniumSetups(){
- }
+ }
- /* prepare lib for selenium test
- * Check & download selenium-server.jar from http://downloads.sourceforge.net/seleniumxml/selenium-server-1.0-SNAPSHOT-20081126.jar?use_mirror=
- * Check a change use HTTP as the default at file framework/webapp/config/url.properties
- * Check correct the config/seleniumXml.properties and firefox path
- */
+ /* prepare lib for selenium test
+ * Check & download selenium-server.jar from http://downloads.sourceforge.net/seleniumxml/selenium-server-1.0-SNAPSHOT-20081126.jar?use_mirror=
+ * Check a change use HTTP as the default at file framework/webapp/config/url.properties
+ * Check correct the config/seleniumXml.properties and firefox path
+ */
- public static String verifyConfig(HttpServletRequest request, HttpServletResponse response){
- boolean lib = false;
- boolean urlset = false;
- Map msgMap = FastMap.newInstance();
- Properties urlProps = null;
- try{
- /* Check and down load selenium-server.jar */
- File file = new File(libPath);
- URL url = new URL(urlSite);
- URLConnection connection = url.openConnection();
- contentLength = connection.getContentLength();
- if(contentLength == -1){
- request.setAttribute("_ERROR_MESSAGE_", "can not conect to the internet");
- }
- Debug.log("file size. "+contentLength,module);
- if(file.exists()){
- if(contentLength == file.length()){
- lib = true;
- }else lib = false;
- }
- msgMap.put("LIBFLAG",lib);
+ public static String verifyConfig(HttpServletRequest request, HttpServletResponse response){
+ boolean lib = false;
+ boolean urlset = false;
+ Map msgMap = FastMap.newInstance();
+ Properties urlProps = null;
+ try{
+ /* Check and down load selenium-server.jar */
+ File file = new File(libPath);
+ URL url = new URL(urlSite);
+ URLConnection connection = url.openConnection();
+ contentLength = connection.getContentLength();
+ if (contentLength == -1) {
+ request.setAttribute("_ERROR_MESSAGE_", "can not conect to the internet");
+ }
+ Debug.log("file size. "+contentLength,module);
+ if (file.exists()) {
+ if (contentLength == file.length()) {
+ lib = true;
+ } else lib = false;
+ }
+ msgMap.put("LIBFLAG",lib);
- /* Check a change use HTTP as the default */
- String httpStatus = null;
- URL urlProp = UtilURL.fromResource("url.properties");
- if (urlProps == null) {
- urlProps = new Properties();
- if (urlProp == null) {
- String errMsg = "variable with name " + urlProp.toString() + " is not set, cannot resolve location.";
- throw new MalformedURLException(errMsg);
- }
- urlProps = UtilProperties.getProperties(urlProp);
- if(urlProps != null){
- httpStatus = urlProps.getProperty("port.https.enabled");
- if(httpStatus != null && httpStatus.equals("N")){
- urlset = true;
- }
- }
- }
- msgMap.put("URLFLAG",urlset);
- request.setAttribute("MSGMAP", msgMap);
- }catch(Exception e){
- Debug.logError(e.getMessage(), module);
- }
- return "success";
- }
+ /* Check a change use HTTP as the default */
+ String httpStatus = null;
+ URL urlProp = UtilURL.fromResource("url.properties");
+ if (urlProps == null) {
+ urlProps = new Properties();
+ if (urlProp == null) {
+ String errMsg = "variable with name " + urlProp.toString() + " is not set, cannot resolve location.";
+ throw new MalformedURLException(errMsg);
+ }
+ urlProps = UtilProperties.getProperties(urlProp);
+ if (urlProps != null) {
+ httpStatus = urlProps.getProperty("port.https.enabled");
+ if (httpStatus != null && httpStatus.equals("N")) {
+ urlset = true;
+ }
+ }
+ }
+ msgMap.put("URLFLAG",urlset);
+ request.setAttribute("MSGMAP", msgMap);
+ }catch(Exception e){
+ Debug.logError(e.getMessage(), module);
+ }
+ return "success";
+ }
- public static void doDownload( HttpServletRequest request, HttpServletResponse response){
- URL url = null;
- long bytesRead= 0;
- currentValue = 0;
- contentLength = 0;
- BufferedInputStream in = null;
- BufferedOutputStream out = null;
- try {
- url = new URL(urlSite);
+ public static void doDownload( HttpServletRequest request, HttpServletResponse response){
+ URL url = null;
+ long bytesRead= 0;
+ currentValue = 0;
+ contentLength = 0;
+ BufferedInputStream in = null;
+ BufferedOutputStream out = null;
+ try {
+ url = new URL(urlSite);
- URLConnection connection = url.openConnection();
- contentLength = connection.getContentLength();
- InputStream stream = connection.getInputStream();
- Debug.log("getContentLength is :"+contentLength);
+ URLConnection connection = url.openConnection();
+ contentLength = connection.getContentLength();
+ InputStream stream = connection.getInputStream();
+ Debug.log("getContentLength is :"+contentLength);
- in = new BufferedInputStream(stream);
+ in = new BufferedInputStream(stream);
- long totalBytes = in.available();
- Debug.log("totalBytes is : "+totalBytes);
+ long totalBytes = in.available();
+ Debug.log("totalBytes is : "+totalBytes);
- byte[] b = new byte[1024];
+ byte[] b = new byte[1024];
- FileOutputStream file = new FileOutputStream(libPath);
- out = new BufferedOutputStream(file);
+ FileOutputStream file = new FileOutputStream(libPath);
+ out = new BufferedOutputStream(file);
- int r;
- Debug.log("currentValue is : "+currentValue+" bytes");
- while ((r = in.read(b,0,b.length)) != -1) {
- out.write(b,0,r);
- bytesRead += r;
- currentValue = (int)(bytesRead * 100 / contentLength);
- // Debug.log("loading.. :"+bytesRead);
- }
- out.flush();
- } catch (IOException ex) {
- Debug.logError("Error message :"+ex.getMessage(),module);
- }finally {
- try {
- if (in != null) in.close();
- if (out != null) out.close();
- }catch (Exception ex) {
- Debug.logError("Error message :"+ex.getMessage(),module);
- }
- }
- }
+ int r;
+ Debug.log("currentValue is : "+currentValue+" bytes");
+ while ((r = in.read(b,0,b.length)) != -1) {
+ out.write(b,0,r);
+ bytesRead += r;
+ currentValue = (int)(bytesRead * 100 / contentLength);
+ // Debug.log("loading.. :"+bytesRead);
+ }
+ out.flush();
+ } catch (IOException ex) {
+ Debug.logError("Error message :"+ex.getMessage(),module);
+ }finally {
+ try {
+ if (in != null) in.close();
+ if (out != null) out.close();
+ }catch (Exception ex) {
+ Debug.logError("Error message :"+ex.getMessage(),module);
+ }
+ }
+ }
- public static String checkProgressDownloadStatus(HttpServletRequest request, HttpServletResponse response){
- if(josonMap == null){
- josonMap = FastMap.newInstance();
- }
+ public static String checkProgressDownloadStatus(HttpServletRequest request, HttpServletResponse response){
+ if(josonMap == null){
+ josonMap = FastMap.newInstance();
+ }
- josonMap.put("loadPercent", currentValue);
- josonMap.put("contentLength", contentLength);
- toJsonObject(josonMap,response);
+ josonMap.put("loadPercent", currentValue);
+ josonMap.put("contentLength", contentLength);
+ toJsonObject(josonMap,response);
- return "success";
- }
+ return "success";
+ }
- public static void toJsonObject(Map attrMap, HttpServletResponse response){
- JSONObject json = JSONObject.fromObject(attrMap);
- String jsonStr = json.toString();
- if (jsonStr == null) {
- Debug.logError("JSON Object was empty; fatal error!",module);
- }
- // set the X-JSON content type
- response.setContentType("application/json");
- // jsonStr.length is not reliable for unicode characters
- try {
- response.setContentLength(jsonStr.getBytes("UTF8").length);
- } catch (UnsupportedEncodingException e) {
- Debug.logError("Problems with Json encoding",module);
- }
- // return the JSON String
- Writer out;
- try {
- out = response.getWriter();
- out.write(jsonStr);
- out.flush();
- } catch (IOException e) {
- Debug.logError("Unable to get response writer",module);
- }
- }
+ public static void toJsonObject(Map attrMap, HttpServletResponse response){
+ JSONObject json = JSONObject.fromObject(attrMap);
+ String jsonStr = json.toString();
+ if (jsonStr == null) {
+ Debug.logError("JSON Object was empty; fatal error!",module);
+ }
+ // set the X-JSON content type
+ response.setContentType("application/json");
+ // jsonStr.length is not reliable for unicode characters
+ try {
+ response.setContentLength(jsonStr.getBytes("UTF8").length);
+ } catch (UnsupportedEncodingException e) {
+ Debug.logError("Problems with Json encoding",module);
+ }
+ // return the JSON String
+ Writer out;
+ try {
+ out = response.getWriter();
+ out.write(jsonStr);
+ out.flush();
+ } catch (IOException e) {
+ Debug.logError("Unable to get response writer",module);
+ }
+ }
}
diff --git a/framework/testtools/src/org/ofbiz/testtools/seleniumxml/DataLoader.java b/framework/testtools/src/org/ofbiz/testtools/seleniumxml/DataLoader.java
index b62e183cc2..ed824bc3bf 100644
--- a/framework/testtools/src/org/ofbiz/testtools/seleniumxml/DataLoader.java
+++ b/framework/testtools/src/org/ofbiz/testtools/seleniumxml/DataLoader.java
@@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
+
package org.ofbiz.testtools.seleniumxml;
import java.util.List;
@@ -29,6 +30,8 @@ import org.python.core.PyDictionary;
import org.python.core.PyList;
import org.python.core.PyObject;
import org.python.util.PythonInterpreter;
+import org.ofbiz.testtools.seleniumxml.InitJython;
+import org.ofbiz.testtools.seleniumxml.SeleniumXml;
public class DataLoader {
@@ -37,18 +40,15 @@ public class DataLoader {
private SeleniumXml parent;
private SeleniumXml currentTest;
private List children;
-
+
private int currentRowIndx;
-
-
+
+
//Objects initialized from csvreader script.
private PyDictionary fieldNameMap;
private PyList dataList;
private PyList fieldNames;
-
-
-
-
+
public DataLoader(String file, String iterations, SeleniumXml parent, List children) {
super();
this.file = file;
@@ -66,6 +66,7 @@ public class DataLoader {
Map map = FastMap.newInstance();
map.put("file", this.file);
interp.set("params", map);
+
interp.exec("from csvreader import CSVReader");
String cmd = "reader = CSVReader('" + this.file + "')";
interp.exec(cmd);
@@ -74,21 +75,21 @@ public class DataLoader {
this.fieldNameMap = (PyDictionary) interp.eval("reader.fieldNameMap");
//interp.execfile("c:/dev/ag/seleniumxml/plugins/csvreader.py");
//interp.execfile("c:/dev/ag/seleniumxml/plugins/TestCSVReader.py");
-
+
//Now get output from script
//this.dataList = (PyArray) map.get("dataList");
//this.fieldNames = (PyDictionary) map.get("fieldNames");
-
+
}
-
+
private void next() {
this.currentRowIndx = (this.currentRowIndx + 1) % this.dataList.__len__();
}
-
+
private void loadData() {
int size = this.fieldNames.__len__();
- for(int i=0; i children) {
super();
this.dataListName = dataListName;
this.parent = parent;
this.children = children;
}
-
- public void runTest() {
+
+ public void runTest() throws TestCaseException {
this.currentTest = new SeleniumXml(this.parent);
+ this.currentTest.setUserName(this.parent.getUserName());
+ this.currentTest.setPassword(this.parent.getPassword());
Map dataMap = this.parent.getMap();
List