org.seasar.framework.mock.sql.MockXAConnection Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2004-2015 the Seasar Foundation and the Others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
package org.seasar.framework.mock.sql;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.ConnectionEventListener;
import javax.sql.StatementEventListener;
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
/**
* {@link XAConnection}用のモッククラスです。
*
* @author koichik
*/
public class MockXAConnection implements XAConnection {
private boolean closed = false;
public XAResource getXAResource() throws SQLException {
return null;
}
public void addConnectionEventListener(
final ConnectionEventListener listener) {
}
public void close() throws SQLException {
closed = true;
}
/**
* このXAConnection
が閉じている場合はtrue
を返します。
*
* @return このXAConnection
が閉じている場合はtrue
*/
public boolean isClosed() {
return closed;
}
/**
* このXAConnection
が閉じているかどうかを設定します。
*
* @param closed
* このXAConnection
が閉じているかどうか
*/
public void setClosed(final boolean closed) {
this.closed = closed;
}
public Connection getConnection() throws SQLException {
return new MockConnection();
}
public void removeConnectionEventListener(
final ConnectionEventListener listener) {
}
public void addStatementEventListener(StatementEventListener listener) {
// TODO Auto-generated method stub
}
public void removeStatementEventListener(StatementEventListener listener) {
// TODO Auto-generated method stub
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy