Search in sources :

Example 26 with JDOMetaDataManager

use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project tests by datanucleus.

the class BasicTest method testFieldColumnMetadata.

/**
 * Tests the column field declared in many forms
 */
public void testFieldColumnMetadata() {
    MetaDataManager mgr = new JDOMetaDataManager(new PersistenceNucleusContextImpl("JDO", null));
    mgr.setValidate(false);
    AbstractClassMetaData cmdD0 = mgr.getMetaDataForClass(D0.class, new ClassLoaderResolverImpl());
    AbstractClassMetaData cmdD1 = mgr.getMetaDataForClass(D1.class, new ClassLoaderResolverImpl());
    AbstractClassMetaData cmdD2 = mgr.getMetaDataForClass(D2.class, new ClassLoaderResolverImpl());
    assertEquals("NNN", cmdD0.getMetaDataForManagedMemberAtAbsolutePosition(cmdD0.getAbsolutePositionOfMember("name")).getColumnMetaData()[0].getName());
    assertEquals(cmdD0.getMetaDataForManagedMemberAtAbsolutePosition(cmdD0.getAbsolutePositionOfMember("name")).getColumnMetaData()[0].getName(), cmdD1.getMetaDataForManagedMemberAtAbsolutePosition(cmdD1.getAbsolutePositionOfMember("name")).getColumnMetaData()[0].getName());
    assertEquals(cmdD0.getMetaDataForManagedMemberAtAbsolutePosition(cmdD0.getAbsolutePositionOfMember("name")).getColumnMetaData()[0].getName(), cmdD2.getMetaDataForManagedMemberAtAbsolutePosition(cmdD2.getAbsolutePositionOfMember("name")).getColumnMetaData()[0].getName());
}
Also used : JDOMetaDataManager(org.datanucleus.api.jdo.metadata.JDOMetaDataManager) MetaDataManager(org.datanucleus.metadata.MetaDataManager) PersistenceNucleusContextImpl(org.datanucleus.PersistenceNucleusContextImpl) JDOMetaDataManager(org.datanucleus.api.jdo.metadata.JDOMetaDataManager) AbstractClassMetaData(org.datanucleus.metadata.AbstractClassMetaData) ClassLoaderResolverImpl(org.datanucleus.ClassLoaderResolverImpl)

Example 27 with JDOMetaDataManager

use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project tests by datanucleus.

the class BasicTest method testFieldDeclaredInSubClassMetadata.

/**
 * Tests a field declared in the metadata of a subclass, like Subclass.field
 */
public void testFieldDeclaredInSubClassMetadata() {
    MetaDataManager mgr = new JDOMetaDataManager(new PersistenceNucleusContextImpl("JDO", null));
    mgr.setValidate(false);
    AbstractClassMetaData cmdD0 = mgr.getMetaDataForClass(Pet.class, new ClassLoaderResolverImpl());
    AbstractClassMetaData cmdD1 = mgr.getMetaDataForClass(Dog.class, new ClassLoaderResolverImpl());
    AbstractClassMetaData cmdD2 = mgr.getMetaDataForClass(Cat.class, new ClassLoaderResolverImpl());
    assertNotNull(cmdD0.getMetaDataForMember("name"));
    assertNotNull(cmdD1.getMetaDataForMember("name"));
    assertEquals("dog", cmdD1.getMetaDataForMember("name").getColumnMetaData()[0].getName());
    assertNotNull(cmdD2.getMetaDataForMember("name"));
    assertEquals("cat", cmdD2.getMetaDataForMember("name").getColumnMetaData()[0].getName());
}
Also used : JDOMetaDataManager(org.datanucleus.api.jdo.metadata.JDOMetaDataManager) MetaDataManager(org.datanucleus.metadata.MetaDataManager) PersistenceNucleusContextImpl(org.datanucleus.PersistenceNucleusContextImpl) JDOMetaDataManager(org.datanucleus.api.jdo.metadata.JDOMetaDataManager) AbstractClassMetaData(org.datanucleus.metadata.AbstractClassMetaData) ClassLoaderResolverImpl(org.datanucleus.ClassLoaderResolverImpl)

Example 28 with JDOMetaDataManager

use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project tests by datanucleus.

the class AnnotationPlusXMLOverrideTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    nucleusCtx = new PersistenceNucleusContextImpl("JDO", null);
    metaDataMgr = new JDOMetaDataManager(nucleusCtx);
    clr = new ClassLoaderResolverImpl();
}
Also used : PersistenceNucleusContextImpl(org.datanucleus.PersistenceNucleusContextImpl) JDOMetaDataManager(org.datanucleus.api.jdo.metadata.JDOMetaDataManager) ClassLoaderResolverImpl(org.datanucleus.ClassLoaderResolverImpl)

Aggregations

JDOMetaDataManager (org.datanucleus.api.jdo.metadata.JDOMetaDataManager)28 PersistenceNucleusContextImpl (org.datanucleus.PersistenceNucleusContextImpl)27 ClassLoaderResolverImpl (org.datanucleus.ClassLoaderResolverImpl)20 MetaDataManager (org.datanucleus.metadata.MetaDataManager)17 AbstractClassMetaData (org.datanucleus.metadata.AbstractClassMetaData)16 MetaDataParser (org.datanucleus.metadata.xml.MetaDataParser)8 NucleusContext (org.datanucleus.NucleusContext)7 FetchPlan (org.datanucleus.FetchPlan)5 FetchPlanForClass (org.datanucleus.FetchPlanForClass)5 JDOFetchPlan (org.datanucleus.api.jdo.JDOFetchPlan)5 ArrayList (java.util.ArrayList)4 BitSet (java.util.BitSet)4 MetaData (org.datanucleus.metadata.MetaData)4 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 NucleusException (org.datanucleus.exceptions.NucleusException)2 FileMetaData (org.datanucleus.metadata.FileMetaData)2 BufferedReader (java.io.BufferedReader)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1