Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
themeEclipse
titlePublic Constructor
linenumberstrue
	/**
     * Create a new test diver instance.
     * Default test properties are used to initialize the driver instance
     *
     * @param topology the topology to be tested
     */
    public TopologyTestDriver(final Topology topology) {
        this(topology, DEFAULT_TEST_PROPSnew Properties());
    }

	


Proposed Changes

We propose to add new constructor to TopologyTestDriver class. This constructor will have only Topology as parameter. Kafka streams config has APPLICATION_ID_CONFIG and BOOTSTRAP_SERVERS_CONFIG as required parameters. Those values will be provided in the private constructor of TopologyTestDriver. We want to set randomized application id to avoid conflicts with tests running in parallel. Proposing to change private constructor of TopologyTestDriver in following way.

Code Block
languagejava
linenumberstrue
 private TopologyTestDriver(final InternalTopologyBuilder builder,
                               static final Properties DEFAULT_TEST_PROPS;

config,
                               final staticlong initialWallClockTimeMs) {
        DEFAULT_TEST_PROPSfinal Properties configCopy = new Properties();
        DEFAULT_TEST_PROPS.put(APPLICATION_IDconfigCopy.putAll(config);
        if (!configCopy.containsKey(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG)) {
            configCopy.setProperty(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "dummy-appbootstrap-idhost:0");
        }
        DEFAULT_TEST_PROPSif (!configCopy.containsKey(StreamsConfig.APPLICATION_ID_CONFIG)) {
            // provide randomized dummy app-id if it's not specified
            configCopy.setProperty(StreamsConfig.BOOTSTRAPAPPLICATION_SERVERSID_CONFIG,
                    "dummy-topology-test-driver-app-id-" + ThreadLocalRandom.current().nextInt());
        }

Proposed Changes

...


		.
		.
		.
		.
}



Classes which will have usage for this constructor are 

...