kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From damian...@apache.org
Subject kafka git commit: MINOR: update processor topology test driver
Date Tue, 12 Sep 2017 08:23:32 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 439050816 -> a67140317


MINOR: update processor topology test driver

Author: Bill Bejeck <bill@confluent.io>

Reviewers: Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>,
Damian Guy <damian.guy@gmail.com>

Closes #3828 from bbejeck/MINOR_update_processor_topology_test_driver


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/a6714031
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/a6714031
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/a6714031

Branch: refs/heads/trunk
Commit: a67140317a644034e91ee596ab22bfb55adde1e0
Parents: 4390508
Author: Bill Bejeck <bill@confluent.io>
Authored: Tue Sep 12 09:23:28 2017 +0100
Committer: Damian Guy <damian.guy@gmail.com>
Committed: Tue Sep 12 09:23:28 2017 +0100

----------------------------------------------------------------------
 .../kafka/streams/InternalTopologyAccessor.java | 32 ++++++++++++++++++++
 .../kafka/test/ProcessorTopologyTestDriver.java | 13 ++++++++
 2 files changed, 45 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/a6714031/streams/src/test/java/org/apache/kafka/streams/InternalTopologyAccessor.java
----------------------------------------------------------------------
diff --git a/streams/src/test/java/org/apache/kafka/streams/InternalTopologyAccessor.java
b/streams/src/test/java/org/apache/kafka/streams/InternalTopologyAccessor.java
new file mode 100644
index 0000000..a6144f2
--- /dev/null
+++ b/streams/src/test/java/org/apache/kafka/streams/InternalTopologyAccessor.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kafka.streams;
+
+import org.apache.kafka.streams.processor.internals.InternalTopologyBuilder;
+
+
+/**
+ * This class is meant for testing purposes only and allows the testing of
+ * topologies by using the  {@link org.apache.kafka.test.ProcessorTopologyTestDriver}
+ */
+public class InternalTopologyAccessor {
+
+    public static InternalTopologyBuilder getInternalTopologyBuilder(Topology topology) {
+        return topology.internalTopologyBuilder;
+    }
+}

http://git-wip-us.apache.org/repos/asf/kafka/blob/a6714031/streams/src/test/java/org/apache/kafka/test/ProcessorTopologyTestDriver.java
----------------------------------------------------------------------
diff --git a/streams/src/test/java/org/apache/kafka/test/ProcessorTopologyTestDriver.java
b/streams/src/test/java/org/apache/kafka/test/ProcessorTopologyTestDriver.java
index b2dbeb5..148511a 100644
--- a/streams/src/test/java/org/apache/kafka/test/ProcessorTopologyTestDriver.java
+++ b/streams/src/test/java/org/apache/kafka/test/ProcessorTopologyTestDriver.java
@@ -31,6 +31,7 @@ import org.apache.kafka.common.serialization.Deserializer;
 import org.apache.kafka.common.serialization.Serializer;
 import org.apache.kafka.common.utils.MockTime;
 import org.apache.kafka.common.utils.Time;
+import org.apache.kafka.streams.InternalTopologyAccessor;
 import org.apache.kafka.streams.StreamsConfig;
 import org.apache.kafka.streams.StreamsMetrics;
 import org.apache.kafka.streams.Topology;
@@ -157,6 +158,18 @@ public class ProcessorTopologyTestDriver {
     private StreamTask task;
     private GlobalStateUpdateTask globalStateTask;
 
+
+    /**
+     * Create a new test diver instance
+     * @param config the stream configuration for the topology
+     * @param topology the {@link Topology} whose {@link InternalTopologyBuilder} will
+     *                        be use to create the topology instance.
+     */
+    public ProcessorTopologyTestDriver(final StreamsConfig config,
+                                       final Topology topology) {
+        this(config, InternalTopologyAccessor.getInternalTopologyBuilder(topology));
+    }
+
     /**
      * Create a new test driver instance.
      * @param config the stream configuration for the topology


Mime
View raw message