Commit ee22bc29 authored by Luna Riegel's avatar Luna Riegel
Browse files

Test: Fix Copy.Copy failure for LinkedPolygons

parent 4b335e3e
Pipeline #11769 passed with stage
in 1 minute and 43 seconds
package de.hft.stuttgart.citydoctor2.database;
import de.hft.stuttgart.citydoctor2.check.CheckableUtilsVisitor;
import de.hft.stuttgart.citydoctor2.datastructure.BoundingBox;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
import de.hft.stuttgart.citydoctor2.datastructure.Geometry;
import de.hft.stuttgart.citydoctor2.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.utils.Pair;
import org.apache.commons.lang3.SerializationUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -97,7 +98,15 @@ public class DatabaseHandler {
ResultSet rs = ps.executeQuery();
if (rs.next()) {
try (InputStream is = rs.getBinaryStream("data")) {
return SerializationUtils.deserialize(is);
CityObject co = SerializationUtils.deserialize(is);
// Rebuild the adjacency maps
co.accept(new CheckableUtilsVisitor() {
@Override
public void check(Geometry geom) {
geom.updateVertices();
}
});
return co;
}
}
} catch (IOException e) {
......
......@@ -351,7 +351,6 @@ public class Geometry extends GmlElement {
in.defaultReadObject();
edges = new ArrayList<>();
edgeMap = new HashMap<>();
updateVertices();
}
public void clearMetaData() {
......
......@@ -75,7 +75,8 @@ public class BuildingTest {
assertNotSame(b, copy);
assertEquals(b.getGmlId(), copy.getGmlId());
copy.prepareForChecking();
Geometry copyGeom = copy.getGeometries().get(0);
assertNotSame(geom, copyGeom);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment