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


Java FakeApplication类代码示例

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


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

示例1: provideFakeApplication

import play.test.FakeApplication; //导入依赖的package包/类
@Override
protected FakeApplication provideFakeApplication() {
    return fakeApplication(new GlobalSettings() {
        {
            service = mock(Service.class);
        }
        final Injector injector = Guice.createInjector(new PlayApplicationModule(), new AbstractModule() {
            @Override
            protected void configure() {
                bind(Service.class).toInstance(service);
            }
        });

        @Override
        public <A> A getControllerInstance(Class<A> controllerClass) throws Exception {
            return injector.getInstance(controllerClass);
        }
    });
}
 
开发者ID:julienrf,项目名称:pfe-samples,代码行数:20,代码来源:AuctionsTest.java

示例2: shopApplication

import play.test.FakeApplication; //导入依赖的package包/类
public static FakeApplication shopApplication() {
    return fakeApplication(inMemoryDatabase(), new GlobalSettings() {
        final Injector injector = Guice.createInjector(new PlayApplicationModule());

        @Override
        public <A> A getControllerInstance(Class<A> controllerClass) throws Exception {
            return injector.getInstance(controllerClass);
        }

        @Override
        public <T extends EssentialFilter> Class<T>[] filters() {
            return new Class[]{CSRFFilter.class};
        }

    });
}
 
开发者ID:julienrf,项目名称:pfe-samples,代码行数:17,代码来源:ShopApplication.java

示例3: esFakeApplication

import play.test.FakeApplication; //导入依赖的package包/类
public FakeApplication esFakeApplication() {

        Map<String, Object> additionalConfiguration = new HashMap<String, Object>();
        additionalConfiguration.put("elasticsearch.local", true);
        additionalConfiguration.put("elasticsearch.index.name", "index1,index2");
        additionalConfiguration.put("elasticsearch.index.clazzs", "indextype.*");
        additionalConfiguration.put("elasticsearch.index.show_request", true);
        additionalConfiguration.put("elasticsearch.index.dropOnShutdown", true);

        List<String> additionalPlugin = new ArrayList<String>();
        additionalPlugin.add("com.codetroopers.play.elasticsearch.plugin.IndexPlugin");

        return fakeApplication(additionalConfiguration, additionalPlugin);
    }
 
开发者ID:CedricGatay,项目名称:play2-elasticsearch-jest,代码行数:15,代码来源:ElasticsearchTestJava.java

示例4: running

import play.test.FakeApplication; //导入依赖的package包/类
/**
 * Allow multiple tasks to be run during the same application run.
 *
 * @param app   Application to use for tasks
 * @param tasks Runnable tasks to perform
 */
public static void running(FakeApplication app, final Runnable ... tasks) {
  play.test.Helpers.running(app, new Runnable() {
    @Override
    public void run() {
      for (final Runnable task : tasks) {
        task.run();
      }
    }
  });
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:17,代码来源:AorraTestUtils.java

示例5: fakeAorraApp

import play.test.FakeApplication; //导入依赖的package包/类
public static FakeApplication fakeAorraApp(boolean muteErrors) {
  final List<String> additionalPlugins = newArrayList(
      "test.FakeMailPlugin");
  final List<String> withoutPlugins = newArrayList(
      "com.typesafe.plugin.CommonsMailerPlugin");
  return new FakeApplication(
      new java.io.File("."), Helpers.class.getClassLoader(),
      additionalConfig(muteErrors),
      additionalPlugins,
      withoutPlugins,
      null);
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:13,代码来源:AorraTestUtils.java

示例6: provideFakeApplication

import play.test.FakeApplication; //导入依赖的package包/类
@Override
protected FakeApplication provideFakeApplication() {
    return fakeApplication(inMemoryDatabase());
}
 
开发者ID:julienrf,项目名称:pfe-samples,代码行数:5,代码来源:ShopTest.java

示例7: provideFakeApplication

import play.test.FakeApplication; //导入依赖的package包/类
@Override
protected FakeApplication provideFakeApplication() {
    return shopApplication();
}
 
开发者ID:julienrf,项目名称:pfe-samples,代码行数:5,代码来源:UITest.java

示例8: start

import play.test.FakeApplication; //导入依赖的package包/类
@Before
public void start() {
	FakeApplication app = fakeApplication(inMemoryDatabase());
	Helpers.start(app);
	controller = getInstance(SampleRestController.class);
}
 
开发者ID:hakandilek,项目名称:play2-crud,代码行数:7,代码来源:SampleRestControllerTest.java

示例9: provideFakeApplication

import play.test.FakeApplication; //导入依赖的package包/类
@Override
protected FakeApplication provideFakeApplication() {
       return Helpers.fakeApplication(inMemoryDatabase());
   }
 
开发者ID:ukwa,项目名称:w3act,代码行数:5,代码来源:ModelsTest.java

示例10: setupTest

import play.test.FakeApplication; //导入依赖的package包/类
/**
 * Setup the test
 */
@Before
public void setupTest() {
    FakeApplication app = fakeApplication();
    start(app);
    em = app.getWrappedApplication().plugin(JPAPlugin.class).get().em("default");
    JPA.bindForCurrentThread(em);


    emptyDatabase();


}
 
开发者ID:pliegl,项目名称:we2014,代码行数:16,代码来源:BaseTest.java


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