Signed-off-by: Taylor Smock <taylor.smock@kaart.com>
pull/1/head
Taylor Smock 2020-01-27 11:37:08 -07:00
rodzic 7b26972dfc
commit 40c7f3d59d
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 625F6A74A3E4311A
2 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -76,7 +76,7 @@ public class CreateConnectionsCommandTest {
final DataSet dataSet = new DataSet(node1, node2, node3, dupe, way); final DataSet dataSet = new DataSet(node1, node2, node3, dupe, way);
CreateConnectionsCommand createConnections = new CreateConnectionsCommand(dataSet, CreateConnectionsCommand createConnections = new CreateConnectionsCommand(dataSet,
Collections.singleton(node3)); Collections.singleton(node3.save()));
createConnections.executeCommand(); createConnections.executeCommand();
assertFalse(dataSet.isModified(), "DataSet shouldn't be modified yet"); assertFalse(dataSet.isModified(), "DataSet shouldn't be modified yet");
@ -85,7 +85,7 @@ public class CreateConnectionsCommandTest {
node3.put(ConnectedCommand.KEY, node3.put(ConnectedCommand.KEY,
"w" + way.getUniqueId() + ",n" + node1.getUniqueId() + ",n" + node2.getUniqueId()); "w" + way.getUniqueId() + ",n" + node1.getUniqueId() + ",n" + node2.getUniqueId());
createConnections = new CreateConnectionsCommand(dataSet, Collections.singleton(node3)); createConnections = new CreateConnectionsCommand(dataSet, Collections.singleton(node3.save()));
createConnections.executeCommand(); createConnections.executeCommand();
assertTrue(dataSet.isModified(), "DataSet should be modified"); assertTrue(dataSet.isModified(), "DataSet should be modified");
assertEquals(3, way.getNodesCount(), "The way should have three nodes"); assertEquals(3, way.getNodesCount(), "The way should have three nodes");
@ -100,7 +100,7 @@ public class CreateConnectionsCommandTest {
assertTrue(node3.hasKey(ConnectedCommand.KEY), "The conn key should exist again"); assertTrue(node3.hasKey(ConnectedCommand.KEY), "The conn key should exist again");
dupe.put(DuplicateCommand.KEY, "n" + node1.getUniqueId()); dupe.put(DuplicateCommand.KEY, "n" + node1.getUniqueId());
createConnections = new CreateConnectionsCommand(dataSet, Collections.singleton(dupe)); createConnections = new CreateConnectionsCommand(dataSet, Collections.singleton(dupe.save()));
createConnections.executeCommand(); createConnections.executeCommand();
assertTrue(dataSet.isModified(), "The DataSet should be modified"); assertTrue(dataSet.isModified(), "The DataSet should be modified");
assertEquals(2, way.getNodesCount(), "The way should have two nodes"); assertEquals(2, way.getNodesCount(), "The way should have two nodes");
@ -179,8 +179,8 @@ public class CreateConnectionsCommandTest {
final Node node1 = new Node(new LatLon(39.0674124, -108.5592645)); final Node node1 = new Node(new LatLon(39.0674124, -108.5592645));
final DataSet dataSet = new DataSet(node1); final DataSet dataSet = new DataSet(node1);
node1.put(DuplicateCommand.KEY, "n6146500887"); node1.put(DuplicateCommand.KEY, "n6146500887");
Command replaceNodeCommand = CreateConnectionsCommand.createConnections(dataSet, Collections.singleton(node1)) Command replaceNodeCommand = CreateConnectionsCommand
.get(0); .createConnections(dataSet, Collections.singleton(node1.save())).get(0);
replaceNodeCommand.executeCommand(); replaceNodeCommand.executeCommand();
assertEquals(1, dataSet.allNonDeletedPrimitives().size(), "There should be one primitive left"); assertEquals(1, dataSet.allNonDeletedPrimitives().size(), "There should be one primitive left");
@ -197,7 +197,8 @@ public class CreateConnectionsCommandTest {
final OsmDataLayer layer = new OsmDataLayer(dataSet, "temp layer", null); final OsmDataLayer layer = new OsmDataLayer(dataSet, "temp layer", null);
MainApplication.getLayerManager().addLayer(layer); MainApplication.getLayerManager().addLayer(layer);
replaceNodeCommand = CreateConnectionsCommand.createConnections(dataSet, Collections.singleton(node1)).get(0); replaceNodeCommand = CreateConnectionsCommand.createConnections(dataSet, Collections.singleton(node1.save()))
.get(0);
replaceNodeCommand.executeCommand(); replaceNodeCommand.executeCommand();
assertEquals(2, dataSet.allNonDeletedPrimitives().size(), "The dupe node no longer matches with the OSM node"); assertEquals(2, dataSet.allNonDeletedPrimitives().size(), "The dupe node no longer matches with the OSM node");
assertNotNull(dataSet.getPrimitiveById(6146500887L, OsmPrimitiveType.NODE), "The OSM node should still exist"); assertNotNull(dataSet.getPrimitiveById(6146500887L, OsmPrimitiveType.NODE), "The OSM node should still exist");

Wyświetl plik

@ -111,7 +111,7 @@ public class MapWithAIAddComandTest {
way2.getNodes().forEach(node -> ds1.addPrimitive(node)); way2.getNodes().forEach(node -> ds1.addPrimitive(node));
ds1.addPrimitive(way2); ds1.addPrimitive(way2);
ds1.addPrimitive(way1); ds1.addPrimitive(way1);
MapWithAIAddCommand.createConnections(ds1, Collections.singletonList(way2.firstNode())).executeCommand(); MapWithAIAddCommand.createConnections(ds1, Collections.singletonList(way2.firstNode().save())).executeCommand();
assertEquals(3, way1.getNodesCount(), "The way should now have three nodes"); assertEquals(3, way1.getNodesCount(), "The way should now have three nodes");
assertFalse(way1.isFirstLastNode(way2.firstNode()), "The ways should be connected"); assertFalse(way1.isFirstLastNode(way2.firstNode()), "The ways should be connected");
@ -121,7 +121,7 @@ public class MapWithAIAddComandTest {
way3.getNodes().forEach(node -> ds1.addPrimitive(node)); way3.getNodes().forEach(node -> ds1.addPrimitive(node));
ds1.addPrimitive(way3); ds1.addPrimitive(way3);
final Node way3Node1 = way3.firstNode(); final Node way3Node1 = way3.firstNode();
MapWithAIAddCommand.createConnections(ds1, Collections.singletonList(way3.firstNode())).executeCommand(); MapWithAIAddCommand.createConnections(ds1, Collections.singletonList(way3.firstNode().save())).executeCommand();
assertNotEquals(way3Node1, way3.firstNode(), "The original first node should no longer be the first node"); assertNotEquals(way3Node1, way3.firstNode(), "The original first node should no longer be the first node");
assertEquals(way1.firstNode(), way3.firstNode(), "way1 and way3 should have the same first nodes"); assertEquals(way1.firstNode(), way3.firstNode(), "way1 and way3 should have the same first nodes");
assertTrue(way3Node1.isDeleted(), "way3 should be deleted"); assertTrue(way3Node1.isDeleted(), "way3 should be deleted");