You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/08/18 20:10:47 UTC
svn commit: r805519 [9/9] - in /ofbiz/branches/executioncontext20090812: ./
applications/accounting/config/ applications/accounting/data/
applications/accounting/data/helpdata/
applications/accounting/script/org/ofbiz/accounting/finaccount/
application...
Modified: ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/SeleniumXml.java Tue Aug 18 18:10:44 2009
@@ -50,24 +50,24 @@
public class SeleniumXml {
-
- public static final String PROPS_NAME = "selenium.config";
- Logger logger = Logger.getLogger(SeleniumXml.class.getName());
-
- public static final int MAX_STR_LENGTH = 15;
- static String testPath;
- private Map <String, Object> map;
- private Document doc;
- private DefaultSelenium sel;
- private static Properties props;
+
+ public static final String PROPS_NAME = "selenium.config";
+ Logger logger = Logger.getLogger(SeleniumXml.class.getName());
+
+ public static final int MAX_STR_LENGTH = 15;
+ static String testPath;
+ private Map <String, Object> map;
+ private Document doc;
+ private DefaultSelenium sel;
+ private static Properties props;
private String testSourcePath;
private String username;
private String password;
-
- public static void main(String[] args) throws JDOMException, IOException{
- if(args.length == 0) {
- System.out.println("Please include a path for the selenium XML test file.");
- } else {
+
+ public static void main(String[] args) throws JDOMException, IOException{
+ if (args.length == 0) {
+ System.out.println("Please include a path for the selenium XML test file.");
+ } else {
SeleniumXml sel = new SeleniumXml();
for (String arg: args) {
if (arg.startsWith("-username")) {
@@ -78,160 +78,160 @@
sel.testSourcePath = arg;
}
}
- sel.runTest(args[0]);
- }
- }
-
- public SeleniumXml() throws IOException {
- this.map = new HashMap<String, Object>();
- if (props == null) {
- props = new Properties();
- initConfig();
- }
- logger.setLevel(Level.DEBUG);
- }
-
- private static void initConfig() throws IOException {
- try {
- String configFile = System.getProperty(PROPS_NAME);
- if (configFile == null) {
- String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + PROPS_NAME + " is not set, cannot resolve location.";
- throw new MalformedURLException(errMsg);
- }
- BasicConfigurator.configure();
- InputStream in = new FileInputStream(configFile);
- props.load(in);
- in.close();
-
-
- } catch (IOException e) {
- e.printStackTrace();
- throw e;
- }
- }
-
- /**
- * Constructor to preset with an existing Map of parameters. Intended to be used
- * for nested Selenium tests.
- * @param map
- */
- public SeleniumXml(SeleniumXml selenium) {
- this.sel = selenium.getSelenium();
- this.map = selenium.getParameterMap();
- }
-
- public DefaultSelenium getSelenium() {
- return this.sel;
- }
- public Map <String, Object> getParameterMap() {
- return this.map;
- }
- public void runTest(String fileName) throws JDOMException, IOException {
- readFile(fileName);
- setupSelenium();
- runCommands();
- }
-
- public void runCommands(){
- Element root = this.doc.getRootElement();
- List<Element> nodes = root.getChildren();
- runCommands(nodes);
- }
-
- public void runCommands(List<Element> nodes){
-
- for(Element elem: nodes) {
- if("type" == elem.getName()) {
- typeCmd(elem);
-
- } else if("clickAt" == elem.getName()) {
- clickAt(elem);
- } else if("waitForValue" == elem.getName()) {
- waitForValue(elem);
- } else if("waitForCondition" == elem.getName()) {
- waitForCondition(elem);
- } else if("loadData" == elem.getName()) {
- loadData(elem);
- } else if("loadData" == elem.getName()) {
+ sel.runTest(args[0]);
+ }
+ }
+
+ public SeleniumXml() throws IOException {
+ this.map = new HashMap<String, Object>();
+ if (props == null) {
+ props = new Properties();
+ initConfig();
+ }
+ logger.setLevel(Level.DEBUG);
+ }
+
+ private static void initConfig() throws IOException {
+ try {
+ String configFile = System.getProperty(PROPS_NAME);
+ if (configFile == null) {
+ String errMsg = "The Java environment (-Dxxx=yyy) variable with name " + PROPS_NAME + " is not set, cannot resolve location.";
+ throw new MalformedURLException(errMsg);
+ }
+ BasicConfigurator.configure();
+ InputStream in = new FileInputStream(configFile);
+ props.load(in);
+ in.close();
+
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ /**
+ * Constructor to preset with an existing Map of parameters. Intended to be used
+ * for nested Selenium tests.
+ * @param map
+ */
+ public SeleniumXml(SeleniumXml selenium) {
+ this.sel = selenium.getSelenium();
+ this.map = selenium.getParameterMap();
+ }
+
+ public DefaultSelenium getSelenium() {
+ return this.sel;
+ }
+ public Map <String, Object> getParameterMap() {
+ return this.map;
+ }
+ public void runTest(String fileName) throws JDOMException, IOException {
+ readFile(fileName);
+ setupSelenium();
+ runCommands();
+ }
+
+ public void runCommands() {
+ Element root = this.doc.getRootElement();
+ List<Element> nodes = root.getChildren();
+ runCommands(nodes);
+ }
+
+ public void runCommands(List<Element> nodes) {
+
+ for(Element elem: nodes) {
+ if ("type" == elem.getName()) {
+ typeCmd(elem);
+
+ } else if ("clickAt" == elem.getName()) {
+ clickAt(elem);
+ } else if ("waitForValue" == elem.getName()) {
+ waitForValue(elem);
+ } else if ("waitForCondition" == elem.getName()) {
+ waitForCondition(elem);
+ } else if ("loadData" == elem.getName()) {
loadData(elem);
- } else if("jythonRunner" == elem.getName()) {
- jythonRunner(elem);
- } else if("groovyRunner" == elem.getName()) {
- groovyRunner(elem);
- } else if("dataLoop" == elem.getName()) {
+ } else if ("loadData" == elem.getName()) {
+ loadData(elem);
+ } else if ("jythonRunner" == elem.getName()) {
+ jythonRunner(elem);
+ } else if ("groovyRunner" == elem.getName()) {
+ groovyRunner(elem);
+ } else if ("dataLoop" == elem.getName()) {
dataLoop(elem);
- } else if("remoteRequest" == elem.getName()) {
+ } else if ("remoteRequest" == elem.getName()) {
remoteRequest(elem);
- } else if("selectPopup" == elem.getName()) {
- selectPopup(elem);
- } else if("getAllWindowIds" == elem.getName()) {
- getAllWindowIds(elem);
- } else if("captureTextInPage" == elem.getName()) {
- captureTextInPageCmd(elem);
- } else if("getSelectedLabel" == elem.getName()) {
- getSelectedLabel(elem);
- } else if("getSelectedValue" == elem.getName()) {
- getSelectedValue(elem);
- } else if("getSelectedId" == elem.getName()) {
- getSelectedId(elem);
- } else if("testcase" == elem.getName()) {
- testcase(elem);
- } else if("assertContains" == elem.getName()) {
- assertContains(elem);
- } else if("getHtmlSource" == elem.getName()) {
- getHtmlSource(elem);
- } else if("getBodyText" == elem.getName()) {
- getBodyText(elem);
- } else if("setup" == elem.getName()) {
- continue; //setup is handled previously
- } else if("print" == elem.getName()) {
- printCmd(elem);
- } else if("waitForPageToLoad" == elem.getName()) {
- waitForPageToLoadCmd(elem);
- } else if("getSelectedIds" == elem.getName()) {
- getSelectedIdsCmd(elem);
- } else if("copy" == elem.getName()) {
- copyCmd(elem);
- } else if("append" == elem.getName()) {
- appendCmd(elem);
- } else if("open" == elem.getName()) {
- openCmd(elem);
- } else if("click" == elem.getName()) {
- clickCmd(elem);
- } else if("select" == elem.getName()) {
- selectCmd(elem);
- } else if("uniqueId" == elem.getName()) {
- uniqueIdCmd(elem);
- } else if("randomAlphaString" == elem.getName()) {
- randomAlphaStringCmd(elem);
- } else if("randomString" == elem.getName()) {
- randomStringCmd(elem);
- } else if("setSpeed" == elem.getName()) {
+ } else if ("selectPopup" == elem.getName()) {
+ selectPopup(elem);
+ } else if ("getAllWindowIds" == elem.getName()) {
+ getAllWindowIds(elem);
+ } else if ("captureTextInPage" == elem.getName()) {
+ captureTextInPageCmd(elem);
+ } else if ("getSelectedLabel" == elem.getName()) {
+ getSelectedLabel(elem);
+ } else if ("getSelectedValue" == elem.getName()) {
+ getSelectedValue(elem);
+ } else if ("getSelectedId" == elem.getName()) {
+ getSelectedId(elem);
+ } else if ("testcase" == elem.getName()) {
+ testcase(elem);
+ } else if ("assertContains" == elem.getName()) {
+ assertContains(elem);
+ } else if ("getHtmlSource" == elem.getName()) {
+ getHtmlSource(elem);
+ } else if ("getBodyText" == elem.getName()) {
+ getBodyText(elem);
+ } else if ("setup" == elem.getName()) {
+ continue; //setup is handled previously
+ } else if ("print" == elem.getName()) {
+ printCmd(elem);
+ } else if ("waitForPageToLoad" == elem.getName()) {
+ waitForPageToLoadCmd(elem);
+ } else if ("getSelectedIds" == elem.getName()) {
+ getSelectedIdsCmd(elem);
+ } else if ("copy" == elem.getName()) {
+ copyCmd(elem);
+ } else if ("append" == elem.getName()) {
+ appendCmd(elem);
+ } else if ("open" == elem.getName()) {
+ openCmd(elem);
+ } else if ("click" == elem.getName()) {
+ clickCmd(elem);
+ } else if ("select" == elem.getName()) {
+ selectCmd(elem);
+ } else if ("uniqueId" == elem.getName()) {
+ uniqueIdCmd(elem);
+ } else if ("randomAlphaString" == elem.getName()) {
+ randomAlphaStringCmd(elem);
+ } else if ("randomString" == elem.getName()) {
+ randomStringCmd(elem);
+ } else if ("setSpeed" == elem.getName()) {
setSpeed(elem);
- } else {
- //logger.error("Unknown SeleniumXml command found:"+elem.getName());
- //Use reflection with parameters using the naming convention param1, param2, and any return results stored
- //in map using "out"
- logger.info("Undefined command calling by reflection for command: " + elem.getName());
- callByReflection(elem);
- }
- }
-
- }
-
- private void callByReflection(Element elem) {
-
- String methodName = elem.getName();
- //Support two parameters for all selenium RC calls
- String param1 = elem.getAttributeValue("param1");
- String param2 = elem.getAttributeValue("param2");
-
- Class[] paramTypes = null;
- Object[] args = null;
- if( (param1 != null) && (param2 != null) ) {
- paramTypes = new Class[] {String.class, String.class};
- args = new Object[] {param1, param2};
- } else if (param1 != null) {
+ } else {
+ //logger.error("Unknown SeleniumXml command found:"+elem.getName());
+ //Use reflection with parameters using the naming convention param1, param2, and any return results stored
+ //in map using "out"
+ logger.info("Undefined command calling by reflection for command: " + elem.getName());
+ callByReflection(elem);
+ }
+ }
+
+ }
+
+ private void callByReflection(Element elem) {
+
+ String methodName = elem.getName();
+ //Support two parameters for all selenium RC calls
+ String param1 = elem.getAttributeValue("param1");
+ String param2 = elem.getAttributeValue("param2");
+
+ Class[] paramTypes = null;
+ Object[] args = null;
+ if ((param1 != null) && (param2 != null)) {
+ paramTypes = new Class[] {String.class, String.class};
+ args = new Object[] {param1, param2};
+ } else if (param1 != null) {
paramTypes = new Class[] {String.class};
args = new Object[] {param1};
} else {
@@ -239,73 +239,73 @@
args = new Object[] {};
}
- //Capture the output name for "get" methods
- String out = elem.getAttributeValue("out");
-
- Method m;
- try {
- m = (Method) this.sel.getClass().getDeclaredMethod(methodName, paramTypes);
- Object results = m.invoke(this.sel, args);
-
- //Add output parameter to common map
- if( (out != null) && (results != null)) {
- addParam(out, results);
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- logger.error("Exception occurred when Unknown SeleniumXml command found:"+elem.getName());
- e.printStackTrace();
- }
-
-
- }
-
- public void waitForValue(Element elem) {
-
- String locator = elem.getAttributeValue("locator");
- String timeout = elem.getAttributeValue("timeout");
- String outParam = elem.getAttributeValue("out");
-
- int maxTime = Integer.parseInt(timeout);
- int maxSeconds = maxTime/1000;
- logger.debug("waitForValue: locator=" + locator + " timeout=" + timeout);
- //this.sel.waitForCondition(script, timeout);
- String foundValue = null;
- for(int second=0;; second++) {
- if(second >= maxSeconds) {
-// throw new SeleniumException("waitForValue exceeded timeout: " + maxTime);
- }
- try{
- //getValue throws an exception if it can't find locator
- // - sleep for 1 sec and try again
- // - otherwise break as we found the value
- foundValue = sel.getValue(locator);
- if(outParam != null) {
- this.addParam(outParam, foundValue);
- }
- break; //
- } catch(Exception e) {
- //wait for 1 second and then resume
- try {
- Thread.sleep(1000);
- } catch (InterruptedException threadE) {
- // TODO Auto-generated catch block
- threadE.printStackTrace();
-
- }
- }
- }
- }
-
- public void waitForCondition(Element elem) {
-
- String script = elem.getAttributeValue("script");
- String timeout = elem.getAttributeValue("timeout");
-
- logger.debug("waitForCondition: script=" + script + " timeout=" + timeout);
- this.sel.waitForCondition(script, timeout);
- }
-
+ //Capture the output name for "get" methods
+ String out = elem.getAttributeValue("out");
+
+ Method m;
+ try {
+ m = (Method) this.sel.getClass().getDeclaredMethod(methodName, paramTypes);
+ Object results = m.invoke(this.sel, args);
+
+ //Add output parameter to common map
+ if ((out != null) && (results != null)) {
+ addParam(out, results);
+ }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ logger.error("Exception occurred when Unknown SeleniumXml command found:"+elem.getName());
+ e.printStackTrace();
+ }
+
+
+ }
+
+ public void waitForValue(Element elem) {
+
+ String locator = elem.getAttributeValue("locator");
+ String timeout = elem.getAttributeValue("timeout");
+ String outParam = elem.getAttributeValue("out");
+
+ int maxTime = Integer.parseInt(timeout);
+ int maxSeconds = maxTime/1000;
+ logger.debug("waitForValue: locator=" + locator + " timeout=" + timeout);
+ //this.sel.waitForCondition(script, timeout);
+ String foundValue = null;
+ for(int second=0;; second++) {
+ if (second >= maxSeconds) {
+// throw new SeleniumException("waitForValue exceeded timeout: " + maxTime);
+ }
+ try {
+ //getValue throws an exception if it can't find locator
+ // - sleep for 1 sec and try again
+ // - otherwise break as we found the value
+ foundValue = sel.getValue(locator);
+ if (outParam != null) {
+ this.addParam(outParam, foundValue);
+ }
+ break; //
+ } catch (Exception e) {
+ //wait for 1 second and then resume
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException threadE) {
+ // TODO Auto-generated catch block
+ threadE.printStackTrace();
+
+ }
+ }
+ }
+ }
+
+ public void waitForCondition(Element elem) {
+
+ String script = elem.getAttributeValue("script");
+ String timeout = elem.getAttributeValue("timeout");
+
+ logger.debug("waitForCondition: script=" + script + " timeout=" + timeout);
+ this.sel.waitForCondition(script, timeout);
+ }
+
public void loadData(Element elem) {
String file = elem.getAttributeValue("file");
@@ -349,7 +349,7 @@
String responseHandlerMode = elem.getAttributeValue("responseHandlerMode");
List <Element> children = elem.getChildren();
- RemoteRequest loader = new RemoteRequest( this, children, requestUrl, host, responseHandlerMode);
+ RemoteRequest loader = new RemoteRequest(this, children, requestUrl, host, responseHandlerMode);
loader.runTest();
}
@@ -371,126 +371,126 @@
this.map.put(name, value);
}
- private void assertContains(Element elem) {
- String src = replaceParam(elem.getAttributeValue("src"));
- String test = replaceParam(elem.getAttributeValue("test"));
- int indxSearch = src.indexOf(test);
- if(indxSearch == -1) {
- logger.info("assertContains didn't find " + test + " in the src");
- } else {
- logger.info("assertContains found " + test + " in the src");
- }
- Assert.assertTrue(indxSearch != -1);
- //String text = this.sel.getHtmlSource();
- }
-
- private void selectPopup(Element elem) {
- String locator = elem.getAttributeValue("locator");
-// String winId = elem.getAttributeValue("windowId");
- String timeout = elem.getAttributeValue("timeout");
-
- //this.sel.waitForPopUp(winId, timeout);
- this.sel.click(locator);
-
- String[] winNames = this.sel.getAllWindowNames();
- this.sel.selectWindow("name=" + winNames[1]);
- }
-
- private void getAllWindowIds(Element elem) {
- String[] winIds = this.sel.getAllWindowIds();
- for(int i=0; i<winIds.length; i++) {
- logger.info("WindowId: " + winIds[i]);
- }
- String[] winNames = this.sel.getAllWindowNames();
- for(int i=0; i<winIds.length; i++) {
- logger.info("WindowName: " + winNames[i]);
- }
-
- //this.sel.selectWindow("name=" + winNames[1]);
- //System.out.println("Did we select WindowName: " + winNames[1]);
- }
-
- private void getWindowPopup(Element elem) {
-
- }
- /**
- * Gets the hidden value of a list box
- * @param elem
- */
- private void getSelectedValue(Element elem) {
- String locator = elem.getAttributeValue("locator");
- String out = elem.getAttributeValue("out");
- String text = this.sel.getSelectedValue(locator);
- logger.info("getSelectedValue: locator=" + locator + " text="+text);
- addParam(out, text);
- }
-
- /**
- * Gets the visible (displayed) value of a list box
- * @param elem
- */
- private void getSelectedLabel(Element elem) {
- String locator = elem.getAttributeValue("locator");
- String out = elem.getAttributeValue("out");
- String text = this.sel.getSelectedLabel(locator);
- logger.info("getSelectedValue: locator=" + locator + " text="+text);
- addParam(out, text);
- }
- private void getSelectedId(Element elem) {
- String locator = elem.getAttributeValue("locator");
- String out = elem.getAttributeValue("out");
- String text = this.sel.getSelectedId(locator);
- addParam(out, text);
- }
- private void getHtmlSource(Element elem) {
- String paramName = elem.getAttributeValue("out");
- String text = this.sel.getHtmlSource();
- //logger.info("getHtmlsource: paramName=" + paramName + " text=" + text);
- addParam(paramName, text);
- }
-
- private void getBodyText(Element elem) {
- String paramName = elem.getAttributeValue("out");
- String text = this.sel.getBodyText();
- //logger.info("getBodyText: paramName=" + paramName + " text=" + text);
- addParam(paramName, text);
- }
- private void testcase(Element elem) {
- System.err.println("New testcase: " + elem.getAttributeValue("file"));
- String testFile = elem.getAttributeValue("file");
- SeleniumXml newTest = new SeleniumXml(this);
- try {
- newTest.runTest(testFile);
- } catch (Exception e) {
- e.printStackTrace();
- Assert.fail("Testcase error for file: " + testFile);
- }
- }
- private void clickAt(Element elem) {
- logger.debug("clickAt: " + replaceParam(elem.getAttributeValue("locator")));
- String locator = elem.getAttributeValue("locator");
- String coordString = elem.getAttributeValue("coordString");
- this.sel.clickAt(locator, coordString);
- }
- /**
- * @param elem takes a Selenium String locator. See Javadocs for more information. Here are some
- * example locators:
- * id="buttonId" - the easiest
- * css=input[type='submit'] - uses css selector notation
- * xpath= <TBD>
- * dom= <TBD>
- */
- private void clickCmd(Element elem) {
- String locator = this.replaceParam(elem.getAttributeValue("locator"));
- logger.info("clickCmd: " + locator);
- this.sel.click(locator);
- }
- private void typeCmd(Element elem) {
- String name = elem.getAttributeValue("name");
- String value = replaceParam(elem.getAttributeValue("value"));
- logger.info("typeCmd: id=" + name + " value=" + value);
- this.sel.type(name, value);
- }
+ private void assertContains(Element elem) {
+ String src = replaceParam(elem.getAttributeValue("src"));
+ String test = replaceParam(elem.getAttributeValue("test"));
+ int indxSearch = src.indexOf(test);
+ if (indxSearch == -1) {
+ logger.info("assertContains didn't find " + test + " in the src");
+ } else {
+ logger.info("assertContains found " + test + " in the src");
+ }
+ Assert.assertTrue(indxSearch != -1);
+ //String text = this.sel.getHtmlSource();
+ }
+
+ private void selectPopup(Element elem) {
+ String locator = elem.getAttributeValue("locator");
+// String winId = elem.getAttributeValue("windowId");
+ String timeout = elem.getAttributeValue("timeout");
+
+ //this.sel.waitForPopUp(winId, timeout);
+ this.sel.click(locator);
+
+ String[] winNames = this.sel.getAllWindowNames();
+ this.sel.selectWindow("name=" + winNames[1]);
+ }
+
+ private void getAllWindowIds(Element elem) {
+ String[] winIds = this.sel.getAllWindowIds();
+ for(int i=0; i<winIds.length; i++) {
+ logger.info("WindowId: " + winIds[i]);
+ }
+ String[] winNames = this.sel.getAllWindowNames();
+ for(int i=0; i<winIds.length; i++) {
+ logger.info("WindowName: " + winNames[i]);
+ }
+
+ //this.sel.selectWindow("name=" + winNames[1]);
+ //System.out.println("Did we select WindowName: " + winNames[1]);
+ }
+
+ private void getWindowPopup(Element elem) {
+
+ }
+ /**
+ * Gets the hidden value of a list box
+ * @param elem
+ */
+ private void getSelectedValue(Element elem) {
+ String locator = elem.getAttributeValue("locator");
+ String out = elem.getAttributeValue("out");
+ String text = this.sel.getSelectedValue(locator);
+ logger.info("getSelectedValue: locator=" + locator + " text="+text);
+ addParam(out, text);
+ }
+
+ /**
+ * Gets the visible (displayed) value of a list box
+ * @param elem
+ */
+ private void getSelectedLabel(Element elem) {
+ String locator = elem.getAttributeValue("locator");
+ String out = elem.getAttributeValue("out");
+ String text = this.sel.getSelectedLabel(locator);
+ logger.info("getSelectedValue: locator=" + locator + " text="+text);
+ addParam(out, text);
+ }
+ private void getSelectedId(Element elem) {
+ String locator = elem.getAttributeValue("locator");
+ String out = elem.getAttributeValue("out");
+ String text = this.sel.getSelectedId(locator);
+ addParam(out, text);
+ }
+ private void getHtmlSource(Element elem) {
+ String paramName = elem.getAttributeValue("out");
+ String text = this.sel.getHtmlSource();
+ //logger.info("getHtmlsource: paramName=" + paramName + " text=" + text);
+ addParam(paramName, text);
+ }
+
+ private void getBodyText(Element elem) {
+ String paramName = elem.getAttributeValue("out");
+ String text = this.sel.getBodyText();
+ //logger.info("getBodyText: paramName=" + paramName + " text=" + text);
+ addParam(paramName, text);
+ }
+ private void testcase(Element elem) {
+ System.err.println("New testcase: " + elem.getAttributeValue("file"));
+ String testFile = elem.getAttributeValue("file");
+ SeleniumXml newTest = new SeleniumXml(this);
+ try {
+ newTest.runTest(testFile);
+ } catch (Exception e) {
+ e.printStackTrace();
+ Assert.fail("Testcase error for file: " + testFile);
+ }
+ }
+ private void clickAt(Element elem) {
+ logger.debug("clickAt: " + replaceParam(elem.getAttributeValue("locator")));
+ String locator = elem.getAttributeValue("locator");
+ String coordString = elem.getAttributeValue("coordString");
+ this.sel.clickAt(locator, coordString);
+ }
+ /**
+ * @param elem takes a Selenium String locator. See Javadocs for more information. Here are some
+ * example locators:
+ * id="buttonId" - the easiest
+ * css=input[type='submit'] - uses css selector notation
+ * xpath= <TBD>
+ * dom= <TBD>
+ */
+ private void clickCmd(Element elem) {
+ String locator = this.replaceParam(elem.getAttributeValue("locator"));
+ logger.info("clickCmd: " + locator);
+ this.sel.click(locator);
+ }
+ private void typeCmd(Element elem) {
+ String name = elem.getAttributeValue("name");
+ String value = replaceParam(elem.getAttributeValue("value"));
+ logger.info("typeCmd: id=" + name + " value=" + value);
+ this.sel.type(name, value);
+ }
/*
* setSpeed delays the time for the next selenium command to execute
*/
@@ -498,228 +498,228 @@
logger.info("setSpeed: " + elem.getAttributeValue("value"));
this.sel.setSpeed(elem.getAttributeValue("value"));
}
- /*
- * waitForPageToLoadCmd is the max timeout selenium will wait for a page to load.
- * Commands are executed immediately after the page loads therefore if the pages are
- * fast the test will go through the pages very quickly. Use setSpeed if you want to
- * see the pages executed slower.
- */
- private void waitForPageToLoadCmd(Element elem) {
- logger.info("waitForPageToLoadCmd: " + elem.getAttributeValue("value"));
- this.sel.waitForPageToLoad(elem.getAttributeValue("value"));
- }
- private void openCmd(Element elem) {
- String cmd = replaceParam(elem.getAttributeValue("value"));
- logger.info("openCmd: " + cmd);
- this.sel.open(cmd);
+ /*
+ * waitForPageToLoadCmd is the max timeout selenium will wait for a page to load.
+ * Commands are executed immediately after the page loads therefore if the pages are
+ * fast the test will go through the pages very quickly. Use setSpeed if you want to
+ * see the pages executed slower.
+ */
+ private void waitForPageToLoadCmd(Element elem) {
+ logger.info("waitForPageToLoadCmd: " + elem.getAttributeValue("value"));
+ this.sel.waitForPageToLoad(elem.getAttributeValue("value"));
+ }
+ private void openCmd(Element elem) {
+ String cmd = replaceParam(elem.getAttributeValue("value"));
+ logger.info("openCmd: " + cmd);
+ this.sel.open(cmd);
//this.sel.windowMaximize();
- }
- private void uniqueIdCmd(Element elem) {
- String paramName = elem.getAttributeValue("out");
+ }
+ private void uniqueIdCmd(Element elem) {
+ String paramName = elem.getAttributeValue("out");
String paramValue = RandomStringUtils.randomAlphanumeric(MAX_STR_LENGTH).toUpperCase();
logger.info("uniqueIdCmd: parameter=" + paramName + " value=" + paramValue);
- addParam(paramName, paramValue);
+ addParam(paramName, paramValue);
+ }
+
+ /*
+ * captureText command captures the current HTML page and runs a regex to
+ * get the specified string.
+ *
+ * For example: if the following string existed in a web page
+ *
+ * "xx <tag a=b> yy </tag> zz"
+ *
+ *
+ * And you wanted to capture the value in the of the XML (yy). You would do the following;
+ * Use regxp: "<(\\S+?).*?>(.*?)</\\1>"; //The \\1 reuses group 1
+ *
+ * <captureText regex="<(\\S+?).*?>(.*?)</\\1>" group="2" results="xmlValue" />
+ *
+ * The command will find the <tag>.. and group 2 contains the 'yy' value.
+ *
+ * Note: if 'group' is null it will default to the entire regex group.
+ */
+ private void captureTextInPageCmd(Element elem) {
+
+ String regex = elem.getAttributeValue("regex");
+ String group = elem.getAttributeValue("group");
+ String results = elem.getAttributeValue("results");
+ Pattern pattern = Pattern.compile(regex);
+
+ String targetString = this.sel.getHtmlSource();
+
+ // Create the 'target' string we wish to interrogate.
+ // Get a Matcher based on the target string.
+ Matcher matcher = pattern.matcher(targetString);
+
+ // Find all the matches.
+ if (matcher.find()) {
+ String resultsValue = null;
+ if (group != null) {
+ resultsValue = matcher.group(Integer.parseInt(group));
+ } else {
+ resultsValue = matcher.group();
+ }
+ logger.info("Found match for " + resultsValue);
+ logger.debug("Using regex " + regex);
+ logger.debug("Copy results to " + results);
+ addParam(results, resultsValue);
+ } else {
+ logger.info("Didn't find results with regex: " + regex);
+
+ //TODO: temporary to capture the missed string
+ /*try {
+ FileWriter out = new FileWriter("c:/dev/erep/output/failure.txt");
+ BufferedWriter buffWriter = new BufferedWriter(out);
+ buffWriter.write(targetString);
+ out.flush();
+ out.close();
+ } catch (IOException e) {
+ System.err.println(e);
+ } */
+ }
}
-
- /*
- * captureText command captures the current HTML page and runs a regex to
- * get the specified string.
- *
- * For example: if the following string existed in a web page
- *
- * "xx <tag a=b> yy </tag> zz"
- *
- *
- * And you wanted to capture the value in the of the XML (yy). You would do the following;
- * Use regxp: "<(\\S+?).*?>(.*?)</\\1>"; //The \\1 reuses group 1
- *
- * <captureText regex="<(\\S+?).*?>(.*?)</\\1>" group="2" results="xmlValue" />
- *
- * The command will find the <tag>.. and group 2 contains the 'yy' value.
- *
- * Note: if 'group' is null it will default to the entire regex group.
- */
- private void captureTextInPageCmd(Element elem) {
-
- String regex = elem.getAttributeValue("regex");
- String group = elem.getAttributeValue("group");
- String results = elem.getAttributeValue("results");
- Pattern pattern = Pattern.compile(regex);
-
- String targetString = this.sel.getHtmlSource();
-
- // Create the 'target' string we wish to interrogate.
- // Get a Matcher based on the target string.
- Matcher matcher = pattern.matcher(targetString);
-
- // Find all the matches.
- if (matcher.find()) {
- String resultsValue = null;
- if(group != null) {
- resultsValue = matcher.group(Integer.parseInt(group));
- } else {
- resultsValue = matcher.group();
- }
- logger.info("Found match for " + resultsValue);
- logger.debug("Using regex " + regex);
- logger.debug("Copy results to " + results);
- addParam(results, resultsValue);
- } else {
- logger.info("Didn't find results with regex: " + regex);
-
- //TODO: temporary to capture the missed string
- /*try {
- FileWriter out = new FileWriter("c:/dev/erep/output/failure.txt");
- BufferedWriter buffWriter = new BufferedWriter(out);
- buffWriter.write(targetString);
- out.flush();
- out.close();
- } catch (IOException e) {
- System.err.println(e);
- } */
- }
- }
-
- private void randomAlphaStringCmd(Element elem) {
- int nSize = 0;
- int nPrefixSize = 0;
- String paramName = elem.getAttributeValue("out");
- String size = elem.getAttributeValue("size");
- if(size != null) {
- nSize = Integer.parseInt(size);
- }
- String prefix = elem.getAttributeValue("prefix");
- if(prefix != null) {
- nPrefixSize = prefix.length();
- }
-
- String paramValue = null;
- if(prefix != null) {
- paramValue = prefix + RandomStringUtils.randomAlphabetic(nSize - nPrefixSize);
- } else {
- paramValue = RandomStringUtils.randomAlphabetic(nSize);
- }
- //String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size));
- logger.info("randomStringAlphaCmd: paramName=" + paramName + " paramValue=" + paramValue);
- addParam(paramName, paramValue);
- }
- private void randomStringCmd(Element elem) {
- String paramName = elem.getAttributeValue("out");
- String size = elem.getAttributeValue("size");
- String prefix = elem.getAttributeValue("prefix");
- String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size));
- logger.info("randomStringCmd: paramName=" + paramName + " paramValue=" + paramValue);
- addParam(paramName, paramValue);
- }
- private void getSelectedIdsCmd(Element elem) {
- logger.info("getSelectdIdsCmd: " + elem.getAttributeValue("value"));
- this.sel.getSelectedIds(elem.getAttributeValue("value"));
- }
- private void selectCmd(Element elem) {
- String selectLocator = elem.getAttributeValue("locator");
- String optionLocator = elem.getAttributeValue("option");
- logger.info("selectCmd: selectLocator=" + selectLocator + " optionLocator=" + optionLocator);
- this.sel.select(selectLocator, optionLocator);
- }
- private void printCmd(Element elem) {
- String value = replaceParam(elem.getAttributeValue("value"));
- logger.info("Print: " + value);
- }
- private void copyCmd(Element elem) {
- String toStr = replaceParam(elem.getAttributeValue("to"));
- String fromStr = replaceParam(elem.getAttributeValue("from"));
- logger.info("copyCmd: to=" + toStr + " from=" + fromStr);
- addParam(toStr, fromStr);
- }
- private void appendCmd(Element elem) {
- logger.info("appendCmd: src1=" + elem.getAttributeValue("src1") + " src2=" + elem.getAttributeValue("src2"));
- String newStr = replaceParam(elem.getAttributeValue("src1")) + replaceParam(elem.getAttributeValue("src2"));
- addParam(elem.getAttributeValue("out"), newStr);
- }
+
+ private void randomAlphaStringCmd(Element elem) {
+ int nSize = 0;
+ int nPrefixSize = 0;
+ String paramName = elem.getAttributeValue("out");
+ String size = elem.getAttributeValue("size");
+ if (size != null) {
+ nSize = Integer.parseInt(size);
+ }
+ String prefix = elem.getAttributeValue("prefix");
+ if (prefix != null) {
+ nPrefixSize = prefix.length();
+ }
- public String replaceParam(String value) {
+ String paramValue = null;
+ if (prefix != null) {
+ paramValue = prefix + RandomStringUtils.randomAlphabetic(nSize - nPrefixSize);
+ } else {
+ paramValue = RandomStringUtils.randomAlphabetic(nSize);
+ }
+ //String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size));
+ logger.info("randomStringAlphaCmd: paramName=" + paramName + " paramValue=" + paramValue);
+ addParam(paramName, paramValue);
+ }
+ private void randomStringCmd(Element elem) {
+ String paramName = elem.getAttributeValue("out");
+ String size = elem.getAttributeValue("size");
+ String prefix = elem.getAttributeValue("prefix");
+ String paramValue = TestUtils.createRandomString(prefix, Integer.parseInt(size));
+ logger.info("randomStringCmd: paramName=" + paramName + " paramValue=" + paramValue);
+ addParam(paramName, paramValue);
+ }
+ private void getSelectedIdsCmd(Element elem) {
+ logger.info("getSelectdIdsCmd: " + elem.getAttributeValue("value"));
+ this.sel.getSelectedIds(elem.getAttributeValue("value"));
+ }
+ private void selectCmd(Element elem) {
+ String selectLocator = elem.getAttributeValue("locator");
+ String optionLocator = elem.getAttributeValue("option");
+ logger.info("selectCmd: selectLocator=" + selectLocator + " optionLocator=" + optionLocator);
+ this.sel.select(selectLocator, optionLocator);
+ }
+ private void printCmd(Element elem) {
+ String value = replaceParam(elem.getAttributeValue("value"));
+ logger.info("Print: " + value);
+ }
+ private void copyCmd(Element elem) {
+ String toStr = replaceParam(elem.getAttributeValue("to"));
+ String fromStr = replaceParam(elem.getAttributeValue("from"));
+ logger.info("copyCmd: to=" + toStr + " from=" + fromStr);
+ addParam(toStr, fromStr);
+ }
+ private void appendCmd(Element elem) {
+ logger.info("appendCmd: src1=" + elem.getAttributeValue("src1") + " src2=" + elem.getAttributeValue("src2"));
+ String newStr = replaceParam(elem.getAttributeValue("src1")) + replaceParam(elem.getAttributeValue("src2"));
+ addParam(elem.getAttributeValue("out"), newStr);
+ }
+
+ public String replaceParam(String value) {
StringBuffer buf = new StringBuffer();
int end = 0;
int start = 0;
String replacedVal = null;
String remainingStr = value;
- while (isParam(remainingStr)) {
+ while (isParam(remainingStr)) {
start = remainingStr.indexOf("${");
buf.append(remainingStr.substring(end, start));
- end = remainingStr.indexOf("}");
- String paramName = remainingStr.substring(start + 2, end);
- replacedVal = getParamValue(paramName);
+ end = remainingStr.indexOf("}");
+ String paramName = remainingStr.substring(start + 2, end);
+ replacedVal = getParamValue(paramName);
if (replacedVal == null) {
replacedVal = "";
}
buf.append(replacedVal);
remainingStr = remainingStr.substring(end + 1);
end = 0;
- }
+ }
buf.append(remainingStr.substring(end));
- return buf.toString();
- }
+ return buf.toString();
+ }
- private boolean isParam(String value ) {
+ private boolean isParam(String value) {
- if( (value.indexOf("${") != -1) &&
- (value.indexOf("}", 1) != -1) ) {
- return true;
- }
- return false;
- }
-
- //TODO read properties file to setup selenium
- private void setupSelenium() {
-
- //return if Selenium has already been setup
- //e.g. nested selenium test cases.
- if(this.sel != null) return;
-
- String serverHost = null;
- String serverPort = null;
- String browser = null;
- String startUrl = null;
-
- //First initialize with property values
- if(props != null ) { //Get setup params from property value
-
- serverHost = props.getProperty("serverHost", "localhost");
- serverPort = props.getProperty("proxyPort", "4444");
- browser = props.getProperty("browser", "*firefox");
- startUrl = props.getProperty("startUrl", "http://localhost:8080");
- }
-
- //Second over ride properties if defined in the "setup" element
- Element elem = this.doc.getRootElement().getChild("setup");
- if (elem != null) {
-
- //Override properties if specified
- if( elem.getAttributeValue("serverHost") != null ) {
- serverHost = elem.getAttributeValue("serverHost");
- }
- if( elem.getAttributeValue("serverPort") != null ) {
- serverPort = elem.getAttributeValue("serverPort");
- }
- if( elem.getAttributeValue("browser") != null ) {
- browser = elem.getAttributeValue("browser");
- }
- if( elem.getAttributeValue("startUrl") != null ) {
- startUrl = elem.getAttributeValue("startUrl");
- }
- }
- logger.info("setup: serverHost=" + serverHost);
- logger.info("setup: serverPort=" + serverPort);
- logger.info("setup: browser=" + browser);
- logger.info("setup: startUrl=" + startUrl);
- this.sel = new DefaultSelenium(serverHost, Integer.parseInt(serverPort), browser, startUrl);
- this.sel.start();
- }
- private void readFile(String fileName) throws JDOMException, IOException {
- File xmlFile = new File(fileName);
- SAXBuilder builder = new SAXBuilder();
- this.doc = builder.build(xmlFile);
- }
+ if ((value.indexOf("${") != -1) &&
+ (value.indexOf("}", 1) != -1)) {
+ return true;
+ }
+ return false;
+ }
+
+ //TODO read properties file to setup selenium
+ private void setupSelenium() {
+
+ //return if Selenium has already been setup
+ //e.g. nested selenium test cases.
+ if (this.sel != null) return;
+
+ String serverHost = null;
+ String serverPort = null;
+ String browser = null;
+ String startUrl = null;
+
+ //First initialize with property values
+ if (props != null) { //Get setup params from property value
+
+ serverHost = props.getProperty("serverHost", "localhost");
+ serverPort = props.getProperty("proxyPort", "4444");
+ browser = props.getProperty("browser", "*firefox");
+ startUrl = props.getProperty("startUrl", "http://localhost:8080");
+ }
+
+ //Second over ride properties if defined in the "setup" element
+ Element elem = this.doc.getRootElement().getChild("setup");
+ if (elem != null) {
+
+ //Override properties if specified
+ if (elem.getAttributeValue("serverHost") != null) {
+ serverHost = elem.getAttributeValue("serverHost");
+ }
+ if (elem.getAttributeValue("serverPort") != null) {
+ serverPort = elem.getAttributeValue("serverPort");
+ }
+ if (elem.getAttributeValue("browser") != null) {
+ browser = elem.getAttributeValue("browser");
+ }
+ if (elem.getAttributeValue("startUrl") != null) {
+ startUrl = elem.getAttributeValue("startUrl");
+ }
+ }
+ logger.info("setup: serverHost=" + serverHost);
+ logger.info("setup: serverPort=" + serverPort);
+ logger.info("setup: browser=" + browser);
+ logger.info("setup: startUrl=" + startUrl);
+ this.sel = new DefaultSelenium(serverHost, Integer.parseInt(serverPort), browser, startUrl);
+ this.sel.start();
+ }
+ private void readFile(String fileName) throws JDOMException, IOException {
+ File xmlFile = new File(fileName);
+ SAXBuilder builder = new SAXBuilder();
+ this.doc = builder.build(xmlFile);
+ }
public String getUserName() {
return this.username;
Modified: ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/testtools/src/org/ofbiz/testtools/seleniumxml/util/TestUtils.java Tue Aug 18 18:10:44 2009
@@ -27,42 +27,42 @@
public class TestUtils {
- static char[] charMap = {'A', 'B', 'C','D','E','F','G','H','I','J','K','L','M','N','O','P',
- 'Q','R','S','T','U','V','X','Y','Z',
- 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r',
- 's','t','u','v','w','x','y','z',
- '0','1','2','3','4','5','6','7','8','9'};
-
- static public String createUniqueString() {
- long time = System.currentTimeMillis();
-
- return String.valueOf(time);
- }
-
- static public String createRandomString(int size) {
-
- return createRandomString(null, size);
- }
-
- static public String createRandomString(String prefix, String size) {
- return createRandomString(prefix, Integer.valueOf(size).intValue());
- }
-
- static public String createRandomString(String prefix, int size) {
- StringBuffer buff = new StringBuffer(size);
- int startIndx = 0;
-
- if(prefix != null) {
- buff.append(prefix);
- startIndx = prefix.length();
- }
-
- Random rad = new Random();
- for(int i=startIndx; i<size; i++ ) {
- buff.append(charMap[rad.nextInt(charMap.length)]);
- }
- return buff.toString();
- }
+ static char[] charMap = {'A', 'B', 'C','D','E','F','G','H','I','J','K','L','M','N','O','P',
+ 'Q','R','S','T','U','V','X','Y','Z',
+ 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r',
+ 's','t','u','v','w','x','y','z',
+ '0','1','2','3','4','5','6','7','8','9'};
+
+ static public String createUniqueString() {
+ long time = System.currentTimeMillis();
+
+ return String.valueOf(time);
+ }
+
+ static public String createRandomString(int size) {
+
+ return createRandomString(null, size);
+ }
+
+ static public String createRandomString(String prefix, String size) {
+ return createRandomString(prefix, Integer.valueOf(size).intValue());
+ }
+
+ static public String createRandomString(String prefix, int size) {
+ StringBuffer buff = new StringBuffer(size);
+ int startIndx = 0;
+
+ if (prefix != null) {
+ buff.append(prefix);
+ startIndx = prefix.length();
+ }
+
+ Random rad = new Random();
+ for(int i=startIndx; i<size; i++) {
+ buff.append(charMap[rad.nextInt(charMap.length)]);
+ }
+ return buff.toString();
+ }
public static String readUrlText(String urlString) throws IOException {
URL url = new URL(urlString);
Modified: ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_login.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_login.xml?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_login.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_login.xml Tue Aug 18 18:10:44 2009
@@ -6,8 +6,8 @@
<type name="PASSWORD" value="ofbiz" />
<click locator="//input[@value='Login']" />
<waitForPageToLoad value="10000" />
- <getBodyText out="bodyText"/>
- <getHtmlSource out="htmlSource"/>
+ <getBodyText out="bodyText"/>
+ <getHtmlSource out="htmlSource"/>
<assertContains src="${htmlSource}" test="Welcome" />
</testcase>
Modified: ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/testtools/testdef/seleniumxml/example/example_testsuite.xml Tue Aug 18 18:10:44 2009
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<testcase>
<setSpeed value="500" />
- <testcase file="testdef/seleniumxml/example/example_login.xml"/>
+ <testcase file="testdef/seleniumxml/example/example_login.xml"/>
<testcase file="testdef/seleniumxml/example/example_new.xml"/>
<testcase file="testdef/seleniumxml/example/example_search.xml"/>
</testcase>
Modified: ofbiz/branches/executioncontext20090812/framework/webslinger/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/webslinger/build.xml?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/webslinger/build.xml (original)
+++ ofbiz/branches/executioncontext20090812/framework/webslinger/build.xml Tue Aug 18 18:10:44 2009
@@ -31,7 +31,6 @@
<path id="local.class.path">
<fileset dir="lib" includes="*.jar"/>
- <fileset dir="${ofbiz.home.dir}/framework/api/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/entity/build/lib" includes="*.jar"/>
<fileset dir="${ofbiz.home.dir}/framework/base/lib" includes="*.jar"/>
Modified: ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Tue Aug 18 18:10:44 2009
@@ -35,8 +35,8 @@
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
import org.ofbiz.base.util.string.FlexibleStringExpander;
-import org.ofbiz.entity.EntityFactory;
import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericEntity;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.transaction.TransactionUtil;
import org.ofbiz.service.ExecutionContext;
@@ -355,7 +355,7 @@
AccessController accessController = executionContext.getAccessController();
accessController.checkPermission(View);
// make sure the "null" object is in there for entity ops
- context.put("null", EntityFactory.NULL_FIELD);
+ context.put("null", GenericEntity.NULL_FIELD);
setWidgetBoundaryComments(context);
Modified: ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java (original)
+++ ofbiz/branches/executioncontext20090812/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java Tue Aug 18 18:10:44 2009
@@ -44,8 +44,8 @@
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.collections.MapStack;
-import org.ofbiz.entity.EntityFactory;
import org.ofbiz.entity.GenericDelegator;
+import org.ofbiz.entity.GenericEntity;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.security.Security;
import org.ofbiz.security.SecurityConfigurationException;
@@ -153,7 +153,7 @@
context.put("globalContext", context.standAloneStack());
// make sure the "nullField" object is in there for entity ops; note this is nullField and not null because as null causes problems in FreeMarker and such...
- context.put("nullField", EntityFactory.NULL_FIELD);
+ context.put("nullField", GenericEntity.NULL_FIELD);
context.put("parameters", parameters);
context.put("delegator", delegator);
Modified: ofbiz/branches/executioncontext20090812/revert.bat
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/revert.bat?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/revert.bat (original)
+++ ofbiz/branches/executioncontext20090812/revert.bat Tue Aug 18 18:10:44 2009
@@ -1,2 +1,23 @@
+echo off
+rem #####################################################################
+rem Licensed to the Apache Software Foundation (ASF) under one
+rem or more contributor license agreements. See the NOTICE file
+rem distributed with this work for additional information
+rem regarding copyright ownership. The ASF licenses this file
+rem to you under the Apache License, Version 2.0 (the
+rem "License"); you may not use this file except in compliance
+rem with the License. You may obtain a copy of the License at
+rem
+rem http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing,
+rem software distributed under the License is distributed on an
+rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+rem KIND, either express or implied. See the License for the
+rem specific language governing permissions and limitations
+rem under the License.
+rem #####################################################################
+
rem to revert back a revision in local copy.
+echo on
svn merge -c -%1 https://svn.apache.org/repos/asf/ofbiz/trunk
Modified: ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java (original)
+++ ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java Tue Aug 18 18:10:44 2009
@@ -42,7 +42,7 @@
public void addProcess(String field, String fieldAlias) {
if (!addedProcess) {
this.addEntity("WFPR", org.ofbiz.shark.SharkConstants.WfProcess);
- this.addLink("WFAC", "WFAC", false, ModelFactory.makeKeyMapList(org.ofbiz.shark.SharkConstants.processId));
+ this.addLink("WFAC", "WFAC", false, ModelKeyMap.makeKeyMapList(org.ofbiz.shark.SharkConstants.processId));
}
this.addField("WFPR", field, fieldAlias);
}
Modified: ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/BaseEntityCondExprBldr.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/BaseEntityCondExprBldr.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/BaseEntityCondExprBldr.java (original)
+++ ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/expression/BaseEntityCondExprBldr.java Tue Aug 18 18:10:44 2009
@@ -150,7 +150,7 @@
}
private DynamicViewEntity makeView() {
- DynamicViewEntity view = ModelFactory.createDynamicViewEntity();
+ DynamicViewEntity view = new DynamicViewEntity();
// create the members
Modified: ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java?rev=805519&r1=805518&r2=805519&view=diff
==============================================================================
--- ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java (original)
+++ ofbiz/branches/executioncontext20090812/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java Tue Aug 18 18:10:44 2009
@@ -785,14 +785,14 @@
GenericDelegator delegator = SharkContainer.getDelegator();
List processIds = new ArrayList();
- DynamicViewEntity view = ModelFactory.createDynamicViewEntity();
+ DynamicViewEntity view = new DynamicViewEntity();
view.addMemberEntity("WFDL", org.ofbiz.shark.SharkConstants.WfDeadline);
view.addMemberEntity("WFPR", org.ofbiz.shark.SharkConstants.WfProcess);
view.addMemberEntity("WFAC", org.ofbiz.shark.SharkConstants.WfActivity);
view.addAlias("WFPR", org.ofbiz.shark.SharkConstants.currentState, "processState", null, null, null, null);
view.addAlias("WFAC", org.ofbiz.shark.SharkConstants.currentState, "activityState", null, null, null, null);
- view.addViewLink("WFDL", "WFPR", Boolean.FALSE, ModelFactory.makeKeyMapList(org.ofbiz.shark.SharkConstants.processId));
- view.addViewLink("WFDL", "WFAC", Boolean.FALSE, ModelFactory.makeKeyMapList(org.ofbiz.shark.SharkConstants.activityId));
+ view.addViewLink("WFDL", "WFPR", Boolean.FALSE, ModelKeyMap.makeKeyMapList(org.ofbiz.shark.SharkConstants.processId));
+ view.addViewLink("WFDL", "WFAC", Boolean.FALSE, ModelKeyMap.makeKeyMapList(org.ofbiz.shark.SharkConstants.activityId));
EntityListIterator eli = null;
try {