Search in sources :

Example 1 with InternalNameProvider

use of org.apache.kafka.streams.kstream.internals.InternalNameProvider in project apache-kafka-on-k8s by banzaicloud.

the class GlobalStreamThreadTest method before.

@SuppressWarnings("unchecked")
@Before
public void before() {
    final MaterializedInternal<Object, Object, KeyValueStore<Bytes, byte[]>> materialized = new MaterializedInternal<>(Materialized.<Object, Object, KeyValueStore<Bytes, byte[]>>with(null, null), new InternalNameProvider() {

        @Override
        public String newProcessorName(String prefix) {
            return "processorName";
        }

        @Override
        public String newStoreName(String prefix) {
            return GLOBAL_STORE_NAME;
        }
    }, "store-");
    builder.addGlobalStore((StoreBuilder) new KeyValueStoreMaterializer<>(materialized).materialize().withLoggingDisabled(), "sourceName", null, null, null, GLOBAL_STORE_TOPIC_NAME, "processorName", new KTableSource<>(GLOBAL_STORE_NAME));
    final HashMap<String, Object> properties = new HashMap<>();
    properties.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "blah");
    properties.put(StreamsConfig.APPLICATION_ID_CONFIG, "blah");
    properties.put(StreamsConfig.STATE_DIR_CONFIG, TestUtils.tempDirectory().getAbsolutePath());
    config = new StreamsConfig(properties);
    globalStreamThread = new GlobalStreamThread(builder.buildGlobalStateTopology(), config, mockConsumer, new StateDirectory(config, time), 0, new Metrics(), new MockTime(), "clientId", stateRestoreListener);
}
Also used : HashMap(java.util.HashMap) KeyValueStore(org.apache.kafka.streams.state.KeyValueStore) InternalNameProvider(org.apache.kafka.streams.kstream.internals.InternalNameProvider) Bytes(org.apache.kafka.common.utils.Bytes) Metrics(org.apache.kafka.common.metrics.Metrics) MaterializedInternal(org.apache.kafka.streams.kstream.internals.MaterializedInternal) KeyValueStoreMaterializer(org.apache.kafka.streams.kstream.internals.KeyValueStoreMaterializer) MockTime(org.apache.kafka.common.utils.MockTime) StreamsConfig(org.apache.kafka.streams.StreamsConfig) Before(org.junit.Before)

Aggregations

HashMap (java.util.HashMap)1 Metrics (org.apache.kafka.common.metrics.Metrics)1 Bytes (org.apache.kafka.common.utils.Bytes)1 MockTime (org.apache.kafka.common.utils.MockTime)1 StreamsConfig (org.apache.kafka.streams.StreamsConfig)1 InternalNameProvider (org.apache.kafka.streams.kstream.internals.InternalNameProvider)1 KeyValueStoreMaterializer (org.apache.kafka.streams.kstream.internals.KeyValueStoreMaterializer)1 MaterializedInternal (org.apache.kafka.streams.kstream.internals.MaterializedInternal)1 KeyValueStore (org.apache.kafka.streams.state.KeyValueStore)1 Before (org.junit.Before)1