我正在尝试使用谷歌应用引擎提供的本地测试助手来对我使用 objectify 的应用进行单元测试。但是,某些测试失败并显示以下消息;
com.google.apphosting.api.ApiProxy$CallNotFoundException: The API package 'datastore_v3' or call 'Put()' was not found.
at com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:164)
at com.google.apphosting.api.ApiProxy$1.get(ApiProxy.java:162)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.google.appengine.api.datastore.FutureHelper$CumulativeAggregateFuture.get(FutureHelper.java:145)
at com.google.appengine.api.utils.FutureWrapper.get(FutureWrapper.java:90)
at com.googlecode.objectify.impl.ResultAdapter.now(ResultAdapter.java:29)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:20)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:1)
at com.googlecode.objectify.util.ResultTranslator.nowUncached(ResultTranslator.java:21)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:27)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:20)
at com.googlecode.objectify.util.ResultWrapper.translate(ResultWrapper.java:1)
at com.googlecode.objectify.util.ResultTranslator.nowUncached(ResultTranslator.java:21)
at com.googlecode.objectify.util.ResultCache.now(ResultCache.java:27)
这是我的代码:
private final LocalServiceTestHelper helper = new LocalServiceTestHelper(
new LocalDatastoreServiceTestConfig(),
new LocalMemcacheServiceTestConfig());
@BeforeMethod(alwaysRun = true)
public void setUp() {
helper.setUp();
}
.....
//In class constructor
ObjectifyService.register(SomeClass.class);
.....
@AfterMethod(alwaysRun = true)
public void tearDown() {
helper.tearDown();
}
public void doTest {
SomeClass value = ......
ofy().save().entity(value).now(); //throws error
}
这是我的依赖树:
[INFO] | +- com.google.guava:guava-collections:jar:r03:compile
[INFO] | | +- com.google.guava:guava-annotations:jar:r03:compile
[INFO] | | \- com.google.guava:guava-primitives:jar:r03:compile
[INFO] | | \- com.google.guava:guava-base:jar:r03:compile
[INFO] | \- com.google.inject.extensions:guice-servlet:jar:3.0:compile
[INFO] +- com.google.inject:guice:jar:3.0:compile
[INFO] | +- com.google.api-client:google-api-client:jar:1.11.0-beta:compile
[INFO] | | \- com.google.oauth-client:google-oauth-client:jar:1.11.0-beta:compile
[INFO] | | +- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] | | \- com.google.guava:guava:jar:11.0.1:compile
[INFO] | +- com.google.appengine:appengine-api-1.0-sdk:jar:1.7.2:compile
[INFO] | \- com.googlecode.objectify:objectify:jar:4.0a4:compile
[INFO] | +- com.google.appengine.orm:datanucleus-appengine:jar:1.0.10:runtime
[INFO] | \- com.google.appengine:appengine-tools-sdk:jar:1.7.2:compile
[INFO] +- com.google.appengine:appengine-api-labs:jar:1.7.2:test
[INFO] +- com.google.appengine:appengine-api-stubs:jar:1.7.2:test
[INFO] +- com.google.appengine:appengine-testing:jar:1.7.2:test
[INFO] +- com.google.api-client:google-api-client-appengine:jar:1.10.3-beta:compile
[INFO] | +- com.google.oauth-client:google-oauth-client-appengine:jar:1.10.1-beta:compile
[INFO] | | +- com.google.oauth-client:google-oauth-client-servlet:jar:1.10.1-beta:compile
[INFO] | +- com.google.api-client:google-api-client-servlet:jar:1.10.3-beta:compile
[INFO] | \- com.google.http-client:google-http-client-appengine:jar:1.10.3-beta:compile
[INFO] | \- com.google.http-client:google-http-client:jar:1.10.3-beta:compile
[INFO] | +- com.google.code.gson:gson:jar:2.1:compile
[INFO] | \- com.google.protobuf:protobuf-java:jar:2.2.0:compile
知道我错过了什么或做错了什么吗?