本文整理汇总了Java中play.libs.F.Callback类的典型用法代码示例。如果您正苦于以下问题:Java Callback类的具体用法?Java Callback怎么用?Java Callback使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Callback类属于play.libs.F包,在下文中一共展示了Callback类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: PlayServerWebSocket
import play.libs.F.Callback; //导入依赖的package包/类
public PlayServerWebSocket(Request request, In<String> in, Out<String> out) {
this.request = request;
this.out = out;
// TODO https://github.com/vibe-project/vibe-java-platform/issues/4
// Supports text frame only for now
in.onMessage(new Callback<String>() {
@Override
public void invoke(String message) throws Throwable {
textActions.fire(message);
}
});
in.onClose(new Callback0() {
@Override
public void invoke() throws Throwable {
closeActions.fire();
}
});
}
示例2: testPerformLoginFail
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testPerformLoginFail() {
running(testServer(basePort, fakeApplication(inMemoryDatabase())), driver, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
performLoginActions(browser, configUsername, configPassword + "XXXX");
// check that the login failed message appears
assertThat(browser.pageSource()).contains(Domain.message("web.application.login.failed"));
// check that the application does not start
assertThat(browser.pageSource()).doesNotContain(Domain.message("web.application.notavailable"));
assertThat(browser.pageSource()).doesNotContain(Domain.message("web.application.layout.sidebar.dashboard"));
}
});
}
示例3: testIndexPage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testIndexPage() {
running(testServer(PORT, fakeApplication(inMemoryDatabase())), HTMLUNIT,
new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
IndexPage homePage = new IndexPage(browser.getDriver(), PORT);
// Check index page
browser.goTo(homePage);
homePage.isAt();
// check each other page, but before make sure to click on the index page again
browser.goTo(homePage);
homePage.gotoMakeOffer();
assertThat(homePage.title()).isEqualTo("Make an Offer");
browser.goTo(homePage);
homePage.gotoMakeRequest();
assertThat(homePage.title()).isEqualTo("Make a Request");
}
});
}
示例4: testBookCreatePage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testBookCreatePage() {
running(testServer(PORT, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
@Override
public void invoke(TestBrowser browser) {
// Create the pages.
BookCreatePage bookPage = new BookCreatePage(browser.getDriver(), PORT);
// Now test the page.
browser.goTo(bookPage);
bookPage.isAt();
String bookId = "Book-01";
bookPage.createNewBook(bookId);
// should redirect to book list
assertThat(bookPage.title()).isEqualTo("Student Book Exchange | Find Books");
assertThat(bookPage.pageSource()).contains(bookId);
}
});
}
示例5: testStudentCreatePage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testStudentCreatePage() {
running(testServer(PORT, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
@Override
public void invoke(TestBrowser browser) {
// Create the pages.
StudentCreatePage studentPage = new StudentCreatePage(browser.getDriver(), PORT);
// Now test the page.
browser.goTo(studentPage);
studentPage.isAt();
String studentId = "Student-01";
studentPage.createNewStudent(studentId);
// should redirect to student list
assertThat(studentPage.title()).isEqualTo("Student Book Exchange | Find Students");
assertThat(studentPage.pageSource()).contains(studentId);
}
});
}
示例6: testStudentCreatePage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testStudentCreatePage() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT,
new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
StudentCreatePage studentCreatePage = new StudentCreatePage(browser.getDriver(), 3333);
BookIndexPage bookIndexPage = new BookIndexPage(browser.getDriver(), 3333);
StudentEditPage studentEditPage = new StudentEditPage(browser.getDriver(), 3333, 1L);
browser.goTo(studentCreatePage);
studentCreatePage.isAt();
studentCreatePage.makeNewStudent("Student-01", "Papa", "Smurf", "[email protected]",
"abc");
bookIndexPage.isAt();
browser.goTo(studentEditPage);
studentEditPage.isAt();
assertThat(studentEditPage.pageSource().contains("Student-01"));
// Testing the edit page here as well so we don't need create create the above student
studentEditPage.editStudent("Student-02", "Papa", "Smurf", "[email protected]", "abc");
bookIndexPage.isAt();
browser.goTo(studentEditPage);
assertThat(studentEditPage.pageSource().contains("Student-02"));
}
});
}
示例7: testRequestCreatePage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testRequestCreatePage() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT,
new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
// Make sure a student is logged in (hack, but it's late)
StudentCreatePage studentCreatePage = new StudentCreatePage(browser.getDriver(), 3333);
browser.goTo(studentCreatePage);
studentCreatePage.isAt();
studentCreatePage.makeNewStudent("Student-01", "Papa", "Smurf", "[email protected]",
"abc");
RequestPage requestPage = new RequestPage(browser.getDriver(), 3333);
RequestCreatePage requestCreatePage = new RequestCreatePage(browser.getDriver(), 3333);
browser.goTo(requestCreatePage);
requestCreatePage.isAt();
requestCreatePage.makeNewRequest("Request-01", "Book-01", "Book", "Edition", "1234",
"20", "Good");
requestPage.isAt();
assertThat(requestPage.pageSource().contains("Book"));
}
});
}
示例8: testIndexPage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testIndexPage () {
Map<String, String> settings = new HashMap<String, String>();
settings.putAll(inMemoryDatabase());
settings.put("DemoData", "true");
running(testServer(3333, fakeApplication(settings)), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
IndexPage homePage = new IndexPage(browser.getDriver(), 3333);
browser.goTo(homePage);
homePage.isAt();
homePage.gotoNewWarehouse();
homePage.gotoHome();
}
});
}
示例9: testMyOffersPage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testMyOffersPage () {
Map<String, String> settings = new HashMap<String, String>();
settings.putAll(inMemoryDatabase());
settings.put("DemoData", "true");
running(testServer(3333, fakeApplication(settings)), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
MyOffersPage offersPage = new MyOffersPage(browser.getDriver(), 3333);
browser.goTo(offersPage);
offersPage.isAt();
offersPage.makeNewOffer("Java Concepts", "Used", "22.15");
assertThat(offersPage.pageSource()).contains("Offer Created.");
String noWhiteSpace = offersPage.pageSource().replaceAll("\\s","");
assertThat(noWhiteSpace.contains("<td>JavaConcepts</td><td>Used</td>"));
assertThat(noWhiteSpace.contains("value=22.15"));
offersPage.isAt();
}
});
}
示例10: testMyRequestsPage
import play.libs.F.Callback; //导入依赖的package包/类
@Test
public void testMyRequestsPage () {
Map<String, String> settings = new HashMap<String, String>();
settings.putAll(inMemoryDatabase());
settings.put("DemoData", "true");
running(testServer(3333, fakeApplication(settings)), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
MyRequestsPage requestsPage = new MyRequestsPage(browser.getDriver(), 3333);
browser.goTo(requestsPage);
requestsPage.isAt();
requestsPage.makeNewOffer("Java Concepts", "Used", "22.15");
assertThat(requestsPage.pageSource()).contains("Request Created.");
String noWhiteSpace = requestsPage.pageSource().replaceAll("\\s","");
assertThat(noWhiteSpace.contains("<td>JavaConcepts</td><td>Used</td>"));
assertThat(noWhiteSpace.contains("value=22.15"));
requestsPage.isAt();
}
});
}
示例11: test
import play.libs.F.Callback; //导入依赖的package包/类
/**
* add your integration test here
* in this example we just check if the welcome page is being shown
*/
@Test
public void test() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333");
assertTrue(browser.pageSource().contains("Your new application is ready."));
}
});
}
示例12: test
import play.libs.F.Callback; //导入依赖的package包/类
/**
* add your integration test here
* in this example we just check if the welcome page is being shown
*/
@Test
public void test() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333");
assertThat(browser.pageSource()).contains("Your new application is ready.");
}
});
}
示例13: test
import play.libs.F.Callback; //导入依赖的package包/类
/**
* add your integration test here
* in this example we just check if the welcome page is being shown
*/
@Test
public void test() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333");
assertThat(browser.pageSource()).contains("Your new application is ready.");
}
});
}
示例14: test
import play.libs.F.Callback; //导入依赖的package包/类
/**
* add your integration test here in this example we just check if the welcome page is being shown
*/
@Test
public void test() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333");
assertThat(browser.pageSource()).contains("Formation Play! Framework...");
}
});
}
示例15: test
import play.libs.F.Callback; //导入依赖的package包/类
/**
* add your integration test here in this example we just check if the welcome page is being shown
*/
@Test
public void test() {
running(testServer(3333, fakeApplication(inMemoryDatabase())), HTMLUNIT, new Callback<TestBrowser>() {
public void invoke(TestBrowser browser) {
browser.goTo("http://localhost:3333");
assertThat(browser.pageSource()).contains("Play ▶ Films");
}
});
}