All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.objectify.test.util.MockAsyncDatastoreService Maven / Gradle / Ivy

Go to download

*** THIS VERSION UPLOADED FOR USE WITH CEDAR-COMMON, TO AVOID DEPENDENCIES ON GOOGLE CODE-BASED MAVEN REPOSITORIES. *** The simplest convenient interface to the Google App Engine datastore

The newest version!
package com.googlecode.objectify.test.util;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;

import com.google.appengine.api.datastore.AsyncDatastoreService;
import com.google.appengine.api.datastore.DatastoreAttributes;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Index;
import com.google.appengine.api.datastore.Index.IndexState;
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyRange;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Transaction;
import com.google.appengine.api.datastore.TransactionOptions;

/**
 * This datastore service throws UnsupportedOperationException from every method call immediately.  It allows
 * us to test that the cache layer is working properly - when cached, it shouldn't make any calls here.
 */
public class MockAsyncDatastoreService implements AsyncDatastoreService
{

	@Override
	public PreparedQuery prepare(Query query)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public PreparedQuery prepare(Transaction txn, Query query)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Transaction getCurrentTransaction()
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Transaction getCurrentTransaction(Transaction returnedIfNoTxn)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Collection getActiveTransactions()
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future beginTransaction()
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future beginTransaction(TransactionOptions options)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future get(Key key)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future get(Transaction txn, Key key)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future> get(Iterable keys)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future> get(Transaction txn, Iterable keys)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future put(Entity entity)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future put(Transaction txn, Entity entity)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future> put(Iterable entities)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future> put(Transaction txn, Iterable entities)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future delete(Key... keys)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future delete(Transaction txn, Key... keys)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future delete(Iterable keys)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future delete(Transaction txn, Iterable keys)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future allocateIds(String kind, long num)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future allocateIds(Key parent, String kind, long num)
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future getDatastoreAttributes()
	{
		throw new UnsupportedOperationException();
	}

	@Override
	public Future> getIndexes()
	{
		throw new UnsupportedOperationException();
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy