<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: org.apache.nifi.util.TestRunners giving error in Nifi unit test - As of version 1.14.0, ProcessSession.commit() should be avoided when possible. in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/org-apache-nifi-util-TestRunners-giving-error-in-Nifi-unit/m-p/347613#M235221</link>
    <description>&lt;PRE&gt;&lt;SPAN&gt;testRunner&lt;/SPAN&gt;.setAllowSynchronousSessionCommits(&lt;SPAN&gt;true&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Helped me to get rid of this error&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2022 10:25:15 GMT</pubDate>
    <dc:creator>hegdemahendra</dc:creator>
    <dc:date>2022-07-14T10:25:15Z</dc:date>
    <item>
      <title>org.apache.nifi.util.TestRunners giving error in Nifi unit test - As of version 1.14.0, ProcessSession.commit() should be avoided when possible.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/org-apache-nifi-util-TestRunners-giving-error-in-Nifi-unit/m-p/347459#M235180</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using&amp;nbsp;org.apache.nifi.util.TestRunners in Nifi custom processor unit test cases, and code something like below..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-SPOILER&gt;testRunner = TestRunners.newTestRunner(O9QueueRouting.class);&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;MockFlowFile ff = this.testRunner.enqueue(new ByteArrayInputStream(ffContents.getBytes(StandardCharsets.UTF_8)));&lt;BR /&gt;Map&amp;lt;String, String&amp;gt; attrs = new HashMap&amp;lt;String, String&amp;gt;();&lt;BR /&gt;attrs.put("routingheader", "headervalue");&lt;BR /&gt;attrs.put("kafka.topic", "topic1");&lt;BR /&gt;ff.putAttributes(attrs);&lt;BR /&gt;testRunner.run();&lt;/LI-SPOILER&gt;&lt;P&gt;&lt;BR /&gt;It was working earlier now started giving error like below -&lt;BR /&gt;&lt;BR /&gt;[ERROR] O9QueueRoutingTest.test:73 java.lang.RuntimeException: As of version 1.14.0, ProcessSession.commit() should be avoided when possible.&lt;BR /&gt;See JavaDocs for explanations. Instead, use commitAsync(), commitAsync(Runnable), or commitAsync(Runnable, Consumer&amp;lt;Throwable&amp;gt;). However, if this is not possible,&lt;BR /&gt;ProcessSession.commit() may still be used, but this must be explicitly enabled by calling TestRunner.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how this can be resolved ?&lt;BR /&gt;How to&amp;nbsp;explicitly enable by calling TestRunner ?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Mahendra&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 08:14:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/org-apache-nifi-util-TestRunners-giving-error-in-Nifi-unit/m-p/347459#M235180</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2022-07-13T08:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: org.apache.nifi.util.TestRunners giving error in Nifi unit test - As of version 1.14.0, ProcessSession.commit() should be avoided when possible.</title>
      <link>https://community.cloudera.com/t5/Support-Questions/org-apache-nifi-util-TestRunners-giving-error-in-Nifi-unit/m-p/347613#M235221</link>
      <description>&lt;PRE&gt;&lt;SPAN&gt;testRunner&lt;/SPAN&gt;.setAllowSynchronousSessionCommits(&lt;SPAN&gt;true&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;Helped me to get rid of this error&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 10:25:15 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/org-apache-nifi-util-TestRunners-giving-error-in-Nifi-unit/m-p/347613#M235221</guid>
      <dc:creator>hegdemahendra</dc:creator>
      <dc:date>2022-07-14T10:25:15Z</dc:date>
    </item>
  </channel>
</rss>

