Search in sources :

Example 1 with CrossRefData

use of cbit.vcell.numericstest.TestCriteriaCrossRefOPResults.CrossRefData in project vcell by virtualcell.

the class TestingFrameworkWindowManager method updateReports.

private void updateReports(final Hashtable<TestSuiteInfoNew, Vector<TestCriteriaCrossRefOPResults.CrossRefData>> genReportHash) {
    new Thread(new Runnable() {

        public void run() {
            Set<java.util.Map.Entry<TestSuiteInfoNew, Vector<TestCriteriaCrossRefOPResults.CrossRefData>>> tsInfoEntry = genReportHash.entrySet();
            Iterator<java.util.Map.Entry<TestSuiteInfoNew, Vector<TestCriteriaCrossRefOPResults.CrossRefData>>> tsInfoIter = tsInfoEntry.iterator();
            while (tsInfoIter.hasNext()) {
                try {
                    Entry<TestSuiteInfoNew, Vector<TestCriteriaCrossRefOPResults.CrossRefData>> entry = tsInfoIter.next();
                    TestSuiteInfoNew tsInfo = entry.getKey();
                    Vector<TestCriteriaCrossRefOPResults.CrossRefData> xrefDataV = entry.getValue();
                    // 
                    Vector<AsynchClientTask> tasksVLocal = new java.util.Vector<AsynchClientTask>();
                    tasksVLocal.add(new TFUpdateRunningStatus(TestingFrameworkWindowManager.this, tsInfo));
                    TestSuiteNew tsNew = getTestingFrameworkWindowPanel().getDocumentManager().getTestSuite(tsInfo.getTSKey());
                    for (int i = 0; i < xrefDataV.size(); i++) {
                        CrossRefData crossRefData = xrefDataV.elementAt(i);
                        boolean bDone = false;
                        for (int j = 0; j < tsNew.getTestCases().length; j++) {
                            TestCaseNew testCaseNew = tsNew.getTestCases()[j];
                            if (testCaseNew.getTCKey().equals(crossRefData.tcaseKey)) {
                                for (int k = 0; k < testCaseNew.getTestCriterias().length; k++) {
                                    TestCriteriaNew testCriteria = testCaseNew.getTestCriterias()[k];
                                    if (testCriteria.getTCritKey().equals(crossRefData.tcritKey)) {
                                        tasksVLocal.add(new TFGenerateReport(TestingFrameworkWindowManager.this, testCaseNew, testCriteria, null));
                                        bDone = true;
                                        break;
                                    }
                                }
                            }
                            if (bDone) {
                                break;
                            }
                        }
                    }
                    final String END_NOTIFIER = "END NOTIFIER";
                    tasksVLocal.add(new AsynchClientTask(END_NOTIFIER, AsynchClientTask.TASKTYPE_NONSWING_BLOCKING, false, false) {

                        public void run(Hashtable<String, Object> hashTable) throws Exception {
                            hashTable.put(END_NOTIFIER, END_NOTIFIER);
                        }
                    });
                    tasksVLocal.add(new TFRefresh(TestingFrameworkWindowManager.this, tsInfo));
                    AsynchClientTask[] tasksArr = new AsynchClientTask[tasksVLocal.size()];
                    tasksVLocal.copyInto(tasksArr);
                    java.util.Hashtable<String, Object> hashLocal = new java.util.Hashtable<String, Object>();
                    ClientTaskDispatcher.dispatch(getTestingFrameworkWindowPanel(), hashLocal, tasksArr, true);
                    // Wait for each report to complete before going on to next because report methods are not thread safe?
                    while (!hashLocal.contains(END_NOTIFIER)) {
                        Thread.sleep(100);
                    }
                } catch (Exception e) {
                    PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Error updating reports\n" + e.getMessage());
                    return;
                }
            }
        }
    }).start();
}
Also used : AsynchClientTask(cbit.vcell.client.task.AsynchClientTask) TFGenerateReport(cbit.vcell.client.task.TFGenerateReport) Entry(java.util.Map.Entry) Vector(java.util.Vector) TestSuiteNew(cbit.vcell.numericstest.TestSuiteNew) Hashtable(java.util.Hashtable) TestCriteriaCrossRefOPResults(cbit.vcell.numericstest.TestCriteriaCrossRefOPResults) TestCaseNew(cbit.vcell.numericstest.TestCaseNew) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException) UserCancelException(org.vcell.util.UserCancelException) TFUpdateRunningStatus(cbit.vcell.client.task.TFUpdateRunningStatus) CrossRefData(cbit.vcell.numericstest.TestCriteriaCrossRefOPResults.CrossRefData) TFRefresh(cbit.vcell.client.task.TFRefresh) TestCriteriaNew(cbit.vcell.numericstest.TestCriteriaNew) TestSuiteInfoNew(cbit.vcell.numericstest.TestSuiteInfoNew)

Aggregations

AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)1 TFGenerateReport (cbit.vcell.client.task.TFGenerateReport)1 TFRefresh (cbit.vcell.client.task.TFRefresh)1 TFUpdateRunningStatus (cbit.vcell.client.task.TFUpdateRunningStatus)1 TestCaseNew (cbit.vcell.numericstest.TestCaseNew)1 TestCriteriaCrossRefOPResults (cbit.vcell.numericstest.TestCriteriaCrossRefOPResults)1 CrossRefData (cbit.vcell.numericstest.TestCriteriaCrossRefOPResults.CrossRefData)1 TestCriteriaNew (cbit.vcell.numericstest.TestCriteriaNew)1 TestSuiteInfoNew (cbit.vcell.numericstest.TestSuiteInfoNew)1 TestSuiteNew (cbit.vcell.numericstest.TestSuiteNew)1 Hashtable (java.util.Hashtable)1 Entry (java.util.Map.Entry)1 Vector (java.util.Vector)1 DataAccessException (org.vcell.util.DataAccessException)1 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)1 UserCancelException (org.vcell.util.UserCancelException)1