2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.models.provider.impl;
23 import java.sql.Array;
25 import java.sql.CallableStatement;
27 import java.sql.Connection;
28 import java.sql.DatabaseMetaData;
29 import java.sql.NClob;
30 import java.sql.PreparedStatement;
31 import java.sql.SQLClientInfoException;
32 import java.sql.SQLException;
33 import java.sql.SQLWarning;
34 import java.sql.SQLXML;
35 import java.sql.Savepoint;
36 import java.sql.Statement;
37 import java.sql.Struct;
39 import java.util.Properties;
40 import java.util.concurrent.Executor;
43 * Dummy database connection.
45 * @author Liam Fallon (liam.fallon@est.tech)
47 public class DummyConnection implements Connection {
50 public boolean isWrapperFor(Class<?> iface) throws SQLException {
55 public <T> T unwrap(Class<T> iface) throws SQLException {
60 public void abort(Executor executor) throws SQLException {
65 public void clearWarnings() throws SQLException {
70 public void close() throws SQLException {
71 throw new SQLException("Bad Request");
75 public void commit() throws SQLException {
80 public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
85 public Blob createBlob() throws SQLException {
90 public Clob createClob() throws SQLException {
95 public NClob createNClob() throws SQLException {
100 public SQLXML createSQLXML() throws SQLException {
105 public Statement createStatement() throws SQLException {
110 public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
115 public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)
116 throws SQLException {
121 public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
126 public boolean getAutoCommit() throws SQLException {
131 public String getCatalog() throws SQLException {
136 public Properties getClientInfo() throws SQLException {
141 public String getClientInfo(String name) throws SQLException {
146 public int getHoldability() throws SQLException {
151 public DatabaseMetaData getMetaData() throws SQLException {
156 public int getNetworkTimeout() throws SQLException {
161 public String getSchema() throws SQLException {
166 public int getTransactionIsolation() throws SQLException {
171 public Map<String, Class<?>> getTypeMap() throws SQLException {
176 public SQLWarning getWarnings() throws SQLException {
181 public boolean isClosed() throws SQLException {
186 public boolean isReadOnly() throws SQLException {
191 public boolean isValid(int timeout) throws SQLException {
196 public String nativeSQL(String sql) throws SQLException {
201 public CallableStatement prepareCall(String sql) throws SQLException {
206 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
211 public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency,
212 int resultSetHoldability) throws SQLException {
217 public PreparedStatement prepareStatement(String sql) throws SQLException {
222 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
227 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
232 public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
237 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency)
238 throws SQLException {
243 public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency,
244 int resultSetHoldability) throws SQLException {
249 public void releaseSavepoint(Savepoint savepoint) throws SQLException {
254 public void rollback() throws SQLException {
259 public void rollback(Savepoint savepoint) throws SQLException {
264 public void setAutoCommit(boolean autoCommit) throws SQLException {
269 public void setCatalog(String catalog) throws SQLException {
274 public void setClientInfo(Properties properties) throws SQLClientInfoException {
279 public void setClientInfo(String name, String value) throws SQLClientInfoException {
284 public void setHoldability(int holdability) throws SQLException {
289 public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
294 public void setReadOnly(boolean readOnly) throws SQLException {
299 public Savepoint setSavepoint() throws SQLException {
304 public Savepoint setSavepoint(String name) throws SQLException {
309 public void setSchema(String schema) throws SQLException {
314 public void setTransactionIsolation(int level) throws SQLException {
319 public void setTypeMap(Map<String, Class<?>> map) throws SQLException {