1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver;
20
21 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
22 import org.junit.Test;
23
24 import static org.junit.Assert.assertSame;
25 import static org.junit.Assert.assertTrue;
26
27
28
29
30 public class TestMetricsRegionServerSourceImpl {
31
32 @Test
33 public void testGetInstance() throws Exception {
34 MetricsRegionServerSourceFactory metricsRegionServerSourceFactory =
35 CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class);
36 MetricsRegionServerSource serverSource =
37 metricsRegionServerSourceFactory.createServer(null);
38 assertTrue(serverSource instanceof MetricsRegionServerSourceImpl);
39 assertSame(metricsRegionServerSourceFactory,
40 CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class));
41 }
42
43
44 @Test(expected = RuntimeException.class)
45 public void testNoGetRegionServerMetricsSourceImpl() throws Exception {
46
47
48 CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceImpl.class);
49 }
50 }