Package org.elasticsearch.common.io.stream

Examples of org.elasticsearch.common.io.stream.BytesStreamOutput.bytes()


  @Test
  public void testReadFromWriteToSingleton() throws IOException {
    GeoCluster expected = new GeoCluster(DENVER);
    BytesStreamOutput out = new BytesStreamOutput();
    expected.writeTo(out);
    BytesStreamInput in = new BytesStreamInput(out.bytes());
    GeoCluster actual = GeoCluster.readFrom(in);
    assertThat("Center", actual.center(), closeTo(DENVER));
    assertThat("Bounds", actual.bounds(), equalTo(new GeoBoundingBox(DENVER)));
  }
View Full Code Here


  @Test
  public void testReadFromWriteTo() throws IOException {
    GeoCluster expected = new GeoCluster(42, DENVER, COLORADO);
    BytesStreamOutput out = new BytesStreamOutput();
    expected.writeTo(out);
    BytesStreamInput in = new BytesStreamInput(out.bytes());
    GeoCluster actual = GeoCluster.readFrom(in);
    assertThat("Center", actual.center(), closeTo(DENVER));
    assertThat("Bounds", actual.bounds(), equalTo(COLORADO));
  }
View Full Code Here

  @Test
  public void testReadFromWriteTo() throws IOException {
    BytesStreamOutput out = new BytesStreamOutput();
    GeoPoints.writeTo(LAS_VEGAS, out);
    BytesStreamInput in = new BytesStreamInput(out.bytes());
    GeoPoint point = GeoPoints.readFrom(in);
    assertThat("Latitude", point.lat(), equalTo(LAS_VEGAS.lat()));
    assertThat("Longitude", point.lon(), equalTo(LAS_VEGAS.lon()));
  }
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.