Author: lfryc(a)redhat.com
Date: 2010-07-28 09:41:42 -0400 (Wed, 28 Jul 2010)
New Revision: 18257
Added:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerProperties.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Templates.java
Removed:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/internal/
Modified:
root/tests/metamer/trunk/ftest-source/pom.xml
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java
Log:
added support for Templates configured by MatrixConfigurator
Modified: root/tests/metamer/trunk/ftest-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest-source/pom.xml 2010-07-28 13:40:23 UTC (rev 18256)
+++ root/tests/metamer/trunk/ftest-source/pom.xml 2010-07-28 13:41:42 UTC (rev 18257)
@@ -54,6 +54,11 @@
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>metamer</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/AbstractMetamerTest.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -32,12 +32,12 @@
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.TemplatesList;
+import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.testng.SkipException;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
/**
* Abstract test case used as a basis for majority of test cases.
@@ -51,10 +51,11 @@
* timeout in miliseconds
*/
public static final long TIMEOUT = 5000;
- private String[][] templates;
- public AbstractMetamerTest() {
- }
+ @Inject
+ @Templates(include = { "plain", "richDataTable1,redDiv",
"richDataTable2,redDiv", "a4jRepeat1", "a4jRepeat2",
+ "hDataTable1", "hDataTable2", "uiRepeat1",
"uiRepeat2" })
+ private TemplatesList template;
/**
* Returns the url to test page to be opened by Selenium
@@ -64,42 +65,6 @@
public abstract URL getTestUrl();
/**
- * Data provider for templates.
- *
- * @return array containing templates that should be used (defined in testng.xml) or
default array (containing only
- * plain template) if nothing is defined
- */
- @DataProvider(name = "templates")
- protected Object[][] getTemplates() {
- if (templates != null && templates.length > 0) {
- return templates;
- }
-
- return new Object[][] { { "plain" } };
- }
-
- /**
- * Loads and parses attribute "templates" from testng.xml.
- *
- * @param urlParams
- */
- @BeforeClass(alwaysRun = true)
- @Parameters({ "templates" })
- public void initTemplates(@Optional String urlParams) {
- if (urlParams == null) {
- return;
- }
-
- String[] array = urlParams.split(" ");
- templates = new String[array.length][];
-
- for (int i = 0; i < array.length; i++) {
- templates[i] = new String[1];
- templates[i][0] = array[i];
- }
- }
-
- /**
* Opens the tested page. If templates is not empty nor null, it appends url
parameter with templates.
*
* @param templates
@@ -110,17 +75,14 @@
if (selenium == null) {
new SkipException("selenium isn't initialized");
}
- String urlParams = "";
- if (templates != null && templates.length != 0) {
- urlParams = "?templates=" + templates[0];
- }
- selenium.open(buildUrl(getTestUrl() + urlParams));
+ selenium.open(buildUrl(getTestUrl() + "?templates=" +
template.toString()));
selenium.waitForPageToLoad(TIMEOUT);
}
/**
* Invalidates session by clicking on a button on tested page.
*/
+ @AfterMethod(alwaysRun = true)
public void invalidateSession() {
selenium.deleteAllVisibleCookies();
}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MatrixConfigurator.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -25,6 +25,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
@@ -39,51 +40,80 @@
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
+import org.jboss.test.selenium.listener.TestMethodSelector;
+import org.richfaces.tests.metamer.Template;
+import org.richfaces.tests.metamer.TemplatesList;
import org.richfaces.tests.metamer.ftest.annotations.Inject;
+import org.richfaces.tests.metamer.ftest.annotations.Templates;
import org.richfaces.tests.metamer.ftest.annotations.Use;
-import org.richfaces.tests.metamer.ftest.internal.NamedType;
import org.testng.IAnnotationTransformer;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.IMethodInstance;
import org.testng.IMethodInterceptor;
import org.testng.ITestContext;
+import org.testng.ITestNGMethod;
import org.testng.ITestResult;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.AfterSuite;
-import org.testng.annotations.AfterTest;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.ITestAnnotation;
+import org.testng.annotations.Test;
/**
* @author <a href="mailto:ppitonak@redhat.com">Lukas Fryc</a>
* @version $Revision$
*/
-public class MatrixConfigurator implements IAnnotationTransformer,
IInvokedMethodListener, IMethodInterceptor {
+public class MatrixConfigurator extends TestMethodSelector implements
IAnnotationTransformer, IInvokedMethodListener,
+ IMethodInterceptor {
- private static final Class<? extends Annotation>[] AFTER_ANNOTATION = new
Class[] { AfterMethod.class,
- AfterClass.class, AfterTest.class, AfterSuite.class };
-
Map<Class<?>, Map<Method, Configuration>> configurations = new
HashMap<Class<?>, Map<Method, Configuration>>();
LinkedList<Method> methods = new LinkedList<Method>();
boolean methodConfigured = false;
public List<IMethodInstance> intercept(List<IMethodInstance>
methodInstances, ITestContext context) {
for (IMethodInstance methodInstance : methodInstances) {
- for (int i = 0; i < methodInstance.getMethod().getInvocationCount(); i++)
{
+ int parameterCount = 1;
+ Test testAnnotation =
methodInstance.getMethod().getMethod().getAnnotation(Test.class);
+
+ if (!"".equals(testAnnotation.dataProvider())) {
+ Object testInstance = methodInstance.getMethod().getInstances()[0];
+ try {
+ Method method = getProvidingMethod(testAnnotation.dataProvider(),
testInstance.getClass());
+ boolean isAccessible = method.isAccessible();
+ if (!isAccessible) {
+ method.setAccessible(true);
+ }
+ Object[][] result = (Object[][]) method.invoke(testInstance);
+ method.setAccessible(isAccessible);
+ parameterCount = result.length;
+ } catch (Exception e) {
+ throw new IllegalStateException("Cannot obtain data from
dataProvider", e);
+ }
+ }
+
+ for (int i = 0; i < (parameterCount *
methodInstance.getMethod().getInvocationCount()); i++) {
methods.add(methodInstance.getMethod().getMethod());
}
}
return methodInstances;
}
+ private Method getProvidingMethod(String providerName, Class<?>
testInstanceClass) {
+ for (Method method : getAllMethods(testInstanceClass)) {
+ DataProvider dataProvider = method.getAnnotation(DataProvider.class);
+ if (dataProvider != null) {
+ if (providerName.equals(dataProvider.name())) {
+ return method;
+ }
+ }
+ }
+
+ throw new IllegalStateException("For provider name '" +
providerName + "' doesn't exists associated provider");
+ }
+
public void beforeInvocation(IInvokedMethod invokedMethod, ITestResult testResult) {
if (!methodConfigured) {
- Method method = invokedMethod.getTestMethod().getMethod();
- for (Class<? extends Annotation> annotationClass : AFTER_ANNOTATION) {
- if (method.getAnnotation(annotationClass) != null) {
- return;
- }
+ if (isAfterConfiguration(invokedMethod.getTestMethod())) {
+ return;
}
configureMethod(testResult);
@@ -92,23 +122,28 @@
}
}
+ private boolean isAfterConfiguration(ITestNGMethod m) {
+ return m.isAfterClassConfiguration() || m.isAfterGroupsConfiguration() ||
m.isAfterMethodConfiguration()
+ || m.isAfterSuiteConfiguration() || m.isAfterTestConfiguration();
+ }
+
private void configureMethod(ITestResult testResult) {
Method realMethod = ((Queue<Method>) methods).poll();
+
Class<?> realClass = realMethod.getDeclaringClass();
-
+
if (!configurations.get(realClass).get(realMethod).hasNext()) {
return;
}
-
+
final Object testInstance = testResult.getInstance();
- Map<NamedType, Object> configuration =
configurations.get(realClass).get(realMethod).next();
+ Map<Field, Object> configuration =
configurations.get(realClass).get(realMethod).next();
try {
- for (Entry<NamedType, Object> entry : configuration.entrySet()) {
- final NamedType namedType = entry.getKey();
+ for (Entry<Field, Object> entry : configuration.entrySet()) {
+ final Field field = entry.getKey();
final Object parameter = entry.getValue();
- Field field = realClass.getDeclaredField(namedType.getName());
Object assignment;
if (parameter instanceof String &&
!parameter.getClass().isAssignableFrom(field.getType())) {
Field parameterField = realClass.getDeclaredField((String)
parameter);
@@ -141,26 +176,28 @@
}
public void transform(ITestAnnotation annotation, Class testClass, Constructor
testConstructor, Method testMethod) {
+ super.transform(annotation, testClass, testConstructor, testMethod);
int invocationCount = createConfiguration(testMethod.getDeclaringClass(),
testMethod);
annotation.setInvocationCount(invocationCount);
}
public int createConfiguration(Class<?> realClass, Method realMethod) {
- Map<NamedType, List<? extends Object>> parameters = new
LinkedHashMap<NamedType, List<? extends Object>>();
+ Map<Field, List<? extends Object>> parameters = new
LinkedHashMap<Field, List<? extends Object>>();
- List<NamedType> unsatisfied = new LinkedList<NamedType>();
+ List<Field> unsatisfied = new LinkedList<Field>();
// get a list of satisfied and unsatisfied parameters/injections
- for (Field field : realClass.getDeclaredFields()) {
+ Field[] allFields = getAllFields(realClass);
+ for (Field field : allFields) {
if (field.getAnnotation(Inject.class) != null) {
- final NamedType namedType = new NamedType(field.getType(),
field.getName());
- if (field.getAnnotation(Use.class) != null ||
field.getAnnotation(Use.class) != null) {
- parameters.put(namedType,
- getUseParameter(realClass, field.getType(),
field.getAnnotation(Use.class)));
+ if (field.getAnnotation(Use.class) != null) {
+ parameters.put(field, getUseParameter(realClass, field.getType(),
field.getAnnotation(Use.class)));
+ } else if (field.getAnnotation(Templates.class) != null) {
+ parameters.put(field,
+ getTemplatesParameter(realClass, field.getType(),
field.getAnnotation(Templates.class)));
} else {
- parameters.put(namedType, null);
- unsatisfied.add(namedType);
+ unsatisfied.add(field);
}
}
}
@@ -168,10 +205,10 @@
for (Annotation annotation : realMethod.getAnnotations()) {
if (annotation.annotationType() == Use.class) {
Use use = (Use) annotation;
- for (NamedType namedType : parameters.keySet()) {
- if (namedType.getName().equals(use.field())) {
- parameters.put(namedType, getUseParameter(realClass,
namedType.getParameterType(), use));
- unsatisfied.remove(namedType);
+ for (Field field : parameters.keySet()) {
+ if (field.getName().equals(use.field())) {
+ parameters.put(field, getUseParameter(realClass, field.getType(),
use));
+ unsatisfied.remove(field);
}
}
}
@@ -195,6 +232,36 @@
return Math.max(1, count);
}
+ private Field[] getAllFields(Class<?> testClass) {
+ List<Field> fields = new ArrayList<Field>();
+
+ Class<?> currentClass = testClass;
+ while (currentClass != Object.class) {
+ fields.addAll(Arrays.asList(currentClass.getDeclaredFields()));
+ if (currentClass == AbstractMetamerTest.class) {
+ break;
+ }
+ currentClass = currentClass.getSuperclass();
+ }
+
+ return fields.toArray(new Field[fields.size()]);
+ }
+
+ private Method[] getAllMethods(Class<?> testClass) {
+ List<Method> allMethods = new ArrayList<Method>();
+
+ Class<?> currentClass = testClass;
+ while (currentClass != Object.class) {
+ allMethods.addAll(Arrays.asList(currentClass.getDeclaredMethods()));
+ if (currentClass == AbstractMetamerTest.class) {
+ break;
+ }
+ currentClass = currentClass.getSuperclass();
+ }
+
+ return allMethods.toArray(new Method[allMethods.size()]);
+ }
+
private Map<Method, Configuration> getClassConfigurations(Class<?>
realClass) {
if (!configurations.containsKey(realClass)) {
configurations.put(realClass, new HashMap<Method, Configuration>());
@@ -202,17 +269,17 @@
return configurations.get(realClass);
}
- private List<? extends Object> getUseParameter(Class<?> testClass,
Class<?> parameterType, Use use) {
+ private List<? extends Object> getUseParameter(Class<?> testClass,
Class<?> parameterType, Use useAnnotation) {
if (parameterType == int.class || parameterType == Integer.class) {
- return Arrays.asList(ArrayUtils.toObject(use.ints()));
+ return Arrays.asList(ArrayUtils.toObject(useAnnotation.ints()));
}
// tries satisfy parameter from fields
List<Object> result = new LinkedList<Object>();
- for (int i = 0; i < use.value().length; i++) {
+ for (int i = 0; i < useAnnotation.value().length; i++) {
boolean satisfied = false;
for (Field field : testClass.getDeclaredFields()) {
- String name = use.value()[i];
+ String name = useAnnotation.value()[i];
name = StringUtils.replace(name, "*", ".+");
name = StringUtils.replace(name, "?", ".");
Pattern pattern = Pattern.compile(name);
@@ -231,50 +298,66 @@
return result;
}
- private class Configuration implements Iterator<Map<NamedType, Object>>
{
- Map<NamedType, List<? extends Object>> parameters;
- Map<NamedType, Queue<? extends Object>> queues;
+ private List<TemplatesList> getTemplatesParameter(Class<?> testClass,
Class<?> parameterType,
+ Templates templatesAnnotation) {
+ if (parameterType != TemplatesList.class) {
+ throw new IllegalStateException("only " + Template.class.getName()
+ + " fields can be annotated with @Inject @Templates");
+ }
+
+ List<TemplatesList> templates = MetamerProperties.getTemplates();
+
+ if (templates == null) {
+ templates = MetamerProperties.parseTemplates(templatesAnnotation.include());
+ }
+
+ return templates;
+ }
+
+ private class Configuration implements Iterator<Map<Field, Object>> {
+ Map<Field, List<? extends Object>> parameters;
+ Map<Field, Queue<? extends Object>> queues;
Queue<? extends Object> lastQueue;
- public Configuration(Map<NamedType, List<? extends Object>>
parameters) {
+ public Configuration(Map<Field, List<? extends Object>> parameters)
{
this.parameters = parameters;
reset();
}
public void reset() {
- queues = new LinkedHashMap<NamedType, Queue<? extends
Object>>();
- for (Entry<NamedType, List<? extends Object>> entry :
parameters.entrySet()) {
- final NamedType namedType = entry.getKey();
+ queues = new LinkedHashMap<Field, Queue<? extends Object>>();
+ for (Entry<Field, List<? extends Object>> entry :
parameters.entrySet()) {
+ final Field field = entry.getKey();
List<? extends Object> parameter = entry.getValue();
lastQueue = new LinkedList<Object>(parameter);
- queues.put(namedType, lastQueue);
+ queues.put(field, lastQueue);
}
}
- public Map<NamedType, Object> next() {
+ public Map<Field, Object> next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
- Map<NamedType, Object> pass = new HashMap<NamedType, Object>();
+ Map<Field, Object> pass = new HashMap<Field, Object>();
- for (Entry<NamedType, Queue<? extends Object>> entry :
queues.entrySet()) {
- final NamedType namedType = entry.getKey();
+ for (Entry<Field, Queue<? extends Object>> entry :
queues.entrySet()) {
+ final Field field = entry.getKey();
final Queue<? extends Object> queue = entry.getValue();
- pass.put(namedType, queue.peek());
+ pass.put(field, queue.peek());
}
- for (Entry<NamedType, Queue<? extends Object>> entry :
queues.entrySet()) {
- final NamedType namedType = entry.getKey();
+ for (Entry<Field, Queue<? extends Object>> entry :
queues.entrySet()) {
+ final Field field = entry.getKey();
final Queue<? extends Object> queue = entry.getValue();
queue.poll();
if (queue.isEmpty() && hasNext()) {
- List<? extends Object> parameter = parameters.get(namedType);
- queues.put(namedType, new LinkedList<Object>(parameter));
+ List<? extends Object> parameter = parameters.get(field);
+ queues.put(field, new LinkedList<Object>(parameter));
} else {
break;
}
Added:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerProperties.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerProperties.java
(rev 0)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/MetamerProperties.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ *******************************************************************************/
+package org.richfaces.tests.metamer.ftest;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.commons.lang.StringUtils;
+import org.richfaces.tests.metamer.TemplatesList;
+import org.richfaces.tests.metamer.TemplatesListConverter;
+
+/**
+ * @author <a href="mailto:ppitonak@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public final class MetamerProperties {
+
+ private MetamerProperties() {
+ }
+
+ public static List<TemplatesList> getTemplates() {
+ final String templatesString = System.getProperty("templates");
+
+ if (templatesString == null) {
+ return null;
+ }
+
+ String[] templatesArray = StringUtils.split(templatesString, ";");
+
+ return parseTemplates(templatesArray);
+ }
+
+ public static List<TemplatesList> parseTemplates(String[] templatesArray) {
+ final TemplatesListConverter convertor = new TemplatesListConverter();
+ List<TemplatesList> templates = new LinkedList<TemplatesList>();
+
+ for (String template : templatesArray) {
+ templates.add((TemplatesList) convertor.getAsObject(null, null, template));
+ }
+
+ return templates;
+ }
+}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -29,7 +29,6 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
/**
@@ -51,14 +50,8 @@
return buildUrl(contextPath,
"faces/components/a4jActionListener/all.xhtml");
}
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates")
- public void testInvokeListenerByType(String templates) {
+ @Test
+ public void testInvokeListenerByType() {
final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
final String msg = "Implementation of ActionListener created and called:
"
+
"org.richfaces.tests.metamer.bean.A4JActionListenerBean$ActionListenerImpl";
@@ -89,8 +82,8 @@
}
- @Test(dataProvider = "templates")
- public void testInvokeListenerByBinding(String templates) {
+ @Test
+ public void testInvokeListenerByBinding() {
final String msg = "Bound listener called";
selenium.click(invokeButtonBinding);
@@ -103,8 +96,8 @@
assertEquals(count, 1, "Only one message should be displayed on the
page.");
}
- @Test(dataProvider = "templates")
- public void testInvokeListenerMethod(String templates) {
+ @Test
+ public void testInvokeListenerMethod() {
final String msg = "Method expression listener called";
selenium.click(invokeButtonMethod);
@@ -117,8 +110,8 @@
assertEquals(count, 1, "Only one message should be displayed on the
page.");
}
- @Test(dataProvider = "templates")
- public void testInvokeListenerMethodCC(String templates) {
+ @Test
+ public void testInvokeListenerMethodCC() {
final String msg = "Method expression listener called from composite
component";
selenium.click(invokeButtonCC);
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandButton/TestA4JCommandButton.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -34,7 +34,6 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
/**
@@ -56,14 +55,8 @@
return buildUrl(contextPath,
"faces/components/a4jCommandButton/simple.xhtml");
}
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
+ @Test(groups = "client-side-perf")
+ public void testSimpleClick() {
selenium.typeKeys(input, "RichFaces 4");
selenium.click(button);
@@ -79,8 +72,8 @@
assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces
4' in input");
}
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
+ @Test
+ public void testSimpleClickUnicode() {
selenium.typeKeys(input, "ľščťžýáíéňô");
selenium.click(button);
@@ -96,8 +89,8 @@
assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when
'ľščťžýáíéňô' in input");
}
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
+ @Test
+ public void testAction() {
JQueryLocator doubleStringAction =
pjq("input[value=doubleStringAction]");
JQueryLocator first6CharsAction =
pjq("input[value=first6CharsAction]");
JQueryLocator toUpperCaseAction =
pjq("input[value=toUpperCaseAction]");
@@ -128,8 +121,8 @@
assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces
4ě' in input and toUpperCaseAction selected");
}
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
+ @Test
+ public void testActionListener() {
JQueryLocator doubleStringActionListener =
pjq("input[value=doubleStringActionListener]");
JQueryLocator first6CharsActionListener =
pjq("input[value=first6CharsActionListener]");
JQueryLocator toUpperCaseActionListener =
pjq("input[value=toUpperCaseActionListener]");
@@ -161,8 +154,8 @@
"output2 when 'RichFaces 4ě' in input and
toUpperCaseActionListener selected");
}
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
+ @Test
+ public void testDisabled() {
JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
AttributeLocator<?> disabledAttribute = button.getAttribute(new
Attribute("disabled"));
@@ -173,58 +166,58 @@
assertEquals(isDisabled.toLowerCase(), "disabled", "The value of
attribute disabled");
}
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
+ @Test
+ public void testOnclick() {
testFireEvent(Event.CLICK, button);
}
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
+ @Test
+ public void testOndblclick() {
testFireEvent(Event.DBLCLICK, button);
}
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
+ @Test
+ public void testOnkeydown() {
testFireEvent(Event.KEYDOWN, button);
}
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
+ @Test
+ public void testOnkeypress() {
testFireEvent(Event.KEYPRESS, button);
}
- @Test(dataProvider = "templates")
- public void testOneyup(String templates) {
+ @Test
+ public void testOneyup() {
testFireEvent(Event.KEYUP, button);
}
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
+ @Test
+ public void testOnmousedown() {
testFireEvent(Event.MOUSEDOWN, button);
}
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
+ @Test
+ public void testOnmousemove() {
testFireEvent(Event.MOUSEMOVE, button);
}
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
+ @Test
+ public void testOnmouseout() {
testFireEvent(Event.MOUSEOUT, button);
}
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
+ @Test
+ public void testOnmouseover() {
testFireEvent(Event.MOUSEOVER, button);
}
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
+ @Test
+ public void testOnmouseup() {
testFireEvent(Event.MOUSEUP, button);
}
- @Test(dataProvider = "templates")
- public void testRender(String templates) {
+ @Test
+ public void testRender() {
JQueryLocator renderInput = pjq("input[name$=renderInput]");
selenium.type(renderInput, "output1");
@@ -263,8 +256,8 @@
}
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
+ @Test
+ public void testRendered() {
JQueryLocator renderedCheckbox = pjq("input[name$=renderedInput]");
selenium.click(renderedCheckbox);
@@ -272,8 +265,8 @@
assertFalse(selenium.isElementPresent(button), "Button should not be
displayed");
}
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
+ @Test
+ public void testStyleClass() {
JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
@@ -293,8 +286,8 @@
assertFalse(selenium.isAttributePresent(classAttribute), "Button's class
was not removed.");
}
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
+ @Test
+ public void testStyle() {
JQueryLocator styleInput = pjq("input[id$=styleInput]");
final AttributeLocator<?> attribute = button.getAttribute(new
Attribute("style"));
final String value = "font-size: 20px;";
@@ -305,8 +298,8 @@
assertEquals(selenium.getAttribute(attribute), value, "Style of the button
did not change");
}
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
+ @Test
+ public void testValue() {
JQueryLocator valueInput = pjq("input[id$=valueInput]");
final AttributeLocator<?> attribute = button.getAttribute(new
Attribute("value"));
final String value = "new label";
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jCommandLink/TestA4JCommandLink.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -34,7 +34,6 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
/**
@@ -56,14 +55,8 @@
return buildUrl(contextPath,
"faces/components/a4jCommandLink/simple.xhtml");
}
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
+ @Test(groups = "client-side-perf")
+ public void testSimpleClick() {
selenium.typeKeys(input, "RichFaces 4");
selenium.click(link);
@@ -79,8 +72,8 @@
assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces
4' in input");
}
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
+ @Test
+ public void testSimpleClickUnicode() {
selenium.typeKeys(input, "ľščťžýáíéňô");
selenium.click(link);
@@ -96,8 +89,8 @@
assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when
'ľščťžýáíéňô' in input");
}
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
+ @Test
+ public void testAction() {
JQueryLocator doubleStringAction =
pjq("input[value=doubleStringAction]");
JQueryLocator first6CharsAction =
pjq("input[value=first6CharsAction]");
JQueryLocator toUpperCaseAction =
pjq("input[value=toUpperCaseAction]");
@@ -128,8 +121,8 @@
assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces
4ě' in input and toUpperCaseAction selected");
}
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
+ @Test
+ public void testActionListener() {
JQueryLocator doubleStringActionListener =
pjq("input[value=doubleStringActionListener]");
JQueryLocator first6CharsActionListener =
pjq("input[value=first6CharsActionListener]");
JQueryLocator toUpperCaseActionListener =
pjq("input[value=toUpperCaseActionListener]");
@@ -161,8 +154,8 @@
"output2 when 'RichFaces 4ě' in input and
toUpperCaseActionListener selected");
}
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
+ @Test
+ public void testDisabled() {
JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
JQueryLocator newLink = pjq("span[id$=a4jCommandLink]");
@@ -176,58 +169,58 @@
}
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
+ @Test
+ public void testOnclick() {
testFireEvent(Event.CLICK, link);
}
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
+ @Test
+ public void testOndblclick() {
testFireEvent(Event.DBLCLICK, link);
}
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
+ @Test
+ public void testOnkeydown() {
testFireEvent(Event.KEYDOWN, link);
}
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
+ @Test
+ public void testOnkeypress() {
testFireEvent(Event.KEYPRESS, link);
}
- @Test(dataProvider = "templates")
- public void testOneyup(String templates) {
+ @Test
+ public void testOneyup() {
testFireEvent(Event.KEYUP, link);
}
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
+ @Test
+ public void testOnmousedown() {
testFireEvent(Event.MOUSEDOWN, link);
}
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
+ @Test
+ public void testOnmousemove() {
testFireEvent(Event.MOUSEMOVE, link);
}
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
+ @Test
+ public void testOnmouseout() {
testFireEvent(Event.MOUSEOUT, link);
}
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
+ @Test
+ public void testOnmouseover() {
testFireEvent(Event.MOUSEOVER, link);
}
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
+ @Test
+ public void testOnmouseup() {
testFireEvent(Event.MOUSEUP, link);
}
- @Test(dataProvider = "templates")
- public void testRender(String templates) {
+ @Test
+ public void testRender() {
JQueryLocator renderInput = pjq("input[name$=renderInput]");
selenium.type(renderInput, "output1");
@@ -266,8 +259,8 @@
}
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
+ @Test
+ public void testRendered() {
JQueryLocator renderedCheckbox = pjq("input[name$=renderedInput]");
selenium.click(renderedCheckbox);
@@ -275,8 +268,8 @@
assertFalse(selenium.isElementPresent(link), "Button should not be
displayed");
}
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
+ @Test
+ public void testStyleClass() {
JQueryLocator bold = pjq("input[name$=styleClassInput][value=bold]");
JQueryLocator strike =
pjq("input[name$=styleClassInput][value=strike]");
JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
@@ -296,8 +289,8 @@
assertFalse(selenium.isAttributePresent(classAttribute), "Button's class
was not removed.");
}
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
+ @Test
+ public void testStyle() {
JQueryLocator styleInput = pjq("input[id$=styleInput]");
final AttributeLocator<?> attribute = link.getAttribute(new
Attribute("style"));
final String value = "font-size: 20px;";
@@ -308,8 +301,8 @@
assertEquals(selenium.getAttribute(attribute), value, "Style of the button
did not change");
}
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
+ @Test
+ public void testValue() {
JQueryLocator valueInput = pjq("input[id$=valueInput]");
final String value = "new label";
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jLog/TestA4JLog.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -32,7 +32,6 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
/**
@@ -63,14 +62,8 @@
return buildUrl(contextPath, "faces/components/a4jLog/simple.xhtml");
}
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates")
- public void testSubmit(String templates) {
+ @Test
+ public void testSubmit() {
selenium.typeKeys(input, "RichFaces 4");
selenium.click(submitButton);
@@ -80,8 +73,8 @@
assertTrue(count > 0, "There should be at least one message in log after
submit button was clicked.");
}
- @Test(dataProvider = "templates")
- public void testSubmitUnicode(String templates) {
+ @Test
+ public void testSubmitUnicode() {
selenium.typeKeys(input, "ľščťžýáíéôúäň");
selenium.click(submitButton);
@@ -91,8 +84,8 @@
assertTrue(count > 0, "There should be at least one message in log after
submit button was clicked.");
}
- @Test(dataProvider = "templates")
- public void testClearButton(String templates) {
+ @Test
+ public void testClearButton() {
JQueryLocator clearButton = pjq("div.rich-log button");
selenium.typeKeys(input, "RichFaces 4");
@@ -109,8 +102,8 @@
assertEquals(count, 0, "There should be no messages in log after clear
button was clicked.");
}
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
+ @Test
+ public void testRendered() {
JQueryLocator renderedInput = pjq("input[id$=renderedInput]");
selenium.click(renderedInput);
@@ -119,83 +112,83 @@
assertFalse(selenium.isElementPresent(log), "Log should not be
displayed.");
}
- @Test(dataProvider = "templates")
- public void testDebugFilterDebug(String templates) {
+ @Test
+ public void testDebugFilterDebug() {
testLogging(LogLevel.DEBUG, LogLevel.DEBUG);
}
- @Test(dataProvider = "templates")
- public void testDebugFilterInfo(String templates) {
+ @Test
+ public void testDebugFilterInfo() {
testLogging(LogLevel.DEBUG, LogLevel.INFO);
}
- @Test(dataProvider = "templates")
- public void testDebugFilterWarn(String templates) {
+ @Test
+ public void testDebugFilterWarn() {
testLogging(LogLevel.DEBUG, LogLevel.WARN);
}
- @Test(dataProvider = "templates")
- public void testDebugFilterError(String templates) {
+ @Test
+ public void testDebugFilterError() {
testLogging(LogLevel.DEBUG, LogLevel.ERROR);
}
- @Test(dataProvider = "templates")
- public void testInfoFilterDebug(String templates) {
+ @Test
+ public void testInfoFilterDebug() {
testLogging(LogLevel.INFO, LogLevel.DEBUG);
}
- @Test(dataProvider = "templates")
- public void testInfoFilterInfo(String templates) {
+ @Test
+ public void testInfoFilterInfo() {
testLogging(LogLevel.INFO, LogLevel.INFO);
}
- @Test(dataProvider = "templates")
- public void testInfoFilterWarn(String templates) {
+ @Test
+ public void testInfoFilterWarn() {
testLogging(LogLevel.INFO, LogLevel.WARN);
}
- @Test(dataProvider = "templates")
- public void testInfoFilterError(String templates) {
+ @Test
+ public void testInfoFilterError() {
testLogging(LogLevel.INFO, LogLevel.ERROR);
}
- @Test(dataProvider = "templates")
- public void testWarnFilterDebug(String templates) {
+ @Test
+ public void testWarnFilterDebug() {
testLogging(LogLevel.WARN, LogLevel.DEBUG);
}
- @Test(dataProvider = "templates")
- public void testWarnFilterInfo(String templates) {
+ @Test
+ public void testWarnFilterInfo() {
testLogging(LogLevel.WARN, LogLevel.INFO);
}
- @Test(dataProvider = "templates")
- public void testWarnFilterWarn(String templates) {
+ @Test
+ public void testWarnFilterWarn() {
testLogging(LogLevel.WARN, LogLevel.WARN);
}
- @Test(dataProvider = "templates")
- public void testWarnFilterError(String templates) {
+ @Test
+ public void testWarnFilterError() {
testLogging(LogLevel.WARN, LogLevel.ERROR);
}
- @Test(dataProvider = "templates")
- public void testErrorFilterDebug(String templates) {
+ @Test
+ public void testErrorFilterDebug() {
testLogging(LogLevel.ERROR, LogLevel.DEBUG);
}
- @Test(dataProvider = "templates")
- public void testErrorFilterInfo(String templates) {
+ @Test
+ public void testErrorFilterInfo() {
testLogging(LogLevel.ERROR, LogLevel.INFO);
}
- @Test(dataProvider = "templates")
- public void testErrorFilterWarn(String templates) {
+ @Test
+ public void testErrorFilterWarn() {
testLogging(LogLevel.ERROR, LogLevel.WARN);
}
- @Test(dataProvider = "templates")
- public void testErrorFilterError(String templates) {
+ @Test
+ public void testErrorFilterError() {
testLogging(LogLevel.ERROR, LogLevel.ERROR);
}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -27,6 +27,7 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import static org.jboss.test.selenium.dom.Event.*;
import java.net.URL;
@@ -35,7 +36,6 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@@ -58,12 +58,6 @@
return buildUrl(contextPath,
"faces/components/a4jOutputPanel/simple.xhtml");
}
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
/**
* Data provider for templates, events and layout of output panel.
*
@@ -72,32 +66,28 @@
* panel (block or inline)
*/
@SuppressWarnings("unused")
- @DataProvider(name = "templatesEventsLayouts")
- private Object[][] getTemplatesEventsLayouts() {
+ @DataProvider(name = "eventsLayouts")
+ private Object[][] getEventsLayouts() {
final int layoutsCount = 2;
- // list of templates, e.g. {{"plain"},
{"richDataTable1,redDiv"}}
- Object[][] templates = getTemplates();
// list of events that will be tested
- Event[] events = new Event[]{Event.CLICK, Event.DBLCLICK, Event.KEYDOWN,
Event.KEYPRESS, Event.KEYUP,
- Event.MOUSEDOWN, Event.MOUSEMOVE, Event.MOUSEOUT, Event.MOUSEOVER,
Event.MOUSEUP};
+ Event[] events = new Event[] { CLICK, DBLCLICK, KEYDOWN, KEYPRESS, KEYUP,
MOUSEDOWN, MOUSEMOVE, MOUSEOUT,
+ MOUSEOVER, MOUSEUP };
- Object[][] result = new Object[templates.length * events.length *
layoutsCount][];
+ Object[][] result = new Object[events.length * layoutsCount][];
int index = 0;
- for (int i = 0; i < templates.length; i++) {
- for (int j = 0; j < events.length; j++) {
- for (int k = 0; k < layoutsCount; k++) {
- index = i * events.length * layoutsCount + j * layoutsCount + k;
- result[index] = new Object[]{templates[i][0], events[j], k == 0 ?
"block" : "inline"};
- }
+ for (int i = 0; i < events.length; i++) {
+ for (int j = 0; j < layoutsCount; j++) {
+ index = i * layoutsCount + j;
+ result[index] = new Object[] { events[i], j == 0 ? "block" :
"inline" };
}
}
return result;
}
- @Test(dataProvider = "templatesEventsLayouts")
- public void testEvent(String templates, Event event, String type) {
+ @Test(dataProvider = "eventsLayouts")
+ public void testEvent(Event event, String type) {
JQueryLocator element = null;
if ("inline".equals(type)) {
@@ -120,8 +110,8 @@
testFireEvent(event, element);
}
- @Test(dataProvider = "templates")
- public void testClick(String templates) {
+ @Test
+ public void testClick() {
selenium.click(increaseCounterButton);
waitGui.until(textEquals.locator(outputDiv).text("1"));
@@ -129,8 +119,8 @@
waitGui.until(textEquals.locator(outputDiv).text("2"));
}
- @Test(dataProvider = "templates")
- public void testAjaxRendered(String templates) {
+ @Test
+ public void testAjaxRendered() {
JQueryLocator ajaxRenderedCheckbox =
pjq("input[id$=ajaxRenderedInput]");
JQueryLocator reRenderAllImage = jq("div.header
img[id$=reRenderAllImage]");
@@ -147,8 +137,8 @@
waitGui.until(textEquals.locator(outputDiv).text("2"));
}
- @Test(dataProvider = "templates")
- public void testDir(String templates) {
+ @Test
+ public void testDir() {
JQueryLocator optionLtr = pjq("input[name$=dirInput][value=ltr]");
JQueryLocator optionRtl = pjq("input[name$=dirInput][value=rtl]");
JQueryLocator optionNone = pjq("input[name$=dirInput][value=]");
@@ -175,8 +165,8 @@
}
}
- @Test(dataProvider = "templates")
- public void testLang(String templates) {
+ @Test
+ public void testLang() {
JQueryLocator langInput = pjq("input[id$=langInput]");
AttributeLocator<?> attributeLang = outputDiv.getAttribute(new
Attribute("lang"));
@@ -193,8 +183,8 @@
assertEquals(attributeValue, "sk", "Lang attribute");
}
- @Test(dataProvider = "templates")
- public void testLayout(String templates) {
+ @Test
+ public void testLayout() {
JQueryLocator optionBlock =
pjq("input[name$=layoutInput][value=block]");
JQueryLocator optionInline =
pjq("input[name$=layoutInput][value=inline]");
JQueryLocator optionNone =
pjq("input[name$=layoutInput][value=none]");
@@ -218,8 +208,8 @@
assertTrue(selenium.isElementPresent(outputSpan), "Span should be rendered
when none is set.");
}
- @Test(dataProvider = "templates")
- public void testRendered(String templates) {
+ @Test
+ public void testRendered() {
JQueryLocator renderedInput = pjq("input[id$=renderedInput]");
selenium.click(renderedInput);
@@ -237,8 +227,8 @@
assertEquals(counter, "2", "Counter after two clicks on
button.");
}
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
+ @Test
+ public void testStyle() {
String style = "background-color: magenta; color: white; font-weight:
bold;";
JQueryLocator styleInput = pjq("input[id$=styleInput]");
AttributeLocator<?> attributeStyle =
outputDiv.getAttribute(Attribute.STYLE);
@@ -258,8 +248,8 @@
}
}
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
+ @Test
+ public void testStyleClass() {
JQueryLocator optionNone =
pjq("input[name$=styleClassInput][value=]");
AttributeLocator<?> attributeClass =
outputDiv.getAttribute(Attribute.CLASS);
@@ -285,8 +275,8 @@
}
}
- @Test(dataProvider = "templates")
- public void testTitle(String templates) {
+ @Test
+ public void testTitle() {
String title = "a4j:outputPanel title";
JQueryLocator titleInput = pjq("input[id$=titleInput]");
AttributeLocator<?> attributeTitle = outputDiv.getAttribute(new
Attribute("title"));
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jPoll/TestPoll.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -29,7 +29,6 @@
import org.jboss.test.selenium.locator.IdLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
@@ -63,11 +62,6 @@
return buildUrl(contextPath, "faces/components/a4jPoll/simple.xhtml");
}
- @AfterMethod(alwaysRun = true)
- public void clearSession() {
- invalidateSession();
- }
-
/**
* <p>
* Test the progress of polling for 3 different values from client side.
@@ -92,8 +86,8 @@
* deviations isn't greater than {@link #MAX_AVERAGE_DEVIATION}.
* </p>
*/
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testIntervalFromClientPerspective(String templates) {
+ @Test(groups = "client-side-perf")
+ public void testIntervalFromClientPerspective() {
long total = 0;
long count = 0;
Copied:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Templates.java
(from rev 18256,
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java)
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Templates.java
(rev 0)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Templates.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -0,0 +1,14 @@
+package org.richfaces.tests.metamer.ftest.annotations;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+
+@Target({ TYPE, FIELD, METHOD, PARAMETER })
+(a)Retention(RetentionPolicy.RUNTIME)
+public @interface Templates {
+ String[] include() default {};
+ String[] exclude() default {};
+}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/annotations/Use.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -5,7 +5,7 @@
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*;
-@Target({ TYPE, FIELD, METHOD, PARAMETER })
+@Target({ FIELD, METHOD })
@Retention(RetentionPolicy.RUNTIME)
public @interface Use {
String field() default "";
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/hCommandButton/TestHCommandButton.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -34,7 +34,6 @@
import org.jboss.test.selenium.locator.AttributeLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
/**
@@ -56,14 +55,8 @@
return buildUrl(contextPath,
"faces/components/commandButton/simple.xhtml");
}
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
+ @Test(groups = "client-side-perf")
+ public void testSimpleClick() {
selenium.typeKeys(input, "RichFaces 4");
selenium.click(button);
@@ -79,8 +72,8 @@
assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces
4' in input");
}
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
+ @Test
+ public void testSimpleClickUnicode() {
selenium.typeKeys(input, "ľščťžýáíéňô");
selenium.click(button);
@@ -96,8 +89,8 @@
assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when
'ľščťžýáíéňô' in input");
}
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
+ @Test
+ public void testAction() {
JQueryLocator doubleStringAction =
pjq("input[value=doubleStringAction]");
JQueryLocator first6CharsAction =
pjq("input[value=first6CharsAction]");
JQueryLocator toUpperCaseAction =
pjq("input[value=toUpperCaseAction]");
@@ -128,8 +121,8 @@
assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces
4ě' in input and toUpperCaseAction selected");
}
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
+ @Test
+ public void testActionListener() {
JQueryLocator doubleStringActionListener =
pjq("input[value=doubleStringActionListener]");
JQueryLocator first6CharsActionListener =
pjq("input[value=first6CharsActionListener]");
JQueryLocator toUpperCaseActionListener =
pjq("input[value=toUpperCaseActionListener]");
@@ -161,8 +154,8 @@
"output2 when 'RichFaces 4ě' in input and
toUpperCaseActionListener selected");
}
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
+ @Test
+ public void testDisabled() {
JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
AttributeLocator<?> disabledAttribute = button.getAttribute(new
Attribute("disabled"));
@@ -174,75 +167,75 @@
}
// not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnblur(String templates) {
+ // @Test
+ public void testOnblur() {
testFireEvent(Event.BLUR, button);
}
// not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnchange(String templates) {
+ // @Test
+ public void testOnchange() {
testFireEvent(Event.CHANGE, button);
}
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
+ @Test
+ public void testOnclick() {
testFireEvent(Event.CLICK, button);
}
- @Test(dataProvider = "templates")
- public void testOndblclick(String templates) {
+ @Test
+ public void testOndblclick() {
testFireEvent(Event.DBLCLICK, button);
}
// not implemented in Mojarra
- // @Test(dataProvider = "templates")
- public void testOnfocus(String templates) {
+ // @Test
+ public void testOnfocus() {
testFireEvent(Event.FOCUS, button);
}
- @Test(dataProvider = "templates")
- public void testOnkeydown(String templates) {
+ @Test
+ public void testOnkeydown() {
testFireEvent(Event.KEYDOWN, button);
}
- @Test(dataProvider = "templates")
- public void testOnkeypress(String templates) {
+ @Test
+ public void testOnkeypress() {
testFireEvent(Event.KEYPRESS, button);
}
- @Test(dataProvider = "templates")
- public void testOnkeyup(String templates) {
+ @Test
+ public void testOnkeyup() {
testFireEvent(Event.KEYUP, button);
}
- @Test(dataProvider = "templates")
- public void testOnmousedown(String templates) {
+ @Test
+ public void testOnmousedown() {
testFireEvent(Event.MOUSEDOWN, button);
}
- @Test(dataProvider = "templates")
- public void testOnmousemove(String templates) {
+ @Test
+ public void testOnmousemove() {
testFireEvent(Event.MOUSEMOVE, button);
}
- @Test(dataProvider = "templates")
- public void testOnmouseout(String templates) {
+ @Test
+ public void testOnmouseout() {
testFireEvent(Event.MOUSEOUT, button);
}
- @Test(dataProvider = "templates")
- public void testOnmouseover(String templates) {
+ @Test
+ public void testOnmouseover() {
testFireEvent(Event.MOUSEOVER, button);
}
- @Test(dataProvider = "templates")
- public void testOnmouseup(String templates) {
+ @Test
+ public void testOnmouseup() {
testFireEvent(Event.MOUSEUP, button);
}
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
+ @Test
+ public void testStyleClass() {
JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
@@ -263,27 +256,27 @@
assertFalse(selenium.isAttributePresent(classAttribute), "Button's class
was not removed.");
}
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
+ @Test
+ public void testStyle() {
JQueryLocator styleInput = pjq("input[id$=styleInput]");
final AttributeLocator<?> attribute = button.getAttribute(new
Attribute("style"));
final String value = "font-size: 20px;";
selenium.type(styleInput, value);
selenium.waitForPageToLoad(TIMEOUT);
-
+
assertEquals(selenium.getAttribute(attribute), value, "Style of the button
did not change");
}
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
+ @Test
+ public void testValue() {
JQueryLocator valueInput = pjq("input[id$=valueInput]");
final AttributeLocator<?> attribute = button.getAttribute(new
Attribute("value"));
final String value = "new label";
selenium.type(valueInput, value);
selenium.waitForPageToLoad(TIMEOUT);
-
+
assertEquals(selenium.getAttribute(attribute), value, "Value of the button
did not change");
}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richDataScroller/TestPagination.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -35,7 +35,6 @@
import org.richfaces.tests.metamer.ftest.annotations.Use;
import org.richfaces.tests.metamer.ftest.model.AssertingDataScroller;
import org.richfaces.tests.metamer.ftest.model.DataTable;
-import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -101,10 +100,4 @@
assertEquals(maxPages, dataScroller.getCountOfVisiblePages());
}
}
-
- @Override
- @AfterMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java 2010-07-28
13:40:23 UTC (rev 18256)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/TestScroller.java 2010-07-28
13:41:42 UTC (rev 18257)
@@ -60,8 +60,8 @@
*
* @see {@link #testRowCount(DataScroller)}
*/
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testRowCountFooterScroller(String templates) {
+ @Test(groups = "client-side-perf")
+ public void testRowCountFooterScroller() {
testRowCount(dataScroller2);
}
@@ -70,8 +70,8 @@
*
* @see {@link #testRowCount(DataScroller)}
*/
- @Test(dataProvider = "templates")
- public void testRowCountOutsideTable(String templates) {
+ @Test
+ public void testRowCountOutsideTable() {
testRowCount(dataScroller1);
}