Skip to content
Snippets Groups Projects
Commit ca7beee0 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

skip invalid cell designer files

parent e270e998
No related branches found
No related tags found
1 merge request!44Resolve "semantic zoom"
......@@ -8,6 +8,7 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.commons.io.FileUtils;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -22,9 +23,9 @@ import lcsb.mapviewer.model.map.model.Model;
@RunWith(Parameterized.class)
public class CellDesigner2SbgnmlConversionTest {
Logger logger = Logger.getLogger(CellDesigner2SbgnmlConversionTest.class.getName());
private static Logger logger = Logger.getLogger(CellDesigner2SbgnmlConversionTest.class.getName());
private Path testPath;
private Path testPath;
public CellDesigner2SbgnmlConversionTest(Path testPath) {
this.testPath = testPath;
......@@ -32,15 +33,19 @@ public class CellDesigner2SbgnmlConversionTest {
@Parameters(name = "{index} : {0}")
public static Collection<Object[]> data() throws IOException {
Collection<Object[]> data = new ArrayList<Object[]>();
Collection<Object[]> data = new ArrayList<>();
Files.walk(Paths.get("../converter-CellDesigner/testFiles")).forEach(fPath -> {
if (Files.isRegularFile(fPath) && fPath.toString().endsWith(".xml")) {
String tempPath = fPath.toString().substring(fPath.toString().indexOf("testFiles") + "testFiles".length() + 1);
if (!tempPath.contains("_full")) {
// String tName =
// fPath.toString().substring(fPath.toString().indexOf("testFiles") +
// "testFiles".length(), fPath.toString().indexOf(".xml"));
data.add(new Object[] { fPath });
if (Files.isRegularFile(fPath) && fPath.toString().endsWith(".xml")&& fPath.toString().indexOf("invalid")==-1) {
try {
String tempPath = fPath.toString().substring(fPath.toString().indexOf("testFiles") + "testFiles".length() + 1);
if (!tempPath.contains("_full")) {
String content = FileUtils.readFileToString(fPath.toFile());
if (content.indexOf("xmlns:celldesigner") >= 0) {
data.add(new Object[] { fPath });
}
}
} catch (Exception e) {
throw new RuntimeException();
}
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment