Beispiel #1
0
  public void testIgnoreUnignoreFile() throws Exception {
    // JemmyProperties.setCurrentTimeout("ComponentOperator.WaitComponentTimeout", 30000);
    // JemmyProperties.setCurrentTimeout("DialogWaiter.WaitDialogTimeout", 30000);
    try {
      TestKit.showStatusLabels();
      TestKit.closeProject(PROJECT_NAME);

      OutputOperator oo = OutputOperator.invoke();

      stream = new PrintStream(new File(getWorkDir(), getName() + ".log"));
      TestKit.loadOpenProject(PROJECT_NAME, getDataDir());

      TestKit.createNewElement(PROJECT_NAME, "javaapp", "NewClass");
      Node node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|NewClass");
      node.performPopupAction("Mercurial|Ignore");
      OutputTabOperator oto = new OutputTabOperator("Mercurial");
      oto.waitText("INFO: End of Ignore");

      node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|NewClass");

      org.openide.nodes.Node nodeIDE = (org.openide.nodes.Node) node.getOpenideNode();
      String color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
      String status = TestKit.getStatus(nodeIDE.getHtmlDisplayName());
      assertEquals(
          "Wrong color of node - file color should be ignored!!!", TestKit.IGNORED_COLOR, color);
      assertEquals(
          "Wrong annotation of node - file status should be ignored!!!",
          TestKit.IGNORED_STATUS,
          status);

      node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|NewClass");
      TimeoutExpiredException tee = null;
      try {
        node.performPopupAction("Mercurial|Ignore");
      } catch (Exception e) {
        tee = (TimeoutExpiredException) e;
      }
      assertNotNull("Ignore action should be disabled!!!", tee);

      // unignore file
      oto = new OutputTabOperator("Mercurial");
      oto.clear();
      node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|NewClass");
      node.performPopupAction("Mercurial|Unignore");
      oto.waitText("INFO: End of Unignore");
      node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|NewClass");
      nodeIDE = (org.openide.nodes.Node) node.getOpenideNode();
      color = TestKit.getColor(nodeIDE.getHtmlDisplayName());
      status = TestKit.getStatus(nodeIDE.getHtmlDisplayName());
      assertEquals("Wrong color of node - file color should be new!!!", TestKit.NEW_COLOR, color);
      assertEquals(
          "Wrong annotation of node - file status should be new!!!", TestKit.NEW_STATUS, status);

      // verify content of Versioning view
      node = new Node(new SourcePackagesNode(PROJECT_NAME), "javaapp|NewClass");
      node.performPopupAction("Mercurial|Status");
      new EventTool().waitNoEvent(1000);
      VersioningOperator vo = VersioningOperator.invoke();
      TableModel model = vo.tabFiles().getModel();
      assertEquals("Versioning view should be empty", 1, model.getRowCount());
      assertEquals(
          "File should be listed in Versioning view",
          "NewClass.java",
          model.getValueAt(0, 0).toString());

      stream.flush();
      stream.close();

    } catch (Exception e) {
      throw new Exception("Test failed: " + e);
    } finally {
      TestKit.closeProject(PROJECT_NAME);
    }
  }
 public ComponentOperator open() {
   testNode.performPopupAction(ACTION);
   return new NbDialogOperator(TITLE);
 }