当前位置: 首页>>代码示例>>Java>>正文


Java MetricsReplicationSourceImpl类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceImpl的典型用法代码示例。如果您正苦于以下问题:Java MetricsReplicationSourceImpl类的具体用法?Java MetricsReplicationSourceImpl怎么用?Java MetricsReplicationSourceImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MetricsReplicationSourceImpl类属于org.apache.hadoop.hbase.replication.regionserver包,在下文中一共展示了MetricsReplicationSourceImpl类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testGetInstance

import org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceImpl; //导入依赖的package包/类
@Test
public void testGetInstance() throws Exception {
  MetricsReplicationSource rms = CompatibilitySingletonFactory
      .getInstance(MetricsReplicationSource.class);
  assertTrue(rms instanceof MetricsReplicationSourceImpl);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:7,代码来源:TestMetricsReplicationSourceImpl.java

示例2: testMetricsSourceBaseSourcePassthrough

import org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceImpl; //导入依赖的package包/类
@Test
public void testMetricsSourceBaseSourcePassthrough(){
  /*
  The replication MetricsSource wraps a MetricsReplicationSourceSourceImpl
  and a MetricsReplicationGlobalSourceSource, so that metrics get written to both namespaces.
  Both of those classes wrap a MetricsReplicationSourceImpl that implements BaseSource, which
  allows for custom JMX metrics.
  This test checks to make sure the BaseSource decorator logic on MetricsSource actually calls down through
  the two layers of wrapping to the actual BaseSource.
  */
  String id = "id";
  DynamicMetricsRegistry mockRegistry = mock(DynamicMetricsRegistry.class);
  MetricsReplicationSourceImpl singleRms = mock(MetricsReplicationSourceImpl.class);
  when(singleRms.getMetricsRegistry()).thenReturn(mockRegistry);
  MetricsReplicationSourceImpl globalRms = mock(MetricsReplicationSourceImpl.class);
  when(globalRms.getMetricsRegistry()).thenReturn(mockRegistry);

  MetricsReplicationSourceSource singleSourceSource = new MetricsReplicationSourceSourceImpl(singleRms, id);
  MetricsReplicationSourceSource globalSourceSource = new MetricsReplicationGlobalSourceSource(globalRms);
  MetricsSource source = new MetricsSource(id, singleSourceSource, globalSourceSource);
  String gaugeName = "gauge";
  String singleGaugeName = "source.id." + gaugeName;
  String globalGaugeName = "source." + gaugeName;
  long delta = 1;
  String counterName = "counter";
  String singleCounterName = "source.id." + counterName;
  String globalCounterName = "source." + counterName;
  long count = 2;
  source.decGauge(gaugeName, delta);
  source.getMetricsContext();
  source.getMetricsDescription();
  source.getMetricsJmxContext();
  source.getMetricsName();
  source.incCounters(counterName, count);
  source.incGauge(gaugeName, delta);
  source.init();
  source.removeMetric(gaugeName);
  source.setGauge(gaugeName, delta);
  source.updateHistogram(counterName, count);

  verify(singleRms).decGauge(singleGaugeName, delta);
  verify(globalRms).decGauge(globalGaugeName, delta);
  verify(globalRms).getMetricsContext();
  verify(globalRms).getMetricsJmxContext();
  verify(globalRms).getMetricsName();
  verify(singleRms).incCounters(singleCounterName, count);
  verify(globalRms).incCounters(globalCounterName, count);
  verify(singleRms).incGauge(singleGaugeName, delta);
  verify(globalRms).incGauge(globalGaugeName, delta);
  verify(globalRms).init();
  verify(singleRms).removeMetric(singleGaugeName);
  verify(globalRms).removeMetric(globalGaugeName);
  verify(singleRms).setGauge(singleGaugeName, delta);
  verify(globalRms).setGauge(globalGaugeName, delta);
  verify(singleRms).updateHistogram(singleCounterName, count);
  verify(globalRms).updateHistogram(globalCounterName, count);
}
 
开发者ID:apache,项目名称:hbase,代码行数:58,代码来源:TestReplicationEndpoint.java


注:本文中的org.apache.hadoop.hbase.replication.regionserver.MetricsReplicationSourceImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。