From jbosstools-commits at lists.jboss.org Tue Oct 4 10:29:09 2011
Content-Type: multipart/mixed; boundary="===============6343579555457972849=="
MIME-Version: 1.0
From: jbosstools-commits at lists.jboss.org
To: jbosstools-commits at lists.jboss.org
Subject: [jbosstools-commits] JBoss Tools SVN: r35326 - in
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test:
wtp and 1 other directory.
Date: Tue, 04 Oct 2011 10:29:08 -0400
Message-ID: <201110041429.p94ET8iZ030618@svn01.web.mwc.hst.phx2.redhat.com>
--===============6343579555457972849==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Author: jjankovi
Date: 2011-10-04 10:29:08 -0400 (Tue, 04 Oct 2011)
New Revision: 35326
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/=
bot/test/eap/EAPCompAllTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/=
bot/test/eap/EAPFromWSDLTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/=
bot/test/wtp/WSTestBase.java
Log:
Workaround for Web Service Client app
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools=
/ws/ui/bot/test/eap/EAPCompAllTests.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui=
/bot/test/eap/EAPCompAllTests.java 2011-10-04 13:40:42 UTC (rev 35325)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui=
/bot/test/eap/EAPCompAllTests.java 2011-10-04 14:29:08 UTC (rev 35326)
@@ -17,11 +17,11 @@
/**
* Documentation/description is available at Docspace}
* =
- * @author jlukas
+ * @author jlukas, jjankovi
* @see DOC-43=
675
*/
@SuiteClasses({
- EAPFromJavaTest.class,
+ EAPFromJavaTest.class,
EAPFromWSDLTest.class
})
@RunWith(RequirementAwareSuite.class)
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools=
/ws/ui/bot/test/eap/EAPFromWSDLTest.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui=
/bot/test/eap/EAPFromWSDLTest.java 2011-10-04 13:40:42 UTC (rev 35325)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui=
/bot/test/eap/EAPFromWSDLTest.java 2011-10-04 14:29:08 UTC (rev 35326)
@@ -21,10 +21,19 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_=
Level;
import org.jboss.tools.ws.ui.bot.test.wtp.TopDownWSTest;
import org.jboss.tools.ws.ui.bot.test.wtp.WSTestBase;
@@ -36,144 +45,222 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
=
-(a)Require(server=3D
-(a)Server(type =3D ServerType.EAP), perspective =3D "Java EE")
+(a)Require(server =3D @Server(type =3D ServerType.EAP), perspective =3D "J=
ava EE")
@RunWith(RequirementAwareSuite.class)
-(a)SuiteClasses({ EAPCompAllTests.class})
+(a)SuiteClasses({ EAPCompAllTests.class })
public class EAPFromWSDLTest extends WSTestBase {
=
- private static final Logger L =3D Logger.getLogger(EAPFromWSDLTest.cla=
ss.getName());
- private static boolean servicePassed =3D false;
+ private static final Logger L =3D Logger.getLogger(EAPFromWSDLTest.class
+ .getName());
+ private static boolean servicePassed =3D false;
=
- public EAPFromWSDLTest() {
- }
+ public EAPFromWSDLTest() {
+ }
=
- @Before
- @Override
- public void setup() {
- if (!projectExists(getWsProjectName())) {
- createProject(getWsProjectName());
- }
- if (!projectExists(getWsClientProjectName())) {
- createProject(getWsClientProjectName());
- }
- }
+ @Before
+ @Override
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ createProject(getWsProjectName());
+ }
+ if (!projectExists(getWsClientProjectName())) {
+ createProject(getWsClientProjectName());
+ }
+ }
=
- @After
- @Override
- public void cleanup() {
- L.info("overridden");
- }
+ @After
+ @Override
+ public void cleanup() {
+ L.info("overridden");
+ }
=
- @AfterClass
- public static void x() {
- L.info("x");
- servers.removeAllProjectsFromServer();
- }
+ @AfterClass
+ public static void x() {
+ L.info("x");
+ servers.removeAllProjectsFromServer();
+ }
=
- @Override
- protected String getWsProjectName() {
- return "AreaWSProject";
- }
+ @Override
+ protected String getWsProjectName() {
+ return "AreaWSProject";
+ }
=
- @Override
- protected String getEarProjectName() {
- return getWsProjectName() + "EAR";
- }
+ @Override
+ protected String getEarProjectName() {
+ return getWsProjectName() + "EAR";
+ }
=
- protected String getWsClientProjectName() {
- return "AreaWSClientProject";
- }
+ protected String getWsClientProjectName() {
+ return "AreaWSClientProject";
+ }
=
- protected String getClientEarProjectName() {
- return getWsClientProjectName() + "EAR";
- }
+ protected String getClientEarProjectName() {
+ return getWsClientProjectName() + "EAR";
+ }
=
- @Override
- protected String getWsPackage() {
- return "org.jboss.ws";
- }
+ @Override
+ protected String getWsPackage() {
+ return "org.jboss.ws";
+ }
=
- @Override
- protected String getWsName() {
- return "AreaService";
- }
+ @Override
+ protected String getWsName() {
+ return "AreaService";
+ }
=
- @Override
- protected Slider_Level getLevel() {
- return Slider_Level.DEPLOY;
- }
+ @Override
+ protected Slider_Level getLevel() {
+ return Slider_Level.DEPLOY;
+ }
=
- @Test
- public void testService() {
- topDownWS(TopDownWSTest.class.getResourceAsStream("/resources/jbos=
sws/AreaService.wsdl"), getWsPackage());
+ @Test
+ public void testService() {
+ topDownWS(TopDownWSTest.class.getResourceAsStream("/resources/jbossws/Ar=
eaService.wsdl"),
+ getWsPackage());
=
- IProject project =3D ResourcesPlugin.getWorkspace().getRoot().getP=
roject(getWsProjectName());
- IFile f =3D project.getFile("src/" + getWsPackage().replace(".", "=
/") + "/AreaServiceImpl.java");
- String content =3D readFile(f);
- Assert.assertNotNull(content);
- Assert.assertTrue(content.contains("public class AreaServiceImpl i=
mplements AreaService {"));
- Assert.assertTrue(content.contains("public float calculateRectArea=
(Dimensions parameters)"));
- replaceContent(f, "/resources/jbossws/AreaWS.java.ws");
+ IProject project =3D ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(getWsProjectName());
+ IFile f =3D project.getFile("src/" + getWsPackage().replace(".", "/")
+ + "/AreaServiceImpl.java");
+ String content =3D readFile(f);
+ Assert.assertNotNull(content);
+ Assert.assertTrue(content
+ .contains("public class AreaServiceImpl implements AreaService {"));
+ Assert.assertTrue(content
+ .contains("public float calculateRectArea(Dimensions parameters)"));
+ replaceContent(f, "/resources/jbossws/AreaWS.java.ws");
=
- f =3D project.getFile("WebContent/WEB-INF/web.xml");
- content =3D readFile(f);
- Assert.assertNotNull(content);
- Assert.assertTrue(content.contains("org.jboss.ws.Ar=
eaServiceImpl"));
- Assert.assertTrue(content.contains("/AreaService"));
- runProject(getEarProjectName());
- assertServiceDeployed(getWSDLUrl(), 10000);
- servicePassed =3D true;
- }
+ f =3D project.getFile("WebContent/WEB-INF/web.xml");
+ content =3D readFile(f);
+ Assert.assertNotNull(content);
+ Assert.assertTrue(content
+ .contains("org.jboss.ws.AreaServiceImpl=
"));
+ Assert.assertTrue(content
+ .contains("/AreaService"));
+ runProject(getEarProjectName());
+ assertServiceDeployed(getWSDLUrl(), 10000);
+ servicePassed =3D true;
+ }
=
- @Test
- public void testClient() {
- Assert.assertTrue("service must exist", servicePassed);
- createClient(getWSDLUrl(), getWsClientProjectName(), Slider_Level.=
DEVELOP, "org.jboss.wsclient");
- IProject p =3D ResourcesPlugin.getWorkspace().getRoot().getProject=
(getWsClientProjectName());
- String pkg =3D "org/jboss/wsclient";
- String cls =3D "src/" + pkg + "/AreaService.java";
- Assert.assertTrue(p.getFile(cls).exists());
- cls =3D "src/" + pkg + "/clientsample/ClientSample.java";
- IFile f =3D p.getFile(cls);
- Assert.assertTrue(f.exists());
- replaceContent(f, "/resources/jbossws/clientsample.java.ws");
- eclipse.runJavaApplication(getWsClientProjectName(), "org.jboss.ws=
client.clientsample.ClientSample", null);
- util.waitForNonIgnoredJobs();
- bot.sleep(15000);
- String output =3D console.getConsoleText();
- L.info(output);
- Assert.assertTrue(output.contains("Server said: 37.5"));
- Assert.assertTrue(output.contains("Server said: 3512.3699"));
- }
+ @Test
+ public void testClient() {
+ Assert.assertTrue("service must exist", servicePassed);
+ createClient(getWSDLUrl(), getWsClientProjectName(),
+ Slider_Level.DEVELOP, "org.jboss.wsclient");
+ IProject p =3D ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(getWsClientProjectName());
+ String pkg =3D "org/jboss/wsclient";
+ String cls =3D "src/" + pkg + "/AreaService.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ cls =3D "src/" + pkg + "/clientsample/ClientSample.java";
+ IFile f =3D p.getFile(cls);
+ Assert.assertTrue(f.exists());
+ replaceContent(f, "/resources/jbossws/clientsample.java.ws");
=
- private void replaceContent(IFile f, String content) {
- try {
- f.delete(true, new NullProgressMonitor());
- } catch (CoreException ce) {
- L.log(Level.WARNING, ce.getMessage(), ce);
- }
- InputStream is =3D null;
- try {
- is =3D EAPFromWSDLTest.class.getResourceAsStream(content);
- f.create(is, true, new NullProgressMonitor());
- } catch (CoreException ce) {
- L.log(Level.WARNING, ce.getMessage(), ce);
- } finally {
- if (is !=3D null) {
- try {
- is.close();
- } catch (IOException ioe) {
- //ignore
- }
- }
- }
- try {
- ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IWorkspa=
ceRoot.DEPTH_INFINITE, new NullProgressMonitor());
- } catch (CoreException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- }
- util.waitForNonIgnoredJobs();
- bot.sleep(1000);
- }
+ /*
+ * workaround for https://issues.jboss.org/browse/JBIDE-9817
+ */
+ projectExplorer.selectProject(getWsClientProjectName());
+ SWTBotTree tree =3D projectExplorer.bot().tree();
+ SWTBotTreeItem item =3D tree.getTreeItem(getWsClientProjectName());
+ item.expand();
+ removeRuntimeLibrary(tree, item, bot, util);
+
+ eclipse.runJavaApplication(getWsClientProjectName(),
+ "org.jboss.wsclient.clientsample.ClientSample", null);
+ util.waitForNonIgnoredJobs();
+ bot.sleep(15 * TIME_1S);
+ String output =3D console.getConsoleText();
+ L.info(output);
+ Assert.assertTrue(output, output.contains("Server said: 37.5"));
+ Assert.assertTrue(output.contains("Server said: 3512.3699"));
+ }
+
+ private void replaceContent(IFile f, String content) {
+ try {
+ f.delete(true, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ L.log(Level.WARNING, ce.getMessage(), ce);
+ }
+ InputStream is =3D null;
+ try {
+ is =3D EAPFromWSDLTest.class.getResourceAsStream(content);
+ f.create(is, true, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ L.log(Level.WARNING, ce.getMessage(), ce);
+ } finally {
+ if (is !=3D null) {
+ try {
+ is.close();
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+ }
+ try {
+ ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .refreshLocal(IWorkspaceRoot.DEPTH_INFINITE,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ util.waitForNonIgnoredJobs();
+ bot.sleep(TIME_1S);
+ }
+
+ private void removeRuntimeLibrary(final SWTBotTree tree,
+ SWTBotTreeItem item, SWTBotExt bot, SWTUtilExt util) {
+ nodeContextMenu(tree, item, "Build Path", "Configure Build Path...")
+ .click();
+ bot.activeShell().activate();
+ bot.tabItem("Libraries").activate();
+ assertTrue(!bot.button("Remove").isEnabled());
+ try {
+ findSelectEnterpriseRuntimeLibrary(bot);
+ assertTrue(bot.button("Remove").isEnabled());
+ bot.button("Remove").click();
+ bot.button("OK").click();
+ bot.sleep(Timing.time2S());
+ util.waitForNonIgnoredJobs();
+ } catch (Exception e) {
+ e.printStackTrace();
+ bot.button("Cancel").click();
+ }
+
+ }
+
+ private void findSelectEnterpriseRuntimeLibrary(SWTBotExt bot)
+ throws Exception {
+ SWTBotTree libraryTree =3D bot.tree(1);
+ boolean libraryFound =3D false;
+ for (SWTBotTreeItem libraryItem : libraryTree.getAllItems()) {
+ if (libraryItem.getText().contains(
+ "JBoss Enterprise Application Platform")) {
+ libraryTree.select(libraryItem);
+ libraryFound =3D true;
+ break;
+ }
+ }
+ if (!libraryFound)
+ throw new Exception("No runtime library has been found");
+ }
+
+ private SWTBotMenu nodeContextMenu(final SWTBotTree tree,
+ SWTBotTreeItem item, final String... menu) {
+ assert menu.length > 0;
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
+ return UIThreadRunnable.syncExec(new Result() {
+
+ public SWTBotMenu run() {
+ SWTBotMenu m =3D new SWTBotMenu(ContextMenuHelper.getContextMenu(
+ tree, menu[0], false));
+ for (int i =3D 1; i < menu.length; i++) {
+ m =3D m.menu(menu[i]);
+ }
+ return m;
+ }
+ });
+ }
}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools=
/ws/ui/bot/test/wtp/WSTestBase.java
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui=
/bot/test/wtp/WSTestBase.java 2011-10-04 13:40:42 UTC (rev 35325)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui=
/bot/test/wtp/WSTestBase.java 2011-10-04 14:29:08 UTC (rev 35326)
@@ -192,7 +192,7 @@
}
wsw.finish();
util.waitForNonIgnoredJobs();
- bot.sleep(1000);
+ bot.sleep(2*TIME_1S);
=
// let's fail if there's some error in the wizard,
// and close error dialog and the wizard so other tests
--===============6343579555457972849==--