Search in sources :

Example 1 with CapabilityStatus

use of com.google.appengine.api.capabilities.CapabilityStatus in project java-docs-samples by GoogleCloudPlatform.

the class ShortTest method testDisabledDatastore.

@Test(expected = ApiProxy.CapabilityDisabledException.class)
public void testDisabledDatastore() {
    Capability testOne = new Capability("datastore_v3");
    CapabilityStatus testStatus = CapabilityStatus.DISABLED;
    // Initialize the test configuration.
    LocalCapabilitiesServiceTestConfig config = new LocalCapabilitiesServiceTestConfig().setCapabilityStatus(testOne, testStatus);
    helper = new LocalServiceTestHelper(config);
    helper.setUp();
    FetchOptions fo = FetchOptions.Builder.withLimit(10);
    DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
    assertEquals(0, ds.prepare(new Query("yam")).countEntities(fo));
}
Also used : FetchOptions(com.google.appengine.api.datastore.FetchOptions) Capability(com.google.appengine.api.capabilities.Capability) Query(com.google.appengine.api.datastore.Query) DatastoreService(com.google.appengine.api.datastore.DatastoreService) LocalServiceTestHelper(com.google.appengine.tools.development.testing.LocalServiceTestHelper) CapabilityStatus(com.google.appengine.api.capabilities.CapabilityStatus) LocalCapabilitiesServiceTestConfig(com.google.appengine.tools.development.testing.LocalCapabilitiesServiceTestConfig) Test(org.junit.Test)

Aggregations

Capability (com.google.appengine.api.capabilities.Capability)1 CapabilityStatus (com.google.appengine.api.capabilities.CapabilityStatus)1 DatastoreService (com.google.appengine.api.datastore.DatastoreService)1 FetchOptions (com.google.appengine.api.datastore.FetchOptions)1 Query (com.google.appengine.api.datastore.Query)1 LocalCapabilitiesServiceTestConfig (com.google.appengine.tools.development.testing.LocalCapabilitiesServiceTestConfig)1 LocalServiceTestHelper (com.google.appengine.tools.development.testing.LocalServiceTestHelper)1 Test (org.junit.Test)1