geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r811209 - in /geronimo/xbean/trunk/xbean-finder/src: main/java/org/apache/xbean/finder/ClassFinder.java test/java/org/apache/xbean/finder/ClassFinderTest.java
Date Fri, 04 Sep 2009 03:01:31 GMT
Author: dblevins
Date: Fri Sep  4 03:01:31 2009
New Revision: 811209

URL: http://svn.apache.org/viewvc?rev=811209&view=rev
Log:
Patch from Karan Malhi, XBEAN-135: lassFinder.getPackageName() returns the unqualified class
name instead of the package name
Thanks, Karan!

Modified:
    geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
    geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderTest.java

Modified: geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java?rev=811209&r1=811208&r2=811209&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/main/java/org/apache/xbean/finder/ClassFinder.java
Fri Sep  4 03:01:31 2009
@@ -542,7 +542,7 @@
         }
 
         public String getPackageName(){
-            return name.substring(name.lastIndexOf(".")+1, name.length());
+        	  return name.substring(0,name.lastIndexOf("."));
         }
 
         public List<MethodInfo> getConstructors() {

Modified: geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderTest.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderTest.java?rev=811209&r1=811208&r2=811209&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderTest.java
(original)
+++ geronimo/xbean/trunk/xbean-finder/src/test/java/org/apache/xbean/finder/ClassFinderTest.java
Fri Sep  4 03:01:31 2009
@@ -151,4 +151,12 @@
         testFindAnnotatedMethods();
         testFindAnnotatedPackages();
     }
+    public void testFindClassesInPackage() throws Exception{
+    	List<Class> classesInPackage = classFinder.findClassesInPackage("org.acme.foo",
false);
+    	Class[] classesArray = {Blue.class, Blue.Navy.class, Blue.Sky.class, Green.class, Green.Emerald.class,
Red.class,
+                Red.CandyApple.class, Red.Pink.class, Halloween.class, Holiday.class, Deployable.class,
Primary.class,
+                Property.class, Thanksgiving.class, ValentinesDay.class};
+    	List<Class> classes = Arrays.asList(classesArray);
+    	assertEquals(true, classesInPackage.containsAll(classes));
+    }
 }



Mime
View raw message