本文整理汇总了Java中com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig类的典型用法代码示例。如果您正苦于以下问题:Java LocalMemcacheServiceTestConfig类的具体用法?Java LocalMemcacheServiceTestConfig怎么用?Java LocalMemcacheServiceTestConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LocalMemcacheServiceTestConfig类属于com.google.appengine.tools.development.testing包,在下文中一共展示了LocalMemcacheServiceTestConfig类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTestConfigs
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
/**
* Override to customise the test configs required.
*
* @return Test configs.
*/
protected List<LocalServiceTestConfig> createTestConfigs() {
List<LocalServiceTestConfig> results = new ArrayList<>();
LocalTaskQueueTestConfig queueConfig = new LocalTaskQueueTestConfig();
queueConfig.setQueueXmlPath("src/main/webapp/WEB-INF/queue.xml");
results.add(new LocalDatastoreServiceTestConfig().setApplyAllHighRepJobPolicy());
results.add(queueConfig);
results.add(new LocalMemcacheServiceTestConfig());
results.add(new LocalSearchServiceTestConfig());
return results;
}
示例2: setUp
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
super.setUp();
// See
// http://www.ensor.cc/2010/11/unit-testing-named-queues-spring.html
// NOTE: THE QUEUE XML PATH RELATIVE TO WEB APP ROOT, More info
// below
// http://stackoverflow.com/questions/11197058/testing-non-default-app-engine-task-queues
final LocalTaskQueueTestConfig localTaskQueueConfig = new LocalTaskQueueTestConfig()
.setDisableAutoTaskExecution(false).setQueueXmlPath("src/test/resources/queue.xml")
.setTaskExecutionLatch(countdownLatch).setCallbackClass(DeleteShardedCounterDeferredCallback.class);
Capability testOne = new Capability("memcache");
CapabilityStatus testStatus = CapabilityStatus.DISABLED;
// Initialize
LocalCapabilitiesServiceTestConfig capabilityStatusConfig = new LocalCapabilitiesServiceTestConfig()
.setCapabilityStatus(testOne, testStatus);
// Use a different queue.xml for testing purposes
helper = new LocalServiceTestHelper(
new LocalDatastoreServiceTestConfig().setDefaultHighRepJobPolicyUnappliedJobPercentage(0.01f),
new LocalMemcacheServiceTestConfig(), localTaskQueueConfig, capabilityStatusConfig);
helper.setUp();
}
开发者ID:instacount,项目名称:appengine-counter,代码行数:27,代码来源:ShardedCounterServiceCounterShardDecrementNoMemcacheTest.java
示例3: disableMemcache
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
protected void disableMemcache()
{
// See
// http://www.ensor.cc/2010/11/unit-testing-named-queues-spring.html
// NOTE: THE QUEUE XML PATH RELATIVE TO WEB APP ROOT, More info
// below
// http://stackoverflow.com/questions/11197058/testing-non-default-app-engine-task-queues
final LocalTaskQueueTestConfig localTaskQueueConfig = new LocalTaskQueueTestConfig()
.setDisableAutoTaskExecution(false).setQueueXmlPath("src/test/resources/queue.xml")
.setTaskExecutionLatch(countdownLatch).setCallbackClass(DeleteShardedCounterDeferredCallback.class);
Capability testOne = new Capability("memcache");
CapabilityStatus testStatus = CapabilityStatus.DISABLED;
// Initialize
LocalCapabilitiesServiceTestConfig capabilityStatusConfig = new LocalCapabilitiesServiceTestConfig()
.setCapabilityStatus(testOne, testStatus);
// Use a different queue.xml for testing purposes
helper = new LocalServiceTestHelper(
new LocalDatastoreServiceTestConfig().setDefaultHighRepJobPolicyUnappliedJobPercentage(0.01f),
new LocalMemcacheServiceTestConfig(), localTaskQueueConfig, capabilityStatusConfig);
helper.setUp();
}
示例4: createTestConfigs
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
/**
* Override to customise the test configs required.
*
* @return
*/
protected List<LocalServiceTestConfig> createTestConfigs() {
List<LocalServiceTestConfig> results = new ArrayList<>();
LocalTaskQueueTestConfig queueConfig = new LocalTaskQueueTestConfig();
queueConfig.setQueueXmlPath("src/main/webapp/WEB-INF/queue.xml");
results.add(new LocalDatastoreServiceTestConfig().setApplyAllHighRepJobPolicy());
results.add(queueConfig);
results.add(new LocalMemcacheServiceTestConfig());
results.add(new LocalSearchServiceTestConfig());
return results;
}
示例5: setUp
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
/**
* Sets up the AppEngine environment and initializes Guice.
*/
@Override
protected void setUp() throws Exception {
super.setUp();
datastoreConfig = new LocalDatastoreServiceTestConfig();
memcacheConfig = new LocalMemcacheServiceTestConfig();
taskQueueConfig = new LocalTaskQueueTestConfig();
taskQueueConfig.setQueueXmlPath("src/main/webapp/WEB-INF/queue.xml");
HashMap<String, Object> envAttr = new HashMap<String, Object>();
envAttr.put("com.google.appengine.api.users.UserService.user_id_key", "13");
helper = new LocalServiceTestHelper(datastoreConfig, taskQueueConfig);
helper.setEnvAuthDomain("auth");
helper.setEnvEmail("[email protected]");
helper.setEnvAttributes(envAttr);
helper.setEnvIsAdmin(true);
helper.setEnvIsLoggedIn(true);
helper.setUp();
User user = UserTestCase.addTestUser();
// Mock the session so AuthFilter will also return the test user
HttpServletRequest mockServletRequest = Mockito.mock(HttpServletRequest.class);
HttpSession mockHttpSession = Mockito.mock(HttpSession.class);
Mockito.when(mockHttpSession.getAttribute(AuthFilter.USER_KEY)).thenReturn(user);
Mockito.when(mockServletRequest.getSession()).thenReturn(mockHttpSession);
AuthFilter.testLogin(mockServletRequest, user);
}
示例6: before
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
@Override
protected void before() throws Throwable {
LocalDatastoreServiceTestConfig cfg = new LocalDatastoreServiceTestConfig();
LocalBlobstoreServiceTestConfig blobCfg = new LocalBlobstoreServiceTestConfig();
LocalTaskQueueTestConfig queueCfg = new LocalTaskQueueTestConfig();
LocalMemcacheServiceTestConfig cacheCfg = new LocalMemcacheServiceTestConfig();
helper = new LocalServiceTestHelper(cfg, blobCfg, queueCfg, cacheCfg);
helper.setUp();
}
示例7: setUp
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
@Before
public void setUp() throws Exception
{
// Don't call super.setUp because we initialize slightly differently
// here...
countdownLatch = new LocalTaskQueueTestConfig.TaskCountDownLatch(1);
// See
// http://www.ensor.cc/2010/11/unit-testing-named-queues-spring.html
// NOTE: THE QUEUE XML PATH RELATIVE TO WEB APP ROOT, More info
// below
// http://stackoverflow.com/questions/11197058/testing-non-default-app-engine-task-queues
final LocalTaskQueueTestConfig localTaskQueueConfig = new LocalTaskQueueTestConfig()
.setDisableAutoTaskExecution(false).setQueueXmlPath("src/test/resources/queue.xml")
.setTaskExecutionLatch(countdownLatch).setCallbackClass(DeleteShardedCounterDeferredCallback.class);
// Use a different queue.xml for testing purposes
helper = new LocalServiceTestHelper(new LocalDatastoreServiceTestConfig().setApplyAllHighRepJobPolicy(),
new LocalMemcacheServiceTestConfig(), new LocalCapabilitiesServiceTestConfig(), localTaskQueueConfig);
helper.setUp();
memcache = MemcacheServiceFactory.getMemcacheService();
capabilitiesService = CapabilitiesServiceFactory.getCapabilitiesService();
// New Objectify 5.1 Way. See https://groups.google.com/forum/#!topic/objectify-appengine/O4FHC_i7EGk
this.session = ObjectifyService.begin();
// Enable Joda Translators
JodaTimeTranslators.add(ObjectifyService.factory());
ObjectifyService.factory().register(CounterData.class);
ObjectifyService.factory().register(CounterShardData.class);
ObjectifyService.factory().register(CounterShardOperationData.class);
shardedCounterServiceImpl = new ShardedCounterServiceImpl();
this.shardedCounterService = shardedCounterServiceImpl;
}
示例8: getMemcacheConfig
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; //导入依赖的package包/类
public LocalMemcacheServiceTestConfig getMemcacheConfig() {
return memcacheConfig;
}