01: package liquibase.database;
02:
03: import static org.junit.Assert.*;
04: import org.junit.Test;
05:
06: /**
07: * Tests for {@link MSSQLDatabase}
08: */
09: public class MSSQLDatabaseTest extends AbstractDatabaseTest {
10:
11: public MSSQLDatabaseTest() throws Exception {
12: super (new MSSQLDatabase());
13: }
14:
15: protected String getProductNameString() {
16: return "Microsoft SQL Server";
17: }
18:
19: @Test
20: public void getBlobType() {
21: assertEquals("IMAGE", getDatabase().getBlobType());
22: }
23:
24: @Test
25: public void supportsInitiallyDeferrableColumns() {
26: assertFalse(getDatabase().supportsInitiallyDeferrableColumns());
27: }
28:
29: @Test
30: public void getBooleanType() {
31: assertEquals("BIT", getDatabase().getBooleanType());
32: }
33:
34: @Test
35: public void getCurrencyType() {
36: assertEquals("MONEY", getDatabase().getCurrencyType());
37: }
38:
39: @Test
40: public void getUUIDType() {
41: assertEquals("UNIQUEIDENTIFIER", 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("SMALLDATETIME", getDatabase().getDateType());
52: }
53:
54: @Test
55: public void getDateTimeType() {
56: assertEquals("DATETIME", getDatabase().getDateTimeType());
57: }
58:
59: @Test
60: public void getCurrentDateTimeFunction() {
61: assertEquals("GETDATE()", getDatabase()
62: .getCurrentDateTimeFunction());
63: }
64:
65: @Test
66: public void getDefaultDriver() {
67: Database database = new MSSQLDatabase();
68:
69: assertEquals(
70: "com.microsoft.sqlserver.jdbc.SQLServerDriver",
71: database
72: .getDefaultDriver("jdbc:sqlserver://localhost;databaseName=liquibase"));
73:
74: assertNull(database
75: .getDefaultDriver("jdbc:oracle:thin://localhost;databaseName=liquibase"));
76: }
77:
78: @Test
79: public void escapeTableName_noSchema() {
80: Database database = new MSSQLDatabase();
81: assertEquals("[tableName]", database.escapeTableName(null,
82: "tableName"));
83: }
84:
85: @Test
86: public void escapeTableName_withSchema() {
87: Database database = new MSSQLDatabase();
88: assertEquals("[schemaName].[tableName]", database
89: .escapeTableName("schemaName", "tableName"));
90: }
91: }
|