When running a unit test in AppEngine, I receive the following error:
The class "biz.bookdesign.librivoxserver.UserStars" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
org.datanucleus.exceptions.ClassNotPersistableException: The class "biz.bookdesign.librivoxserver.UserStars" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found.
at org.datanucleus.ObjectManagerImpl.assertClassPersistable(ObjectManagerImpl.java:5464)
at org.datanucleus.ObjectManagerImpl.newObjectId(ObjectManagerImpl.java:3425)
at org.datanucleus.api.jdo.JDOPersistenceManager.newObjectIdInstance(JDOPersistenceManager.java:1618)
at org.datanucleus.api.jdo.JDOPersistenceManager.getObjectById(JDOPersistenceManager.java:1740)
...
I have copied my jdoconfig.xml
file into my test class path using the following commands in my module gradle file:
testClasses {
doLast{
JDOCopy.execute()
}
}
task JDOCopy (type: Copy)
JDOCopy {
from 'src/main/webapp/WEB-INF/classes'
into 'build/classes/test'
include('**/*.xml')
}
What else is missing?
It turns out that I was not running the appengineEnhance
task in my test configuration. By adding it to my test configuration in IntelliJ, the task was run, the classes were enhanced, and the test ran correctly. I added it under Run/Debug configurations from the main menu bar.