package uk.org.taverna.databundle;

import static org.junit.Assert.*;
import static org.junit.Assert.assertTrue;

import java.nio.file.Files;
import java.nio.file.Path;

import org.junit.Test;

public class TestDataBundles {
	@Test
	public void createDataBundle() throws Exception {
		Path dataBundle = DataBundles.createDataBundle();
		assertTrue(Files.isDirectory(dataBundle));
	}
	
	@Test
	public void getInputs() throws Exception {
		Path dataBundle = DataBundles.createDataBundle();
		Path inputs = DataBundles.getInputs(dataBundle);
		assertTrue(Files.isDirectory(inputs));
		// Second time should not fail because it already exists
		inputs = DataBundles.getInputs(dataBundle);
		assertTrue(Files.isDirectory(inputs));
	}
	
	@Test
	public void hasInputs() throws Exception {
		Path dataBundle = DataBundles.createDataBundle();
		assertFalse(DataBundles.hasInputs(dataBundle));
		DataBundles.getInputs(dataBundle);
		assertTrue(DataBundles.hasInputs(dataBundle));		
	}
	
	@Test
	public void getOutputs() throws Exception {
		Path dataBundle = DataBundles.createDataBundle();
		Path outputs = DataBundles.getOutputs(dataBundle);
		assertTrue(Files.isDirectory(outputs));
		// Second time should not fail because it already exists
		outputs = DataBundles.getOutputs(dataBundle);
		assertTrue(Files.isDirectory(outputs));
	}
	
}

@@ -905,32 +905,52 @@
 uts(dataBundle);
+ // create on demand
 %0A%09%09assertTrue(Da
@@ -989,32 +989,408 @@
 ;%09%09%0A%09%7D%0A%09%0A%09@Test%0A
+%09public void hasOutputs() throws Exception %7B%0A%09%09Path dataBundle = DataBundles.createDataBundle();%0A%09%09assertFalse(DataBundles.hasOutputs(dataBundle));%0A%09%09DataBundles.getInputs(dataBundle); // independent%0A%09%09assertFalse(DataBundles.hasOutputs(dataBundle));%0A%09%09DataBundles.getOutputs(dataBundle);%09// create on demand%09%0A%09%09assertTrue(DataBundles.hasOutputs(dataBundle));%09%09%0A%09%7D%0A%09%0A%09%0A%09@Test%0A
 %09public void get

test hasOutput