LCOV - code coverage report
Current view: top level - acceptance - DisabledAccountIndex.java (source / functions) Hit Total Coverage
Test: _coverage_report.dat Lines: 5 13 38.5 %
Date: 2022-11-19 15:00:39 Functions: 3 10 30.0 %

          Line data    Source code
       1             : // Copyright (C) 2018 The Android Open Source Project
       2             : //
       3             : // Licensed under the Apache License, Version 2.0 (the "License");
       4             : // you may not use this file except in compliance with the License.
       5             : // You may obtain a copy of the License at
       6             : //
       7             : // http://www.apache.org/licenses/LICENSE-2.0
       8             : //
       9             : // Unless required by applicable law or agreed to in writing, software
      10             : // distributed under the License is distributed on an "AS IS" BASIS,
      11             : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      12             : // See the License for the specific language governing permissions and
      13             : // limitations under the License.
      14             : 
      15             : package com.google.gerrit.acceptance;
      16             : 
      17             : import com.google.gerrit.entities.Account;
      18             : import com.google.gerrit.index.QueryOptions;
      19             : import com.google.gerrit.index.Schema;
      20             : import com.google.gerrit.index.query.DataSource;
      21             : import com.google.gerrit.index.query.Predicate;
      22             : import com.google.gerrit.server.account.AccountState;
      23             : import com.google.gerrit.server.index.account.AccountIndex;
      24             : 
      25             : /** This class wraps an index and assumes the search index can't handle any queries. */
      26             : public class DisabledAccountIndex implements AccountIndex {
      27             :   private final AccountIndex index;
      28             : 
      29           2 :   public DisabledAccountIndex(AccountIndex index) {
      30           2 :     this.index = index;
      31           2 :   }
      32             : 
      33             :   public AccountIndex unwrap() {
      34           2 :     return index;
      35             :   }
      36             : 
      37             :   @Override
      38             :   public Schema<AccountState> getSchema() {
      39           2 :     return index.getSchema();
      40             :   }
      41             : 
      42             :   @Override
      43             :   public void close() {
      44           0 :     index.close();
      45           0 :   }
      46             : 
      47             :   @Override
      48             :   public void insert(AccountState obj) {
      49           0 :     throw new UnsupportedOperationException("AccountIndex is disabled");
      50             :   }
      51             : 
      52             :   @Override
      53             :   public void replace(AccountState obj) {
      54           0 :     throw new UnsupportedOperationException("AccountIndex is disabled");
      55             :   }
      56             : 
      57             :   @Override
      58             :   public void delete(Account.Id key) {
      59           0 :     throw new UnsupportedOperationException("AccountIndex is disabled");
      60             :   }
      61             : 
      62             :   @Override
      63             :   public void deleteAll() {
      64           0 :     throw new UnsupportedOperationException("AccountIndex is disabled");
      65             :   }
      66             : 
      67             :   @Override
      68             :   public DataSource<AccountState> getSource(Predicate<AccountState> p, QueryOptions opts) {
      69           0 :     throw new UnsupportedOperationException("AccountIndex is disabled");
      70             :   }
      71             : 
      72             :   @Override
      73             :   public void markReady(boolean ready) {
      74           0 :     throw new UnsupportedOperationException("AccountIndex is disabled");
      75             :   }
      76             : }

Generated by: LCOV version 1.16+git.20220603.dfeb750