当前位置: 首页>>代码示例>>Java>>正文


Java ApiProxy.getDelegate方法代码示例

本文整理汇总了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);
   }
 }
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:27,代码来源:SessionManagerTest.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-gcs-client,代码行数:26,代码来源:GcsServiceFactory.java

示例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");
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:8,代码来源:MutationLogTest.java

示例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");
}
 
开发者ID:google,项目名称:nomulus,代码行数:8,代码来源:MapreduceTestCase.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-gcs-client,代码行数:12,代码来源:LocalRawGcsService.java

示例6: LogRecorder

import com.google.apphosting.api.ApiProxy; //导入方法依赖的package包/类
public LogRecorder() {
  oldDelegate = ApiProxy.getDelegate();
  ApiProxy.setDelegate(this);
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:5,代码来源:LogTest.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:9,代码来源:TestDatagramSocketServlet.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:9,代码来源:TestSocketServlet.java

示例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;
}
 
开发者ID:GoogleCloudPlatform,项目名称:appengine-java-vm-runtime,代码行数:9,代码来源:UrlOverSocketsTestServlet.java


注:本文中的com.google.apphosting.api.ApiProxy.getDelegate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。