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:[email protected]
P.S. A good JDO? O, Gasp!
Craig L Russell
Architect, Oracle
http://db.apache.org/jdo
408 276-5638 mailto:[email protected]
P.S. A good JDO? O, Gasp!