geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r601205 - /geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotationHelperTest.java
Date Wed, 05 Dec 2007 04:41:13 GMT
Author: gawor
Date: Tue Dec  4 20:41:12 2007
New Revision: 601205

URL: http://svn.apache.org/viewvc?rev=601205&view=rev
Log:
sort fields returned by ClassFinder so that list is in the same order across various jdks
(GERONIMO-3672)

Modified:
    geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotationHelperTest.java

Modified: geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotationHelperTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotationHelperTest.java?rev=601205&r1=601204&r2=601205&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotationHelperTest.java
(original)
+++ geronimo/server/trunk/plugins/j2ee/geronimo-j2ee-builder/src/test/java/org/apache/geronimo/j2ee/deployment/annotation/AnnotationHelperTest.java
Tue Dec  4 20:41:12 2007
@@ -17,11 +17,14 @@
 
 package org.apache.geronimo.j2ee.deployment.annotation;
 
+import java.lang.annotation.Annotation;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import javax.annotation.security.DeclareRoles;
@@ -55,10 +58,31 @@
         PersistenceContextAnnotationTest.class, PersistenceUnitAnnotationTest.class,
         WebServiceRefAnnotationTest.class, SecurityAnnotationTest.class};
 
-    private ClassFinder classFinder = new ClassFinder(classes);
+    private ClassFinder classFinder = new TestClassFinder(classes);
     private ClassLoader classLoader = this.getClass().getClassLoader();
     private XmlOptions options = new XmlOptions();
 
+    static class TestClassFinder extends ClassFinder {
+        public TestClassFinder(Class [] classes) {
+            super(classes);
+        }        
+        public List<Field> findAnnotatedFields(Class<? extends Annotation> arg)
{
+            List<Field> fields = super.findAnnotatedFields(arg);
+            Collections.sort(fields, new FieldComparator());
+            return fields;
+        }
+    }
+    
+    static class FieldComparator implements Comparator {
+        public int compare(Object o1, Object o2) {
+            return compare((Field)o1, (Field)o2);
+        }
+        public int compare(Field o1, Field o2) {
+            String field1 = o1.getDeclaringClass().getName() + "/" + o1.getName();
+            String field2 = o2.getDeclaringClass().getName() + "/" + o2.getName();
+            return field1.compareTo(field2);
+        }        
+    }
 
     public void testEJBAnnotationHelper() throws Exception {
 



Mime
View raw message