Exemplo n.º 1
0
  public void testSaveRemove()
      throws MalformedURLException, CoreException, InterruptedException, NoSuchMethodException,
          IllegalAccessException, IllegalArgumentException, InvocationTargetException {
    long ts = System.currentTimeMillis();

    // create query
    LogHandler h = new LogHandler("Finnished populate", LogHandler.Compare.STARTS_WITH);
    BugzillaQuery q = new BugzillaQuery(QueryTestUtil.getRepository());

    // get controler and wait until populated with default values
    QueryController c = q.getController();
    h.waitUntilDone();
    Collection<BugzillaQuery> qs = QueryTestUtil.getRepository().getQueries();
    int queriesCount = qs.size();

    QueryListener ql = new QueryListener();
    q.addPropertyChangeListener(ql);
    // save
    h = new LogHandler(" saved", LogHandler.Compare.ENDS_WITH);
    save(c, QUERY_NAME + ts);
    h.waitUntilDone();
    assertEquals(1, ql.saved);

    qs = QueryTestUtil.getRepository().getQueries();
    assertEquals(queriesCount + 1, qs.size());

    // remove
    remove(c);
    assertEquals(1, ql.removed);
    qs = QueryTestUtil.getRepository().getQueries();
    assertEquals(queriesCount, qs.size());
  }
Exemplo n.º 2
0
  public void testSaveBeforeSearch()
      throws MalformedURLException, CoreException, NoSuchMethodException, IllegalAccessException,
          IllegalArgumentException, InvocationTargetException, InterruptedException {
    long ts = System.currentTimeMillis();
    String summary = "somary" + ts;
    String id1 = TestUtil.createIssue(QueryTestUtil.getRepository(), summary);

    LogHandler h = new LogHandler("Finnished populate ", LogHandler.Compare.STARTS_WITH);

    // create query
    BugzillaQuery q = new BugzillaQuery(QueryTestUtil.getRepository());

    // get controler and wait until populated with default values
    QueryController c = q.getController();
    h.waitUntilDone();

    // populate with parameters - summary
    populate(c, summary);

    TestQueryNotifyListener nl = new TestQueryNotifyListener(q);
    nl.reset();
    QueryListener ql = new QueryListener();
    q.addPropertyChangeListener(ql);

    h = new LogHandler("refresh finish", LogHandler.Compare.STARTS_WITH); // we wan't to check
    // if the refresh is made after save
    save(c, QUERY_NAME + ts); // save button
    h.waitUntilDone();
    assertEquals(1, ql.saved);

    assertTrue(nl.started);
    assertTrue(nl.finished);
    List<BugzillaIssue> il = nl.getIssues(IssueCache.ISSUE_STATUS_ALL);
    assertEquals(1, il.size());
    BugzillaIssue i = il.get(0);
    assertEquals(summary, i.getSummary());
    assertEquals(id1, i.getID());
  }