String fileSrcPath = ejtt.getTestDataDir() +"/war/"+ BASIC_WAR;
String destDir = ejtt.getTempDir() + "/appPagination";
new File(destDir).mkdirs();
if( ! new File(destDir).isDirectory() )
throw new EmbJoprTestException("Couldn't create directory: "+destDir);
// Deploy the same APP multiple times.
for (int i = 0; i < DEPLOYED_WARS_COUNT; i++) {
String fileDestPath = destDir+"/appPagination"+i+".war";
FileUtils.copyFile( new File(fileSrcPath), new File(fileDestPath) );
ejtt.deployment.deployViaEmbJoprRepeatedly( DeployableTypes.WAR, fileDestPath );
succesfullyDeployed = i+1;
}
// Navigate to apps summary tab
NavTreeNode appsNode = ejtt.navTree.getNodeByLabel(NAV_APPLICATIONS);
assertNotNull(appsNode);
appsNode.click();
ejtt.tabMenu.clickTab("Summary");
ejtt.sleep(1000);
// Get and check total items count.
int itemsCount = ejtt.tabMenu.getTabContentBox().getPagination().getTotalItemsCount();
// Returns null, skipping.
//Number serverCount = (Number) server.getManagedBeanValue("#{paginationDataModel.size}");
//assertEquals("Items count reported in page differs from server's.", serverCount, itemsCount);
// Check whether trinomial equation fits
int itemsPerPage = ejtt.tabMenu.getTabContentBox().getPagination().getItemsPerPage();
int expectedPages = itemsCount / itemsPerPage;
if( itemsCount % itemsPerPage > 0 )
expectedPages++;
int pageCount = ejtt.tabMenu.getTabContentBox().getPagination().getPageCount();
assertEquals("Expected number of pages: "+itemsCount+" / "+itemsPerPage, expectedPages, pageCount);
int page = 0;
while( ejtt.tabMenu.getTabContentBox().getPagination().goNext() ){
page++;
if( page > expectedPages )
throw new EmbJoprTestException("Got too far when clicking Next" +
" - to "+page+"th page, expected only "+expectedPages+".");
// Get rows.
ContentTable table = ejtt.tabMenu.getTabContentBox().getFirstTable();
List<ContentTableRow> rows = table.getRows();