1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.thrift;
20
21 import org.apache.hadoop.hbase.CompatibilitySingletonFactory;
22 import org.apache.hadoop.hbase.testclassification.SmallTests;
23 import org.apache.hadoop.hbase.testclassification.MetricsTests;
24 import org.apache.hadoop.hbase.thrift.MetricsThriftServerSourceFactory;
25 import org.apache.hadoop.hbase.thrift.MetricsThriftServerSourceFactoryImpl;
26 import org.junit.Test;
27 import org.junit.experimental.categories.Category;
28
29 import static org.junit.Assert.assertNotNull;
30 import static org.junit.Assert.assertSame;
31 import static org.junit.Assert.assertTrue;
32
33
34
35
36 @Category({MetricsTests.class, SmallTests.class})
37 public class TestMetricsThriftServerSourceFactoryImpl {
38
39 @Test
40 public void testCompatabilityRegistered() throws Exception {
41 assertNotNull(CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class));
42 assertTrue(CompatibilitySingletonFactory.getInstance(MetricsThriftServerSourceFactory.class) instanceof MetricsThriftServerSourceFactoryImpl);
43 }
44
45 @Test
46 public void testCreateThriftOneSource() throws Exception {
47
48 assertSame(new MetricsThriftServerSourceFactoryImpl().createThriftOneSource(),
49 new MetricsThriftServerSourceFactoryImpl().createThriftOneSource());
50
51 }
52
53 @Test
54 public void testCreateThriftTwoSource() throws Exception {
55
56 assertSame(new MetricsThriftServerSourceFactoryImpl().createThriftTwoSource(),
57 new MetricsThriftServerSourceFactoryImpl().createThriftTwoSource());
58 }
59 }