[jbosstools-commits] JBoss Tools SVN: r42994 - branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Aug 13 03:29:11 EDT 2012


Author: ljelinko
Date: 2012-08-13 03:29:10 -0400 (Mon, 13 Aug 2012)
New Revision: 42994

Modified:
   branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
Log:
Enhanced methods for retrieving server status and publish state

Modified: branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java
===================================================================
--- branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java	2012-08-13 07:28:11 UTC (rev 42993)
+++ branches/jbosstools-3.3.x/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/view/ServersView.java	2012-08-13 07:29:10 UTC (rev 42994)
@@ -224,19 +224,27 @@
 		SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
 
 		String label = server.getText();
+		log.debug("Server label is: " + label);
 		int startIndex = label.indexOf('[') + 1;
 		int endIndex = label.indexOf(',');
+		if (endIndex < 0){
+			endIndex = label.indexOf(']');
+		}
 		return label.substring(startIndex, endIndex);
 	}
-	
+
 	public String getServerPublishStatus(String serverName){
 		SWTBot bot = show().bot();
 		SWTBotTreeItem server = findServerByName(bot.tree(), serverName);
 
 		String label = server.getText();
-		int startIndex = label.indexOf(',') + 2;
+		log.info("Server label is: " + label);
+		int startIndex = label.indexOf(',');
+		if (startIndex < 0){
+			throw new IllegalStateException("Label " + label + " does not contains server publish status information");
+		}
 		int endIndex = label.indexOf(']');
-		return label.substring(startIndex, endIndex);
+		return label.substring(startIndex + 2, endIndex);
 	}
 
 	public boolean containsProject(String serverName, String project){



More information about the jbosstools-commits mailing list