1 package com.mockobjects.sql; 2 3 import java.io.PrintWriter ; 4 import java.sql.Connection ; 5 import javax.sql.DataSource ; 6 import com.mockobjects.ExpectationCounter; 7 import com.mockobjects.MockObject; 8 9 17 public abstract class CommonMockDataSource extends MockObject 18 implements DataSource { 19 20 private Connection myConnection; 21 22 private ExpectationCounter myConnectCalls = 23 new ExpectationCounter("CommonMockDataSource.connection"); 24 25 30 public void setExpectedConnectCalls(int callCount) { 31 myConnectCalls.setExpected(callCount); 32 } 33 34 38 public void setupConnection(Connection aConnection) { 39 myConnection = aConnection; 40 } 41 42 44 48 public Connection getConnection() { 49 myConnectCalls.inc(); 50 return myConnection; 51 } 52 53 55 58 public Connection getConnection(String username, 59 String password) { 60 notImplemented(); 61 return null; 62 } 63 64 67 public int getLoginTimeout() { 68 notImplemented(); 69 return 0; 70 } 71 72 75 public PrintWriter getLogWriter() { 76 notImplemented(); 77 return null; 78 } 79 80 83 public void setLoginTimeout(int seconds) { 84 notImplemented(); 85 } 86 87 90 public void setLogWriter(PrintWriter out) { 91 notImplemented(); 92 } 93 } 94 95 96 | Popular Tags |