Re: MockClientSupplier
Hello Andy, You can just call KafkaStreams.toString(). I'm copying its java doc string here: "Produces a string representation contain useful information about Kafka Streams * Such as thread IDs, task IDs and a representation of the topology. This is useful * in debugging scenarios." Guozhang On Mon, Sep 12, 2016 at 2:56 AM, Andy Chambers <achambers.h...@gmail.com> wrote: > Thanks Guozhang, > > Actually on inspection, the MockClientSupplier itself seems easy enough to > replicate. But now I have a question about the MockConsumer. I expected to > be able to use the MockConsumer to simulate input events but when I try to > add a record, I get: > >Cannot add records for a partition that is not assigned to the >consumer > > I'd have thought the app under test would have caused the mock consumer to > subscribe to the input topic. I tried to verify this without even producing > a record by checking the "subscription" method of the mock consumer but > that returns an empty set even after the app streams have been started. > > Is there any way to inspect the topology of a streams app? I think that's > what I'd really like to test. The transformations/aggregations themselves > are obviously easier to test independently of kafka. It might be nice to > just check they are all glued together correctly. > > Cheers, > Andy > > > > On Sun, Sep 11, 2016 at 8:56 PM, Guozhang Wang <wangg...@gmail.com> wrote: > > > Hello Andy, > > > > Unfortunately the included package `o.a.k.test` is not included in the > > released maven. > > > > There are some discussions about moving these test fixtures into public > > packages: > > > > https://issues.apache.org/jira/browse/KAFKA-3625 > > > > Guozhang > > > > On Sat, Sep 10, 2016 at 2:01 PM, Andy Chambers <achambers.h...@gmail.com > > > > wrote: > > > > > Hi, > > > > > > The MockClientSupplier looks like it would be useful for developers > > wishing > > > to write unit tests for kafka streams apps. Is it public? If so, can > > > someone help me out with the maven coordinates. Currently depending on > > > these maven coordinates > > > > > > [org.apache.kafka/kafka-streams "0.10.0.1"] > > > [org.apache.kafka/kafka-clients "0.10.0.1"] > > > [org.apache.kafka/kafka_2.11 "0.10.0.1"] > > > > > > but none seem to include the class org.apache.kafka.test. > > > MockClientSupplier > > > > > > Cheers, > > > Andy > > > > > > > > > > > -- > > -- Guozhang > > > -- -- Guozhang
Re: MockClientSupplier
Thanks Guozhang, Actually on inspection, the MockClientSupplier itself seems easy enough to replicate. But now I have a question about the MockConsumer. I expected to be able to use the MockConsumer to simulate input events but when I try to add a record, I get: Cannot add records for a partition that is not assigned to the consumer I'd have thought the app under test would have caused the mock consumer to subscribe to the input topic. I tried to verify this without even producing a record by checking the "subscription" method of the mock consumer but that returns an empty set even after the app streams have been started. Is there any way to inspect the topology of a streams app? I think that's what I'd really like to test. The transformations/aggregations themselves are obviously easier to test independently of kafka. It might be nice to just check they are all glued together correctly. Cheers, Andy On Sun, Sep 11, 2016 at 8:56 PM, Guozhang Wang <wangg...@gmail.com> wrote: > Hello Andy, > > Unfortunately the included package `o.a.k.test` is not included in the > released maven. > > There are some discussions about moving these test fixtures into public > packages: > > https://issues.apache.org/jira/browse/KAFKA-3625 > > Guozhang > > On Sat, Sep 10, 2016 at 2:01 PM, Andy Chambers <achambers.h...@gmail.com> > wrote: > > > Hi, > > > > The MockClientSupplier looks like it would be useful for developers > wishing > > to write unit tests for kafka streams apps. Is it public? If so, can > > someone help me out with the maven coordinates. Currently depending on > > these maven coordinates > > > > [org.apache.kafka/kafka-streams "0.10.0.1"] > > [org.apache.kafka/kafka-clients "0.10.0.1"] > > [org.apache.kafka/kafka_2.11 "0.10.0.1"] > > > > but none seem to include the class org.apache.kafka.test. > > MockClientSupplier > > > > Cheers, > > Andy > > > > > > -- > -- Guozhang >
Re: MockClientSupplier
Hello Andy, Unfortunately the included package `o.a.k.test` is not included in the released maven. There are some discussions about moving these test fixtures into public packages: https://issues.apache.org/jira/browse/KAFKA-3625 Guozhang On Sat, Sep 10, 2016 at 2:01 PM, Andy Chambers <achambers.h...@gmail.com> wrote: > Hi, > > The MockClientSupplier looks like it would be useful for developers wishing > to write unit tests for kafka streams apps. Is it public? If so, can > someone help me out with the maven coordinates. Currently depending on > these maven coordinates > > [org.apache.kafka/kafka-streams "0.10.0.1"] > [org.apache.kafka/kafka-clients "0.10.0.1"] > [org.apache.kafka/kafka_2.11 "0.10.0.1"] > > but none seem to include the class org.apache.kafka.test. > MockClientSupplier > > Cheers, > Andy > -- -- Guozhang
MockClientSupplier
Hi, The MockClientSupplier looks like it would be useful for developers wishing to write unit tests for kafka streams apps. Is it public? If so, can someone help me out with the maven coordinates. Currently depending on these maven coordinates [org.apache.kafka/kafka-streams "0.10.0.1"] [org.apache.kafka/kafka-clients "0.10.0.1"] [org.apache.kafka/kafka_2.11 "0.10.0.1"] but none seem to include the class org.apache.kafka.test.MockClientSupplier Cheers, Andy