@Override public MockFlowFile enqueue(final InputStream data, final Map<String, String> attributes) { final MockProcessSession session = new MockProcessSession(new SharedSessionState(processor, idGenerator), processor, enforceReadStreamsClosed); MockFlowFile flowFile = session.create(); flowFile = session.importFrom(data, flowFile); flowFile = session.putAllAttributes(flowFile, attributes); enqueue(flowFile); return flowFile; }
public AbstractHeartbeatMonitor(final ClusterCoordinator clusterCoordinator, final NiFiProperties nifiProperties) { this.clusterCoordinator = clusterCoordinator; final String heartbeatInterval = nifiProperties.getProperty(NiFiProperties.CLUSTER_PROTOCOL_HEARTBEAT_INTERVAL, NiFiProperties.DEFAULT_CLUSTER_PROTOCOL_HEARTBEAT_INTERVAL); this.heartbeatIntervalMillis = (int) FormatUtils.getTimeDuration(heartbeatInterval, TimeUnit.MILLISECONDS); }
/** * Returns true if the Kerberos service principal and keytab location * properties are populated. * * @return true if Kerberos service support is enabled */ public boolean isKerberosSpnegoSupportEnabled() { return !StringUtils.isBlank(getKerberosSpnegoPrincipal()) && !StringUtils.isBlank(getKerberosSpnegoKeytabLocation()); }
/** * The host name that will be given out to clients to connect to the Remote * Input Port. * * @return the remote input host name or null if not configured */ public String getRemoteInputHost() { final String value = getProperty(REMOTE_INPUT_HOST); return StringUtils.isBlank(value) ? null : value; }
/** * Returns whether an OpenId Connect (OIDC) URL is set. * * @return whether an OpenId Connection URL is set */ public boolean isOidcEnabled() { return !StringUtils.isBlank(getOidcDiscoveryUrl()); }
public VolatileComponentStatusRepository(final NiFiProperties nifiProperties) { numDataPoints = nifiProperties.getIntegerProperty(NUM_DATA_POINTS_PROPERTY, DEFAULT_NUM_DATA_POINTS); gcStatuses = new RingBuffer<>(numDataPoints); timestamps = new RingBuffer<>(numDataPoints); }
/** * Returns the whitelisted proxy context paths as a comma-delimited string. The paths have been normalized to the form {@code /some/context/path}. * <p> * Note: Calling {@code NiFiProperties.getProperty(NiFiProperties.WEB_PROXY_CONTEXT_PATH)} will not normalize the paths. * * @return the path(s) */ public String getWhitelistedContextPaths() { return StringUtils.join(getWhitelistedContextPathsAsList(), ","); }
@Override public void warn(String msg, Object[] os) { if (lastArgIsException(os)) { warn(msg, translateException(os), (Throwable) os[os.length - 1]); } else { msg = "{} " + msg; os = addProcessor(os); logger.warn(msg, os); } }
public TestRunner getRunner() { TestRunner runner = TestRunners.newTestRunner(ReplaceTextWithMapping.class); /** * we have to disable validation of expression language because the processor will * need to evaluate the REGEX field with AND without flow files. If not disabled, * the test will throw an error about the evaluation scope */ runner.setValidateExpressionUsage(false); return runner; }
@Override public void warn(String msg, Object[] os, final Throwable t) { os = addProcessorAndThrowable(os, t); msg = "{} " + msg + ": {}"; logger.warn(msg, os); if (logger.isDebugEnabled()) { logger.warn("", t); } }
@Override public ValidationContext getControllerServiceValidationContext(final ControllerService controllerService) { final MockProcessContext serviceProcessContext = new MockProcessContext(controllerService, context, stateManager, variableRegistry); return new MockValidationContext(serviceProcessContext, stateManager, variableRegistry); }
@Override public void debug(String msg, Object[] os, Throwable t) { os = addProcessorAndThrowable(os, t); msg = "{} " + msg + ": {}"; logger.debug(msg, os); if (logger.isDebugEnabled()) { logger.debug("", t); } }
@Override public void info(String msg, Object[] os, Throwable t) { os = addProcessorAndThrowable(os, t); msg = "{} " + msg + ": {}"; logger.info(msg, os); if (logger.isDebugEnabled()) { logger.info("", t); } }
@Override public int getRemovedCount() { int count = 0; for (final MockProcessSession session : sessionFactory.getCreatedSessions()) { count += session.getRemovedCount(); } return count; }
@Override public void trace(String msg, Object[] os, Throwable t) { os = addProcessorAndThrowable(os, t); msg = "{} " + msg + ": {}"; logger.trace(msg, os); logger.trace("", t); }
@Override public void assertAllFlowFilesTransferred(final Relationship relationship) { for (final MockProcessSession session : sessionFactory.getCreatedSessions()) { session.assertAllFlowFilesTransferred(relationship); } }
@Override public void assertAllFlowFiles(Relationship relationship, FlowFileValidator validator) { for (final MockProcessSession session : sessionFactory.getCreatedSessions()) { session.assertAllFlowFiles(relationship, validator); } }
@Override public void trace(String msg, Object[] os) { msg = "{} " + msg; os = addProcessor(os); logger.trace(msg, os); }
public TestRunner getRunner() { TestRunner runner = TestRunners.newTestRunner(ReplaceText.class); /** * we have to disable validation of expression language because the scope of the evaluation * for the search value depends of another property (the evaluation mode). If not disabling * the validation, it'll throw an error about the eval */ runner.setValidateExpressionUsage(false); return runner; }