[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] How to run EclipseLink unittests inside Eclipse?
|
Thank you, Tom!
The FullRegressionTestSuite is now working.
But when trying to execute some other tests (e.g.
AdvancedJPAJunitTest), I am getting the following exception:
java.lang.RuntimeException: An exception occurred trying clear the cache.
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.clearCache(JUnitTestCase.java:245)
at
org.eclipse.persistence.testing.tests.jpa.advanced.AdvancedJPAJunitTest.setUp(AdvancedJPAJunitTest.java:139)
at junit.framework.TestCase.runBare(TestCase.java:132)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:503)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: Exception [EclipseLink-30005] (Eclipse Persistence Services
- 2.3.0.qualifier):
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for
persistence archives with ClassLoader:
sun.misc.Launcher$AppClassLoader@11b86e7
Internal Exception: javax.persistence.PersistenceException: Exception
[EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.qualifier):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [default] failed.
Internal Exception: Exception [EclipseLink-7151] (Eclipse Persistence
Services - 2.3.0.qualifier):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.lang.String] for the
attribute [name] on the entity class [class
org.eclipse.persistence.testing.models.jpa.xml.merge.relationships.Customer]
is not a valid type for an enumerated mapping. The attribute must be
defined as a Java enum.
at
org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:126)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:105)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:430)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:406)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getServerSession(JUnitTestCase.java:397)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.clearCache(JUnitTestCase.java:243)
... 16 more
Caused by: javax.persistence.PersistenceException: Exception
[EclipseLink-28018] (Eclipse Persistence Services - 2.3.0.qualifier):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [default] failed.
Internal Exception: Exception [EclipseLink-7151] (Eclipse Persistence
Services - 2.3.0.qualifier):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.lang.String] for the
attribute [name] on the entity class [class
org.eclipse.persistence.testing.models.jpa.xml.merge.relationships.Customer]
is not a valid type for an enumerated mapping. The attribute must be
defined as a Java enum.
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1166)
at
org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:101)
at
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:96)
... 21 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services
- 2.3.0.qualifier):
org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [default] failed.
Internal Exception: Exception [EclipseLink-7151] (Eclipse Persistence
Services - 2.3.0.qualifier):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.lang.String] for the
attribute [name] on the entity class [class
org.eclipse.persistence.testing.models.jpa.xml.merge.relationships.Customer]
is not a valid type for an enumerated mapping. The attribute must be
defined as a Java enum.
at
org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:219)
... 24 more
Caused by: Exception [EclipseLink-7151] (Eclipse Persistence Services
- 2.3.0.qualifier):
org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class java.lang.String] for the
attribute [name] on the entity class [class
org.eclipse.persistence.testing.models.jpa.xml.merge.relationships.Customer]
is not a valid type for an enumerated mapping. The attribute must be
defined as a Java enum.
at
org.eclipse.persistence.exceptions.ValidationException.invalidTypeForEnumeratedAttribute(ValidationException.java:1076)
at
org.eclipse.persistence.internal.jpa.metadata.converters.EnumeratedMetadata.process(EnumeratedMetadata.java:111)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processEnumerated(MappingAccessor.java:1439)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor.processEnumerated(BasicAccessor.java:413)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processJPAConverters(MappingAccessor.java:1467)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingConverter(MappingAccessor.java:1535)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.MappingAccessor.processMappingValueConverter(MappingAccessor.java:1553)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.BasicAccessor.process(BasicAccessor.java:372)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.processMappingAccessors(MetadataDescriptor.java:1417)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappingAccessors(ClassAccessor.java:1438)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1066)
at
org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:604)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1541)
at
org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:485)
at
org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:454)
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1120)
... 23 more
Zitat von Tom Ware <tom.ware@xxxxxxxxxx>:
Hi Patric,
Hopefully I can help. I am going to assume you want to start with
the JPA tests. If that is not the case, let me know.
http://wiki.eclipse.org/EclipseLink/Development/Testing/JPA#Eclipse_JUnit
A couple of comments
1. The easiest way to ensure all the necessary components are built
is to run the ant build from the base directory. (You need an
eclipselink.jar and to have run the build in the
eclipselink.jpa.test directory and the full build will do both of
these)
2. The build of eclipselink.jpa.test creates persistence unit jars
for the test. You will need to run that build each time you add or
remove classes from the model. Take a look at the
jpa\eclipselink.jpa.test directory after you have built and you will
see all the persistence units.
2. If you prefer not to edit the
eclipselink.jpa.test/test.properties, you can provide the database
information in your user home directory and call it test.properties.
Any information in that file will override anything defined in
eclipselink.jpa.test/test.properties.
3. The eclipselink.jpa.test project contains a good launch target to
start with called FullRegressionTestSuite.launch.
Let me know what problems you are having,
Tom
Patric Rufflar wrote:
Hello,
I'd like to know how to setup eclipselink in Eclipse that I can ran
the provided test suites or add some new.
I read:
http://wiki.eclipse.org/EclipseLink/Building#Minimum_SVN_Trunk_projects_for_JPA_or_Core_Eclipse_Development_and_Testing
and
http://wiki.eclipse.org/EclipseLink/Development/Testing/Prereq
I setup an eclipse project using the eclipselink sources which
compiled successfully.
But when I try to ran some tests or testsuites I am getting:
javax.persistence.PersistenceException: No Persistence provider for
EntityManager named default
at
javax.persistence.Persistence.createEntityManagerFactory(Unknown
Source)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:402) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:385) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getEntityManagerFactory(JUnitTestCase.java:412) at org.eclipse.persistence.testing.framework.junit.JUnitTestCase.getServerSession(JUnitTestCase.java:373) at org.eclipse.persistence.testing.tests.jpa.orphanremoval.OrphanRemovalJUnitTestCase.testSetup(OrphanRemovalJUnitTestCase.java:1058) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at
java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:466) at
junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196) (or similar stack
traces).
Which persistence.xml must be used? Is there some process which
creates or moves the correct persistence.xml?
Do I have to create some tables (or run a script) in order to run the tests?
Thank you for your help and best regards,
Patric
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users