[jbosstools-commits] JBoss Tools SVN: r41221 - trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon May 21 15:47:16 EDT 2012


Author: ldimaggio
Date: 2012-05-21 15:47:16 -0400 (Mon, 21 May 2012)
New Revision: 41221

Modified:
   trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
   trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/WebServiceProducer.java
Log:
Added console switch check to examples/ESBExampleTest.java, correct text comparison to examples/WebServiceProducer.java



Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java	2012-05-21 18:41:12 UTC (rev 41220)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/ESBExampleTest.java	2012-05-21 19:47:16 UTC (rev 41221)
@@ -150,14 +150,43 @@
 	protected String executeClientGetServerOutput(String className, String arguments) {
 		String text = console.getConsoleText();		
 		eclipse.runJavaApplication(getExampleClientProjectName(), className, arguments);
-		bot.sleep(Timing.time5S());
-		console.switchConsole(configuredState.getServer().name);
-		String text2 = console.getConsoleText(TIME_5S, TIME_20S, false);
-		if (text.length()>=text2.length()) {
+//		console.switchConsole(configuredState.getServer().name);
+//		String text2 = console.getConsoleText(TIME_5S, TIME_30S, false);
+//		if (text.length()>=text2.length()) {
+//			return null;
+//		}
+//		return text2.substring(text.length());
+	
+		// New - the consoles fail to switch....sometimes
+		boolean consoleSwitched = false;	
+		int switchLimit = 30;
+		int switchCounter = 0;
+		consoleSwitched = console.switchConsole(configuredState.getServer().name);
+		while (!consoleSwitched) {
+			consoleSwitched = console.switchConsole(configuredState.getServer().name);
+			bot.sleep(Timing.time10S());
+			log.error("Console did not switch - retrying.");
+			if (switchCounter++ > switchLimit) {
+				break;
+			}
+		}		
+		//console.switchConsole(configuredState.getServer().name);
+		
+		//String text2 = console.getConsoleText(TIME_5S, TIME_20S, false);
+		String text2 = console.getConsoleText(TIME_5S, TIME_30S, false);  /* https://issues.jboss.org/browse/JBQA-5838 - ldimaggi  */
+		log.info("text2 = " + text2);
+		//console.clearConsole();
+			
+		if (text2.length() == 0) {			
 			return null;
 		}
-		return text2.substring(text.length());
+		else {
+			return text2;
+		}	
 	}	
+	
+	
+	
 	protected void fixJREToWorkspaceDefault(String project) {
 		SWTBotTree tree = projectExplorer.show().bot().tree();
 		SWTBotTreeItem proj = tree.select(project).getTreeItem(project);

Modified: trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/WebServiceProducer.java
===================================================================
--- trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/WebServiceProducer.java	2012-05-21 18:41:12 UTC (rev 41220)
+++ trunk/esb/tests/org.jboss.tools.esb.ui.bot.test/src/org/jboss/tools/esb/ui/bot/tests/examples/WebServiceProducer.java	2012-05-21 19:47:16 UTC (rev 41221)
@@ -20,16 +20,16 @@
 		super.executeExample();	
 		
 		String text = executeClientGetServerOutput("org.jboss.soa.esb.samples.quickstart.webserviceproducer.test.SendMessage","jms");
-		assertNotNull("Calling Send message failed, nothing appened to server log",text);	
-		assertTrue("Calling Send message failed, unexpected server output :"+text,text.contains("Goodbye!!"));	
+		assertNotNull("Calling Send message failed, nothing appended to server log",text);	
+		assertTrue("Calling Send message failed, unexpected server output :"+text,text.contains("Ah Goodbye then!!!!"));	
 
 		text = executeClientGetServerOutput("org.jboss.soa.esb.samples.quickstart.webserviceproducer.test.SendMessage","http 8765");
-		assertNotNull("Calling Send message failed, nothing appened to server log",text);	
-		assertTrue("Calling Send message failed, unexpected server output :"+text,text.contains("Goodbye!!"));
+		assertNotNull("Calling Send message failed, nothing appended (http) to server log",text);	
+		assertTrue("Calling Send message failed, unexpected server output :"+text,text.contains("Ah Goodbye then!!!!"));
 
 		text = executeClientGetServerOutput("org.jboss.soa.esb.samples.quickstart.webserviceproducer.test.SendMessage","socket 8888");
-		assertNotNull("Calling Send message failed, nothing appened to server log",text);	
-		assertTrue("Calling Send message failed, unexpected server output :"+text,text.contains("Goodbye!!"));
+		assertNotNull("Calling Send message failed, nothing appended (socket) to server log",text);	
+		assertTrue("Calling Send message failed, unexpected server output :"+text,text.contains("Ah Goodbye then!!!!"));
 		
 		SWTTestExt.servers.removeAllProjectsFromServer();
 	}



More information about the jbosstools-commits mailing list