src_fm_fc_ms_ff stringlengths 43 86.8k | target stringlengths 20 276k |
|---|---|
WindowKeySchema implements RocksDBSegmentedBytesStore.KeySchema { @Override public Bytes lowerRange(final Bytes key, final long from) { return OrderedBytes.lowerRange(key, MIN_SUFFIX); } @Override void init(final String topic); @Override Bytes upperRange(final Bytes key, final long to); @Override Bytes lowerRange(fina... | @Test public void testLowerBoundWithZeroTimestamp() throws Exception { Bytes lower = windowKeySchema.lowerRange(Bytes.wrap(new byte[]{0xA, 0xB, 0xC}), 0); assertThat(lower, equalTo(WindowStoreUtils.toBinaryKey(new byte[]{0xA, 0xB, 0xC}, 0, 0))); }
@Test public void testLowerBoundWithMonZeroTimestamp() throws Exception ... |
DelegatingPeekingKeyValueIterator implements KeyValueIterator<K, V>, PeekingKeyValueIterator<K, V> { @Override public synchronized KeyValue<K, V> next() { if (!hasNext()) { throw new NoSuchElementException(); } final KeyValue<K, V> result = next; next = null; return result; } DelegatingPeekingKeyValueIterator(final Str... | @Test(expected = NoSuchElementException.class) public void shouldThrowNoSuchElementWhenNoMoreItemsLeftAndNextCalled() throws Exception { final DelegatingPeekingKeyValueIterator<String, String> peekingIterator = new DelegatingPeekingKeyValueIterator<>(name, store.all()); peekingIterator.next(); } |
DelegatingPeekingKeyValueIterator implements KeyValueIterator<K, V>, PeekingKeyValueIterator<K, V> { @Override public synchronized K peekNextKey() { if (!hasNext()) { throw new NoSuchElementException(); } return next.key; } DelegatingPeekingKeyValueIterator(final String storeName, final KeyValueIterator<K, V> underlyin... | @Test(expected = NoSuchElementException.class) public void shouldThrowNoSuchElementWhenNoMoreItemsLeftAndPeekNextCalled() throws Exception { final DelegatingPeekingKeyValueIterator<String, String> peekingIterator = new DelegatingPeekingKeyValueIterator<>(name, store.all()); peekingIterator.peekNextKey(); } |
CompositeReadOnlyKeyValueStore implements ReadOnlyKeyValueStore<K, V> { @Override public V get(final K key) { final List<ReadOnlyKeyValueStore<K, V>> stores = storeProvider.stores(storeName, storeType); for (ReadOnlyKeyValueStore<K, V> store : stores) { try { final V result = store.get(key); if (result != null) { retur... | @Test public void shouldReturnNullIfKeyDoesntExist() throws Exception { assertNull(theStore.get("whatever")); }
@Test public void shouldReturnValueIfExists() throws Exception { stubOneUnderlying.put("key", "value"); assertEquals("value", theStore.get("key")); }
@Test public void shouldNotGetValuesFromOtherStores() thro... |
CompositeReadOnlyKeyValueStore implements ReadOnlyKeyValueStore<K, V> { @Override public KeyValueIterator<K, V> range(final K from, final K to) { final NextIteratorFunction<K, V> nextIteratorFunction = new NextIteratorFunction<K, V>() { @Override public KeyValueIterator<K, V> apply(final ReadOnlyKeyValueStore<K, V> sto... | @Test public void shouldSupportRange() throws Exception { stubOneUnderlying.put("a", "a"); stubOneUnderlying.put("b", "b"); stubOneUnderlying.put("c", "c"); final List<KeyValue<String, String>> results = toList(theStore.range("a", "b")); assertTrue(results.contains(new KeyValue<>("a", "a"))); assertTrue(results.contain... |
CompositeReadOnlyKeyValueStore implements ReadOnlyKeyValueStore<K, V> { @Override public KeyValueIterator<K, V> all() { final NextIteratorFunction<K, V> nextIteratorFunction = new NextIteratorFunction<K, V>() { @Override public KeyValueIterator<K, V> apply(final ReadOnlyKeyValueStore<K, V> store) { try { return store.a... | @Test public void shouldSupportAllAcrossMultipleStores() throws Exception { final KeyValueStore<String, String> cache = newStoreInstance(); stubProviderTwo.addStore(storeName, cache); stubOneUnderlying.put("a", "a"); stubOneUnderlying.put("b", "b"); stubOneUnderlying.put("z", "z"); cache.put("c", "c"); cache.put("d", "... |
CompositeReadOnlyKeyValueStore implements ReadOnlyKeyValueStore<K, V> { @Override public long approximateNumEntries() { final List<ReadOnlyKeyValueStore<K, V>> stores = storeProvider.stores(storeName, storeType); long total = 0; for (ReadOnlyKeyValueStore<K, V> store : stores) { total += store.approximateNumEntries(); ... | @Test public void shouldGetApproximateEntriesAcrossAllStores() throws Exception { final KeyValueStore<String, String> cache = newStoreInstance(); stubProviderTwo.addStore(storeName, cache); stubOneUnderlying.put("a", "a"); stubOneUnderlying.put("b", "b"); stubOneUnderlying.put("z", "z"); cache.put("c", "c"); cache.put(... |
ChangeLoggingKeyValueStore extends WrappedStateStore.AbstractStateStore implements KeyValueStore<K, V> { @Override public void put(final K key, final V value) { final Bytes bytesKey = Bytes.wrap(serdes.rawKey(key)); final byte[] bytesValue = serdes.rawValue(value); innerBytes.put(bytesKey, bytesValue); } ChangeLoggingK... | @Test public void shouldWriteKeyValueBytesToInnerStoreOnPut() throws Exception { store.put(hi, there); assertThat(deserializedValueFromInner(hi), equalTo(there)); }
@Test public void shouldWriteKeyValueBytesToInnerStoreOnPut() { store.put(hi, there); assertThat(deserializedValueFromInner(hi), equalTo(there)); } |
ChangeLoggingKeyValueStore extends WrappedStateStore.AbstractStateStore implements KeyValueStore<K, V> { @Override public void putAll(final List<KeyValue<K, V>> entries) { final List<KeyValue<Bytes, byte[]>> keyValues = new ArrayList<>(); for (final KeyValue<K, V> entry : entries) { keyValues.add(KeyValue.pair(Bytes.wr... | @Test public void shouldWriteAllKeyValueToInnerStoreOnPutAll() throws Exception { store.putAll(Arrays.asList(KeyValue.pair(hello, world), KeyValue.pair(hi, there))); assertThat(deserializedValueFromInner(hello), equalTo(world)); assertThat(deserializedValueFromInner(hi), equalTo(there)); }
@Test public void shouldWrite... |
ChangeLoggingKeyValueStore extends WrappedStateStore.AbstractStateStore implements KeyValueStore<K, V> { @Override public V delete(final K key) { final byte[] oldValue = innerBytes.delete(Bytes.wrap(serdes.rawKey(key))); if (oldValue == null) { return null; } return serdes.valueFrom(oldValue); } ChangeLoggingKeyValueSt... | @Test public void shouldReturnNullOnDeleteIfNoOldValue() throws Exception { assertThat(store.delete(hi), is(nullValue())); }
@Test public void shouldReturnNullOnDeleteIfNoOldValue() { assertThat(store.delete(hi), is(nullValue())); } |
ChangeLoggingKeyValueStore extends WrappedStateStore.AbstractStateStore implements KeyValueStore<K, V> { @Override public V putIfAbsent(final K key, final V value) { final V v = get(key); if (v == null) { put(key, value); } return v; } ChangeLoggingKeyValueStore(final KeyValueStore<Bytes, byte[]> bytesStore,
... | @Test public void shouldReturnNullOnPutIfAbsentWhenNoPreviousValue() throws Exception { assertThat(store.putIfAbsent(hi, there), is(nullValue())); }
@Test public void shouldReturnNullOnPutIfAbsentWhenNoPreviousValue() { assertThat(store.putIfAbsent(hi, there), is(nullValue())); } |
TimestampConverter implements Transformation<R> { @Override public void configure(Map<String, ?> configs) { final SimpleConfig simpleConfig = new SimpleConfig(CONFIG_DEF, configs); final String field = simpleConfig.getString(FIELD_CONFIG); final String type = simpleConfig.getString(TARGET_TYPE_CONFIG); String formatPat... | @Test(expected = ConfigException.class) public void testConfigNoTargetType() { TimestampConverter<SourceRecord> xform = new TimestampConverter.Value<>(); xform.configure(Collections.<String, String>emptyMap()); }
@Test(expected = ConfigException.class) public void testConfigInvalidTargetType() { TimestampConverter<Sour... |
ChangeLoggingKeyValueStore extends WrappedStateStore.AbstractStateStore implements KeyValueStore<K, V> { @Override public V get(final K key) { final byte[] rawValue = innerBytes.get(Bytes.wrap(serdes.rawKey(key))); if (rawValue == null) { return null; } return serdes.valueFrom(rawValue); } ChangeLoggingKeyValueStore(fi... | @Test public void shouldReturnNullOnGetWhenDoesntExist() throws Exception { assertThat(store.get(hello), is(nullValue())); }
@Test public void shouldReturnNullOnGetWhenDoesntExist() { assertThat(store.get(hello), is(nullValue())); } |
QueryableStoreProvider { public <T> T getStore(final String storeName, final QueryableStoreType<T> queryableStoreType) { final List<T> globalStore = globalStoreProvider.stores(storeName, queryableStoreType); if (!globalStore.isEmpty()) { return queryableStoreType.create(new WrappingStoreProvider(Collections.<StateStore... | @Test(expected = InvalidStateStoreException.class) public void shouldThrowExceptionIfKVStoreDoesntExist() throws Exception { storeProvider.getStore("not-a-store", QueryableStoreTypes.keyValueStore()); }
@Test(expected = InvalidStateStoreException.class) public void shouldThrowExceptionIfWindowStoreDoesntExist() throws ... |
StoreChangeLogger { void logChange(final K key, final V value) { if (collector != null) { final Serializer<K> keySerializer = serialization.keySerializer(); final Serializer<V> valueSerializer = serialization.valueSerializer(); collector.send(this.topic, key, value, this.partition, context.timestamp(), keySerializer, v... | @SuppressWarnings("unchecked") @Test public void testAddRemove() throws Exception { context.setTime(1); changeLogger.logChange(0, "zero"); changeLogger.logChange(1, "one"); changeLogger.logChange(2, "two"); assertEquals("zero", logged.get(0)); assertEquals("one", logged.get(1)); assertEquals("two", logged.get(2)); chan... |
KafkaStreams { public void close() { close(DEFAULT_CLOSE_TIMEOUT, TimeUnit.SECONDS); } KafkaStreams(final TopologyBuilder builder, final Properties props); KafkaStreams(final TopologyBuilder builder, final StreamsConfig config); KafkaStreams(final TopologyBuilder builder,
final StreamsConfig c... | @Test public void testCloseIsIdempotent() throws Exception { streams.close(); final int closeCount = MockMetricsReporter.CLOSE_COUNT.get(); streams.close(); Assert.assertEquals("subsequent close() calls should do nothing", closeCount, MockMetricsReporter.CLOSE_COUNT.get()); } |
KafkaStreams { public Map<MetricName, ? extends Metric> metrics() { return Collections.unmodifiableMap(metrics.metrics()); } KafkaStreams(final TopologyBuilder builder, final Properties props); KafkaStreams(final TopologyBuilder builder, final StreamsConfig config); KafkaStreams(final TopologyBuilder builder,
... | @Test public void testNumberDefaultMetrics() { final KafkaStreams streams = createKafkaStreams(); final Map<MetricName, ? extends Metric> metrics = streams.metrics(); assertEquals(metrics.size(), 16); } |
KafkaStreams { public Collection<StreamsMetadata> allMetadata() { validateIsRunning(); return streamsMetadataState.getAllMetadata(); } KafkaStreams(final TopologyBuilder builder, final Properties props); KafkaStreams(final TopologyBuilder builder, final StreamsConfig config); KafkaStreams(final TopologyBuilder builde... | @Test(expected = IllegalStateException.class) public void shouldNotGetAllTasksWhenNotRunning() throws Exception { streams.allMetadata(); } |
KafkaStreams { public Collection<StreamsMetadata> allMetadataForStore(final String storeName) { validateIsRunning(); return streamsMetadataState.getAllMetadataForStore(storeName); } KafkaStreams(final TopologyBuilder builder, final Properties props); KafkaStreams(final TopologyBuilder builder, final StreamsConfig conf... | @Test(expected = IllegalStateException.class) public void shouldNotGetAllTasksWithStoreWhenNotRunning() throws Exception { streams.allMetadataForStore("store"); } |
KafkaStreams { public <K> StreamsMetadata metadataForKey(final String storeName, final K key, final Serializer<K> keySerializer) { validateIsRunning(); return streamsMetadataState.getMetadataWithKey(storeName, key, keySerializer); } KafkaStreams(final TopologyBuilder builder, final Properties props); KafkaStreams(fina... | @Test(expected = IllegalStateException.class) public void shouldNotGetTaskWithKeyAndSerializerWhenNotRunning() throws Exception { streams.metadataForKey("store", "key", Serdes.String().serializer()); }
@Test(expected = IllegalStateException.class) public void shouldNotGetTaskWithKeyAndPartitionerWhenNotRunning() throws... |
KafkaStreams { public void cleanUp() { if (state.isRunning()) { throw new IllegalStateException("Cannot clean up while running."); } final String appId = config.getString(StreamsConfig.APPLICATION_ID_CONFIG); final String stateDir = config.getString(StreamsConfig.STATE_DIR_CONFIG); final String localApplicationDir = st... | @Test public void testCleanup() throws Exception { final Properties props = new Properties(); props.setProperty(StreamsConfig.APPLICATION_ID_CONFIG, "testLocalCleanup"); props.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, CLUSTER.bootstrapServers()); final KStreamBuilder builder = new KStreamBuilder(); final Kafk... |
KafkaStreams { @Override public String toString() { return toString(""); } KafkaStreams(final TopologyBuilder builder, final Properties props); KafkaStreams(final TopologyBuilder builder, final StreamsConfig config); KafkaStreams(final TopologyBuilder builder,
final StreamsConfig config,
... | @Test public void testToString() { streams.start(); String streamString = streams.toString(); streams.close(); String appId = streamString.split("\\n")[1].split(":")[1].trim(); Assert.assertNotEquals("streamString should not be empty", "", streamString); Assert.assertNotNull("streamString should not be null", streamStr... |
Windows { protected Windows<W> segments(final int segments) throws IllegalArgumentException { if (segments < 2) { throw new IllegalArgumentException("Number of segments must be at least 2."); } this.segments = segments; return this; } protected Windows(); Windows<W> until(final long durationMs); long maintainMs(); abs... | @Test public void shouldSetNumberOfSegments() { final int anySegmentSizeLargerThanOne = 5; assertEquals(anySegmentSizeLargerThanOne, new TestWindows().segments(anySegmentSizeLargerThanOne).segments); }
@Test(expected = IllegalArgumentException.class) public void numberOfSegmentsMustBeAtLeastTwo() { new TestWindows().se... |
Windows { public Windows<W> until(final long durationMs) throws IllegalArgumentException { if (durationMs < 0) { throw new IllegalArgumentException("Window retention time (durationMs) cannot be negative."); } maintainDurationMs = durationMs; return this; } protected Windows(); Windows<W> until(final long durationMs); ... | @Test(expected = IllegalArgumentException.class) public void retentionTimeMustNotBeNegative() { new TestWindows().until(-1); } |
KStreamBuilder extends TopologyBuilder { public <K, V> KStream<K, V> stream(final String... topics) { return stream(null, null, null, null, topics); } KStream<K, V> stream(final String... topics); KStream<K, V> stream(final AutoOffsetReset offsetReset,
final String... topics); KS... | @Test(expected = TopologyBuilderException.class) public void testFrom() { builder.stream("topic-1", "topic-2"); builder.addSource(KStreamImpl.SOURCE_NAME + "0000000000", "topic-3"); }
@Test public void shouldNotTryProcessingFromSinkTopic() { final KStream<String, String> source = builder.stream("topic-source"); source.... |
KStreamBuilder extends TopologyBuilder { public String newName(final String prefix) { return prefix + String.format("%010d", index.getAndIncrement()); } KStream<K, V> stream(final String... topics); KStream<K, V> stream(final AutoOffsetReset offsetReset,
final String... topics); ... | @Test public void testNewName() { assertEquals("X-0000000000", builder.newName("X-")); assertEquals("Y-0000000001", builder.newName("Y-")); assertEquals("Z-0000000002", builder.newName("Z-")); final KStreamBuilder newBuilder = new KStreamBuilder(); assertEquals("X-0000000000", newBuilder.newName("X-")); assertEquals("Y... |
KStreamBuilder extends TopologyBuilder { public String newStoreName(final String prefix) { return prefix + String.format(KTableImpl.STATE_STORE_NAME + "%010d", index.getAndIncrement()); } KStream<K, V> stream(final String... topics); KStream<K, V> stream(final AutoOffsetReset offsetReset,
... | @Test public void testNewStoreName() { assertEquals("X-STATE-STORE-0000000000", builder.newStoreName("X-")); assertEquals("Y-STATE-STORE-0000000001", builder.newStoreName("Y-")); assertEquals("Z-STATE-STORE-0000000002", builder.newStoreName("Z-")); KStreamBuilder newBuilder = new KStreamBuilder(); assertEquals("X-STATE... |
KStreamBuilder extends TopologyBuilder { public <K, V> KStream<K, V> merge(final KStream<K, V>... streams) { return KStreamImpl.merge(this, streams); } KStream<K, V> stream(final String... topics); KStream<K, V> stream(final AutoOffsetReset offsetReset,
final String... topics); K... | @Test public void testMerge() { final String topic1 = "topic-1"; final String topic2 = "topic-2"; final KStream<String, String> source1 = builder.stream(topic1); final KStream<String, String> source2 = builder.stream(topic2); final KStream<String, String> merged = builder.merge(source1, source2); final MockProcessorSup... |
KStreamBuilder extends TopologyBuilder { public <K, V> KTable<K, V> table(final String topic, final String queryableStoreName) { return table(null, null, null, null, topic, queryableStoreName); } KStream<K, V> stream(final String... topics); KStream<K, V> stream(final AutoOffsetReset offsetReset,
... | @Test public void shouldStillMaterializeSourceKTableIfStateNameNotSpecified() throws Exception { KTable table1 = builder.table("topic1", "table1"); KTable table2 = builder.table("topic2", (String) null); final ProcessorTopology topology = builder.build(null); assertEquals(2, topology.stateStores().size()); assertEquals... |
KStreamBuilder extends TopologyBuilder { public <K, V> GlobalKTable<K, V> globalTable(final String topic, final String queryableStoreName) { return globalTable(null, null, null, topic, queryableStoreName); } KStream<K, V> stream(final String... topics); KStream<K, V> stream(final AutoOffsetReset offsetReset,
... | @Test public void shouldBuildSimpleGlobalTableTopology() throws Exception { builder.globalTable("table", "globalTable"); final ProcessorTopology topology = builder.buildGlobalStateTopology(); final List<StateStore> stateStores = topology.globalStateStores(); assertEquals(1, stateStores.size()); assertEquals("globalTabl... |
MaskField implements Transformation<R> { @Override public R apply(R record) { if (operatingSchema(record) == null) { return applySchemaless(record); } else { return applyWithSchema(record); } } @Override void configure(Map<String, ?> props); @Override R apply(R record); @Override ConfigDef config(); @Override void clo... | @Test public void schemaless() { final Map<String, Object> value = new HashMap<>(); value.put("magic", 42); value.put("bool", true); value.put("byte", (byte) 42); value.put("short", (short) 42); value.put("int", 42); value.put("long", 42L); value.put("float", 42f); value.put("double", 42d); value.put("string", "blabla"... |
TimeWindows extends Windows<TimeWindow> { public static TimeWindows of(final long sizeMs) throws IllegalArgumentException { if (sizeMs <= 0) { throw new IllegalArgumentException("Window size (sizeMs) must be larger than zero."); } return new TimeWindows(sizeMs, sizeMs); } private TimeWindows(final long sizeMs, final l... | @Test public void shouldSetWindowSize() { assertEquals(ANY_SIZE, TimeWindows.of(ANY_SIZE).sizeMs); }
@Test(expected = IllegalArgumentException.class) public void windowSizeMustNotBeZero() { TimeWindows.of(0); }
@Test(expected = IllegalArgumentException.class) public void windowSizeMustNotBeNegative() { TimeWindows.of(-... |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public <K1, V1> KGroupedTable<K1, V1> groupBy(KeyValueMapper<? super K, ? super V, KeyValue<K1, V1>> selector, Serde<K1> keySerde, Serde<V1> valueSerde) { Objects.requireNonNull(selector, "selector can't be null"); String selectName = topology.new... | @Test public void testRepartition() throws Exception { String topic1 = "topic1"; String storeName1 = "storeName1"; final KStreamBuilder builder = new KStreamBuilder(); KTableImpl<String, String, String> table1 = (KTableImpl<String, String, String>) builder.table(stringSerde, stringSerde, topic1, storeName1); KTableImpl... |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public KStream<K, V> toStream() { String name = topology.newName(TOSTREAM_NAME); topology.addProcessor(name, new KStreamMapValues<K, Change<V>, V>(new ValueMapper<Change<V>, V>() { @Override public V apply(Change<V> change) { return change.newValu... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullSelectorOnToStream() throws Exception { table.toStream(null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public void to(String topic) { to(null, null, null, topic); } KTableImpl(KStreamBuilder topology,
String name,
ProcessorSupplier<?, ?> processorSupplier,
Set<String> sourceNodes,
... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullTopicOnTo() throws Exception { table.to(null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public KTable<K, V> filter(final Predicate<? super K, ? super V> predicate) { return filter(predicate, (String) null); } KTableImpl(KStreamBuilder topology,
String name,
ProcessorSupplier<?, ?> processor... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullPredicateOnFilter() throws Exception { table.filter(null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public KTable<K, V> filterNot(final Predicate<? super K, ? super V> predicate) { return filterNot(predicate, (String) null); } KTableImpl(KStreamBuilder topology,
String name,
ProcessorSupplier<?, ?> pro... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullPredicateOnFilterNot() throws Exception { table.filterNot(null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public <V1> KTable<K, V1> mapValues(final ValueMapper<? super V, ? extends V1> mapper) { return mapValues(mapper, null, (String) null); } KTableImpl(KStreamBuilder topology,
String name,
ProcessorSupplie... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullMapperOnMapValues() throws Exception { table.mapValues(null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public void writeAsText(String filePath) { writeAsText(filePath, null, null, null); } KTableImpl(KStreamBuilder topology,
String name,
ProcessorSupplier<?, ?> processorSupplier,
Set... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullFilePathOnWriteAsText() throws Exception { table.writeAsText(null); }
@Test(expected = TopologyBuilderException.class) public void shouldNotAllowEmptyFilePathOnWriteAsText() throws Exception { table.writeAsText("\t \t"); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public void foreach(final ForeachAction<? super K, ? super V> action) { Objects.requireNonNull(action, "action can't be null"); String name = topology.newName(FOREACH_NAME); KStreamPeek<K, Change<V>> processorSupplier = new KStreamPeek<>(new Forea... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullActionOnForEach() throws Exception { table.foreach(null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public KTable<K, V> through(final Serde<K> keySerde, final Serde<V> valSerde, final StreamPartitioner<? super K, ? super V> partitioner, final String topic, final String queryableStoreName) { final String internalStoreName = queryableStoreName != ... | @Test(expected = NullPointerException.class) public void shouldAllowNullTopicInThrough() throws Exception { table.through((String) null, "store"); }
@Test public void shouldAllowNullStoreInThrough() throws Exception { table.through("topic", (String) null); } |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public <V1, R> KTable<K, R> join(final KTable<K, V1> other, final ValueJoiner<? super V, ? super V1, ? extends R> joiner) { return doJoin(other, joiner, false, false, null, (String) null); } KTableImpl(KStreamBuilder topology,
... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullOtherTableOnJoin() throws Exception { table.join(null, MockValueJoiner.TOSTRING_JOINER); }
@Test public void shouldAllowNullStoreInJoin() throws Exception { table.join(table, MockValueJoiner.TOSTRING_JOINER, null, (String) null); }
@Test(expecte... |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public <V1, R> KTable<K, R> leftJoin(final KTable<K, V1> other, final ValueJoiner<? super V, ? super V1, ? extends R> joiner) { return doJoin(other, joiner, true, false, null, (String) null); } KTableImpl(KStreamBuilder topology,
... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullStoreSupplierInLeftJoin() throws Exception { table.leftJoin(table, MockValueJoiner.TOSTRING_JOINER, (StateStoreSupplier<KeyValueStore>) null); }
@Test(expected = NullPointerException.class) public void shouldNotAllowNullJoinerOnLeftJoin() throws... |
KTableImpl extends AbstractStream<K> implements KTable<K, V> { @Override public <V1, R> KTable<K, R> outerJoin(final KTable<K, V1> other, final ValueJoiner<? super V, ? super V1, ? extends R> joiner) { return doJoin(other, joiner, true, true, null, (String) null); } KTableImpl(KStreamBuilder topology,
... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullStoreSupplierInOuterJoin() throws Exception { table.outerJoin(table, MockValueJoiner.TOSTRING_JOINER, (StateStoreSupplier<KeyValueStore>) null); }
@Test(expected = NullPointerException.class) public void shouldNotAllowNullOtherTableOnOuterJoin()... |
SetSchemaMetadata implements Transformation<R> { protected static Object updateSchemaIn(Object keyOrValue, Schema updatedSchema) { if (keyOrValue instanceof Struct) { Struct origStruct = (Struct) keyOrValue; Struct newStruct = new Struct(updatedSchema); for (Field field : updatedSchema.fields()) { newStruct.put(field, ... | @Test public void updateSchemaOfNonStruct() { Object value = new Integer(1); Object updatedValue = SetSchemaMetadata.updateSchemaIn(value, Schema.INT32_SCHEMA); assertSame(value, updatedValue); }
@Test public void updateSchemaOfStruct() { final String fieldName1 = "f1"; final String fieldName2 = "f2"; final String fiel... |
WindowedStreamPartitioner implements StreamPartitioner<Windowed<K>, V> { public Integer partition(final Windowed<K> windowedKey, final V value, final int numPartitions) { final byte[] keyBytes = serializer.serializeBaseKey(topic, windowedKey); return toPositive(Utils.murmur2(keyBytes)) % numPartitions; } WindowedStream... | @Test public void testCopartitioning() { Random rand = new Random(); DefaultPartitioner defaultPartitioner = new DefaultPartitioner(); WindowedSerializer<Integer> windowedSerializer = new WindowedSerializer<>(intSerializer); WindowedStreamPartitioner<Integer, String> streamPartitioner = new WindowedStreamPartitioner<>(... |
KTableKTableOuterJoin extends KTableKTableAbstractJoin<K, R, V1, V2> { @Override public Processor<K, Change<V1>> get() { return new KTableKTableOuterJoinProcessor(valueGetterSupplier2.get()); } KTableKTableOuterJoin(KTableImpl<K, ?, V1> table1, KTableImpl<K, ?, V2> table2, ValueJoiner<? super V1, ? super V2, ? extends ... | @Test public void testJoin() throws Exception { KStreamBuilder builder = new KStreamBuilder(); final int[] expectedKeys = new int[]{0, 1, 2, 3}; KTable<Integer, String> table1; KTable<Integer, String> table2; KTable<Integer, String> joined; MockProcessorSupplier<Integer, String> processor; processor = new MockProcessor... |
KTableAggregate implements KTableProcessorSupplier<K, V, T> { @Override public Processor<K, Change<V>> get() { return new KTableAggregateProcessor(); } KTableAggregate(String storeName, Initializer<T> initializer, Aggregator<? super K, ? super V, T> add, Aggregator<? super K, ? super V, T> remove); @Override void enabl... | @Test public void shouldForwardToCorrectProcessorNodeWhenMultiCacheEvictions() throws Exception { final String tableOne = "tableOne"; final String tableTwo = "tableTwo"; final KStreamBuilder builder = new KStreamBuilder(); final String reduceTopic = "TestDriver-reducer-store-repartition"; final Map<String, Long> reduce... |
KStreamFlatMap implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KStreamFlatMapProcessor(); } KStreamFlatMap(KeyValueMapper<? super K, ? super V, ? extends Iterable<? extends KeyValue<? extends K1, ? extends V1>>> mapper); @Override Processor<K, V> get(); } | @Test public void testFlatMap() { KStreamBuilder builder = new KStreamBuilder(); KeyValueMapper<Number, Object, Iterable<KeyValue<String, String>>> mapper = new KeyValueMapper<Number, Object, Iterable<KeyValue<String, String>>>() { @Override public Iterable<KeyValue<String, String>> apply(Number key, Object value) { Ar... |
KStreamFlatMapValues implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KStreamFlatMapValuesProcessor(); } KStreamFlatMapValues(ValueMapper<? super V, ? extends Iterable<? extends V1>> mapper); @Override Processor<K, V> get(); } | @Test public void testFlatMapValues() { KStreamBuilder builder = new KStreamBuilder(); ValueMapper<Number, Iterable<String>> mapper = new ValueMapper<Number, Iterable<String>>() { @Override public Iterable<String> apply(Number value) { ArrayList<String> result = new ArrayList<String>(); result.add("v" + value); result.... |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public void to(String topic) { to(null, null, null, topic); } KStreamImpl(KStreamBuilder topology, String name, Set<String> sourceNodes,
boolean repartitionRequired); @Override KStream<K, V> filter(Predicate<? super K, ? s... | @Test public void testToWithNullValueSerdeDoesntNPE() { final KStreamBuilder builder = new KStreamBuilder(); final KStream<String, String> inputStream = builder.stream(stringSerde, stringSerde, "input"); inputStream.to(stringSerde, null, "output"); }
@Test(expected = NullPointerException.class) public void shouldNotAll... |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public KStream<K, V> filter(Predicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate can't be null"); String name = topology.newName(FILTER_NAME); topology.addProcessor(name, new KStreamFilter<>(predicate, false)... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullPredicateOnFilter() throws Exception { testStream.filter(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public KStream<K, V> filterNot(final Predicate<? super K, ? super V> predicate) { Objects.requireNonNull(predicate, "predicate can't be null"); String name = topology.newName(FILTER_NAME); topology.addProcessor(name, new KStreamFilter<>(predicat... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullPredicateOnFilterNot() throws Exception { testStream.filterNot(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <K1> KStream<K1, V> selectKey(final KeyValueMapper<? super K, ? super V, ? extends K1> mapper) { Objects.requireNonNull(mapper, "mapper can't be null"); return new KStreamImpl<>(topology, internalSelectKey(mapper), sourceNodes, true); } K... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullMapperOnSelectKey() throws Exception { testStream.selectKey(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <K1, V1> KStream<K1, V1> map(KeyValueMapper<? super K, ? super V, ? extends KeyValue<? extends K1, ? extends V1>> mapper) { Objects.requireNonNull(mapper, "mapper can't be null"); String name = topology.newName(MAP_NAME); topology.addProc... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullMapperOnMap() throws Exception { testStream.map(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <V1> KStream<K, V1> mapValues(ValueMapper<? super V, ? extends V1> mapper) { Objects.requireNonNull(mapper, "mapper can't be null"); String name = topology.newName(MAPVALUES_NAME); topology.addProcessor(name, new KStreamMapValues<>(mapper... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullMapperOnMapValues() throws Exception { testStream.mapValues(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public void writeAsText(String filePath) { writeAsText(filePath, null, null, null); } KStreamImpl(KStreamBuilder topology, String name, Set<String> sourceNodes,
boolean repartitionRequired); @Override KStream<K, V> filter(... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullFilePathOnWriteAsText() throws Exception { testStream.writeAsText(null); }
@Test(expected = TopologyBuilderException.class) public void shouldNotAllowEmptyFilePathOnWriteAsText() throws Exception { testStream.writeAsText("\t \t"); } |
Cast implements Transformation<R> { @Override public void configure(Map<String, ?> props) { final SimpleConfig config = new SimpleConfig(CONFIG_DEF, props); casts = parseFieldTypes(config.getList(SPEC_CONFIG)); wholeValueCastType = casts.get(WHOLE_VALUE_CAST); schemaUpdateCache = new SynchronizedCache<>(new LRUCache<Sc... | @Test(expected = ConfigException.class) public void testConfigEmpty() { final Cast<SourceRecord> xform = new Cast.Key<>(); xform.configure(Collections.singletonMap(Cast.SPEC_CONFIG, "")); }
@Test(expected = ConfigException.class) public void testConfigInvalidSchemaType() { final Cast<SourceRecord> xform = new Cast.Key<... |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <K1, V1> KStream<K1, V1> flatMap(KeyValueMapper<? super K, ? super V, ? extends Iterable<? extends KeyValue<? extends K1, ? extends V1>>> mapper) { Objects.requireNonNull(mapper, "mapper can't be null"); String name = topology.newName(FLA... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullMapperOnFlatMap() throws Exception { testStream.flatMap(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <V1> KStream<K, V1> flatMapValues(ValueMapper<? super V, ? extends Iterable<? extends V1>> mapper) { Objects.requireNonNull(mapper, "mapper can't be null"); String name = topology.newName(FLATMAPVALUES_NAME); topology.addProcessor(name, n... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullMapperOnFlatMapValues() throws Exception { testStream.flatMapValues(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override @SuppressWarnings("unchecked") public KStream<K, V>[] branch(Predicate<? super K, ? super V>... predicates) { if (predicates.length == 0) { throw new IllegalArgumentException("you must provide at least one predicate"); } for (Predicate<? super K... | @Test(expected = IllegalArgumentException.class) public void shouldHaveAtLeastOnPredicateWhenBranching() throws Exception { testStream.branch(); }
@Test(expected = NullPointerException.class) public void shouldCantHaveNullPredicate() throws Exception { testStream.branch((Predicate) null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public KStream<K, V> through(Serde<K> keySerde, Serde<V> valSerde, StreamPartitioner<? super K, ? super V> partitioner, String topic) { to(keySerde, valSerde, partitioner, topic); return topology.stream(keySerde, valSerde, topic); } KStreamImpl(... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullTopicOnThrough() throws Exception { testStream.through(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <K1, V1> KStream<K1, V1> transform(TransformerSupplier<? super K, ? super V, KeyValue<K1, V1>> transformerSupplier, String... stateStoreNames) { Objects.requireNonNull(transformerSupplier, "transformerSupplier can't be null"); String name... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullTransformSupplierOnTransform() throws Exception { testStream.transform(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <V1> KStream<K, V1> transformValues(ValueTransformerSupplier<? super V, ? extends V1> valueTransformerSupplier, String... stateStoreNames) { Objects.requireNonNull(valueTransformerSupplier, "valueTransformSupplier can't be null"); String ... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullTransformSupplierOnTransformValues() throws Exception { testStream.transformValues(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public void process(final ProcessorSupplier<? super K, ? super V> processorSupplier, String... stateStoreNames) { String name = topology.newName(PROCESSOR_NAME); topology.addProcessor(name, processorSupplier, this.name); topology.connectProcesso... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullProcessSupplier() throws Exception { testStream.process(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <V1, R> KStream<K, R> join( final KStream<K, V1> other, final ValueJoiner<? super V, ? super V1, ? extends R> joiner, final JoinWindows windows, final Serde<K> keySerde, final Serde<V> thisValueSerde, final Serde<V1> otherValueSerde) { re... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullOtherStreamOnJoin() throws Exception { testStream.join(null, MockValueJoiner.TOSTRING_JOINER, JoinWindows.of(10)); }
@Test(expected = NullPointerException.class) public void shouldNotAllowNullValueJoinerOnJoin() throws Exception { testStream.joi... |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <V1, R> KStream<K, R> leftJoin( final KStream<K, V1> other, final ValueJoiner<? super V, ? super V1, ? extends R> joiner, final JoinWindows windows, final Serde<K> keySerde, final Serde<V> thisValSerde, final Serde<V1> otherValueSerde) { ... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullTableOnTableJoin() throws Exception { testStream.leftJoin((KTable) null, MockValueJoiner.TOSTRING_JOINER); }
@Test(expected = NullPointerException.class) public void shouldNotAllowNullValueMapperOnTableJoin() throws Exception { testStream.leftJo... |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public <K1> KGroupedStream<K1, V> groupBy(KeyValueMapper<? super K, ? super V, K1> selector) { return groupBy(selector, null, null); } KStreamImpl(KStreamBuilder topology, String name, Set<String> sourceNodes,
boolean repa... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullSelectorOnGroupBy() throws Exception { testStream.groupBy(null); } |
KStreamImpl extends AbstractStream<K> implements KStream<K, V> { @Override public void foreach(ForeachAction<? super K, ? super V> action) { Objects.requireNonNull(action, "action can't be null"); String name = topology.newName(FOREACH_NAME); topology.addProcessor(name, new KStreamPeek<>(action, false), this.name); } K... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullActionOnForEach() throws Exception { testStream.foreach(null); } |
KStreamBranch implements ProcessorSupplier<K, V> { @SuppressWarnings("unchecked") public KStreamBranch(Predicate<K, V> ... predicates) { this.predicates = predicates; } @SuppressWarnings("unchecked") KStreamBranch(Predicate<K, V> ... predicates); @Override Processor<K, V> get(); } | @SuppressWarnings("unchecked") @Test public void testKStreamBranch() { KStreamBuilder builder = new KStreamBuilder(); builder.setApplicationId("X"); Predicate<Integer, String> isEven = new Predicate<Integer, String>() { @Override public boolean test(Integer key, String value) { return (key % 2) == 0; } }; Predicate<Int... |
KGroupedTableImpl extends AbstractStream<K> implements KGroupedTable<K, V> { @Override public KTable<K, Long> count(final String queryableStoreName) { determineIsQueryable(queryableStoreName); return count(keyValueStore(keySerde, Serdes.Long(), getOrCreateName(queryableStoreName, AGGREGATE_NAME))); } KGroupedTableImpl(... | @Test public void shouldAllowNullStoreNameOnCount() { groupedTable.count((String) null); } |
KGroupedTableImpl extends AbstractStream<K> implements KGroupedTable<K, V> { @Override public <T> KTable<K, T> aggregate(final Initializer<T> initializer, final Aggregator<? super K, ? super V, T> adder, final Aggregator<? super K, ? super V, T> subtractor, final Serde<T> aggValueSerde, final String queryableStoreName)... | @Test public void shouldAllowNullStoreNameOnAggregate() throws Exception { groupedTable.aggregate(MockInitializer.STRING_INIT, MockAggregator.TOSTRING_ADDER, MockAggregator.TOSTRING_REMOVER, (String) null); }
@Test(expected = InvalidTopicException.class) public void shouldNotAllowInvalidStoreNameOnAggregate() throws Ex... |
KGroupedTableImpl extends AbstractStream<K> implements KGroupedTable<K, V> { @Override public KTable<K, V> reduce(final Reducer<V> adder, final Reducer<V> subtractor, final String queryableStoreName) { determineIsQueryable(queryableStoreName); return reduce(adder, subtractor, keyValueStore(keySerde, valSerde, getOrCrea... | @Test(expected = NullPointerException.class) public void shouldNotAllowNullAdderOnReduce() throws Exception { groupedTable.reduce(null, MockReducer.STRING_REMOVER, "store"); }
@Test(expected = NullPointerException.class) public void shouldNotAllowNullSubtractorOnReduce() throws Exception { groupedTable.reduce(MockReduc... |
SessionKeySerde implements Serde<Windowed<K>> { @Override public Serializer<Windowed<K>> serializer() { return new SessionKeySerializer(keySerde.serializer()); } SessionKeySerde(final Serde<K> keySerde); @Override void configure(final Map<String, ?> configs, final boolean isKey); @Override void close(); @Override Seria... | @Test public void shouldSerializeNullToNull() throws Exception { assertNull(sessionKeySerde.serializer().serialize(topic, null)); } |
SessionKeySerde implements Serde<Windowed<K>> { @Override public Deserializer<Windowed<K>> deserializer() { return new SessionKeyDeserializer(keySerde.deserializer()); } SessionKeySerde(final Serde<K> keySerde); @Override void configure(final Map<String, ?> configs, final boolean isKey); @Override void close(); @Overri... | @Test public void shouldDeSerializeEmtpyByteArrayToNull() throws Exception { assertNull(sessionKeySerde.deserializer().deserialize(topic, new byte[0])); }
@Test public void shouldDeSerializeNullToNull() throws Exception { assertNull(sessionKeySerde.deserializer().deserialize(topic, null)); } |
KStreamMap implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KStreamMapProcessor(); } KStreamMap(KeyValueMapper<? super K, ? super V, ? extends KeyValue<? extends K1, ? extends V1>> mapper); @Override Processor<K, V> get(); } | @Test public void testMap() { KStreamBuilder builder = new KStreamBuilder(); KeyValueMapper<Integer, String, KeyValue<String, Integer>> mapper = new KeyValueMapper<Integer, String, KeyValue<String, Integer>>() { @Override public KeyValue<String, Integer> apply(Integer key, String value) { return KeyValue.pair(value, ke... |
KStreamTransform implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KStreamTransformProcessor<>(transformerSupplier.get()); } KStreamTransform(TransformerSupplier<? super K, ? super V, ? extends KeyValue<? extends K1, ? extends V1>> transformerSupplier); @Override Processor<K, V> g... | @Test public void testTransform() { KStreamBuilder builder = new KStreamBuilder(); TransformerSupplier<Number, Number, KeyValue<Integer, Integer>> transformerSupplier = new TransformerSupplier<Number, Number, KeyValue<Integer, Integer>>() { public Transformer<Number, Number, KeyValue<Integer, Integer>> get() { return n... |
KTableKTableLeftJoin extends KTableKTableAbstractJoin<K, R, V1, V2> { @Override public Processor<K, Change<V1>> get() { return new KTableKTableLeftJoinProcessor(valueGetterSupplier2.get()); } KTableKTableLeftJoin(KTableImpl<K, ?, V1> table1, KTableImpl<K, ?, V2> table2, ValueJoiner<? super V1, ? super V2, ? extends R> ... | @Test public void testJoin() throws Exception { final KStreamBuilder builder = new KStreamBuilder(); final int[] expectedKeys = new int[]{0, 1, 2, 3}; KTable<Integer, String> table1 = builder.table(intSerde, stringSerde, topic1, storeName1); KTable<Integer, String> table2 = builder.table(intSerde, stringSerde, topic2, ... |
KTableSource implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KTableSourceProcessor(); } KTableSource(String storeName); @Override Processor<K, V> get(); void enableSendingOldValues(); final String storeName; } | @Test public void testValueGetter() throws IOException { final KStreamBuilder builder = new KStreamBuilder(); String topic1 = "topic1"; KTableImpl<String, String, String> table1 = (KTableImpl<String, String, String>) builder.table(stringSerde, stringSerde, topic1, "anyStoreName"); KTableValueGetterSupplier<String, Stri... |
KTableSource implements ProcessorSupplier<K, V> { public void enableSendingOldValues() { sendOldValues = true; } KTableSource(String storeName); @Override Processor<K, V> get(); void enableSendingOldValues(); final String storeName; } | @Test public void testSendingOldValue() throws IOException { final KStreamBuilder builder = new KStreamBuilder(); String topic1 = "topic1"; KTableImpl<String, String, String> table1 = (KTableImpl<String, String, String>) builder.table(stringSerde, stringSerde, topic1, "anyStoreName"); table1.enableSendingOldValues(); a... |
KTableMapValues implements KTableProcessorSupplier<K, V, V1> { @Override public void enableSendingOldValues() { parent.enableSendingOldValues(); sendOldValues = true; } KTableMapValues(final KTableImpl<K, ?, V> parent, final ValueMapper<? super V, ? extends V1> mapper,
final String queryableN... | @Test public void testSendingOldValue() throws IOException { KStreamBuilder builder = new KStreamBuilder(); String topic1 = "topic1"; KTableImpl<String, String, String> table1 = (KTableImpl<String, String, String>) builder.table(stringSerde, stringSerde, topic1, "anyStoreName"); KTableImpl<String, String, Integer> tabl... |
ByteArrayConverter implements Converter { @Override public byte[] fromConnectData(String topic, Schema schema, Object value) { if (schema != null && schema.type() != Schema.Type.BYTES) throw new DataException("Invalid schema type for ByteArrayConverter: " + schema.type().toString()); if (value != null && !(value instan... | @Test public void testFromConnect() { assertArrayEquals( SAMPLE_BYTES, converter.fromConnectData(TOPIC, Schema.BYTES_SCHEMA, SAMPLE_BYTES) ); }
@Test public void testFromConnectSchemaless() { assertArrayEquals( SAMPLE_BYTES, converter.fromConnectData(TOPIC, null, SAMPLE_BYTES) ); }
@Test(expected = DataException.class)... |
KStreamTransformValues implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KStreamTransformValuesProcessor<>(valueTransformerSupplier.get()); } KStreamTransformValues(ValueTransformerSupplier<V, R> valueTransformerSupplier); @Override Processor<K, V> get(); } | @Test public void testTransform() { KStreamBuilder builder = new KStreamBuilder(); ValueTransformerSupplier<Number, Integer> valueTransformerSupplier = new ValueTransformerSupplier<Number, Integer>() { public ValueTransformer<Number, Integer> get() { return new ValueTransformer<Number, Integer>() { private int total = ... |
KStreamMapValues implements ProcessorSupplier<K, V> { @Override public Processor<K, V> get() { return new KStreamMapProcessor(); } KStreamMapValues(ValueMapper<V, V1> mapper); @Override Processor<K, V> get(); } | @Test public void testFlatMapValues() { KStreamBuilder builder = new KStreamBuilder(); ValueMapper<CharSequence, Integer> mapper = new ValueMapper<CharSequence, Integer>() { @Override public Integer apply(CharSequence value) { return value.length(); } }; final int[] expectedKeys = {1, 10, 100, 1000}; KStream<Integer, S... |
KGroupedStreamImpl extends AbstractStream<K> implements KGroupedStream<K, V> { @Override public KTable<K, V> reduce(final Reducer<V> reducer, final String queryableStoreName) { determineIsQueryable(queryableStoreName); return reduce(reducer, keyValueStore(keySerde, valSerde, getOrCreateName(queryableStoreName, REDUCE_N... | @Test(expected = NullPointerException.class) public void shouldNotHaveNullReducerOnReduce() throws Exception { groupedStream.reduce(null, "store"); }
@Test public void shouldAllowNullStoreNameOnReduce() throws Exception { groupedStream.reduce(MockReducer.STRING_ADDER, (String) null); }
@Test(expected = InvalidTopicExce... |
KGroupedStreamImpl extends AbstractStream<K> implements KGroupedStream<K, V> { @Override public KTable<K, Long> count(final String queryableStoreName) { determineIsQueryable(queryableStoreName); return count(keyValueStore(keySerde, Serdes.Long(), getOrCreateName(queryableStoreName, AGGREGATE_NAME))); } KGroupedStreamIm... | @Test(expected = NullPointerException.class) public void shouldNotHaveNullStoreSupplierOnCount() throws Exception { groupedStream.count((StateStoreSupplier<KeyValueStore>) null); }
@Test(expected = NullPointerException.class) public void shouldNotHaveNullStoreSupplierOnWindowedCount() throws Exception { groupedStream.c... |
KGroupedStreamImpl extends AbstractStream<K> implements KGroupedStream<K, V> { @Override public <T> KTable<K, T> aggregate(final Initializer<T> initializer, final Aggregator<? super K, ? super V, T> aggregator, final Serde<T> aggValueSerde, final String queryableStoreName) { determineIsQueryable(queryableStoreName); re... | @Test(expected = NullPointerException.class) public void shouldNotHaveNullInitializerOnAggregate() throws Exception { groupedStream.aggregate(null, MockAggregator.TOSTRING_ADDER, Serdes.String(), "store"); }
@Test(expected = NullPointerException.class) public void shouldNotHaveNullAdderOnAggregate() throws Exception { ... |
ByteArrayConverter implements Converter { @Override public SchemaAndValue toConnectData(String topic, byte[] value) { return new SchemaAndValue(Schema.OPTIONAL_BYTES_SCHEMA, value); } @Override void configure(Map<String, ?> configs, boolean isKey); @Override byte[] fromConnectData(String topic, Schema schema, Object v... | @Test public void testToConnect() { SchemaAndValue data = converter.toConnectData(TOPIC, SAMPLE_BYTES); assertEquals(Schema.OPTIONAL_BYTES_SCHEMA, data.schema()); assertTrue(Arrays.equals(SAMPLE_BYTES, (byte[]) data.value())); }
@Test public void testToConnectNull() { SchemaAndValue data = converter.toConnectData(TOPIC... |
SessionWindows { public static SessionWindows with(final long inactivityGapMs) { if (inactivityGapMs <= 0) { throw new IllegalArgumentException("Gap time (inactivityGapMs) cannot be zero or negative."); } return new SessionWindows(inactivityGapMs); } private SessionWindows(final long gapMs); static SessionWindows with... | @Test(expected = IllegalArgumentException.class) public void windowSizeMustNotBeNegative() { SessionWindows.with(-1); }
@Test(expected = IllegalArgumentException.class) public void windowSizeMustNotBeZero() { SessionWindows.with(0); } |
JoinWindows extends Windows<Window> { public static JoinWindows of(final long timeDifferenceMs) throws IllegalArgumentException { return new JoinWindows(timeDifferenceMs, timeDifferenceMs); } private JoinWindows(final long beforeMs, final long afterMs); static JoinWindows of(final long timeDifferenceMs); JoinWindows b... | @Test(expected = IllegalArgumentException.class) public void timeDifferenceMustNotBeNegative() { JoinWindows.of(-1); } |
DefaultPartitionGrouper implements PartitionGrouper { public Map<TaskId, Set<TopicPartition>> partitionGroups(Map<Integer, Set<String>> topicGroups, Cluster metadata) { Map<TaskId, Set<TopicPartition>> groups = new HashMap<>(); for (Map.Entry<Integer, Set<String>> entry : topicGroups.entrySet()) { Integer topicGroupId ... | @Test public void shouldComputeGroupingForTwoGroups() { final PartitionGrouper grouper = new DefaultPartitionGrouper(); final Map<TaskId, Set<TopicPartition>> expectedPartitionsForTask = new HashMap<>(); final Map<Integer, Set<String>> topicGroups = new HashMap<>(); int topicGroupId = 0; topicGroups.put(topicGroupId, m... |
WallclockTimestampExtractor implements TimestampExtractor { @Override public long extract(final ConsumerRecord<Object, Object> record, final long previousTimestamp) { return System.currentTimeMillis(); } @Override long extract(final ConsumerRecord<Object, Object> record, final long previousTimestamp); } | @Test public void extractSystemTimestamp() { final TimestampExtractor extractor = new WallclockTimestampExtractor(); final long before = System.currentTimeMillis(); final long timestamp = extractor.extract(new ConsumerRecord<>("anyTopic", 0, 0, null, null), 42); final long after = System.currentTimeMillis(); assertThat... |
StateRestorer { void restore(final byte[] key, final byte[] value) { stateRestoreCallback.restore(key, value); } StateRestorer(final TopicPartition partition,
final StateRestoreCallback stateRestoreCallback,
final Long checkpoint,
final long offsetLimit,
... | @Test public void shouldCallRestoreOnRestoreCallback() throws Exception { restorer.restore(new byte[0], new byte[0]); assertThat(callback.restored.size(), equalTo(1)); } |
StateRestorer { boolean hasCompleted(final long recordOffset, final long endOffset) { return endOffset == 0 || recordOffset >= readTo(endOffset); } StateRestorer(final TopicPartition partition,
final StateRestoreCallback stateRestoreCallback,
final Long checkpoint,
... | @Test public void shouldBeCompletedIfRecordOffsetGreaterThanEndOffset() throws Exception { assertTrue(restorer.hasCompleted(11, 10)); }
@Test public void shouldBeCompletedIfRecordOffsetGreaterThanOffsetLimit() throws Exception { assertTrue(restorer.hasCompleted(51, 100)); }
@Test public void shouldBeCompletedIfEndOffse... |
AbstractProcessorContext implements InternalProcessorContext { @Override public void register(final StateStore store, final boolean loggingEnabled, final StateRestoreCallback stateRestoreCallback) { if (initialized) { throw new IllegalStateException("Can only create state stores during initialization."); } Objects.requ... | @Test public void shouldNotThrowIllegalStateExceptionOnRegisterWhenContextIsNotInitialized() throws Exception { context.register(stateStore, false, null); }
@Test(expected = NullPointerException.class) public void shouldThrowNullPointerOnRegisterIfStateStoreIsNull() { context.register(null, false, null); } |
AbstractProcessorContext implements InternalProcessorContext { @Override public String topic() { if (recordContext == null) { throw new IllegalStateException("This should not happen as topic() should only be called while a record is processed"); } final String topic = recordContext.topic(); if (topic.equals(NONEXIST_TO... | @Test public void shouldReturnTopicFromRecordContext() throws Exception { assertThat(context.topic(), equalTo(recordContext.topic())); } |
AbstractProcessorContext implements InternalProcessorContext { @Override public int partition() { if (recordContext == null) { throw new IllegalStateException("This should not happen as partition() should only be called while a record is processed"); } return recordContext.partition(); } AbstractProcessorContext(final ... | @Test public void shouldReturnPartitionFromRecordContext() throws Exception { assertThat(context.partition(), equalTo(recordContext.partition())); } |
AbstractProcessorContext implements InternalProcessorContext { @Override public long offset() { if (recordContext == null) { throw new IllegalStateException("This should not happen as offset() should only be called while a record is processed"); } return recordContext.offset(); } AbstractProcessorContext(final TaskId t... | @Test public void shouldReturnOffsetFromRecordContext() throws Exception { assertThat(context.offset(), equalTo(recordContext.offset())); } |
AbstractProcessorContext implements InternalProcessorContext { @Override public long timestamp() { if (recordContext == null) { throw new IllegalStateException("This should not happen as timestamp() should only be called while a record is processed"); } return recordContext.timestamp(); } AbstractProcessorContext(final... | @Test public void shouldReturnTimestampFromRecordContext() throws Exception { assertThat(context.timestamp(), equalTo(recordContext.timestamp())); } |
TopicAdmin implements AutoCloseable { public boolean createTopic(NewTopic topic) { if (topic == null) return false; Set<String> newTopicNames = createTopics(topic); return newTopicNames.contains(topic.name()); } TopicAdmin(Map<String, Object> adminConfig); TopicAdmin(Map<String, Object> adminConfig, AdminClient admin... | @Test public void shouldReturnFalseWhenSuppliedNullTopicDescription() { Cluster cluster = createCluster(1); try (MockKafkaAdminClientEnv env = new MockKafkaAdminClientEnv(cluster)) { env.kafkaClient().setNode(cluster.controller()); env.kafkaClient().setNodeApiVersions(NodeApiVersions.create()); env.kafkaClient().prepar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.