@Test
 // (Test Cases for 1.8) test case 1
 public void testCachingPagePresent() throws Exception {
   Utility.createProject(Messages.projCache);
   SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1);
   assertTrue(
       "testCachingPagePresent",
       wabot.checkBox().isEnabled()
           && !wabot.checkBox().isChecked()
           && wabot.button("OK").isEnabled()
           && wabot.button("Cancel").isEnabled());
   propShell.close();
 }
 @Test
 // (Test Cases for 1.8) test case 3
 public void testDisableCaching() throws Exception {
   Utility.createProject(Messages.projCache);
   SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1);
   // check
   wabot.checkBox().select();
   /*
    * To avoid missing storage account error,
    * type some value. Requires typeText only.
    */
   wabot.textWithLabel(Messages.keyLbl).typeText("a");
   wabot.textWithLabel(Messages.nameLbl).typeText("a");
   Utility.selEndPtPage();
   Boolean endPtPresent =
       wabot
               .table()
               .cell(1, 0)
               .equals(String.format("%s%s", Messages.cachEndPtName, Messages.dfltCachName))
           && wabot.table().cell(1, 1).equals(Messages.typeIntrnl)
           && wabot.table().cell(1, 3).equals("11211");
   Utility.selLclStrPage(Messages.role1);
   Boolean LclStrPresent =
       wabot.table().cell(0, 0).equals(Messages.cachLclStr)
           && wabot.table().cell(0, 1).equals("20000");
   Utility.selCachePage(Messages.role1);
   // un-check
   wabot.checkBox().click();
   Boolean isDisabled =
       !wabot.checkBox().isChecked()
           && !wabot.label(Messages.cachScaleLbl).isEnabled()
           && !wabot.label(Messages.hostLbl).isEnabled()
           && !wabot.button(Messages.roleAddBtn).isEnabled()
           && !wabot.button(Messages.roleEditBtn).isEnabled()
           && !wabot.label(Messages.keyLbl).isEnabled()
           && !wabot.label(Messages.nameLbl).isEnabled()
           && !wabot.table().isEnabled()
           && !wabot.textWithLabel(Messages.cachScaleLbl).isEnabled()
           && !wabot.scale().isEnabled();
   // Once caching disabled, no storage account warning
   Utility.selEndPtPage();
   Boolean endPtRmv =
       !wabot
           .table()
           .containsItem(String.format("%s%s", Messages.cachEndPtName, Messages.dfltCachName));
   propShell = Utility.selLclStrPage(Messages.role1);
   Boolean lclStrRmv = !wabot.table().containsItem(Messages.cachLclStr);
   assertTrue(
       "testDisableCaching", endPtPresent && LclStrPresent && isDisabled && endPtRmv && lclStrRmv);
   propShell.close();
 }
 @Test
 // (Test Cases for 1.8) test case 6
 public void testNtNumericCacheSizeOKPressed() throws Exception {
   Utility.createProject(Messages.projCache);
   SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1);
   wabot.checkBox().select();
   // Cache size = alphabet
   // typeText and setting focus on OK is IMP.
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("ab");
   wabot.button("OK").setFocus();
   wabot.button("OK").click();
   SWTBotShell errorShell = wabot.shell(Messages.cachPerErrTtl).activate();
   Boolean alphabtErr = errorShell.getText().equals(Messages.cachPerErrTtl);
   wabot.button("OK").click();
   // Cache size = special character
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("#*");
   wabot.button("OK").setFocus();
   wabot.button("OK").click();
   errorShell = wabot.shell(Messages.cachPerErrTtl).activate();
   Boolean splCharErr = errorShell.getText().equals(Messages.cachPerErrTtl);
   wabot.button("OK").click();
   assertTrue("testNtNumericCacheSizeOKPressed", alphabtErr && splCharErr);
   propShell.close();
 }
 @Test
 // (Test Cases for 1.8) test case 4
 public void testInvalidCacheSizeOKPressed() throws Exception {
   Utility.createProject(Messages.projCache);
   SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1);
   wabot.checkBox().select();
   // Cache size = 0
   // typeText and setting focus on OK is IMP.
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("0");
   wabot.button("OK").setFocus();
   wabot.button("OK").click();
   SWTBotShell errorShell = wabot.shell(Messages.cachPerErrTtl).activate();
   Boolean zeroErr = errorShell.getText().equals(Messages.cachPerErrTtl);
   wabot.button("OK").click();
   // Cache size < 0 i.e. Negative
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("-2");
   wabot.button("OK").setFocus();
   wabot.button("OK").click();
   errorShell = wabot.shell(Messages.cachPerErrTtl).activate();
   Boolean negErr = errorShell.getText().equals(Messages.cachPerErrTtl);
   wabot.button("OK").click();
   // Cache size > 100
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("105%");
   wabot.button("OK").setFocus();
   wabot.button("OK").click();
   errorShell = wabot.shell(Messages.cachPerErrTtl).activate();
   Boolean grtErr = errorShell.getText().equals(Messages.cachPerErrTtl);
   wabot.button("OK").click();
   assertTrue("testInvalidCacheSizeOKPressed", zeroErr && negErr && grtErr);
   propShell.close();
 }
  /** Import a gzip trace */
  @Test
  public void testGzipImport() {
    final String traceType = "Test trace : TMF Tests";
    final String tracesNode = "Traces [1]";

    /*
     * Actual importing
     */
    openImportWizard();
    selectImportFromArchive(fGzipTrace.getAbsolutePath());
    selectFolder(ROOT_FOLDER);
    SWTBotCheckBox checkBox = fBot.checkBox(Messages.ImportTraceWizard_CreateLinksInWorkspace);
    assertFalse(checkBox.isEnabled());
    SWTBotCombo comboBox = fBot.comboBoxWithLabel(Messages.ImportTraceWizard_TraceType);
    comboBox.setSelection(traceType);
    importFinish();
    /*
     * Remove .gz extension
     */
    assertNotNull(fGzipTrace);
    String name = fGzipTrace.getName();
    assertNotNull(name);
    assertTrue(name.length() > 3);
    String traceName = name.substring(0, name.length() - 3);
    assertNotNull(traceName);
    assertFalse(traceName.isEmpty());

    /*
     * Open trace
     */
    SWTBotView projectExplorer = fBot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
    projectExplorer.setFocus();
    final SWTBotTree tree = projectExplorer.bot().tree();
    /*
     * This appears to be problematic due to the length of the file name and
     * the resolution in our CI.
     */
    tree.expandNode(PROJECT_NAME, true);
    SWTBotTreeItem treeItem = tree.getTreeItem(PROJECT_NAME);
    fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(tracesNode, treeItem));
    treeItem = treeItem.getNode(tracesNode);
    fBot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(traceName, treeItem));
    treeItem = treeItem.getNode(traceName);
    treeItem.doubleClick();
    SWTBotUtils.waitForJobs();
    /*
     * Check results
     */
    SWTBotTable editor = fBot.activeEditor().bot().table();
    String c22 = editor.cell(2, 2);
    String c10 = editor.cell(1, 0);
    assertEquals("Type-1", c22);
    assertEquals("", c10);
  }
 @Test
 // (Test Cases for 1.8) test case 5
 public void testInvalidCacheSizeOKToLeave() throws Exception {
   Utility.createProject(Messages.projCache);
   SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1);
   wabot.checkBox().select();
   /*
    * To avoid missing storage account error,
    * type some value. Requires typeText only.
    */
   wabot.textWithLabel(Messages.keyLbl).typeText("a");
   wabot.textWithLabel(Messages.nameLbl).typeText("a");
   // Cache size = 0
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("0");
   SWTBotTree properties = propShell.bot().tree();
   properties.getTreeItem(Messages.roleTreeRoot).getNode(Messages.endptPage).select();
   SWTBotShell errorShell =
       wabot.shell(String.format("%s%s", Messages.okToLeaveTtl, " ")).activate();
   Boolean zeroErr =
       errorShell.getText().equals(String.format("%s%s", Messages.okToLeaveTtl, " "));
   wabot.button("OK").click();
   // Cache size < 0 i.e. Negative
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("-2");
   properties = propShell.bot().tree();
   properties.getTreeItem(Messages.roleTreeRoot).getNode(Messages.endptPage).select();
   errorShell = wabot.shell(String.format("%s%s", Messages.okToLeaveTtl, " ")).activate();
   Boolean negErr = errorShell.getText().equals(String.format("%s%s", Messages.okToLeaveTtl, " "));
   wabot.button("OK").click();
   // Cache size > 100
   wabot.textWithLabel(Messages.cachScaleLbl).setText("");
   wabot.textWithLabel(Messages.cachScaleLbl).typeText("105%");
   properties = propShell.bot().tree();
   properties.getTreeItem(Messages.roleTreeRoot).getNode(Messages.endptPage).select();
   errorShell = wabot.shell(String.format("%s%s", Messages.okToLeaveTtl, " ")).activate();
   Boolean grtErr = errorShell.getText().equals(String.format("%s%s", Messages.okToLeaveTtl, " "));
   wabot.button("OK").click();
   assertTrue("testInvalidCacheSizeOKToLeave", zeroErr && negErr && grtErr);
   propShell.close();
 }
 @Test
 // (Test Cases for 1.8) test case 2
 public void testEnableCaching() throws Exception {
   Utility.createProject(Messages.projCache);
   SWTBotShell propShell = Utility.selCacheUsingCnxtMenu(Messages.projCache, Messages.role1);
   wabot.checkBox().select();
   Boolean isEnabled =
       wabot.checkBox().isChecked()
           && wabot.label(Messages.cachScaleLbl).isEnabled()
           && wabot.label(Messages.hostLbl).isEnabled()
           && wabot.button(Messages.roleAddBtn).isEnabled()
           && !wabot.button(Messages.roleEditBtn).isEnabled()
           && wabot.label(Messages.keyLbl).isEnabled()
           && wabot.label(Messages.nameLbl).isEnabled()
           && wabot.table().isEnabled();
   Boolean cacheSizeVal =
       wabot.textWithLabel(Messages.cachScaleLbl).getText().equals(Messages.dfltSizeVal)
           && (wabot.scale().getValue() == 30);
   Boolean dfltCacheVal =
       wabot.table().containsItem(Messages.dfltCachName)
           && wabot.table().cell(0, 1).equals(Messages.cachBckNo)
           && wabot.table().cell(0, 2).equals(Messages.expPolAbs)
           && wabot.table().cell(0, 3).equals("10")
           && wabot.table().cell(0, 4).equals("11211");
   Boolean hostNmVal =
       wabot
           .textWithLabel(Messages.hostLbl)
           .getText()
           .equals(String.format("%s%s", Messages.hostNm, Messages.role1.toLowerCase()));
   Boolean StorageVal =
       wabot.textWithLabel(Messages.keyLbl).getText().equals("")
           && wabot.textWithLabel(Messages.nameLbl).getText().equals("");
   /*
    * To avoid missing storage account error,
    * set some value
    */
   wabot.textWithLabel(Messages.keyLbl).setText("a");
   wabot.textWithLabel(Messages.nameLbl).setText("a");
   Utility.selEndPtPage();
   Boolean endPtPresent =
       wabot
               .table()
               .cell(1, 0)
               .equals(String.format("%s%s", Messages.cachEndPtName, Messages.dfltCachName))
           && wabot.table().cell(1, 1).equals(Messages.typeIntrnl)
           && wabot.table().cell(1, 3).equals("11211");
   propShell = Utility.selLclStrPage(Messages.role1);
   Boolean LclStrPresent =
       wabot.table().cell(0, 0).equals(Messages.cachLclStr)
           && wabot.table().cell(0, 1).equals("20000");
   assertTrue(
       "testEnableCaching",
       isEnabled
           && cacheSizeVal
           && dfltCacheVal
           && hostNmVal
           && StorageVal
           && endPtPresent
           && LclStrPresent);
   propShell.close();
 }