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


Java LocalServiceTestConfig类代码示例

本文整理汇总了Java中com.google.appengine.tools.development.testing.LocalServiceTestConfig的典型用法代码示例。如果您正苦于以下问题:Java LocalServiceTestConfig类的具体用法?Java LocalServiceTestConfig怎么用?Java LocalServiceTestConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


LocalServiceTestConfig类属于com.google.appengine.tools.development.testing包,在下文中一共展示了LocalServiceTestConfig类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTestConfigs

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的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;
}
 
开发者ID:n15g,项目名称:spring-boot-gae,代码行数:17,代码来源:SetupAppengine.java

示例2: before

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的package包/类
@Override
protected void before() throws Throwable {
    List<LocalServiceTestConfig> testConfigs = createTestConfigs();
    helper = new LocalServiceTestHelper(testConfigs.toArray(new LocalServiceTestConfig[0]));
    helper.setTimeZone(TimeZone.getDefault());
    helper.setUp();
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:8,代码来源:SetupAppengine.java

示例3: createTestConfigs

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的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;
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:17,代码来源:SetupAppengine.java

示例4: hasService

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的package包/类
/**
 * Check if a service of the given type is registered.
 * @param type the service class.
 * @return {@code true} if an instance of the given service class was found, {@code false} otherwise
 */
public boolean hasService(final Class<? extends LocalServiceTestConfig> type)
{
	for(LocalServiceTestConfig service : services)
	{
		if(type.isInstance(service))
		{
			return true;
		}
	}
	return false;
}
 
开发者ID:bnavetta,项目名称:appsite2,代码行数:17,代码来源:ServiceManager.java

示例5: before

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的package包/类
@Override
protected void before() throws IOException {
  setupLogging();
  Set<LocalServiceTestConfig> configs = new HashSet<>();
  if (withUrlFetch) {
    configs.add(new LocalURLFetchServiceTestConfig());
  }
  if (withDatastore) {
    configs.add(new LocalDatastoreServiceTestConfig()
        // We need to set this to allow cross entity group transactions.
        .setApplyAllHighRepJobPolicy()
        // This causes unit tests to write a file containing any indexes the test required. We
        // can use that file below to make sure we have the right indexes in our prod code.
        .setNoIndexAutoGen(false));
    // This forces app engine to write the generated indexes to a usable location.
    System.setProperty("appengine.generated.dir", temporaryFolder.getRoot().getAbsolutePath());
  }
  if (withLocalModules) {
    configs.add(new LocalModulesServiceTestConfig()
        .addBasicScalingModuleVersion("default", "1", 1)
        .addBasicScalingModuleVersion("tools", "1", 1)
        .addBasicScalingModuleVersion("backend", "1", 1));
  }
  if (withTaskQueue) {
    File queueFile = temporaryFolder.newFile("queue.xml");
    Files.asCharSink(queueFile, UTF_8).write(taskQueueXml);
    configs.add(new LocalTaskQueueTestConfig()
        .setQueueXmlPath(queueFile.getAbsolutePath()));
  }
  if (withUserService) {
    configs.add(new LocalUserServiceTestConfig());
  }

  helper = new LocalServiceTestHelper(configs.toArray(new LocalServiceTestConfig[]{}));

  if (withUserService) {
    // Set top-level properties on LocalServiceTestConfig for user login.
    helper.setEnvIsLoggedIn(userInfo.isLoggedIn())
        // This envAttributes thing is the only way to set userId.
        // see https://code.google.com/p/googleappengine/issues/detail?id=3579
        .setEnvAttributes(ImmutableMap.<String, Object>of(
            "com.google.appengine.api.users.UserService.user_id_key", userInfo.gaeUserId()))
        .setEnvAuthDomain(userInfo.authDomain())
        .setEnvEmail(userInfo.email())
        .setEnvIsAdmin(userInfo.isAdmin());
  }

  if (clock != null) {
    helper.setClock(() -> clock.nowUtc().getMillis());
  }

  if (withLocalModules) {
    helper.setEnvInstance("0");
  }

  helper.setUp();

  if (withDatastore) {
    ObjectifyService.initOfy();
    // Reset id allocation in ObjectifyService so that ids are deterministic in tests.
    ObjectifyService.resetNextTestId();
    loadInitialData();
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:65,代码来源:AppEngineRule.java

示例6: TestEnvironment

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的package包/类
public TestEnvironment(LocalServiceTestConfig... configs) {
  this.helper = new LocalServiceTestHelper(configs);
}
 
开发者ID:google,项目名称:domaintest,代码行数:4,代码来源:TestEnvironment.java

示例7: addService

import com.google.appengine.tools.development.testing.LocalServiceTestConfig; //导入依赖的package包/类
/**
 * Add a new service to the set of services available to the test. Once the service test helper
 * has been created, new services cannot be added.
 * @param service the service configuration (cannot be {@code null})
 */
public void addService(final LocalServiceTestConfig service)
{
	checkState(helper == null, "The test helper has already been created");
	services.add(checkNotNull(service));
}
 
开发者ID:bnavetta,项目名称:appsite2,代码行数:11,代码来源:ServiceManager.java


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