use of com.google.appengine.api.datastore.Index.Property in project appengine-java-standard by GoogleCloudPlatform.
the class IndexTranslatorTest method testIgnoreGeoMode.
/**
* Ensures that an Index with a GEOSPATIAL mode can be converted (even though for now we're
* ignoring the mode).
*/
// TODO add support for Mode, so that it can be surfaced to the app
@Test
public void testIgnoreGeoMode() {
OnestoreEntity.CompositeIndex ci = new OnestoreEntity.CompositeIndex();
ci.setAppId("foo");
ci.setId(1);
ci.setState(OnestoreEntity.CompositeIndex.State.WRITE_ONLY);
OnestoreEntity.Index indexPb = new OnestoreEntity.Index().setEntityType("Mountain").setAncestor(false);
indexPb.addProperty(new OnestoreEntity.Index.Property().setName("location").setMode(OnestoreEntity.Index.Property.Mode.GEOSPATIAL));
ci.setDefinition(indexPb);
Index index = IndexTranslator.convertFromPb(ci);
assertThat(index.getProperties()).hasSize(1);
Property property = index.getProperties().get(0);
assertThat(property.getName()).isEqualTo("location");
assertThat(property.getDirection()).isNull();
}
Aggregations