public static DataSet generate(final int numArticles, final int numComments) {
            // generate four days' worth of data, starting right now (to avoid broker retention/compaction)
            final int timeSpan = 1000 * 60 * 60 * 24 * 4;
            final long dataStartTime = System.currentTimeMillis();
            final long dataEndTime = dataStartTime + timeSpan;

            // Explicitly create a seed so we can we can log.
            // If we are debugging a failed run, we can deterministically produce the same dataset
            // by plugging in the seed from that run.
            final long seed = new Random().nextLong();
            final Random random = new Random(seed);
            LOG.info("Dataset PRNG seed: {}", seed);
            final Iterator<Integer> articlesToCommentOnSequence = zipfNormal(random, numArticles);

            final Article[] articles = new Article[numArticles];
            final Comment[] comments = new Comment[numComments];

            // first generate the articles (note: out of order)
            for (int i = 0; i < numArticles; i++) {
                final long timestamp = random.nextInt(timeSpan) + dataStartTime;
                final String text = randomText(random, 2000);
                articles[i] = new Article(i, timestamp, text);
            }

            // then spend the rest of the time generating the comments
            for (int i = 0; i < numComments; i++) {
                final int articleId = articlesToCommentOnSequence.next();
                final long articleTimestamp = articles[articleId].getTimestamp();
                // comments get written after articles
                final long timestamp = random.nextInt((int) (dataEndTime - articleTimestamp)) + articleTimestamp;
                final String text = randomText(random, 200);
                final Comment comment = new Comment(i, timestamp, text, articleId);
                comments[i] = comment;
            }
            return new DataSet(articles, comments);
        }
This test builds on a basic relational data caricature:
a set of articles, each with a set of comments on them.
<p>
The particular relation in this data is that each Comment
has an articleId foreign-key reference to an Article.
<p>
We traverse this relation in both directions to verify
correct operation of Kafka Streams:
- Embed on each Comment a prefix of the text in the Article it references
aka SELECT * FROM Comment JOIN Article ON Comment.ArticleID = Article.ID
- Embed on each Article a count of all the Comments it has
streams/src/test/java/org/apache/kafka/streams/tests/RelationalSmokeTest.java