View Javadoc

1   /*
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  
20  package org.apache.hadoop.hbase.replication.regionserver.helper;
21  
22  import org.apache.hadoop.conf.Configuration;
23  import org.apache.hadoop.hbase.ChoreService;
24  import org.apache.hadoop.hbase.CoordinatedStateManager;
25  import org.apache.hadoop.hbase.Server;
26  import org.apache.hadoop.hbase.ServerName;
27  import org.apache.hadoop.hbase.client.ClusterConnection;
28  import org.apache.hadoop.hbase.zookeeper.MetaTableLocator;
29  import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
30  
31  public class DummyServer implements Server {
32    Configuration conf;
33    String hostname;
34    ZooKeeperWatcher zkw;
35  
36    public DummyServer(Configuration conf, String hostname, ZooKeeperWatcher zkw) {
37      this.conf = conf;
38      this.hostname = hostname;
39      this.zkw = zkw;
40    }
41  
42    @Override
43    public Configuration getConfiguration() {
44      return conf;
45    }
46  
47    @Override
48    public ZooKeeperWatcher getZooKeeper() {
49      return zkw;
50    }
51  
52    @Override
53    public CoordinatedStateManager getCoordinatedStateManager() {
54      return null;
55    }
56    @Override
57    public ClusterConnection getConnection() {
58      return null;
59    }
60  
61    @Override
62    public MetaTableLocator getMetaTableLocator() {
63      return null;
64    }
65  
66    @Override
67    public ServerName getServerName() {
68      return ServerName.valueOf(hostname, 1234, 1L);
69    }
70  
71    @Override
72    public void abort(String why, Throwable e) {
73      // To change body of implemented methods use File | Settings | File Templates.
74    }
75  
76    @Override
77    public boolean isAborted() {
78      return false;
79    }
80  
81    @Override
82    public void stop(String why) {
83      // To change body of implemented methods use File | Settings | File Templates.
84    }
85  
86    @Override
87    public boolean isStopped() {
88      return false; // To change body of implemented methods use File | Settings | File Templates.
89    }
90  
91    @Override
92    public ChoreService getChoreService() {
93      return null;
94    }
95  }