Search in sources :

Example 6 with PackageMetadata

use of javax.jdo.metadata.PackageMetadata in project tests by datanucleus.

the class JDOMetadataAPITest method testPackageClassInterface.

/**
 * Simple test that checks the numbers of packages, classes, interfaces contained.
 */
public void testPackageClassInterface() {
    JDOMetadata jdomd = pmf.newMetadata();
    PackageMetadata pmd1 = jdomd.newPackageMetadata("org.datanucleus.test");
    pmd1.newClassMetadata("MyClass1");
    pmd1.newClassMetadata("MyClass2");
    PackageMetadata pmd2 = jdomd.newPackageMetadata("org.datanucleus.test2");
    pmd2.newInterfaceMetadata("org.datanucleus.test3");
    // Check the JDO metadata
    assertEquals("Number of packages in JDO metadata is incorrect", 2, jdomd.getNumberOfPackages());
    assertEquals("Number of classes in JDO package metadata 1 is incorrect", 2, pmd1.getNumberOfClasses());
    assertEquals("Number of interfaces in JDO package metadata 1 is incorrect", 0, pmd1.getNumberOfInterfaces());
    assertEquals("Number of classes in JDO package metadata 2 is incorrect", 0, pmd2.getNumberOfClasses());
    assertEquals("Number of interfaces in JDO package metadata 2 is incorrect", 1, pmd2.getNumberOfInterfaces());
    // Check the internal metadata
    FileMetaData filemd = ((JDOMetadataImpl) jdomd).getInternal();
    assertEquals("Number of packages is incorrect", 2, filemd.getNoOfPackages());
}
Also used : JDOMetadataImpl(org.datanucleus.api.jdo.metadata.JDOMetadataImpl) JDOMetadata(javax.jdo.metadata.JDOMetadata) PackageMetadata(javax.jdo.metadata.PackageMetadata) FileMetaData(org.datanucleus.metadata.FileMetaData)

Aggregations

PackageMetadata (javax.jdo.metadata.PackageMetadata)6 ClassMetadata (javax.jdo.metadata.ClassMetadata)4 InheritanceMetadata (javax.jdo.metadata.InheritanceMetadata)2 JDOMetadata (javax.jdo.metadata.JDOMetadata)2 CollectionMetadata (javax.jdo.metadata.CollectionMetadata)1 DiscriminatorMetadata (javax.jdo.metadata.DiscriminatorMetadata)1 FieldMetadata (javax.jdo.metadata.FieldMetadata)1 MemberMetadata (javax.jdo.metadata.MemberMetadata)1 TypeMetadata (javax.jdo.metadata.TypeMetadata)1 VersionMetadata (javax.jdo.metadata.VersionMetadata)1 JDOMetadataImpl (org.datanucleus.api.jdo.metadata.JDOMetadataImpl)1 FileMetaData (org.datanucleus.metadata.FileMetaData)1 Computer (org.datanucleus.samples.annotations.embedded.Computer)1 EntityType (org.motechproject.mds.domain.EntityType)1 EntityDto (org.motechproject.mds.dto.EntityDto)1 FieldDto (org.motechproject.mds.dto.FieldDto)1