Search in sources :

Example 1 with Property

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();
}
Also used : OnestoreEntity(com.google.storage.onestore.v3.OnestoreEntity) Property(com.google.appengine.api.datastore.Index.Property) Test(org.junit.Test)

Aggregations

Property (com.google.appengine.api.datastore.Index.Property)1 OnestoreEntity (com.google.storage.onestore.v3.OnestoreEntity)1 Test (org.junit.Test)1