Author: ljelinko
Date: 2011-11-25 05:07:20 -0500 (Fri, 25 Nov 2011)
New Revision: 36654
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java
Log:
added assert for non expected files
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java 2011-11-25
10:06:33 UTC (rev 36653)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/core/CreateJavaPortlet.java 2011-11-25
10:07:20 UTC (rev 36654)
@@ -44,12 +44,20 @@
@Override
protected List<String> getExpectedFiles() {
return Arrays.asList(
- "WebContent/WEB-INF/default-object.xml",
- "WebContent/WEB-INF/portlet-instances.xml",
+ DEFAULT_OBJECTS_XML,
+ PORTLET_INSTANCES_XML,
CLASS_FILE);
}
@Override
+ protected List<String> getNonExpectedFiles() {
+ return Arrays.asList(
+ JSF_FOLDER,
+ JBOSS_APP_XML,
+ JBOSS_PORTLET_XML);
+ }
+
+ @Override
protected List<XMLNode> getExpectedXMLNodes() {
return Arrays.asList(new XMLNode("portlet-app/portlet/portlet-class",
FULL_CLASS_NAME));
}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java 2011-11-25
10:06:33 UTC (rev 36653)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/jsf/CreateJSFPortlet.java 2011-11-25
10:07:20 UTC (rev 36654)
@@ -6,6 +6,7 @@
import java.util.List;
import org.jboss.tools.portlet.ui.bot.entity.XMLNode;
+import org.jboss.tools.portlet.ui.bot.task.wizard.WizardPageDefaultsFillingTask;
import org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.AbstractPortletCreationTask;
import org.jboss.tools.portlet.ui.bot.task.wizard.web.jboss.JSFPortletCreationTask;
import org.jboss.tools.portlet.ui.bot.test.template.CreatePortletTemplate;
@@ -17,11 +18,9 @@
*
*/
public class CreateJSFPortlet extends CreatePortletTemplate {
-
+
private static final String FACES_CLASS_NAME =
"javax.portlet.faces.GenericFacesPortlet";
-
- private static final String JSF_FOLDER = "WebContent/jsf/";
-
+
@Override
protected String getProjectName() {
return PROJECT_NAME;
@@ -29,7 +28,10 @@
@Override
protected AbstractPortletCreationTask getCreatePortletTask() {
- return new JSFPortletCreationTask();
+ JSFPortletCreationTask task = new JSFPortletCreationTask();
+ task.addWizardPage(new WizardPageDefaultsFillingTask());
+ task.addWizardPage(new WizardPageDefaultsFillingTask());
+ return task;
}
@Override
@@ -37,14 +39,20 @@
return Arrays.asList(
JSF_FOLDER + "edit.jsp",
JSF_FOLDER + "view.jsp",
- JSF_FOLDER + "help.jsp",
- "WebContent/WEB-INF/default-object.xml",
- "WebContent/WEB-INF/portlet-instances.xml",
- "WebContent/WEB-INF/jboss-app.xml",
- "WebContent/WEB-INF/jboss-portlet.xml");
+ JSF_FOLDER + "help.jsp"
+ );
}
@Override
+ protected List<String> getNonExpectedFiles() {
+ return Arrays.asList(
+ DEFAULT_OBJECTS_XML,
+ PORTLET_INSTANCES_XML,
+ JBOSS_APP_XML,
+ JBOSS_PORTLET_XML);
+ }
+
+ @Override
protected List<XMLNode> getExpectedXMLNodes() {
return Arrays.asList(new XMLNode("portlet-app/portlet/portlet-class",
FACES_CLASS_NAME));
}
Modified:
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java
===================================================================
---
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java 2011-11-25
10:06:33 UTC (rev 36653)
+++
trunk/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/test/template/CreatePortletTemplate.java 2011-11-25
10:07:20 UTC (rev 36654)
@@ -1,5 +1,6 @@
package org.jboss.tools.portlet.ui.bot.test.template;
+import static org.hamcrest.Matchers.not;
import static org.jboss.tools.portlet.ui.bot.entity.EntityFactory.file;
import static
org.jboss.tools.portlet.ui.bot.matcher.factory.DefaultMatchersFactory.isNumberOfErrors;
import static
org.jboss.tools.portlet.ui.bot.matcher.factory.WorkspaceMatchersFactory.containsNodes;
@@ -22,32 +23,55 @@
*
*/
public abstract class CreatePortletTemplate extends SWTTaskBasedTestCase {
+
+ protected static final String WEB_INF = "WebContent/WEB-INF/";
+
+ protected static final String DEFAULT_OBJECTS_XML = WEB_INF +
"default-object.xml";
+
+ protected static final String PORTLET_INSTANCES_XML = WEB_INF +
"portlet-instances.xml";
+
+ protected static final String JBOSS_APP_XML = WEB_INF + "jboss-app.xml";
+
+ protected static final String JBOSS_PORTLET_XML = WEB_INF +
"jboss-portlet.xml";
+ protected static final String JSF_FOLDER = "WebContent/jsf/";
+
protected abstract String getProjectName();
-
+
protected abstract AbstractPortletCreationTask getCreatePortletTask();
-
+
protected abstract List<String> getExpectedFiles();
-
+
+ protected abstract List<String> getNonExpectedFiles();
+
protected abstract List<XMLNode> getExpectedXMLNodes();
-
+
@Test
public void testCreate(){
doPerform(getCreatePortletTask());
-
+
doAssertThat(0, isNumberOfErrors());
doAssertThat(getExpectedWorkspaceFiles(), exist());
- doAssertThat(file(getProjectName(), "WebContent/WEB-INF/portlet.xml"),
+ doAssertThat(getNonExpectedWorkspaceFiles(), not(exist()));
+ doAssertThat(file(getProjectName(), WEB_INF + "portlet.xml"),
containsNodes(getExpectedXMLNodes()));
}
-
+
private List<WorkspaceFile> getExpectedWorkspaceFiles(){
- List<WorkspaceFile> expectedWorkspaceFiles = new
ArrayList<WorkspaceFile>();
-
- for (String file : getExpectedFiles()){
- expectedWorkspaceFiles.add(new WorkspaceFile(getProjectName(), file));
+ return wrap(getExpectedFiles());
+ }
+
+ private List<WorkspaceFile> getNonExpectedWorkspaceFiles(){
+ return wrap(getNonExpectedFiles());
+ }
+
+ private List<WorkspaceFile> wrap(List<String> files){
+ List<WorkspaceFile> workspaceFiles = new ArrayList<WorkspaceFile>();
+
+ for (String file : files){
+ workspaceFiles.add(new WorkspaceFile(getProjectName(), file));
}
-
- return expectedWorkspaceFiles;
+
+ return workspaceFiles;
}
}
Show replies by date