Author: jleroux
Date: Wed Mar 16 08:28:27 2011 New Revision: 1082088 URL: http://svn.apache.org/viewvc?rev=1082088&view=rev Log: Allow to use Selenium in Webtools with (by default) or without Internet access. Of course, without Internet access needs selenium-server.jar in framework/testtools/lib/ to work Modified: ofbiz/trunk/framework/testtools/config/seleniumXml.properties ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java Modified: ofbiz/trunk/framework/testtools/config/seleniumXml.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/config/seleniumXml.properties?rev=1082088&r1=1082087&r2=1082088&view=diff ============================================================================== --- ofbiz/trunk/framework/testtools/config/seleniumXml.properties (original) +++ ofbiz/trunk/framework/testtools/config/seleniumXml.properties Wed Mar 16 08:28:27 2011 @@ -23,3 +23,6 @@ proxyPort=4444 browser=*firefox /usr/lib/firefox-3.0.8/firefox startUrl=http://localhost:8080/ log4jFile=./config/log4j.properties + +# --- Allow to use Selenium in Webtools with or without Internet access +internet.access=true Modified: ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java?rev=1082088&r1=1082087&r2=1082088&view=diff ============================================================================== --- ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java (original) +++ ofbiz/trunk/framework/testtools/src/org/ofbiz/testtools/VerifySeleniumSetups.java Wed Mar 16 08:28:27 2011 @@ -69,24 +69,41 @@ public class VerifySeleniumSetups { public static String verifyConfig(HttpServletRequest request, HttpServletResponse response){ boolean lib = false; boolean urlset = false; + boolean internetAccess = false; Map<String,Object> msgMap = FastMap.newInstance(); Properties urlProps = null; + Properties testProps = 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"); + /* Check and download selenium-server.jar */ + URL testProp = UtilURL.fromResource("seleniumXml.properties"); + if (testProps == null) { + testProps = new Properties(); + if (testProp == null) { + String errMsg = "Cannot resolve location from test.properties."; + throw new MalformedURLException(errMsg); + } } - Debug.log("file size. "+contentLength,module); - if (file.exists()) { - if (contentLength == file.length()) { - lib = true; - } else lib = false; + internetAccess = UtilProperties.getPropertyAsBoolean("seleniumXml", "internet.access", true); + File file = new File(libPath); + if (internetAccess) { + 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); + } + } else { + if (file.exists()) { + msgMap.put("LIBFLAG",true); + } } - msgMap.put("LIBFLAG",lib); /* Check a change use HTTP as the default */ String httpStatus = null; |
Free forum by Nabble | Edit this page |