Author: lzoubek(a)redhat.com
Date: 2011-03-01 09:01:31 -0500 (Tue, 01 Mar 2011)
New Revision: 29407
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/SecureStorage.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/SetProperties.java
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java
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/TestConfigurator.java
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java
Log:
swtbotext: added support for secure storage (password) config property
Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2011-03-01
10:31:08 UTC (rev 29406)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/META-INF/MANIFEST.MF 2011-03-01
14:01:31 UTC (rev 29407)
@@ -40,6 +40,7 @@
org.jboss.tools.ui.bot.ext.types,
org.jboss.tools.ui.bot.ext.view,
org.jboss.tools.ui.bot.ext.widgets,
+ org.jboss.tools.ui.bot.ext.wizards,
org.jboss.tools.ui.bot.ext.zest
Bundle-Vendor: JBoss by Red Hat
Bundle-ClassPath: .,
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties 2011-03-01
10:31:08 UTC (rev 29406)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/resources/SWTBotTest-default.properties 2011-03-01
14:01:31 UTC (rev 29407)
@@ -23,3 +23,6 @@
#Connection profile named <db_type>_<version> will be created
#Annotation usage for TestCase db=@DB
DB=hsqldb18,internal,driver,jdbc,user,,
+# Secure Storage=<password>
+# configure master password for secure storage
+SS=password
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java 2011-03-01
10:31:08 UTC (rev 29406)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/ConfiguredState.java 2011-03-01
14:01:31 UTC (rev 29407)
@@ -18,7 +18,7 @@
private JBPM jbpm = new JBPM();
private DB db = new DB();
private RemoteSystem remoteSystem = new RemoteSystem();
-
+ private String secureStoragePassword;
private boolean viewsPrepared = false;
public boolean isViewsPrepared() {
@@ -28,6 +28,12 @@
public void setViewsPrepared(boolean viewsPrepared) {
this.viewsPrepared = viewsPrepared;
}
+ public String getSecureStoragePassword() {
+ return secureStoragePassword;
+ }
+ public void setSecureStoragePassword(String secureStoragePassword) {
+ this.secureStoragePassword = secureStoragePassword;
+ }
/**
* gets list of installed jre's (without the default one)
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/SecureStorage.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/SecureStorage.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/SecureStorage.java 2011-03-01
14:01:31 UTC (rev 29407)
@@ -0,0 +1,23 @@
+package org.jboss.tools.ui.bot.ext.config;
+
+public class SecureStorage {
+
+ public String password;
+ public static SecureStorage fromString(String key, String propValue) throws Exception {
+ try {
+ if (propValue==null) {
+ return null;
+ }
+ SecureStorage bean = new SecureStorage();
+ bean.password = propValue;
+ return bean;
+ }
+ catch (Exception ex) {
+ throw new Exception(String.format("Cannot parse %s property
line",key),ex);
+ }
+ }
+ @Override
+ public String toString() {
+ return String.format("Secure Storage is configured");
+ }
+}
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-03-01
10:31:08 UTC (rev 29406)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfiguration.java 2011-03-01
14:01:31 UTC (rev 29407)
@@ -31,6 +31,7 @@
private JBPMBean jbpm;
private DBBean db;
private RemoteSystemBean remoteSystem;
+ private SecureStorage secureStorage;
public TestConfiguration(String propName, String propFile) throws Exception {
this.propName = propName;
@@ -65,7 +66,8 @@
printConfig(Keys.JBPM, jbpm);
db = DBBean.fromString(getProperty(Keys.DB));
printConfig(Keys.DB,db);
-
+ secureStorage = SecureStorage.fromString(Keys.SS, getProperty(Keys.SS));
+ printConfig("Secure Storage",secureStorage);
checkConfig();
}
@@ -186,4 +188,7 @@
public RemoteSystemBean getRemoteSystem() {
return remoteSystem;
}
+ public SecureStorage getSecureStorage() {
+ return secureStorage;
+ }
}
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2011-03-01
10:31:08 UTC (rev 29406)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java 2011-03-01
14:01:31 UTC (rev 29407)
@@ -33,6 +33,7 @@
public static final String JBPM = "JBPM";
public static final String DB = "DB";
public static final String RS = "RS";
+ public static final String SS = "SS";
}
public class Values {
@@ -113,6 +114,12 @@
}
}
+ /**
+ * checks whether given property-file (its conntent) contains multiple configurations to
load
+ * or it is just that configuration file
+ * @param propFile
+ * @return true if given property-file (its conntent) contains multiple configurations
+ */
public static boolean isMultiPropertiesFile(String propFile) {
Properties props = new Properties();
try {
@@ -260,6 +267,7 @@
// internal list
List<RequirementBase> reqs = new ArrayList<RequirementBase>();
reqs.add(RequirementBase.createPrepareViews());
+ reqs.add(RequirementBase.createSetProperties());
// all not annotated classes can run
if (requies == null) {
return reqs;
Modified:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java 2011-03-01
10:31:08 UTC (rev 29406)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/RequirementBase.java 2011-03-01
14:01:31 UTC (rev 29407)
@@ -136,6 +136,11 @@
return req;
}
+ public static RequirementBase createSetProperties() {
+ RequirementBase req = new SetProperties();
+ req.setPriority(-99);
+ return req;
+ }
public static RequirementBase createClearWorkspace() {
RequirementBase req = new ClearWorkspace();
req.setPriority(-2);
Added:
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/SetProperties.java
===================================================================
---
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/SetProperties.java
(rev 0)
+++
trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/requirement/SetProperties.java 2011-03-01
14:01:31 UTC (rev 29407)
@@ -0,0 +1,25 @@
+package org.jboss.tools.ui.bot.ext.config.requirement;
+
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.TestConfigurator;
+
+/**
+ * special type of requirement. Does nothing, just copies several properties and its
values from {@link TestConfigurator#currentConfig}
+ * to {@link SWTTestExt#configuredState}. Such properties are only propagated from config
to config state
+ * @author lzoubek
+ *
+ */
+public class SetProperties extends RequirementBase {
+
+ @Override
+ public boolean checkFulfilled() {
+ SWTTestExt.configuredState.setSecureStoragePassword(TestConfigurator.currentConfig.getSecureStorage().password);
+ return true;
+ }
+
+ @Override
+ public void handle() {
+
+ }
+
+}