Author: scabanovich
Date: 2012-10-10 17:44:01 -0400 (Wed, 10 Oct 2012)
New Revision: 44416
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NewJSFProjectTest.java
Log:
JBIDE-12781
https://issues.jboss.org/browse/JBIDE-12781
Test is added.
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NewJSFProjectTest.java
===================================================================
---
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NewJSFProjectTest.java 2012-10-10
20:45:36 UTC (rev 44415)
+++
trunk/jsf/tests/org.jboss.tools.jsf.ui.test/src/org/jboss/tools/jsf/ui/test/NewJSFProjectTest.java 2012-10-10
21:44:01 UTC (rev 44416)
@@ -13,7 +13,6 @@
import org.jboss.tools.jsf.web.helpers.context.NewProjectWizardContext;
import org.jboss.tools.jst.web.model.helpers.WebAppHelper;
import org.jboss.tools.test.util.ResourcesUtils;
-import org.jboss.tools.test.util.WorkbenchUtils;
import junit.framework.TestCase;
@@ -49,6 +48,7 @@
XModelObject facesConfig =
nature.getModel().getByPath("/faces-config.xml");
assertNotNull(facesConfig);
+ assertEquals("1.2", facesConfig.getAttributeValue("version"));
XModelObject userBean = facesConfig.getChildByPath("Managed Beans/user");
assertNotNull(userBean);
} finally {
@@ -56,6 +56,40 @@
}
}
+ public void testNewJSFProject21Operation() throws Exception {
+ try {
+ NewProjectWizardContext context = new NewProjectWizardContext();
+ IProject project = getProjectHandle();
+ context.setProject(project);
+ IPath defaultPath = ModelUIPlugin.getWorkspace().getRoot().getLocation();
+ IPath locationPath = defaultPath.append(PROJECT_NAME);
+ context.setServletVersion("2.5");
+ context.setProjectLocation(locationPath.toOSString());
+ context.setProjectTemplate("JSFKickStartWithoutLibs");
+ context.setJSFVersion("JSF 2.1");
+
+ JSFProjectCreationOperation operation = new JSFProjectCreationOperation(context);
+ IWorkbenchWindow window =
JsfUiPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
+ window.run(false, false, operation);
+
+ IModelNature nature = EclipseResourceUtil.getModelNature(project);
+ assertNotNull(nature);
+ XModelObject webxml = nature.getModel().getByPath("/web.xml");
+ assertNotNull(webxml);
+
+ XModelObject[] s = WebAppHelper.getServlets(webxml);
+ assertTrue(s.length > 0);
+ String servletName = s[0].getAttributeValue("servlet-name");
+ assertEquals("Faces Servlet", servletName);
+
+ XModelObject facesConfig =
nature.getModel().getByPath("/faces-config.xml");
+ assertNotNull(facesConfig);
+ assertEquals("2.1", facesConfig.getAttributeValue("version"));
+ } finally {
+ ResourcesUtils.deleteProject(PROJECT_NAME);
+ }
+ }
+
private IProject getProjectHandle() {
return ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
}