You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by ma...@apache.org on 2007/08/09 23:20:55 UTC
svn commit: r564384 [3/3] - in /db/jdo/trunk:
api2-legacy/src/java/javax/jdo/ api2-legacy/src/schema/javax/jdo/
api2-legacy/test/java/javax/jdo/ api2-legacy/test/schema/jdoconfig/Negative0/
api2-legacy/test/schema/jdoconfig/Negative00/ api2-legacy/test...
Modified: db/jdo/trunk/api2/test/java/javax/jdo/JDOHelperConfigTest.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/java/javax/jdo/JDOHelperConfigTest.java?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/api2/test/java/javax/jdo/JDOHelperConfigTest.java (original)
+++ db/jdo/trunk/api2/test/java/javax/jdo/JDOHelperConfigTest.java Thu Aug 9 14:20:35 2007
@@ -23,11 +23,11 @@
import javax.jdo.util.BatchTestRunner;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URLClassLoader;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
-import java.net.URLClassLoader;
/**
* Tests class javax.jdo.JDOHelper for META-INF/jdoconfig.xml compliance.
@@ -42,197 +42,108 @@
return new TestSuite(JDOHelperConfigTest.class);
}
- protected static String JDOCONFIG_CLASSPATH_PREFIX =
- System.getProperty("basedir") + "/test/schema/jdoconfig";
-
- protected static Random RANDOM = new Random(System.currentTimeMillis());
-
- /**
- * Tests JDOHelper.getPersistenceUnitProperties using file
- * Positive0-jdoconfig.xml and PU name
- * "persistence-unit-name.positive0.pmf0"
- */
- public void testPositive00_PMF0_GetNamedPMFProperties() throws IOException {
+ protected static String JDOCONFIG_CLASSPATH_PREFIX
+ = initJDOConfigClasspathPrefix();
- try {
- URLClassLoader loader = new JDOConfigTestClassLoader(
- JDOCONFIG_CLASSPATH_PREFIX,
- getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
- Map expected = prepareInitialExpectedMap("positive0.pmf0", 2);
- String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
- Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
- assertNotNull("No properties found", actual);
- assertEqualProperties(expected, actual);
- } catch (Exception e) {
- e.printStackTrace();
+ protected static String initJDOConfigClasspathPrefix() {
+ String basedir = System.getProperty("basedir");
+ if (basedir != null) {
+ if (!basedir.endsWith("/")) {
+ basedir += "/";
+ }
+ } else {
+ basedir = "";
}
+ return basedir + "test/schema/jdoconfig";
}
- /**
- * Tests JDOHelper.getPersistenceUnitProperties using file
- * Positive0-jdoconfig.xml and PU name
- * "persistence-unit-name.positive0.pmf1"
- */
- public void testPositive00_PMF1_GetNamedPMFProperties() throws IOException {
- URLClassLoader loader = new JDOConfigTestClassLoader(
- JDOCONFIG_CLASSPATH_PREFIX,
- getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
- Map expected = prepareInitialExpectedMap("positive0.pmf1", 2);
- String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
- Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
- assertNotNull("No properties found", actual);
- assertEqualProperties(expected, actual);
- }
-
- /**
- * Tests JDOHelper.getPersistenceUnitProperties using file
- * Positive0-jdoconfig.xml and PU name
- * "persistence-unit-name.positive0.pmf2"
- */
- public void testPositive00_PMF2_GetNamedPMFProperties() throws IOException {
- URLClassLoader loader = new JDOConfigTestClassLoader(
- JDOCONFIG_CLASSPATH_PREFIX,
- getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
- Map expected = prepareInitialExpectedMap("positive0.pmf2", 2);
- String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
- Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
- assertNotNull("No properties found", actual);
- assertEqualProperties(expected, actual);
- }
-
- /**
- * Tests JDOHelper.getPersistenceUnitProperties using file
- * Positive0-jdoconfig.xml and PU name
- * "persistence-unit-name.positive0.pmf3"
- */
- public void testPositive00_PMF3_GetNamedPMFProperties() throws IOException {
- URLClassLoader loader = new JDOConfigTestClassLoader(
- JDOCONFIG_CLASSPATH_PREFIX,
- getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
- Map expected = prepareInitialExpectedMap("positive0.pmf3", 2, 2);
- String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
- Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
- assertNotNull("No properties found", actual);
- assertEqualProperties(expected, actual);
- }
-
- /**
- * Tests JDOHelper.getPersistenceUnitProperties using file
- * Positive0-jdoconfig.xml and PU name
- * "persistence-unit-name.positive0.pmf4"
- */
- public void testPositive00_PMF4_GetNamedPMFProperties() throws IOException {
- URLClassLoader loader = new JDOConfigTestClassLoader(
- JDOCONFIG_CLASSPATH_PREFIX,
- getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive0", loader);
-
- Map expected = prepareInitialExpectedMap("positive0.pmf4", 0, 2);
- String name = (String) expected.get(PROPERTY_PERSISTENCE_UNIT_NAME);
-
- Map actual = JDOHelper.getPersistenceUnitProperties(name, loader);
-
- assertNotNull("No properties found", actual);
- assertEqualProperties(expected, actual);
- }
+ protected static Random RANDOM = new Random(System.currentTimeMillis());
- public Map prepareInitialExpectedMap(String testVariant) {
- return prepareInitialExpectedMap(testVariant, 0, 0);
- }
- public Map prepareInitialExpectedMap(String testVariant, int numListeners) {
- return prepareInitialExpectedMap(testVariant, numListeners, 0);
- }
- public Map prepareInitialExpectedMap(
- String testVariant,
- int numListeners,
- int numProperties
+ protected Map prepareInitialExpectedMap(
+ String testVariant,
+ int listenerCount,
+ int vendorSpecificPropertyCount,
+ boolean excludeName,
+ boolean excludePUName
) {
Map expected = new HashMap();
+ if (!excludeName) {
+ expected.put(
+ PROPERTY_NAME,
+ PMF_ATTRIBUTE_NAME + "." + testVariant);
+ }
+ if (!excludePUName) {
+ expected.put(
+ PROPERTY_PERSISTENCE_UNIT_NAME,
+ PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME + "." + testVariant);
+ }
+
expected.put(PROPERTY_PERSISTENCE_MANAGER_FACTORY_CLASS,
- PMF_ATTRIBUTE_CLASS + "." + testVariant);
+ PMF_ATTRIBUTE_CLASS + "." + testVariant);
expected.put(
- PROPERTY_CONNECTION_DRIVER_NAME,
- PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME + "." + testVariant);
+ PROPERTY_CONNECTION_DRIVER_NAME,
+ PMF_ATTRIBUTE_CONNECTION_DRIVER_NAME + "." + testVariant);
expected.put(
- PROPERTY_CONNECTION_FACTORY_NAME,
- PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME + "." + testVariant);
+ PROPERTY_CONNECTION_FACTORY_NAME,
+ PMF_ATTRIBUTE_CONNECTION_FACTORY_NAME + "." + testVariant);
expected.put(
- PROPERTY_CONNECTION_FACTORY2_NAME,
- PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME + "." + testVariant);
+ PROPERTY_CONNECTION_FACTORY2_NAME,
+ PMF_ATTRIBUTE_CONNECTION_FACTORY2_NAME + "." + testVariant);
expected.put(
- PROPERTY_CONNECTION_PASSWORD,
- PMF_ATTRIBUTE_CONNECTION_PASSWORD + "." + testVariant);
+ PROPERTY_CONNECTION_PASSWORD,
+ PMF_ATTRIBUTE_CONNECTION_PASSWORD + "." + testVariant);
expected.put(
- PROPERTY_CONNECTION_URL,
- PMF_ATTRIBUTE_CONNECTION_URL + "." + testVariant);
+ PROPERTY_CONNECTION_URL,
+ PMF_ATTRIBUTE_CONNECTION_URL + "." + testVariant);
expected.put(
- PROPERTY_CONNECTION_USER_NAME,
- PMF_ATTRIBUTE_CONNECTION_USER_NAME + "." + testVariant);
+ PROPERTY_CONNECTION_USER_NAME,
+ PMF_ATTRIBUTE_CONNECTION_USER_NAME + "." + testVariant);
expected.put(
- PROPERTY_IGNORE_CACHE,
- PMF_ATTRIBUTE_IGNORE_CACHE + "." + testVariant);
+ PROPERTY_IGNORE_CACHE,
+ PMF_ATTRIBUTE_IGNORE_CACHE + "." + testVariant);
expected.put(
- PROPERTY_MAPPING,
- PMF_ATTRIBUTE_MAPPING + "." + testVariant);
+ PROPERTY_MAPPING,
+ PMF_ATTRIBUTE_MAPPING + "." + testVariant);
expected.put(
- PROPERTY_MULTITHREADED,
- PMF_ATTRIBUTE_MULTITHREADED + "." + testVariant);
+ PROPERTY_MULTITHREADED,
+ PMF_ATTRIBUTE_MULTITHREADED + "." + testVariant);
expected.put(
- PROPERTY_NONTRANSACTIONAL_READ,
- PMF_ATTRIBUTE_NONTRANSACTIONAL_READ + "." + testVariant);
+ PROPERTY_NONTRANSACTIONAL_READ,
+ PMF_ATTRIBUTE_NONTRANSACTIONAL_READ + "." + testVariant);
expected.put(
- PROPERTY_NONTRANSACTIONAL_WRITE,
- PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE + "." + testVariant);
+ PROPERTY_NONTRANSACTIONAL_WRITE,
+ PMF_ATTRIBUTE_NONTRANSACTIONAL_WRITE + "." + testVariant);
expected.put(
- PROPERTY_OPTIMISTIC,
- PMF_ATTRIBUTE_OPTIMISTIC + "." + testVariant);
+ PROPERTY_OPTIMISTIC,
+ PMF_ATTRIBUTE_OPTIMISTIC + "." + testVariant);
expected.put(
- PROPERTY_PERSISTENCE_UNIT_NAME,
- PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME + "." + testVariant);
+ PROPERTY_RESTORE_VALUES,
+ PMF_ATTRIBUTE_RESTORE_VALUES + "." + testVariant);
expected.put(
- PROPERTY_RESTORE_VALUES,
- PMF_ATTRIBUTE_RESTORE_VALUES + "." + testVariant);
+ PROPERTY_RETAIN_VALUES,
+ PMF_ATTRIBUTE_RETAIN_VALUES + "." + testVariant);
expected.put(
- PROPERTY_RETAIN_VALUES,
- PMF_ATTRIBUTE_RETAIN_VALUES + "." + testVariant);
+ PROPERTY_DETACH_ALL_ON_COMMIT,
+ PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT + "." + testVariant);
expected.put(
- PROPERTY_DETACH_ALL_ON_COMMIT,
- PMF_ATTRIBUTE_DETACH_ALL_ON_COMMIT + "." + testVariant);
- expected.put(
- PROPERTY_SERVER_TIME_ZONE_ID,
- PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID + "." + testVariant);
+ PROPERTY_SERVER_TIME_ZONE_ID,
+ PMF_ATTRIBUTE_SERVER_TIME_ZONE_ID + "." + testVariant);
// listeners
- for (int i = 0; i < numListeners; i++) {
+ for (int i = 0; i < listenerCount; i++) {
expected.put(
- PROPERTY_PREFIX_INSTANCE_LIFECYCLE_LISTENER +
- "listener." + testVariant + ".listener" + i,
- "classes." + testVariant + ".classes" + i
+ PROPERTY_PREFIX_INSTANCE_LIFECYCLE_LISTENER +
+ "listener." + testVariant + ".listener" + i,
+ "classes." + testVariant + ".classes" + i
);
}
- // properties
- for (int i = 0; i < numProperties; i++) {
+ // vendor-specific properties
+ for (int i = 0; i < vendorSpecificPropertyCount; i++) {
expected.put(
- "property." + testVariant + ".name" + i,
- "property." + testVariant + ".value" + i
+ "property." + testVariant + ".name" + i,
+ "property." + testVariant + ".value" + i
);
}
@@ -248,240 +159,364 @@
String actualValue = (String) actual.get(key);
assertEquals(
- "Actual property at key [" + key + "] with value [" +
- actualValue + "] not equal to expected value [" +
- expectedValue + "]",
- expectedValue,
- actualValue);
+ "Actual property at key [" + key + "] with value [" +
+ actualValue + "] not equal to expected value [" +
+ expectedValue + "]",
+ expectedValue,
+ actualValue);
}
}
- /**
- * Tests JDOHelper.getPersistenceUnitProperties using file
- * Positive0-jdoconfig.xml and PU name
- * "persistence-unit-name.positive0.pmf0"
- */
- public void testPositive01_DuplicatePUsInDifferentConfigFilesButNotRequested() throws IOException {
-
+ protected void doPositiveTest(
+ String[] classpaths,
+ String testVariantName,
+ int listenerCount,
+ int vendorSpecificPropertyCount,
+ boolean checkEqualProperties)
+ throws IOException {
+
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive1/1a", loader);
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive1/1b", loader);
- Map props = JDOHelper.getPersistenceUnitProperties(null, loader);
- assertNotNull(props);
+ for (int i = 0; i < classpaths.length; i++) {
+ ClasspathHelper.addFile(classpaths[i], loader);
+ }
+
+ Map expected = prepareInitialExpectedMap(
+ testVariantName,
+ listenerCount,
+ vendorSpecificPropertyCount,
+ false,
+ false);
+
+ String name = testVariantName == null
+ ? null
+ : (String) expected.get(PROPERTY_NAME);
+
+ Map actual = JDOHelper.getNamedPMFProperties(name, loader);
+
+ assertNotNull("No properties found", actual);
+ if (checkEqualProperties) {
+ assertEqualProperties(expected, actual);
+ }
+ }
+
+ public void testPositive00_PMF0_BasicPMFConfigUsingOnlyStandardAttributesAndListeners()
+ throws IOException {
+ doPositiveTest(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+ "positive00.pmf0",
+ 2,
+ 0,
+ true);
+ }
+
+ public void testPositive00_PMF1_BasicPMFConfigUsingOnlyPropertyElementsWithStandardJavaxDotJDOProperties()
+ throws IOException {
+ doPositiveTest(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+ "positive00.pmf1",
+ 2,
+ 0,
+ true);
+ }
+
+ public void testPositive00_PMF2_NestedPropertyElementsWithOnlyStandardAttributeNames()
+ throws IOException {
+ doPositiveTest(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+ "positive00.pmf2",
+ 2,
+ 0,
+ true);
+ }
+
+ public void testPositive00_PMF3_StandardAttributesPlusNonstandardPropertiesInPropertyElements()
+ throws IOException {
+ doPositiveTest(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+ "positive00.pmf3",
+ 2,
+ 2,
+ true);
+ }
+
+ public void testPositive00_PMF4_StandardAttributesPlusNonstandardAttributes()
+ throws IOException {
+ doPositiveTest(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX + "/Positive00"},
+ "positive00.pmf4",
+ 0,
+ 2,
+ true);
+ }
+
+ public void testPositive01_DuplicatePUsInDifferentConfigFilesButNotRequested()
+ throws IOException {
+
+ doPositiveTest(
+ new String[]{
+ JDOCONFIG_CLASSPATH_PREFIX + "/Positive01/1a",
+ JDOCONFIG_CLASSPATH_PREFIX + "/Positive01/1b"
+ },
+ null,
+ 0,
+ 2,
+ false);
}
- /**
- * Tests JDOHelper.getPMFClassNameViaServiceLookup
- */
- public void testPositive03_PMF0_PMFClassNameViaServicesLookup() throws IOException {
+ public void testPositive03_PMF0_PMFClassNameViaServicesLookup()
+ throws IOException {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive3", loader);
+ ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive03", loader);
- String expected = "class.positive3.pmf0";
+ String expected = "class.positive03.pmf0";
String actual = JDOHelper.getPMFClassNameViaServiceLookup(loader);
assertNotNull("No PMF name found via services lookup", actual);
assertEquals(expected, actual);
}
- /**
- * Tests JDOHelper.getPMFClassNameViaServiceLookup
- */
- public void testPositive04_PMF0_PMFClassNameViaServicesLookup() throws IOException {
+ public void testPositive04_PMF0_PMFClassNameViaServicesLookup()
+ throws IOException {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive4", loader);
+ ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive04", loader);
- String expected = "class.positive4.pmf0";
+ String expected = "class.positive04.pmf0";
String actual = JDOHelper.getPMFClassNameViaServiceLookup(loader);
assertNotNull("No PMF name found via services lookup", actual);
assertEquals(expected, actual);
}
- /**
- * Tests JDOHelper.getPMFClassNameViaServiceLookup
- */
- public void testPositive05_PMF0_PMFClassNameViaServicesLookup() throws IOException {
+ public void testPositive05_PMF0_PMFClassNameViaServicesLookup()
+ throws IOException {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Positive5", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Positive05", loader);
- String expected = "class.positive5.pmf0";
+ String expected = "class.positive05.pmf0";
String actual = JDOHelper.getPMFClassNameViaServiceLookup(loader);
assertNotNull("No PMF name found via services lookup", actual);
assertEquals(expected, actual);
}
- public void testNegative08_NoResourcesFound() {
- String resource = "" + RANDOM.nextLong();
+ public void testPositive06_PMF0_GetAnonymousPMFProperties()
+ throws IOException {
- InputStream in =
- getClass().getClassLoader().getResourceAsStream(resource);
- assertNull(in);
+ URLClassLoader loader = new JDOConfigTestClassLoader(
+ JDOCONFIG_CLASSPATH_PREFIX,
+ getClass().getClassLoader());
- // resource pretty much guaranteed not to exist
- try {
- JDOHelper.getPersistenceManagerFactory(resource);
- fail("JDOHelper failed to throw JDOFatalUserException");
- }
- catch (JDOFatalUserException x) {
- // happy path
- }
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Positive06", loader);
+
+ Map expected = prepareInitialExpectedMap(
+ "positive06.pmf0", 2, 0, true, true);
+
+ Map actual = JDOHelper.getNamedPMFProperties(null, loader);
+
+ assertNotNull("No properties found", actual);
+ assertEqualProperties(expected, actual);
}
- public void testNegative00_EmptyJDOConfigXML() throws IOException {
+ public void testPositive07_PMF0_GetAnonymousPMFPropertiesWithPUName()
+ throws IOException {
+
+ URLClassLoader loader = new JDOConfigTestClassLoader(
+ JDOCONFIG_CLASSPATH_PREFIX,
+ getClass().getClassLoader());
+
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Positive07", loader);
+
+ Map expected = prepareInitialExpectedMap(
+ "positive07.pmf0", 2, 0, true, false);
+
+ Map actual = JDOHelper.getNamedPMFProperties(null, loader);
+
+ assertNotNull("No properties found", actual);
+ assertEqualProperties(expected, actual);
+ }
+
+ public void testNegative00_EmptyJDOConfigXML() throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative0", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative0", loader);
JDOHelper.getPersistenceManagerFactory(loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // sunny day
}
}
-
- public void testNegative01_NoPersistenceUnitsDefined() throws IOException {
+
+ public void testNegative01_NoPersistenceUnitsDefined() throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative1", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative01", loader);
JDOHelper.getPersistenceManagerFactory(loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // joy, sweet joy
}
}
public void testNegative02_DuplicateAnonymousPersistenceUnitsInSameConfig()
- throws IOException
- {
+ throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative2", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative02", loader);
JDOHelper.getPersistenceManagerFactory(loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // the cockles of my heart warmeth
}
}
public void testNegative03_DuplicateNamedPersistenceUnitsInSameConfig()
- throws IOException
- {
+ throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative3", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative03", loader);
JDOHelper.getPersistenceManagerFactory(
- "persistence-unit-name.negative3",
- loader);
+ "name.negative03",
+ loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // warm fuzzies
}
}
public void testNegative04_DuplicatePUNamePropertyInAttributeAndElement()
- throws IOException
- {
+ throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative4", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative04", loader);
JDOHelper.getPersistenceManagerFactory(
- "persistence-unit-name.negative4.value0",
- loader);
+ "name.negative04.value0",
+ loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // no cold pricklies
}
}
public void testNegative05_DuplicatePropertyInAttributeAndElement()
- throws IOException
- {
+ throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative5", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative05", loader);
JDOHelper.getPersistenceManagerFactory(loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // party!
}
}
public void testNegative06_DuplicatePUInDifferentConfigFiles()
- throws IOException
- {
+ throws IOException {
try {
URLClassLoader loader = new JDOConfigTestClassLoader(
JDOCONFIG_CLASSPATH_PREFIX,
getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative6/6a", loader);
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative6/6b", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative06/6a", loader);
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative06/6b", loader);
JDOHelper.getPersistenceManagerFactory(
- "persistence-unit-name.negative6",
+ "name.negative06",
loader);
fail("JDOHelper failed to throw JDOFatalUserException");
}
catch (JDOFatalUserException x) {
- // happy path
+ // clear blue sky
}
}
public void testNegative07_EmptyServicesFile()
- throws IOException
- {
- JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(new String[] {JDOCONFIG_CLASSPATH_PREFIX}, getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative7", testLoader);
- String shouldBeNull = JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
+ throws IOException {
+ JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX},
+ getClass().getClassLoader());
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative07", testLoader);
+ String shouldBeNull =
+ JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
assertNull(shouldBeNull);
}
+ public void testNegative08_NoResourcesFound() {
+ String resource = "" + RANDOM.nextLong();
+
+ InputStream in =
+ getClass().getClassLoader().getResourceAsStream(resource);
+ assertNull(in);
+
+ // resource pretty much guaranteed not to exist
+ try {
+ JDOHelper.getPersistenceManagerFactory(resource);
+ fail("JDOHelper failed to throw JDOFatalUserException");
+ }
+ catch (JDOFatalUserException x) {
+ // happy path
+ }
+ }
+
public void testNegative08_ServicesFileWithOnlyComments()
- throws IOException
- {
- JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(new String[] {JDOCONFIG_CLASSPATH_PREFIX}, getClass().getClassLoader());
- ClasspathHelper.addFile(JDOCONFIG_CLASSPATH_PREFIX + "/Negative8", testLoader);
- String shouldBeNull = JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
+ throws IOException {
+ JDOConfigTestClassLoader testLoader = new JDOConfigTestClassLoader(
+ new String[]{JDOCONFIG_CLASSPATH_PREFIX},
+ getClass().getClassLoader());
+ ClasspathHelper.addFile(
+ JDOCONFIG_CLASSPATH_PREFIX + "/Negative08", testLoader);
+ String shouldBeNull =
+ JDOHelper.getPMFClassNameViaServiceLookup(testLoader);
assertNull(shouldBeNull);
}
}
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative00/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1 @@
+
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative01/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <!-- No PMFs defined -->
+</jdoconfig>
+
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative02/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <!-- Duplicate anonymous PMFs present -->
+ <persistence-manager-factory/>
+ <persistence-manager-factory/>
+</jdoconfig>
+
+
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative03/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate named PMF -->
+ <persistence-manager-factory
+ name="name.negative3"/>
+
+ <persistence-manager-factory
+ name="name.negative3"/>
+
+</jdoconfig>
+
+
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative04/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate PMF name property in attribute & element -->
+ <persistence-manager-factory
+ name="persistence-unit-name.negative4.value0">
+ <property
+ name="name"
+ value="name.negative4.value1"/>
+
+ </persistence-manager-factory>
+</jdoconfig>
+
+
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative05/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate property in attribute & element -->
+ <persistence-manager-factory
+ class="class.negative5.value0">
+ <property
+ name="class"
+ value="class.negative5.value1"/>
+
+ </persistence-manager-factory>
+</jdoconfig>
+
+
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6a/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate PMF in this file and another -->
+ <persistence-manager-factory
+ name="name.negative6"/>
+</jdoconfig>
+
+
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative06/6b/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate PMF in this file and another -->
+ <persistence-manager-factory
+ name="name.negative6"/>
+</jdoconfig>
+
+
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative07/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative07/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
(empty)
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Negative08/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1,3 @@
+# there are
+# only comments
+# in this file
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive00/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,260 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!--
+ Basic PMF config using attributes & listeners with no nonstandard
+ properties.
+ -->
+ <persistence-manager-factory
+ class="class.positive00.pmf0"
+ connection-driver-name="connection-driver-name.positive00.pmf0"
+ connection-factory-name="connection-factory-name.positive00.pmf0"
+ connection-factory2-name="connection-factory2-name.positive00.pmf0"
+ connection-password="connection-password.positive00.pmf0"
+ connection-url="connection-url.positive00.pmf0"
+ connection-user-name="connection-user-name.positive00.pmf0"
+ ignore-cache="ignore-cache.positive00.pmf0"
+ mapping="mapping.positive00.pmf0"
+ multithreaded="multithreaded.positive00.pmf0"
+ nontransactional-read="nontransactional-read.positive00.pmf0"
+ nontransactional-write="nontransactional-write.positive00.pmf0"
+ optimistic="optimistic.positive00.pmf0"
+ name="name.positive00.pmf0"
+ persistence-unit-name="persistence-unit-name.positive00.pmf0"
+ restore-values="restore-values.positive00.pmf0"
+ retain-values="retain-values.positive00.pmf0"
+ detach-all-on-commit="detach-all-on-commit.positive00.pmf0"
+ server-time-zone-id="server-time-zone-id.positive00.pmf0">
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf0.listener0"
+ classes="classes.positive00.pmf0.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf0.listener1"
+ classes="classes.positive00.pmf0.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ Basic PMF config using only <property> elements with javax.jdo
+ properties and no nonstandard properties.
+ -->
+ <persistence-manager-factory>
+ <property
+ name="javax.jdo.PersistenceManagerFactoryClass"
+ value="class.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionDriverName"
+ value="connection-driver-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionFactoryName"
+ value="connection-factory-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionFactory2Name"
+ value="connection-factory2-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionPassword"
+ value="connection-password.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionURL"
+ value="connection-url.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ConnectionUserName"
+ value="connection-user-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.IgnoreCache"
+ value="ignore-cache.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Mapping"
+ value="mapping.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Multithreaded"
+ value="multithreaded.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.NontransactionalRead"
+ value="nontransactional-read.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.NontransactionalWrite"
+ value="nontransactional-write.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Optimistic"
+ value="optimistic.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.Name"
+ value="name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.PersistenceUnitName"
+ value="persistence-unit-name.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.DetachAllOnCommit"
+ value="detach-all-on-commit.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.RestoreValues"
+ value="restore-values.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.RetainValues"
+ value="retain-values.positive00.pmf1"/>
+ <property
+ name="javax.jdo.option.ServerTimeZoneID"
+ value="server-time-zone-id.positive00.pmf1"/>
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf1.listener0"
+ classes="classes.positive00.pmf1.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf1.listener1"
+ classes="classes.positive00.pmf1.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ PMF config that uses nested <property> elements with standard
+ attribute names instead of javax.jdo property names and no nonstandard
+ properties.
+ -->
+ <persistence-manager-factory>
+ <property
+ name="class"
+ value="class.positive00.pmf2"/>
+ <property
+ name="connection-driver-name"
+ value="connection-driver-name.positive00.pmf2"/>
+ <property
+ name="connection-factory-name"
+ value="connection-factory-name.positive00.pmf2"/>
+ <property
+ name="connection-factory2-name"
+ value="connection-factory2-name.positive00.pmf2"/>
+ <property
+ name="connection-password"
+ value="connection-password.positive00.pmf2"/>
+ <property
+ name="connection-url"
+ value="connection-url.positive00.pmf2"/>
+ <property
+ name="connection-user-name"
+ value="connection-user-name.positive00.pmf2"/>
+ <property
+ name="ignore-cache"
+ value="ignore-cache.positive00.pmf2"/>
+ <property
+ name="mapping"
+ value="mapping.positive00.pmf2"/>
+ <property
+ name="multithreaded"
+ value="multithreaded.positive00.pmf2"/>
+ <property
+ name="nontransactional-read"
+ value="nontransactional-read.positive00.pmf2"/>
+ <property
+ name="nontransactional-write"
+ value="nontransactional-write.positive00.pmf2"/>
+ <property
+ name="optimistic"
+ value="optimistic.positive00.pmf2"/>
+ <property
+ name="name"
+ value="name.positive00.pmf2"/>
+ <property
+ name="persistence-unit-name"
+ value="persistence-unit-name.positive00.pmf2"/>
+ <property
+ name="detach-all-on-commit"
+ value="detach-all-on-commit.positive00.pmf2"/>
+ <property
+ name="restore-values"
+ value="restore-values.positive00.pmf2"/>
+ <property
+ name="retain-values"
+ value="retain-values.positive00.pmf2"/>
+ <property
+ name="javax.jdo.option.ServerTimeZoneID"
+ value="server-time-zone-id.positive00.pmf2"/>
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf2.listener0"
+ classes="classes.positive00.pmf2.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf2.listener1"
+ classes="classes.positive00.pmf2.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ PMF config using standard attributes plus nonstandard properties in
+ <property> elements.
+ -->
+ <persistence-manager-factory
+ class="class.positive00.pmf3"
+ connection-driver-name="connection-driver-name.positive00.pmf3"
+ connection-factory-name="connection-factory-name.positive00.pmf3"
+ connection-factory2-name="connection-factory2-name.positive00.pmf3"
+ connection-password="connection-password.positive00.pmf3"
+ connection-url="connection-url.positive00.pmf3"
+ connection-user-name="connection-user-name.positive00.pmf3"
+ ignore-cache="ignore-cache.positive00.pmf3"
+ mapping="mapping.positive00.pmf3"
+ multithreaded="multithreaded.positive00.pmf3"
+ nontransactional-read="nontransactional-read.positive00.pmf3"
+ nontransactional-write="nontransactional-write.positive00.pmf3"
+ optimistic="optimistic.positive00.pmf3"
+ name="name.positive00.pmf3"
+ persistence-unit-name="persistence-unit-name.positive00.pmf3"
+ restore-values="restore-values.positive00.pmf3"
+ retain-values="retain-values.positive00.pmf3"
+ detach-all-on-commit="detach-all-on-commit.positive00.pmf3"
+ server-time-zone-id="server-time-zone-id.positive00.pmf3">
+
+ <property name="property.positive00.pmf3.name0"
+ value="property.positive00.pmf3.value0"/>
+ <property name="property.positive00.pmf3.name1"
+ value="property.positive00.pmf3.value1"/>
+
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf3.listener0"
+ classes="classes.positive00.pmf3.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive00.pmf3.listener1"
+ classes="classes.positive00.pmf3.classes1"
+ />
+ </persistence-manager-factory>
+
+ <!--
+ PMF config using standard attributes plus nonstandard attributes.
+ -->
+ <persistence-manager-factory
+ class="class.positive00.pmf4"
+ connection-driver-name="connection-driver-name.positive00.pmf4"
+ connection-factory-name="connection-factory-name.positive00.pmf4"
+ connection-factory2-name="connection-factory2-name.positive00.pmf4"
+ connection-password="connection-password.positive00.pmf4"
+ connection-url="connection-url.positive00.pmf4"
+ connection-user-name="connection-user-name.positive00.pmf4"
+ ignore-cache="ignore-cache.positive00.pmf4"
+ mapping="mapping.positive00.pmf4"
+ multithreaded="multithreaded.positive00.pmf4"
+ nontransactional-read="nontransactional-read.positive00.pmf4"
+ nontransactional-write="nontransactional-write.positive00.pmf4"
+ optimistic="optimistic.positive00.pmf4"
+ name="name.positive00.pmf4"
+ persistence-unit-name="persistence-unit-name.positive00.pmf4"
+ restore-values="restore-values.positive00.pmf4"
+ retain-values="retain-values.positive00.pmf4"
+ detach-all-on-commit="detach-all-on-commit.positive00.pmf4"
+ server-time-zone-id="server-time-zone-id.positive00.pmf4"
+
+ property.positive00.pmf4.name0="property.positive00.pmf4.value0"
+ property.positive00.pmf4.name1="property.positive00.pmf4.value1"/>
+</jdoconfig>
+
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1a/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate PUs in this file and another, but not requested -->
+ <persistence-manager-factory/>
+
+ <persistence-manager-factory
+ name="name.positive01"/>
+</jdoconfig>
+
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive01/1b/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Duplicate PUs in this file and another, but not requested -->
+ <persistence-manager-factory
+ name="name.positive01"/>
+</jdoconfig>
+
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Anonymous PMF & with META-INF/services lookup for PMF class name -->
+ <persistence-manager-factory/>
+</jdoconfig>
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive03/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1 @@
+class.positive03.pmf0
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Anonymous PMF & with META-INF/services lookup for PMF class name -->
+ <persistence-manager-factory/>
+</jdoconfig>
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive04/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1,3 @@
+
+#this is a comment
+class.positive04.pmf0 # this is another comment
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!-- Anonymous PMF & with META-INF/services lookup for PMF class name -->
+ <persistence-manager-factory/>
+</jdoconfig>
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive05/META-INF/services/javax.jdo.PersistenceManagerFactory Thu Aug 9 14:20:35 2007
@@ -0,0 +1 @@
+class.positive05.pmf0# this is a comment without whitespace separating it from the uncommented text
\ No newline at end of file
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive06/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!--
+ Basic anonymous PMF config using attributes & listeners with no nonstandard
+ properties.
+ -->
+ <persistence-manager-factory
+ class="class.positive06.pmf0"
+ connection-driver-name="connection-driver-name.positive06.pmf0"
+ connection-factory-name="connection-factory-name.positive06.pmf0"
+ connection-factory2-name="connection-factory2-name.positive06.pmf0"
+ connection-password="connection-password.positive06.pmf0"
+ connection-url="connection-url.positive06.pmf0"
+ connection-user-name="connection-user-name.positive06.pmf0"
+ ignore-cache="ignore-cache.positive06.pmf0"
+ mapping="mapping.positive06.pmf0"
+ multithreaded="multithreaded.positive06.pmf0"
+ nontransactional-read="nontransactional-read.positive06.pmf0"
+ nontransactional-write="nontransactional-write.positive06.pmf0"
+ optimistic="optimistic.positive06.pmf0"
+ restore-values="restore-values.positive06.pmf0"
+ retain-values="retain-values.positive06.pmf0"
+ detach-all-on-commit="detach-all-on-commit.positive06.pmf0"
+ server-time-zone-id="server-time-zone-id.positive06.pmf0">
+
+ <instance-lifecycle-listener
+ listener="listener.positive06.pmf0.listener0"
+ classes="classes.positive06.pmf0.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive06.pmf0.listener1"
+ classes="classes.positive06.pmf0.classes1"
+ />
+ </persistence-manager-factory>
+</jdoconfig>
Added: db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml?view=auto&rev=564384
==============================================================================
--- db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml (added)
+++ db/jdo/trunk/api2/test/schema/jdoconfig/Positive07/META-INF/jdoconfig.xml Thu Aug 9 14:20:35 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Do not change any values in this file without also making changes to
+ JDOHelperConfigTest.java, as that file depends on the values in this one!
+-->
+<jdoconfig
+ xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">
+
+ <!--
+ Basic anonymous PMF config using attributes & listeners with no nonstandard
+ properties but with a PU name.
+ -->
+ <persistence-manager-factory
+ class="class.positive07.pmf0"
+ connection-driver-name="connection-driver-name.positive07.pmf0"
+ connection-factory-name="connection-factory-name.positive07.pmf0"
+ connection-factory2-name="connection-factory2-name.positive07.pmf0"
+ connection-password="connection-password.positive07.pmf0"
+ connection-url="connection-url.positive07.pmf0"
+ connection-user-name="connection-user-name.positive07.pmf0"
+ ignore-cache="ignore-cache.positive07.pmf0"
+ mapping="mapping.positive07.pmf0"
+ multithreaded="multithreaded.positive07.pmf0"
+ nontransactional-read="nontransactional-read.positive07.pmf0"
+ nontransactional-write="nontransactional-write.positive07.pmf0"
+ optimistic="optimistic.positive07.pmf0"
+ persistence-unit-name="persistence-unit-name.positive07.pmf0"
+ restore-values="restore-values.positive07.pmf0"
+ retain-values="retain-values.positive07.pmf0"
+ detach-all-on-commit="detach-all-on-commit.positive07.pmf0"
+ server-time-zone-id="server-time-zone-id.positive07.pmf0">
+
+ <instance-lifecycle-listener
+ listener="listener.positive07.pmf0.listener0"
+ classes="classes.positive07.pmf0.classes0"
+ />
+ <instance-lifecycle-listener
+ listener="listener.positive07.pmf0.listener1"
+ classes="classes.positive07.pmf0.classes1"
+ />
+ </persistence-manager-factory>
+</jdoconfig>
+
Modified: db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt (original)
+++ db/jdo/trunk/tck2-legacy/src/conf/jdo-2_1-signatures.txt Thu Aug 9 14:20:35 2007
@@ -15,6 +15,8 @@
= "persistence-manager-factory";
static String PMF_ATTRIBUTE_CLASS
= "class";
+ static String PMF_ATTRIBUTE_NAME
+ = "name";
static String PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME
= "persistence-unit-name";
static String PMF_ATTRIBUTE_OPTIMISTIC
@@ -153,6 +155,8 @@
= "javax.jdo.option.ConnectionFactory2Name";
static String PROPERTY_MAPPING
= "javax.jdo.option.Mapping";
+ static String PROPERTY_NAME
+ = "javax.jdo.option.Name";
static String PROPERTY_PERSISTENCE_UNIT_NAME
= "javax.jdo.option.PersistenceUnitName";
static String PROPERTY_INSTANCE_LIFECYCLE_LISTENER
@@ -450,6 +454,7 @@
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory();
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map props);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map props, ClassLoader cl);
+ public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map props, ClassLoader resourceLoader, ClassLoader pmfLoader);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(String propsResource);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(String propsResource, ClassLoader loader);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(String propsResource, ClassLoader propsLoader, ClassLoader pmfLoader);
@@ -720,6 +725,8 @@
public boolean getIgnoreCache();
public boolean getDetachAllOnCommit();
public void setDetachAllOnCommit(boolean flag);
+ public java.lang.String getName();
+ public void setName(java.lang.String);
public java.lang.String getPersistenceUnitName();
public void setPersistenceUnitName(java.lang.String);
public java.lang.String getServerTimeZoneID();
Modified: db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt?view=diff&rev=564384&r1=564383&r2=564384
==============================================================================
--- db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt (original)
+++ db/jdo/trunk/tck2/src/conf/jdo-2_1-signatures.txt Thu Aug 9 14:20:35 2007
@@ -15,6 +15,8 @@
= "persistence-manager-factory";
static String PMF_ATTRIBUTE_CLASS
= "class";
+ static String PMF_ATTRIBUTE_NAME
+ = "name";
static String PMF_ATTRIBUTE_PERSISTENCE_UNIT_NAME
= "persistence-unit-name";
static String PMF_ATTRIBUTE_OPTIMISTIC
@@ -153,6 +155,8 @@
= "javax.jdo.option.ConnectionFactory2Name";
static String PROPERTY_MAPPING
= "javax.jdo.option.Mapping";
+ static String PROPERTY_NAME
+ = "javax.jdo.option.Name";
static String PROPERTY_PERSISTENCE_UNIT_NAME
= "javax.jdo.option.PersistenceUnitName";
static String PROPERTY_INSTANCE_LIFECYCLE_LISTENER
@@ -450,6 +454,7 @@
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory();
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map props);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map props, ClassLoader cl);
+ public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(java.util.Map props, ClassLoader resourceLoader, ClassLoader pmfLoader);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(String propsResource);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(String propsResource, ClassLoader loader);
public static javax.jdo.PersistenceManagerFactory getPersistenceManagerFactory(String propsResource, ClassLoader propsLoader, ClassLoader pmfLoader);
@@ -720,6 +725,8 @@
public boolean getIgnoreCache();
public boolean getDetachAllOnCommit();
public void setDetachAllOnCommit(boolean flag);
+ public java.lang.String getName();
+ public void setName(java.lang.String);
public java.lang.String getPersistenceUnitName();
public void setPersistenceUnitName(java.lang.String);
public java.lang.String getServerTimeZoneID();