use of cbit.vcell.numericstest.TestCriteriaNew in project vcell by virtualcell.
the class TestingFrameworkWindowManager method getNewTestCriteriaFromUser.
/**
* Insert the method's description here.
* Creation date: (4/9/2003 1:31:08 PM)
* @return cbit.vcell.numericstestingframework.TestSuiteInfo
*/
public TestCriteriaNew getNewTestCriteriaFromUser(String solutionType, TestCriteriaNew origTestCriteria) throws UserCancelException {
// Reset the text fields in the EditCriteriaPanel.
getEditTestCriteriaPanel().setExistingTestCriteria(origTestCriteria);
getEditTestCriteriaPanel().setSolutionType(solutionType);
getEditTestCriteriaPanel().resetTextFields();
while (true) {
// display the editCriteriaPanel.
Object choice = showEditTestCriteriaDialog(getEditTestCriteriaPanel(), getComponent());
if (choice != null && choice.equals("OK")) {
TestCriteriaNew tcritNew = getEditTestCriteriaPanel().getNewTestCriteria();
if (tcritNew instanceof TestCriteriaNewMathModel) {
TestCriteriaNewMathModel tcritNewMM = (TestCriteriaNewMathModel) tcritNew;
if ((tcritNewMM.getRegressionMathModelInfo() == null && tcritNewMM.getRegressionSimInfo() != null) || (tcritNewMM.getRegressionMathModelInfo() != null && tcritNewMM.getRegressionSimInfo() == null)) {
PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Must specify both Reference MathModel and Simulation");
continue;
}
} else if (tcritNew instanceof TestCriteriaNewBioModel) {
TestCriteriaNewBioModel tcritNewBM = (TestCriteriaNewBioModel) tcritNew;
if ((tcritNewBM.getRegressionBioModelInfo() == null && tcritNewBM.getRegressionSimInfo() != null) || (tcritNewBM.getRegressionBioModelInfo() != null && tcritNewBM.getRegressionSimInfo() == null)) {
PopupGenerator.showErrorDialog(TestingFrameworkWindowManager.this, "Must specify both Reference BioModel App and Simulation");
continue;
}
} else {
}
return tcritNew;
}
throw UserCancelException.CANCEL_GENERIC;
}
}
use of cbit.vcell.numericstest.TestCriteriaNew in project vcell by virtualcell.
the class TestingFrameworkWindowManager method duplicateTestSuite.
/**
* Insert the method's description here.
* Creation date: (4/10/2003 11:27:32 AM)
* @param testCase cbit.vcell.numericstestingframework.TestCase
*/
public String duplicateTestSuite(final TestSuiteInfoNew testSuiteInfo_Original, final TestSuiteInfoNew newTestSuiteInfo, int regrRefFlag, ClientTaskStatusSupport pp) throws DataAccessException {
if (testSuiteInfo_Original == null || newTestSuiteInfo == null) {
throw new IllegalArgumentException(this.getClass().getName() + "duplicateTestSuite_Private: TestSuite cannot be null");
}
checkNewTestSuiteInfo(newTestSuiteInfo);
TestSuiteNew testSuite_Original = getRequestManager().getDocumentManager().getTestSuite(testSuiteInfo_Original.getTSKey());
if (testSuite_Original == null) {
throw new DataAccessException("Couldn't get TestSuite for tsInfo " + testSuiteInfo_Original.getTSID());
}
AddTestSuiteOP testSuiteOP = new AddTestSuiteOP(newTestSuiteInfo.getTSID(), newTestSuiteInfo.getTSVCellBuild(), newTestSuiteInfo.getTSNumericsBuild(), null, newTestSuiteInfo.getTSAnnotation());
getRequestManager().getDocumentManager().doTestSuiteOP(testSuiteOP);
TestSuiteInfoNew[] tsinArr = getRequestManager().getDocumentManager().getTestSuiteInfos();
TestSuiteInfoNew tsin = null;
for (int i = 0; i < tsinArr.length; i += 1) {
if (tsinArr[i].getTSID().equals(newTestSuiteInfo.getTSID())) {
tsin = tsinArr[i];
break;
}
}
if (tsin == null) {
throw new DataAccessException("couldn't find new TestSuiteInfo " + newTestSuiteInfo.getTSID() + " in DB");
}
TestCaseNew[] originalTestCases = testSuite_Original.getTestCases();
TestCaseNew[] newTestCases = null;
if (originalTestCases != null && originalTestCases.length > 0) {
newTestCases = new TestCaseNew[originalTestCases.length];
for (int i = 0; i < originalTestCases.length; i += 1) {
if (originalTestCases[i] instanceof TestCaseNewMathModel) {
TestCaseNewMathModel tcnmm = (TestCaseNewMathModel) originalTestCases[i];
TestCriteriaNew[] tcritnmm = (TestCriteriaNew[]) tcnmm.getTestCriterias();
TestCriteriaNewMathModel[] newTCrits = null;
if (tcritnmm != null && tcritnmm.length > 0) {
// Copy regression and errors
newTCrits = new TestCriteriaNewMathModel[tcritnmm.length];
for (int j = 0; j < tcritnmm.length; j += 1) {
newTCrits[j] = new TestCriteriaNewMathModel(null, tcritnmm[j].getSimInfo(), ((TestCriteriaNewMathModel) tcritnmm[j]).getRegressionMathModelInfo(), tcritnmm[j].getRegressionSimInfo(), tcritnmm[j].getMaxRelError(), tcritnmm[j].getMaxAbsError(), null, // new will have no data
TestCriteriaNew.TCRIT_STATUS_NODATA, // new will have no data
null);
}
}
// copy mathmodel,type and annotation and copied tcrits
newTestCases[i] = new TestCaseNewMathModel(null, tcnmm.getMathModelInfo(), tcnmm.getType(), tcnmm.getAnnotation(), newTCrits);
} else if (originalTestCases[i] instanceof TestCaseNewBioModel) {
TestCaseNewBioModel tcnbm = (TestCaseNewBioModel) originalTestCases[i];
TestCriteriaNew[] tcritnbm = (TestCriteriaNew[]) tcnbm.getTestCriterias();
TestCriteriaNewBioModel[] newTCrits = null;
if (tcritnbm != null && tcritnbm.length > 0) {
// Copy regression and errors
newTCrits = new TestCriteriaNewBioModel[tcritnbm.length];
for (int j = 0; j < tcritnbm.length; j += 1) {
newTCrits[j] = new TestCriteriaNewBioModel(null, tcritnbm[j].getSimInfo(), ((TestCriteriaNewBioModel) tcritnbm[j]).getRegressionBioModelInfo(), ((TestCriteriaNewBioModel) tcritnbm[j]).getRegressionApplicationName(), tcritnbm[j].getRegressionSimInfo(), tcritnbm[j].getMaxRelError(), tcritnbm[j].getMaxAbsError(), null, // new will have no data
TestCriteriaNew.TCRIT_STATUS_NODATA, // new will have no data
null);
}
}
// copy mathmodel,type and annotation and copied tcrits
newTestCases[i] = new TestCaseNewBioModel(null, tcnbm.getBioModelInfo(), tcnbm.getSimContextName(), tcnbm.getSimContextKey(), tcnbm.getType(), tcnbm.getAnnotation(), newTCrits);
} else {
throw new RuntimeException("Unsupported TestCase type " + originalTestCases[i].getClass().getName());
}
}
}
// Add the new TestCases
if (newTestCases != null && newTestCases.length > 0) {
return addTestCases(tsin, newTestCases, regrRefFlag, pp);
} else {
return null;
}
}
use of cbit.vcell.numericstest.TestCriteriaNew in project vcell by virtualcell.
the class TestingFrameworkWindowManager method startTestSuiteSimulations.
/**
* Insert the method's description here.
* Creation date: (1/20/2003 11:52:18 AM)
* @return boolean
* @param mathDesc cbit.vcell.math.MathDescription
*/
public String startTestSuiteSimulations(TestSuiteInfoNew testSuiteInfo, ClientTaskStatusSupport pp) {
StringBuffer errors = new StringBuffer();
try {
pp.setProgress(1);
pp.setMessage("Getting TestSuite " + testSuiteInfo.getTSID());
TestSuiteNew testSuite = getRequestManager().getDocumentManager().getTestSuite(testSuiteInfo.getTSKey());
Vector<TestCriteriaNew> tcritVector = new Vector<TestCriteriaNew>();
TestCaseNew[] testCases = testSuite.getTestCases();
if (testCases != null) {
for (int i = 0; i < testCases.length; i++) {
TestCriteriaNew[] tCriteria = testCases[i].getTestCriterias();
if (tCriteria != null) {
for (int j = 0; j < tCriteria.length; j++) {
tcritVector.add(tCriteria[j]);
}
}
}
if (tcritVector.size() > 0) {
TestCriteriaNew[] tcritArray = (TestCriteriaNew[]) BeanUtils.getArray(tcritVector, TestCriteriaNew.class);
String errorString = startSimulations(tcritArray, pp);
if (errorString != null) {
errors.append(errorString + "\n");
}
}
}
} catch (Throwable e) {
errors.append(e.getClass().getName() + " " + e.getMessage());
}
if (errors.length() > 0) {
errors.insert(0, "Error starting TestSuite simulations\n");
return errors.toString();
}
return null;
}
use of cbit.vcell.numericstest.TestCriteriaNew in project vcell by virtualcell.
the class NumericsTestCellRenderer method getTreeCellRendererComponent.
/**
* Insert the method's description here.
* Creation date: (7/27/2000 6:41:57 PM)
* @return java.awt.Component
*/
public java.awt.Component getTreeCellRendererComponent(javax.swing.JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
JLabel component = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
//
try {
if (value instanceof BioModelNode) {
BioModelNode node = (BioModelNode) value;
if (node.getUserObject() instanceof TestSuiteInfoNew) {
TestSuiteInfoNew tsn = (TestSuiteInfoNew) node.getUserObject();
// component.setText(tsn.getTSID()+" "+tsn.getTSVCellBuild()+" "+tsn.getTSNumericsBuild());
} else if (node.getUserObject() instanceof TestCaseNew) {
TestCaseNew testCase = (TestCaseNew) node.getUserObject();
boolean hasUnknown = false;
boolean isSimRunning = false;
boolean isSimFailed = false;
boolean isSimNotRunFialOrDone = false;
boolean hasReportErrors = false;
// boolean hasResult = false;
boolean hasNoRefRegr = false;
boolean hasFailures = false;
// AT LEAST ONE SIMULATION HAS NO DATA ...
boolean hasNoData = false;
boolean needsReport = false;
// }
if (testCase.getTestCriterias() != null) {
for (int i = 0; i < testCase.getTestCriterias().length; i += 1) {
TestCriteriaNew tcrit = testCase.getTestCriterias()[i];
if (tcrit.getReportStatus() != null) {
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT)) {
needsReport = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_RPERROR)) {
hasReportErrors = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_NOREFREGR)) {
hasNoRefRegr = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_FAILEDVARS)) {
hasFailures = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_NODATA)) {
hasNoData = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_SIMRUNNING)) {
isSimRunning = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_SIMFAILED)) {
isSimFailed = true;
}
if (tcrit.getReportStatus().equals(cbit.vcell.numericstest.TestCriteriaNew.TCRIT_STATUS_SIMNOTRUNFAILDONE)) {
isSimNotRunFialOrDone = true;
}
}
}
}
// if(node.getRenderHint(cbit.vcell.client.desktop.testingframework.TestingFrmwkTreeModel.SIMULATIONS_NO_REPORT) instanceof Boolean){
// Boolean tc_NR = (Boolean)node.getRenderHint(cbit.vcell.client.desktop.testingframework.TestingFrmwkTreeModel.SIMULATIONS_NO_REPORT);
// if(tc_NR.booleanValue()){
// hasResult = false;
// }
// }
setComponentProperties(component, (TestCaseNew) node.getUserObject(), /*hasResult,*/
hasFailures, hasNoData, hasNoRefRegr, hasReportErrors, isSimRunning, isSimFailed, needsReport, isSimNotRunFialOrDone);
} else if (node.getUserObject() instanceof TestCriteriaNew) {
TestCriteriaNew testCriteria = (TestCriteriaNew) node.getUserObject();
String extraText = null;
if (!testCriteria.getReportStatus().equals(TestCriteriaNew.TCRIT_STATUS_PASSED)) {
extraText = testCriteria.getReportStatus() + " " + (testCriteria.getReportStatusMessage() != null ? " " + testCriteria.getReportStatusMessage().substring(0, Math.min(100, testCriteria.getReportStatusMessage().length())) : "");
}
component.setText("[" + testCriteria.getSimInfo().getVersion().getVersionKey() + "] " + testCriteria.getSimInfo().getVersion().getName() + (extraText != null ? " (" + extraText + ")" : ""));
component.setToolTipText(" Test Criteria info");
if (extraText != null) {
component.setForeground(java.awt.Color.magenta);
}
if (testCriteria.getReportStatus().equals(TestCriteriaNew.TCRIT_STATUS_FAILEDVARS)) {
component.setForeground(java.awt.Color.red);
}
// //TestCaseNew tcn = null;
// //javax.swing.tree.DefaultMutableTreeNode prevNode = (javax.swing.tree.DefaultMutableTreeNode)node.getParent();
// //if(prevNode != null && prevNode.getUserObject() instanceof cbit.vcell.numericstest.TestCaseNew){
// //tcn = (TestCaseNew)prevNode.getUserObject();
// //}
// boolean hasResult = false;
// TestCriteriaNew testCriteria = (TestCriteriaNew)node.getUserObject();
// if(testCriteria.getVarComparisonSummaries() != null && testCriteria.getVarComparisonSummaries().length != 0){
// hasResult = true;
// }
// //boolean hasNoRefRegr = false;
// //if(tcn != null){
// //if(tcn.getType().equals(cbit.vcell.numericstest.TestCaseNew.REGRESSION) &&
// //testCriteria.getRegressionSimInfo() == null){
// //hasNoRefRegr = true;
// //}
// //}
// if(!hasResult /*|| hasNoRefRegr*/){
// component.setForeground(java.awt.Color.magenta);
// }
// component.setText(testCriteria.getSimInfo().getVersion().getName()+
// (testCriteria.getReportStatus() != null &&
// testCriteria.getReportStatus().startsWith(TestCriteriaNew.TCRIT_STATUS_SIMRUNNING)?"(SimRunning)":"")+
// (testCriteria.getReportStatus() != null &&
// testCriteria.getReportStatus().startsWith(TestCriteriaNew.TCRIT_STATUS_SIMFAILED)?"(SimFailed)":"")
// /*+(hasNoRefRegr?" (No Ref Regr)":"")*/);
// component.setToolTipText(" Test Criteria info");
} else if (node.getRenderHint(cbit.vcell.client.desktop.testingframework.TestingFrmwkTreeModel.FAILED_VARIABLE_MAE_MRE) instanceof Boolean) {
Boolean fv_MAE_MRE = (Boolean) node.getRenderHint(cbit.vcell.client.desktop.testingframework.TestingFrmwkTreeModel.FAILED_VARIABLE_MAE_MRE);
if (fv_MAE_MRE.booleanValue()) {
component.setForeground(java.awt.Color.red);
} else {
component.setForeground(java.awt.Color.black);
}
}
}
} catch (Throwable e) {
e.printStackTrace(System.out);
}
//
return component;
}
use of cbit.vcell.numericstest.TestCriteriaNew in project vcell by virtualcell.
the class TestingFrameworkPanel method actionsOnMouseClick.
/**
* Comment
*/
private void actionsOnMouseClick(MouseEvent mouseEvent) {
if (mouseEvent.isPopupTrigger()) {
if (getJTree1().getSelectionCount() <= 1) {
getJTree1().setSelectionPath(getJTree1().getPathForLocation(mouseEvent.getPoint().x, mouseEvent.getPoint().y));
}
if (!checkAllSameType()) {
JPopupMenu jPopupMenu = new JPopupMenu();
jPopupMenu.add(selectIncompatibleWarning);
jPopupMenu.show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
return;
}
if (isLoadTestPopup()) {
getLoadTestMenu().show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
} else if (getTreeSelection() instanceof String) {
if (((String) getTreeSelection()).equals(TestingFrmwkTreeModel.TEST_SUITE_SUBTREE_NAME)) {
getMainPopupMenu().show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
}
} else if (getTreeSelection() instanceof TestingFrmwkTreeModel.TestCriteriaVarUserObj) {
getTCritVarPopupMenu().show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
} else if (getTreeSelection() instanceof TestSuiteInfoNew) {
getRemoveDiffTestCriteriaJMenuItem().setEnabled(false);
if (getJTree1().getSelectionCount() == 2) {
TestSuiteInfoNew testSuiteInfoNew0 = (TestSuiteInfoNew) ((BioModelNode) getSelectedTreePaths()[0].getLastPathComponent()).getUserObject();
TestSuiteInfoNew testSuiteInfoNew1 = (TestSuiteInfoNew) ((BioModelNode) getSelectedTreePaths()[1].getLastPathComponent()).getUserObject();
if (testSuiteInfoNew0.getTSDate().compareTo(testSuiteInfoNew1.getTSDate()) < 0) {
getRemoveDiffTestCriteriaJMenuItem().setEnabled(!testSuiteInfoNew1.isLocked());
} else {
getRemoveDiffTestCriteriaJMenuItem().setEnabled(!testSuiteInfoNew0.isLocked());
}
}
boolean bMenuValid = getJTree1().getSelectionCount() == 1;
getRefreshTestSuiteJMenuItem().setEnabled(bMenuValid);
boolean isLocked = false;
if (getJTree1().getSelectionCount() == 1) {
isLocked = ((TestSuiteInfoNew) getTreeSelection()).isLocked();
}
// Disable if TestSuite locked
getDuplicateTSMenuItem().setEnabled(bMenuValid);
getRunAllMenuItem().setEnabled(bMenuValid && !isLocked);
getGenTSReportMenuItem().setEnabled(!checkAnyLocked());
getAddTestCaseMenuItem().setEnabled(bMenuValid && !isLocked);
getRemoveTSMenuItem().setEnabled(bMenuValid && !isLocked);
getEditAnnotationTestSuiteMenuItem().setEnabled(bMenuValid && !isLocked);
getLockTestSuiteMenuItem().setEnabled(bMenuValid && !isLocked);
getRemoveCompiledSolversJMenuItem().setEnabled(bMenuValid && !isLocked);
// Set enable based on conditions if not locked
if (bMenuValid && !isLocked) {
if (((TreeNode) getJTree1().getSelectionPath().getLastPathComponent()).getChildCount() == 0) {
getDuplicateTSMenuItem().setEnabled(false);
getRunAllMenuItem().setEnabled(false);
getGenTSReportMenuItem().setEnabled(false);
} else {
getDuplicateTSMenuItem().setEnabled(true);
getRunAllMenuItem().setEnabled(true);
getGenTSReportMenuItem().setEnabled(true);
}
}
getTestSuitePopupMenu().show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
} else if (getTreeSelection() instanceof TestCaseNew) {
boolean bMenuValid = getJTree1().getSelectionCount() == 1;
getRefreshTestCaseJMenuItem().setEnabled(bMenuValid);
getLoadMenuItem().setEnabled(bMenuValid);
boolean isLocked = false;
if (getJTree1().getSelectionCount() == 1) {
isLocked = ((TestSuiteInfoNew) ((BioModelNode) ((TreeNode) getJTree1().getSelectionPath().getLastPathComponent()).getParent()).getUserObject()).isLocked();
}
getRemoveMenuItem().setEnabled(!checkAnyLocked());
getRunSimsMenuItem().setEnabled(bMenuValid && !isLocked);
getGenerateTCReportMenuItem().setEnabled(!checkAnyLocked());
getChangeTypeToSteadyMenuItem().setEnabled(bMenuValid && !isLocked);
getEditAnnotationTestCaseMenuItem().setEnabled(bMenuValid && !isLocked);
if (bMenuValid && !isLocked) {
TestCaseNew tcNew = (TestCaseNew) getTreeSelection();
if (tcNew.getType().equals(TestCaseNew.EXACT) || tcNew.getType().equals(TestCaseNew.EXACT_STEADY)) {
getChangeTypeToSteadyMenuItem().setEnabled(true);
} else {
getChangeTypeToSteadyMenuItem().setEnabled(false);
}
}
getTestCasePopupMenu().show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
} else if (getTreeSelection() instanceof TestCriteriaNew) {
boolean bMenuValid = getJTree1().getSelectionCount() == 1;
getRefreshTestCriteriaJMenuItem().setEnabled(bMenuValid);
getViewMenuItem().setEnabled(bMenuValid);
getCompareMenuItem().setEnabled(bMenuValid);
getCompareUserDefinedMenuItem().setEnabled(bMenuValid);
getQueryTCritCrossRefMenuItem1().setEnabled(bMenuValid);
getTestCriteriaCopySimKeyMenuItem().setEnabled(bMenuValid);
boolean isLocked = false;
if (getJTree1().getSelectionCount() == 1) {
isLocked = ((TestSuiteInfoNew) ((BioModelNode) ((TreeNode) getJTree1().getSelectionPath().getLastPathComponent()).getParent().getParent()).getUserObject()).isLocked();
}
getRunSimMenuItem().setEnabled(!checkAnyLocked());
getEditTCrMenuItem().setEnabled(bMenuValid && !isLocked);
getRemoveTestCritMenuItem().setEnabled(!checkAnyLocked());
getGenerateTCRitReportMenuItem1().setEnabled(!checkAnyLocked());
getGenerateTCRitReportUserDefinedReferenceMenuItem1().setEnabled(!checkAnyLocked());
if (bMenuValid && !isLocked) {
TestCriteriaNew testCriteria = (TestCriteriaNew) getTreeSelection();
if (testCriteria.getRegressionSimInfo() == null) {
getCompareMenuItem().setEnabled(false);
} else {
getCompareMenuItem().setEnabled(true);
}
}
getSimulationPopupMenu().show(mouseEvent.getComponent(), mouseEvent.getPoint().x, mouseEvent.getPoint().y);
}
} else {
getMainPopupMenu().setVisible(false);
getTestSuitePopupMenu().setVisible(false);
getTestCasePopupMenu().setVisible(false);
getTCritVarPopupMenu().setVisible(false);
getSimulationPopupMenu().setVisible(false);
}
}
Aggregations