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; 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.BoundingBox;
import de.hft.stuttgart.citydoctor2.datastructure.CityObject; 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.datastructure.GmlId;
import de.hft.stuttgart.citydoctor2.utils.Pair;
import org.apache.commons.lang3.SerializationUtils; import org.apache.commons.lang3.SerializationUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
...@@ -97,7 +98,15 @@ public class DatabaseHandler { ...@@ -97,7 +98,15 @@ public class DatabaseHandler {
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
if (rs.next()) { if (rs.next()) {
try (InputStream is = rs.getBinaryStream("data")) { 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) { } catch (IOException e) {
......
...@@ -351,7 +351,6 @@ public class Geometry extends GmlElement { ...@@ -351,7 +351,6 @@ public class Geometry extends GmlElement {
in.defaultReadObject(); in.defaultReadObject();
edges = new ArrayList<>(); edges = new ArrayList<>();
edgeMap = new HashMap<>(); edgeMap = new HashMap<>();
updateVertices();
} }
public void clearMetaData() { public void clearMetaData() {
......
...@@ -76,6 +76,7 @@ public class BuildingTest { ...@@ -76,6 +76,7 @@ public class BuildingTest {
assertEquals(b.getGmlId(), copy.getGmlId()); assertEquals(b.getGmlId(), copy.getGmlId());
copy.prepareForChecking();
Geometry copyGeom = copy.getGeometries().get(0); Geometry copyGeom = copy.getGeometries().get(0);
assertNotSame(geom, copyGeom); 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