@Test public void testCompareTo() throws Exception { MetricsRegionServerSourceFactory fact = CompatibilitySingletonFactory.getInstance(MetricsRegionServerSourceFactory.class); MetricsRegionSource one = fact.createRegion(new RegionWrapperStub("TEST")); MetricsRegionSource oneClone = fact.createRegion(new RegionWrapperStub("TEST")); MetricsRegionSource two = fact.createRegion(new RegionWrapperStub("TWO")); assertEquals(0, one.compareTo(oneClone)); assertTrue( one.compareTo(two) < 0); assertTrue( two.compareTo(one) > 0); }
@Override public int compareTo(MetricsRegionSource source) { if (!(source instanceof MetricsRegionSourceImpl)) return -1; MetricsRegionSourceImpl impl = (MetricsRegionSourceImpl) source; return this.regionWrapper.getRegionName() .compareTo(impl.regionWrapper.getRegionName()); }
MetricsRegionSourceImpl implements MetricsRegionSource { @Override public int compareTo(MetricsRegionSource source) { if (!(source instanceof MetricsRegionSourceImpl)) return -1; MetricsRegionSourceImpl impl = (MetricsRegionSourceImpl) source; return this.regionWrapper.getRegionName() .compareTo(impl.regionWrapper.getRegionName()); } }
MetricsRegionSourceImpl implements MetricsRegionSource { @Override public int compareTo(MetricsRegionSource source) { if (!(source instanceof MetricsRegionSourceImpl)) return -1; MetricsRegionSourceImpl impl = (MetricsRegionSourceImpl) source; return this.regionWrapper.getRegionName() .compareTo(impl.regionWrapper.getRegionName()); } MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
                                 MetricsRegionAggregateSourceImpl aggregate); }
MetricsRegionSourceImpl implements MetricsRegionSource { @Override public int compareTo(MetricsRegionSource source) { if (!(source instanceof MetricsRegionSourceImpl)) return -1; MetricsRegionSourceImpl impl = (MetricsRegionSourceImpl) source; return this.regionWrapper.getRegionName() .compareTo(impl.regionWrapper.getRegionName()); } MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
                                 MetricsRegionAggregateSourceImpl aggregate); @Override void close(); @Override void updatePut(); @Override void updateDelete(); @Override void updateGet(long getSize); @Override void updateScan(long scanSize); @Override void updateIncrement(); @Override void updateAppend(); @Override MetricsRegionAggregateSource getAggregateSource(); @Override int compareTo(MetricsRegionSource source); @Override boolean equals(Object obj); }
MetricsRegionSourceImpl implements MetricsRegionSource { @Override public int compareTo(MetricsRegionSource source) { if (!(source instanceof MetricsRegionSourceImpl)) return -1; MetricsRegionSourceImpl impl = (MetricsRegionSourceImpl) source; return this.regionWrapper.getRegionName() .compareTo(impl.regionWrapper.getRegionName()); } MetricsRegionSourceImpl(MetricsRegionWrapper regionWrapper,
                                 MetricsRegionAggregateSourceImpl aggregate); @Override void close(); @Override void updatePut(); @Override void updateDelete(); @Override void updateGet(long getSize); @Override void updateScan(long scanSize); @Override void updateIncrement(); @Override void updateAppend(); @Override MetricsRegionAggregateSource getAggregateSource(); @Override int compareTo(MetricsRegionSource source); @Override boolean equals(Object obj);  }