db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject What does getParent return?
Date Mon, 22 Mar 2010 23:48:26 GMT
Hi,

I'm (finally) writing some test code for the metadata feature and have  
run into a problem.

Here's the code:

     /** test getMetadata with abstract class name*/
     public void testAbstractClassName() {
         pm = getPM();
         String className = "org.apache.jdo.tck.pc.company.Employee";
         TypeMetadata metadata = pmf.getMetadata(className);
         assertNotNull(ASSERTION_FAILED
                 + "metadata must not be null for abstract class" +  
className, metadata);
         dump(metadata);
         Metadata parent = metadata.getParent();
         assertNotNull(ASSERTION_FAILED
                 + "parent metadata must not be null for abstract  
class" + className, parent);
         String name = metadata.getName();
         String packageName = ((PackageMetadata)  
metadata.getParent()).getName();
         assertEquals(ASSERTION_FAILED
                 + "metadata name and class name must match",  
className, packageName + "." + name);
     }

The parent metadata is the issue. For a TypeMetadata the parent should  
be a PackageMetadata. But it looks like getParent() returns null for a  
ClassMetadata.

Before I file a JIRA I thought I'd double check...

Craig

Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@oracle.com
P.S. A good JDO? O, Gasp!


Mime
View raw message