Search in sources :

Example 1 with ConfigurationChangeNotifier

use of org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeNotifier in project nifi-minifi by apache.

the class FileChangeIngestorTest method testTargetChangedWithModificationEvent_nonConfigFile.

@Test
public void testTargetChangedWithModificationEvent_nonConfigFile() throws Exception {
    when(mockDifferentiator.isNew(Mockito.any(InputStream.class))).thenReturn(false);
    final ConfigurationChangeNotifier testNotifier = Mockito.mock(ConfigurationChangeNotifier.class);
    // In this case, we receive a trigger event for the directory monitored, but it was another file not being monitored
    final WatchKey mockWatchKey = createMockWatchKeyForPath("footage_not_found.yml");
    establishMockEnvironmentForChangeTests(testNotifier, mockWatchKey);
    notifierSpy.targetChanged();
    verify(testNotifier, Mockito.never()).notifyListeners(Mockito.any(ByteBuffer.class));
}
Also used : ConfigurationChangeNotifier(org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeNotifier) InputStream(java.io.InputStream) WatchKey(java.nio.file.WatchKey) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Example 2 with ConfigurationChangeNotifier

use of org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeNotifier in project nifi-minifi by apache.

the class FileChangeIngestorTest method testTargetChangedNoModification.

/* Verify handleChange events */
@Test
public void testTargetChangedNoModification() throws Exception {
    when(mockDifferentiator.isNew(Mockito.any(InputStream.class))).thenReturn(false);
    final ConfigurationChangeNotifier testNotifier = Mockito.mock(ConfigurationChangeNotifier.class);
    // In this case the WatchKey is null because there were no events found
    establishMockEnvironmentForChangeTests(testNotifier, null);
    verify(testNotifier, Mockito.never()).notifyListeners(Mockito.any(ByteBuffer.class));
}
Also used : ConfigurationChangeNotifier(org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeNotifier) InputStream(java.io.InputStream) ByteBuffer(java.nio.ByteBuffer) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)2 ByteBuffer (java.nio.ByteBuffer)2 ConfigurationChangeNotifier (org.apache.nifi.minifi.bootstrap.configuration.ConfigurationChangeNotifier)2 Test (org.junit.Test)2 WatchKey (java.nio.file.WatchKey)1