[jbosstools-commits] JBoss Tools SVN: r23541 - in trunk/jst/tests/org.jboss.tools.jst.web.ui.test: projects and 2 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Jul 19 10:44:03 EDT 2010


Author: scabanovich
Date: 2010-07-19 10:44:02 -0400 (Mon, 19 Jul 2010)
New Revision: 23541

Added:
   trunk/jst/tests/org.jboss.tools.jst.web.ui.test/projects/fake_as/
   trunk/jst/tests/org.jboss.tools.jst.web.ui.test/projects/fake_as/.project
Modified:
   trunk/jst/tests/org.jboss.tools.jst.web.ui.test/META-INF/MANIFEST.MF
   trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/AddJSFCapabilitiesTest.java
Log:
https://jira.jboss.org/browse/JBIDE-6540

Modified: trunk/jst/tests/org.jboss.tools.jst.web.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.ui.test/META-INF/MANIFEST.MF	2010-07-19 14:40:34 UTC (rev 23540)
+++ trunk/jst/tests/org.jboss.tools.jst.web.ui.test/META-INF/MANIFEST.MF	2010-07-19 14:44:02 UTC (rev 23541)
@@ -10,7 +10,8 @@
  org.jboss.tools.common.model.ui,
  org.jboss.tools.common.model.ui.test,
  org.jboss.tools.tests,
- org.eclipse.ui.ide
+ org.eclipse.ui.ide,
+ org.eclipse.wst.server.core
 Export-Package: org.jboss.tools.jst.web.ui.test
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: J2SE-1.5

Added: trunk/jst/tests/org.jboss.tools.jst.web.ui.test/projects/fake_as/.project
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.ui.test/projects/fake_as/.project	                        (rev 0)
+++ trunk/jst/tests/org.jboss.tools.jst.web.ui.test/projects/fake_as/.project	2010-07-19 14:44:02 UTC (rev 23541)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>fake_as</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+	</buildSpec>
+	<natures>
+	</natures>
+</projectDescription>


Property changes on: trunk/jst/tests/org.jboss.tools.jst.web.ui.test/projects/fake_as/.project
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/AddJSFCapabilitiesTest.java
===================================================================
--- trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/AddJSFCapabilitiesTest.java	2010-07-19 14:40:34 UTC (rev 23540)
+++ trunk/jst/tests/org.jboss.tools.jst.web.ui.test/src/org/jboss/tools/jst/web/ui/test/AddJSFCapabilitiesTest.java	2010-07-19 14:44:02 UTC (rev 23541)
@@ -6,9 +6,15 @@
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.jface.wizard.IWizard;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.wst.server.core.IRuntime;
+import org.eclipse.wst.server.core.IRuntimeType;
+import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
+import org.eclipse.wst.server.core.ServerCore;
 import org.jboss.tools.common.meta.key.WizardKeys;
 import org.jboss.tools.common.model.ui.ModelUIPlugin;
 import org.jboss.tools.common.model.ui.action.AddNatureActionDelegate;
@@ -20,6 +26,7 @@
 
 public class AddJSFCapabilitiesTest extends TestCase {
 	IProject project = null;
+	IProject fake_as = null;
 
 	public AddJSFCapabilitiesTest() {
 		super("Add JSF Capabilities Test");
@@ -41,6 +48,17 @@
 			project = setup.importProject();
 		}
 		this.project = project.getProject();
+
+		IResource fake_as = ResourcesPlugin.getWorkspace().getRoot().findMember("fake_as");
+		if(fake_as == null) {
+			ProjectImportTestSetup setup = new ProjectImportTestSetup(
+					this,
+					"org.jboss.tools.jst.web.ui.test",
+					"projects/fake_as",
+					"fake_as");
+			fake_as = setup.importProject();
+		}
+		this.fake_as = fake_as.getProject();
 		JobUtils.waitForIdle();
 	}
 
@@ -52,11 +70,40 @@
 		dialog.setBlockOnOpen(false);
 		dialog.open();
 
-		//TODO implement finish of wizard and check of results.
-		//TODO it is necessary to provide server runtime; without it, wizard cannot finish
-		System.out.println(wizard.canFinish());
+		IRuntime r0 = createRuntime();
+		((ImportWebProjectWizard)wizard).setRuntimeName(r0.getName());
+
+		assertTrue(wizard.canFinish());
+		
+		boolean b = wizard.performFinish();
+
+		assertTrue(b);
+		
+		try {
+			assertTrue(project.hasNature("org.jboss.tools.jsf.jsfnature"));
+		} catch (CoreException e) {
+			fail(e.getMessage());
+		}
 	}
 
+	static String RUNTIME = "org.jboss.ide.eclipse.as.runtime.42";
+	
+	IRuntime createRuntime() {
+		IRuntimeType t = ServerCore.findRuntimeType(RUNTIME);
+		
+		IPath location = fake_as.getLocation();
+		try {
+			IRuntimeWorkingCopy r = t.createRuntime(RUNTIME, new NullProgressMonitor());
+			r.setName("myRuntime");
+			r.setLocation(location);
+			return r.save(true, new NullProgressMonitor());
+		
+		} catch (CoreException e) {
+			fail(e.getMessage());
+			return null;
+		}
+	}
+	
 	private void refreshProject(IProject project){
 		try {
 			project.refreshLocal(IResource.DEPTH_INFINITE, null);



More information about the jbosstools-commits mailing list