Search in sources :

Example 6 with TopologyException

use of org.apache.kafka.streams.errors.TopologyException in project apache-kafka-on-k8s by banzaicloud.

the class InternalTopologyBuilderTest method testAddProcessorWithSameName.

@Test
public void testAddProcessorWithSameName() {
    builder.addSource(null, "source", null, null, null, "topic-1");
    builder.addProcessor("processor", new MockProcessorSupplier(), "source");
    try {
        builder.addProcessor("processor", new MockProcessorSupplier(), "source");
        fail("Should throw TopologyException with processor name conflict");
    } catch (final TopologyException expected) {
    /* ok */
    }
}
Also used : MockProcessorSupplier(org.apache.kafka.test.MockProcessorSupplier) TopologyException(org.apache.kafka.streams.errors.TopologyException) Test(org.junit.Test)

Example 7 with TopologyException

use of org.apache.kafka.streams.errors.TopologyException in project apache-kafka-on-k8s by banzaicloud.

the class InternalTopologyBuilderTest method testAddStateStoreWithDuplicates.

@Test
public void testAddStateStoreWithDuplicates() {
    builder.addStateStore(new MockStateStoreSupplier("store", false));
    try {
        builder.addStateStore(new MockStateStoreSupplier("store", false));
        fail("Should throw TopologyException with store name conflict");
    } catch (final TopologyException expected) {
    /* ok */
    }
}
Also used : MockStateStoreSupplier(org.apache.kafka.test.MockStateStoreSupplier) TopologyException(org.apache.kafka.streams.errors.TopologyException) Test(org.junit.Test)

Example 8 with TopologyException

use of org.apache.kafka.streams.errors.TopologyException in project apache-kafka-on-k8s by banzaicloud.

the class InternalTopologyBuilderTest method testAddStateStoreWithSink.

@Test
public void testAddStateStoreWithSink() {
    builder.addSink("sink-1", "topic-1", null, null, null);
    try {
        builder.addStateStore(new MockStateStoreSupplier("store", false), "sink-1");
        fail("Should throw TopologyException with store cannot be added to sink");
    } catch (final TopologyException expected) {
    /* ok */
    }
}
Also used : MockStateStoreSupplier(org.apache.kafka.test.MockStateStoreSupplier) TopologyException(org.apache.kafka.streams.errors.TopologyException) Test(org.junit.Test)

Aggregations

TopologyException (org.apache.kafka.streams.errors.TopologyException)8 Test (org.junit.Test)7 MockStateStoreSupplier (org.apache.kafka.test.MockStateStoreSupplier)3 IntegrationTest (org.apache.kafka.test.IntegrationTest)2 MockProcessorSupplier (org.apache.kafka.test.MockProcessorSupplier)2 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 StreamsBuilder (org.apache.kafka.streams.StreamsBuilder)1 KStreamBuilder (org.apache.kafka.streams.kstream.KStreamBuilder)1