1 21 package net.sf.hajdbc.dialect; 22 23 import java.sql.SQLException ; 24 25 import net.sf.hajdbc.Dialect; 26 27 import org.easymock.EasyMock; 28 import org.testng.annotations.Test; 29 30 34 @Test 35 public class TestPostgreSQLDialect extends TestDefaultDialect 36 { 37 @Override 38 protected Dialect createDialect() 39 { 40 return new PostgreSQLDialect(); 41 } 42 43 @Override 44 public void testGetLockTableSQL() 45 { 46 String schema = "schema"; 47 String table = "table"; 48 String quote = "'"; 49 50 try 51 { 52 EasyMock.expect(this.metaData.supportsSchemasInDataManipulation()).andReturn(true); 53 EasyMock.expect(this.metaData.getIdentifierQuoteString()).andReturn(quote).times(2); 54 55 this.control.replay(); 56 57 String sql = this.dialect.getLockTableSQL(this.metaData, schema, table); 58 59 this.control.verify(); 60 61 assert sql.equals("LOCK TABLE 'schema'.'table' IN EXCLUSIVE MODE") : sql; 62 } 63 catch (SQLException e) 64 { 65 assert false : e; 66 } 67 } 68 69 @Override 70 public void testGetTruncateTableSQL() 71 { 72 String schema = "schema"; 73 String table = "table"; 74 String quote = "'"; 75 76 try 77 { 78 EasyMock.expect(this.metaData.supportsSchemasInDataManipulation()).andReturn(true); 79 EasyMock.expect(this.metaData.getIdentifierQuoteString()).andReturn(quote).times(2); 80 81 this.control.replay(); 82 83 String sql = this.dialect.getTruncateTableSQL(this.metaData, schema, table); 84 85 this.control.verify(); 86 87 assert sql.equals("TRUNCATE TABLE 'schema'.'table'") : sql; 88 } 89 catch (SQLException e) 90 { 91 assert false : e; 92 } 93 } 94 } 95 | Popular Tags |