@Test public void bufferOverflow() throws Exception { System.setProperty("xroad.op-monitor-buffer.size", "2"); final Props props = Props.create(TestOpMonitoringBuffer.class); final TestActorRef<TestOpMonitoringBuffer> testActorRef = TestActorRef.create(ACTOR_SYSTEM, props, "testActorRef"); TestOpMonitoringBuffer opMonitoringBuffer = testActorRef.underlyingActor(); OpMonitoringData opMonitoringData = new OpMonitoringData( OpMonitoringData.SecurityServerType.CLIENT, 100); opMonitoringBuffer.store(opMonitoringData); opMonitoringBuffer.store(opMonitoringData); opMonitoringBuffer.store(opMonitoringData); assertEquals(2, opMonitoringBuffer.buffer.size()); assertEquals(true, opMonitoringBuffer.buffer.containsKey(2L)); assertEquals(true, opMonitoringBuffer.buffer.containsKey(3L)); }
@Override protected void store(OpMonitoringData data) throws Exception { if (ignoreOpMonitoringData()) { return; } data.setSecurityServerInternalIp(getIpAddress()); buffer.put(getNextBufferIndex(), data); send(); }
OpMonitoringBuffer extends AbstractOpMonitoringBuffer { @Override protected void store(OpMonitoringData data) throws Exception { if (ignoreOpMonitoringData()) { return; } data.setSecurityServerInternalIp(getIpAddress()); buffer.put(getNextBufferIndex(), data); send(); } }
OpMonitoringBuffer extends AbstractOpMonitoringBuffer { @Override protected void store(OpMonitoringData data) throws Exception { if (ignoreOpMonitoringData()) { return; } data.setSecurityServerInternalIp(getIpAddress()); buffer.put(getNextBufferIndex(), data); send(); } OpMonitoringBuffer(); }
OpMonitoringBuffer extends AbstractOpMonitoringBuffer { @Override protected void store(OpMonitoringData data) throws Exception { if (ignoreOpMonitoringData()) { return; } data.setSecurityServerInternalIp(getIpAddress()); buffer.put(getNextBufferIndex(), data); send(); } OpMonitoringBuffer(); @Override void preStart(); @Override void postStop(); }
OpMonitoringBuffer extends AbstractOpMonitoringBuffer { @Override protected void store(OpMonitoringData data) throws Exception { if (ignoreOpMonitoringData()) { return; } data.setSecurityServerInternalIp(getIpAddress()); buffer.put(getNextBufferIndex(), data); send(); } OpMonitoringBuffer(); @Override void preStart(); @Override void postStop(); static final String OP_MONITORING_DAEMON_SENDER; }