use of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector in project osmosis by openstreetmap.
the class MergeBoundTest method testBothEmpty.
/**
* Tests the proper working of the merge task if both sources are
* empty.
*
* @throws Exception if something goes wrong
*/
@Test
public void testBothEmpty() throws Exception {
RunnableSource source0 = new EmptyReader();
RunnableSource source1 = new EmptyReader();
EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1, BoundRemovedAction.Ignore);
SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
Assert.assertTrue("Expected empty result set but got some data", merged.getLastEntityContainer() == null);
}
use of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector in project osmosis by openstreetmap.
the class TagFilterTest method testRejectRelation.
/**
* Test rejecting a relation without tag-based filtering.
*/
@Test
public final void testRejectRelation() {
Set<String> keys = new HashSet<String>();
Map<String, Set<String>> keyValues = new HashMap<String, Set<String>>();
tagFilter = new TagFilter("reject-relations", keys, keyValues);
entityInspector = new SinkEntityInspector();
tagFilter.setSink(entityInspector);
tagFilter.process(amenityNodeContainer);
tagFilter.process(residentialWayContainer);
tagFilter.process(testRelationContainer);
tagFilter.complete();
List<EntityContainer> expectedResult = Arrays.asList(amenityNodeContainer, residentialWayContainer);
assertTrue(entityInspector.getProcessedEntities().equals(expectedResult));
tagFilter.close();
}
use of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector in project osmosis by openstreetmap.
the class TagFilterTest method testRejectWay.
/**
* Test rejecting a way which matches the filter.
*/
@Test
public final void testRejectWay() {
Set<String> keys = new HashSet<String>();
Map<String, Set<String>> keyValues = new HashMap<String, Set<String>>();
keyValues.put("highway", new HashSet<String>(Arrays.asList("motorway", "motorway_link")));
tagFilter = new TagFilter("reject-ways", keys, keyValues);
entityInspector = new SinkEntityInspector();
tagFilter.setSink(entityInspector);
tagFilter.process(amenityNodeContainer);
tagFilter.process(residentialWayContainer);
tagFilter.process(motorwayWayContainer);
tagFilter.complete();
List<EntityContainer> expectedResult = Arrays.asList(amenityNodeContainer, residentialWayContainer);
assertTrue(entityInspector.getProcessedEntities().equals(expectedResult));
tagFilter.close();
}
use of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector in project osmosis by openstreetmap.
the class TagFilterTest method testAcceptNode.
/**
* Test passing a node which matches the filter.
*/
@Test
public final void testAcceptNode() {
Set<String> keys = new HashSet<String>(Arrays.asList("amenity"));
Map<String, Set<String>> keyValues = new HashMap<String, Set<String>>();
keyValues.put("key", new HashSet<String>(Arrays.asList("valone", "valtwo")));
tagFilter = new TagFilter("accept-nodes", keys, keyValues);
entityInspector = new SinkEntityInspector();
tagFilter.setSink(entityInspector);
tagFilter.process(amenityNodeContainer);
tagFilter.process(taglessNodeContainer);
tagFilter.process(residentialWayContainer);
tagFilter.complete();
List<EntityContainer> expectedResult = Arrays.asList(amenityNodeContainer, residentialWayContainer);
assertTrue(entityInspector.getProcessedEntities().equals(expectedResult));
tagFilter.close();
}
Aggregations