Make JdbcDaoTests use in-memory database.
This commit is contained in:
parent
8c74d459c5
commit
2426bb9e8e
|
@ -0,0 +1,102 @@
|
||||||
|
/* Copyright 2004 Acegi Technology Pty Limited
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package net.sf.acegisecurity;
|
||||||
|
|
||||||
|
import org.springframework.jdbc.core.JdbcTemplate;
|
||||||
|
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Singleton which provides a populated database connection for all
|
||||||
|
* JDBC-related unit tests.
|
||||||
|
*
|
||||||
|
* @author Ben Alex
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PopulatedDatabase {
|
||||||
|
//~ Static fields/initializers =============================================
|
||||||
|
|
||||||
|
private static DriverManagerDataSource dataSource = null;
|
||||||
|
|
||||||
|
//~ Constructors ===========================================================
|
||||||
|
|
||||||
|
private PopulatedDatabase() {}
|
||||||
|
|
||||||
|
//~ Methods ================================================================
|
||||||
|
|
||||||
|
public static DataSource getDataSource() {
|
||||||
|
if (dataSource == null) {
|
||||||
|
setupDataSource();
|
||||||
|
}
|
||||||
|
|
||||||
|
return dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void setupDataSource() {
|
||||||
|
dataSource = new DriverManagerDataSource();
|
||||||
|
dataSource.setDriverClassName("org.hsqldb.jdbcDriver");
|
||||||
|
dataSource.setUrl("jdbc:hsqldb:mem:acegisecuritytest");
|
||||||
|
dataSource.setUsername("sa");
|
||||||
|
dataSource.setPassword("");
|
||||||
|
|
||||||
|
JdbcTemplate template = new JdbcTemplate(dataSource);
|
||||||
|
|
||||||
|
template.execute(
|
||||||
|
"CREATE TABLE USERS(USERNAME VARCHAR_IGNORECASE(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR_IGNORECASE(50) NOT NULL,ENABLED BOOLEAN NOT NULL)");
|
||||||
|
template.execute(
|
||||||
|
"CREATE TABLE AUTHORITIES(USERNAME VARCHAR_IGNORECASE(50) NOT NULL,AUTHORITY VARCHAR_IGNORECASE(50) NOT NULL,CONSTRAINT FK_AUTHORITIES_USERS FOREIGN KEY(USERNAME) REFERENCES USERS(USERNAME))");
|
||||||
|
template.execute(
|
||||||
|
"CREATE UNIQUE INDEX IX_AUTH_USERNAME ON AUTHORITIES(USERNAME,AUTHORITY)");
|
||||||
|
template.execute(
|
||||||
|
"CREATE TABLE ACLS(OBJECT_IDENTITY VARCHAR_IGNORECASE(250) NOT NULL,RECIPIENT VARCHAR_IGNORECASE(100) NOT NULL,PARENT_OBJECT_IDENTITY VARCHAR_IGNORECASE(250),MASK INTEGER NOT NULL,ACL_CLASS VARCHAR_IGNORECASE(250) NOT NULL,CONSTRAINT PK_ACLS PRIMARY KEY(OBJECT_IDENTITY,RECIPIENT))");
|
||||||
|
template.execute("SET IGNORECASE TRUE");
|
||||||
|
template.execute("INSERT INTO USERS VALUES('dianne','emu',TRUE)");
|
||||||
|
template.execute("INSERT INTO USERS VALUES('marissa','koala',TRUE)");
|
||||||
|
template.execute("INSERT INTO USERS VALUES('peter','opal',FALSE)");
|
||||||
|
template.execute("INSERT INTO USERS VALUES('scott','wombat',TRUE)");
|
||||||
|
template.execute("INSERT INTO USERS VALUES('cooper','kookaburra',TRUE)");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO AUTHORITIES VALUES('marissa','ROLE_TELLER')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO AUTHORITIES VALUES('marissa','ROLE_SUPERVISOR')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO AUTHORITIES VALUES('dianne','ROLE_TELLER')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO AUTHORITIES VALUES('scott','ROLE_TELLER')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO AUTHORITIES VALUES('peter','ROLE_TELLER')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:1','ROLE_SUPERVISOR',NULL,1,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:2','marissa','net.sf.acegisecurity.acl.DomainObject:1',2,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:2','ROLE_SUPERVISOR','net.sf.acegisecurity.acl.DomainObject:1',0,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:3','scott','net.sf.acegisecurity.acl.DomainObject:1',14,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:4','inheritance_marker_only','net.sf.acegisecurity.acl.DomainObject:1',0,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:5','inheritance_marker_only','net.sf.acegisecurity.acl.DomainObject:3',0,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:6','scott','net.sf.acegisecurity.acl.DomainObject:3',1,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:7','scott','some.invalid.parent:1',2,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')");
|
||||||
|
template.execute(
|
||||||
|
"INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:8','scott','net.sf.acegisecurity.acl.DomainObject:3',1,'some.invalid.basic.acl.entry.class.name')");
|
||||||
|
}
|
||||||
|
}
|
|
@ -17,21 +17,15 @@ package net.sf.acegisecurity.providers.dao.jdbc;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import net.sf.acegisecurity.PopulatedDatabase;
|
||||||
import net.sf.acegisecurity.UserDetails;
|
import net.sf.acegisecurity.UserDetails;
|
||||||
import net.sf.acegisecurity.providers.dao.UsernameNotFoundException;
|
import net.sf.acegisecurity.providers.dao.UsernameNotFoundException;
|
||||||
|
|
||||||
import org.springframework.core.io.ClassPathResource;
|
|
||||||
|
|
||||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
|
||||||
import org.springframework.jdbc.object.MappingSqlQuery;
|
import org.springframework.jdbc.object.MappingSqlQuery;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link JdbcDaoImpl}.
|
* Tests {@link JdbcDaoImpl}.
|
||||||
|
@ -66,8 +60,8 @@ public class JdbcDaoTests extends TestCase {
|
||||||
assertEquals("marissa", user.getUsername());
|
assertEquals("marissa", user.getUsername());
|
||||||
assertEquals("koala", user.getPassword());
|
assertEquals("koala", user.getPassword());
|
||||||
assertTrue(user.isEnabled());
|
assertTrue(user.isEnabled());
|
||||||
assertEquals("ROLE_TELLER", user.getAuthorities()[0].getAuthority());
|
assertEquals("ROLE_TELLER", user.getAuthorities()[1].getAuthority());
|
||||||
assertEquals("ROLE_SUPERVISOR", user.getAuthorities()[1].getAuthority());
|
assertEquals("ROLE_SUPERVISOR", user.getAuthorities()[0].getAuthority());
|
||||||
assertEquals(2, user.getAuthorities().length);
|
assertEquals(2, user.getAuthorities().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +131,9 @@ public class JdbcDaoTests extends TestCase {
|
||||||
UserDetails user = dao.loadUserByUsername("marissa");
|
UserDetails user = dao.loadUserByUsername("marissa");
|
||||||
assertEquals("marissa", user.getUsername());
|
assertEquals("marissa", user.getUsername());
|
||||||
assertEquals("ARBITRARY_PREFIX_ROLE_TELLER",
|
assertEquals("ARBITRARY_PREFIX_ROLE_TELLER",
|
||||||
user.getAuthorities()[0].getAuthority());
|
|
||||||
assertEquals("ARBITRARY_PREFIX_ROLE_SUPERVISOR",
|
|
||||||
user.getAuthorities()[1].getAuthority());
|
user.getAuthorities()[1].getAuthority());
|
||||||
|
assertEquals("ARBITRARY_PREFIX_ROLE_SUPERVISOR",
|
||||||
|
user.getAuthorities()[0].getAuthority());
|
||||||
assertEquals(2, user.getAuthorities().length);
|
assertEquals(2, user.getAuthorities().length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,23 +160,9 @@ public class JdbcDaoTests extends TestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private DataSource makeDataSource() throws Exception {
|
|
||||||
ClassPathResource dbScript = new ClassPathResource(
|
|
||||||
"acegisecuritytest.script");
|
|
||||||
String path = dbScript.getFile().getParentFile().getAbsolutePath();
|
|
||||||
|
|
||||||
DriverManagerDataSource ds = new DriverManagerDataSource();
|
|
||||||
ds.setDriverClassName("org.hsqldb.jdbcDriver");
|
|
||||||
ds.setUrl("jdbc:hsqldb:" + path + File.separator + "acegisecuritytest");
|
|
||||||
ds.setUsername("sa");
|
|
||||||
ds.setPassword("");
|
|
||||||
|
|
||||||
return ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
private JdbcDaoImpl makePopulatedJdbcDao() throws Exception {
|
private JdbcDaoImpl makePopulatedJdbcDao() throws Exception {
|
||||||
JdbcDaoImpl dao = new JdbcDaoImpl();
|
JdbcDaoImpl dao = new JdbcDaoImpl();
|
||||||
dao.setDataSource(makeDataSource());
|
dao.setDataSource(PopulatedDatabase.getDataSource());
|
||||||
dao.afterPropertiesSet();
|
dao.afterPropertiesSet();
|
||||||
|
|
||||||
return dao;
|
return dao;
|
||||||
|
@ -191,7 +171,7 @@ public class JdbcDaoTests extends TestCase {
|
||||||
private JdbcDaoImpl makePopulatedJdbcDaoWithRolePrefix()
|
private JdbcDaoImpl makePopulatedJdbcDaoWithRolePrefix()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
JdbcDaoImpl dao = new JdbcDaoImpl();
|
JdbcDaoImpl dao = new JdbcDaoImpl();
|
||||||
dao.setDataSource(makeDataSource());
|
dao.setDataSource(PopulatedDatabase.getDataSource());
|
||||||
dao.setRolePrefix("ARBITRARY_PREFIX_");
|
dao.setRolePrefix("ARBITRARY_PREFIX_");
|
||||||
dao.afterPropertiesSet();
|
dao.afterPropertiesSet();
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
#HSQL database
|
#HSQL database
|
||||||
#Wed Mar 10 03:15:01 GMT 2004
|
#Wed Jul 28 02:20:39 GMT 2004
|
||||||
sql.strict_fk=true
|
hsqldb.script_format=0
|
||||||
|
runtime.gc_interval=0
|
||||||
|
sql.enforce_strict_size=false
|
||||||
|
hsqldb.cache_size_scale=10
|
||||||
readonly=false
|
readonly=false
|
||||||
sql.strong_fk=true
|
hsqldb.nio_data_file=true
|
||||||
hsqldb.version=1.7.1
|
version=1.7.2
|
||||||
version=1.7.1
|
|
||||||
hsqldb.cache_scale=14
|
hsqldb.cache_scale=14
|
||||||
|
hsqldb.first_identity=0
|
||||||
|
hsqldb.cache_file_scale=1
|
||||||
sql.compare_in_locale=false
|
sql.compare_in_locale=false
|
||||||
sql.month=true
|
|
||||||
hsqldb.log_size=200
|
hsqldb.log_size=200
|
||||||
modified=no
|
modified=no
|
||||||
hsqldb.cache_version=1.7.0
|
hsqldb.cache_version=1.7.0
|
||||||
hsqldb.original_version=1.7.1
|
hsqldb.original_version=1.7.2
|
||||||
hsqldb.compatible_version=1.7.0
|
hsqldb.compatible_version=1.7.2
|
||||||
sql.enforce_size=false
|
sql.enforce_size=false
|
||||||
|
|
|
@ -1,84 +1,23 @@
|
||||||
SET IGNORECASE TRUE
|
CREATE TABLE USERS(USERNAME VARCHAR_IGNORECASE(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR_IGNORECASE(50) NOT NULL,ENABLED BOOLEAN NOT NULL)
|
||||||
CREATE TABLE USERS(USERNAME VARCHAR(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR(50) NOT NULL,ENABLED BIT NOT NULL)
|
CREATE TABLE AUTHORITIES(USERNAME VARCHAR_IGNORECASE(50) NOT NULL,AUTHORITY VARCHAR_IGNORECASE(50) NOT NULL,CONSTRAINT FK_AUTHORITIES_USERS FOREIGN KEY(USERNAME) REFERENCES USERS(USERNAME))
|
||||||
CREATE TABLE AUTHORITIES(USERNAME VARCHAR(50) NOT NULL,AUTHORITY VARCHAR(50) NOT NULL,CONSTRAINT FK_AUTHORITIES_USERS FOREIGN KEY(USERNAME) REFERENCES USERS(USERNAME))
|
|
||||||
CREATE UNIQUE INDEX IX_AUTH_USERNAME ON AUTHORITIES(USERNAME,AUTHORITY)
|
CREATE UNIQUE INDEX IX_AUTH_USERNAME ON AUTHORITIES(USERNAME,AUTHORITY)
|
||||||
GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
|
CREATE TABLE ACLS(OBJECT_IDENTITY VARCHAR_IGNORECASE(250) NOT NULL,RECIPIENT VARCHAR_IGNORECASE(100) NOT NULL,PARENT_OBJECT_IDENTITY VARCHAR_IGNORECASE(250),MASK INTEGER NOT NULL,ACL_CLASS VARCHAR_IGNORECASE(250) NOT NULL,CONSTRAINT PK_ACLS PRIMARY KEY(OBJECT_IDENTITY,RECIPIENT))
|
||||||
GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC
|
SET IGNORECASE TRUE
|
||||||
CREATE USER SA PASSWORD "" ADMIN
|
CREATE USER SA PASSWORD "" ADMIN
|
||||||
CREATE ALIAS DAYNAME FOR "org.hsqldb.Library.dayname"
|
INSERT INTO USERS VALUES('dianne','emu',TRUE)
|
||||||
CREATE ALIAS SPACE FOR "org.hsqldb.Library.space"
|
INSERT INTO USERS VALUES('marissa','koala',TRUE)
|
||||||
CREATE ALIAS SUBSTRING FOR "org.hsqldb.Library.substring"
|
INSERT INTO USERS VALUES('peter','opal',FALSE)
|
||||||
CREATE ALIAS HEXTORAW FOR "org.hsqldb.Library.hexToRaw"
|
INSERT INTO USERS VALUES('scott','wombat',TRUE)
|
||||||
CREATE ALIAS SQRT FOR "java.lang.Math.sqrt"
|
|
||||||
CREATE ALIAS ABS FOR "org.hsqldb.Library.abs"
|
|
||||||
CREATE ALIAS POWER FOR "java.lang.Math.pow"
|
|
||||||
CREATE ALIAS CHAR FOR "org.hsqldb.Library.character"
|
|
||||||
CREATE ALIAS CONCAT FOR "org.hsqldb.Library.concat"
|
|
||||||
CREATE ALIAS PI FOR "org.hsqldb.Library.pi"
|
|
||||||
CREATE ALIAS RAWTOHEX FOR "org.hsqldb.Library.rawToHex"
|
|
||||||
CREATE ALIAS SECOND FOR "org.hsqldb.Library.second"
|
|
||||||
CREATE ALIAS TRUNCATE FOR "org.hsqldb.Library.truncate"
|
|
||||||
CREATE ALIAS MONTH FOR "org.hsqldb.Library.month"
|
|
||||||
CREATE ALIAS LOWER FOR "org.hsqldb.Library.lcase"
|
|
||||||
CREATE ALIAS ATAN2 FOR "java.lang.Math.atan2"
|
|
||||||
CREATE ALIAS REPEAT FOR "org.hsqldb.Library.repeat"
|
|
||||||
CREATE ALIAS DAYOFMONTH FOR "org.hsqldb.Library.dayofmonth"
|
|
||||||
CREATE ALIAS TAN FOR "java.lang.Math.tan"
|
|
||||||
CREATE ALIAS RADIANS FOR "java.lang.Math.toRadians"
|
|
||||||
CREATE ALIAS FLOOR FOR "java.lang.Math.floor"
|
|
||||||
CREATE ALIAS NOW FOR "org.hsqldb.Library.now"
|
|
||||||
CREATE ALIAS ACOS FOR "java.lang.Math.acos"
|
|
||||||
CREATE ALIAS DAYOFWEEK FOR "org.hsqldb.Library.dayofweek"
|
|
||||||
CREATE ALIAS CEILING FOR "java.lang.Math.ceil"
|
|
||||||
CREATE ALIAS DAYOFYEAR FOR "org.hsqldb.Library.dayofyear"
|
|
||||||
CREATE ALIAS LCASE FOR "org.hsqldb.Library.lcase"
|
|
||||||
CREATE ALIAS WEEK FOR "org.hsqldb.Library.week"
|
|
||||||
CREATE ALIAS SOUNDEX FOR "org.hsqldb.Library.soundex"
|
|
||||||
CREATE ALIAS ASIN FOR "java.lang.Math.asin"
|
|
||||||
CREATE ALIAS LOCATE FOR "org.hsqldb.Library.locate"
|
|
||||||
CREATE ALIAS EXP FOR "java.lang.Math.exp"
|
|
||||||
CREATE ALIAS MONTHNAME FOR "org.hsqldb.Library.monthname"
|
|
||||||
CREATE ALIAS YEAR FOR "org.hsqldb.Library.year"
|
|
||||||
CREATE ALIAS LEFT FOR "org.hsqldb.Library.left"
|
|
||||||
CREATE ALIAS ROUNDMAGIC FOR "org.hsqldb.Library.roundMagic"
|
|
||||||
CREATE ALIAS BITOR FOR "org.hsqldb.Library.bitor"
|
|
||||||
CREATE ALIAS LTRIM FOR "org.hsqldb.Library.ltrim"
|
|
||||||
CREATE ALIAS COT FOR "org.hsqldb.Library.cot"
|
|
||||||
CREATE ALIAS COS FOR "java.lang.Math.cos"
|
|
||||||
CREATE ALIAS MOD FOR "org.hsqldb.Library.mod"
|
|
||||||
CREATE ALIAS SIGN FOR "org.hsqldb.Library.sign"
|
|
||||||
CREATE ALIAS DEGREES FOR "java.lang.Math.toDegrees"
|
|
||||||
CREATE ALIAS LOG FOR "java.lang.Math.log"
|
|
||||||
CREATE ALIAS SIN FOR "java.lang.Math.sin"
|
|
||||||
CREATE ALIAS CURTIME FOR "org.hsqldb.Library.curtime"
|
|
||||||
CREATE ALIAS DIFFERENCE FOR "org.hsqldb.Library.difference"
|
|
||||||
CREATE ALIAS INSERT FOR "org.hsqldb.Library.insert"
|
|
||||||
CREATE ALIAS SUBSTR FOR "org.hsqldb.Library.substring"
|
|
||||||
CREATE ALIAS DATABASE FOR "org.hsqldb.Library.database"
|
|
||||||
CREATE ALIAS MINUTE FOR "org.hsqldb.Library.minute"
|
|
||||||
CREATE ALIAS HOUR FOR "org.hsqldb.Library.hour"
|
|
||||||
CREATE ALIAS IDENTITY FOR "org.hsqldb.Library.identity"
|
|
||||||
CREATE ALIAS QUARTER FOR "org.hsqldb.Library.quarter"
|
|
||||||
CREATE ALIAS CURDATE FOR "org.hsqldb.Library.curdate"
|
|
||||||
CREATE ALIAS BITAND FOR "org.hsqldb.Library.bitand"
|
|
||||||
CREATE ALIAS USER FOR "org.hsqldb.Library.user"
|
|
||||||
CREATE ALIAS UCASE FOR "org.hsqldb.Library.ucase"
|
|
||||||
CREATE ALIAS RTRIM FOR "org.hsqldb.Library.rtrim"
|
|
||||||
CREATE ALIAS LOG10 FOR "org.hsqldb.Library.log10"
|
|
||||||
CREATE ALIAS RIGHT FOR "org.hsqldb.Library.right"
|
|
||||||
CREATE ALIAS ATAN FOR "java.lang.Math.atan"
|
|
||||||
CREATE ALIAS UPPER FOR "org.hsqldb.Library.ucase"
|
|
||||||
CREATE ALIAS ASCII FOR "org.hsqldb.Library.ascii"
|
|
||||||
CREATE ALIAS RAND FOR "java.lang.Math.random"
|
|
||||||
CREATE ALIAS LENGTH FOR "org.hsqldb.Library.length"
|
|
||||||
CREATE ALIAS ROUND FOR "org.hsqldb.Library.round"
|
|
||||||
CREATE ALIAS REPLACE FOR "org.hsqldb.Library.replace"
|
|
||||||
INSERT INTO USERS VALUES('dianne','emu',true)
|
|
||||||
INSERT INTO USERS VALUES('marissa','koala',true)
|
|
||||||
INSERT INTO USERS VALUES('peter','opal',false)
|
|
||||||
INSERT INTO USERS VALUES('scott','wombat',true)
|
|
||||||
INSERT INTO AUTHORITIES VALUES('marissa','ROLE_TELLER')
|
INSERT INTO AUTHORITIES VALUES('marissa','ROLE_TELLER')
|
||||||
INSERT INTO AUTHORITIES VALUES('marissa','ROLE_SUPERVISOR')
|
INSERT INTO AUTHORITIES VALUES('marissa','ROLE_SUPERVISOR')
|
||||||
INSERT INTO AUTHORITIES VALUES('dianne','ROLE_TELLER')
|
INSERT INTO AUTHORITIES VALUES('dianne','ROLE_TELLER')
|
||||||
INSERT INTO AUTHORITIES VALUES('scott','ROLE_TELLER')
|
INSERT INTO AUTHORITIES VALUES('scott','ROLE_TELLER')
|
||||||
INSERT INTO AUTHORITIES VALUES('peter','ROLE_TELLER')
|
INSERT INTO AUTHORITIES VALUES('peter','ROLE_TELLER')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:1','ROLE_SUPERVISOR',NULL,1,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:2','marissa','net.sf.acegisecurity.acl.DomainObject:1',2,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:2','ROLE_SUPERVISOR','net.sf.acegisecurity.acl.DomainObject:1',0,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:3','scott','net.sf.acegisecurity.acl.DomainObject:1',14,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:4','inheritance_marker_only','net.sf.acegisecurity.acl.DomainObject:1',0,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:5','inheritance_marker_only','net.sf.acegisecurity.acl.DomainObject:3',0,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:6','scott','net.sf.acegisecurity.acl.DomainObject:3',1,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
INSERT INTO ACLS VALUES('net.sf.acegisecurity.acl.DomainObject:7','scott','some.invalid.parent:1',2,'net.sf.acegisecurity.acl.basic.SimpleAclEntry')
|
||||||
|
|
|
@ -26,3 +26,46 @@ INSERT INTO authorities VALUES ('marissa', 'ROLE_SUPERVISOR');
|
||||||
INSERT INTO authorities VALUES ('dianne', 'ROLE_TELLER');
|
INSERT INTO authorities VALUES ('dianne', 'ROLE_TELLER');
|
||||||
INSERT INTO authorities VALUES ('scott', 'ROLE_TELLER');
|
INSERT INTO authorities VALUES ('scott', 'ROLE_TELLER');
|
||||||
INSERT INTO authorities VALUES ('peter', 'ROLE_TELLER');
|
INSERT INTO authorities VALUES ('peter', 'ROLE_TELLER');
|
||||||
|
|
||||||
|
CREATE TABLE acls (
|
||||||
|
object_identity VARCHAR_IGNORECASE(250) NOT NULL,
|
||||||
|
recipient VARCHAR_IGNORECASE(100) NOT NULL,
|
||||||
|
parent_object_identity VARCHAR_IGNORECASE(250),
|
||||||
|
mask INTEGER NOT NULL,
|
||||||
|
acl_class VARCHAR_IGNORECASE(250) NOT NULL,
|
||||||
|
CONSTRAINT pk_acls PRIMARY KEY(object_identity, recipient)
|
||||||
|
);
|
||||||
|
|
||||||
|
--- Mask integer 0 = no permissions
|
||||||
|
--- Mask integer 1 = administer
|
||||||
|
--- Mask integer 2 = read
|
||||||
|
--- Mask integer 6 = read and write permissions
|
||||||
|
--- Mask integer 14 = read and write and create permissions
|
||||||
|
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--- *** EFFECTIVE RIGHTS FOR DIFFERENT INSTANCES AND RECIPIENTS ***
|
||||||
|
--- INSTANCE RECIPIENT PERMISSION(S) (COMMENT #INSTANCE)
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
--- 1 ROLE_SUPERVISOR Administer
|
||||||
|
--- 2 ROLE_SUPERVISOR None (overrides parent #1)
|
||||||
|
--- marissa Read
|
||||||
|
--- 3 ROLE_SUPERVISOR Administer (from parent #1)
|
||||||
|
--- scott Read, Write, Create
|
||||||
|
--- 4 ROLE_SUPERVISOR Administer (from parent #1)
|
||||||
|
--- 5 ROLE_SUPERVISOR Administer (from parent #3)
|
||||||
|
--- scott Read, Write, Create (from parent #3)
|
||||||
|
--- 6 ROLE_SUPERVISOR Administer (from parent #3)
|
||||||
|
--- scott Administer (overrides parent #3)
|
||||||
|
--- 7 scott Read (invalid parent ignored)
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:1', 'ROLE_SUPERVISOR', null, 1, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:2', 'ROLE_SUPERVISOR', 'net.sf.acegisecurity.acl.DomainObject:1', 0, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:2', 'marissa', 'net.sf.acegisecurity.acl.DomainObject:1', 2, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:3', 'scott', 'net.sf.acegisecurity.acl.DomainObject:1', 14, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:4', 'inheritance_marker_only', 'net.sf.acegisecurity.acl.DomainObject:1', 0, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:5', 'inheritance_marker_only', 'net.sf.acegisecurity.acl.DomainObject:3', 0, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:6', 'scott', 'net.sf.acegisecurity.acl.DomainObject:3', 1, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
INSERT INTO acls VALUES ('net.sf.acegisecurity.acl.DomainObject:7', 'scott', 'some.invalid.parent:1', 2, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
HSQLDB 1.7.2 Release Candidate 6D
|
|
@ -1,16 +0,0 @@
|
||||||
#HSQL database
|
|
||||||
#Thu Apr 22 17:27:10 EDT 2004
|
|
||||||
sql.strict_fk=true
|
|
||||||
readonly=false
|
|
||||||
sql.strong_fk=true
|
|
||||||
hsqldb.version=1.7.1
|
|
||||||
version=1.7.1
|
|
||||||
hsqldb.cache_scale=14
|
|
||||||
sql.compare_in_locale=false
|
|
||||||
sql.month=true
|
|
||||||
hsqldb.log_size=200
|
|
||||||
modified=no
|
|
||||||
hsqldb.cache_version=1.7.0
|
|
||||||
hsqldb.original_version=1.7.1
|
|
||||||
hsqldb.compatible_version=1.7.0
|
|
||||||
sql.enforce_size=false
|
|
|
@ -1,85 +0,0 @@
|
||||||
CREATE TABLE USERS(USERNAME VARCHAR_IGNORECASE(50) NOT NULL PRIMARY KEY,PASSWORD VARCHAR_IGNORECASE(50) NOT NULL,ENABLED BIT NOT NULL)
|
|
||||||
CREATE TABLE AUTHORITIES(USERNAME VARCHAR_IGNORECASE(50) NOT NULL,AUTHORITY VARCHAR_IGNORECASE(50) NOT NULL,CONSTRAINT FK_AUTHORITIES_USERS FOREIGN KEY(USERNAME) REFERENCES USERS(USERNAME))
|
|
||||||
CREATE UNIQUE INDEX IX_AUTH_USERNAME ON AUTHORITIES(USERNAME,AUTHORITY)
|
|
||||||
GRANT ALL ON CLASS "org.hsqldb.Library" TO PUBLIC
|
|
||||||
GRANT ALL ON CLASS "java.lang.Math" TO PUBLIC
|
|
||||||
CREATE USER SA PASSWORD "" ADMIN
|
|
||||||
SET IGNORECASE TRUE
|
|
||||||
CREATE ALIAS DAYNAME FOR "org.hsqldb.Library.dayname"
|
|
||||||
CREATE ALIAS SPACE FOR "org.hsqldb.Library.space"
|
|
||||||
CREATE ALIAS SUBSTRING FOR "org.hsqldb.Library.substring"
|
|
||||||
CREATE ALIAS HEXTORAW FOR "org.hsqldb.Library.hexToRaw"
|
|
||||||
CREATE ALIAS SQRT FOR "java.lang.Math.sqrt"
|
|
||||||
CREATE ALIAS ABS FOR "org.hsqldb.Library.abs"
|
|
||||||
CREATE ALIAS POWER FOR "java.lang.Math.pow"
|
|
||||||
CREATE ALIAS CHAR FOR "org.hsqldb.Library.character"
|
|
||||||
CREATE ALIAS CONCAT FOR "org.hsqldb.Library.concat"
|
|
||||||
CREATE ALIAS PI FOR "org.hsqldb.Library.pi"
|
|
||||||
CREATE ALIAS RAWTOHEX FOR "org.hsqldb.Library.rawToHex"
|
|
||||||
CREATE ALIAS SECOND FOR "org.hsqldb.Library.second"
|
|
||||||
CREATE ALIAS TRUNCATE FOR "org.hsqldb.Library.truncate"
|
|
||||||
CREATE ALIAS MONTH FOR "org.hsqldb.Library.month"
|
|
||||||
CREATE ALIAS LOWER FOR "org.hsqldb.Library.lcase"
|
|
||||||
CREATE ALIAS ATAN2 FOR "java.lang.Math.atan2"
|
|
||||||
CREATE ALIAS REPEAT FOR "org.hsqldb.Library.repeat"
|
|
||||||
CREATE ALIAS DAYOFMONTH FOR "org.hsqldb.Library.dayofmonth"
|
|
||||||
CREATE ALIAS TAN FOR "java.lang.Math.tan"
|
|
||||||
CREATE ALIAS RADIANS FOR "java.lang.Math.toRadians"
|
|
||||||
CREATE ALIAS FLOOR FOR "java.lang.Math.floor"
|
|
||||||
CREATE ALIAS NOW FOR "org.hsqldb.Library.now"
|
|
||||||
CREATE ALIAS ACOS FOR "java.lang.Math.acos"
|
|
||||||
CREATE ALIAS DAYOFWEEK FOR "org.hsqldb.Library.dayofweek"
|
|
||||||
CREATE ALIAS CEILING FOR "java.lang.Math.ceil"
|
|
||||||
CREATE ALIAS DAYOFYEAR FOR "org.hsqldb.Library.dayofyear"
|
|
||||||
CREATE ALIAS LCASE FOR "org.hsqldb.Library.lcase"
|
|
||||||
CREATE ALIAS WEEK FOR "org.hsqldb.Library.week"
|
|
||||||
CREATE ALIAS SOUNDEX FOR "org.hsqldb.Library.soundex"
|
|
||||||
CREATE ALIAS ASIN FOR "java.lang.Math.asin"
|
|
||||||
CREATE ALIAS LOCATE FOR "org.hsqldb.Library.locate"
|
|
||||||
CREATE ALIAS EXP FOR "java.lang.Math.exp"
|
|
||||||
CREATE ALIAS MONTHNAME FOR "org.hsqldb.Library.monthname"
|
|
||||||
CREATE ALIAS YEAR FOR "org.hsqldb.Library.year"
|
|
||||||
CREATE ALIAS LEFT FOR "org.hsqldb.Library.left"
|
|
||||||
CREATE ALIAS ROUNDMAGIC FOR "org.hsqldb.Library.roundMagic"
|
|
||||||
CREATE ALIAS BITOR FOR "org.hsqldb.Library.bitor"
|
|
||||||
CREATE ALIAS LTRIM FOR "org.hsqldb.Library.ltrim"
|
|
||||||
CREATE ALIAS COT FOR "org.hsqldb.Library.cot"
|
|
||||||
CREATE ALIAS COS FOR "java.lang.Math.cos"
|
|
||||||
CREATE ALIAS MOD FOR "org.hsqldb.Library.mod"
|
|
||||||
CREATE ALIAS SIGN FOR "org.hsqldb.Library.sign"
|
|
||||||
CREATE ALIAS DEGREES FOR "java.lang.Math.toDegrees"
|
|
||||||
CREATE ALIAS LOG FOR "java.lang.Math.log"
|
|
||||||
CREATE ALIAS SIN FOR "java.lang.Math.sin"
|
|
||||||
CREATE ALIAS CURTIME FOR "org.hsqldb.Library.curtime"
|
|
||||||
CREATE ALIAS DIFFERENCE FOR "org.hsqldb.Library.difference"
|
|
||||||
CREATE ALIAS INSERT FOR "org.hsqldb.Library.insert"
|
|
||||||
CREATE ALIAS SUBSTR FOR "org.hsqldb.Library.substring"
|
|
||||||
CREATE ALIAS DATABASE FOR "org.hsqldb.Library.database"
|
|
||||||
CREATE ALIAS MINUTE FOR "org.hsqldb.Library.minute"
|
|
||||||
CREATE ALIAS HOUR FOR "org.hsqldb.Library.hour"
|
|
||||||
CREATE ALIAS IDENTITY FOR "org.hsqldb.Library.identity"
|
|
||||||
CREATE ALIAS QUARTER FOR "org.hsqldb.Library.quarter"
|
|
||||||
CREATE ALIAS CURDATE FOR "org.hsqldb.Library.curdate"
|
|
||||||
CREATE ALIAS BITAND FOR "org.hsqldb.Library.bitand"
|
|
||||||
CREATE ALIAS USER FOR "org.hsqldb.Library.user"
|
|
||||||
CREATE ALIAS UCASE FOR "org.hsqldb.Library.ucase"
|
|
||||||
CREATE ALIAS RTRIM FOR "org.hsqldb.Library.rtrim"
|
|
||||||
CREATE ALIAS LOG10 FOR "org.hsqldb.Library.log10"
|
|
||||||
CREATE ALIAS RIGHT FOR "org.hsqldb.Library.right"
|
|
||||||
CREATE ALIAS ATAN FOR "java.lang.Math.atan"
|
|
||||||
CREATE ALIAS UPPER FOR "org.hsqldb.Library.ucase"
|
|
||||||
CREATE ALIAS ASCII FOR "org.hsqldb.Library.ascii"
|
|
||||||
CREATE ALIAS RAND FOR "java.lang.Math.random"
|
|
||||||
CREATE ALIAS LENGTH FOR "org.hsqldb.Library.length"
|
|
||||||
CREATE ALIAS ROUND FOR "org.hsqldb.Library.round"
|
|
||||||
CREATE ALIAS REPLACE FOR "org.hsqldb.Library.replace"
|
|
||||||
INSERT INTO USERS VALUES('cooper','kookaburra',true)
|
|
||||||
INSERT INTO USERS VALUES('dianne','emu',true)
|
|
||||||
INSERT INTO USERS VALUES('marissa','koala',true)
|
|
||||||
INSERT INTO USERS VALUES('peter','opal',false)
|
|
||||||
INSERT INTO USERS VALUES('scott','wombat',true)
|
|
||||||
INSERT INTO AUTHORITIES VALUES('marissa','ROLE_TELLER')
|
|
||||||
INSERT INTO AUTHORITIES VALUES('marissa','ROLE_SUPERVISOR')
|
|
||||||
INSERT INTO AUTHORITIES VALUES('dianne','ROLE_TELLER')
|
|
||||||
INSERT INTO AUTHORITIES VALUES('scott','ROLE_TELLER')
|
|
||||||
INSERT INTO AUTHORITIES VALUES('peter','ROLE_TELLER')
|
|
Loading…
Reference in New Issue