Examples of JDOMetaDataManager


Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

    /**
     * Test of the valid locations for a specified package.
     */
    public void testLocationsForPackage()
    {
        JDOMetaDataManager mgr = new JDOMetaDataManager(new NucleusContext("JDO", null));

        // Try typical JDO package name
        String packageName = "org.jpox.samples";
        List locations = mgr.getValidMetaDataLocationsForPackage("jdo", null, packageName);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
        List validLocations = new ArrayList();
        validLocations.add("/META-INF/package.jdo");
        validLocations.add("/WEB-INF/package.jdo");
        validLocations.add("/package.jdo");
        validLocations.add("/org.jdo");
        validLocations.add("/org/package.jdo");
        validLocations.add("/org/jpox.jdo");
        validLocations.add("/org/jpox/package.jdo");
        validLocations.add("/org/jpox/samples.jdo");
        validLocations.add("/org/jpox/samples/package.jdo");
        checkLocations(packageName, locations, validLocations);

        // Try 1 level package name
        packageName = "org";
        locations = mgr.getValidMetaDataLocationsForPackage("jdo", null, packageName);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
        validLocations.clear();
        validLocations.add("/META-INF/package.jdo");
        validLocations.add("/WEB-INF/package.jdo");
        validLocations.add("/package.jdo");
        validLocations.add("/org.jdo");
        validLocations.add("/org/package.jdo");
        checkLocations(packageName, locations, validLocations);

        // Try 0 level package name
        packageName = "";
        locations = mgr.getValidMetaDataLocationsForPackage("jdo", null, packageName);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
        validLocations.clear();
        validLocations.add("/META-INF/package.jdo");
        validLocations.add("/WEB-INF/package.jdo");
        validLocations.add("/package.jdo");
        checkLocations(packageName, locations, validLocations);

        // Try typical ORM package name
        packageName = "org.jpox.samples";
        locations = mgr.getValidMetaDataLocationsForPackage("orm", "jpox", packageName);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
        validLocations.clear();
        validLocations.add("/META-INF/package-jpox.orm");
        validLocations.add("/WEB-INF/package-jpox.orm");
        validLocations.add("/package-jpox.orm");
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

    /**
     * Test of the valid locations for a specified class.
     */
    public void testLocationsForClass()
    {
        JDOMetaDataManager mgr = new JDOMetaDataManager(new NucleusContext("JDO", null));

        // Try typical JDO class name
        String className = "org.jpox.samples.store.Product";
        List locations = mgr.getValidMetaDataLocationsForClass("jdo", null, className);
        assertTrue("Locations returned from MetaData Manager was null!", locations != null);
        List validLocations = new ArrayList();
        validLocations.add("/META-INF/package.jdo");
        validLocations.add("/WEB-INF/package.jdo");
        validLocations.add("/package.jdo");
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

public class MetaDataParserTest extends TestCase
{
    public void testParseMetaDataURLnullURL()
    {
        MetaDataParser parser = new MetaDataParser(
            new JDOMetaDataManager(new NucleusContext("JDO", null)),true);
        try
        {
            parser.parseMetaDataURL(null, "jdo");
            fail("expected JPOXException");
        }
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

    }

    public void testParseMetaDataURLnullhandler()
    {
        MetaDataParser parser = new MetaDataParser(
            new JDOMetaDataManager(new NucleusContext("JDO", null)),true);
        try
        {
            parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/package2.jdo"), null);
            fail("expected JPOXException");
        }
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

public class PersistenceFileMetaDataHandlerTest extends TestCase
{
    public void testParseDefaultNamespace()
    {
        MetaDataParser parser = new MetaDataParser(
            new JDOMetaDataManager(new NucleusContext("JDO", null)),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/persistence1.xml"), "persistence");
        assertNotNull(md);
    }
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

    }

    public void testParseNamespace()
    {
        MetaDataParser parser = new MetaDataParser(
            new JDOMetaDataManager(new NucleusContext("JDO", null)),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/persistence2.xml"), "persistence");
        assertNotNull(md);
    }
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

public class JDOMetaDataHandlerTest extends TestCase
{
    public void testParseDefaultNamespace()
    {
        MetaDataParser parser = new MetaDataParser(
            new JDOMetaDataManager(new NucleusContext("JDO", null)),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/package1.jdo"), "jdo");
        assertNotNull(md);
    }
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

    }

    public void testParseNamespace()
    {
        MetaDataParser parser = new MetaDataParser(
            new JDOMetaDataManager(new NucleusContext("JDO", null)),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/package2.jdo"), "jdo");
        assertNotNull(md);
    }
View Full Code Here

Examples of org.datanucleus.api.jdo.metadata.JDOMetaDataManager

        {
            throw new IllegalArgumentException("Contents of file is null");
        }

        NucleusContext context = new NucleusContext("JDO", NucleusContext.ContextType.ENHANCEMENT, null);
        MetaDataManager mgr = new JDOMetaDataManager(context);
        MetaDataParser parser = new MetaDataParser(mgr, true);
        JDOClassLoaderResolver clr = new JDOClassLoaderResolver();

        // Parse the MetaData
        FileMetaData filemd = (FileMetaData)parser.parseMetaDataStream(
            new ByteArrayInputStream(jdoXmlContents.getBytes()), null, "JDO");
        if (filemd == null)
        {
            return null;
        }
        mgr.registerFile("EnhancerTestXMLFile", filemd, clr);

        // Populate/Initialise the MetaData for the actual classes.
        for (int i=0;i<filemd.getNoOfPackages();i++)
        {
            PackageMetaData pmd = filemd.getPackage(i);
View Full Code Here

Examples of org.datanucleus.jdo.metadata.JDOMetaDataManager

public class JDOMetaDataHandlerTest extends TestCase
{
    public void testParseDefaultNamespace()
    {
        MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(new OMFContext(new PersistenceConfiguration(){})),true);
        MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/metadata/xml/package1.jdo"), "jdo");
        assertNotNull(md);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.