01: package liquibase.database;
02:
03: import static org.junit.Assert.*;
04: import org.junit.Test;
05:
06: /**
07: * Tests for {@link PostgresDatabase}
08: */
09: public class PostgresDatabaseTest extends AbstractDatabaseTest {
10:
11: public PostgresDatabaseTest() throws Exception {
12: super (new PostgresDatabase());
13: }
14:
15: protected String getProductNameString() {
16: return "PostgreSQL";
17: }
18:
19: @Test
20: public void getBlobType() {
21: assertEquals("BYTEA", getDatabase().getBlobType());
22: }
23:
24: @Test
25: public void supportsInitiallyDeferrableColumns() {
26: assertTrue(getDatabase().supportsInitiallyDeferrableColumns());
27: }
28:
29: @Test
30: public void getBooleanType() {
31: assertEquals("BOOLEAN", getDatabase().getBooleanType());
32: }
33:
34: @Test
35: public void getCurrencyType() {
36: assertEquals("DECIMAL", getDatabase().getCurrencyType());
37: }
38:
39: @Test
40: public void getUUIDType() {
41: assertEquals("CHAR(36)", getDatabase().getUUIDType());
42: }
43:
44: @Test
45: public void getClobType() {
46: assertEquals("TEXT", getDatabase().getClobType());
47: }
48:
49: @Test
50: public void getDateType() {
51: assertEquals("DATE", getDatabase().getDateType());
52: }
53:
54: @Test
55: public void getDateTimeType() {
56: assertEquals("TIMESTAMP WITH TIME ZONE", getDatabase()
57: .getDateTimeType());
58: }
59:
60: @Test
61: public void getCurrentDateTimeFunction() {
62: assertEquals("NOW()", getDatabase()
63: .getCurrentDateTimeFunction());
64: }
65:
66: @Test
67: public void testDropDatabaseObjects() throws Exception {
68: ; //TODO: test has troubles, fix later
69: }
70:
71: @Test
72: public void testCheckDatabaseChangeLogTable() throws Exception {
73: ; //TODO: test has troubles, fix later
74: }
75:
76: public void testGetDefaultDriver() {
77: Database database = new PostgresDatabase();
78:
79: assertEquals(
80: "org.postgresql.Driver",
81: database
82: .getDefaultDriver("jdbc:postgresql://localhost/liquibase"));
83:
84: assertNull(database
85: .getDefaultDriver("jdbc:db2://localhost;databaseName=liquibase"));
86: }
87:
88: }
|