本文整理汇总了Java中play.test.Helpers.fakeApplication方法的典型用法代码示例。如果您正苦于以下问题:Java Helpers.fakeApplication方法的具体用法?Java Helpers.fakeApplication怎么用?Java Helpers.fakeApplication使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.test.Helpers
的用法示例。
在下文中一共展示了Helpers.fakeApplication方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
//createtableList();
Util.checkCassandraDbConnections(JsonKey.SUNBIRD_PLUGIN);
entityName = "announcement";
app = Helpers.fakeApplication();
Helpers.start(app);
headerMap = new HashMap<String, String[]>();
headerMap.put(HeaderParam.X_Consumer_ID.getName(), new String[]{"Service test consumer"});
headerMap.put(HeaderParam.X_Device_ID.getName(), new String[]{"Some Device Id"});
headerMap.put(HeaderParam.X_Authenticated_Userid.getName(), new String[]{"Authenticated user id"});
headerMap.put(JsonKey.MESSAGE_ID, new String[]{"Unique Message id"});
system = ActorSystem.create("system");
ActorRef subject = system.actorOf(props);
BaseController.setActorRef(subject);
}
示例2: setUp
import play.test.Helpers; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
// Unfortunately we need to restart for each test because there is some weird issue with question id sequence.
// Ebean allocates us duplicate PKs eventually unless server is recreated in between. This is either a bug with
// Ebean (batching) or an issue with our question entity JPA mappings.
app = Helpers.fakeApplication();
Helpers.start(app);
cleanDB();
Database db = getDB();
Evolutions.applyEvolutions(db);
cleanEvolvedTables(db);
db.shutdown();
addTestData();
onBeforeLogin();
Method testMethod = getClass().getDeclaredMethod(currentTest.getMethodName());
if (testMethod.isAnnotationPresent(RunAsStudent.class)) {
loginAsStudent();
} else if (testMethod.isAnnotationPresent(RunAsTeacher.class)) {
loginAsTeacher();
} else if (testMethod.isAnnotationPresent(RunAsAdmin.class)) {
loginAsAdmin();
}
}
示例3: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
app = Helpers.fakeApplication();
Helpers.start(app);
headerMap = new HashMap<String, String[]>();
headerMap.put(HeaderParam.X_Consumer_ID.getName(), new String[]{"Service test consumer"});
headerMap.put(HeaderParam.X_Device_ID.getName(), new String[]{"Some Device Id"});
headerMap.put(HeaderParam.X_Authenticated_Userid.getName(), new String[]{"Authenticated user id"});
headerMap.put(JsonKey.MESSAGE_ID, new String[]{"Unique Message id"});
}
示例4: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
app = Helpers.fakeApplication();
Helpers.start(app);
headerMap = new HashMap<String, String[]>();
headerMap.put(HeaderParam.X_Consumer_ID.getName(), new String[]{"Service test consumer"});
headerMap.put(HeaderParam.X_Device_ID.getName(), new String[]{"Some Device Id"});
headerMap.put(HeaderParam.X_Authenticated_Userid.getName(), new String[]{"Authenticated user id"});
headerMap.put(JsonKey.MESSAGE_ID, new String[]{"Unique Message id"});
system = ActorSystem.create("system");
ActorRef subject = system.actorOf(props);
BaseController.setActorRef(subject);
}
示例5: initializeRedisModule
import play.test.Helpers; //导入方法依赖的package包/类
/**
* Initialize Redis module.
*
* @since 17.06.26
*/
@Before
public void initializeRedisModule() {
if (this.playRedis == null) {
this.application = Helpers.
fakeApplication(new HashMap<String, Object>() {{
put(
"play.modules.disabled",
Collections.singletonList(
"com.zero_x_baadf00d.play.module.redis.PlayRedisModule"
)
);
put("redis.host", "127.0.0.1");
put("redis.port", 6379);
put("redis.password", "false-password");
}});
Assert.assertEquals(
"false-password",
this.application.config().getString("redis.password")
);
this.playRedis = new PlayRedisImpl(
mock(ApplicationLifecycle.class),
this.application.config()
);
Assert.assertNotEquals(null, this.playRedis);
}
}
示例6: start
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void start() {
app = Helpers.fakeApplication();
Helpers.start(app);
transactionTestService = TestUtils.instanceOf(app, TransactionTestService.class);
}
示例7: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
try {
app = Helpers.fakeApplication(inMemoryDatabase());
start(app);
} catch (Exception e) {
Logger.error("Unable to start app: {}", e.getMessage());
e.printStackTrace();
}
}
示例8: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
try {
app = Helpers.fakeApplication(inMemoryDatabase("IntegrationTest"));
start(app);
} catch (Exception e) {
Logger.error("Unable to start app: {}", e.getMessage());
e.printStackTrace();
}
}
示例9: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
try {
app = Helpers.fakeApplication(inMemoryDatabase("ControllerTest"));
start(app);
} catch (Exception e) {
Logger.error("Unable to start app: {}", e.getMessage());
e.printStackTrace();
}
}
示例10: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
try {
app = Helpers.fakeApplication();
} catch (Exception e) {
Logger.error("Unable to start app: {}", e.getMessage());
e.printStackTrace();
}
}
示例11: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
System.out.println("=========================================================");
System.out.println(" -------------------------");
System.out.println(" APPLICATION TEST");
System.out.println(" -------------------------");
app = Helpers.fakeApplication();
Helpers.start(app);
}
示例12: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
Config additionalConfig = ConfigFactory.parseFile(new File("conf/testes.conf"));
additionalConfigurations = new Configuration(additionalConfig);
System.out.println(additionalConfigurations.asMap());
app = Helpers.fakeApplication(additionalConfigurations.asMap());
Helpers.start(app);
}
示例13: startFakeApplication
import play.test.Helpers; //导入方法依赖的package包/类
/**
* Initialisiert eine {@link FakeApplication} mit InMemory-DB.
*/
@BeforeClass
public static void startFakeApplication() {
fakeApplication = Helpers.fakeApplication(Helpers.inMemoryDatabase());
Helpers.start(fakeApplication);
}
示例14: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@Before
public void startApp() throws Exception {
app = Helpers.fakeApplication(Helpers.inMemoryDatabase());
Helpers.start(app);
}
示例15: startApp
import play.test.Helpers; //导入方法依赖的package包/类
@BeforeClass
public static void startApp() {
app = Helpers.fakeApplication(Helpers.inMemoryDatabase());
Helpers.start(app);
}