Author: lzoubek(a)redhat.com
Date: 2011-08-04 06:19:16 -0400 (Thu, 04 Aug 2011)
New Revision: 33584
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
Log:
swtbot ext: make ESB runtime downloadable too
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java 2011-08-04
06:50:57 UTC (rev 33583)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ESBBean.java 2011-08-04
10:19:16 UTC (rev 33584)
@@ -4,6 +4,11 @@
public ESBBean() {
this.key = TestConfigurator.Keys.ESB;
}
+
+ public static ESBBean fromString(String propValue, String url) throws Exception {
+ return (ESBBean)fromString(propValue, url, new ESBBean());
+ }
+
public static ESBBean fromString(String propValue) throws Exception {
return (ESBBean)fromString(propValue, new ESBBean());
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java 2011-08-04
06:50:57 UTC (rev 33583)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/RuntimeBean.java 2011-08-04
10:19:16 UTC (rev 33584)
@@ -8,7 +8,13 @@
import java.net.URL;
import org.apache.log4j.Logger;
+import org.jboss.tools.ui.bot.ext.helper.FileHelper;
+/**
+ * Ancestor of all configurable beans, having common methods for parsing property line or
downloading runtime
+ * @author lzoubek
+ *
+ */
public class RuntimeBean {
protected static final Logger log = Logger.getLogger(RuntimeBean.class);
protected String key;
@@ -29,12 +35,29 @@
throw new Exception("Cannot parse "+bean.key+" property
line",ex);
}
}
+
+ protected static RuntimeBean fromString(String propValue, String url, RuntimeBean bean)
throws Exception {
+ if (bean!=null && url!=null) {
+ String runtimeFile = downloadRuntime(url);
+ if (runtimeFile!=null) {
+ File runtimeHomeAbs = new File(bean.runtimeHome).getAbsoluteFile();
+ FileHelper.unzipArchive(new File(runtimeFile), runtimeHomeAbs.getParentFile());
+ }
+ }
+ return bean;
+ }
@Override
public String toString() {
return String.format("%s runtime version=%s, home=%s",this.key,
this.version, this.runtimeHome);
}
- public static String downloadRuntime(String url) {
+
+ /**
+ * Downloads file from given url to temp dir
+ *
+ * @return absolute path to downloaded file
+ */
+ protected static String downloadRuntime(String url) {
BufferedInputStream in = null;
RandomAccessFile raf = null;
String outputFile =
System.getProperty("java.io.tmpdir")+System.getProperty("file.separator")+url.replaceAll(".*/",
"");
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2011-08-04
06:50:57 UTC (rev 33583)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2011-08-04
10:19:16 UTC (rev 33584)
@@ -72,7 +72,8 @@
printConfig(Keys.RS, remoteSystem);
seam = SeamBean.fromString(getProperty(Keys.SEAM));
printConfig(Keys.SEAM, seam);
- esb = ESBBean.fromString(getProperty(Keys.ESB));
+ esb = ESBBean.fromString(getProperty(Keys.ESB),
+ getProperty(Keys.ESB + TestConfigurator.RUNTIME_URL_SUFFIX));
printConfig(Keys.ESB, esb);
jbpm = JBPMBean.fromString(getProperty(Keys.JBPM));
printConfig(Keys.JBPM, jbpm);