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 Re: What does getParent return?
Date Tue, 23 Mar 2010 03:03:08 GMT
And I also assume that every xml element has a parent that is the  
element which contains it.

So PackageMetadata has a parent JDOMetadata.

And each element in metadata that is contained in another has a  
parent. Except JDOMetadata that has no parent.

Craig

On Mar 22, 2010, at 4:48 PM, Craig L Russell wrote:

> 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!
>

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