[jbosstools-commits] JBoss Tools SVN: r30374 - in trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext: config and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Apr 6 10:53:22 EDT 2011


Author: lzoubek at redhat.com
Date: 2011-04-06 10:53:22 -0400 (Wed, 06 Apr 2011)
New Revision: 30374

Modified:
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java
Log:
swtbotext:improved logging of RequirementAwareSuite


Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java	2011-04-06 13:40:35 UTC (rev 30373)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/RequirementAwareSuite.java	2011-04-06 14:53:22 UTC (rev 30374)
@@ -194,25 +194,24 @@
 			if (!this.config.equals(TestConfigurator.currentConfig)) {
 				TestConfigurator.currentConfig = this.config;
 			}
+			log.info("class "+klass.getCanonicalName());
 			List<RequirementBase> reqs = TestConfigurator.getClassRequirements(klass);
 			if (reqs != null) {
 				SWTBotTestRequires anno = klass.getAnnotation(SWTBotTestRequires.class);
 				if (anno!=null && anno.runOnce() && cleanUp.isClassPlanned(klass)) {
 					// class is already planned to run and contains annotation runOnce
-					log.info("Skipping class '" + klass.getCanonicalName()
-					+ "' - runOnce=true, class already planned");
+					log.info("runOnce=true, class already planned");
+					log.info("Skipped");
 					return null;
 				}
-				log.info("Returning runner for class '"
-						+ klass.getCanonicalName() + "'");
+				log.info("OK");
 				// increment number of tests planned to run by 1 (class contains
 				// at least 1 test method)
 				cleanUp.incrPlanned();
 				cleanUp.addClass(klass);
 				return new ReqAwareClassRunner(klass, reqs, config);
 			}
-			log.info("Skipping class '" + klass.getCanonicalName()
-					+ "' - annotations do not met configuration");
+			log.info("Skipped");
 			return null;
 		}
 
@@ -309,6 +308,7 @@
 						.toString(), entry.getValue().toString());
 				String suiteName = config.getPropName() + " - "
 						+ klass.getCanonicalName();
+				log.info("Determine whether test classes meet configuration");
 				runners.add(new NamedSuite(klass,
 						new RequirementAwareRunnerBuilder(config), suiteName));
 			} catch (Exception ex) {

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-04-06 13:40:35 UTC (rev 30373)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/config/TestConfigurator.java	2011-04-06 14:53:22 UTC (rev 30374)
@@ -150,38 +150,46 @@
 			return RequirementBase.createRemoveServer();
 		}
 		if (!s.required() || currentConfig.getServer() == null) {
+			ReasonLogger.notConfigured("Server");
 			return null;
 		}
 		if (!s.type().equals(ServerType.ALL)) {
 			if (s.type().equals(ServerType.EAP)
 					&& !currentConfig.getServer().type
 							.equals(Values.SERVER_TYPE_EAP)) {
+				ReasonLogger.serverTypeMatch(s.type().toString(), currentConfig.getServer().type);
 				return null;
 			}
 			if (s.type().equals(ServerType.JbossAS)
 					&& !currentConfig.getServer().type
 							.equals(Values.SERVER_TYPE_JBOSSAS)) {
+				ReasonLogger.serverTypeMatch(s.type().toString(), currentConfig.getServer().type);
 				return null;
 			}
 			if (s.type().equals(ServerType.EPP)
 					&& !currentConfig.getServer().type
 							.equals(Values.SERVER_TYPE_EPP)) {
+				ReasonLogger.serverTypeMatch(s.type().toString(), currentConfig.getServer().type);
 				return null;
 			}
 			if (s.type().equals(ServerType.SOA)
 					&& !currentConfig.getServer().type
 							.equals(Values.SERVER_TYPE_SOA)) {
+				ReasonLogger.serverTypeMatch(s.type().toString(), currentConfig.getServer().type);
 				return null;
 			}
 		}
 		if (s.location().equals(ServerLocation.Local) && currentConfig.getServer().remoteSystem!=null) {
+			ReasonLogger.serverLocation("local", "remote");
 			return null;
 		}
 		if (s.location().equals(ServerLocation.Remote) && currentConfig.getServer().remoteSystem==null) {
+			ReasonLogger.serverLocation("remote", "local");
 			return null;
 		}
 		if (!matches(currentConfig.getServer().version, s.operator(),
 				s.version())) {
+			ReasonLogger.versionMatch("Server", s.operator(), s.version(), currentConfig.getServer().version);
 			return null;
 		}
 		RequirementBase serverReq = null;
@@ -206,7 +214,7 @@
 			}
 		return serverReq;
 	}
-
+	
 	/**
 	 * returns null when given Seam annotation does not match global test
 	 * configuration (e.g. Test wants Seam version 2.2 but we are running on
@@ -217,9 +225,11 @@
 	 */
 	private static RequirementBase getSeamRequirement(Seam s) {
 		if (!s.required() || currentConfig.getSeam() == null) {
+			ReasonLogger.notConfigured("Seam");
 			return null;
 		}
 		if (!matches(currentConfig.getSeam().version, s.operator(), s.version())) {
+			ReasonLogger.versionMatch("Seam", s.operator(), s.version(), currentConfig.getSeam().version);
 			return null;
 		}
 		return RequirementBase.createAddSeam();
@@ -227,9 +237,11 @@
 
 	private static RequirementBase getESBRequirement(ESB e) {
 		if (!e.required() || currentConfig.getEsb() == null) {
+			ReasonLogger.notConfigured("ESB");
 			return null;
 		}
 		if (!matches(currentConfig.getEsb().version, e.operator(), e.version())) {
+			ReasonLogger.versionMatch("ESB", e.operator(), e.version(), currentConfig.getEsb().version);
 			return null;
 		}
 		return RequirementBase.createAddESB();
@@ -237,9 +249,11 @@
 
 	private static RequirementBase getJBPMRequirement(JBPM j) {
 		if (!j.required() || currentConfig.getJBPM() == null) {
+			ReasonLogger.notConfigured("jBPM");
 			return null;
 		}
 		if (!matches(currentConfig.getJBPM().version, j.operator(), j.version())) {
+			ReasonLogger.versionMatch("jBPM", j.operator(), j.version(), currentConfig.getJBPM().version);
 			return null;
 		}
 		return RequirementBase.createAddJBPM();
@@ -247,9 +261,11 @@
 
 	private static RequirementBase getDBRequirement(DB d) {
 		if (!d.required() || currentConfig.getDB() == null) {
+			ReasonLogger.notConfigured("DB");
 			return null;
 		}
 		if (!matches(currentConfig.getDB().version, d.operator(), d.version())) {
+			ReasonLogger.versionMatch("DB", d.operator(), d.version(), currentConfig.getDB().version);
 			return null;
 		}
 		return RequirementBase.prepareDB();
@@ -273,6 +289,7 @@
 			return reqs;
 		}
 		if (requies.secureStorage() && currentConfig.getSecureStorage()==null) {
+			ReasonLogger.notConfigured("Secure Storage");
 			return null;
 		}
 		if (requies.server().required()) {
@@ -386,4 +403,25 @@
 		return currentConfig.getProperty(key);
 		// return SWTTestExt.util.getValue(swtTestProperties, key);
 	}
+	/**
+	 * internal class providing methods for logging reasons explaining which annotation
+	 * requirements have not been met and why a testclass was not executed
+	 * @author lzoubek
+	 *
+	 */
+	private static class ReasonLogger {
+
+		public static void notConfigured(String what) {
+			log.info(String.format("Requires %s, but it is not configured", what));
+		}
+		public static void serverTypeMatch(String required, String configured) {
+			log.info(String.format("Requires %s server type, but configured is %s",required,configured));
+		}
+		public static void serverLocation(String required, String configured) {
+			log.info(String.format("Requires %s server location, but is configured as %s",required,configured));
+		}
+		public static void versionMatch(String what, String operator, String required, String configured) {
+			log.info(String.format("Required %s %s %s version  does not match, configured is %s",operator,required,what,configured));
+		}
+	}
 }



More information about the jbosstools-commits mailing list