/** * Constructs a new {@code AppEngineDatastoreService} with the specified * {@code com.google.appengine.api.datastore.DatastoreService}. * * @param datastore com.google.appengine.api.datastore.DatastoreService. */ public AppEngineDatastoreService(DatastoreService datastore) { this.datastore = datastore; datastoreType = datastore.getDatastoreAttributes().getDatastoreType(); logger.fine("Application [" + SystemProperty.applicationId.get() + "] is using [" + datastoreType + "] datastore"); }
@Test public void testEntityGroupMetadata() throws EntityNotFoundException { if (service.getDatastoreAttributes().getDatastoreType() == DatastoreAttributes.DatastoreType.HIGH_REPLICATION) { NamespaceManager.set(namespaceDat[2]); Entity entity1 = new Entity(kindDat[2]);
@Test public void testMiscOps() throws Exception { AsyncDatastoreService service = DatastoreServiceFactory.getAsyncDatastoreService(); DatastoreAttributes attributes = waitOnFuture(service.getDatastoreAttributes()); Assert.assertNotNull(attributes); Assert.assertNotNull(attributes.getDatastoreType()); Map<Index, Index.IndexState> indexes = waitOnFuture(service.getIndexes()); Assert.assertNotNull(indexes); Transaction tx = waitOnFuture(service.beginTransaction()); try { String txId = tx.getId(); Assert.assertNotNull(txId); Assert.assertEquals(txId, tx.getId()); String appId = tx.getApp(); Assert.assertNotNull(appId); Assert.assertEquals(appId, tx.getApp()); } finally { tx.rollback(); } }