/**
* Test of the valid locations for a specified package.
*/
public void testLocationsForPackage()
{
JDOMetaDataManager mgr = new JDOMetaDataManager(new OMFContext(new PersistenceConfiguration(){}));
// 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");