Author: ljelinko
Date: 2011-11-23 11:25:49 -0500 (Wed, 23 Nov 2011)
New Revision: 36569
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JSFPortletTestSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JavaPortletTestSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJSFPortletProject.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/web/jboss/JBossJSFPortletCapabilitiesWizardPageFillingTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/AssociatedPerspectiveDialogClosingTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/ProjectPropertyDialogOpenTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/facet/AbstractFacetTask.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardFillingTask.java
Log:
Refactored Java portlet project test (created abstraction) and added test for jsf portlet
project
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/AllTestsSuite.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -1,5 +1,6 @@
package org.jboss.tools.portlet.ui.bot.test;
+import org.jboss.tools.portlet.ui.bot.test.create.CreateJSFPortletProject;
import org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortlet;
import org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortletProject;
import org.jboss.tools.portlet.ui.bot.test.create.RunJavaPortletOnServer;
@@ -10,7 +11,8 @@
@Suite.SuiteClasses({
CreateJavaPortletProject.class,
CreateJavaPortlet.class,
- RunJavaPortletOnServer.class
+ RunJavaPortletOnServer.class,
+ CreateJSFPortletProject.class
})
public class AllTestsSuite {
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JSFPortletTestSuite.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JSFPortletTestSuite.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JSFPortletTestSuite.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -0,0 +1,13 @@
+package org.jboss.tools.portlet.ui.bot.test;
+
+import org.jboss.tools.portlet.ui.bot.test.create.CreateJSFPortletProject;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+(a)RunWith(RequirementAwareUsageWindowClosingSuite.class)
+(a)Suite.SuiteClasses({
+ CreateJSFPortletProject.class,
+ })
+public class JSFPortletTestSuite {
+
+}
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JavaPortletTestSuite.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JavaPortletTestSuite.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/JavaPortletTestSuite.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -0,0 +1,17 @@
+package org.jboss.tools.portlet.ui.bot.test;
+
+import org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortlet;
+import org.jboss.tools.portlet.ui.bot.test.create.CreateJavaPortletProject;
+import org.jboss.tools.portlet.ui.bot.test.create.RunJavaPortletOnServer;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+(a)RunWith(RequirementAwareUsageWindowClosingSuite.class)
+(a)Suite.SuiteClasses({
+ CreateJavaPortletProject.class,
+ CreateJavaPortlet.class,
+ RunJavaPortletOnServer.class
+ })
+public class JavaPortletTestSuite {
+
+}
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJSFPortletProject.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJSFPortletProject.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJSFPortletProject.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -0,0 +1,53 @@
+package org.jboss.tools.portlet.ui.bot.test.create;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
+import org.jboss.tools.portlet.ui.bot.test.task.wizard.WizardPageDefaultsFillingTask;
+import org.jboss.tools.portlet.ui.bot.test.task.wizard.WizardPageFillingTask;
+import
org.jboss.tools.portlet.ui.bot.test.task.wizard.web.jboss.JBossJSFPortletCapabilitiesWizardPageFillingTask;
+import
org.jboss.tools.portlet.ui.bot.test.task.wizard.web.jboss.JBossPortletCapabilitiesWizardPageFillingTask;
+import org.jboss.tools.portlet.ui.bot.test.template.CreatePortletProjectTemplate;
+
+
+/**
+ * Creates a new Dynamic Web Project with the specific JBoss JSF Portlet facet.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class CreateJSFPortletProject extends CreatePortletProjectTemplate{
+
+ public static final String PROJECT_NAME = "jsf-portlet";
+
+ protected static final FacetDefinition JSF_PORTLET_FACET = new
FacetDefinition("JBoss JSF Portlet", JBOSS_FACET_CATEGORY);
+
+ protected static final FacetDefinition JSF_FACET = new FacetDefinition("JavaServer
Faces");
+
+ @Override
+ public String getProjectName() {
+ return PROJECT_NAME;
+ }
+
+ @Override
+ public List<FacetDefinition> getRequiredFacets() {
+ List<FacetDefinition> facets = new ArrayList<FacetDefinition>();
+ facets.add(JAVA_FACET);
+ facets.add(JSF_FACET);
+ facets.add(CORE_PORTLET_FACET);
+ facets.add(JSF_PORTLET_FACET);
+ return facets;
+ }
+
+ @Override
+ public List<WizardPageFillingTask> getAdditionalWizardPages() {
+ List<WizardPageFillingTask> tasks = new
ArrayList<WizardPageFillingTask>();
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new
JBossPortletCapabilitiesWizardPageFillingTask(JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new
JBossJSFPortletCapabilitiesWizardPageFillingTask(JBossJSFPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ return tasks;
+ }
+}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/create/CreateJavaPortletProject.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -1,24 +1,13 @@
package org.jboss.tools.portlet.ui.bot.test.create;
-import static org.jboss.tools.portlet.ui.bot.test.entity.EntityFactory.file;
-import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.DefaultMatchersFactory.isNumberOfErrors;
-import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.exists;
-import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.hasFacets;
-import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.isExistingProject;
+import java.util.ArrayList;
+import java.util.List;
import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
-import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
-import org.jboss.tools.portlet.ui.bot.test.task.facet.FacetsSelectionTask;
import org.jboss.tools.portlet.ui.bot.test.task.wizard.WizardPageDefaultsFillingTask;
-import
org.jboss.tools.portlet.ui.bot.test.task.wizard.web.DynamicWebProjectCreationTask;
+import org.jboss.tools.portlet.ui.bot.test.task.wizard.WizardPageFillingTask;
import
org.jboss.tools.portlet.ui.bot.test.task.wizard.web.jboss.JBossPortletCapabilitiesWizardPageFillingTask;
-import org.jboss.tools.portlet.ui.bot.test.testcase.SWTTaskBasedTestCase;
-import org.jboss.tools.ui.bot.ext.SWTTestExt;
-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.ServerState;
-import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
-import org.junit.Test;
+import org.jboss.tools.portlet.ui.bot.test.template.CreatePortletProjectTemplate;
/**
* Creates a new Dynamic Web Project with the specific JBoss Core Portlet facet.
@@ -26,42 +15,29 @@
* @author Lucia Jelinkova
*
*/
-@Require(server=@Server(required=true, state=ServerState.Present, type=ServerType.EPP))
-public class CreateJavaPortletProject extends SWTTaskBasedTestCase{
+public class CreateJavaPortletProject extends CreatePortletProjectTemplate {
public static final String PROJECT_NAME = "java-portlet";
- private static final String FACET_CATEGORY = "JBoss Portlets";
-
- private static final String FACET_NAME = "JBoss Core Portlet";
-
- @Test
- public void testcreate(){
- doPerform(getCreateDynamicWebProjectTask());
-
- doAssertThat(0, isNumberOfErrors());
- doAssertThat(PROJECT_NAME, isExistingProject());
- doAssertThat(file(PROJECT_NAME, "WebContent/WEB-INF/portlet.xml"),
exists());
- doAssertThat(file(PROJECT_NAME, "JBoss Portlet Libraries"), exists());
- doAssertThat(PROJECT_NAME, hasFacets(new FacetDefinition(FACET_NAME,
FACET_CATEGORY)));
+ @Override
+ public String getProjectName() {
+ return PROJECT_NAME;
}
- private AbstractSWTTask getCreateDynamicWebProjectTask() {
- DynamicWebProjectCreationTask task = new DynamicWebProjectCreationTask();
- task.setProjectName(PROJECT_NAME);
- task.setWebModuleVersion("2.5");
- task.setServerName(SWTTestExt.configuredState.getServer().name);
- task.setSelectFacetsTask(getSelectFacetsTask());
- task.addWizardPage(new WizardPageDefaultsFillingTask());
- task.addWizardPage(new WizardPageDefaultsFillingTask());
- task.addWizardPage(new
JBossPortletCapabilitiesWizardPageFillingTask(JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
- return task;
+ @Override
+ public List<FacetDefinition> getRequiredFacets() {
+ List<FacetDefinition> facets = new ArrayList<FacetDefinition>();
+ facets.add(JAVA_FACET);
+ facets.add(CORE_PORTLET_FACET);
+ return facets;
}
- private FacetsSelectionTask getSelectFacetsTask() {
- FacetsSelectionTask task = new FacetsSelectionTask();
- task.addFacet(new FacetDefinition("Java", null, "1.6"));
- task.addFacet(new FacetDefinition(FACET_NAME, FACET_CATEGORY));
- return task;
+ @Override
+ public List<WizardPageFillingTask> getAdditionalWizardPages() {
+ List<WizardPageFillingTask> tasks = new
ArrayList<WizardPageFillingTask>();
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new WizardPageDefaultsFillingTask());
+ tasks.add(new
JBossPortletCapabilitiesWizardPageFillingTask(JBossPortletCapabilitiesWizardPageFillingTask.Type.RUNTIME_PROVIDER));
+ return tasks;
}
}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/matcher/factory/WorkspaceMatchersFactory.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -1,6 +1,7 @@
package org.jboss.tools.portlet.ui.bot.test.matcher.factory;
import java.util.Arrays;
+import java.util.List;
import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
import org.jboss.tools.portlet.ui.bot.test.entity.WorkspaceFile;
@@ -35,6 +36,10 @@
return new ProjectFacetsMatcher(facets);
}
+ public static SWTMatcher<String> hasFacets(List<FacetDefinition> facets){
+ return new ProjectFacetsMatcher(facets.toArray(new FacetDefinition[facets.size()]));
+ }
+
public static SWTMatcher<WorkspaceFile> containsNodes(XMLNode... nodes){
return new XMLFileNodeContentMatcher(Arrays.asList(nodes));
}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/AssociatedPerspectiveDialogClosingTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/AssociatedPerspectiveDialogClosingTask.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/AssociatedPerspectiveDialogClosingTask.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -1,7 +1,10 @@
package org.jboss.tools.portlet.ui.bot.test.task.dialog;
+import org.eclipse.swt.widgets.Shell;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
/**
@@ -26,6 +29,16 @@
SWTBot bot;
try {
+ for (final Shell s : getBot().getFinder().getShells()){
+ UIThreadRunnable.asyncExec(getBot().getDisplay(), new VoidResult(){
+
+ @Override
+ public void run() {
+ System.out.println(s.getText());
+ System.out.println(s);
+ }
+ });
+ }
bot = getBot().shell("Open Associated Perspective?").activate().bot();
} catch (WidgetNotFoundException e) {
// dialog is not open, skip the rest
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/ProjectPropertyDialogOpenTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/ProjectPropertyDialogOpenTask.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/dialog/ProjectPropertyDialogOpenTask.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -2,7 +2,6 @@
import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
-import org.jboss.tools.ui.bot.ext.gen.ActionItem;
import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
import org.jboss.tools.ui.bot.ext.view.PackageExplorer;
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/facet/AbstractFacetTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/facet/AbstractFacetTask.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/facet/AbstractFacetTask.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -62,6 +62,10 @@
facets.add(facet);
}
+ public void addAllFacets(List<FacetDefinition> f){
+ facets.addAll(f);
+ }
+
/**
* Matcher for locating the facet selection tree on the screen.
*
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardFillingTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardFillingTask.java 2011-11-23
16:17:23 UTC (rev 36568)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/WizardFillingTask.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -4,6 +4,7 @@
import java.util.List;
import org.jboss.tools.portlet.ui.bot.test.task.CompositeSWTTask;
+import org.jboss.tools.ui.bot.ext.SWTBotFactory;
/**
*
@@ -27,12 +28,18 @@
super.setTasks(wizardPages);
super.perform();
getBot().button("Finish").click();
+
+ SWTBotFactory.getUtil().waitForAll();
}
public void addWizardPage(WizardPageFillingTask task){
wizardPages.add(task);
}
+ public void addAllWizardPages(List<WizardPageFillingTask> tasks){
+ wizardPages.addAll(tasks);
+ }
+
@Override
protected void beforeTask(WizardPageFillingTask task) {
if (!isFirst(task)){
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/web/jboss/JBossJSFPortletCapabilitiesWizardPageFillingTask.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/web/jboss/JBossJSFPortletCapabilitiesWizardPageFillingTask.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/task/wizard/web/jboss/JBossJSFPortletCapabilitiesWizardPageFillingTask.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -0,0 +1,44 @@
+package org.jboss.tools.portlet.ui.bot.test.task.wizard.web.jboss;
+
+import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
+import org.jboss.tools.portlet.ui.bot.test.task.wizard.WizardPageFillingTask;
+
+/**
+ * Fills the JBoss JSF portlet specific wizard page (for selection of
+ * how the portlet libraries should be configured)
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class JBossJSFPortletCapabilitiesWizardPageFillingTask extends
+ AbstractSWTTask implements WizardPageFillingTask {
+
+ public enum Type {
+ DISABLED("Disable Library Configuration"),
+ USER("User library"),
+ RUNTIME_PROVIDER("JSF Portletbridge Runtime Provider");
+
+ private String desc;
+
+ private Type(String s) {
+ desc = s;
+ }
+
+ @Override
+ public String toString() {
+ return desc;
+ }
+ }
+
+ private Type type;
+
+ public JBossJSFPortletCapabilitiesWizardPageFillingTask(Type type) {
+ super();
+ this.type = type;
+ }
+
+ @Override
+ public void perform() {
+ getBot().comboBoxWithLabel("Type:").setSelection(type.toString());
+ }
+}
Added:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java
(rev 0)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletProjectTemplate.java 2011-11-23
16:25:49 UTC (rev 36569)
@@ -0,0 +1,72 @@
+package org.jboss.tools.portlet.ui.bot.test.template;
+
+import static org.jboss.tools.portlet.ui.bot.test.entity.EntityFactory.file;
+import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.DefaultMatchersFactory.isNumberOfErrors;
+import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.exists;
+import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.hasFacets;
+import static
org.jboss.tools.portlet.ui.bot.test.matcher.factory.WorkspaceMatchersFactory.isExistingProject;
+
+import java.util.List;
+
+import org.jboss.tools.portlet.ui.bot.test.entity.FacetDefinition;
+import org.jboss.tools.portlet.ui.bot.test.task.AbstractSWTTask;
+import org.jboss.tools.portlet.ui.bot.test.task.facet.FacetsSelectionTask;
+import org.jboss.tools.portlet.ui.bot.test.task.wizard.WizardPageFillingTask;
+import
org.jboss.tools.portlet.ui.bot.test.task.wizard.web.DynamicWebProjectCreationTask;
+import org.jboss.tools.portlet.ui.bot.test.testcase.SWTTaskBasedTestCase;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+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.ServerState;
+import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
+import org.junit.Test;
+
+/**
+ * Template test that creates a new dynamic web project with facets specified by
+ * concrete implementaions.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+@Require(server=@Server(required=true, state=ServerState.Present, type=ServerType.EPP))
+public abstract class CreatePortletProjectTemplate extends SWTTaskBasedTestCase {
+
+ protected static final String JBOSS_FACET_CATEGORY = "JBoss Portlets";
+
+ protected static final FacetDefinition CORE_PORTLET_FACET = new
FacetDefinition("JBoss Core Portlet", JBOSS_FACET_CATEGORY);
+
+ protected static final FacetDefinition JAVA_FACET = new
FacetDefinition("Java", null, "1.6");
+
+ public abstract String getProjectName();
+
+ public abstract List<FacetDefinition> getRequiredFacets();
+
+ public abstract List<WizardPageFillingTask> getAdditionalWizardPages();
+
+ @Test
+ public void testcreate(){
+ doPerform(getCreateDynamicWebProjectTask());
+
+ doAssertThat(0, isNumberOfErrors());
+ doAssertThat(getProjectName(), isExistingProject());
+ doAssertThat(file(getProjectName(), "WebContent/WEB-INF/portlet.xml"),
exists());
+ doAssertThat(file(getProjectName(), "JBoss Portlet Libraries"), exists());
+ doAssertThat(getProjectName(), hasFacets(getRequiredFacets()));
+ }
+
+ protected AbstractSWTTask getCreateDynamicWebProjectTask() {
+ DynamicWebProjectCreationTask task = new DynamicWebProjectCreationTask();
+ task.setProjectName(getProjectName());
+ task.setWebModuleVersion("2.5");
+ task.setServerName(SWTTestExt.configuredState.getServer().name);
+ task.setSelectFacetsTask(getSelectFacetsTask());
+ task.addAllWizardPages(getAdditionalWizardPages());
+ return task;
+ }
+
+ protected FacetsSelectionTask getSelectFacetsTask() {
+ FacetsSelectionTask task = new FacetsSelectionTask();
+ task.addAllFacets(getRequiredFacets());
+ return task;
+ }
+}