use of org.apache.nifi.minifi.commons.status.common.ValidationError in project nifi-minifi by apache.
the class StatusRequestParser method transformValidationResults.
private static List<ValidationError> transformValidationResults(Collection<ValidationResult> validationResults) {
List<ValidationError> validationErrorList = new LinkedList<>();
for (ValidationResult validationResult : validationResults) {
if (!validationResult.isValid()) {
ValidationError validationError = new ValidationError();
validationError.setSubject(validationResult.getSubject());
validationError.setInput(validationResult.getInput());
validationError.setReason(validationResult.getExplanation());
validationErrorList.add(validationError);
}
}
return validationErrorList;
}
use of org.apache.nifi.minifi.commons.status.common.ValidationError in project nifi-minifi by apache.
the class StatusReportPopulator method addControllerServiceStatus.
public static void addControllerServiceStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addValidationErrors, boolean addBulletins, boolean populateBulletins) {
ControllerServiceStatus controllerServiceStatus = new ControllerServiceStatus();
controllerServiceStatus.setName("mockControllerService");
if (addBulletins) {
if (populateBulletins) {
BulletinStatus bulletinStatus = new BulletinStatus();
bulletinStatus.setMessage("Bulletin message");
bulletinStatus.setTimestamp(new Date(1464019245000L));
controllerServiceStatus.setBulletinList(Collections.singletonList(bulletinStatus));
} else {
controllerServiceStatus.setBulletinList(Collections.EMPTY_LIST);
}
}
if (addHealth) {
ControllerServiceHealth controllerServiceHealth = new ControllerServiceHealth();
controllerServiceHealth.setState("ENABLED");
controllerServiceHealth.setHasBulletins(populateBulletins);
controllerServiceStatus.setControllerServiceHealth(controllerServiceHealth);
if (addValidationErrors) {
List<ValidationError> validationErrorList = new LinkedList<>();
ValidationError validationError1 = new ValidationError();
validationError1.setInput("input");
validationError1.setSubject("subject");
validationError1.setReason("is not valid");
validationErrorList.add(validationError1);
ValidationError validationError2 = new ValidationError();
validationError2.setInput("input2");
validationError2.setSubject("subject2");
validationError2.setReason("is not valid too");
validationErrorList.add(validationError2);
controllerServiceHealth.setValidationErrorList(validationErrorList);
} else {
controllerServiceHealth.setValidationErrorList(Collections.EMPTY_LIST);
}
}
flowStatusReport.setControllerServiceStatusList(Collections.singletonList(controllerServiceStatus));
}
use of org.apache.nifi.minifi.commons.status.common.ValidationError in project nifi-minifi by apache.
the class StatusReportPopulator method addProcessorStatus.
public static void addProcessorStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean validationErrors, boolean addStats, boolean addBulletins, boolean populateBulletins) {
ProcessorStatusBean expectedProcessorStatus = new ProcessorStatusBean();
expectedProcessorStatus.setName("UpdateAttributeProcessorId");
if (addHealth) {
ProcessorHealth processorHealth = new ProcessorHealth();
processorHealth.setHasBulletins(populateBulletins);
processorHealth.setRunStatus("Stopped");
if (validationErrors) {
List<ValidationError> validationErrorList = new LinkedList<>();
ValidationError validationError1 = new ValidationError();
validationError1.setInput("input");
validationError1.setSubject("subject");
validationError1.setReason("is not valid");
validationErrorList.add(validationError1);
ValidationError validationError2 = new ValidationError();
validationError2.setInput("input2");
validationError2.setSubject("subject2");
validationError2.setReason("is not valid too");
validationErrorList.add(validationError2);
processorHealth.setValidationErrorList(validationErrorList);
} else {
processorHealth.setValidationErrorList(Collections.EMPTY_LIST);
}
expectedProcessorStatus.setProcessorHealth(processorHealth);
}
if (addStats) {
ProcessorStats expectedProcessorStats = new ProcessorStats();
expectedProcessorStats.setActiveThreads(1);
expectedProcessorStats.setFlowfilesReceived(2);
expectedProcessorStats.setBytesRead(3);
expectedProcessorStats.setBytesWritten(4);
expectedProcessorStats.setFlowfilesSent(5);
expectedProcessorStats.setInvocations(6);
expectedProcessorStats.setProcessingNanos(7);
expectedProcessorStatus.setProcessorStats(expectedProcessorStats);
}
if (addBulletins) {
if (populateBulletins) {
BulletinStatus bulletinStatus = new BulletinStatus();
bulletinStatus.setMessage("Bulletin message");
bulletinStatus.setTimestamp(new Date(1464019245000L));
expectedProcessorStatus.setBulletinList(Collections.singletonList(bulletinStatus));
} else {
expectedProcessorStatus.setBulletinList(Collections.EMPTY_LIST);
}
}
flowStatusReport.setProcessorStatusList(Collections.singletonList(expectedProcessorStatus));
}
use of org.apache.nifi.minifi.commons.status.common.ValidationError in project nifi-minifi by apache.
the class StatusReportPopulator method addReportingTaskStatus.
public static void addReportingTaskStatus(FlowStatusReport flowStatusReport, boolean addHealth, boolean addValidationErrors, boolean addBulletins, boolean populateBulletins) {
ReportingTaskStatus reportingTaskStatus = new ReportingTaskStatus();
reportingTaskStatus.setName("ReportProvenance");
if (addHealth) {
ReportingTaskHealth reportingTaskHealth = new ReportingTaskHealth();
reportingTaskHealth.setActiveThreads(1);
reportingTaskHealth.setScheduledState("RUNNING");
reportingTaskHealth.setHasBulletins(populateBulletins);
if (addValidationErrors) {
List<ValidationError> validationErrorList = new LinkedList<>();
ValidationError validationError1 = new ValidationError();
validationError1.setInput("input");
validationError1.setSubject("subject");
validationError1.setReason("is not valid");
validationErrorList.add(validationError1);
ValidationError validationError2 = new ValidationError();
validationError2.setInput("input2");
validationError2.setSubject("subject2");
validationError2.setReason("is not valid too");
validationErrorList.add(validationError2);
reportingTaskHealth.setValidationErrorList(validationErrorList);
} else {
reportingTaskHealth.setValidationErrorList(Collections.EMPTY_LIST);
}
reportingTaskStatus.setReportingTaskHealth(reportingTaskHealth);
}
if (addBulletins) {
if (populateBulletins) {
BulletinStatus bulletinStatus = new BulletinStatus();
bulletinStatus.setMessage("Bulletin message");
bulletinStatus.setTimestamp(new Date(1464019245000L));
reportingTaskStatus.setBulletinList(Collections.singletonList(bulletinStatus));
} else {
reportingTaskStatus.setBulletinList(Collections.EMPTY_LIST);
}
}
flowStatusReport.setReportingTaskStatusList(Collections.singletonList(reportingTaskStatus));
}
Aggregations