use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class UDTPermsTest method suite.
// /////////////////////////////////////////////////////////////////////////////////
//
// JUnit BEHAVIOR
//
// /////////////////////////////////////////////////////////////////////////////////
/**
* Construct top level suite in this JUnit test
*/
public static Test suite() {
BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(UDTPermsTest.class);
Test cleanTest = new CleanDatabaseTestSetup(suite);
Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(cleanTest, LEGAL_USERS, "udtPermissions");
Test authorizedTest = TestConfiguration.sqlAuthorizationDecorator(authenticatedTest);
return authorizedTest;
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class RolesConferredPrivilegesTest method makeSuite.
/**
* Construct suite of tests
*
* @return A suite containing the test cases.
*/
private static Test makeSuite() {
/* Tests running with sql authorization set. First decorate
* with clean database, then with authentication +
* sqlAuthorization.
*/
Test clean = new CleanDatabaseTestSetup(new BaseTestSuite(RolesConferredPrivilegesTest.class)) {
protected void decorateSQL(Statement s) throws SQLException {
/*
* a1 a2 a3
* / | \ | |
* / b +--------> c d
* j | \ /
* e---+ \ /
* \ \ \ /
* \ \---------+ \ /
* \ \_ f
* \ /
* \ /
* \ /
* \ /
* \ /
* \ /
* h
*/
s.execute("create role a1");
s.execute("create role j");
s.execute("create role b");
s.execute("create role e");
s.execute("create role h");
s.execute("create role a2");
s.execute("create role c");
s.execute("create role f");
s.execute("create role a3");
s.execute("create role d");
s.execute("grant a1 to j");
s.execute("grant a1 TO b");
s.execute("grant b TO e");
s.execute("grant e TO h");
s.execute("grant a1 TO c");
s.execute("grant e TO f");
s.execute("grant a2 TO c");
s.execute("grant c TO f");
s.execute("grant f TO h");
s.execute("grant a3 TO d");
s.execute("grant d TO f");
s.execute("create schema s1");
s.execute("create function s1.f1( ) returns int " + "language java parameter style java external name " + "'org.apache.derbyTesting.functionTests.tests.lang." + "RolesConferredPrivilegesTest.s1f1' " + "no sql called on null input");
s.execute("create function s1.f2( ) returns int " + "language java parameter style java external name " + "'org.apache.derbyTesting.functionTests.tests.lang." + "RolesConferredPrivilegesTest.s1f1' " + "no sql called on null input");
s.execute("create table s1.t1(" + "c1 int unique, c2 int unique, c3 int unique, " + "primary key (c1,c2,c3))");
// We made columns all unique so we can test references
// privilege for all columns.
s.execute("create procedure s1.calledNested()" + " language java parameter style java" + " external name " + "'org.apache.derbyTesting.functionTests.tests.lang." + "RolesConferredPrivilegesTest.calledNested' " + " modifies sql data");
s.execute("create function s1.getCurrentRole() " + "returns varchar(30)" + "language java parameter style java external name " + "'org.apache.derbyTesting.functionTests.tests.lang." + "RolesConferredPrivilegesTest.getCurrentRole' " + " reads sql data");
}
};
return TestConfiguration.sqlAuthorizationDecorator(DatabasePropertyTestSetup.singleProperty(DatabasePropertyTestSetup.builtinAuthentication(clean, users, pwSuffix), // lot:
"derby.language.statementCacheSize", "1000"));
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class SubqueryTest method suite.
public static Test suite() {
Properties props = new Properties();
props.setProperty("derby.language.statementCacheSize", "0");
return new DatabasePropertyTestSetup(new SystemPropertyTestSetup(new CleanDatabaseTestSetup(new BaseTestSuite(SubqueryTest.class, "SubqueryTest")) {
/**
* @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
*/
protected void decorateSQL(Statement s) throws SQLException {
s.execute("CREATE FUNCTION ConsistencyChecker() " + "RETURNS VARCHAR(128) " + "EXTERNAL NAME " + "'org.apache.derbyTesting.functionTests." + "util.T_ConsistencyChecker.runConsistencyChecker' " + "LANGUAGE JAVA PARAMETER STYLE JAVA");
s.execute("create table s " + "(i int, s smallint, c char(30), " + "vc char(30), b bigint)");
s.execute("create table t " + "(i int, s smallint, c char(30), " + "vc char(30), b bigint)");
s.execute("create table tt " + "(ii int, ss smallint, cc char(30), " + "vcvc char(30), b bigint)");
s.execute("create table ttt " + "(iii int, sss smallint, ccc char(30), " + "vcvcvc char(30))");
// populate the tables
s.execute("insert into s values " + "(null, null, null, null, null)");
s.execute("insert into s values (0, 0, '0', '0', 0)");
s.execute("insert into s values (1, 1, '1', '1', 1)");
s.execute("insert into t values " + "(null, null, null, null, null)");
s.execute("insert into t values (0, 0, '0', '0', 0)");
s.execute("insert into t values (1, 1, '1', '1', 1)");
s.execute("insert into t values (1, 1, '1', '1', 1)");
s.execute("insert into t values (2, 2, '2', '2', 1)");
s.execute("insert into tt values " + "(null, null, null, null, null)");
s.execute("insert into tt values (0, 0, '0', '0', 0)");
s.execute("insert into tt values (1, 1, '1', '1', 1)");
s.execute("insert into tt values (1, 1, '1', '1', 1)");
s.execute("insert into tt values (2, 2, '2', '2', 1)");
s.execute("insert into ttt values (null, null, null, null)");
s.execute("insert into ttt values (11, 11, '11', '11')");
s.execute("insert into ttt values (11, 11, '11', '11')");
s.execute("insert into ttt values (22, 22, '22', '22')");
}
}, props), props, true);
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class ScrollCursors1Test method baseSuite.
public static Test baseSuite(String name) {
BaseTestSuite suite = new BaseTestSuite(name);
suite.addTestSuite(ScrollCursors1Test.class);
return new CleanDatabaseTestSetup(suite) {
/**
* Create and populate table
*
* @see org.apache.derbyTesting.junit.CleanDatabaseTestSetup#decorateSQL(java.sql.Statement)
*/
protected void decorateSQL(Statement s) throws SQLException {
s.executeUpdate("create table t1(c50 char(50), i int)");
s.executeUpdate(" create table t2(c50 char(50), i int)");
// populate tables
s.executeUpdate("insert into t1 values ('b', 2), ('c', 3), ('d', 4), " + "('e', 5)," + " ('f', 6), ('g', 7), ('h', 8), ('i', 9)," + " ('j', 10), ('k', 11), ('l', 12), ('m', 13)");
}
};
}
use of org.apache.derbyTesting.junit.CleanDatabaseTestSetup in project derby by apache.
the class SequenceGeneratorTest method suite.
// /////////////////////////////////////////////////////////////////////////////////
//
// JUnit BEHAVIOR
//
// /////////////////////////////////////////////////////////////////////////////////
/**
* Construct top level suite in this JUnit test
*/
public static Test suite() {
BaseTestSuite suite = (BaseTestSuite) TestConfiguration.embeddedSuite(SequenceGeneratorTest.class);
Test cleanTest = new CleanDatabaseTestSetup(suite);
Test timeoutTest = DatabasePropertyTestSetup.setLockTimeouts(cleanTest, 5, 5);
Test authenticatedTest = DatabasePropertyTestSetup.builtinAuthentication(timeoutTest, LEGAL_USERS, "sequenceGenerator");
Test authorizedTest = TestConfiguration.sqlAuthorizationDecorator(authenticatedTest);
return authorizedTest;
}
Aggregations