blob: 2bf95b043c97d3f464ca4d6c30e9570632bbd417 [file] [log] [blame]
// Copyright (C) 2015 The Android Open Source Project
//
// 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 com.google.gerrit.testing;
import com.google.gerrit.reviewdb.server.ChangeAccess;
import com.google.gerrit.reviewdb.server.ChangeMessageAccess;
import com.google.gerrit.reviewdb.server.PatchLineCommentAccess;
import com.google.gerrit.reviewdb.server.PatchSetAccess;
import com.google.gerrit.reviewdb.server.PatchSetApprovalAccess;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.reviewdb.server.SchemaVersionAccess;
import com.google.gwtorm.server.Access;
import com.google.gwtorm.server.StatementExecutor;
/** ReviewDb that is disabled for testing. */
public class DisabledReviewDb implements ReviewDb {
public static class Disabled extends RuntimeException {
private static final long serialVersionUID = 1L;
private Disabled() {
super("ReviewDb is disabled for this test");
}
}
@Override
public void close() {
// Do nothing.
}
@Override
public void commit() {
throw new Disabled();
}
@Override
public void rollback() {
throw new Disabled();
}
@Override
public void updateSchema(StatementExecutor e) {
throw new Disabled();
}
@Override
public void pruneSchema(StatementExecutor e) {
throw new Disabled();
}
@Override
public Access<?, ?>[] allRelations() {
throw new Disabled();
}
@Override
public SchemaVersionAccess schemaVersion() {
throw new Disabled();
}
@Override
public ChangeAccess changes() {
throw new Disabled();
}
@Override
public PatchSetApprovalAccess patchSetApprovals() {
throw new Disabled();
}
@Override
public ChangeMessageAccess changeMessages() {
throw new Disabled();
}
@Override
public PatchSetAccess patchSets() {
throw new Disabled();
}
@Override
public PatchLineCommentAccess patchComments() {
throw new Disabled();
}
@Override
public int nextAccountId() {
throw new Disabled();
}
@Override
public int nextAccountGroupId() {
throw new Disabled();
}
@Override
public int nextChangeId() {
throw new Disabled();
}
}