use of org.apache.nifi.provenance.ProvenanceEventRecord in project nifi by apache.
the class TestSiteToSiteProvenanceReportingTask method testFilterComponentIdSuccess.
@Test
public void testFilterComponentIdSuccess() throws IOException, InitializationException {
final Map<PropertyDescriptor, String> properties = new HashMap<>();
for (final PropertyDescriptor descriptor : new MockSiteToSiteProvenanceReportingTask().getSupportedPropertyDescriptors()) {
properties.put(descriptor, descriptor.getDefaultValue());
}
properties.put(SiteToSiteProvenanceReportingTask.BATCH_SIZE, "1000");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_COMPONENT_ID, "2345, 5678, 1234");
ProvenanceEventRecord event = createProvenanceEventRecord();
MockSiteToSiteProvenanceReportingTask task = setup(event, properties);
task.initialize(initContext);
task.onScheduled(confContext);
task.onTrigger(context);
assertEquals(3, task.dataSent.size());
}
use of org.apache.nifi.provenance.ProvenanceEventRecord in project nifi by apache.
the class TestSiteToSiteProvenanceReportingTask method testFilterComponentTypeNoResult.
@Test
public void testFilterComponentTypeNoResult() throws IOException, InitializationException {
final Map<PropertyDescriptor, String> properties = new HashMap<>();
for (final PropertyDescriptor descriptor : new MockSiteToSiteProvenanceReportingTask().getSupportedPropertyDescriptors()) {
properties.put(descriptor, descriptor.getDefaultValue());
}
properties.put(SiteToSiteProvenanceReportingTask.BATCH_SIZE, "1000");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_COMPONENT_TYPE, "proc.*");
ProvenanceEventRecord event = createProvenanceEventRecord();
MockSiteToSiteProvenanceReportingTask task = setup(event, properties);
task.initialize(initContext);
task.onScheduled(confContext);
task.onTrigger(context);
assertEquals(0, task.dataSent.size());
}
use of org.apache.nifi.provenance.ProvenanceEventRecord in project nifi by apache.
the class TestSiteToSiteProvenanceReportingTask method testFilterMultiFilterNoResult.
@Test
public void testFilterMultiFilterNoResult() throws IOException, InitializationException {
final Map<PropertyDescriptor, String> properties = new HashMap<>();
for (final PropertyDescriptor descriptor : new MockSiteToSiteProvenanceReportingTask().getSupportedPropertyDescriptors()) {
properties.put(descriptor, descriptor.getDefaultValue());
}
properties.put(SiteToSiteProvenanceReportingTask.BATCH_SIZE, "1000");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_COMPONENT_ID, "2345, 5678, 1234");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_COMPONENT_TYPE, "dummy.*");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_EVENT_TYPE, "DROP");
ProvenanceEventRecord event = createProvenanceEventRecord();
MockSiteToSiteProvenanceReportingTask task = setup(event, properties);
task.initialize(initContext);
task.onScheduled(confContext);
task.onTrigger(context);
assertEquals(0, task.dataSent.size());
}
use of org.apache.nifi.provenance.ProvenanceEventRecord in project nifi by apache.
the class TestSiteToSiteProvenanceReportingTask method testFilterMultiFilterExcludeTakesPrecedence.
@Test
public void testFilterMultiFilterExcludeTakesPrecedence() throws IOException, InitializationException {
final Map<PropertyDescriptor, String> properties = new HashMap<>();
for (final PropertyDescriptor descriptor : new MockSiteToSiteProvenanceReportingTask().getSupportedPropertyDescriptors()) {
properties.put(descriptor, descriptor.getDefaultValue());
}
properties.put(SiteToSiteProvenanceReportingTask.BATCH_SIZE, "1000");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_COMPONENT_TYPE_EXCLUDE, "dummy.*");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_EVENT_TYPE, "RECEIVE");
ProvenanceEventRecord event = createProvenanceEventRecord();
MockSiteToSiteProvenanceReportingTask task = setup(event, properties);
task.initialize(initContext);
task.onScheduled(confContext);
task.onTrigger(context);
assertEquals(0, task.dataSent.size());
}
use of org.apache.nifi.provenance.ProvenanceEventRecord in project nifi by apache.
the class TestSiteToSiteProvenanceReportingTask method testRemotePorts.
@Test
public void testRemotePorts() throws IOException, InitializationException {
final Map<PropertyDescriptor, String> properties = new HashMap<>();
for (final PropertyDescriptor descriptor : new MockSiteToSiteProvenanceReportingTask().getSupportedPropertyDescriptors()) {
properties.put(descriptor, descriptor.getDefaultValue());
}
properties.put(SiteToSiteProvenanceReportingTask.BATCH_SIZE, "1000");
properties.put(SiteToSiteProvenanceReportingTask.FILTER_COMPONENT_ID, "riB2,roB3");
// riB2 is a Remote Input Port in Process Group B2.
ProvenanceEventRecord event = createProvenanceEventRecord("riB2", "Remote Input Port");
MockSiteToSiteProvenanceReportingTask task = setup(event, properties, 1);
task.initialize(initContext);
task.onScheduled(confContext);
task.onTrigger(context);
assertEquals(1, task.dataSent.size());
JsonNode reportedEvent = new ObjectMapper().readTree(task.dataSent.get(0)).get(0);
assertEquals("riB2", reportedEvent.get("componentId").asText());
assertEquals("Remote Input Port name", reportedEvent.get("componentName").asText());
assertEquals("pgB2", reportedEvent.get("processGroupId").asText());
// roB3 is a Remote Output Port in Process Group B3.
event = createProvenanceEventRecord("roB3", "Remote Output Port");
task = setup(event, properties, 1);
task.initialize(initContext);
task.onScheduled(confContext);
task.onTrigger(context);
assertEquals(1, task.dataSent.size());
reportedEvent = new ObjectMapper().readTree(task.dataSent.get(0)).get(0);
assertEquals("roB3", reportedEvent.get("componentId").asText());
assertEquals("Remote Output Port name", reportedEvent.get("componentName").asText());
assertEquals("pgB3", reportedEvent.get("processGroupId").asText());
}
Aggregations