| 1 |
// |
| 2 |
// ======================================================================== |
| 3 |
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. |
| 4 |
// |
| 5 |
// This program and the accompanying materials are made available under the |
| 6 |
// terms of the Eclipse Public License v. 2.0 which is available at |
| 7 |
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 |
| 8 |
// which is available at https://www.apache.org/licenses/LICENSE-2.0. |
| 9 |
// |
| 10 |
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 |
| 11 |
// ======================================================================== |
| 12 |
// |
| 13 |
|
| 14 |
package org.example; |
| 15 |
|
| 16 |
import java.io.PrintWriter; |
| 17 |
import java.sql.Connection; |
| 18 |
import java.sql.SQLException; |
| 19 |
import java.util.logging.Logger; |
| 20 |
import javax.sql.DataSource; |
| 21 |
|
| 22 |
/** |
| 23 |
* MockDataSource |
| 24 |
*/ |
| 25 |
public class MockDataSource implements DataSource |
| 26 |
{ |
| 27 |
|
| 28 |
/** |
| 29 |
* NOTE: JDK7+ new feature |
| 30 |
*/ |
| 31 |
@Override |
| 32 |
public Logger getParentLogger() |
| 33 |
{ |
| 34 |
return null; |
| 35 |
} |
| 36 |
|
| 37 |
@Override |
| 38 |
public Connection getConnection() throws SQLException |
| 39 |
{ |
| 40 |
return null; |
| 41 |
} |
| 42 |
|
| 43 |
@Override |
| 44 |
public Connection getConnection(String username, String password) |
| 45 |
throws SQLException |
| 46 |
{ |
| 47 |
return null; |
| 48 |
} |
| 49 |
|
| 50 |
@Override |
| 51 |
public PrintWriter getLogWriter() throws SQLException |
| 52 |
{ |
| 53 |
return null; |
| 54 |
} |
| 55 |
|
| 56 |
@Override |
| 57 |
public int getLoginTimeout() throws SQLException |
| 58 |
{ |
| 59 |
return 0; |
| 60 |
} |
| 61 |
|
| 62 |
@Override |
| 63 |
public void setLogWriter(PrintWriter out) throws SQLException |
| 64 |
{ |
| 65 |
} |
| 66 |
|
| 67 |
@Override |
| 68 |
public void setLoginTimeout(int seconds) throws SQLException |
| 69 |
{ |
| 70 |
} |
| 71 |
|
| 72 |
@Override |
| 73 |
public boolean isWrapperFor(Class<?> iface) throws SQLException |
| 74 |
{ |
| 75 |
return false; |
| 76 |
} |
| 77 |
|
| 78 |
@Override |
| 79 |
public <T> T unwrap(Class<T> iface) throws SQLException |
| 80 |
{ |
| 81 |
return null; |
| 82 |
} |
| 83 |
} |