@Test public void getEntities_twoEntitiesStored_shouldReturnTwoEntities() { createEntityInDatastore(KIND_NAME, PROPERTY_NAME, A_NAME); createEntityInDatastore(KIND_NAME, PROPERTY_NAME, ANOTHER_NAME); Iterable<Entity> entities = entitiesService.getEntities(KIND_NAME, ALL_NAMESPACES, null, null); Iterator<Entity> it = entities.iterator(); Entity entity1 = it.next(); Entity entity2 = it.next(); assertEquals(A_NAME, entity1.getProperty(PROPERTY_NAME)); assertEquals(ANOTHER_NAME, entity2.getProperty(PROPERTY_NAME)); assertFalse(it.hasNext()); }
@Override public Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit) { AppEngineHelper.disableApiHooks(); FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); if (offset != null) { fetchOptions.offset(offset); } if (limit != null) { fetchOptions.limit(limit); } Query query = new Query(kind); return datastoreHelper.queryOnNamespace(namespace, query, fetchOptions); }
EntitiesServiceImpl implements EntitiesService { @Override public Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit) { AppEngineHelper.disableApiHooks(); FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); if (offset != null) { fetchOptions.offset(offset); } if (limit != null) { fetchOptions.limit(limit); } Query query = new Query(kind); return datastoreHelper.queryOnNamespace(namespace, query, fetchOptions); } }
EntitiesServiceImpl implements EntitiesService { @Override public Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit) { AppEngineHelper.disableApiHooks(); FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); if (offset != null) { fetchOptions.offset(offset); } if (limit != null) { fetchOptions.limit(limit); } Query query = new Query(kind); return datastoreHelper.queryOnNamespace(namespace, query, fetchOptions); } @Inject  EntitiesServiceImpl(
            DatastoreHelper datastoreHelper,
            DefaultValueGenerator defaultValueGenerator,
            DatastoreCountProvider countProvider); }
EntitiesServiceImpl implements EntitiesService { @Override public Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit) { AppEngineHelper.disableApiHooks(); FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); if (offset != null) { fetchOptions.offset(offset); } if (limit != null) { fetchOptions.limit(limit); } Query query = new Query(kind); return datastoreHelper.queryOnNamespace(namespace, query, fetchOptions); } @Inject  EntitiesServiceImpl(
            DatastoreHelper datastoreHelper,
            DefaultValueGenerator defaultValueGenerator,
            DatastoreCountProvider countProvider); @Override Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit); @Override Collection<Entity> getEntities(List<Key> keys); @Override Entity createEmptyEntity(String kind); @Override void deleteEntities(String kind, String namespace, DeleteEntities deleteType, String encodedKeys); @Override long getCount(String kind, String namespace); @Override List<Key> put(Iterable<Entity> entities); @Override Future<List<Key>> putAsync(Iterable<Entity> entities); }
EntitiesServiceImpl implements EntitiesService { @Override public Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit) { AppEngineHelper.disableApiHooks(); FetchOptions fetchOptions = FetchOptions.Builder.withDefaults(); if (offset != null) { fetchOptions.offset(offset); } if (limit != null) { fetchOptions.limit(limit); } Query query = new Query(kind); return datastoreHelper.queryOnNamespace(namespace, query, fetchOptions); } @Inject  EntitiesServiceImpl(
            DatastoreHelper datastoreHelper,
            DefaultValueGenerator defaultValueGenerator,
            DatastoreCountProvider countProvider); @Override Iterable<Entity> getEntities(String kind, String namespace, Integer offset, Integer limit); @Override Collection<Entity> getEntities(List<Key> keys); @Override Entity createEmptyEntity(String kind); @Override void deleteEntities(String kind, String namespace, DeleteEntities deleteType, String encodedKeys); @Override long getCount(String kind, String namespace); @Override List<Key> put(Iterable<Entity> entities); @Override Future<List<Key>> putAsync(Iterable<Entity> entities);  }