use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project datanucleus-api-jdo by datanucleus.
the class JDOMetaDataHandlerTest method testParseDefaultNamespace.
public void testParseDefaultNamespace() {
NucleusContext nucCtx = new PersistenceNucleusContextImpl("JDO", null);
MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(nucCtx), nucCtx.getPluginManager(), true, true);
MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/package1.jdo"), "jdo");
assertNotNull(md);
}
use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project datanucleus-api-jdo by datanucleus.
the class PersistenceFileMetaDataHandlerTest method testParseNamespace.
public void testParseNamespace() {
NucleusContext nucCtx = new PersistenceNucleusContextImpl("JDO", null);
MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(nucCtx), nucCtx.getPluginManager(), true, true);
MetaData md = parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/persistence2.xml"), "persistence");
assertNotNull(md);
}
use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project datanucleus-api-jdo by datanucleus.
the class MetaDataManagerTest method testLocationsForClass.
/**
* Test of the valid locations for a specified class.
*/
public void testLocationsForClass() {
Map startupProps = new HashMap<>();
startupProps.put(JDOPropertyNames.PROPERTY_METADATA_XML_JDO_1_0, "true");
JDOMetaDataManager mgr = new JDOMetaDataManager(new PersistenceNucleusContextImpl("JDO", startupProps));
// 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");
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");
validLocations.add("/org/jpox/samples/store.jdo");
validLocations.add("/org/jpox/samples/store/package.jdo");
validLocations.add("/org/jpox/samples/store/Product.jdo");
checkLocations(className, locations, validLocations);
}
use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project datanucleus-api-jdo by datanucleus.
the class MetaDataParserTest method testParseMetaDataURLnullURL.
public void testParseMetaDataURLnullURL() {
NucleusContext nucCtx = new PersistenceNucleusContextImpl("JDO", null);
MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(nucCtx), nucCtx.getPluginManager(), true, true);
try {
parser.parseMetaDataURL(null, "jdo");
fail("expected JPOXException");
} catch (NucleusException ex) {
// expected
}
}
use of org.datanucleus.api.jdo.metadata.JDOMetaDataManager in project datanucleus-api-jdo by datanucleus.
the class MetaDataParserTest method testParseMetaDataURLnullhandler.
public void testParseMetaDataURLnullhandler() {
NucleusContext nucCtx = new PersistenceNucleusContextImpl("JDO", null);
MetaDataParser parser = new MetaDataParser(new JDOMetaDataManager(nucCtx), nucCtx.getPluginManager(), true, true);
try {
parser.parseMetaDataURL(getClass().getResource("/org/datanucleus/api/jdo/metadata/xml/package2.jdo"), null);
fail("expected JPOXException");
} catch (NucleusException ex) {
// expected
}
}
Aggregations