Bonjour,

je vais des tests pour utiliser Unitils avec l'ORM EBEAN.
Dans mes tests sous UNITILS3.3 j'utilise JUNIT4 et DBUNIT.
Mon soucis vient du fait que le premier test tombe systematiquement en erreur, j'ai un log de HSQLDB que je n'arrive pas a solutionner.
Le meme test une deuxieme fois est correcte.
Je pense a une erreur d'initialisation de la base, mais pourquoi cela fonctionne t il ensuite, et comment le verifier?
Je pense que cela est du a un soucis ou une configuration EBEAN, Mais ou est mon erreur ?
Merci d'avance
Phil

Code de test
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
package com.example;
 
//~--- non-JDK imports --------------------------------------------------------
 
import com.example.IEmployeeDao.DataAccessException;
 
import org.junit.Before;
import org.junit.Test;
 
import org.unitils.UnitilsJUnit4;
import org.unitils.database.sqlassert.SqlAssert;
import org.unitils.dbunit.annotation.DataSet;
import org.unitils.dbunit.annotation.ExpectedDataSet;
import org.unitils.reflectionassert.ReflectionAssert;
import org.unitils.reflectionassert.ReflectionComparatorMode;
 
//import junit.framework.TestCase;
//import static org.unitils.reflectionassert.ReflectionAssert.assertPropertyLenEquals;
//import static org.unitils.reflectionassert.ReflectionAssert.assertPropertyRefEquals;
//import static org.unitils.reflectionassert.ReflectionComparatorMode.IGNORE_DEFAULTS;
import static org.unitils.reflectionassert.ReflectionAssert.*;
 
//~--- JDK imports ------------------------------------------------------------
 
import java.math.BigDecimal;
 
import java.util.Arrays;
import java.util.List;
 
public class EmployeeDao3Test extends UnitilsJUnit4
   {
    private IEmployeeDao employeeDao;
 
    @Before
    public void setUpDao() {
        employeeDao = new EbeanEmployeeDao();
    System.out.println("before"); 
    //Apres le premier Before, il y a un message d'erreur
    }
 
    /* Le PREMIER TEST TOMBE EN erreur*/
      @Test
      @DataSet("EmployeeDaoTest.findsForTitleOnly.xml")
      public void bidonpourvoirsicenestpaslepremier() throws DataAccessException{
 
          Integer count = employeeDao.count2();
 
          junit.framework.Assert.assertNotNull(count);
 
      }
 
 
    /* Le DEUXIME IDENTIQUE EST OK, cela fait penser a un soucis de chargement de données*/
      @Test
      @DataSet("EmployeeDaoTest.findsForTitleOnly.xml")
      public void deuxieme() throws DataAccessException{
 
              Integer count = employeeDao.count2();
 
          junit.framework.Assert.assertNotNull(count);
 
      }
 
 
 
   }
Logs erreur
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
 
 
 
    before
10 oct. 2012 22:27:18 com.avaje.ebeaninternal.server.core.BootupClassPathSearch search
INFO: Classpath search hits in jars[ebean-2.7.7.jar] pkgs[com.avaje.ebeaninternal.server.bean, com.avaje.ebean.meta, com.example]  searchTime[93]
10 oct. 2012 22:27:19 com.avaje.ebeaninternal.server.lib.sql.DataSourcePool initialise
INFO: DataSourcePool [hsqldb] autoCommit[false] transIsolation[READ_COMMITTED] min[1] max[25]
10 oct. 2012 22:27:19 com.avaje.ebeaninternal.server.core.DefaultServerFactory setDatabasePlatform
INFO: DatabasePlatform name:hsqldb platform:hsqldb
10 oct. 2012 22:27:19 com.avaje.ebeaninternal.server.subclass.SubClassManager$1 run
INFO: SubClassFactory parent ClassLoader [org.apache.maven.surefire.booter.IsolatedClassLoader]
10 oct. 2012 22:27:20 com.avaje.ebeaninternal.server.deploy.BeanDescriptorManager logStatus
INFO: Entities enhanced[0] subclassed[1]
runScript
executing 1 of 3 SET DATABASE REFERENTIAL INTEGRITY FALSE
 ... ignoring error executing SET DATABASE REFERENTIAL INTEGRITY FALSE  error: Unexpected token REFERENTIAL, requires COLLATION in statement [SET DATABASE REFER
ENTIAL]
java.sql.SQLException: Unexpected token REFERENTIAL, requires COLLATION in statement [SET DATABASE REFERENTIAL]
        at org.hsqldb.jdbc.Util.throwError(Unknown Source)
        at org.hsqldb.jdbc.jdbcPreparedStatement.execute(Unknown Source)
        at com.avaje.ebeaninternal.server.lib.sql.ExtendedPreparedStatement.execute(ExtendedPreparedStatement.java:136)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runStatement(DdlGenerator.java:272)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runStatements(DdlGenerator.java:246)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runScript(DdlGenerator.java:224)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runDdl(DdlGenerator.java:93)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.execute(DdlGenerator.java:66)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.executeDDL(DefaultServerFactory.java:347)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:229)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:123)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:63)
        at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:64)
        at com.avaje.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:225)
        at com.avaje.ebean.Ebean$ServerManager.<init>(Ebean.java:181)
        at com.avaje.ebean.Ebean$ServerManager.<init>(Ebean.java:147)
        at com.avaje.ebean.Ebean.<clinit>(Ebean.java:141)
        at com.example.EbeanEmployeeDao.count2(EbeanEmployeeDao.java:139)
        at com.example.EmployeeDao3Test.bidonpourvoirsicenestpaslepremier(EmployeeDao3Test.java:48)
        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 org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runTestMethod(UnitilsJUnit4TestClassRunner.java:174)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runBeforesThenTestThenAfters(UnitilsJUnit4TestClassRunner.java:156)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.unitils.UnitilsJUnit4TestClassRunner.invokeTestMethod(UnitilsJUnit4TestClassRunner.java:95)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.unitils.UnitilsJUnit4TestClassRunner.access$000(UnitilsJUnit4TestClassRunner.java:44)
        at org.unitils.UnitilsJUnit4TestClassRunner$1.run(UnitilsJUnit4TestClassRunner.java:62)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.unitils.UnitilsJUnit4TestClassRunner.run(UnitilsJUnit4TestClassRunner.java:68)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
        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 org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
executing 2 of 3 drop table if exists EMPLOYEES
executing 3 of 3 SET DATABASE REFERENTIAL INTEGRITY TRUE
 ... ignoring error executing SET DATABASE REFERENTIAL INTEGRITY TRUE  error: Unexpected token REFERENTIAL, requires COLLATION in statement [SET DATABASE REFERE
NTIAL]
java.sql.SQLException: Unexpected token REFERENTIAL, requires COLLATION in statement [SET DATABASE REFERENTIAL]
        at org.hsqldb.jdbc.Util.throwError(Unknown Source)
        at org.hsqldb.jdbc.jdbcPreparedStatement.execute(Unknown Source)
        at com.avaje.ebeaninternal.server.lib.sql.ExtendedPreparedStatement.execute(ExtendedPreparedStatement.java:136)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runStatement(DdlGenerator.java:272)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runStatements(DdlGenerator.java:246)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runScript(DdlGenerator.java:224)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.runDdl(DdlGenerator.java:93)
        at com.avaje.ebeaninternal.server.ddl.DdlGenerator.execute(DdlGenerator.java:66)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.executeDDL(DefaultServerFactory.java:347)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:229)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:123)
        at com.avaje.ebeaninternal.server.core.DefaultServerFactory.createServer(DefaultServerFactory.java:63)
        at com.avaje.ebean.EbeanServerFactory.create(EbeanServerFactory.java:64)
        at com.avaje.ebean.Ebean$ServerManager.getWithCreate(Ebean.java:225)
        at com.avaje.ebean.Ebean$ServerManager.<init>(Ebean.java:181)
        at com.avaje.ebean.Ebean$ServerManager.<init>(Ebean.java:147)
        at com.avaje.ebean.Ebean.<clinit>(Ebean.java:141)
        at com.example.EbeanEmployeeDao.count2(EbeanEmployeeDao.java:139)
        at com.example.EmployeeDao3Test.bidonpourvoirsicenestpaslepremier(EmployeeDao3Test.java:48)
        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 org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
        at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
        at org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runTestMethod(UnitilsJUnit4TestClassRunner.java:174)
        at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
        at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
        at org.unitils.UnitilsJUnit4TestClassRunner$TestListenerInvokingMethodRoadie.runBeforesThenTestThenAfters(UnitilsJUnit4TestClassRunner.java:156)
        at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
        at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
        at org.unitils.UnitilsJUnit4TestClassRunner.invokeTestMethod(UnitilsJUnit4TestClassRunner.java:95)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.unitils.UnitilsJUnit4TestClassRunner.access$000(UnitilsJUnit4TestClassRunner.java:44)
        at org.unitils.UnitilsJUnit4TestClassRunner$1.run(UnitilsJUnit4TestClassRunner.java:62)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.unitils.UnitilsJUnit4TestClassRunner.run(UnitilsJUnit4TestClassRunner.java:68)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)
        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 org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)
... end of script
runScript
executing 1 of 1 create table EMPLOYEES ( id                        integer GENERATED BY DEFAULT...
... end of script
10 oct. 2012 22:27:21 com.avaje.ebeaninternal.server.transaction.log.FileTransactionLoggerWrapper initialiseLogger
INFO: Transaction logs in: logs
count2 size=0
before
count2 size=5