Java Code Examples for org.apache.nifi.scheduling.SchedulingStrategy#TIMER_DRIVEN

The following examples show how to use org.apache.nifi.scheduling.SchedulingStrategy#TIMER_DRIVEN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestStandardProcessScheduler.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws InitializationException {
    System.setProperty(NiFiProperties.PROPERTIES_FILE_PATH, TestStandardProcessScheduler.class.getResource("/nifi.properties").getFile());
    this.nifiProperties = NiFiProperties.createBasicNiFiProperties(null, null);
    scheduler = new StandardProcessScheduler(Mockito.mock(ControllerServiceProvider.class), null, stateMgrProvider, variableRegistry, nifiProperties);
    scheduler.setSchedulingAgent(SchedulingStrategy.TIMER_DRIVEN, Mockito.mock(SchedulingAgent.class));

    reportingTask = new TestReportingTask();
    final ReportingInitializationContext config = new StandardReportingInitializationContext(UUID.randomUUID().toString(), "Test", SchedulingStrategy.TIMER_DRIVEN, "5 secs",
            Mockito.mock(ComponentLog.class), null, nifiProperties);
    reportingTask.initialize(config);

    final ValidationContextFactory validationContextFactory = new StandardValidationContextFactory(null, variableRegistry);
    final ComponentLog logger = Mockito.mock(ComponentLog.class);
    taskNode = new StandardReportingTaskNode(reportingTask, UUID.randomUUID().toString(), null, scheduler, validationContextFactory, variableRegistry, logger);

    controller = Mockito.mock(FlowController.class);
    rootGroup = new MockProcessGroup();
    Mockito.when(controller.getGroup(Mockito.anyString())).thenReturn(rootGroup);
}
 
Example 2
Source File: ExtensionBuilder.java    From nifi with Apache License 2.0 5 votes vote down vote up
private LoggableComponent<ReportingTask> createLoggableReportingTask() throws ReportingTaskInstantiationException {
    try {
        final LoggableComponent<ReportingTask> taskComponent = createLoggableComponent(ReportingTask.class);

        final String taskName = taskComponent.getComponent().getClass().getSimpleName();
        final ReportingInitializationContext config = new StandardReportingInitializationContext(identifier, taskName,
                SchedulingStrategy.TIMER_DRIVEN, "1 min", taskComponent.getLogger(), serviceProvider, kerberosConfig, nodeTypeProvider);

        taskComponent.getComponent().initialize(config);

        return taskComponent;
    } catch (final Exception e) {
        throw new ReportingTaskInstantiationException(type, e);
    }
}
 
Example 3
Source File: StandardReportingInitializationContext.java    From nifi with Apache License 2.0 5 votes vote down vote up
@Override
public long getSchedulingPeriod(final TimeUnit timeUnit) {
    if (schedulingStrategy == SchedulingStrategy.TIMER_DRIVEN) {
        return FormatUtils.getTimeDuration(schedulingPeriod, timeUnit);
    }
    return -1L;
}
 
Example 4
Source File: StandardReportingInitializationContext.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
@Override
public long getSchedulingPeriod(final TimeUnit timeUnit) {
    if (schedulingStrategy == SchedulingStrategy.TIMER_DRIVEN) {
        return FormatUtils.getTimeDuration(schedulingPeriod, timeUnit);
    }
    return -1L;
}
 
Example 5
Source File: DocumentationReportingInitializationContext.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 6
Source File: MockReportingInitializationContext.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 7
Source File: LocalPort.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 8
Source File: StandardRemoteGroupPort.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 9
Source File: StandardPublicPort.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 10
Source File: StandardFunnel.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 11
Source File: MockReportingInitializationContext.java    From nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 12
Source File: MockReportingInitializationContext.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 13
Source File: MockReportingInitializationContext.java    From nifi-minifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 14
Source File: LocalPort.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 15
Source File: StandardRemoteGroupPort.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 16
Source File: StandardRootGroupPort.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 17
Source File: MockReportingInitializationContext.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}
 
Example 18
Source File: StandardFunnel.java    From localization_nifi with Apache License 2.0 4 votes vote down vote up
@Override
public SchedulingStrategy getSchedulingStrategy() {
    return SchedulingStrategy.TIMER_DRIVEN;
}