Package org.springframework.data.geo

Examples of org.springframework.data.geo.Point


  /**
   * @see DATAMONOGO-829
   */
  @Test(expected = IllegalArgumentException.class)
  public void nearQueryShouldThrowExceptionWhenGivenANullQuery() {
    NearQuery.near(new Point(1, 2)).query(null);
  }
View Full Code Here


   */
  @Test
  public void numShouldNotBeAlteredByQueryWithoutPageable() {

    int num = 100;
    NearQuery query = NearQuery.near(new Point(1, 2));
    query.num(num);
    query.query(Query.query(Criteria.where("foo").is("bar")));

    assertThat(DBObjectTestUtils.getTypedValue(query.toDBObject(), "num", Integer.class), is(num));
  }
View Full Code Here

    Method method = PersonRepository.class.getMethod("findByLocationNear", Point.class);
    MongoQueryMethod queryMethod = new MongoQueryMethod(method, metadata, context);

    MongoParameterAccessor accessor = new MongoParametersParameterAccessor(queryMethod,
        new Object[] { new Point(10, 20) });
    assertThat(accessor.getMaxDistance(), is(nullValue()));
  }
View Full Code Here

    Method method = PersonRepository.class.getMethod("findByLocationNear", Point.class, Distance.class);
    MongoQueryMethod queryMethod = new MongoQueryMethod(method, metadata, context);

    MongoParameterAccessor accessor = new MongoParametersParameterAccessor(queryMethod, new Object[] {
        new Point(10, 20), DISTANCE });
    assertThat(accessor.getMaxDistance(), is(DISTANCE));
  }
View Full Code Here

    Method method = PersonRepository.class.getMethod("findByLocationNear", Point.class, Distance.class);
    MongoQueryMethod queryMethod = new MongoQueryMethod(method, metadata, context);

    MongoParameterAccessor accessor = new MongoParametersParameterAccessor(queryMethod, new Object[] {
        new Point(10, 20), DISTANCE });
    assertThat(accessor.getFullText(), IsNull.nullValue());
  }
View Full Code Here

   * @see DATAMONGO-341
   */
  @Test
  public void geoNearRejectsNullEntityClass() {

    final NearQuery query = NearQuery.near(new Point(10, 20));

    new Execution() {
      @Override
      public void doWith(MongoOperations operations) {
        operations.geoNear(query, null);
View Full Code Here

   * @see DATAMONGO-341
   */
  @Test
  public void geoNearRejectsNullEntityClassIfCollectionGiven() {

    final NearQuery query = NearQuery.near(new Point(10, 20));

    new Execution() {
      @Override
      public void doWith(MongoOperations operations) {
        operations.geoNear(query, null, "collection");
View Full Code Here

  @Test
  public void testCreateQueryWithNear() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationNear", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method,
        new Object[] { new Point(48.303056, 14.290556), new Distance(5) });
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=store d=5.0}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithNearWhereUnitIsMiles() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationNear", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method, new Object[] { new Point(48.303056, 14.290556),
        new Distance(1, Metrics.MILES) });
    Assert.assertEquals("{!bbox pt=48.303056,14.290556 sfield=store d=1.609344}", queryParser.getQueryString(query));
  }
View Full Code Here

  @Test
  public void testCreateQueryWithWithin() throws NoSuchMethodException, SecurityException {
    Method method = SampleRepository.class.getMethod("findByLocationWithin", Point.class, Distance.class);

    Query query = createQueryForMethodWithArgs(method,
        new Object[] { new Point(48.303056, 14.290556), new Distance(5) });
    Assert.assertEquals("{!geofilt pt=48.303056,14.290556 sfield=store d=5.0}", queryParser.getQueryString(query));
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.geo.Point

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.