public void setWorkflowBundleIO(WorkflowBundleIO workflowBundleIO) { DataBundles.setWfBundleIO(workflowBundleIO); }
private ExtensionIgnoringFilter(Path file) { this.fname = filenameWithoutExtension(file); }
public static Path setError(Path path, ErrorDocument error) throws IOException { return setError(path, error.getMessage(), error.getTrace(), error .getCausedBy().toArray(new Path[error.getCausedBy().size()])); }
@Test public void getError() throws Exception { Path inputs = DataBundles.getInputs(dataBundle); Path portIn1 = DataBundles.getPort(inputs, "in1"); DataBundles.setError(portIn1, "Something did not work", "A very\n long\n error\n trace"); ErrorDocument error = DataBundles.getError(portIn1); assertTrue(error.getCausedBy().isEmpty()); assertEquals("Something did not work", error.getMessage()); // Notice that the lack of trailing \n is preserved assertEquals("A very\n long\n error\n trace", error.getTrace()); assertEquals(null, DataBundles.getError(null)); }
@Test public void setErrorExistsAsError() throws Exception { Path inputs = DataBundles.getInputs(dataBundle); Path in1 = DataBundles.getPort(inputs, "in1"); Path err = DataBundles.setError(in1, "a", "b"); assertFalse(Files.exists(in1)); assertTrue(Files.isRegularFile(err)); DataBundles.setError(in1, "c", "d"); assertEquals("c", DataBundles.getError(in1).getMessage()); }
public WorkflowReport load(Bundle bundle) throws IOException, ReaderException, ParseException { Path path = getWorkflowRunReport(bundle); WorkflowBundle workflow = getWorkflowBundle(bundle); return load(path, workflow); }
@Before public void createDataBundle() throws IOException { dataBundle = DataBundles.createBundle(); }
public static void deleteAllExtensions(final Path file) throws IOException { Filter<Path> filter = new ExtensionIgnoringFilter(file); try (DirectoryStream<Path> ds = newDirectoryStream(file.getParent(), filter)) { for (Path p : ds) deleteRecursively(p); } }
public static Path setReference(Path path, URI reference) throws IOException { path = withExtension(path, DOT_URL); checkExistingAnyExtension(path); return Bundles.setReference(path, reference); }
public static boolean isMissing(Path item) { return Bundles.isMissing(item) && !isError(item); }
public static Path getPort(Path map, String portName) throws IOException { Files.createDirectories(map); return anyExtension(map, portName); }
public static void createList(Path path) throws IOException { checkExistingAnyExtension(path); Files.createDirectories(path); }
public static Path getWorkflowDescription(Bundle dataBundle) throws IOException { Path annotations = getAnnotations(dataBundle); return annotations.resolve(WORKFLOW + DOT_WFDESC_TTL); }
public static boolean isError(Path path) { return isRegularFile(withExtension(path, DOT_ERR)); }
protected static Path withExtension(Path path, String extension) { String filename = path.getFileName().toString(); return path.resolveSibling(withExtensionFilename(filename, extension)); }
@Override public boolean accept(Path entry) throws IOException { return fname.equals(filenameWithoutExtension(entry)); } }
private static Path anyExtension(Path path) throws IOException { return anyExtension(path.getParent(), path.getFileName().toString()); }
public static void setStringValue(Path path, String string) throws IOException { checkExistingAnyExtension(path); Bundles.setStringValue(path, string); }
private static long getEntryNumber(Path entry) throws NumberFormatException { String name = filenameWithoutExtension(entry); return Long.parseLong(name); }
public static Path getWorkflow(Bundle dataBundle) throws IOException { return anyExtension(dataBundle.getRoot(), WORKFLOW); }