Package com.google.appengine.api.datastore

Examples of com.google.appengine.api.datastore.AsyncDatastoreService.beginTransaction()


        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());
View Full Code Here


    @Test
    public void testBeginTx() throws Exception {
        final AsyncDatastoreService service = DatastoreServiceFactory.getAsyncDatastoreService();

        Transaction tx = waitOnFuture(service.beginTransaction(TransactionOptions.Builder.withXG(true)));
        Key key, key2;
        try {
            key = waitOnFuture(service.put(tx, new Entity("AsyncTx")));
            key2 = waitOnFuture(service.put(tx, new Entity("AsyncTx")));
            tx.commit();
View Full Code Here

            tx.rollback();
            throw e;
        }

        if (key != null && key2 != null) {
            tx = waitOnFuture(service.beginTransaction(TransactionOptions.Builder.withXG(true)));
            try {
                try {
                    try {
                        Assert.assertNotNull(waitOnFuture(service.get(tx, key)));
                        Assert.assertNotNull(waitOnFuture(service.get(tx, Collections.singleton(key2))));
View Full Code Here

    }

    @Test
    public void testCommitTx() throws Exception {
        AsyncDatastoreService service = DatastoreServiceFactory.getAsyncDatastoreService();
        Transaction tx = waitOnFuture(service.beginTransaction(TransactionOptions.Builder.withDefaults()));
        Key key;
        try {
            Future<Key> fKey = service.put(tx, new Entity("AsyncTx"));
            key = waitOnFuture(fKey);
            waitOnFuture(tx.commitAsync());
View Full Code Here

    }

    @Test
    public void testRollbackTx() throws Exception {
        AsyncDatastoreService service = DatastoreServiceFactory.getAsyncDatastoreService();
        Transaction tx = waitOnFuture(service.beginTransaction(TransactionOptions.Builder.withDefaults()));
        Key key = null;
        try {
            Future<Key> fKey = service.put(tx, new Entity("AsyncTx"));
            key = waitOnFuture(fKey);
        } finally {
View Full Code Here

        return getHelperDeployment().addClass(AsyncTestBase.class);
    }

    protected <T> T inTx(Action<T> action) throws Exception {
        AsyncDatastoreService ads = DatastoreServiceFactory.getAsyncDatastoreService();
        Transaction tx = ads.beginTransaction().get();
        boolean ok = false;
        try {
            T result = action.run(ads);
            ok = true;
            return result;
View Full Code Here

TOP
Copyright © 2015 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.