Index: src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java =================================================================== --- src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java (revision 22476) +++ src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java (working copy) @@ -2,106 +2,95 @@ import java.io.IOException; -import junit.framework.TestCase; - -import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; -import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; - -public class JBossWSProjectFacetBotTest extends TestCase { - private static SWTWorkbenchBot bot; - private static final String JBOSSWS_HOME_DEFAULT = "D:/softinstall/jboss-5.1.0.GA"; - public static final String JBOSSWS_42_HOME = "jbosstools.test.jboss.home.5.1"; - public static final String JBOSS_AS_42_HOME = System.getProperty( - JBOSSWS_42_HOME, JBOSSWS_HOME_DEFAULT); - private IProject project; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; +import org.eclipse.wst.common.project.facet.core.IFacetedProject; +import org.eclipse.wst.common.project.facet.core.IProjectFacet; +import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; +import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWSDL; +import org.jboss.tools.ui.bot.ext.types.IDELabel; - protected void setUp() throws Exception { - bot = new SWTWorkbenchBot(); - bot.viewByTitle("Welcome").close(); - createServerRuntime(); - } +public class JBossWSProjectFacetBotTest extends WSWizardTest { public void testNewWizard() throws IOException, CoreException { bot.menu("File").menu("New").menu("Project...").click(); bot.shell("New Project").activate(); - SWTBotTree tree = bot.tree(); + SWTBotTree tree = bot.tree(); tree.expandNode("Web").expandNode("Dynamic Web Project").select(); - assertTrue(bot.button("Next >").isEnabled()); - bot.button("Next >").click(); - bot.shell("New Dynamic Web Project").activate(); - assertFalse(bot.button("Finish").isEnabled()); - - bot.textWithLabel("Project name:").setText("A"); - assertTrue(bot.button("Finish").isEnabled()); - bot.comboBoxInGroup("Dynamic web module version").setSelection("2.5"); - bot.comboBoxInGroup("Configuration").setSelection("JBossWS Web Service Project v3.0"); - assertFalse(bot.button("Finish").isEnabled()); - bot.button("Next >").click(); - bot.button("Next >").click(); - bot.button("Next >").click(); - bot.radio(0).click(); - bot.sleep(6000); - assertTrue(bot.button("Finish").isEnabled()); - bot.button("Finish").click(); - - project = ResourcesPlugin.getWorkspace().getRoot().getProject("A"); - assertNotNull(project); - - } - - protected void tearDown() throws Exception { - bot = null; - } + assertTrue(bot.button("Next >").isEnabled()); + bot.button("Next >").click(); + bot.shell("New Dynamic Web Project").activate(); + assertFalse(bot.button("Finish").isEnabled()); - protected void createServerRuntime() { - if (!isServerRuntimeDefined(bot, "AS4.2Runtime")) { - bot.menu("File").menu("New").menu("Other...").click(); - bot.shell("New").activate(); - SWTBotTree tree = bot.tree(); - bot.sleep(1000); - tree.expandNode("Server").select("Server"); - bot.button("Next >").click(); - SWTBotTree tree2 = bot.tree(); - tree2.expandNode("JBoss Community").select("JBoss AS 5.1"); - bot.textWithLabel("Server name:").setText("AS4.2Server"); - bot.button("Next >").click(); - bot.textWithLabel("Name").setText("AS4.2Runtime"); - bot.textWithLabel("Home Directory").setText(JBOSS_AS_42_HOME); - bot.button("Finish").click(); - bot.sleep(2000); - } + bot.textWithLabel("Project name:").setText("B"); + assertTrue(bot.button("Finish").isEnabled()); + bot.comboBoxInGroup("Dynamic web module version").setSelection("2.5"); + bot.comboBoxInGroup("Configuration").setSelection( + "JBossWS Web Service Project v3.0"); + assertFalse(bot.button("Finish").isEnabled()); + bot.button("Next >").click(); + bot.button("Next >").click(); + bot.button("Next >").click(); + bot.radio(0).click(); + bot.sleep(2000); + assertTrue(bot.button("Finish").isEnabled()); + open.finish(bot); + project = ResourcesPlugin.getWorkspace().getRoot().getProject("B"); + assertNotNull(project); + IFacetedProject fproj = ProjectFacetsManager.create(project); + assertNotNull(fproj + .getProjectFacetVersion((IProjectFacet) ProjectFacetsManager + .getProjectFacet("jbossws.core"))); + tryJBIDE6250(); } - public static boolean isServerRuntimeDefined(SWTWorkbenchBot bot, - String runtimeName) { + private void tryJBIDE6250() { + setDefaultWSRuntime(); + + SWTBot wiz = open.newObject(WebServicesWSDL.LABEL); + wiz.textWithLabel(WebServicesWSDL.TEXT_FILE_NAME).setText( + "ClassB" + ".wsdl"); + wiz.textWithLabel( + WebServicesWSDL.TEXT_ENTER_OR_SELECT_THE_PARENT_FOLDER) + .setText("B"); + wiz.button(IDELabel.Button.NEXT).click(); + open.finish(wiz); + eclipse.setClassContentFromResource(bot.editorByTitle("ClassB" + + ".wsdl"), true, + org.jboss.tools.ws.ui.bot.test.Activator.PLUGIN_ID, + "jbossws", "ClassB" + ".wsdl"); + + bot.sleep(1000); + bot.menu("File").menu("New").menu("Other...").click(); + bot.shell("New").activate(); - boolean serverRuntimeNotDefined = true; - - bot.menu("Window").menu("Preferences").click(); - bot.shell("Preferences").activate(); - bot.tree().expandNode("Server").select("Runtime Environments"); - - SWTBotTable tbRuntimeEnvironments = bot.table(); - int numRows = tbRuntimeEnvironments.rowCount(); - if (numRows > 0) { - int currentRow = 0; - while (serverRuntimeNotDefined && currentRow < numRows) { - if (tbRuntimeEnvironments.cell(currentRow, 0).equalsIgnoreCase( - runtimeName)) { - serverRuntimeNotDefined = false; - } else { - currentRow++; - } - } + SWTBotTree tree = bot.tree(); + SWTBotTreeItem item = tree.getTreeItem("Web Services"); + tree.select(item); + item.expand(); + try { + item.getNode("Web Service").select(); + } catch (Exception e) { + item.collapse(); + item.expand(); + item.getNode("Web Service").select(); } - - bot.button("OK").click(); - - return !serverRuntimeNotDefined; - + bot.sleep(1000); + assertTrue(bot.button("Next >").isEnabled()); + bot.button("Next >").click(); + bot.shell("Web Service").activate(); + bot.comboBoxWithLabel("Web service type:").setSelection(1); + bot.comboBoxWithLabel("Service definition:").setText( + "/B/ClassB.wsdl"); + while (!bot.button("Next >").isEnabled()) { + bot.sleep(1000); + } + selectProject(); + bot.button("Next >").click(); + bot.sleep(1000); + assertTrue(bot.checkBox(0).isChecked()); } } Index: src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java =================================================================== --- src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java (revision 0) +++ src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java (revision 0) @@ -0,0 +1,115 @@ +package org.jboss.tools.ws.ui.bot.test; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +import junit.framework.TestCase; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.jboss.tools.test.util.TestProjectProvider; +import org.jboss.tools.ui.bot.ext.SWTBotExt; +import org.jboss.tools.ui.bot.ext.SWTEclipseExt; +import org.jboss.tools.ui.bot.ext.SWTOpenExt; +import org.jboss.tools.ui.bot.ext.parts.SWTBotHyperlinkExt; + +public class WSWizardTest extends TestCase{ + protected static SWTBotExt bot = new SWTBotExt(); + public static final SWTOpenExt open = new SWTOpenExt(bot); + public static final SWTEclipseExt eclipse = new SWTEclipseExt(bot); + public static final String JBOSSWS_HOME_DEFAULT = "D:/softinstall/jboss-5.1.0.GA"; + public static final String JBOSSWS_42_HOME = "jbosstools.test.jboss.home.5.1"; + public static final String JBOSS_AS_42_HOME = System.getProperty( + JBOSSWS_42_HOME, JBOSSWS_HOME_DEFAULT); + IProject project; + + protected void setUp() throws Exception { + bot.viewByTitle("Welcome").close(); + bot.perspectiveByLabel("Java EE").activate(); + createServerRuntime(); + } + protected void tearDown() throws Exception { + bot = null; + } + + public void createServerRuntime() { + if (!isServerRuntimeDefined(bot, "AS4.2Runtime")) { + bot.menu("File").menu("New").menu("Other...").click(); + bot.shell("New").activate(); + SWTBotTree tree = bot.tree(); + bot.sleep(1000); + tree.expandNode("Server").select("Server"); + bot.button("Next >").click(); + SWTBotTree tree2 = bot.tree(); + tree2.expandNode("JBoss Community").select("JBoss AS 5.1"); + bot.textWithLabel("Server name:").setText("AS4.2Server"); + bot.button("Next >").click(); + bot.textWithLabel("Name").setText("AS4.2Runtime"); + bot.textWithLabel("Home Directory").setText(JBOSS_AS_42_HOME); + bot.button("Finish").click(); + bot.sleep(2000); + } + } + + public static boolean isServerRuntimeDefined(SWTWorkbenchBot bot, + String runtimeName) { + + boolean serverRuntimeNotDefined = true; + + bot.menu("Window").menu("Preferences").click(); + bot.shell("Preferences").activate(); + bot.tree().expandNode("Server").select("Runtime Environments"); + + SWTBotTable tbRuntimeEnvironments = bot.table(); + int numRows = tbRuntimeEnvironments.rowCount(); + if (numRows > 0) { + int currentRow = 0; + while (serverRuntimeNotDefined && currentRow < numRows) { + if (tbRuntimeEnvironments.cell(currentRow, 0).equalsIgnoreCase( + runtimeName)) { + serverRuntimeNotDefined = false; + } else { + currentRow++; + } + } + } + + bot.button("OK").click(); + + return !serverRuntimeNotDefined; + + } + + + public IProject importProject() throws CoreException, IOException, InvocationTargetException, InterruptedException { + TestProjectProvider provider = new TestProjectProvider("org.jboss.tools.ws.ui.bot.test", "/projects/" + "A", + "A", true); + IProject prj = provider.getProject(); + return prj; + } + + public void selectProject() { + SWTBotHyperlinkExt link = bot.hyperlink(2); + if(!"Service project: B".equals(link.getText())){ + link.click(); + + SWTBot dBot = bot.activeShell().bot(); + dBot.comboBoxWithLabel("Service project:").setText("B"); + dBot.button("OK").click(); + dBot.sleep(1000); + } + } + public void setDefaultWSRuntime(){ + bot.menu("Window").menu("Preferences").click(); + bot.shell("Preferences").activate(); + SWTBotTree tree = bot.tree(); + tree.expandNode("Web Services").expandNode("Server and Runtime").select(); + bot.comboBoxWithLabel("Web service runtime:").setSelection("JBossWS"); + bot.button("OK").click(); + bot.sleep(2000); + } +} Index: META-INF/MANIFEST.MF =================================================================== --- META-INF/MANIFEST.MF (revision 22476) +++ META-INF/MANIFEST.MF (working copy) @@ -18,7 +18,9 @@ org.eclipse.ui.forms;bundle-version="3.4.1", org.junit4;bundle-version="4.5.0", org.jboss.tools.ws.ui;bundle-version="1.1.0", - org.eclipse.core.resources + org.eclipse.core.resources, + org.jboss.tools.tests, + org.eclipse.wst.common.project.facet.core Bundle-ActivationPolicy: lazy Bundle-RequiredExecutionEnvironment: J2SE-1.5 Eclipse-RegisterBuddy: org.apache.log4j