Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.Transaction.rollback()


                    }
                } finally {
                    service.delete(tx, Collections.singleton(key));
                }
            } finally {
                tx.rollback();
            }
        }
    }

    @Test
View Full Code Here


    public void testTransactionalTasksMustBeNameless() {
        Transaction tx = DatastoreServiceFactory.getDatastoreService().beginTransaction();
        try {
            queue.add(tx, withMethod(PULL).taskName("foo"));
        } finally {
            tx.rollback();
        }
    }

    @Test(expected = IllegalArgumentException.class)
    public void testNegativeEtaMillis() {
View Full Code Here

        Transaction tx = DatastoreServiceFactory.getDatastoreService().beginTransaction();
        final int beforeNumTasks = getDefaultQueue().fetchStatistics().getNumTasks();
        try {
            getDefaultQueue().add(tx, TaskOptions.Builder.withDefaults());
        } finally {
            tx.rollback();
        }

        sync(10000)// Wait for statistics servers to refresh.
        Assert.assertEquals(beforeNumTasks, getDefaultQueue().fetchStatistics().getNumTasks());
    }
View Full Code Here

        Transaction tx = DatastoreServiceFactory.getDatastoreService().beginTransaction();
        final int beforeNumTasks = getDefaultQueue().fetchStatistics().getNumTasks();
        try {
            getDefaultQueue().add(tx, Collections.singleton(TaskOptions.Builder.withDefaults()));
        } finally {
            tx.rollback();
        }

        sync(10000)// Wait for statistics servers to refresh.
        Assert.assertEquals(beforeNumTasks, getDefaultQueue().fetchStatistics().getNumTasks());
    }
View Full Code Here

        Transaction tx = DatastoreServiceFactory.getDatastoreService().beginTransaction();
        final int beforeNumTasks = getDefaultQueue().fetchStatistics().getNumTasks();
        try {
            waitOnFuture(getDefaultQueue().addAsync(tx, TaskOptions.Builder.withDefaults()));
        } finally {
            tx.rollback();
        }

        sync(10000);
        Assert.assertEquals(beforeNumTasks, waitOnFuture(getDefaultQueue().fetchStatisticsAsync(2013.0)).getNumTasks());
    }
View Full Code Here

        Transaction tx = DatastoreServiceFactory.getDatastoreService().beginTransaction();
        final int beforeNumTasks = getDefaultQueue().fetchStatistics().getNumTasks();
        try {
            waitOnFuture(getDefaultQueue().addAsync(tx, Collections.singleton(TaskOptions.Builder.withDefaults())));
        } finally {
            tx.rollback();
        }

        sync(10000);
        Assert.assertEquals(beforeNumTasks, waitOnFuture(getDefaultQueue().fetchStatisticsAsync(2013.0)).getNumTasks());
    }
View Full Code Here

        try {
            service.put(tx, entity);
            tx.commit();
        } finally {
            if (tx.isActive()) {
                tx.rollback();
            }
        }
    }

    private CompositeFilter getTestMethodFilter(String testMethodTag) {
View Full Code Here

            service.put(tx, entity);
            assertStoreDoesNotContain(entity);
            tx.commit();
            assertStoreContains(entity);
        } catch (Exception e) {
            tx.rollback();
            throw e;
        }
    }

    @Test
View Full Code Here

            service.delete(tx, entity.getKey());
            assertStoreContains(entity);
            tx.commit();
            assertStoreDoesNotContain(entity);
        } catch (Exception e) {
            tx.rollback();
            throw e;
        }
    }

    @Test
View Full Code Here

    @Test
    public void testRollbackWhenPuttingEntity() throws Exception {
        Entity entity = createTestEntity("ROLLBACK", 1);
        Transaction tx = service.beginTransaction();
        service.put(tx, entity);
        tx.rollback();
        // should not be there due to rollback
        assertStoreDoesNotContain(entity);
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.