Author: lfryc(a)redhat.com
Date: 2010-07-21 08:15:26 -0400 (Wed, 21 Jul 2010)
New Revision: 18171
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/LocatorReference.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.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/a4jOutputPanel/TestA4JOutputPanel.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java
Log:
modified project to follow richfaces-checkstyle and formatting-rules
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2010-07-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/SeleniumGetter.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -1,3 +1,24 @@
+/*
+ * 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.jboss.test.selenium;
import org.jboss.test.selenium.encapsulated.JavaScript;
@@ -7,6 +28,13 @@
import org.jboss.test.selenium.utils.PrimitiveUtils;
import org.jboss.test.selenium.waiting.conversion.Convertor;
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ *
+ * @param <P>
+ * type of parameter
+ */
public abstract class SeleniumGetter<P> {
protected AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
protected P parameter;
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/LocatorReference.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/LocatorReference.java 2010-07-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/LocatorReference.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -26,21 +26,23 @@
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
+ *
+ * @param <T> type of referenced locator
*/
public class LocatorReference<T extends Locator> {
- private T reference;
+ private T reference;
- public LocatorReference(T reference) {
- super();
- this.reference = reference;
- }
+ public LocatorReference(T reference) {
+ super();
+ this.reference = reference;
+ }
- public T getLocator() {
- return reference;
- }
+ public T getLocator() {
+ return reference;
+ }
- public void setLocator(T locator) {
- this.reference = locator;
- }
+ public void setLocator(T locator) {
+ this.reference = locator;
+ }
}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java 2010-07-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/jboss/test/selenium/locator/reference/ReferencedLocator.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -29,75 +29,75 @@
/**
* @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
* @version $Revision$
+ *
+ * @param <T> type of referenced locator
*/
-public class ReferencedLocator<T extends IterableLocator<T> &
CompoundableLocator<T>>
- extends AbstractElementLocator implements IterableLocator<T>,
- CompoundableLocator<T> {
+public class ReferencedLocator<T extends IterableLocator<T> &
CompoundableLocator<T>> extends AbstractElementLocator
+ implements IterableLocator<T>, CompoundableLocator<T> {
- private LocatorReference<T> reference;
- private String addition;
+ private LocatorReference<T> reference;
+ private String addition;
- public ReferencedLocator(LocatorReference<T> reference, String locator) {
- super("not-used");
- this.reference = reference;
- this.addition = locator;
- }
+ public ReferencedLocator(LocatorReference<T> reference, String locator) {
+ super("not-used");
+ this.reference = reference;
+ this.addition = locator;
+ }
- public static <N extends AbstractElementLocator & IterableLocator<N> &
CompoundableLocator<N>> ReferencedLocator<N> ref(
- LocatorReference<N> reference, String locator) {
- return new ReferencedLocator<N>(reference, locator);
- }
+ public static <N extends IterableLocator<N> &
CompoundableLocator<N>> ReferencedLocator<N> ref(
+ LocatorReference<N> reference, String locator) {
+ return new ReferencedLocator<N>(reference, locator);
+ }
- public T getReferenced() {
- T referencedLocator = reference.getLocator();
+ public T getReferenced() {
+ T referencedLocator = reference.getLocator();
- @SuppressWarnings("unchecked")
- Class<T> tClass = (Class<T>) referencedLocator.getClass();
+ @SuppressWarnings("unchecked")
+ Class<T> tClass = (Class<T>) referencedLocator.getClass();
- try {
- T newInstance = tClass.getConstructor(String.class).newInstance(
- addition);
+ try {
+ T newInstance = tClass.getConstructor(String.class).newInstance(addition);
- return referencedLocator.getDescendant(newInstance);
- } catch (Exception e) {
- throw new IllegalStateException(e);
- }
- }
+ return referencedLocator.getDescendant(newInstance);
+ } catch (Exception e) {
+ throw new IllegalStateException(e);
+ }
+ }
- @Override
- public String getRawLocator() {
- return getReferenced().getRawLocator();
- }
+ @Override
+ public String getRawLocator() {
+ return getReferenced().getRawLocator();
+ }
- public LocationStrategy getLocationStrategy() {
- return reference.getLocator().getLocationStrategy();
- }
+ public LocationStrategy getLocationStrategy() {
+ return reference.getLocator().getLocationStrategy();
+ }
- public T getChild(T elementLocator) {
- return getReferenced().getChild(elementLocator);
- }
+ public T getChild(T elementLocator) {
+ return getReferenced().getChild(elementLocator);
+ }
- public T getDescendant(T elementLocator) {
- return getReferenced().getDescendant(elementLocator);
- }
+ public T getDescendant(T elementLocator) {
+ return getReferenced().getDescendant(elementLocator);
+ }
- public T getNthChildElement(int index) {
- return getReferenced().getNthChildElement(index);
- }
+ public T getNthChildElement(int index) {
+ return getReferenced().getNthChildElement(index);
+ }
- public T getNthOccurence(int index) {
- return getReferenced().getNthOccurence(index);
- }
+ public T getNthOccurence(int index) {
+ return getReferenced().getNthOccurence(index);
+ }
- public Iterable<T> getAllChildren() {
- return getReferenced().getAllChildren();
- }
+ public Iterable<T> getAllChildren() {
+ return getReferenced().getAllChildren();
+ }
- public Iterable<T> getChildren(T elementLocator) {
- return getReferenced().getChildren(elementLocator);
- }
+ public Iterable<T> getChildren(T elementLocator) {
+ return getReferenced().getChildren(elementLocator);
+ }
- public Iterable<T> getDescendants(T elementLocator) {
- return getReferenced().getDescendants(elementLocator);
- }
+ public Iterable<T> getDescendants(T elementLocator) {
+ return getReferenced().getDescendants(elementLocator);
+ }
}
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-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jActionListener/TestA4JActionListener.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -21,16 +21,13 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.a4jActionListener;
-import org.jboss.test.selenium.encapsulated.JavaScript;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
import java.net.URL;
import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
-import org.jboss.test.selenium.waiting.ajax.JavaScriptCondition;
import org.jboss.test.selenium.waiting.selenium.SeleniumCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
import org.testng.annotations.AfterMethod;
@@ -42,7 +39,6 @@
* @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
* @version $Revision$
*/
-@SuppressWarnings("unused")
public class TestA4JActionListener extends AbstractMetamerTest {
private ElementLocator invokeButtonType =
pjq("input[id$=invokeByTypeButton]");
@@ -66,7 +62,7 @@
public void testInvokeListenerByType(String templates) {
final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
final String msg = "Implementation of ActionListener created and called:
"
- +
"org.richfaces.tests.metamer.bean.A4JActionListenerBean$ActionListenerImpl";
+ +
"org.richfaces.tests.metamer.bean.A4JActionListenerBean$ActionListenerImpl";
selenium.click(invokeButtonType);
waitGui.until(elementPresent.locator(message));
@@ -82,12 +78,12 @@
selenium.click(invokeButtonType);
waitModel.failWith("New object of class ActionListenerImpl should be
instantiated.").until(
- new SeleniumCondition() {
+ new SeleniumCondition() {
- public boolean isTrue() {
- return !output1.equals(selenium.getText(message));
- }
- });
+ public boolean isTrue() {
+ return !output1.equals(selenium.getText(message));
+ }
+ });
count = selenium.getCount(message);
assertEquals(count, 1, "Only one message should be displayed on the
page.");
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-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jOutputPanel/TestA4JOutputPanel.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -72,7 +72,7 @@
* panel (block or inline)
*/
@SuppressWarnings("unused")
- @DataProvider(name = "templatesEventsLayouts")
+ @DataProvider(name = "templatesEventsLayouts")
private Object[][] getTemplatesEventsLayouts() {
final int layoutsCount = 2;
// list of templates, e.g. {{"plain"},
{"richDataTable1,redDiv"}}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java 2010-07-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataScroller.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -37,78 +37,78 @@
*/
public class DataScroller {
- AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
- LocatorReference<JQueryLocator> root = new
LocatorReference<JQueryLocator>(null);
- ReferencedLocator<JQueryLocator> pageNumbers = ref(root, ">
.rf-ds-dtl"),
- firstPageButton = ref(root, "> .rf-ds-l[id$=ds_f]"),
- lastPageButton = ref(root, "> .rf-ds-r:eq(1)"),
- lastVisiblePage = ref(root, "> .rf-ds-dtl:last"),
- currentPage = ref(root, "> .rf-ds-cur");
+ LocatorReference<JQueryLocator> root = new
LocatorReference<JQueryLocator>(null);
+ ReferencedLocator<JQueryLocator> pageNumbers = ref(root, ">
.rf-ds-dtl");
+ ReferencedLocator<JQueryLocator> firstPageButton = ref(root, ">
.rf-ds-l[id$=ds_f]");
+ ReferencedLocator<JQueryLocator> lastPageButton = ref(root, ">
.rf-ds-r:eq(1)");
+ ReferencedLocator<JQueryLocator> lastVisiblePage = ref(root, ">
.rf-ds-dtl:last");
+ ReferencedLocator<JQueryLocator> currentPage = ref(root, ">
.rf-ds-cur");
- public DataScroller(JQueryLocator root) {
- setRoot(root);
- }
+ public DataScroller(JQueryLocator root) {
+ setRoot(root);
+ }
- public JQueryLocator getRoot() {
- return root.getLocator();
- }
+ public JQueryLocator getRoot() {
+ return root.getLocator();
+ }
- public void setRoot(JQueryLocator root) {
- this.root.setLocator(root);
- }
+ public void setRoot(JQueryLocator root) {
+ this.root.setLocator(root);
+ }
- public void gotoFirstPage() {
- if (!isFirstPage()) {
- clickFirstPageButton();
- }
- }
+ public void gotoFirstPage() {
+ if (!isFirstPage()) {
+ clickFirstPageButton();
+ }
+ }
- public void gotoLastPage() {
- if (!isLastPage()) {
- clickLastPageButton();
- }
- }
+ public void gotoLastPage() {
+ if (!isLastPage()) {
+ clickLastPageButton();
+ }
+ }
- public void clickLastPageButton() {
- guardXhr(selenium).click(lastPageButton);
- }
+ public void clickLastPageButton() {
+ guardXhr(selenium).click(lastPageButton);
+ }
- public void clickFirstPageButton() {
- guardXhr(selenium).click(firstPageButton);
- }
+ public void clickFirstPageButton() {
+ guardXhr(selenium).click(firstPageButton);
+ }
- public int getCountOfVisiblePages() {
- return selenium.getCount(pageNumbers);
- }
+ public int getCountOfVisiblePages() {
+ return selenium.getCount(pageNumbers);
+ }
- public boolean hasPages() {
- return selenium.isElementPresent(lastVisiblePage);
- }
+ public boolean hasPages() {
+ return selenium.isElementPresent(lastVisiblePage);
+ }
- public Integer getLastVisiblePage() {
- if (!hasPages()) {
- return null;
- }
- return integer(selenium.getText(lastVisiblePage));
- }
+ public Integer getLastVisiblePage() {
+ if (!hasPages()) {
+ return null;
+ }
+ return integer(selenium.getText(lastVisiblePage));
+ }
- public int getCurrentPage() {
- if (!hasPages()) {
- return 1;
- }
- return integer(selenium.getText(currentPage));
- }
+ public int getCurrentPage() {
+ if (!hasPages()) {
+ return 1;
+ }
+ return integer(selenium.getText(currentPage));
+ }
- public boolean isFirstPage() {
- return getCurrentPage() == 1;
- }
+ public boolean isFirstPage() {
+ return getCurrentPage() == 1;
+ }
- public boolean isLastPage() {
- return getCurrentPage() == getLastVisiblePage();
- }
+ public boolean isLastPage() {
+ return getCurrentPage() == getLastVisiblePage();
+ }
- public static int integer(String string) {
- return Integer.valueOf(string);
- }
+ public static int integer(String string) {
+ return Integer.valueOf(string);
+ }
}
Modified:
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java
===================================================================
---
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java 2010-07-21
12:14:26 UTC (rev 18170)
+++
root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richExtendedDataTable/DataTable.java 2010-07-21
12:15:26 UTC (rev 18171)
@@ -35,21 +35,21 @@
*/
public class DataTable {
- AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
+ AjaxSelenium selenium = AjaxSeleniumProxy.getInstance();
- LocatorReference<JQueryLocator> root = new
LocatorReference<JQueryLocator>(null);
- ReferencedLocator<JQueryLocator> tableRows = ref(root,
- "> div.rf-edt-b table table tr");
+ LocatorReference<JQueryLocator> root = new
LocatorReference<JQueryLocator>(null);
+
+ ReferencedLocator<JQueryLocator> tableRows = ref(root, "> div.rf-edt-b
table table tr");
- public DataTable(JQueryLocator tableRoot) {
- root.setLocator(tableRoot);
- }
+ public DataTable(JQueryLocator tableRoot) {
+ root.setLocator(tableRoot);
+ }
- public int getCountOfTableRows() {
- return selenium.getCount(tableRows);
- }
+ public int getCountOfTableRows() {
+ return selenium.getCount(tableRows);
+ }
- public String getTableText() {
- return selenium.getText(root.getLocator());
- }
+ public String getTableText() {
+ return selenium.getText(root.getLocator());
+ }
}