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:[email protected]
P.S. A good JDO? O, Gasp!

Reply via email to