Skip to content
Snippets Groups Projects
Commit 3dcf521f authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

fixing sbml converter tests

parent 2466b0b5
No related branches found
No related tags found
1 merge request!644Refactored IConverter and XmlParser across project
Pipeline #8826 failed
Showing
with 19 additions and 20 deletions
......@@ -19,7 +19,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelComparator;
......@@ -49,7 +49,7 @@ public class CellDesignerToMultiExportTest {
@Test
public void createModelTest() throws Exception {
try {
IConverter converter = new CellDesignerXmlParser();
Converter converter = new CellDesignerXmlParser();
Model model = converter.createModel(new ConverterParams().filename(filePath.toString()));
model.setName(null);
......
......@@ -16,7 +16,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.model.map.model.Model;
@RunWith(Parameterized.class)
......@@ -44,11 +44,11 @@ public class CopasiImportTest extends SbmlTestFunctions{
@Test
public void createModelTest() throws Exception {
try {
IConverter converter = new SbmlParser();
Converter converter = new SbmlParser();
Model model = converter.createModel(new ConverterParams().filename(filePath.toString()));
assertNotNull(model);
converter.exportModelToInputStream(model);
converter.model2InputStream(model);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -21,7 +21,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.converter.graphics.AbstractImageGenerator;
import lcsb.mapviewer.converter.graphics.NormalImageGenerator;
import lcsb.mapviewer.converter.graphics.PngImageGenerator;
......@@ -61,7 +61,7 @@ public class GenericSbmlParserTest {
try {
String dir = Files.createTempDirectory("sbml-temp-images-dir").toFile().getAbsolutePath();
IConverter converter = new SbmlParser();
Converter converter = new SbmlParser();
Model model = converter.createModel(new ConverterParams().filename(filePath.toString()));
model.setName(null);
......@@ -77,7 +77,7 @@ public class GenericSbmlParserTest {
// Desktop.getDesktop().open(new File(pngFilePath));
CellDesignerXmlParser cellDesignerXmlParser = new CellDesignerXmlParser();
String xmlString = cellDesignerXmlParser.toXml(model);
String xmlString = cellDesignerXmlParser.model2Xml(model);
InputStream is = new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
......
......@@ -19,7 +19,6 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.model.ModelComparator;
......@@ -65,7 +64,7 @@ public class GenericSbmlToXmlParserTest {
String pathWithouExtension = dir + "/"
+ filePath.getFileName().toString().substring(0, filePath.getFileName().toString().indexOf(".xml"));
String xmlFilePath = pathWithouExtension.concat(".xml");
converter.exportModelToFile(model, xmlFilePath);
converter.model2File(model, xmlFilePath);
Model model2 = converter.createModel(new ConverterParams().filename(xmlFilePath).sizeAutoAdjust(false));
model2.setName(null);
......
......@@ -21,7 +21,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.converter.graphics.AbstractImageGenerator;
import lcsb.mapviewer.converter.graphics.NormalImageGenerator;
import lcsb.mapviewer.converter.graphics.PngImageGenerator;
......@@ -56,7 +56,7 @@ public class MultiParserTest {
try {
String dir = Files.createTempDirectory("sbml-temp-images-dir").toFile().getAbsolutePath();
IConverter converter = new SbmlParser();
Converter converter = new SbmlParser();
Model model = converter.createModel(new ConverterParams().filename(filePath.toString()));
model.setName(null);
......@@ -72,7 +72,7 @@ public class MultiParserTest {
// Desktop.getDesktop().open(new File(pngFilePath));
CellDesignerXmlParser cellDesignerXmlParser = new CellDesignerXmlParser();
String xmlString = cellDesignerXmlParser.toXml(model);
String xmlString = cellDesignerXmlParser.model2Xml(model);
InputStream is = new ByteArrayInputStream(xmlString.getBytes("UTF-8"));
......
......@@ -36,7 +36,7 @@ public class SbmlExporterFromCellDesignerTest extends SbmlTestFunctions {
model.setName(originalModel.getName());
String cellDesignerXml = cellDesignerXmlParser.toXml(model);
String cellDesignerXml = cellDesignerXmlParser.model2Xml(model);
ByteArrayInputStream stream = new ByteArrayInputStream(cellDesignerXml.getBytes("UTF-8"));
assertEquals(0, comparator.compare(model, originalModel));
......
......@@ -239,7 +239,7 @@ public class SbmlExporterTest extends SbmlTestFunctions {
Model model = converter.createModel(new ConverterParams().filename("testFiles/layoutExample/example1.xml"));
model.setName(null);
converter.exportModelToFile(model, tempFilename);
converter.model2File(model, tempFilename);
Model model2 = converter.createModel(new ConverterParams().filename(tempFilename));
model2.setName(null);
......@@ -258,7 +258,7 @@ public class SbmlExporterTest extends SbmlTestFunctions {
Model model = createEmptyModel();
converter.exportModelToFile(model, tempFilename);
converter.model2File(model, tempFilename);
Model model2 = converter.createModel(new ConverterParams().filename(tempFilename));
......@@ -666,7 +666,7 @@ public class SbmlExporterTest extends SbmlTestFunctions {
.createModel(new ConverterParams().filename("testFiles/cell_designer_problems/boolean_logic_gate.xml"));
Model model = getModelAfterSerializing(originalModel);
new CellDesignerXmlParser().toXml(model);
new CellDesignerXmlParser().model2Xml(model);
List<Line2D> lines1 = originalModel.getReactions().iterator().next().getLines();
List<Line2D> lines2 = model.getReactions().iterator().next().getLines();
......
......@@ -16,7 +16,7 @@ import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;
import lcsb.mapviewer.converter.ConverterParams;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.converter.Converter;
import lcsb.mapviewer.converter.InvalidInputDataExecption;
@RunWith(Parameterized.class)
......@@ -44,7 +44,7 @@ public class SbmlPareserForInvalidReactionTest {
@Test
public void createModelTest() throws Exception {
try {
IConverter converter = new SbmlParser();
Converter converter = new SbmlParser();
converter.createModel(new ConverterParams().filename(filePath.toString()));
fail("Exception expected when parsing file: " + filePath.toString());
......
......@@ -113,7 +113,7 @@ public class SbmlReactionExportArrowType {
model.addReaction(reaction);
CellDesignerXmlParser cellDesignerXmlParser = new CellDesignerXmlParser();
String xmlString = cellDesignerXmlParser.toXml(model);
String xmlString = cellDesignerXmlParser.model2Xml(model);
Model modelAfterSerialization = cellDesignerXmlParser
.createModel(new ConverterParams().inputStream(new ByteArrayInputStream(xmlString.getBytes())));
return modelAfterSerialization;
......
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