Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
6fde5b5d
Commit
6fde5b5d
authored
Apr 04, 2019
by
Piotr Gawron
Browse files
when exporting custom properties strings are properly escaped as xml parameters
parent
f3278201
Changes
2
Hide whitespace changes
Inline
Side-by-side
converter-CellDesigner/src/main/java/lcsb/mapviewer/converter/model/celldesigner/annotation/RestAnnotationParser.java
View file @
6fde5b5d
...
...
@@ -160,8 +160,9 @@ public class RestAnnotationParser extends XmlParser {
return
""
;
}
}
else
if
(
value
instanceof
String
)
{
if
(!((
String
)
value
).
trim
().
isEmpty
()
||
forceFullInfo
)
{
return
type
.
getCommonName
()
+
": "
+
value
+
"\n"
;
String
string
=(
String
)
value
;
if
(!(
string
.
trim
().
isEmpty
())
||
forceFullInfo
)
{
return
type
.
getCommonName
()
+
": "
+
super
.
escapeXml
(
string
)
+
"\n"
;
}
else
{
return
""
;
}
...
...
@@ -178,7 +179,7 @@ public class RestAnnotationParser extends XmlParser {
if
(
object
instanceof
MiriamData
)
{
result
+=
((
MiriamData
)
object
).
getResource
();
}
else
{
result
+=
object
;
result
+=
super
.
escapeXml
(
object
.
toString
())
;
}
}
...
...
converter-CellDesigner/src/test/java/lcsb/mapviewer/converter/model/celldesigner/CellDesignerXmlParserTest.java
View file @
6fde5b5d
...
...
@@ -54,6 +54,8 @@ import lcsb.mapviewer.model.map.species.Species;
public
class
CellDesignerXmlParserTest
extends
CellDesignerTestFunctions
{
Logger
logger
=
Logger
.
getLogger
(
CellDesignerXmlParserTest
.
class
);
ModelComparator
modelComparator
=
new
ModelComparator
();
@Before
public
void
setUp
()
throws
Exception
{
}
...
...
@@ -422,8 +424,6 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
InputStream
is
=
new
ByteArrayInputStream
(
xmlString
.
getBytes
());
Model
model2
=
parser
.
createModel
(
new
ConverterParams
().
inputStream
(
is
).
sizeAutoAdjust
(
false
));
ModelComparator
modelComparator
=
new
ModelComparator
();
assertEquals
(
0
,
modelComparator
.
compare
(
model
,
model2
));
}
catch
(
Exception
e
)
{
...
...
@@ -1012,6 +1012,34 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
}
}
@Test
public
void
testSpeciesWithSpecialSynonym
()
throws
Exception
{
try
{
Model
model
=
new
ModelFullIndexed
(
null
);
model
.
setIdModel
(
"as"
);
model
.
setWidth
(
10
);
model
.
setHeight
(
10
);
Species
protein
=
new
GenericProtein
(
"id1"
);
protein
.
setWidth
(
10
);
protein
.
setHeight
(
10
);
protein
.
setName
(
"ROS"
);
protein
.
addSynonym
(
"&"
);
model
.
addElement
(
protein
);
CellDesignerXmlParser
parser
=
new
CellDesignerXmlParser
();
String
xmlString
=
parser
.
toXml
(
model
);
InputStream
is
=
new
ByteArrayInputStream
(
xmlString
.
getBytes
(
"UTF-8"
));
Model
model2
=
parser
.
createModel
(
new
ConverterParams
().
inputStream
(
is
));
assertEquals
(
0
,
modelComparator
.
compare
(
model
,
model2
));
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
e
;
}
}
@Test
public
void
testReactionCoordsEqual
()
throws
Exception
{
try
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment