19 package org.sleuthkit.autopsy.testutils;
21 import java.nio.file.Path;
22 import java.util.List;
23 import java.util.UUID;
24 import org.apache.commons.collections.CollectionUtils;
60 if (!dataSourcePath.toFile().exists()) {
61 throw new TestUtilsException(
"IngestUtils.addDataSource: Data source not found: " + dataSourcePath.toString());
63 UUID taskId = UUID.randomUUID();
68 String joinedErrors = String.join(System.lineSeparator(), callBack.getErrorMessages());
69 throw new TestUtilsException(String.format(
"IngestUtils.addDataSource: Error(s) occurred while running the data source processor: %s", joinedErrors));
71 for (Content c:callBack.getDataSourceContent()) {
75 throw new TestUtilsException(
"IngestUtils.addDataSource encountered an error on adding a datasource: " + ex.getMessage(), ex);
90 StringBuilder joinedErrors =
new StringBuilder(
"");
91 errs.forEach((err) -> {
92 joinedErrors.append(String.format(
"Error: %s: %s.", err.getModuleDisplayName(), err.toString())).append(System.lineSeparator());
95 if (CollectionUtils.isNotEmpty(errs)) {
96 throw new TestUtilsException(
"An error occurred while running an ingest job: " + joinedErrors);
99 }
catch (InterruptedException ex) {
116 template.setEnabled(
true);
static ProcessorCallback runDataSourceProcessor(AutoIngestDataSourceProcessor processor, Path dataSourcePath)
static List< IngestModuleError > runIngestJob(Collection< Content > dataSources, IngestJobSettings settings)
static void addDataSource(AutoIngestDataSourceProcessor dataSourceProcessor, Path dataSourcePath)
static IngestModuleTemplate getIngestModuleTemplate(IngestModuleFactory factory)
void notifyDataSourceAdded(Content dataSource, UUID addingDataSourceEventId)
default IngestModuleIngestJobSettings getDefaultIngestJobSettings()
static Case getCurrentCaseThrows()
static void runIngestJob(List< Content > datasources, IngestJobSettings ingestJobSettings)
void notifyAddingDataSource(UUID eventId)