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


Java Callback类代码示例

本文整理汇总了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();
        }
    });
}
 
开发者ID:vibe-project,项目名称:vibe-java-platform,代码行数:19,代码来源:PlayServerWebSocket.java

示例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"));
        }
    });
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:17,代码来源:IntegrationTest.java

示例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");

        }
      });
}
 
开发者ID:camliu89,项目名称:ICSTextBookApplication,代码行数:24,代码来源:ViewTest.java

示例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);
    }
  });
}
 
开发者ID:ttaomae,项目名称:book-exchange,代码行数:20,代码来源:ViewTest.java

示例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);
    }
  });
}
 
开发者ID:ttaomae,项目名称:book-exchange,代码行数:20,代码来源:ViewTest.java

示例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"));
        }
      });
}
 
开发者ID:anthonyjchriste,项目名称:makeke,代码行数:27,代码来源:ViewTest.java

示例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"));
        }
      });
}
 
开发者ID:anthonyjchriste,项目名称:makeke,代码行数:24,代码来源:ViewTest.java

示例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();
    }
  });
}
 
开发者ID:rward,项目名称:BookSkateMate,代码行数:21,代码来源:ViewTest.java

示例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();
             
    }
  });
}
 
开发者ID:rward,项目名称:BookSkateMate,代码行数:21,代码来源:ViewTest.java

示例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();
      
     
    
   
     
    }
  });
}
 
开发者ID:rward,项目名称:BookSkateMate,代码行数:26,代码来源:ViewTest.java

示例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."));
        }
    });
}
 
开发者ID:Telecooperation,项目名称:assistance-platform-server,代码行数:14,代码来源:IntegrationTest.java

示例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.");
        }
    });
}
 
开发者ID:Semantive,项目名称:cassandra-trainings-ho,代码行数:14,代码来源:IntegrationTest.java

示例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.");
        }
    });
}
 
开发者ID:carlpratt,项目名称:cs638-twilio,代码行数:14,代码来源:IntegrationTest.java

示例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...");
        }
    });
}
 
开发者ID:fmaturel,项目名称:PlayTraining,代码行数:13,代码来源:IntegrationTest.java

示例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");
        }
    });
}
 
开发者ID:fmaturel,项目名称:PlayTraining,代码行数:13,代码来源:IntegrationTest.java


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