assertEquals(null, throttle.getNamespace()); assertEquals(null, throttle.getRegionServer()); assertEquals(6, throttle.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttle.getTimeUnit()); countThrottle++;
count++; if (throttleSettings.getThrottleType() == ThrottleType.REQUEST_NUMBER) { assertEquals(20, throttleSettings.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttleSettings.getTimeUnit()); } else if (throttleSettings.getThrottleType() == ThrottleType.READ_NUMBER) { assertEquals(30, throttleSettings.getSoftLimit()); assertEquals(TimeUnit.SECONDS, throttleSettings.getTimeUnit());
case THROTTLE: ThrottleSettings throttle = (ThrottleSettings)settings; if (throttle.getSoftLimit() == 6) { assertEquals(ThrottleType.READ_NUMBER, throttle.getThrottleType()); } else if (throttle.getSoftLimit() == 12) { assertEquals(ThrottleType.WRITE_NUMBER, throttle.getThrottleType()); } else {
@Test public void testMerge() throws IOException { TimedQuota tq1 = TimedQuota.newBuilder().setSoftLimit(10) .setScope(QuotaProtos.QuotaScope.MACHINE) .setTimeUnit(HBaseProtos.TimeUnit.MINUTES).build(); ThrottleRequest tr1 = ThrottleRequest.newBuilder().setTimedQuota(tq1) .setType(QuotaProtos.ThrottleType.REQUEST_NUMBER).build(); ThrottleSettings orig = new ThrottleSettings("joe", null, null, null, tr1); TimedQuota tq2 = TimedQuota.newBuilder().setSoftLimit(10) .setScope(QuotaProtos.QuotaScope.MACHINE) .setTimeUnit(HBaseProtos.TimeUnit.SECONDS).build(); ThrottleRequest tr2 = ThrottleRequest.newBuilder().setTimedQuota(tq2) .setType(QuotaProtos.ThrottleType.REQUEST_NUMBER).build(); ThrottleSettings merged = orig.merge(new ThrottleSettings("joe", null, null, null, tr2)); assertEquals(10, merged.getSoftLimit()); assertEquals(ThrottleType.REQUEST_NUMBER, merged.getThrottleType()); assertEquals(TimeUnit.SECONDS, merged.getTimeUnit()); }
case READ_NUMBER: assertFalse("Should not have multiple read quotas", seenRead); assertEquals(readLimit, throttleSettings.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttleSettings.getTimeUnit()); assertEquals(tn, throttleSettings.getTableName()); case WRITE_NUMBER: assertFalse("Should not have multiple write quotas", seenWrite); assertEquals(writeLimit, throttleSettings.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttleSettings.getTimeUnit()); assertEquals(tn, throttleSettings.getTableName());
@Test public void testMerge() throws IOException { TimedQuota tq1 = TimedQuota.newBuilder().setSoftLimit(10) .setScope(QuotaProtos.QuotaScope.MACHINE) .setTimeUnit(HBaseProtos.TimeUnit.MINUTES).build(); ThrottleRequest tr1 = ThrottleRequest.newBuilder().setTimedQuota(tq1) .setType(QuotaProtos.ThrottleType.REQUEST_NUMBER).build(); ThrottleSettings orig = new ThrottleSettings("joe", null, null, tr1); TimedQuota tq2 = TimedQuota.newBuilder().setSoftLimit(10) .setScope(QuotaProtos.QuotaScope.MACHINE) .setTimeUnit(HBaseProtos.TimeUnit.SECONDS).build(); ThrottleRequest tr2 = ThrottleRequest.newBuilder().setTimedQuota(tq2) .setType(QuotaProtos.ThrottleType.REQUEST_NUMBER).build(); ThrottleSettings merged = orig.merge(new ThrottleSettings("joe", null, null, tr2)); assertEquals(10, merged.getSoftLimit()); assertEquals(ThrottleType.REQUEST_NUMBER, merged.getThrottleType()); assertEquals(TimeUnit.SECONDS, merged.getTimeUnit()); }
case READ_NUMBER: assertFalse("Should not have multiple read quotas", seenRead); assertEquals(readLimit, throttleSettings.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttleSettings.getTimeUnit()); assertEquals(tn, throttleSettings.getTableName()); case WRITE_NUMBER: assertFalse("Should not have multiple write quotas", seenWrite); assertEquals(writeLimit, throttleSettings.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttleSettings.getTimeUnit()); assertEquals(tn, throttleSettings.getTableName());
assertEquals(null, throttle.getTableName()); assertEquals(null, throttle.getNamespace()); assertEquals(6, throttle.getSoftLimit()); assertEquals(TimeUnit.MINUTES, throttle.getTimeUnit()); countThrottle++;
case THROTTLE: ThrottleSettings throttle = (ThrottleSettings)settings; if (throttle.getSoftLimit() == 6) { assertEquals(ThrottleType.READ_NUMBER, throttle.getThrottleType()); } else if (throttle.getSoftLimit() == 12) { assertEquals(ThrottleType.WRITE_NUMBER, throttle.getThrottleType()); } else {