Examples of ESWay


Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test
  public void findWay_withLineString() {
    // Setup
    ESWay way = ESWay.Builder.create().id(1).addLocation(1.0, 2.0).addLocation(2.0, 3.0)
        .addLocation(3.0, 2.0).addLocation(4.0, 1.0).build();
    index(INDEX_NAME, way);
    refresh(INDEX_NAME);

    // Action
    ESWay actual = entityDao.find(ESWay.class, 1);

    // Assert
    Assert.assertEquals(way, actual);
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test
  public void findWay_withPolygon() {
    // Setup
    ESWay way = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.1, 2.1).build();
    index(INDEX_NAME, way);
    refresh(INDEX_NAME);

    // Action
    ESWay actual = entityDao.find(ESWay.class, 1);

    // Assert
    Assert.assertEquals(way, actual);
  }
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test(expected = DaoException.class)
  public void findWay_thatDoesNotExists() {
    // Setup
    ESWay way = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    index(INDEX_NAME, way);
    refresh(INDEX_NAME);

    // Action
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  @Test
  public void findAllWays() {
    // Setup
    // Setup
    ESWay way1 = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    ESWay way2 = ESWay.Builder.create().id(2).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    List<ESWay> expected = Arrays.asList(new ESWay[] { way1, way2 });

    index(INDEX_NAME, way1, way2);
    refresh(INDEX_NAME);
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test
  public void findAllWays_withSubset() {
    // Setup
    ESWay way1 = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    ESWay way2 = ESWay.Builder.create().id(2).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    List<ESWay> expected = Arrays.asList(new ESWay[] { way2 });

    index(INDEX_NAME, way1, way2);
    refresh(INDEX_NAME);
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test
  public void findAllWays_keepOrder() {
    // Setup
    ESWay way1 = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    ESWay way2 = ESWay.Builder.create().id(2).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    List<ESWay> expected = Arrays.asList(new ESWay[] { way2, way1 });

    index(INDEX_NAME, way1, way2);
    refresh(INDEX_NAME);
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test
  public void deleteWay() {
    // Setup
    ESWay way = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    index(INDEX_NAME, way);
    refresh(INDEX_NAME);

    // Action
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

  }

  @Test
  public void deleteWay_thatDoesNotExists() {
    // Setup
    ESWay way = ESWay.Builder.create().id(1).addLocation(1.1, 2.1).addLocation(1.2, 2.2)
        .addLocation(1.3, 2.3).addLocation(1.4, 2.4).build();
    index(INDEX_NAME, way);
    refresh(INDEX_NAME);

    // Action
View Full Code Here

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.entity.ESWay

    BulkRequestBuilder bulkRequest = client.prepareBulk();
    for (Way way : ways) {
      try {
        int size = way.getWayNodes().size();
        ESShape shape = getShape(iterator, size);
        ESWay esWay = ESWay.Builder.buildFromEntity(way, shape);
        bulkRequest.add(client.prepareIndex(indexName, esWay.getEntityType().getIndiceName(), esWay.getIdString())
            .setSource(esWay.toJson()));
      } catch (Exception e) {
        LOG.warning(String.format("Unable to add Entity %s to bulk request, cause: %s",
            way.getId(), e.getMessage()));
      }
    }
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.