tpalfy commented on a change in pull request #3944: NIFI-6939: Upgrade Atlas 
client dependency to 2.0.0
URL: https://github.com/apache/nifi/pull/3944#discussion_r363304081
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-atlas-bundle/nifi-atlas-reporting-task/src/test/java/org/apache/nifi/atlas/reporting/TestReportLineageToAtlas.java
 ##########
 @@ -200,4 +196,86 @@ private void 
testConnectAndReadTimeout(Map<PropertyDescriptor, String> propertie
         assertEquals(expectedConnectTimeout, actualConnectTimeout);
         assertEquals(expectedReadTimeout, actualReadTimeout);
     }
+
+    @Test
+    public void testNotificationSendingIsSynchronousWhenAtlasConfIsGenerated() 
throws Exception {
+        String atlasConfDir = createAtlasConfDir();
+
+        Map<PropertyDescriptor, String> properties = 
initReportingTaskProperties(atlasConfDir);
+
+        ConfigurationContext configurationContext = new 
MockConfigurationContext(properties, null);
+
+        testSubject.initialize(initializationContext);
+        testSubject.setup(configurationContext);
+
+        Configuration atlasProperties = ApplicationProperties.get();
+        boolean isAsync = 
atlasProperties.getBoolean(AtlasHook.ATLAS_NOTIFICATION_ASYNCHRONOUS, 
Boolean.TRUE);
+        assertFalse(isAsync);
+    }
+
+    @Test
+    public void 
testNotificationSendingIsSynchronousWhenAtlasConfIsProvidedAndSynchronousModeHasBeenSet()
 throws Exception {
+        String atlasConfDir = createAtlasConfDir();
+
+        Properties atlasConf = new Properties();
+        atlasConf.setProperty(AtlasHook.ATLAS_NOTIFICATION_ASYNCHRONOUS, 
"false");
+        saveAtlasConf(atlasConfDir, atlasConf);
+
+        Map<PropertyDescriptor, String> properties = 
initReportingTaskProperties(atlasConfDir);
+        properties.put(ATLAS_CONF_CREATE, "false");
+
+        ConfigurationContext configurationContext = new 
MockConfigurationContext(properties, null);
+
+        testSubject.initialize(initializationContext);
+        testSubject.setup(configurationContext);
+
+        Configuration atlasProperties = ApplicationProperties.get();
+        boolean isAsync = 
atlasProperties.getBoolean(AtlasHook.ATLAS_NOTIFICATION_ASYNCHRONOUS, 
Boolean.TRUE);
+        assertFalse(isAsync);
+    }
+
+    @Test(expected = ProcessException.class)
+    public void 
testNotificationSendingIsSynchronousWhenAtlasConfIsProvidedButSynchronousModeHasNotBeenSet()
 throws Exception {
 
 Review comment:
   Maybe a name like this would describe the case better: 
`testThrowExceptionWhenAtlasConfIsProvidedButSynchronousModeHasNotBeenSet`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to