When I use the *<![CDATA[jdbc:hsqldb:file:src/test/resources/sql/testdb]]>*I
get this error:
*[INFO] Error executing database operation: CLEAN_INSERT
Embedded error: The database is already in use by another process:
[EMAIL PROTECTED]
=C:\opt\temp\appfuse\myproject\co
re\src\test\resources\sql\testdb.lck, exists=true, locked=false,
valid=false, fl =null]: java.lang.Exception: java.io.IOException: The
process c
annot access the file because another process has locked a portion of the
file : C:\opt\temp\appfuse\myproject\core\src\test\resources\sql\testdb
.lck
*
Then I used *
<![CDATA[jdbc:hsqldb:file:src/test/resources/sql/testdb;shutdown=true]]>*and
got this error:
*<![CDATA[org.dbunit.dataset.NoSuchTableException: role
at
org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:223)
at
org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:73)
*
Now when I look at the tesdb.log I see this:
*/*C1*/SET SCHEMA PUBLIC
CONNECT USER SA
/*C2*/SET SCHEMA PUBLIC
CONNECT USER SA
/*C1*/drop table if exists user_role
create table user_role (user_id bigint not null, role_id bigint not null,
primary key (user_id, role_id))
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
DELETE FROM USER_ROLE WHERE USER_ID=-2 AND ROLE_ID=-1
DELETE FROM USER_ROLE WHERE USER_ID=-1 AND ROLE_ID=-2
DELETE FROM APP_USER WHERE ID=-1
DELETE FROM ROLE WHERE ID=-3
DELETE FROM ROLE WHERE ID=-2
DELETE FROM ROLE WHERE ID=-1
DELETE FROM ROLE WHERE ID=4
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
DELETE FROM USER_ROLE WHERE USER_ID=-2 AND ROLE_ID=-1
DELETE FROM USER_ROLE WHERE USER_ID=-1 AND ROLE_ID=-2
DELETE FROM APP_USER WHERE ID=-1
DELETE FROM ROLE WHERE ID=-3
DELETE FROM ROLE WHERE ID=-2
DELETE FROM ROLE WHERE ID=-1
DELETE FROM ROLE WHERE ID=4
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-1
INSERT INTO ROLE VALUES(-1,1,'Administrator role (can edit
Users)','ROLE_ADMIN Gak')
COMMIT
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-1
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-2
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-3
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=4
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM APP_USER WHERE ID=-1
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
SET AUTOCOMMIT TRUE
DELETE FROM USER_ROLE WHERE USER_ID=-2 AND ROLE_ID=-1
DELETE FROM USER_ROLE WHERE USER_ID=-1 AND ROLE_ID=-2
DELETE FROM APP_USER WHERE ID=-1
DELETE FROM ROLE WHERE ID=-3
DELETE FROM ROLE WHERE ID=-2
DELETE FROM ROLE WHERE ID=-1
DELETE FROM ROLE WHERE ID=4
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
DELETE FROM USER_ROLE WHERE USER_ID=-2 AND ROLE_ID=-1
DELETE FROM USER_ROLE WHERE USER_ID=-1 AND ROLE_ID=-2
DELETE FROM APP_USER WHERE ID=-1
DELETE FROM ROLE WHERE ID=-3
DELETE FROM ROLE WHERE ID=-2
DELETE FROM ROLE WHERE ID=-1
DELETE FROM ROLE WHERE ID=4
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=4
COMMIT
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-1
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-2
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-3
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
SET AUTOCOMMIT TRUE
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
SET AUTOCOMMIT FALSE
DELETE FROM APP_USER WHERE ID=-1
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
SET AUTOCOMMIT TRUE
DELETE FROM USER_ROLE WHERE USER_ID=-2 AND ROLE_ID=-1
DELETE FROM USER_ROLE WHERE USER_ID=-1 AND ROLE_ID=-2
DELETE FROM APP_USER WHERE ID=-1
DELETE FROM ROLE WHERE ID=-3
DELETE FROM ROLE WHERE ID=-2
DELETE FROM ROLE WHERE ID=-1
DELETE FROM ROLE WHERE ID=4
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
DELETE FROM USER_ROLE WHERE USER_ID=-2 AND ROLE_ID=-1
DELETE FROM USER_ROLE WHERE USER_ID=-1 AND ROLE_ID=-2
DELETE FROM APP_USER WHERE ID=-1
DELETE FROM ROLE WHERE ID=-3
DELETE FROM ROLE WHERE ID=-2
DELETE FROM ROLE WHERE ID=-1
DELETE FROM ROLE WHERE ID=4
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
INSERT INTO USER_ROLE VALUES(-1,-2)
INSERT INTO USER_ROLE VALUES(-2,-1)
SET AUTOCOMMIT FALSE
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-1
INSERT INTO ROLE VALUES(-1,0,'Administrator role (can edit
Users)','ROLE_ADMIN')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-2
INSERT INTO ROLE VALUES(-2,0,'Default role for all Users','ROLE_USER')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=-3
INSERT INTO ROLE VALUES(-3,0,'Test role for Test Users','ROLE_TEST')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM ROLE WHERE ID=4
INSERT INTO ROLE VALUES(4,0,'Another Test Role','ANOTHER_ROLE')
SET AUTOCOMMIT TRUE
SET AUTOCOMMIT FALSE
DELETE FROM APP_USER WHERE ID=-1
INSERT INTO APP_USER
VALUES(-1,1,NULL,'[EMAIL
PROTECTED]','Mick','Knutson',NULL,'1234','base454','(415)
555-1212','mickknutson','http://baselogic.com',-1)
SET AUTOCOMMIT TRUE
/*C3*/SET SCHEMA PUBLIC
CONNECT USER SA
/*C4*/SET SCHEMA PUBLIC
CONNECT USER SA
drop table if exists app_user
drop table if exists role
drop table if exists user_role
create table user_role (user_id bigint not null, role_id bigint not null,
primary key (user_id, role_id))
SET AUTOCOMMIT FALSE
DELETE FROM ADDRESS WHERE ID=-1
INSERT INTO ADDRESS VALUES(-1,1,'725 Florida Street #5','San
Francisco','US','94110','CA')
SET AUTOCOMMIT TRUE
/*C5*/SET SCHEMA PUBLIC
CONNECT USER SA
drop table if exists address
drop table if exists app_user
drop table if exists role
drop table if exists user_role
create table user_role (user_id bigint not null, role_id bigint not null,
primary key (user_id, role_id))
*
It seems that it is suppose to be working, but the test are failing.
On Mon, Apr 28, 2008 at 4:18 PM, Adam Hardy <[EMAIL PROTECTED]>
wrote:
Sorry. I keep confusing them. HSQL is also known as Hypersonic. Can be
confusing. But have you checked out whether the schema creation really
occurs and then gets lost, or whether it just never happens?
Try the JDBC params such as default_schema=true
or try a file db instead of in-memory e.g.
jdbc:hsqldb:file:src/test/resources/sql/testdb