Examples of SinkEntityInspector


Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound computation if no nodes are upstream.
   */
  @Test
  public void computeBoundNoNodes() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundComputer bc = new BoundComputer("NewBound");
    bc.setSink(inspector);
    bc.complete();
    bc.release();

    Assert.assertNull(inspector.getLastEntityContainer());
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound computation if no nodes but a bound entity is upstream.
   */
  @Test
  public void computeBoundNoNodesWithBound() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundComputer bc = new BoundComputer("NewBound");
    bc.setSink(inspector);
    bc.process(new BoundContainer(new Bound("Test")));
    bc.complete();
    bc.release();

    Assert.assertNull(inspector.getLastEntityContainer());
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound computation when no bound entity is upstream.
   */
  @Test
  public void computeBoundNoUpstreamBound() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundComputer bc = new BoundComputer("NewBound");
    bc.setSink(inspector);
    bc.process(new NodeContainer(new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    bc.process(new NodeContainer(new Node(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 1), 2, 2)));
    bc.complete();
    bc.release();

    EntityContainer ec = inspector.getProcessedEntities().iterator().next();
    Assert.assertEquals(new Bound(2, 1, 2, 1, "NewBound"), ec.getEntity());
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound computation when there is bound entity is upstream.
   */
  @Test
  public void computeBoundWithUpstreamBound() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundComputer bc = new BoundComputer("NewBound");
    bc.setSink(inspector);
    bc.process(new NodeContainer(new Node(new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    bc.process(new NodeContainer(new Node(new CommonEntityData(2, 2, new Date(), OsmUser.NONE, 1), 2, 2)));
    bc.complete();
    bc.release();

    Iterator<EntityContainer> iterator = inspector.getProcessedEntities().iterator();
    EntityContainer ec = iterator.next();
    Assert.assertEquals(new Bound(2, 1, 2, 1, "NewBound"), ec.getEntity());

    // Ensure there is no second bound.
    ec = iterator.next();
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound removal.
   */
  @Test
  public void removeExistingBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundSetter setter = new BoundSetter(null);
    setter.setSink(inspector);
    setter.process(new BoundContainer(new Bound("Test")));
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
    EntityContainer ec = inspector.getProcessedEntities().iterator().next();
    Assert.assertEquals(EntityType.Node, ec.getEntity().getType());
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound removal when there is no bound upstream.
   */
  @Test
  public void removeNoBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    BoundSetter setter = new BoundSetter(null);
    setter.setSink(inspector);
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
    EntityContainer ec = inspector.getProcessedEntities().iterator().next();
    Assert.assertEquals(EntityType.Node, ec.getEntity().getType());
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound setting.
   */
  @Test
  public void overwriteBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    Bound newBound = new Bound(2, 1, 4, 3, "NewBound");
    BoundSetter setter = new BoundSetter(newBound);
    setter.setSink(inspector);
    setter.process(new BoundContainer(new Bound("Test")));
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
    Iterator<EntityContainer> iterator = inspector.getProcessedEntities().iterator();
    EntityContainer ec = iterator.next();
    Assert.assertEquals(EntityType.Bound, ec.getEntity().getType());
    Bound bound = (Bound) ec.getEntity();
    Assert.assertEquals(bound, newBound);
   
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

  /**
   * Tests the bound setting when there is no bound upstream.
   */
  @Test
  public void setNewBoundTest() {
    SinkEntityInspector inspector = new SinkEntityInspector();
    Bound newBound = new Bound(2, 1, 4, 3, "NewBound");
    BoundSetter setter = new BoundSetter(newBound);
    setter.setSink(inspector);
    setter.process(new NodeContainer(new Node(
        new CommonEntityData(1, 1, new Date(), OsmUser.NONE, 1), 1, 1)));
    setter.complete();
    setter.release();
   
    EntityContainer ec = inspector.getProcessedEntities().iterator().next();
    Assert.assertEquals(EntityType.Bound, ec.getEntity().getType());
    Bound bound = (Bound) ec.getEntity();
    Assert.assertEquals(bound, newBound);
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

    user = new OsmUser(12, "OsmosisTest");
   
    // All nodes have an empty tags list.
    tags = new ArrayList<Tag>();
   
    entityInspector = new SinkEntityInspector();
    // simpleAreaFilter doesn't cross antimeridian; no complete ways or relations
    simpleAreaFilter = new BoundingBoxFilter(
            IdTrackerType.Dynamic,
            -20,
            20,
View Full Code Here

Examples of org.openstreetmap.osmosis.testutil.v0_6.SinkEntityInspector

   
    // All nodes have an empty tags list.
    tags = new ArrayList<Tag>();
   
    polygonFile = new File(getClass().getResource("testPolygon.txt").getFile());
    entityInspector = new SinkEntityInspector();
    // polyAreaFilter has a notch out of the Northeast corner.
    polyAreaFilter = new PolygonFilter(IdTrackerType.Dynamic, polygonFile, false, false, false, false);
    polyAreaFilter.setSink(entityInspector);
    intersectingBound = new Bound(30, 0, 30, 0, "intersecting");
    crossingIntersectingBound = new Bound(-10, 10, 30, -30, "crossing intersecting");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.