package org.researchobject.combinearchive;

import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;

import org.junit.Ignore;
import org.junit.Test;

public class TestCombineToRO {

	@Test
	public void convertBoris() throws Exception {
		Path file = Files.createTempFile("Boris", ".omex");
		try (InputStream src = getClass().getResourceAsStream("/Boris.omex")) {
			Files.copy(src, file, StandardCopyOption.REPLACE_EXISTING);
		}
		CombineToRO.combineToRO(file);
		System.out.println(file);		
	}
	
	@Test
	public void convertDirectoryMadness() throws Exception {
		Path file = Files.createTempFile("DirectoryMadness", ".omex");
		try (InputStream src = getClass().getResourceAsStream("/DirectoryMadness.omex")) {
			Files.copy(src, file, StandardCopyOption.REPLACE_EXISTING);
		}
		CombineToRO.combineToRO(file);
		System.out.println(file);		
	}
	
	@Test
	public void convertDirectoryMadnessZipped() throws Exception {
		Path file = Files.createTempFile("DirectoryMadnessZipped", ".omex");
		try (InputStream src = getClass().getResourceAsStream("/DirectoryMadnessZipped.omex")) {
			Files.copy(src, file, StandardCopyOption.REPLACE_EXISTING);
		}
		CombineToRO.combineToRO(file);
		System.out.println(file);		
	}
}

@@ -160,16 +160,122 @@
 yOption;
+%0Aimport java.util.logging.ConsoleHandler;%0Aimport java.util.logging.Level;%0Aimport java.util.logging.Logger;
 %0A%0Aimport
@@ -289,14 +289,19 @@
 nit.
-Ignore
+BeforeClass
 ;%0Aim
@@ -354,16 +354,668 @@
 ToRO %7B%0A%0A
+%09@BeforeClass%0A%09public static void setLogging() %7B%0A%09%09Logger logger = Logger.getLogger(%22%22);%0A%09%09//logger.setLevel(Level.FINER);%0A%09%09ConsoleHandler console = new ConsoleHandler();%0A%09%09console.setLevel(Level.FINEST);%0A%09%09logger.addHandler(console);%0A%09%09Logger.getLogger(%22org.researchobject%22).setLevel(Level.FINEST);%0A%09%7D%0A%09%0A%09%0A%09@Test%0A%09public void convertAslanidi() throws Exception %7B%0A%09%09Path file = Files.createTempFile(%22aslanidi%22, %22.zip%22);%0A%09%09try (InputStream src = getClass().getResourceAsStream(%22/aslanidi_purkinje_model_2009.zip%22)) %7B%0A%09%09%09Files.copy(src, file, StandardCopyOption.REPLACE_EXISTING);%0A%09%09%7D%0A%09%09CombineToRO.combineToRO(file);%0A%09%09System.out.println(file);%09%09%0A%09%7D%0A%09%0A
 %09@Test%0A%09

Test /aslanidi_purkinje_model_2009.zip