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()); }
@RandomlyFails public void testSaveAterSearch() throws MalformedURLException, CoreException, NoSuchMethodException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InterruptedException { long ts = System.currentTimeMillis(); String summary = "somary" + ts; BugzillaRepository repository = QueryTestUtil.getRepository(); String id1 = TestUtil.createIssue(repository, summary); LogHandler h = new LogHandler("Finnished populate", LogHandler.Compare.STARTS_WITH); // create query BugzillaQuery q = new BugzillaQuery(repository); // get controler and wait until populated with default values QueryController c = q.getController(); ts = System.currentTimeMillis(); h.waitUntilDone(); // populate with parameters - summary populate(c, summary); TestQueryNotifyListener nl = new TestQueryNotifyListener(q); // search nl.reset(); h = new LogHandler("refresh finish", LogHandler.Compare.STARTS_WITH); search(c); // search button and wait until done ts = System.currentTimeMillis(); h.waitUntilDone(); 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()); // save nl.reset(); String name = QUERY_NAME + ts; h = new LogHandler(" saved", LogHandler.Compare.ENDS_WITH); save(c, name); // save button h.waitUntilDone(); assertTrue(q.isSaved()); // create a new repo instance and check if our query is between them repository = QueryTestUtil.getRepository(); Collection<BugzillaQuery> queries = repository.getQueries(); boolean bl = false; for (BugzillaQuery query : queries) { bl = query.getDisplayName().equals(name); if (bl) break; } assertTrue(bl); }
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()); }