[jbosstools-commits] JBoss Tools SVN: r22538 - in trunk/ws: plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data and 4 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Jun 4 03:28:17 EDT 2010


Author: Grid.Qian
Date: 2010-06-04 03:28:16 -0400 (Fri, 04 Jun 2010)
New Revision: 22538

Added:
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java
Modified:
   trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java
   trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java
   trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
   trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
   trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java
Log:
JBIDE-6250: fix and create bot test to trunk

Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java	2010-06-04 02:28:26 UTC (rev 22537)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/WSDL2JavaCommand.java	2010-06-04 07:28:16 UTC (rev 22538)
@@ -4,7 +4,6 @@
 import java.util.List;
 
 import org.jboss.tools.ws.creation.core.data.ServiceModel;
-import org.jboss.tools.ws.creation.core.utils.JBossWSCreationUtils;
 
 public class WSDL2JavaCommand extends AbstractGenerateCodeCommand{
 
@@ -56,7 +55,7 @@
 			command.add(model.getTarget());
 		}
 		
-		if(model.enableSOAP12() && JBossWSCreationUtils.supportSOAP12(model.getWebProjectName())){
+		if(model.enableSOAP12()){
 			command.add("-e"); //$NON-NLS-1$
 		}
 	}

Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java	2010-06-04 02:28:26 UTC (rev 22537)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/data/ServiceModel.java	2010-06-04 07:28:16 UTC (rev 22538)
@@ -18,7 +18,7 @@
 	private boolean isGenWSDL;
 	private String target;
 	private int wsScenario;
-	private boolean extension;
+	private boolean extension = true;
 	private String serviceName;
 	private String customClassName;
 

Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties	2010-06-04 02:28:26 UTC (rev 22537)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/messages/JBossWSCreationCore.properties	2010-06-04 07:28:16 UTC (rev 22538)
@@ -21,7 +21,7 @@
 Label_Binding_File=Binding files
 Label_JaxWS_Target=JAX-WS specification
 Label_Update_Webxml=Update the default Web.xml
-Label_EnableSOAP12_Binding_Extension=Enable SOAP 1.2 binding extension (This option is only available for JBossWS 3.0 or later)
+Label_EnableSOAP12_Binding_Extension=Enable binding extension support (Only available for JBossWS 3.0 or later)
 Label_Button_Text_Remove=Remove
 Progress_Message_Generating=Generating Web Service resources...
 Client_Sample_Run_Over= Call Over!

Modified: trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java	2010-06-04 02:28:26 UTC (rev 22537)
+++ trunk/ws/plugins/org.jboss.tools.ws.creation.ui/src/org/jboss/tools/ws/creation/ui/widgets/WSDL2JavaCodeGenConfigWidget.java	2010-06-04 07:28:16 UTC (rev 22538)
@@ -215,7 +215,7 @@
 			});
 		}
 
-		// enable enable soap12 checkbox if the target jbossws runtime is less
+		// select soap12 checkbox if the target jbossws runtime is more
 		// than 3.0
 		updateExtensionButtonStatus();
 
@@ -223,8 +223,9 @@
 	}
 
 	private void updateExtensionButtonStatus() {
-		btnExtension.setEnabled(JBossWSCreationUtils.supportSOAP12(model
-				.getWebProjectName()));
+		boolean a = JBossWSCreationUtils.supportSOAP12(model.getWebProjectName());
+		btnExtension.setEnabled(a);
+		btnExtension.setSelection(a);
 	}
 
 	private void loadBindingFiles(List bindingList) {

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF	2010-06-04 02:28:26 UTC (rev 22537)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF	2010-06-04 07:28:16 UTC (rev 22538)
@@ -15,10 +15,12 @@
  org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
  org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
  org.eclipse.ui.ide;bundle-version="3.5.1",
- org.eclipse.ui.forms;bundle-version="3.4.1",
+ 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

Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java	2010-06-04 02:28:26 UTC (rev 22537)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java	2010-06-04 07:28:16 UTC (rev 22538)
@@ -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;
+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;
 
-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;
+public class JBossWSProjectFacetBotTest extends WSWizardTest {
 
-	protected void setUp() throws Exception {
-		bot = new SWTWorkbenchBot();
-		bot.viewByTitle("Welcome").close();
-		createServerRuntime();
-	}
-
 	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);
-	    
-	}
+		assertTrue(bot.button("Next >").isEnabled());
+		bot.button("Next >").click();
+		bot.shell("New Dynamic Web Project").activate();
+		assertFalse(bot.button("Finish").isEnabled());
 
-	protected void tearDown() throws Exception {
-		bot = null;
+		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();
 	}
 
-	protected void createServerRuntime() {
-		if (!isServerRuntimeDefined(bot, "AS4.2Runtime")) {
-			bot.menu("File").menu("New").menu("Other...").click();
-			bot.shell("New").activate();
-			SWTBotTree tree = bot.tree();
+	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();
+
+		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.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);
-			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);
 		}
+		selectProject();
+		bot.button("Next >").click();
+		bot.sleep(1000);	
+		assertTrue(bot.checkBox(0).isChecked());
 	}
-
-	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;
-
-	}
 }

Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java	                        (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java	2010-06-04 07:28:16 UTC (rev 22538)
@@ -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);
+	}
+}


Property changes on: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSWizardTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain



More information about the jbosstools-commits mailing list