Package org.openstreetmap.osmosis.plugin.elasticsearch.model.shape

Examples of org.openstreetmap.osmosis.plugin.elasticsearch.model.shape.ESShape


    Node node = OsmDataBuilder.buildSampleNode();

    Iterator<MultiGetItemResponse> iteratorMocked = mock(Iterator.class);
    doReturn(iteratorMocked).when(entityDao).getNodeItems(any(List.class));

    ESShape builder = new ESShapeBuilder(1).addLocation(1.0, 2.0).build();
    doReturn(builder).when(entityDao).getShape(iteratorMocked, 1);

    BulkRequestBuilder bulkRequestBuilderMocked = mock(BulkRequestBuilder.class);
    when(clientMocked.prepareBulk()).thenReturn(bulkRequestBuilderMocked);
View Full Code Here


    Way way = OsmDataBuilder.buildSampleWay(1, 1, 2, 3, 4);

    Iterator<MultiGetItemResponse> iteratorMocked = mock(Iterator.class);
    doReturn(iteratorMocked).when(entityDao).getNodeItems(any(List.class));

    ESShape builder = new ESShapeBuilder(1).addLocation(1.0, 2.0).addLocation(2.0, 3.0)
        .addLocation(3.0, 2.0).addLocation(1.0, 2.0).build();
    doReturn(builder).when(entityDao).getShape(iteratorMocked, 4);

    BulkRequestBuilder bulkRequestBuilderMocked = mock(BulkRequestBuilder.class);
    when(clientMocked.prepareBulk()).thenReturn(bulkRequestBuilderMocked);
View Full Code Here

    Iterator<MultiGetItemResponse> iteratorMocked = mock(Iterator.class);
    when(iteratorMocked.next()).thenReturn(multiGetItemResponseMocked);

    // Action
    ESShape actual = entityDao.getShape(iteratorMocked, 2);

    // Assert
    Assert.assertTrue(Arrays.deepEquals(new double[][] {
        new double[] { 2.0, 1.0 },
        new double[] { 4.0, 3.0 }
    }, actual.getGeoJsonArray()));
  }
View Full Code Here

    Iterator<MultiGetItemResponse> iteratorMocked = mock(Iterator.class);
    when(iteratorMocked.next()).thenReturn(multiGetItemResponseMocked);

    // Action
    ESShape actual = entityDao.getShape(iteratorMocked, 2);

    // Assert
    Assert.assertTrue(Arrays.deepEquals(new double[][] {
        new double[] { 2.0, 1.0 }
    }, actual.getGeoJsonArray()));
  }
View Full Code Here

    Iterator<MultiGetItemResponse> iterator = getNodeItems(ways);
    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",
View Full Code Here

TOP

Related Classes of org.openstreetmap.osmosis.plugin.elasticsearch.model.shape.ESShape

Copyright © 2018 www.massapicom. 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.