[jbosstools-commits] JBoss Tools SVN: r22945 - trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Jun 23 08:45:55 EDT 2010
Author: jlukas at redhat.com
Date: 2010-06-23 08:45:54 -0400 (Wed, 23 Jun 2010)
New Revision: 22945
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
Log:
improving ws tester test to cover also get from wsdl button/action and related UI
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-06-23 12:32:17 UTC (rev 22944)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WsTesterTest.java 2010-06-23 12:45:54 UTC (rev 22945)
@@ -23,10 +23,13 @@
import java.util.logging.Logger;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotList;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem;
import org.eclipse.ui.internal.WorkbenchMessages;
@@ -87,6 +90,33 @@
Assert.assertEquals(2, wstv.getRequestArgs(WsTesterView.Request_Arg_Type.HEADER).keySet().size());
wstv.clearRequestArgs(WsTesterView.Request_Arg_Type.HEADER);
Assert.assertEquals(0, wstv.getRequestArgs(WsTesterView.Request_Arg_Type.HEADER).keySet().size());
+
+ wstv.setWebServiceType(WsTesterView.Ws_Type.JAX_WS);
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ dlg.openURL();
+ SWTBotShell sh = bot.activeShell();
+ sh.bot().text().typeText(SERVICE_URL + "?WSDL");
+ sh.bot().button("OK").click();
+ bot.sleep(1000);
+ Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
+ List<String> items = dlg.getServices();
+ L.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("BibleWebservice"));
+ items = dlg.getPorts();
+ L.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("BibleWebserviceSoap"));
+ Assert.assertTrue(items.contains("BibleWebserviceSoap12"));
+ items = dlg.getOperations();
+ L.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(4, items.size());
+ Assert.assertTrue(items.contains("GetBookTitles"));
+ Assert.assertTrue(items.contains("GetBibleWordsByChapterAndVerse"));
+ dlg.selectOperation("GetBibleWordsbyKeyWord");
+ dlg.ok();
+ Assert.assertEquals("http://www.webservicex.net/BibleWebservice.asmx", wstv.getServiceURL());
+ Assert.assertEquals("http://www.webserviceX.NET/GetBibleWordsbyKeyWord", wstv.getActionURL());
viewBot.close();
}
@@ -366,10 +396,18 @@
comboBox(2).typeText(url);
}
+ public String getServiceURL() {
+ return comboBox(2).getText();
+ }
+
public void setActionURL(String s) {
text(0).typeText(s);
}
+ public String getActionURL() {
+ return text(0).getText();
+ }
+
public void setRequestBody(String s) {
SWTBotTabItem ti = tabItem(JBossWSUIMessages.JAXRSWSTestView_Request_Body_Label);
ti.activate();
@@ -455,6 +493,11 @@
waitWhile(Conditions.shellIsActive(dlgTitle), 120000);
sleep(500);
}
+
+ public SelectWSDLDialog getFromWSDL() {
+ button(JBossWSUIMessages.JAXRSWSTestView_Button_Get_From_WSDL).click();
+ return new SelectWSDLDialog(activeShell().widget);
+ }
public void openMonitor() {
button(JBossWSUIMessages.JAXRSWSTestView_Open_Monitor_Button).click();
@@ -468,4 +511,53 @@
return Platform.getResourceString(WSUI_BUNDLE, key);
}
}
+
+ private static class SelectWSDLDialog extends SWTBotShell {
+
+ public SelectWSDLDialog(Shell shell) throws WidgetNotFoundException {
+ super(shell);
+ assert JBossWSUIMessages.WSDLBrowseDialog_Dialog_Title.equals(getText());
+ }
+
+ public void openURL() {
+ bot().button(JBossWSUIMessages.WSDLBrowseDialog_URL_Browse).click();
+ }
+
+// public void setURI(String s) {
+// bot().comboBoxWithLabel(JBossWSUIMessages.WSDLBrowseDialog_WSDL_URI_Field).setText(s);
+// }
+
+ public String getURI() {
+ return bot().comboBoxWithLabel(JBossWSUIMessages.WSDLBrowseDialog_WSDL_URI_Field).getText();
+ }
+
+ public List<String> getServices() {
+ return getItems(JBossWSUIMessages.WSDLBrowseDialog_Service_Field);
+ }
+
+ public List<String> getPorts() {
+ return getItems(JBossWSUIMessages.WSDLBrowseDialog_Port_Field);
+ }
+
+ public List<String> getOperations() {
+ return Arrays.asList(getOperationsList().getItems());
+ }
+
+ public void selectOperation(String op) {
+ getOperationsList().select(op);
+ }
+
+ public void ok() {
+ bot().button("OK").click();
+ }
+
+ private List<String> getItems(String label) {
+ String[] items = bot().comboBoxWithLabel(label).items();
+ return Arrays.asList(items);
+ }
+
+ private SWTBotList getOperationsList() {
+ return bot().listWithLabel(JBossWSUIMessages.WSDLBrowseDialog_Operation_Field);
+ }
+ }
}
More information about the jbosstools-commits
mailing list