@Test public void shouldAddTwoBytesAndSchedule() throws Exception { target.event( new EventScheduler() { @Override public void schedule(long delay, TimeUnit timeUnit) { assertEquals(1000, timeUnit.toMillis(delay)); schedules++; } }, new EventAdder() { @Override public void add(byte[] event) { assertEquals(2, event.length); adds++; } } ); assertEquals(1, schedules); assertEquals(1, adds); }
@Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longValue(); adder.add(Util.twoLeastSignificantBytes(convertedValue)); scheduler.schedule(1000, TimeUnit.MILLISECONDS); }
LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longValue(); adder.add(Util.twoLeastSignificantBytes(convertedValue)); scheduler.schedule(1000, TimeUnit.MILLISECONDS); } }
LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longValue(); adder.add(Util.twoLeastSignificantBytes(convertedValue)); scheduler.schedule(1000, TimeUnit.MILLISECONDS); }  }
LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longValue(); adder.add(Util.twoLeastSignificantBytes(convertedValue)); scheduler.schedule(1000, TimeUnit.MILLISECONDS); }  @Override void event(EventScheduler scheduler, EventAdder adder); }
LoadAverageEntropySource implements EntropySource { @Override public void event(EventScheduler scheduler, EventAdder adder) { double systemLoadAverage = operatingSystemMXBean.getSystemLoadAverage(); BigDecimal value = BigDecimal.valueOf(systemLoadAverage); long convertedValue = value.movePointRight(value.scale()).longValue(); adder.add(Util.twoLeastSignificantBytes(convertedValue)); scheduler.schedule(1000, TimeUnit.MILLISECONDS); }  @Override void event(EventScheduler scheduler, EventAdder adder);  }