@Test public void shouldStoreRawData() { final int typeIdOne = 333; final long keyOne = 777L; final MutableDirectBuffer keyOneBuffer = new UnsafeBuffer(ByteBuffer.allocateDirect(8)); keyOneBuffer.putLong(0, keyOne); final DirectBuffer labelOneBuffer = new UnsafeBuffer("Test Label One".getBytes(US_ASCII)); final int typeIdTwo = 222; final long keyTwo = 444; final MutableDirectBuffer keyTwoBuffer = new UnsafeBuffer(ByteBuffer.allocateDirect(8)); keyTwoBuffer.putLong(0, keyTwo); final DirectBuffer labelTwoBuffer = new UnsafeBuffer("Test Label Two".getBytes(US_ASCII)); final int counterIdOne = manager.allocate( typeIdOne, keyOneBuffer, 0, keyOneBuffer.capacity(), labelOneBuffer, 0, labelOneBuffer.capacity()); final int counterIdTwo = manager.allocate( typeIdTwo, keyTwoBuffer, 0, keyTwoBuffer.capacity(), labelTwoBuffer, 0, labelTwoBuffer.capacity()); manager.forEach(metaData); final ArgumentCaptor<DirectBuffer> argCaptorOne = ArgumentCaptor.forClass(DirectBuffer.class); final ArgumentCaptor<DirectBuffer> argCaptorTwo = ArgumentCaptor.forClass(DirectBuffer.class); final InOrder inOrder = Mockito.inOrder(metaData); inOrder.verify(metaData).accept(eq(counterIdOne), eq(typeIdOne), argCaptorOne.capture(), eq("Test Label One")); inOrder.verify(metaData).accept(eq(counterIdTwo), eq(typeIdTwo), argCaptorTwo.capture(), eq("Test Label Two")); inOrder.verifyNoMoreInteractions(); final DirectBuffer keyOneBufferCapture = argCaptorOne.getValue(); assertThat(keyOneBufferCapture.getLong(0), is(keyOne)); final DirectBuffer keyTwoBufferCapture = argCaptorTwo.getValue(); assertThat(keyTwoBufferCapture.getLong(0), is(keyTwo)); }
public int allocate(final String label) { return allocate(label, DEFAULT_TYPE_ID); }
CountersManager extends CountersReader { public int allocate(final String label) { return allocate(label, DEFAULT_TYPE_ID); } }
CountersManager extends CountersReader { public int allocate(final String label) { return allocate(label, DEFAULT_TYPE_ID); } CountersManager(
        final AtomicBuffer metaDataBuffer,
        final AtomicBuffer valuesBuffer,
        final Charset labelCharset,
        final EpochClock epochClock,
        final long freeToReuseTimeoutMs);  CountersManager(
        final AtomicBuffer metaDataBuffer, final AtomicBuffer valuesBuffer, final Charset labelCharset);  CountersManager(final AtomicBuffer metaDataBuffer, final AtomicBuffer valuesBuffer); }
CountersManager extends CountersReader { public int allocate(final String label) { return allocate(label, DEFAULT_TYPE_ID); } CountersManager(
        final AtomicBuffer metaDataBuffer,
        final AtomicBuffer valuesBuffer,
        final Charset labelCharset,
        final EpochClock epochClock,
        final long freeToReuseTimeoutMs);  CountersManager(
        final AtomicBuffer metaDataBuffer, final AtomicBuffer valuesBuffer, final Charset labelCharset);  CountersManager(final AtomicBuffer metaDataBuffer, final AtomicBuffer valuesBuffer); int allocate(final String label); int allocate(final String label, final int typeId); int allocate(final String label, final int typeId, final Consumer<MutableDirectBuffer> keyFunc); int allocate(
        final int typeId,
        final DirectBuffer keyBuffer,
        final int keyOffset,
        final int keyLength,
        final DirectBuffer labelBuffer,
        final int labelOffset,
        final int labelLength); AtomicCounter newCounter(final String label); AtomicCounter newCounter(final String label, final int typeId); AtomicCounter newCounter(final String label, final int typeId, final Consumer<MutableDirectBuffer> keyFunc); AtomicCounter newCounter(
        final int typeId,
        final DirectBuffer keyBuffer,
        final int keyOffset,
        final int keyLength,
        final DirectBuffer labelBuffer,
        final int labelOffset,
        final int labelLength); void free(final int counterId); void setCounterValue(final int counterId, final long value); void setCounterRegistrationId(final int counterId, final long registrationId); void setCounterOwnerId(final int counterId, final long ownerId); void setCounterLabel(final int counterId, final String label); void setCounterKey(final int counterId, final Consumer<MutableDirectBuffer> keyFunc); void setCounterKey(final int counterId, final DirectBuffer keyBuffer, final int offset, final int length); void appendToLabel(final int counterId, final String label); }
CountersManager extends CountersReader { public int allocate(final String label) { return allocate(label, DEFAULT_TYPE_ID); } CountersManager(
        final AtomicBuffer metaDataBuffer,
        final AtomicBuffer valuesBuffer,
        final Charset labelCharset,
        final EpochClock epochClock,
        final long freeToReuseTimeoutMs);  CountersManager(
        final AtomicBuffer metaDataBuffer, final AtomicBuffer valuesBuffer, final Charset labelCharset);  CountersManager(final AtomicBuffer metaDataBuffer, final AtomicBuffer valuesBuffer); int allocate(final String label); int allocate(final String label, final int typeId); int allocate(final String label, final int typeId, final Consumer<MutableDirectBuffer> keyFunc); int allocate(
        final int typeId,
        final DirectBuffer keyBuffer,
        final int keyOffset,
        final int keyLength,
        final DirectBuffer labelBuffer,
        final int labelOffset,
        final int labelLength); AtomicCounter newCounter(final String label); AtomicCounter newCounter(final String label, final int typeId); AtomicCounter newCounter(final String label, final int typeId, final Consumer<MutableDirectBuffer> keyFunc); AtomicCounter newCounter(
        final int typeId,
        final DirectBuffer keyBuffer,
        final int keyOffset,
        final int keyLength,
        final DirectBuffer labelBuffer,
        final int labelOffset,
        final int labelLength); void free(final int counterId); void setCounterValue(final int counterId, final long value); void setCounterRegistrationId(final int counterId, final long registrationId); void setCounterOwnerId(final int counterId, final long ownerId); void setCounterLabel(final int counterId, final String label); void setCounterKey(final int counterId, final Consumer<MutableDirectBuffer> keyFunc); void setCounterKey(final int counterId, final DirectBuffer keyBuffer, final int offset, final int length); void appendToLabel(final int counterId, final String label);  }