Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.DatastoreServiceConfig$Builder


    e.setProperty("bidirChildren_INTEGER_IDX", childIndex);
    return e;
  }

  BatchRecorder newBatchRecorder() {
    DatastoreServiceConfig config = getStoreManager().getDefaultDatastoreServiceConfigForReads();
    return new BatchRecorder(config) {
      boolean isBatchMethod(Method method) {
        return method.getName().equals("delete") &&
          (method.getParameterTypes().length == 1 && Iterable.class.isAssignableFrom(method.getParameterTypes()[0])) ||
          (method.getParameterTypes().length == 2 && Iterable.class.isAssignableFrom(method.getParameterTypes()[1]));
View Full Code Here


  }

  void testChildFetchedLazily(Class<? extends HasOneToManyJPA> pojoClass,
                              Class<? extends BidirTop> bidirClass,
                              UnidirLevel unidirLevel, String bidirKind) throws Exception {
    DatastoreServiceConfig config = getStoreManager().getDefaultDatastoreServiceConfigForReads();
    // force a new emf to get created after we've installed our own DatastoreService mock
    if (emf.isOpen()) {
      emf.close();
    }
    tearDown();
View Full Code Here

*/
public class JDODatastoreServiceConfigTest extends JDOTestCase {

  public void testDefaultStorageVersion() {
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    DatastoreServiceConfig defaultConfig = DatastoreServiceConfig.Builder.withDefaults();
    assertEquals(defaultConfig.getDeadline(), config.getDeadline());
    assertEquals(defaultConfig.getReadPolicy(), config.getReadPolicy());
  }
View Full Code Here

    props.put("javax.jdo.option.DatastoreWriteTimeoutMillis", "335");
    props.put(DatastoreManager.DATASTORE_READ_CONSISTENCY_PROPERTY, ReadPolicy.Consistency.EVENTUAL.name());
    pmf = JDOHelper.getPersistenceManagerFactory(props, getPersistenceManagerFactoryName().name());
    pm = pmf.getPersistenceManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(.334d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(.335d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
  }
View Full Code Here

    props.put("datanucleus.datastoreWriteTimeout", "335");
    props.put(DatastoreManager.DATASTORE_READ_CONSISTENCY_PROPERTY, ReadPolicy.Consistency.EVENTUAL.name());
    pmf = JDOHelper.getPersistenceManagerFactory(props, getPersistenceManagerFactoryName().name());
    pm = pmf.getPersistenceManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(.334d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(.335d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
  }
View Full Code Here

    pmf.close();

    pmf = JDOHelper.getPersistenceManagerFactory("datastoreserviceconfigprops");
    pm = pmf.getPersistenceManager();
    DatastoreManager storeMgr = (DatastoreManager) getExecutionContext().getStoreManager();
    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    assertEquals(5.0d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    config = storeMgr.getDefaultDatastoreServiceConfigForWrites();
    assertEquals(10.0d, config.getDeadline());
    assertEquals(new ReadPolicy(ReadPolicy.Consistency.EVENTUAL), config.getReadPolicy());
    pm.close();
    pmf.close();
  }
View Full Code Here

    // DatastoreManager.addTypeManagerMappings() depends on this.
    assertEquals("java.util.Arrays$ArrayList", Arrays.asList(1, 2, 3).getClass().getName());
  }

  public void testCopyDatastoreServiceConfig() {
    DatastoreServiceConfig original = DatastoreServiceConfig.Builder.withDefaults();
    DatastoreServiceConfig copy = DatastoreManager.copyDatastoreServiceConfig(original);
    assertFalse(original == copy);
    assertEquals(original.getDeadline(), copy.getDeadline());
    assertEquals(original.getImplicitTransactionManagementPolicy(),
                 copy.getImplicitTransactionManagementPolicy());
    assertEquals(original.getReadPolicy(), copy.getReadPolicy());
  }
View Full Code Here

        return Utils.newArrayList();
      }

      List children = new ArrayList();
      List<Key> keys = (List<Key>)value;
      DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
      DatastoreService ds = DatastoreServiceFactoryInternal.getDatastoreService(config);
      Map<Key, Entity> entitiesByKey = ds.get(keys);
      int i = 0;
      for (Key key : keys) {
        if (i < startIdx) {
View Full Code Here

    for (SortPredicate sp : sortPredicates) {
      q.addSort(sp.getPropertyName(), sp.getDirection());
      NucleusLogger.PERSISTENCE.debug("  Added sort: " + sp.getPropertyName() + " " + sp.getDirection());
    }

    DatastoreServiceConfig config = storeMgr.getDefaultDatastoreServiceConfigForReads();
    DatastoreService ds = DatastoreServiceFactoryInternal.getDatastoreService(config);
    return ds.prepare(q);
  }
View Full Code Here

      }
    }
  }

  public static void install(DatastoreManager storeManager, Policy policy) {
    DatastoreServiceConfig config = storeManager.getDefaultDatastoreServiceConfigForReads();
    ORIGINAL_DATASTORE_SERVICE = DatastoreServiceFactoryInternal.getDatastoreService(config);
    Handler handler = new Handler(ORIGINAL_DATASTORE_SERVICE, policy);
    DatastoreService ds = (DatastoreService) Proxy.newProxyInstance(
        DatastoreServiceInterceptor.class.getClassLoader(),
        new Class[] {DatastoreService.class}, handler);
View Full Code Here

TOP

Related Classes of com.google.appengine.api.datastore.DatastoreServiceConfig$Builder

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.