Author: jlukas(a)redhat.com
Date: 2010-11-08 12:30:40 -0500 (Mon, 08 Nov 2010)
New Revision: 26333
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java
Log:
making ws tests running faster
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java 2010-11-08
15:48:01 UTC (rev 26332)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/BottomUpWebService.java 2010-11-08
17:30:40 UTC (rev 26333)
@@ -8,15 +8,37 @@
public class BottomUpWebService extends JbossWSTest {
@Test
- public void bottomUpJbossWS() {
+ public void bottomUpJbossWS1() {
int testlevel=4;
- for (int i=0;i<testlevel;i++) {
- for (int j=0;j<testlevel;j++) {
- bottomUpJbossWebService(i, j);
- }
+ for (int j=0;j<testlevel;j++) {
+ bottomUpJbossWebService(0, j);
}
}
+ @Test
+ public void bottomUpJbossWS2() {
+ int testlevel=4;
+ for (int j=0;j<testlevel;j++) {
+ bottomUpJbossWebService(1, j);
+ }
+ }
+
+ @Test
+ public void bottomUpJbossWS3() {
+ int testlevel=4;
+ for (int j=0;j<testlevel;j++) {
+ bottomUpJbossWebService(2, j);
+ }
+ }
+
+ @Test
+ public void bottomUpJbossWS4() {
+ int testlevel=4;
+ for (int j=0;j<testlevel;j++) {
+ bottomUpJbossWebService(3, j);
+ }
+ }
+
protected void bottomUpJbossWebService(int serverType, int clientType) {
log.info(" * Running test ServiceType:
'"+wizardConfigTexts.get(serverType)+"', ClientType:
'"+wizardConfigTexts.get(clientType)+"'");
createEARProject(EAR_PROJECT_NAME);
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java 2010-11-08
15:48:01 UTC (rev 26332)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JbossWSTest.java 2010-11-08
17:30:40 UTC (rev 26333)
@@ -10,9 +10,21 @@
******************************************************************************/
package org.jboss.tools.ws.ui.bot.test;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
@@ -24,7 +36,6 @@
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebService;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWebServiceClient;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServlet;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
@@ -76,6 +87,7 @@
"<soap:Body>{0}</soap:Body>" +
"</soap:Envelope>";;
+ private static final Logger L = Logger.getLogger(JbossWSTest.class.getName());
public JbossWSTest() {
}
@@ -102,7 +114,7 @@
// enable Finish button
open.finish(wiz);
projectExplorer.selectProject(projectName);
- // create servlet which will inovke service
+ // create servlet which will invoke service
createInvokingServlet(servletName);
}
@@ -177,42 +189,105 @@
}
protected void assertServiceDeployed(String wsdlURL) {
- SWTBotBrowserExt b = bot.browser();
- b.goURL("http://localhost:8080/jbossws/services");
- util.waitForBrowserLoadsPage(b,JBOSSWS_CRED_LOGIN,JBOSSWS_CRED_PASS);
- boolean wsdlOK = b.followLink(wsdlURL);
- assertTrue(
- "Service was not sucessfully deployed, WSDL '"+wsdlURL+"' is
not listed in JbossWS endpoint registry",
- wsdlOK);
- util.waitForBrowserLoadsPage(b);
- b.back();
- util.waitForBrowserLoadsPage(b);
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(wsdlURL);
+ connection = (HttpURLConnection) u.openConnection();
+ assertEquals("Service was not sucessfully deployed, WSDL '" + wsdlURL +
"' was not found",
+ HttpURLConnection.HTTP_OK, connection.getResponseCode());
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
}
protected void assertServiceNotDeployed(String wsdlURL) {
- SWTBotBrowserExt b = bot.browser();
- b.goURL("http://localhost:8080/jbossws/services");
- util.waitForBrowserLoadsPage(b,JBOSSWS_CRED_LOGIN,JBOSSWS_CRED_PASS);
- boolean wsdlOK = !b.getText().contains(wsdlURL);
- assertTrue(
- "Project was not sucessfully undeployed, WSDL '"+wsdlURL+"' is
listed in JbossWS endpoint registry",
- wsdlOK);
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(wsdlURL);
+ connection = (HttpURLConnection) u.openConnection();
+ assertEquals("Project was not sucessfully undeployed, WSDL '" + wsdlURL
+ "' is still available",
+ HttpURLConnection.HTTP_NOT_FOUND, connection.getResponseCode());
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
}
protected void assertServiceResponseToClient(String startServlet, String response) {
- SWTBotBrowserExt b = bot.browser();
- b.goURL(startServlet);
- util.waitForBrowserLoadsPage(b);
- String servletReturned = b.getText();
- boolean servletRetOK = servletReturned.contains(response);
- assertTrue(
- "Unexpected Client servlet response, error calling web service, response is :
"
- + servletReturned, servletRetOK);
-
+ InputStream is = null;
+ try {
+ URL u = new URL(startServlet);
+ is = u.openStream();
+ String rsp = readStream(is);
+ assertContains(response, rsp);
+ } catch (MalformedURLException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ //ignore
+ e.printStackTrace();
+ }
+ }
+ }
}
public static String getSoapRequest(String body) {
return MessageFormat.format(SOAP_REQUEST_TEMPLATE, body);
}
+ protected String readStream(InputStream is) {
+ Reader r = null;
+ Writer w = null;
+ try {
+ char[] buffer = new char[1024];
+ r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ w = new StringWriter();
+ int n;
+ while ((n = r.read(buffer)) != -1) {
+ w.write(buffer, 0, n);
+ }
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } finally {
+ if (r != null) {
+ try {
+ r.close();
+ } catch (IOException e) {
+ //ignore
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ }
+ if (w != null) {
+ try {
+ w.close();
+ } catch (IOException e) {
+ //ignore
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ }
+ }
+ return w != null ? w.toString() : "";
+ }
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java 2010-11-08
15:48:01 UTC (rev 26332)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/SampleWebService.java 2010-11-08
17:30:40 UTC (rev 26333)
@@ -10,13 +10,7 @@
******************************************************************************/
package org.jboss.tools.ws.ui.bot.test;
-import java.io.BufferedReader;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.MessageFormat;
@@ -190,38 +184,5 @@
}
return "";
}
-
- private String readStream(InputStream is) {
- Reader r = null;
- Writer w = null;
- try {
- char[] buffer = new char[1024];
- r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- w = new StringWriter();
- int n;
- while ((n = r.read(buffer)) != -1) {
- w.write(buffer, 0, n);
- }
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } finally {
- if (r != null) {
- try {
- r.close();
- } catch (IOException e) {
- //ignore
- L.log(Level.WARNING, e.getMessage(), e);
- }
- }
- if (w != null) {
- try {
- w.close();
- } catch (IOException e) {
- //ignore
- L.log(Level.WARNING, e.getMessage(), e);
- }
- }
- }
- return w != null ? w.toString() : "";
- }
+
}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java 2010-11-08
15:48:01 UTC (rev 26332)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TopDownWebService.java 2010-11-08
17:30:40 UTC (rev 26333)
@@ -12,14 +12,29 @@
public class TopDownWebService extends JbossWSTest {
@Test
- public void topDownJbossWS() {
+ public void topDownJbossWS1() {
int testLevel = 3;
- for (int i=0;i<testLevel;i++) {
- for (int j=0;j<testLevel;j++) {
- topDownJbossWebService(i, j);
- }
- }
+ for (int j=0;j<testLevel;j++) {
+ topDownJbossWebService(0, j);
+ }
}
+
+ @Test
+ public void topDownJbossWS2() {
+ int testLevel = 3;
+ for (int j=0;j<testLevel;j++) {
+ topDownJbossWebService(1, j);
+ }
+ }
+
+ @Test
+ public void topDownJbossWS3() {
+ int testLevel = 3;
+ for (int j=0;j<testLevel;j++) {
+ topDownJbossWebService(2, j);
+ }
+ }
+
private void topDownJbossWebService(int serverType, int clientType) {
log.info(" * Running test ServiceType:
'"+wizardConfigTexts.get(serverType)+"', ClientType:
'"+wizardConfigTexts.get(clientType)+"'");
createEARProject(EAR_PROJECT_NAME);
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java 2010-11-08
15:48:01 UTC (rev 26332)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/TwoBUWSInOneProject.java 2010-11-08
17:30:40 UTC (rev 26333)
@@ -10,10 +10,6 @@
@SWTBotTestRequires(server=@Server(),perspective="Java EE")
public class TwoBUWSInOneProject extends JbossWSTest {
- @AfterClass
- public static void after() {
- bot.sleep(Long.MAX_VALUE);
- }
@Test
public void twoServices() {
createEARProject(EAR_PROJECT_NAME);
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java 2010-11-08
15:48:01 UTC (rev 26332)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/Wizard.java 2010-11-08
17:30:40 UTC (rev 26333)
@@ -30,6 +30,7 @@
for (int i = 0; i < item.length - 1; i++) {
ti = ti != null ? ti.expandNode(item[i]).select() :
tree.expandNode(item[i]).select();
}
+ sleep(100);
if (ti != null) {
ti.select(item[item.length - 1]);
} else {