From richfaces-svn-commits at lists.jboss.org Fri Jul 23 10:14:55 2010 Content-Type: multipart/mixed; boundary="===============6944726672379797355==" MIME-Version: 1.0 From: richfaces-svn-commits at lists.jboss.org To: richfaces-svn-commits at lists.jboss.org Subject: [richfaces-svn-commits] JBoss Rich Faces SVN: r18214 - in root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest: internal and 1 other directories. Date: Fri, 23 Jul 2010 10:14:55 -0400 Message-ID: <201007231414.o6NEEtaM026223@svn01.web.mwc.hst.phx2.redhat.com> --===============6944726672379797355== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: lfryc(a)redhat.com Date: 2010-07-23 10:14:55 -0400 (Fri, 23 Jul 2010) New Revision: 18214 Added: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/= metamer/ftest/internal/ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/= metamer/ftest/internal/NamedType.java Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/= metamer/ftest/richDataScroller/TestPagination.java Log: externalized NamedType Added: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/te= sts/metamer/ftest/internal/NamedType.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests= /metamer/ftest/internal/NamedType.java (rev 0) +++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests= /metamer/ftest/internal/NamedType.java 2010-07-23 14:14:55 UTC (rev 18214) @@ -0,0 +1,92 @@ +/*************************************************************************= ****** + * 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.internal; + +import java.lang.annotation.Annotation; + +import org.richfaces.tests.metamer.ftest.annotations.Named; + +/** + * @author Lukas Fryc + * @version $Revision$ + */ +public class NamedType { + private Class parameterType; + private String name; + + public NamedType(Class parameterType, String name) { + this.parameterType =3D parameterType; + this.name =3D name; + } + + public NamedType(Class parameterType, Annotation[] annotations) { + this.parameterType =3D parameterType; + for (Annotation annotation : annotations) { + if (annotation.annotationType() =3D=3D Named.class) { + this.name =3D ((Named) annotation).value(); + } + } + } + + @Override + public String toString() { + return "NamedType(" + parameterType.getSimpleName() + ", " + name = + ")"; + } + + @Override + public int hashCode() { + final int prime =3D 31; + int result =3D 1; + result =3D prime * result + ((name =3D=3D null) ? 0 : name.hashCod= e()); + result =3D prime * result + ((parameterType =3D=3D null) ? 0 : par= ameterType.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this =3D=3D obj) { + return true; + } + if (obj =3D=3D null) { + return false; + } + if (getClass() !=3D obj.getClass()) { + return false; + } + NamedType other =3D (NamedType) obj; + if (name =3D=3D null) { + if (other.name !=3D null) { + return false; + } + } else if (!name.equals(other.name)) { + return false; + } + if (parameterType =3D=3D null) { + if (other.parameterType !=3D null) { + return false; + } + } else if (!parameterType.equals(other.parameterType)) { + return false; + } + return true; + } +} \ No newline at end of file Modified: root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces= /tests/metamer/ftest/richDataScroller/TestPagination.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests= /metamer/ftest/richDataScroller/TestPagination.java 2010-07-23 14:14:10 UTC= (rev 18213) +++ root/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests= /metamer/ftest/richDataScroller/TestPagination.java 2010-07-23 14:14:55 UTC= (rev 18214) @@ -24,7 +24,6 @@ import static org.jboss.test.selenium.locator.LocatorFactory.id; import static org.jboss.test.selenium.utils.URLUtils.buildUrl; = -import java.lang.annotation.Annotation; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.net.URL; @@ -42,6 +41,7 @@ import org.richfaces.tests.metamer.ftest.annotations.Inject; import org.richfaces.tests.metamer.ftest.annotations.Named; import org.richfaces.tests.metamer.ftest.annotations.Use; +import org.richfaces.tests.metamer.ftest.internal.NamedType; import org.richfaces.tests.metamer.ftest.richExtendedDataTable.AssertingDa= taScroller; import org.richfaces.tests.metamer.ftest.richExtendedDataTable.DataTable; import org.testng.annotations.AfterMethod; @@ -204,77 +204,6 @@ return result; } = - private class NamedType { - private Class parameterType; - private String name; - - public NamedType(Class parameterType, String name) { - this.parameterType =3D parameterType; - this.name =3D name; - } - - public NamedType(Class parameterType, Annotation[] annotations)= { - this.parameterType =3D parameterType; - for (Annotation annotation : annotations) { - if (annotation.annotationType() =3D=3D Named.class) { - this.name =3D ((Named) annotation).value(); - } - } - } - - @Override - public int hashCode() { - final int prime =3D 31; - int result =3D 1; - result =3D prime * result + getOuterType().hashCode(); - result =3D prime * result + ((name =3D=3D null) ? 0 : name.has= hCode()); - result =3D prime * result + ((parameterType =3D=3D null) ? 0 := parameterType.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this =3D=3D obj) { - return true; - } - if (obj =3D=3D null) { - return false; - } - if (getClass() !=3D obj.getClass()) { - return false; - } - NamedType other =3D (NamedType) obj; - if (!getOuterType().equals(other.getOuterType())) { - return false; - } - if (name =3D=3D null) { - if (other.name !=3D null) { - return false; - } - } else if (!name.equals(other.name)) { - return false; - } - if (parameterType =3D=3D null) { - if (other.parameterType !=3D null) { - return false; - } - } else if (!parameterType.equals(other.parameterType)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "NamedType(" + parameterType.getSimpleName() + ", " + n= ame + ")"; - } - - private TestPagination getOuterType() { - return TestPagination.this; - } - - } - private List getUseParameter(Class parameterType,= Use use) { if (parameterType =3D=3D int.class || parameterType =3D=3D Integer= .class) { return Arrays.asList(ArrayUtils.toObject(use.ints())); --===============6944726672379797355==--