Author: clopes
Date: 2012-08-03 08:53:03 -0700 (Fri, 03 Aug 2012)
New Revision: 30081
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
Log:
Fixed SUID Updater: Invalid SUIDs must be discarded when loading session or
importing XGMML.
Modified:
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
2012-08-02 23:48:03 UTC (rev 30080)
+++
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/SUIDUpdater.java
2012-08-03 15:53:03 UTC (rev 30081)
@@ -87,9 +87,7 @@
if (type == Long.class) {
final Long oldSUID = row.get(columnName,
Long.class);
final Long newSUID = getNewSUID(oldSUID);
-
- if (newSUID != null)
- row.set(columnName, newSUID);
+ row.set(columnName, newSUID);
} else if (type == List.class) {
final List<Long> oldList =
row.getList(columnName, Long.class);
Modified:
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
2012-08-02 23:48:03 UTC (rev 30080)
+++
core3/impl/trunk/io-impl/impl/src/test/java/org/cytoscape/io/internal/read/xgmml/GenericXGMMLReaderTest.java
2012-08-03 15:53:03 UTC (rev 30081)
@@ -176,6 +176,12 @@
// Check edge attributes
assertEquals(edges.get(0).getSource().getSUID(),
net.getRow(edges.get(0)).get("source_node.SUID", Long.class));
assertEquals(edges.get(1).getSource().getSUID(),
net.getRow(edges.get(1)).get("source_node.SUID", Long.class));
+
+ // Set null to invalid SUIDs
+ assertNull(net.getRow(edges.get(0)).get("invalid.SUID",
Long.class));
+ // Don't add invalid SUIDs to list value
+ assertEquals(1,
net.getRow(edges.get(0)).getList("invalid_list_1.SUID", Long.class).size()); //
one valid SUID
+
assertTrue(net.getRow(edges.get(0)).getList("invalid_list_2.SUID",
Long.class).isEmpty()); // all invalid
}
@Test
Modified:
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
===================================================================
---
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
2012-08-02 23:48:03 UTC (rev 30080)
+++
core3/impl/trunk/io-impl/impl/src/test/resources/testData/xgmml/suid_metadata.xgmml
2012-08-03 15:53:03 UTC (rev 30081)
@@ -32,9 +32,27 @@
<edge id="23" label="node1 (DirectedEdge) node2" source="21"
target="22">
<att type="string" name="name" value="node1 (DirectedEdge)
node2" />
<att type="real" name="source_node.SUID" value="21" />
+ <att type="real" name="invalid.SUID" value="101" />
+ <att type="list" name="invalid_list_1.SUID">
+ <att type="real" value="21" />
+ <att type="real" value="104" /><!-- invalid -->
+ </att>
+ <att type="list" name="invalid_list_2.SUID"><!-- all invalid -->
+ <att type="real" value="103" />
+ <att type="real" value="104" />
+ </att>
</edge>
<edge id="24" label="node2 (DirectedEdge) node1" source="22"
target="21">
<att type="string" name="name" value="node2 (DirectedEdge)
node1" />
<att type="real" name="source_node.SUID" value="22" />
+ <att type="real" name="invalid.SUID" value="102" />
+ <att type="list" name="invalid_list_1.SUID">
+ <att type="real" value="21" />
+ <att type="real" value="105" /><!-- invalid -->
+ </att>
+ <att type="list" name="invalid_list_2.SUID"><!-- all invalid -->
+ <att type="real" value="103" />
+ <att type="real" value="104" />
+ </att>
</edge>
</graph>
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.