[seam-commits] Seam SVN: r12432 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen: utils and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Mon Apr 12 05:17:45 EDT 2010
Author: jharting
Date: 2010-04-12 05:17:44 -0400 (Mon, 12 Apr 2010)
New Revision: 12432
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
Log:
JBPAPP-3861
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java 2010-04-12 08:04:47 UTC (rev 12431)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentNewFormTest.java 2010-04-12 09:17:44 UTC (rev 12432)
@@ -22,6 +22,9 @@
package org.jboss.seam.test.functional.seamgen;
import static org.testng.Assert.assertTrue;
+import org.jboss.seam.test.functional.seamgen.ComponentHolder;
+import org.jboss.seam.test.functional.seamgen.SeamGenTest;
+
import org.testng.annotations.Test;
/**
@@ -37,7 +40,12 @@
@Override
protected void prepareData()
{
- newComponentProperties = new String[] { "hi", "HiLocal", "Hi", "hi", "hiPage" };
+ // war version
+ if(SeamGenTest.WAR)
+ newComponent = new ComponentHolder("hi", null, "Hi", "hi", "hiPage");
+ // ear version
+ else
+ newComponent = new ComponentHolder("hi", "HiLocal", "Hi", "hi", "hiPage");
}
@Override
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java 2010-04-12 08:04:47 UTC (rev 12431)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewActionTest.java 2010-04-12 09:17:44 UTC (rev 12432)
@@ -21,6 +21,12 @@
*/
package org.jboss.seam.test.functional.seamgen;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.seam.test.functional.seamgen.ComponentHolder;
+import org.jboss.seam.test.functional.seamgen.SeamGenTest;
+
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -28,29 +34,30 @@
/**
* This class verifies functionality of "new-action command".
+ *
* @author Jozef Hartinger
- *
+ *
*/
public class NewActionTest extends SeleniumSeamGenTest
{
- protected String[] newComponentProperties;
-
+ protected ComponentHolder newComponent;
+
@BeforeClass
- public void createNewAction() throws InterruptedException {
+ public void createNewAction() throws InterruptedException
+ {
prepareData();
generateNewComponent();
deployNewComponent();
waitForAppToDeploy(getComponentPath(), FOOTER);
}
-
@Test(groups = { "newActionGroup" }, dependsOnGroups = { "newProjectGroup" })
public void testNewComponent()
{
- String form = "id=" + newComponentProperties[0] + "Form";
- String button = form + ":" + newComponentProperties[3];
-
+ String form = "id=" + newComponent.name + "Form";
+ String button = form + ":" + newComponent.actionMethod;
+
browser.open(getComponentPath());
assertTrue(browser.isElementPresent(FOOTER), "Footer not found.");
@@ -60,23 +67,86 @@
browser.clickAndWait(button);
assertTrue(browser.isElementPresent(MESSAGES));
- assertTrue(browser.getText(MESSAGES).contains(newComponentProperties[3]));
+ assertTrue(browser.getText(MESSAGES).contains(newComponent.actionMethod));
}
public void generateNewComponent()
{
- seamGen.newAction(newComponentProperties);
+ seamGen.newAction(newComponent.asArray());
}
-
- protected void prepareData() {
- newComponentProperties = new String[]{ "ping", "PingLocal", "Ping", "ping", "pingPage" };
+
+ protected void prepareData()
+ {
+ // war version
+ if (SeamGenTest.WAR)
+ newComponent = new ComponentHolder("ping", null, "Ping", "ping", "pingPage");
+ // ear version
+ else
+ newComponent = new ComponentHolder("ping", "PingLocal", "Ping", "ping", "pingPage");
}
-
- public String getComponentPath() {
- return "/" + APP_NAME + "/" + newComponentProperties[4] + ".seam";
+
+ public String getComponentPath()
+ {
+ return "/" + APP_NAME + "/" + newComponent.pageName + ".seam";
}
-
- protected void deployNewComponent() {
+
+ protected void deployNewComponent()
+ {
seamGen.restart();
}
}
+
+/**
+ * Holds component input for seam-gen
+ *
+ * @author kpiwko
+ *
+ */
+class ComponentHolder
+{
+ String name;
+ String localInterface;
+ String beanClass;
+ String actionMethod;
+ String pageName;
+
+ /**
+ * Constructs new component holder
+ *
+ * @param name Name of component
+ * @param localInterface Name of local interface
+ * @param beanClass Name of bean class
+ * @param actionMethod Name of action method
+ * @param pageName Name of Seam page
+ */
+ public ComponentHolder(String name, String localInterface, String beanClass, String actionMethod, String pageName)
+ {
+ this.name = name;
+ this.localInterface = localInterface;
+ this.beanClass = beanClass;
+ this.actionMethod = actionMethod;
+ this.pageName = pageName;
+ }
+
+ /**
+ * Return properties set in holder as array of strings
+ *
+ * @return Constructed array
+ */
+ public String[] asArray()
+ {
+ List<String> list = new ArrayList<String>();
+ if (name != null)
+ list.add(name);
+ if (localInterface != null)
+ list.add(localInterface);
+ if (beanClass != null)
+ list.add(beanClass);
+ if (actionMethod != null)
+ list.add(actionMethod);
+ if (pageName != null)
+ list.add(pageName);
+
+ return list.toArray(new String[] {});
+ }
+}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java 2010-04-12 08:04:47 UTC (rev 12431)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/NewFormTest.java 2010-04-12 09:17:44 UTC (rev 12432)
@@ -24,6 +24,9 @@
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertEquals;
+import org.jboss.seam.test.functional.seamgen.ComponentHolder;
+import org.jboss.seam.test.functional.seamgen.SeamGenTest;
+
import org.testng.annotations.Test;
/**
@@ -39,8 +42,8 @@
public void testNewComponent()
{
- String form = "id=" + newComponentProperties[0] + "Form";
- String button = form + ":" + newComponentProperties[3];
+ String form = "id=" + newComponent.name + "Form";
+ String button = form + ":" + newComponent.actionMethod;
String field = form + ":" + "valueField:value";
String value = "world";
@@ -55,17 +58,22 @@
browser.clickAndWait(button);
assertTrue(browser.isElementPresent(MESSAGES), "Message not found.");
- assertEquals(browser.getText(MESSAGES), newComponentProperties[3] + " " + value, "Unexpected form output.");
+ assertEquals(browser.getText(MESSAGES), newComponent.actionMethod + " " + value, "Unexpected form output.");
}
@Override
protected void prepareData() {
- newComponentProperties = new String[]{ "hello", "HelloLocal", "Hello", "hello", "helloPage" };
+ // war version
+ if (SeamGenTest.WAR)
+ newComponent = new ComponentHolder("hello", null, "Hello", "hello", "helloPage");
+ // ear version
+ else
+ newComponent = new ComponentHolder("hello", "HelloLocal", "Hello", "hello", "helloPage");
}
@Override
public void generateNewComponent()
{
- seamGen.newForm(newComponentProperties);
+ seamGen.newForm(newComponent.asArray());
}
}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java 2010-04-12 08:04:47 UTC (rev 12431)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/utils/SeamGenAdapter.java 2010-04-12 09:17:44 UTC (rev 12432)
@@ -197,7 +197,7 @@
*/
class InputStreamEater extends Thread
{
- private static final String INPUT_CHALLENGE = "[input]";
+ private static final String INPUT_CHALLENGE = "[input] Enter";
private BufferedReader stream;
private OutputStreamFeeder feederToNotify;
private PrintStream out;
More information about the seam-commits
mailing list