| org.apache.openjpa.persistence.test.PersistenceTestCase org.apache.openjpa.persistence.common.utils.AbstractTestCase
All known Subclasses: org.apache.openjpa.persistence.jdbc.mapping.TestNativeQueries, org.apache.openjpa.persistence.jdbc.query.JDBCTestCase, org.apache.openjpa.persistence.meta.TestPersistentClasses, org.apache.openjpa.persistence.kernel.TestEJBTransactionalClass, org.apache.openjpa.persistence.jpql.joins.TestEJBJoins, org.apache.openjpa.persistence.datacache.TestJPQL2ResultsAndResultClasses, org.apache.openjpa.persistence.jdbc.mapping.TestCompositeIdTraversalInSQLMapping, org.apache.openjpa.persistence.datacache.TestResultShapes, org.apache.openjpa.persistence.kernel.TestEJBManagedInverses, org.apache.openjpa.persistence.kernel.TestEJBObjectCollections, org.apache.openjpa.persistence.kernel.TestEJBNullValues, org.apache.openjpa.persistence.datacache.TestJPQL2Queries, org.apache.openjpa.persistence.query.BaseQueryTest, org.apache.openjpa.persistence.meta.TestSequenceAssigned, org.apache.openjpa.persistence.jdbc.kernel.BaseJDBCTest, org.apache.openjpa.persistence.meta.TestFieldDeclarationOrder, org.apache.openjpa.persistence.datacache.TestQueryResultTypes, org.apache.openjpa.persistence.datacache.CacheTest, org.apache.openjpa.persistence.event.TestLifecycleEventManager, org.apache.openjpa.persistence.jpql.clauses.TestEJBQueryInterface, org.apache.openjpa.persistence.datacache.TestDistributedKodoDataCache, org.apache.openjpa.persistence.jpql.functions.TestEJBQLFunction, org.apache.openjpa.persistence.kernel.TestEJBNoPersistentFields, org.apache.openjpa.persistence.enhance.TestNoNoArgs, org.apache.openjpa.persistence.enhance.TestClone, org.apache.openjpa.persistence.kernel.TestEJBGetObjectByIdValue, org.apache.openjpa.persistence.kernel.TestEJBRetainValues, org.apache.openjpa.persistence.datacache.TestUniteratedQueryResult, org.apache.openjpa.persistence.kernel.TestEJBEntityManager, org.apache.openjpa.persistence.cache.TestQueryCache, org.apache.openjpa.persistence.datacache.TestFlushDataCache, org.apache.openjpa.persistence.meta.TestNonPersistentFields, org.apache.openjpa.persistence.event.RemoteEventBase, org.apache.openjpa.persistence.event.TestTCPRemoteClassChanges, org.apache.openjpa.persistence.jpql.clauses.TestEJBDeleteUpdateImpl, org.apache.openjpa.persistence.event.TestFakeRemoteEvents, org.apache.openjpa.persistence.meta.TestClassMetaData, org.apache.openjpa.persistence.event.TestOrphanedKeyAction, org.apache.openjpa.persistence.jpql.clauses.TestEJBPolymorphicQuery, org.apache.openjpa.persistence.datacache.TestDataCacheScheduler, org.apache.openjpa.persistence.event.TestTCPRemoteRecoveryTransmitAdds, org.apache.openjpa.persistence.datacache.TestPCParametersInQueries, org.apache.openjpa.persistence.jpql.clauses.TestBulkUpdate, org.apache.openjpa.persistence.jpql.expressions.TestEJBQLCondExpression, org.apache.openjpa.persistence.kernel.TestPojoWithoutAnnotationsCannotBePersisted, org.apache.openjpa.persistence.event.TestTCPRemoteEventsDuration, org.apache.openjpa.persistence.kernel.TestEJBLocales, org.apache.openjpa.persistence.event.TestEvents, org.apache.openjpa.persistence.enhance.TestDynamicStorageGenerator, org.apache.openjpa.persistence.event.TestTCPRemoteRecovery, org.apache.openjpa.persistence.meta.TestExternalValues, org.apache.openjpa.persistence.kernel.TestEJBLobs, org.apache.openjpa.persistence.kernel.TestEJBTransactions, org.apache.openjpa.persistence.kernel.TestEJBInterfaces, org.apache.openjpa.persistence.kernel.BaseKernelTest, org.apache.openjpa.persistence.kernel.Test2EJBConcurrency, org.apache.openjpa.persistence.jdbc.kernel.TestOperationOrderUpdateManager, org.apache.openjpa.persistence.jdbc.meta.horizontal.TestLockGroupsWithHorizontalBaseType, org.apache.openjpa.persistence.annotations.AnnotationTestCase, org.apache.openjpa.persistence.datacache.TestMutableParameters, org.apache.openjpa.persistence.kernel.TestEJBIncrementalFlushes, org.apache.openjpa.persistence.datacache.TestJPQLRelationProjections, org.apache.openjpa.persistence.meta.TestOrderBy, org.apache.openjpa.persistence.entityoperation.TestCascades, org.apache.openjpa.persistence.meta.TestValueStrategies, org.apache.openjpa.persistence.kernel.TestEJBState, org.apache.openjpa.persistence.conf.TestKodoConfiguration, org.apache.openjpa.persistence.datacache.CacheLoadTest, org.apache.openjpa.persistence.jpql.clauses.TestEJBClauses, org.apache.openjpa.persistence.enhance.TestSubclassedBehavior,
Inner Class :protected enum Platform | |
Inner Class :public static interface VolatileRunnable | |
Inner Class :public static class OperationTimedOutException extends RuntimeException | |
Method Summary | |
protected void | addProperties(Map map) | public static void | assertIdentical(List c1, List c2) Assert that the given List contain the exact same
elements. | public static void | assertMatches(String regex, String input) | public static void | assertMatches(String regex, Collection input) Assert that the specified collection of Strings contains at least
one string that matches the specified regular expression. | public static void | assertNotMatches(String regex, String input) | public static void | assertNotMatches(String regex, Collection input) Assert that the specified collection of Strings does not match
the specified regular expression. | public void | assertOrdered(Collection c, Comparator comp) Assert that the collection parameter is already ordered
according to the specified comparator. | protected void | assertSize(int size, Collection c) | protected void | assertSize(int size, Query q) | protected void | bug(int id, String s) | protected void | bug(Platform platform, int id, Throwable t, String s) | protected void | bug(EnumSet<Platform> platforms, int id, Throwable t, String s) | protected void | bug(int id, Throwable t, String s) | public String | callingMethod(String exclude) Return the last method name that called this one by
parsing the current stack trace. | protected String | computePersistenceXmlResource(String s) | protected OpenJPAEntityManager | currentEntityManager() | protected String | defaultPersistenceXmlResource() | protected int | deleteAll(Class type, EntityManager em) | protected int | deleteAll(Class... types) | protected void | endEm(EntityManager em) | protected void | endTx(EntityManager em) | protected BrokerFactory | getBrokerFactory() | protected BrokerFactory | getBrokerFactory(String[] args) | protected OpenJPAConfiguration | getConfiguration() | protected Platform | getCurrentPlatform() | protected OpenJPAEntityManagerFactory | getEmf(Map map) | protected OpenJPAEntityManagerFactory | getEmf() | protected Log | getLog() | protected Object | getStackTrace(Throwable t) | protected OpenJPAStateManager | getStateManager(Object obj, EntityManager em) | protected boolean | isActiveTx(EntityManager em) | public boolean | isRootThread() Check to see if we are in the top-level execution stack. | public static boolean | matches(String regex, String input) | public static List | matches(String regex, Collection input) Check the list if strings and return the ones that match
the specified match. | public void | mttest() Re-execute the invoking method a random number of times
in a random number of Threads. | public void | mttest(int threads, int iterations) Execute the calling method iterations
times in threads Threads. | public void | mttest(int serialCount, int threads, int iterations) | public void | mttest(int threads, int iterations, String method, Object[] args) Execute a test method in multiple threads.
Parameters: threads - the number of Threads to run in Parameters: iterations - the number of times the method shouldbe execute in a single Thread Parameters: method - the name of the method to execute Parameters: args - the arguments to pass to the method throws: ThreadingException - if an errors occur inany of the Threads. | public void | mttest(int serialCount, int threads, int iterations, String method, Object[] args) | public void | mttest(String title, int threads, int iterations, VolatileRunnable runner) | public void | mttest(String title, int serialCount, int threads, int iterations, VolatileRunnable runner) Execute a test method in multiple threads.
Parameters: title - a description of the test, for inclusion in theerror message Parameters: serialCount - the number of times to run the methodserially before spawning threads. Parameters: threads - the number of Threads to run in Parameters: iterations - the number of times the method should Parameters: runner - the VolatileRunnable that will executethe actual test from within the Thread. throws: ThreadingException - if an errors occur inany of the Threads. | public static BigDecimal | randomBigDecimal() Support method to get a random BigDecimal for testing. | public static BigInteger | randomBigInteger() Support method to get a random BigInteger for testing. | public static byte[] | randomBlob() Support method to get a random blob for testing. | public static Boolean | randomBoolean() Support method to get a random Boolean for testing. | public static Byte | randomByte() Support method to get a random Byte for testing. | public static Character | randomChar() Support method to get a random Character for testing. | public static String | randomClob() Support method to get a random clob for testing. | public static Date | randomDate() Support method to get a random Date for testing. | public static Double | randomDouble() Support method to get a random Double for testing. | public static Float | randomFloat() Support method to get a random Float for testing. | public static Integer | randomInt() Support method to get a random Integer for testing. | public static Long | randomLong() Support method to get a random Long for testing. | public static Short | randomShort() Support method to get a random Short for testing. | public static String | randomString() Support method to get a random String for testing. | public static String | randomString(int len) Support method to get a random String for testing. | public static Object | randomizeBean(Object bean) Invoke setters for pimitives and primitive wrappers on the
specified object. | protected void | rollbackTx(EntityManager em) | public static Object | roundtrip(Object orig, boolean validateEquality) Serialize and deserialize the object. | public void | sleepRandom() Sleep the current Thread for a random amount of time from 0-1000 ms. | public void | sleepRandom(int max) Sleep the current Thread for a random amount of time from
0-max ms. | protected void | startTx(EntityManager em) | public void | tearDown() | public boolean | timeout(long millis) Re-run this method in the current thread, timing out
after the specified number of seconds.
Usage:
public void timeOutOperation() { if (timeout(5 * 1000)) return;
Thread.currentThread().sleep(10 * 1000); }
Warning this method should be used sparingly,
and only when you expect that a timeout will not
occur. | public boolean | timeout(long millis, String methodName) | public static void | validateCollection(Collection collection) Validate that the specified
Collection fulfills the
Collection contract as specified by the Collections API. | public static void | validateList(List list) Validate that the specified
List fulfills the
List contract as specified by the Collections API. |
inTimeoutThread | protected boolean inTimeoutThread(Code) | | |
multiThreadExecuting | protected String multiThreadExecuting(Code) | | |
AbstractTestCase | public AbstractTestCase()(Code) | | |
addProperties | protected void addProperties(Map map)(Code) | | |
assertIdentical | public static void assertIdentical(List c1, List c2)(Code) | | Assert that the given List contain the exact same
elements. This is different than the normal List contract, which
states that list1.equals(list2) if each element e1.equals(e2).
This method asserts that e1 == n2.
|
assertMatches | public static void assertMatches(String regex, Collection input)(Code) | | Assert that the specified collection of Strings contains at least
one string that matches the specified regular expression.
|
assertNotMatches | public static void assertNotMatches(String regex, Collection input)(Code) | | Assert that the specified collection of Strings does not match
the specified regular expression.
|
assertOrdered | public void assertOrdered(Collection c, Comparator comp)(Code) | | Assert that the collection parameter is already ordered
according to the specified comparator.
|
assertSize | protected void assertSize(int size, Query q)(Code) | | |
callingMethod | public String callingMethod(String exclude)(Code) | | Return the last method name that called this one by
parsing the current stack trace.
Parameters: exclude - a method name to skip throws: IllegalStateException - If the calling method could not beidentified. author: Marc Prud'hommeaux |
computePersistenceXmlResource | protected String computePersistenceXmlResource(String s)(Code) | | |
defaultPersistenceXmlResource | protected String defaultPersistenceXmlResource()(Code) | | |
deleteAll | protected int deleteAll(Class type, EntityManager em)(Code) | | |
endEm | protected void endEm(EntityManager em)(Code) | | |
endTx | protected void endTx(EntityManager em)(Code) | | |
getCurrentPlatform | protected Platform getCurrentPlatform()(Code) | | |
isActiveTx | protected boolean isActiveTx(EntityManager em)(Code) | | |
isRootThread | public boolean isRootThread()(Code) | | Check to see if we are in the top-level execution stack.
|
matches | public static boolean matches(String regex, String input) throws RESyntaxException(Code) | | true if the specified input matches the regular expression regex. |
matches | public static List matches(String regex, Collection input) throws RESyntaxException(Code) | | Check the list if strings and return the ones that match
the specified match.
|
mttest | public void mttest() throws ThreadingException(Code) | | Re-execute the invoking method a random number of times
in a random number of Threads.
|
mttest | public void mttest(int threads, int iterations)(Code) | | Execute the calling method iterations
times in threads Threads.
|
mttest | public void mttest(int serialCount, int threads, int iterations) throws ThreadingException(Code) | | |
mttest | public void mttest(int threads, int iterations, String method, Object[] args) throws ThreadingException(Code) | | Execute a test method in multiple threads.
Parameters: threads - the number of Threads to run in Parameters: iterations - the number of times the method shouldbe execute in a single Thread Parameters: method - the name of the method to execute Parameters: args - the arguments to pass to the method throws: ThreadingException - if an errors occur inany of the Threads. The actual exceptionswill be embedded in the exception. Note thatthis means that assert() failures will betreated as errors rather than warnings. author: Marc Prud'hommeaux |
mttest | public void mttest(int serialCount, int threads, int iterations, String method, Object[] args) throws ThreadingException(Code) | | |
mttest | public void mttest(String title, int threads, int iterations, VolatileRunnable runner) throws ThreadingException(Code) | | |
mttest | public void mttest(String title, int serialCount, int threads, int iterations, VolatileRunnable runner) throws ThreadingException(Code) | | Execute a test method in multiple threads.
Parameters: title - a description of the test, for inclusion in theerror message Parameters: serialCount - the number of times to run the methodserially before spawning threads. Parameters: threads - the number of Threads to run in Parameters: iterations - the number of times the method should Parameters: runner - the VolatileRunnable that will executethe actual test from within the Thread. throws: ThreadingException - if an errors occur inany of the Threads. The actual exceptionswill be embedded in the exception. Note thatthis means that assert() failures will betreated as errors rather than warnings. author: Marc Prud'hommeaux be execute in a single Thread author: Marc Prud'hommeaux |
randomBigDecimal | public static BigDecimal randomBigDecimal()(Code) | | Support method to get a random BigDecimal for testing.
|
randomBigInteger | public static BigInteger randomBigInteger()(Code) | | Support method to get a random BigInteger for testing.
|
randomBlob | public static byte[] randomBlob()(Code) | | Support method to get a random blob for testing.
|
randomBoolean | public static Boolean randomBoolean()(Code) | | Support method to get a random Boolean for testing.
|
randomByte | public static Byte randomByte()(Code) | | Support method to get a random Byte for testing.
|
randomChar | public static Character randomChar()(Code) | | Support method to get a random Character for testing.
|
randomClob | public static String randomClob()(Code) | | Support method to get a random clob for testing.
|
randomDate | public static Date randomDate()(Code) | | Support method to get a random Date for testing.
|
randomDouble | public static Double randomDouble()(Code) | | Support method to get a random Double for testing.
|
randomFloat | public static Float randomFloat()(Code) | | Support method to get a random Float for testing.
|
randomInt | public static Integer randomInt()(Code) | | Support method to get a random Integer for testing.
|
randomLong | public static Long randomLong()(Code) | | Support method to get a random Long for testing.
|
randomShort | public static Short randomShort()(Code) | | Support method to get a random Short for testing.
|
randomString | public static String randomString()(Code) | | Support method to get a random String for testing.
|
randomString | public static String randomString(int len)(Code) | | Support method to get a random String for testing.
|
rollbackTx | protected void rollbackTx(EntityManager em)(Code) | | |
sleepRandom | public void sleepRandom()(Code) | | Sleep the current Thread for a random amount of time from 0-1000 ms.
|
sleepRandom | public void sleepRandom(int max)(Code) | | Sleep the current Thread for a random amount of time from
0-max ms.
|
startTx | protected void startTx(EntityManager em)(Code) | | |
timeout | public boolean timeout(long millis) throws Throwable(Code) | | Re-run this method in the current thread, timing out
after the specified number of seconds.
Usage:
public void timeOutOperation() { if (timeout(5 * 1000)) return;
Thread.currentThread().sleep(10 * 1000); }
Warning this method should be used sparingly,
and only when you expect that a timeout will not
occur. It utilized the deprecated
Thread.stop and
Thread.interrupt methods, which can leave monitors in an
invalid state. It is only used because it provides more
meaningful information than just seeing that the entire autobuild
timed out.
Parameters: millis - the number of milliseconds we should wait. true if we are are in the thread that requested thetimeout, false if we are in the timeout thread itself. |
validateCollection | public static void validateCollection(Collection collection)(Code) | | Validate that the specified
Collection fulfills the
Collection contract as specified by the Collections API.
Note: does not validate mutable operations
|
validateList | public static void validateList(List list)(Code) | | Validate that the specified
List fulfills the
List contract as specified by the Collections API.
Note: does not validate mutable operations
|
|
|