@Testpublic void testUpdate() {running(fakeApplication(inMemoryDatabase()), new Runnable() {@Overridepublic void run() {Project project = new Project(...);project.save();...}});}
[error] Test models.ProjectTest.testCreateAndRetrieve failed: Error getting sequence nextval[error] at com.avaje.ebean.config.dbplatform.SequenceIdGenerator.getMoreIds(SequenceIdGenerator.java:213)...[error] ...[error] Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "SELECT PROJECT_SEQ.NEXTVAL UNION[*] SELECT PROJECT_SEQ.NEXTVAL UNION SELECT PROJECT_SEQ.NEXTVAL ...
play -Dconfig.file=conf/application.test.conf test
ebean.dbtest="models.*"
db.dbtest.driver=org.h2.Driver
db.dbtest.url="jdbc:h2:mem:play"
...@Testpublic void test() {running(fakeApplication(inMemoryDatabase("dbtest")), new Runnable() {@Overridepublic void run() {
Test models.MyTest.test failed: The default EbeanServer has not been defined? This is normally set via the ebean.datasource.default property. Otherwise it should be registered programatically via registerServer()
ebean.datasource.default=dbtest
ConfigException$BadPath: path parameter: Invalid path ' - could not find datasource for datasource.default': Token not allowed in path expression: '-' (you can double-quote this token if you really want it here)
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/2Pf7mqFA5JsJ.
To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.
Hi,I use for my part H2 for the tests and MySQL for the main app but I don't use evolutions. I don't think it will be an issue.So for unit testing I started from this : http://blog.matthieuguillermin.fr/2012/03/unit-testing-tricks-for-play-2-0-and-ebean/and I updated the BaseModelTest to this : (like you I had a problem with the compatibility)public class BaseModelTest {
public static FakeApplication app;public static DdlGenerator ddl;public static EbeanServer server;@BeforeClasspublic static void setup() {app = Helpers.fakeApplication(Helpers.inMemoryDatabase());Helpers.start(app);server = Ebean.getServer("default");ServerConfig config = new ServerConfig();config.setDebugSql(true);ddl = new DdlGenerator((SpiEbeanServer) server, new H2Platform(), config);}@AfterClasspublic static void stopApp() {Helpers.stop(app);}@Beforepublic void resetDb() throws IOException {// dropString dropScript = ddl.generateDropDdl();Ebean.execute(Ebean.createCallableSql(dropScript));// createString createScript = ddl.generateCreateDdl();Ebean.execute(Ebean.createCallableSql(createScript));// insert data// ...}}With this I had a great gain of time when running unit test and I was able to pass all my test to H2.Hope this will help.
--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/4W4FdgZ_v-0J.