Example #1
0
 /** @throws Exception */
 @Test
 public void getAsMapAsyncNoTx() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Key key2 = ds.put(new Entity("Hoge", key)).get();
   Map<Key, Entity> map = DatastoreUtil.getAsMapAsync(ds, null, Arrays.asList(key, key2)).get();
   assertThat(map, is(notNullValue()));
   assertThat(map.size(), is(2));
 }
Example #2
0
 /** @throws Exception */
 @Test(expected = IllegalStateException.class)
 public void getAsMapAsyncTxIsIllegal() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Key key2 = ds.put(new Entity("Hoge", key)).get();
   Transaction tx = ds.beginTransaction().get();
   tx.rollback();
   DatastoreUtil.getAsMapAsync(ds, tx, Arrays.asList(key, key2));
 }
Example #3
0
 /** @throws Exception */
 @Test(expected = IllegalStateException.class)
 public void deleteAsyncIllegalTx() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Transaction tx = ds.beginTransaction().get();
   tx.rollback();
   DatastoreUtil.deleteAsync(ds, tx, Arrays.asList(key)).get();
 }
Example #4
0
 /** @throws Exception */
 @Test
 public void deleteAsync() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Transaction tx = ds.beginTransaction().get();
   DatastoreUtil.deleteAsync(ds, tx, Arrays.asList(key)).get();
   tx.rollback();
   assertThat(tester.count("Hoge"), is(1));
 }
Example #5
0
 /** @throws Exception */
 @Test
 public void deleteAsyncNoTx() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   DatastoreUtil.deleteAsync(ds, null, Arrays.asList(key)).get();
   assertThat(tester.count("Hoge"), is(0));
 }
Example #6
0
 /** @throws Exception */
 @Test
 public void get() throws Exception {
   Key key = ds.put(new Entity("Hoge")).get();
   Transaction tx = ds.beginTransaction().get();
   assertThat(DatastoreUtil.get(ds, tx, key), is(notNullValue()));
 }