View Javadoc

1   package liquibase.sqlgenerator.core;
2   
3   public abstract class AlterSequenceGeneratorTest {
4   ////    @Test
5   ////    public void supports() throws Exception {
6   ////        for (Database database : TestContext.getWriteExecutor().getAllDatabases()) {
7   ////            if (database.supportsSequences()) {
8   ////                assertTrue(createGeneratorUnderTest().supportsDatabase(database));
9   ////            } else {
10  ////                assertFalse(createGeneratorUnderTest().supportsDatabase(database));
11  ////            }
12  ////        }
13  ////    }
14  //
15  //    @Test
16  //    public void execute_incrementBy() throws Exception {
17  //        new DatabaseTestTemplate().testOnAvailableDatabases(
18  //                new SqlStatementDatabaseTest(null, new AlterSequenceStatement(null, SEQ_NAME).setIncrementBy(5)) {
19  //                    protected boolean expectedException(Database database, DatabaseException exception) {
20  //                        return database instanceof FirebirdDatabase || database instanceof HsqlDatabase || database  instanceof H2Database;
21  //                    }
22  //
23  //                    protected void preExecuteAssert(DatabaseSnapshotGenerator snapshot) {
24  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
25  //                        //todo: assert increment by is 1
26  //                    }
27  //
28  //                    protected void postExecuteAssert(DatabaseSnapshotGenerator snapshot) {
29  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
30  //                        //todo: assert increment by value
31  //                    }
32  //                });
33  //    }
34  //
35  //    @Test
36  //    public void execute_minValue() throws Exception {
37  //        new DatabaseTestTemplate().testOnAvailableDatabases(
38  //                new SqlStatementDatabaseTest(null, new AlterSequenceStatement(null, SEQ_NAME).setMinValue(0)) {
39  //                    protected void preExecuteAssert(DatabaseSnapshotGenerator snapshot) {
40  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
41  //                        //todo; assert minValue is 1
42  //                    }
43  //
44  //                    protected void postExecuteAssert(DatabaseSnapshotGenerator snapshot) {
45  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
46  //                        //todo: assert min valuevalue
47  //                    }
48  //                });
49  //    }
50  //
51  //    @Test
52  //    public void execute_maxValue() throws Exception {
53  //        new DatabaseTestTemplate().testOnAvailableDatabases(
54  //                new SqlStatementDatabaseTest(null, new AlterSequenceStatement(null, SEQ_NAME).setMaxValue(50)) {
55  //
56  //                    protected boolean expectedException(Database database, DatabaseException exception) {
57  //                        return database instanceof FirebirdDatabase || database instanceof HsqlDatabase || database  instanceof H2Database;
58  //                    }
59  //
60  //                    protected void preExecuteAssert(DatabaseSnapshotGenerator snapshot) {
61  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
62  //                        //todo: assert initial max value
63  //                    }
64  //
65  //                    protected void postExecuteAssert(DatabaseSnapshotGenerator snapshot) {
66  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
67  //                        //todo: assert max value
68  //                    }
69  //                });
70  //    }
71  //
72  //    @Test
73  //    public void execute_order() throws Exception {
74  //        new DatabaseTestTemplate().testOnAvailableDatabases(
75  //                new SqlStatementDatabaseTest(null, new AlterSequenceStatement(null, SEQ_NAME).setOrdered(true)) {
76  //
77  //                    protected boolean expectedException(Database database, DatabaseException exception) {
78  //                        return !(database instanceof OracleDatabase || database instanceof DB2Database);
79  //                    }
80  //
81  //                    protected void preExecuteAssert(DatabaseSnapshotGenerator snapshot) {
82  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
83  //                        //todo: assert order default
84  //                    }
85  //
86  //                    protected void postExecuteAssert(DatabaseSnapshotGenerator snapshot) {
87  //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
88  //                        //todo: assert max value
89  //                    }
90  //                });
91  //    }
92  //
93  //    @Test
94  //    public void execute_schemaSet() throws Exception {
95  //        new DatabaseTestTemplate().testOnAvailableDatabases(
96  //                new SqlStatementDatabaseTest(TestContext.ALT_SCHEMA, new AlterSequenceStatement(TestContext.ALT_SCHEMA, SEQ_NAME).setIncrementBy(5)) {
97  //                    protected boolean expectedException(Database database, DatabaseException exception) {
98  //                        return database instanceof FirebirdDatabase || database instanceof HsqlDatabase || database  instanceof H2Database;
99  //                    }
100 //
101 //                    protected void preExecuteAssert(DatabaseSnapshotGenerator snapshot) {
102 //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
103 //                        //todo: assert increment by is 1
104 //                    }
105 //
106 //                    protected void postExecuteAssert(DatabaseSnapshotGenerator snapshot) {
107 //                        assertNotNull(snapshot.getSequence(SEQ_NAME));
108 //                        //todo: assert increment by value
109 //                    }
110 //                });
111 //    }
112 
113 }