1 //
2 // ========================================================================
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
8 //
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
11 //
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
14 //
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
17 //
18
19 package com.acme;
20
21 import java.io.PrintWriter;
22 import java.sql.Connection;
23 import java.sql.SQLException;
24 import java.util.logging.Logger;
25
26 import javax.sql.DataSource;
27
28 /**
29 * MockDataSource
30 *
31 *
32 */
33 public class MockDataSource implements DataSource
34 {
35
36 /**
37 * NOTE: JDK7+ new feature
38 */
39 public Logger getParentLogger()
40 {
41 return null;
42 }
43
44 /**
45 * @see javax.sql.DataSource#getConnection()
46 */
47 public Connection getConnection() throws SQLException
48 {
49 return null;
50 }
51
52 /**
53 * @see javax.sql.DataSource#getConnection(java.lang.String, java.lang.String)
54 */
55 public Connection getConnection(String username, String password)
56 throws SQLException
57 {
58 return null;
59 }
60
61 /**
62 * @see javax.sql.DataSource#getLogWriter()
63 */
64 public PrintWriter getLogWriter() throws SQLException
65 {
66 return null;
67 }
68
69 /**
70 * @see javax.sql.DataSource#getLoginTimeout()
71 */
72 public int getLoginTimeout() throws SQLException
73 {
74 return 0;
75 }
76
77 /**
78 * @see javax.sql.DataSource#setLogWriter(java.io.PrintWriter)
79 */
80 public void setLogWriter(PrintWriter out) throws SQLException
81 {
82 }
83
84 /**
85 * @see javax.sql.DataSource#setLoginTimeout(int)
86 */
87 public void setLoginTimeout(int seconds) throws SQLException
88 {
89 }
90
91 public boolean isWrapperFor(Class<?> iface) throws SQLException
92 {
93 return false;
94 }
95
96 public <T> T unwrap(Class<T> iface) throws SQLException
97 {
98 return null;
99 }
100
101 }