Author: jlukas(a)redhat.com
Date: 2011-03-29 17:34:18 -0400 (Tue, 29 Mar 2011)
New Revision: 30124
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceClientWizard.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WsWizardBase.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WsClientTest.java
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java
Log:
adding test for ws client
Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test
___________________________________________________________________
Modified: svn:ignore
- target
buildlog.latest.txt
bin
build
*.class
screenshots
+ target
buildlog.latest.txt
bin
build
*.class
screenshots
.springBeans
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch 2011-03-29 21:16:05
UTC (rev 30123)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/WSAllBotTests.launch 2011-03-29 21:34:18
UTC (rev 30124)
@@ -9,6 +9,13 @@
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="true"/>
<booleanAttribute key="clearwslog" value="false"/>
+<booleanAttribute
key="com.mountainminds.eclemma.core.INPLACE_INSTRUMENTATION"
value="true"/>
+<listAttribute
key="com.mountainminds.eclemma.core.INSTRUMENTATION_PATHS">
+<listEntry value="/org.jboss.tools.ws.ui/target/classes"/>
+<listEntry value="/org.jboss.tools.ws.creation.ui/target/classes"/>
+<listEntry value="/org.jboss.tools.ws.core/target/classes"/>
+<listEntry value="/org.jboss.tools.ws.creation.core/bin"/>
+</listAttribute>
<stringAttribute key="configLocation"
value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="true"/>
<booleanAttribute key="includeOptional" value="true"/>
@@ -30,9 +37,9 @@
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}
-consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="org.jboss.tools.ws.ui.bot.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER"
value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms256m -Xmx512m
-Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties
-Dusage_reporting_enabled=false"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dosgi.requiredJavaVersion=1.5 -XX:MaxPermSize=256m -Xms256m -Xmx1024m
-Dswtbot.test.properties.file=${env_var:HOME}/swtbot.properties
-Dusage_reporting_enabled=false"/>
<stringAttribute key="pde.version" value="3.3"/>
-<stringAttribute key="product"
value="org.eclipse.platform.ide"/>
+<stringAttribute key="product"
value="org.jboss.tools.tests.product"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2011-03-29
21:16:05 UTC (rev 30123)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,6 +15,7 @@
import org.jboss.tools.ws.ui.bot.test.jbt.WsTesterTest;
import org.jboss.tools.ws.ui.bot.test.wtp.BottomUpWSTest;
import org.jboss.tools.ws.ui.bot.test.wtp.TopDownWSTest;
+import org.jboss.tools.ws.ui.bot.test.wtp.WsClientTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
@@ -36,10 +37,11 @@
*
* @author Lukas Jungmann
*/
-@SuiteClasses({
+@SuiteClasses({
SampleWSTest.class,
BottomUpWSTest.class,
TopDownWSTest.class,
+ WsClientTest.class,
WsTesterTest.class
})
@RunWith(RequirementAwareSuite.class)
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceClientWizard.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceClientWizard.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceClientWizard.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.uiutils.wizards;
+
+import org.eclipse.swt.widgets.Shell;
+
+public class WebServiceClientWizard extends WsWizardBase {
+
+ public WebServiceClientWizard() {
+ super();
+ }
+
+ public WebServiceClientWizard(Shell shell) {
+ super(shell);
+ }
+
+ @Override
+ protected String getSourceComboLabel() {
+ return "Service definition:";
+ }
+
+ public WebServiceClientWizard setClientProject(String name) {
+ setTargetProject("Client project:", name);
+ return this;
+ }
+
+}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java 2011-03-29
21:16:05 UTC (rev 30123)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WebServiceWizard.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -10,20 +10,9 @@
******************************************************************************/
package org.jboss.tools.ws.ui.bot.test.uiutils.wizards;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
-import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
-public class WebServiceWizard extends Wizard {
+public class WebServiceWizard extends WsWizardBase {
public enum Service_Type {
BOTTOM_UP, TOP_DOWN;
@@ -44,15 +33,6 @@
}
}
- public enum Slider_Level {
- TEST, START, INSTALL, DEPLOY, ASSEMBLE, DEVELOP, NO_CLIENT;
-
- @Override
- public String toString() {
- return name().charAt(0) + name().substring(1).toLowerCase();
- }
- }
-
public WebServiceWizard() {
super();
}
@@ -71,57 +51,29 @@
return s.startsWith("Bottom up") ? Service_Type.BOTTOM_UP :
Service_Type.TOP_DOWN;
}
- public WebServiceWizard setServiceSource(String s) {
- SWTBotCombo c = null;
+ @Override
+ protected String getSourceComboLabel() {
+ String s = null;
switch (getServiceType()) {
case BOTTOM_UP:
- c = bot().comboBoxWithLabel("Service implementation:");
+ s = "Service implementation:";
break;
case TOP_DOWN:
- c = bot().comboBoxWithLabel("Service definition:");
+ s = "Service definition:";
break;
default:
throw new IllegalArgumentException("Unknown type: " + this);
}
- c.typeText(s);
- return this;
+ return s;
}
- public WebServiceWizard setServerRuntime(String name) {
- findLink("Server runtime:").get(0).click();
- SWTBotShell sh = bot().activeShell();
- SWTBotTree tree = sh.bot().treeInGroup("Server runtime:");
- tree.expandNode("Existing Servers", name).select();
- sh.bot().button("OK").click();
- sleep(50);
- return this;
- }
-
- public WebServiceWizard setWebServiceRuntime(String name) {
- findLink("Web service runtime:").get(0).click();
- SWTBotShell sh = bot().activeShell();
- SWTBotTree tree = sh.bot().treeInGroup("Web service runtime:");
- tree.select(name);
- sh.bot().button("OK").click();
- sleep(50);
- return this;
- }
-
public WebServiceWizard setServiceProject(String name) {
- findLink("Service project:").get(0).click();
- SWTBotShell sh = bot().activeShell();
- sh.bot().comboBoxWithLabel("Service project:").setSelection(name);
- sh.bot().button("OK").click();
- sleep(50);
+ setTargetProject("Service project:", name);
return this;
}
public WebServiceWizard setServiceEARProject(String name) {
- findLink("Service EAR project:").get(0).click();
- SWTBotShell sh = bot().activeShell();
- sh.bot().comboBoxWithLabel("Service EAR project:").setSelection(name);
- sh.bot().button("OK").click();
- sleep(50);
+ setTargetProject("Service EAR project:", name);
return this;
}
@@ -129,42 +81,16 @@
if (Slider_Level.NO_CLIENT == level) {
throw new UnsupportedOperationException("Unsupported level: " + level);
}
- scale(0).setSelection(level.ordinal());
+ setSlider(level, 0);
return this;
}
public WebServiceWizard setClientSlider(Slider_Level level) {
- scale(1).setSelection(level.ordinal());
+ setSlider(level, 1);
return this;
}
public boolean isClientEnabled() {
- return scale(1).isEnabled();
- }
-
- //second panel
- public WebServiceWizard setPackageName(String pkg) {
- bot().textWithLabel("Package name").typeText(pkg);
- return this;
- }
-
- private List<SWTBotHyperlinkExt> findLink(String text) {
- List<? extends Hyperlink> widgets =
bot().widgets(WidgetMatcherFactory.widgetOfType(Hyperlink.class));
- List<SWTBotHyperlinkExt> ret = new ArrayList<SWTBotHyperlinkExt>();
- for (Hyperlink h: widgets) {
- if (h.getText().indexOf(text) > -1) {
- ret.add(new SWTBotHyperlinkExt(h));
- }
- }
- return ret;
- }
-
- private SWTBotScaleExt scale(int i) {
- List<? extends Scale> widgets =
bot().widgets(WidgetMatcherFactory.widgetOfType(Scale.class));
- List<SWTBotScaleExt> ret = new ArrayList<SWTBotScaleExt>();
- for (Scale s: widgets) {
- ret.add(new SWTBotScaleExt(s));
- }
- return ret.get(i);
- }
+ return isScaleEnabled(1);
+ }
}
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WsWizardBase.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WsWizardBase.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/uiutils/wizards/WsWizardBase.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -0,0 +1,129 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.uiutils.wizards;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.widgets.Scale;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotScaleExt;
+
+public abstract class WsWizardBase extends Wizard {
+
+ public enum Slider_Level {
+ TEST, START, INSTALL, DEPLOY, ASSEMBLE, DEVELOP, NO_CLIENT;
+
+ @Override
+ public String toString() {
+ return name().charAt(0) + name().substring(1).toLowerCase();
+ }
+ }
+
+ public WsWizardBase() {
+ super();
+ }
+
+ public WsWizardBase(Shell shell) {
+ super(shell);
+ }
+
+ public WsWizardBase setSource(String s) {
+ SWTBotCombo c = bot().comboBoxWithLabel(getSourceComboLabel());
+ c.typeText(s);
+ return this;
+ }
+
+ public WsWizardBase setServerRuntime(String name) {
+ setServerRuntime(name, 0);
+ return this;
+ }
+
+ public WsWizardBase setWebServiceRuntime(String name) {
+ setWebServiceRuntime(name, 0);
+ return this;
+ }
+
+ protected abstract String getSourceComboLabel();
+
+ protected WsWizardBase setServerRuntime(String name, int idx) {
+ findLink("Server runtime:").get(idx).click();
+ SWTBotShell sh = bot().activeShell();
+ SWTBotTree tree = sh.bot().treeInGroup("Server runtime:");
+ tree.expandNode("Existing Servers", name).select();
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ protected WsWizardBase setWebServiceRuntime(String name, int idx) {
+ findLink("Web service runtime:").get(0).click();
+ sleep(100);
+ SWTBotShell sh = bot().activeShell();
+ sleep(100);
+ SWTBotTree tree = sh.bot().treeInGroup("Web service runtime:");
+ tree.select(name);
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ protected WsWizardBase setTargetProject(String label, String name) {
+ findLink(label).get(0).click();
+ SWTBotShell sh = bot().activeShell();
+ sh.bot().comboBoxWithLabel(label).setSelection(name);
+ sh.bot().button("OK").click();
+ sleep(50);
+ return this;
+ }
+
+ public WsWizardBase setSlider(Slider_Level level, int idx) {
+ scale(idx).setSelection(level.ordinal());
+ return this;
+ }
+
+ //second panel
+ public WsWizardBase setPackageName(String pkg) {
+ bot().textWithLabel("Package name").typeText(pkg);
+ return this;
+ }
+
+
+ protected boolean isScaleEnabled(int i) {
+ return scale(i).isEnabled();
+ }
+
+ private List<SWTBotHyperlinkExt> findLink(String text) {
+ List<? extends Hyperlink> widgets =
bot().widgets(WidgetMatcherFactory.widgetOfType(Hyperlink.class));
+ List<SWTBotHyperlinkExt> ret = new ArrayList<SWTBotHyperlinkExt>();
+ for (Hyperlink h: widgets) {
+ if (h.getText().indexOf(text) > -1) {
+ ret.add(new SWTBotHyperlinkExt(h));
+ }
+ }
+ return ret;
+ }
+
+ private SWTBotScaleExt scale(int i) {
+ List<? extends Scale> widgets =
bot().widgets(WidgetMatcherFactory.widgetOfType(Scale.class));
+ List<SWTBotScaleExt> ret = new ArrayList<SWTBotScaleExt>();
+ for (Scale s: widgets) {
+ ret.add(new SWTBotScaleExt(s));
+ }
+ return ret.get(i);
+ }
+}
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java 2011-03-29
21:16:05 UTC (rev 30123)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/BottomUpWSTest.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,7 +15,7 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
-import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Slider_Level;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
import org.junit.Test;
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java 2011-03-29
21:16:05 UTC (rev 30123)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/TopDownWSTest.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -15,7 +15,7 @@
import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
-import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Slider_Level;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
import org.junit.Test;
@SWTBotTestRequires(server=@Server(),perspective="Java EE")
@@ -91,7 +91,17 @@
topDownWS();
}
+// @Test
+// public void testDefaultPkg() {
+// setLevel(Slider_Level.ASSEMBLE);
+// topDownWS(null);
+// }
+
private void topDownWS() {
+ topDownWS("ws." + getWsName().toLowerCase());
+ }
+
+ private void topDownWS(String pkg) {
String s =
readStream(TopDownWSTest.class.getResourceAsStream("/resources/jbossws/ClassB.wsdl"));
String[] tns = getWsPackage().split("\\.");
StringBuilder sb = new StringBuilder();
@@ -101,14 +111,14 @@
}
sb.append(tns[0]);
String src = MessageFormat.format(s, sb.toString(), getWsName());
- String pkg = "ws." + getWsName().toLowerCase();
createService(Service_Type.TOP_DOWN, "/" + getWsProjectName() +
"/src/" + getWsName() + ".wsdl", getLevel(), pkg, src);
+
switch (getLevel()) {
- case DEVELOP:
- case ASSEMBLE:
- case DEPLOY:
- runProject(getEarProjectName());
- break;
+ case DEVELOP:
+ case ASSEMBLE:
+ case DEPLOY:
+ runProject(getEarProjectName());
+ break;
}
assertServiceDeployed(getWSDLUrl(), 10000);
// servers.removeAllProjectsFromServer(configuredState.getServer().name);
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java 2011-03-29
21:16:05 UTC (rev 30123)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WSTestBase.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
+ * Copyright (c) 2010-2011 Red Hat, Inc.
* Distributed under license by Red Hat, Inc. All rights reserved.
* This program is made available under the terms of the
* Eclipse Public License v1.0 which accompanies this distribution,
@@ -33,22 +33,19 @@
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotScale;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.jboss.tools.ui.bot.ext.SWTTestExt;
import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import
org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JavaEEEnterpriseApplicationProject;
import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWSDL;
-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.SWTBotHyperlinkExt;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.DynamicWebProjectWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceClientWizard;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
-import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Slider_Level;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.Wizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -113,37 +110,32 @@
return "http://localhost:8080/" + getWsProjectName() + "/" +
getWsName() + "?wsdl";
}
- protected void createClient(String projectName, String servletName,String wsdlDef, int
type) {
- createProject(projectName);
- SWTBot wiz = open.newObject(WebServicesWebServiceClient.LABEL);
- wiz.comboBoxWithLabel(
- WebServicesWebServiceClient.TEXT_SERVICE_DEFINITION).setText(
- wsdlDef);
- SWTBotScale slider = bot.scale();
- slider.setValue(type);
- selectJbossWSRuntime();
- bot.sleep(TIME_1S); // wait for wizard to validate wsdl url and
- // enable Finish button
- open.finish(wiz);
- projectExplorer.selectProject(projectName);
- // create servlet which will invoke service
- createInvokingServlet(servletName);
- }
-
- /**
- * checks if 'Web Service Runtime' is set to 'JbossWS' and possibly sets
it correctly
- * @param wiz wizard page of new Web Service
- */
- @Deprecated
- protected void selectJbossWSRuntime() {
- SWTBotHyperlinkExt link = bot.hyperlink(1);
- String linkText = link.getText();
- if (!linkText.contains("JBossWS")) {
- link.click();
- SWTBot dBot = bot.activeShell().bot();
- dBot.tree().select("JBossWS");
- open.finish(dBot,IDELabel.Button.OK);
+ protected void createClient(String wsdl, String targetProject, Slider_Level level,
String pkg) {
+ new NewFileWizardAction().run().selectTemplate("Web Services", "Web
Service Client").next();
+ WebServiceClientWizard w = new WebServiceClientWizard();
+ w.setSource(wsdl);
+ w.setSlider(level, 0);
+ w.setServerRuntime(configuredState.getServer().name);
+ w.setWebServiceRuntime("JBossWS");
+ w.setClientProject(targetProject);
+ if (pkg != null && !"".equals(pkg.trim())) {
+ w.next();
+ w.setPackageName(pkg);
}
+ w.finish();
+ util.waitForNonIgnoredJobs();
+ bot.sleep(1000);
+
+ //let's fail if there's some error in the wizard,
+ //and close error dialog and the wizard so other tests
+ //can continue
+ if (bot.activeShell().getText().contains("Error")) {
+ SWTBotShell sh = bot.activeShell();
+ String msg = sh.bot().text().getText();
+ sh.bot().button(0).click();
+ w.cancel();
+ Assert.fail(msg);
+ }
}
protected void createService(Service_Type t, String source, Slider_Level level, String
pkg, String code) {
@@ -174,7 +166,7 @@
new NewFileWizardAction().run().selectTemplate("Web Services", "Web
Service").next();
WebServiceWizard wsw = new WebServiceWizard();
wsw.setServiceType(t);
- wsw.setServiceSource(source);
+ wsw.setSource(source);
wsw.setServerRuntime(configuredState.getServer().name);
wsw.setWebServiceRuntime("JBossWS");
wsw.setServiceProject(getWsProjectName());
@@ -223,22 +215,6 @@
return bot.editorByTitle(s + ".wsdl");
}
- protected void createInvokingServlet(String servletName) {
- String PKG_NAME="jbossws";
- SWTBot wiz = open.newObject(WebServlet.LABEL);
- wiz.textWithLabel(WebServlet.TEXT_JAVA_PACKAGE).setText(
- PKG_NAME);
- wiz.textWithLabel(WebServlet.TEXT_CLASS_NAME).setText(
- servletName);
- open.finish(wiz);
- eclipse.setClassContentFromResource(bot
- .editorByTitle(servletName
- + ".java"), true,
- org.jboss.tools.ws.ui.bot.test.Activator.PLUGIN_ID,
- PKG_NAME, servletName
- + ".java.servlet");
- }
-
protected void createProject(String name) {
new NewFileWizardAction().run().selectTemplate("Web", "Dynamic Web
Project").next();
new DynamicWebProjectWizard().setProjectName(name).finish();
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WsClientTest.java
===================================================================
---
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WsClientTest.java
(rev 0)
+++
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/WsClientTest.java 2011-03-29
21:34:18 UTC (rev 30124)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wtp;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.ui.bot.ext.config.Annotations.SWTBotTestRequires;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.junit.Assert;
+import org.junit.Test;
+
+@SWTBotTestRequires(server=@Server(),perspective="Java EE")
+public class WsClientTest extends WSTestBase {
+
+ @Override
+ protected String getWsProjectName() {
+ return "client";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ return "client." + getLevel().toString().toLowerCase();
+ }
+
+ @Override
+ protected String getWsName() {
+ return null;
+ }
+
+ @Test
+ public void testDeployClient() {
+ setLevel(Slider_Level.DEPLOY);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testAssembleClient() {
+ setLevel(Slider_Level.ASSEMBLE);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testDevelopClient() {
+ setLevel(Slider_Level.DEVELOP);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testInstallClient() {
+ setLevel(Slider_Level.INSTALL);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testStartClient() {
+ setLevel(Slider_Level.START);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testTestClient() {
+ setLevel(Slider_Level.TEST);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testDefaultPkg() {
+ setLevel(Slider_Level.ASSEMBLE);
+ clientTest(null);
+ }
+
+ private void clientTest(String targetPkg) {
+ createClient("http://footballpool.dataaccess.eu/data/info.wso?WSDL",
getWsProjectName(), getLevel(), targetPkg);
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(getWsProjectName());
+ String pkg = (targetPkg != null && !"".equals(targetPkg.trim())) ?
getWsPackage() : "eu.dataaccess.footballpool";
+ String cls = "src/" + pkg.replace('.', '/') +
"/Info.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ cls = "src/" + pkg.replace('.', '/') +
"/clientsample/ClientSample.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ }
+}