use of org.openstreetmap.osmosis.testutil.v0_6.SinkChangeInspector in project osmosis by openstreetmap.
the class ChangeDeriverTest method rightEmpty.
/**
* Deriving change with an empty right input should yield
* a change with creates only.
*
* @throws Exception if something goes wrong.
*/
@Test
public void rightEmpty() throws Exception {
// Cannot be tested with file comparison as the derived
// change contains deletes which have a current timestamp
// that cannot be reliably predicted.
// Therefore, check all relevant attributes manually.
ChangeDeriver deriver = new ChangeDeriver(1);
RunnableSource left = new XmlReader(dataUtils.createDataFile("v0_6/derive_change/simple.osm"), true, CompressionMethod.None);
RunnableSource right = new EmptyReader();
SinkChangeInspector result = RunTaskUtilities.run(deriver, left, right);
List<ChangeContainer> changes = result.getProcessedChanges();
Assert.assertEquals(3, changes.size());
for (ChangeContainer changeContainer : changes) {
Assert.assertEquals(ChangeAction.Delete, changeContainer.getAction());
}
Entity e;
e = changes.get(0).getEntityContainer().getEntity();
Assert.assertEquals(EntityType.Node, e.getType());
Assert.assertEquals(10, e.getId());
Assert.assertEquals(34, e.getVersion());
e = changes.get(1).getEntityContainer().getEntity();
Assert.assertEquals(EntityType.Way, e.getType());
Assert.assertEquals(100, e.getId());
Assert.assertEquals(56, e.getVersion());
e = changes.get(2).getEntityContainer().getEntity();
Assert.assertEquals(EntityType.Relation, e.getType());
Assert.assertEquals(1000, e.getId());
Assert.assertEquals(78, e.getVersion());
}
Aggregations