use of org.apache.kafka.streams.processor.internals.MockStreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class ThreadCacheTest method shouldReturnNullIfKeyIsNull.
@Test
public void shouldReturnNullIfKeyIsNull() {
final ThreadCache threadCache = new ThreadCache(logContext, 10, new MockStreamsMetrics(new Metrics()));
threadCache.put(namespace, Bytes.wrap(new byte[] { 1 }), cleanEntry(new byte[] { 1 }));
assertNull(threadCache.get(namespace, null));
}
use of org.apache.kafka.streams.processor.internals.MockStreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class ThreadCacheTest method shouldNotBlowUpOnNonExistentNamespaceWhenDeleting.
@Test
public void shouldNotBlowUpOnNonExistentNamespaceWhenDeleting() {
final ThreadCache cache = new ThreadCache(logContext, 10000L, new MockStreamsMetrics(new Metrics()));
assertNull(cache.delete(namespace, Bytes.wrap(new byte[] { 1 })));
}
use of org.apache.kafka.streams.processor.internals.MockStreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class ThreadCacheTest method shouldNotBlowUpOnNonExistentKeyWhenDeleting.
@Test
public void shouldNotBlowUpOnNonExistentKeyWhenDeleting() {
final Bytes key = Bytes.wrap(new byte[] { 0 });
final ThreadCache cache = new ThreadCache(logContext, 10000L, new MockStreamsMetrics(new Metrics()));
cache.put(namespace, key, dirtyEntry(key.get()));
assertNull(cache.delete(namespace, Bytes.wrap(new byte[] { 1 })));
}
use of org.apache.kafka.streams.processor.internals.MockStreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class ThreadCacheTest method shouldNotClashWithOverlappingNames.
@Test
public void shouldNotClashWithOverlappingNames() {
final ThreadCache cache = new ThreadCache(logContext, 10000L, new MockStreamsMetrics(new Metrics()));
final Bytes nameByte = Bytes.wrap(new byte[] { 0 });
final Bytes name1Byte = Bytes.wrap(new byte[] { 1 });
cache.put(namespace1, nameByte, dirtyEntry(nameByte.get()));
cache.put(namespace2, nameByte, dirtyEntry(name1Byte.get()));
assertArrayEquals(nameByte.get(), cache.get(namespace1, nameByte).value);
assertArrayEquals(name1Byte.get(), cache.get(namespace2, nameByte).value);
}
use of org.apache.kafka.streams.processor.internals.MockStreamsMetrics in project apache-kafka-on-k8s by banzaicloud.
the class ThreadCacheTest method shouldEvictImmediatelyIfCacheSizeIsZero.
@Test
public void shouldEvictImmediatelyIfCacheSizeIsZero() {
final ThreadCache cache = new ThreadCache(logContext, 0, new MockStreamsMetrics(new Metrics()));
shouldEvictImmediatelyIfCacheSizeIsZeroOrVerySmall(cache);
}
Aggregations