本文整理汇总了Java中com.google.apphosting.api.ApiProxy.getDelegate方法的典型用法代码示例。如果您正苦于以下问题:Java ApiProxy.getDelegate方法的具体用法?Java ApiProxy.getDelegate怎么用?Java ApiProxy.getDelegate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.apphosting.api.ApiProxy
的用法示例。
在下文中一共展示了ApiProxy.getDelegate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDatastoreTimeouts
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void testDatastoreTimeouts() throws EntityNotFoundException {
Delegate original = ApiProxy.getDelegate();
// Throw in a couple of datastore timeouts
TimeoutGeneratingDelegate newDelegate = new TimeoutGeneratingDelegate(original);
try {
ApiProxy.setDelegate(newDelegate);
HttpServletRequest request = makeMockRequest(true);
replay(request);
AppEngineSession session = manager.newSession(request);
session.setAttribute("foo", "bar");
newDelegate.setTimeouts(3);
session.save();
assertEquals(newDelegate.getTimeoutsRemaining(), 0);
memcache.clearAll();
manager =
new SessionManager(Collections.<SessionStore>singletonList(new DatastoreSessionStore()));
HttpSession session2 = manager.getSession(session.getId());
assertEquals(session.getId(), session2.getId());
assertEquals("bar", session2.getAttribute("foo"));
} finally {
ApiProxy.setDelegate(original);
}
}
示例2: createRawGcsService
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
static RawGcsService createRawGcsService(Map<String, String> headers) {
ImmutableSet.Builder<HTTPHeader> builder = ImmutableSet.builder();
if (headers != null) {
for (Map.Entry<String, String> header : headers.entrySet()) {
builder.add(new HTTPHeader(header.getKey(), header.getValue()));
}
}
RawGcsService rawGcsService;
Value location = SystemProperty.environment.value();
if (location == SystemProperty.Environment.Value.Production || hasCustomAccessTokenProvider()) {
rawGcsService = OauthRawGcsServiceFactory.createOauthRawGcsService(builder.build());
} else if (location == SystemProperty.Environment.Value.Development) {
rawGcsService = LocalRawGcsServiceFactory.createLocalRawGcsService();
} else {
Delegate<?> delegate = ApiProxy.getDelegate();
if (delegate == null
|| delegate.getClass().getName().startsWith("com.google.appengine.tools.development")) {
rawGcsService = LocalRawGcsServiceFactory.createLocalRawGcsService();
} else {
rawGcsService = OauthRawGcsServiceFactory.createOauthRawGcsService(builder.build());
}
}
return rawGcsService;
}
示例3: setUp
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
@Override protected void setUp() throws Exception {
super.setUp();
helper.setUp();
ApiProxyLocal proxy = (ApiProxyLocal) ApiProxy.getDelegate();
// HACK(ohler): Work around "illegal blobKey" crash.
proxy.setProperty(LocalBlobstoreService.NO_STORAGE_PROPERTY, "true");
}
示例4: setUp
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
taskQueue = LocalTaskQueueTestConfig.getLocalTaskQueue();
ApiProxyLocal proxy = (ApiProxyLocal) ApiProxy.getDelegate();
// Creating files is not allowed in some test execution environments, so don't.
proxy.setProperty(LocalBlobstoreService.NO_STORAGE_PROPERTY, "true");
}
示例5: getInstance
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
private static BlobStorageAdapter getInstance() throws IOException {
Delegate<?> apiProxyDelegate = ApiProxy.getDelegate();
if (instance == null || instance.apiProxyDelegate != apiProxyDelegate) {
try {
instance = new BlobStorageAdapter(apiProxyDelegate);
} catch (Exception e) {
throw new IOException(e);
}
}
return instance;
}
示例6: LogRecorder
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
public LogRecorder() {
oldDelegate = ApiProxy.getDelegate();
ApiProxy.setDelegate(this);
}
示例7: setUpMockDelegate
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
/**
* Set up a mock delegate to socket resolve calls.
*/
private ApiProxy.Delegate setUpMockDelegate() {
ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
ApiProxy.setDelegate(new MockDelegate());
return oldDelegate;
}
示例8: setUpMockDelegate
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
/**
* Set up a mock delegate to handle resolve calls.
*/
private ApiProxy.Delegate setUpMockDelegate() {
ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
ApiProxy.setDelegate(new MockDelegate());
return oldDelegate;
}
示例9: setUpMockDelegate
import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
/**
* Set up a mock delegate to handle resolve calls.
*/
private ApiProxy.Delegate setUpMockDelegate() {
ApiProxy.Delegate oldDelegate = ApiProxy.getDelegate();
ApiProxy.setDelegate(new UrlMockDelegate());
return oldDelegate;
}