Search in sources :

Example 6 with MockRecordCollector

use of org.apache.kafka.test.MockRecordCollector in project kafka by apache.

the class CompositeReadOnlyKeyValueStoreTest method newStoreInstance.

private KeyValueStore<String, String> newStoreInstance() {
    final KeyValueStore<String, String> store = Stores.keyValueStoreBuilder(Stores.inMemoryKeyValueStore(storeName), Serdes.String(), Serdes.String()).build();
    @SuppressWarnings("rawtypes") final InternalMockProcessorContext context = new InternalMockProcessorContext<>(new StateSerdes<>(ProcessorStateManager.storeChangelogTopic("appId", storeName, null), Serdes.String(), Serdes.String()), new MockRecordCollector());
    context.setTime(1L);
    store.init((StateStoreContext) context, store);
    return store;
}
Also used : MockRecordCollector(org.apache.kafka.test.MockRecordCollector) InternalMockProcessorContext(org.apache.kafka.test.InternalMockProcessorContext)

Example 7 with MockRecordCollector

use of org.apache.kafka.test.MockRecordCollector in project kafka by apache.

the class ListValueStoreTest method setup.

@Before
public void setup() {
    listStore = buildStore(Serdes.Integer(), Serdes.String());
    final MockRecordCollector recordCollector = new MockRecordCollector();
    final InternalMockProcessorContext<Integer, String> context = new InternalMockProcessorContext<>(baseDir, Serdes.String(), Serdes.Integer(), recordCollector, new ThreadCache(new LogContext("testCache"), 0, new MockStreamsMetrics(new Metrics())));
    context.setTime(1L);
    listStore.init((StateStoreContext) context, listStore);
}
Also used : MockStreamsMetrics(org.apache.kafka.streams.processor.internals.MockStreamsMetrics) Metrics(org.apache.kafka.common.metrics.Metrics) MockRecordCollector(org.apache.kafka.test.MockRecordCollector) LogContext(org.apache.kafka.common.utils.LogContext) MockStreamsMetrics(org.apache.kafka.streams.processor.internals.MockStreamsMetrics) InternalMockProcessorContext(org.apache.kafka.test.InternalMockProcessorContext) Before(org.junit.Before)

Example 8 with MockRecordCollector

use of org.apache.kafka.test.MockRecordCollector in project kafka by apache.

the class KeyValueSegmentsTest method createContext.

@Before
public void createContext() {
    stateDirectory = TestUtils.tempDirectory();
    context = new InternalMockProcessorContext<>(stateDirectory, Serdes.String(), Serdes.Long(), new MockRecordCollector(), new ThreadCache(new LogContext("testCache "), 0, new MockStreamsMetrics(new Metrics())));
    segments = new KeyValueSegments(storeName, METRICS_SCOPE, RETENTION_PERIOD, SEGMENT_INTERVAL);
    segments.openExisting(context, -1L);
}
Also used : MockStreamsMetrics(org.apache.kafka.streams.processor.internals.MockStreamsMetrics) Metrics(org.apache.kafka.common.metrics.Metrics) MockRecordCollector(org.apache.kafka.test.MockRecordCollector) LogContext(org.apache.kafka.common.utils.LogContext) MockStreamsMetrics(org.apache.kafka.streams.processor.internals.MockStreamsMetrics) Before(org.junit.Before)

Example 9 with MockRecordCollector

use of org.apache.kafka.test.MockRecordCollector in project kafka by apache.

the class TimeOrderedKeyValueBufferTest method makeContext.

private static MockInternalProcessorContext makeContext() {
    final Properties properties = new Properties();
    properties.setProperty(StreamsConfig.APPLICATION_ID_CONFIG, APP_ID);
    properties.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "");
    final TaskId taskId = new TaskId(0, 0);
    final MockInternalProcessorContext context = new MockInternalProcessorContext(properties, taskId, TestUtils.tempDirectory());
    context.setRecordCollector(new MockRecordCollector());
    return context;
}
Also used : TaskId(org.apache.kafka.streams.processor.TaskId) MockRecordCollector(org.apache.kafka.test.MockRecordCollector) MockInternalProcessorContext(org.apache.kafka.test.MockInternalProcessorContext) Properties(java.util.Properties)

Example 10 with MockRecordCollector

use of org.apache.kafka.test.MockRecordCollector in project kafka by apache.

the class TimestampedSegmentsTest method createContext.

@Before
public void createContext() {
    stateDirectory = TestUtils.tempDirectory();
    context = new InternalMockProcessorContext<>(stateDirectory, Serdes.String(), Serdes.Long(), new MockRecordCollector(), new ThreadCache(new LogContext("testCache "), 0, new MockStreamsMetrics(new Metrics())));
    segments = new TimestampedSegments(storeName, METRICS_SCOPE, RETENTION_PERIOD, SEGMENT_INTERVAL);
    segments.openExisting(context, -1L);
}
Also used : MockStreamsMetrics(org.apache.kafka.streams.processor.internals.MockStreamsMetrics) Metrics(org.apache.kafka.common.metrics.Metrics) MockRecordCollector(org.apache.kafka.test.MockRecordCollector) LogContext(org.apache.kafka.common.utils.LogContext) MockStreamsMetrics(org.apache.kafka.streams.processor.internals.MockStreamsMetrics) Before(org.junit.Before)

Aggregations

MockRecordCollector (org.apache.kafka.test.MockRecordCollector)10 Metrics (org.apache.kafka.common.metrics.Metrics)7 LogContext (org.apache.kafka.common.utils.LogContext)7 MockStreamsMetrics (org.apache.kafka.streams.processor.internals.MockStreamsMetrics)7 Before (org.junit.Before)7 Properties (java.util.Properties)2 TaskId (org.apache.kafka.streams.processor.TaskId)2 InternalMockProcessorContext (org.apache.kafka.test.InternalMockProcessorContext)2 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Arrays.asList (java.util.Arrays.asList)1 Collection (java.util.Collection)1 Collections.singletonList (java.util.Collections.singletonList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Optional (java.util.Optional)1 Random (java.util.Random)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Function (java.util.function.Function)1