use of org.openstreetmap.osmosis.core.misc.v0_6.NullChangeWriter in project osmosis by openstreetmap.
the class XmlChangeReaderWriterTest method testNonDeleteLatLonNotSet.
/**
* Tests non-acceptance of nodes in a non-delete change with lat/lon attribute not set.
*
* @throws Exception if something goes wrong.
*/
@Test(expected = OsmosisRuntimeException.class)
public void testNonDeleteLatLonNotSet() throws Exception {
File inputFile = dataUtils.createDataFile("v0_6/xml-create-no-coordinates.osc");
XmlChangeReader reader = new XmlChangeReader(inputFile, false, CompressionMethod.None);
reader.setChangeSink(new NullChangeWriter());
reader.run();
}
use of org.openstreetmap.osmosis.core.misc.v0_6.NullChangeWriter in project osmosis by openstreetmap.
the class ChangeSimplifierTest method badSortOrderId.
/**
* Tests that badly ordered input (with respect to the ids) is detected correctly.
*
* @throws Exception
* if anything fails.
*/
@Test
public void badSortOrderId() throws Exception {
ChangeSimplifier simplifier = new ChangeSimplifier();
simplifier.setChangeSink(new NullChangeWriter());
simplifier.initialize(new HashMap<String, Object>());
Node node;
node = new Node(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2), 1, 1);
simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
try {
node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1);
simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
} catch (OsmosisRuntimeException e) {
if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
return;
}
throw e;
}
Assert.fail("Expected exception not thrown");
}
use of org.openstreetmap.osmosis.core.misc.v0_6.NullChangeWriter in project osmosis by openstreetmap.
the class ChangeSimplifierTest method badSortOrderType.
/**
* Tests that badly ordered input (with respect to the ids) is detected correctly.
*
* @throws Exception
* if anything fails.
*/
@Test
public void badSortOrderType() throws Exception {
ChangeSimplifier simplifier = new ChangeSimplifier();
simplifier.setChangeSink(new NullChangeWriter());
simplifier.initialize(new HashMap<String, Object>());
Node node;
Way way;
way = new Way(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 2));
simplifier.process(new ChangeContainer(new WayContainer(way), ChangeAction.Modify));
try {
node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 1), 1, 1);
simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
} catch (OsmosisRuntimeException e) {
if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
return;
}
throw e;
}
Assert.fail("Expected exception not thrown");
}
use of org.openstreetmap.osmosis.core.misc.v0_6.NullChangeWriter in project osmosis by openstreetmap.
the class ChangeSimplifierTest method badSortOrderVersion.
/**
* Tests that badly ordered input (with respect to the version) is detected correctly.
*
* @throws Exception
* if anything fails.
*/
@Test
public void badSortOrderVersion() throws Exception {
ChangeSimplifier simplifier = new ChangeSimplifier();
simplifier.setChangeSink(new NullChangeWriter());
simplifier.initialize(new HashMap<String, Object>());
Node node;
node = new Node(new CommonEntityData(1, 2, new Date(), OsmUser.NONE, 2), 1, 1);
simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
try {
node = new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1);
simplifier.process(new ChangeContainer(new NodeContainer(node), ChangeAction.Modify));
} catch (OsmosisRuntimeException e) {
if (e.getMessage().startsWith("Pipeline entities are not sorted")) {
return;
}
throw e;
}
Assert.fail("Expected exception not thrown");
}
Aggregations