Indeed, ApiProxyLocalImpl is not public anymore in newer versions of
google app engine.
Find below one solution to the problem:
import java.io.File;
import java.util.Properties;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManager;
import javax.jdo.PersistenceManagerFactory;
import junit.framework.TestCase;
import com.google.appengine.api.datastore.dev.LocalDatastoreService;
import com.google.appengine.tools.development.ApiProxyLocal;
import com.google.appengine.tools.development.ApiProxyLocalFactory;
import com.google.appengine.tools.development.LocalServerEnvironment;
import
com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import
com.google.appengine.tools.development.testing.LocalTaskQueueTestConfig;
import com.google.apphosting.api.ApiProxy;
public class BaseTest extends TestCase {
private final LocalServiceTestHelper helper =
new LocalServiceTestHelper(new LocalTaskQueueTestConfig());
protected PersistenceManagerFactory pmf;
protected PersistenceManager pm;
@Override
public void tearDown() {
helper.tearDown();
}
@Override
public void setUp() throws Exception {
super.setUp();
helper.setUp();
Properties newProperties = new Properties();
newProperties.put("javax.jdo.PersistenceManagerFactoryClass",
"org.datanucleus.store.appengine.jdo."
+
"DatastoreJDOPersistenceManagerFactory");
newProperties.put("javax.jdo.option.ConnectionURL",
"appengine");
newProperties.put("javax.jdo.option.NontransactionalRead",
"true");
newProperties.put("javax.jdo.option.NontransactionalWrite",
"true");
newProperties.put("javax.jdo.option.RetainValues", "true");
newProperties.put("datanucleus.appengine.autoCreateDatastoreTxns",
"true");
newProperties.put("datanucleus.appengine.autoCreateDatastoreTxns",
"true");
pmf = JDOHelper.getPersistenceManagerFactory(newProperties);
pm = pmf.getPersistenceManager();
ApiProxyLocalFactory factory = new ApiProxyLocalFactory();
ApiProxyLocal proxy = factory.create(new
LocalServerEnvironment() {
public void waitForServerToStart()
throws
InterruptedException {
}
public int getPort() {
return 0;
}
public File getAppDir() {
return new File(".");
}
public String getAddress() {
return null;
}
});
proxy.setProperty(
// LocalDatastoreService.BACKING_STORE_PROPERTY,
LocalDatastoreService.NO_STORAGE_PROPERTY,
Boolean.TRUE.toString());
ApiProxy.setDelegate(proxy);
}
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.