use of cbit.vcell.numericstest.LoadTestInfoOP in project vcell by virtualcell.
the class TestingFrameworkWindowManager method getLoadTestInfoBetweenDates.
public LoadTestInfoOpResults getLoadTestInfoBetweenDates(Date beginDate, Date endDate) throws DataAccessException {
LoadTestInfoOP loadTestInfoOP = new LoadTestInfoOP(beginDate, endDate);
TestSuiteOPResults testSuiteOPResults = getRequestManager().getDocumentManager().doTestSuiteOP(loadTestInfoOP);
if (testSuiteOPResults instanceof LoadTestInfoOpResults) {
LoadTestInfoOpResults loadTestInfoOpResults = (LoadTestInfoOpResults) testSuiteOPResults;
return loadTestInfoOpResults;
}
throw new IllegalArgumentException("getLoadTestDetails Expecting LoadTestInfoOpResults");
}
use of cbit.vcell.numericstest.LoadTestInfoOP in project vcell by virtualcell.
the class TestingFrameworkWindowPanel method testingFrameworkPanel_actionPerformed.
/**
* Comment
*/
private void testingFrameworkPanel_actionPerformed(final ActionEvent e) {
if (tfRefreshTreeTask == null) {
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager());
}
Hashtable<String, Object> hash = new Hashtable<String, Object>();
Vector<AsynchClientTask> tasksV = new Vector<AsynchClientTask>();
try {
final TreePath[] selectedTreePaths = gettestingFrameworkPanel().getSelectedTreePaths();
if (selectedTreePaths != null && selectedTreePaths.length > 1) {
Object refObj = ((BioModelNode) selectedTreePaths[0].getLastPathComponent()).getUserObject();
for (int i = 1; i < selectedTreePaths.length; i++) {
Object currentObj = ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
if ((refObj == null && currentObj == null) || ((refObj != null && currentObj != null) && (refObj.getClass().equals(currentObj.getClass()))) || (refObj instanceof TestCaseNew && currentObj instanceof TestCaseNew)) {
continue;
} else {
throw new IllegalArgumentException("Multiple selections must all be of same type");
}
}
}
final Object selectedObj = gettestingFrameworkPanel().getTreeSelection();
if (e.getActionCommand().equals(TestingFrameworkPanel.DELETE_XML_LOAD_TEST)) {
int result = DialogUtils.showComponentOKCancelDialog(this, new JLabel("Delete " + selectedTreePaths.length + " Load Tests?"), "Confirm Load Test Delete");
if (result != JOptionPane.OK_OPTION) {
return;
}
AsynchClientTask deleteLoadTestTask = new AsynchClientTask("Deleting Load Test...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
LoadTestInfoOP deleteLoadTestInfoOP = new LoadTestInfoOP(LoadTestOpFlag.delete, null, null);
LoadTestSoftwareVersionTimeStamp[] deleteTheseversTimestamps = new LoadTestSoftwareVersionTimeStamp[selectedTreePaths.length];
for (int i = 0; i < selectedTreePaths.length; i++) {
deleteTheseversTimestamps[i] = ((LoadTestTreeInfo) ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject()).loadTestSoftwareVersionTimeStamp;
}
deleteLoadTestInfoOP.setDeleteInfo(deleteTheseversTimestamps);
getTestingFrameworkWindowManager().getRequestManager().getDocumentManager().doTestSuiteOP(deleteLoadTestInfoOP);
final ActionEvent refreshAction = new ActionEvent(this, 0, TestingFrameworkPanel.REFRESH_XML_LOAD_TEST);
new Thread(new Runnable() {
public void run() {
testingFrameworkPanel_actionPerformed(refreshAction);
}
}).start();
}
};
tasksV.add(deleteLoadTestTask);
} else if (e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_All) || e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_MODELS) || e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_USERS)) {
final Date[] beginDate = new Date[1];
final Date[] endDate = new Date[1];
final TreeSet<String> uniqueUserIDTreeSet = new TreeSet<String>();
final Vector<KeyValue> bioAndMathModelKeyValueV = new Vector<KeyValue>();
String typeMsg = "All";
if (!e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_All)) {
if (selectedTreePaths != null && selectedTreePaths.length > 0) {
Object refObj = ((BioModelNode) selectedTreePaths[0].getLastPathComponent()).getUserObject();
if (refObj instanceof TestingFrmwkTreeModel.LoadTestTreeInfo) {
for (int i = 0; i < selectedTreePaths.length; i++) {
refObj = ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
uniqueUserIDTreeSet.add(((TestingFrmwkTreeModel.LoadTestTreeInfo) refObj).userid);
if (!e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_USERS)) {
bioAndMathModelKeyValueV.add(((TestingFrmwkTreeModel.LoadTestTreeInfo) refObj).bioOrMathModelKey);
}
}
}
}
} else {
// TreeSet<VCDocumentInfo> dateRangeDocInfoTreeSet =
// new TreeSet<VCDocumentInfo>(new Comparator<VCDocumentInfo>() {
// public int compare(VCDocumentInfo o1, VCDocumentInfo o2) {
// return o1.getVersion().getDate().compareTo(o2.getVersion().getDate());
// }
// });
// BioModelInfo[] allBioModelInfos = getDocumentManager().getBioModelInfos();
// dateRangeDocInfoTreeSet.addAll(Arrays.asList(allBioModelInfos));
// MathModelInfo[] allMathModelInfos = getDocumentManager().getMathModelInfos();
// dateRangeDocInfoTreeSet.addAll(Arrays.asList(allMathModelInfos));
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
// Date firstDate = simpleDateFormat.parse(simpleDateFormat.format(dateRangeDocInfoTreeSet.first().getVersion().getDate()));
// Date lastDate = simpleDateFormat.parse(simpleDateFormat.format(dateRangeDocInfoTreeSet.last().getVersion().getDate()));
Date firstDate = simpleDateFormat.parse("2000-01-01");
Date lastDate = simpleDateFormat.parse(simpleDateFormat.format(Calendar.getInstance().getTime()));
String allDateRangeString = simpleDateFormat.format(firstDate) + "," + simpleDateFormat.format(lastDate);
while (beginDate[0] == null || endDate[0] == null) {
try {
String dateRangeString = DialogUtils.showInputDialog0(this, "Enter Date Range (begin,end) to include (e.g. '" + allDateRangeString + "')", allDateRangeString);
beginDate[0] = simpleDateFormat.parse(dateRangeString.substring(0, dateRangeString.indexOf(",")));
endDate[0] = simpleDateFormat.parse(dateRangeString.substring(dateRangeString.indexOf(",") + 1));
// if(beginDate.compareTo(firstDate) != 0 ||
// endDate.compareTo(lastDate) != 0){
// Iterator<VCDocumentInfo> vcDocIter = dateRangeDocInfoTreeSet.iterator();
// while(vcDocIter.hasNext()){
// VCDocumentInfo vcDocInfo = vcDocIter.next();
// Date docDate = simpleDateFormat.parse(simpleDateFormat.format(vcDocInfo.getVersion().getDate()));
// if(docDate.compareTo(beginDate) < 0 ||
// docDate.compareTo(endDate) > 0){
// continue;
// }
// uniqueUserIDTreeSet.add(vcDocInfo.getVersion().getOwner().getName());
// bioAndMathModelKeyValueV.add(vcDocInfo.getVersion().getVersionKey());
// }
// }
} catch (UtilCancelException uce) {
return;
} catch (Exception e2) {
DialogUtils.showErrorDialog(this, e2.getMessage());
}
}
if (beginDate[0].compareTo(firstDate) == 0 && endDate[0].compareTo(lastDate) == 0) {
beginDate[0] = null;
endDate[0] = null;
} else {
typeMsg = "between " + simpleDateFormat.format(beginDate[0]) + "," + simpleDateFormat.format(endDate[0]);
}
}
if (e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_MODELS)) {
typeMsg = "Models (" + bioAndMathModelKeyValueV.size() + ")";
} else if (e.getActionCommand().equals(TestingFrameworkPanel.RUN_XML_LOAD_TEST_USERS)) {
typeMsg = "Users (" + uniqueUserIDTreeSet.size() + ")";
}
int result = DialogUtils.showComponentOKCancelDialog(TestingFrameworkWindowPanel.this, new JLabel("Run " + typeMsg + " Load Tests?"), "Confirm Load Test Run");
if (result != JOptionPane.OK_OPTION) {
return;
}
result = DialogUtils.showComponentOKCancelDialog(this, enterDBAndSoftwareVersPanel, "Enter Software Version running load test");
if (result != JOptionPane.OK_OPTION) {
return;
}
AsynchClientTask runXMLLoadTestTask = new AsynchClientTask("Running XML Load Test...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
String[] uniqueUserIDArr = null;
KeyValue[] bioAndMathModelKeyValueArr = null;
if (beginDate[0] != null && endDate[0] != null) {
LoadTestInfoOpResults loadTestInfoOpResults = getTestingFrameworkWindowManager().getLoadTestInfoBetweenDates(beginDate[0], endDate[0]);
uniqueUserIDArr = loadTestInfoOpResults.getUniqueUserIDsBetweenDates();
bioAndMathModelKeyValueArr = loadTestInfoOpResults.getKeyValuesBetweenDates();
} else {
uniqueUserIDArr = (uniqueUserIDTreeSet.size() == 0 ? null : uniqueUserIDTreeSet.toArray(new String[0]));
bioAndMathModelKeyValueArr = (bioAndMathModelKeyValueV.size() == 0 ? null : bioAndMathModelKeyValueV.toArray(new KeyValue[0]));
}
throw new RuntimeException(TestingFrameworkWindowPanel.class.getSimpleName() + ".runXMLLoadTestTask(): Run Load Test disabled, directly dependend on MathVerifier.runLoadTest(), should move to standalone admin tool.");
// MathVerifier mathVerifier = MathVerifier.createMathVerifier(
// enterDBAndSoftwareVersPanel.getDBHost(),
// enterDBAndSoftwareVersPanel.getDBName(),
// enterDBAndSoftwareVersPanel.getDBSchema(),
// enterDBAndSoftwareVersPanel.getDBPassword());
// mathVerifier.runLoadTest(
// uniqueUserIDArr,
// bioAndMathModelKeyValueArr,
// enterDBAndSoftwareVersPanel.getSoftwareVersion(),
// (enterDBAndSoftwareVersPanel.getSoftwareVersion().length()==0?false:true),
// (enterDBAndSoftwareVersPanel.getSoftwareVersion().length()==0?Compare.DEFAULT_COMPARE_LOGGER:null));
}
};
tasksV.add(runXMLLoadTestTask);
} else if (e.getActionCommand().equals(TestingFrameworkPanel.REFRESH_XML_LOAD_TEST)) /*||
e.getActionCommand().equals(TestingFrameworkPanel.REFRESH_INCLUDE_SLOW_XML_LOAD_TEST)*/
{
final String LOADTESTDETAILS_KEY = "LOADTESTDETAILS_KEY";
AsynchClientTask getFailedLoadTest = new AsynchClientTask("Getting FailedLoadTests...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
/* Integer slowLoadThreshold = null;
if(e.getActionCommand().equals(TestingFrameworkPanel.REFRESH_INCLUDE_SLOW_XML_LOAD_TEST)){
String result = DialogUtils.showInputDialog0(TestingFrameworkWindowPanel.this, "Enter load time threshold (millseconds)","10000");
slowLoadThreshold = new Integer(result);
}
*/
if (gettestingFrameworkPanel().getSlowLoadThreshold() != null && gettestingFrameworkPanel().getLoadTestSQLCondition() != null) {
throw new IllegalArgumentException("SlowLoadThreshold and 'SQL Condition' cannot both be non-null at the same time.");
}
hashTable.put(LOADTESTDETAILS_KEY, getTestingFrameworkWindowManager().getLoadTestDetails(gettestingFrameworkPanel().getSlowLoadThreshold(), gettestingFrameworkPanel().getLoadTestSQLCondition()));
}
};
AsynchClientTask refreshFailedLoadTest = new AsynchClientTask("Refreshing FailedLoadTests...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().refreshLoadTest((LoadTestInfoOpResults) hashTable.get(LOADTESTDETAILS_KEY));
}
};
tasksV.add(getFailedLoadTest);
tasksV.add(refreshFailedLoadTest);
} else if (e.getActionCommand().equals(TestingFrameworkPanel.QUERY_TCRITVAR_CROSSREF)) {
if (selectedObj instanceof TestingFrmwkTreeModel.TestCriteriaVarUserObj && selectedTreePaths.length == 1) {
final TestingFrmwkTreeModel.TestCriteriaVarUserObj tcritVaruserObj = (TestingFrmwkTreeModel.TestCriteriaVarUserObj) selectedObj;
final TestSuiteInfoNew tsInfoNew = gettestingFrameworkPanel().getTestSuiteInfoOfTreePath(selectedTreePaths[0]);
AsynchClientTask queryTCritCrossRef = new AsynchClientTask("Query TCrit Var Cross Ref", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().queryTCritCrossRef(tsInfoNew, tcritVaruserObj.getTestCriteria(), tcritVaruserObj.getVariableComparisonSummary().getName());
}
};
tasksV.add(queryTCritCrossRef);
} else {
throw new Exception("Selected Object is not a TestCriteria Variable! Failed to Query Var Cross Ref.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.QUERY_TCRIT_CROSSREF)) {
if (selectedObj instanceof TestCriteriaNew) {
final TestCriteriaNew tcritNew = (TestCriteriaNew) selectedObj;
final TestSuiteInfoNew tsInfoNew = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCriteria();
AsynchClientTask queryTCritCrossRef = new AsynchClientTask("Query TCrit Cross Ref", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().queryTCritCrossRef(tsInfoNew, tcritNew, null);
}
};
tasksV.add(queryTCritCrossRef);
} else {
throw new Exception("Selected Object is not a TestCriteria! Failed to Query Cross Ref.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.LOCK_TESTSUITE)) {
if (selectedObj instanceof TestSuiteInfoNew) {
final TestSuiteInfoNew tsInfoNew = (TestSuiteInfoNew) selectedObj;
AsynchClientTask lockTestSuiteTask = new AsynchClientTask("Lock TestSuite", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().lockTestSuite(tsInfoNew);
}
};
tasksV.add(lockTestSuiteTask);
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfoNew);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a TestSuite! Failed to Lock TestSuite.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.EDIT_ANNOT_TESTSUITE)) {
if (selectedObj instanceof TestSuiteInfoNew) {
final TestSuiteInfoNew tsInfoNew = (TestSuiteInfoNew) selectedObj;
String newAnnotation;
// initialize fields
String oldAnnotation = tsInfoNew.getTSAnnotation();
// show the editor
newAnnotation = org.vcell.util.gui.DialogUtils.showAnnotationDialog(this, oldAnnotation);
final String finalAnnotation = newAnnotation;
AsynchClientTask editTestSuiteAnnotation = new AsynchClientTask("Edit TestSuite Annotation", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().updateTestSuiteAnnotation(tsInfoNew, finalAnnotation);
}
};
tasksV.add(editTestSuiteAnnotation);
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfoNew);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a TestSuite! Failed to Edit TestSuite Annotation.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.EDIT_ANNOT_TESTCASE)) {
if (selectedObj instanceof TestCaseNew) {
final TestCaseNew tcNew = (TestCaseNew) selectedObj;
String newAnnotation;
// initialize fields
String oldAnnotation = tcNew.getAnnotation();
// show the editor
newAnnotation = org.vcell.util.gui.DialogUtils.showAnnotationDialog(this, oldAnnotation);
final String finalAnnotation = newAnnotation;
AsynchClientTask editTestCaseAnnotation = new AsynchClientTask("Edit TestCase Annotation", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().updateTestCaseAnnotation(tcNew, finalAnnotation);
}
};
tasksV.add(editTestCaseAnnotation);
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCase();
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a TestCase! Failed to Edit TestCase Annotation.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.TOGGLE_STEADYSTATE)) {
if (selectedObj instanceof TestCaseNew) {
final TestCaseNew testCase = (TestCaseNew) selectedObj;
String okString = "Ok";
String confirm = PopupGenerator.showWarningDialog(this, "Toggle TestCase '" + testCase.getVersion().getName() + "'\nfrom " + testCase.getType() + " to " + (testCase.getType().equals(TestCaseNew.EXACT) ? TestCaseNew.EXACT_STEADY : TestCaseNew.EXACT), new String[] { okString, "Cancel" }, okString);
if (confirm.equals(okString)) {
AsynchClientTask toggleSteadyState = new AsynchClientTask("Toggle Steady State", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
getTestingFrameworkWindowManager().toggleTestCaseSteadyState(new TestCaseNew[] { testCase });
}
};
tasksV.add(toggleSteadyState);
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCase();
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw UserCancelException.CANCEL_GENERIC;
}
} else {
throw new Exception("Selected Object is not a TestCase! Cannot Toggle SteadyState");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.ADD_TESTSUITE)) {
TestingFrameworkWindowManager.NewTestSuiteUserInformation newTestSuiteUserInfo = getTestingFrameworkWindowManager().getNewTestSuiteInfoFromUser(null, null);
tasksV.add(new TFAddTestSuite(getTestingFrameworkWindowManager(), newTestSuiteUserInfo.testSuiteInfoNew));
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), newTestSuiteUserInfo.testSuiteInfoNew);
tasksV.add(tfRefreshTreeTask);
} else if (e.getActionCommand().equals(TestingFrameworkPanel.REFRESH_TESTSUITE)) {
TestSuiteInfoNew tsin = null;
if (selectedObj instanceof TestSuiteInfoNew) {
tsin = (TestSuiteInfoNew) selectedObj;
} else if (selectedObj instanceof TestCaseNew) {
tsin = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCase();
} else if (selectedObj instanceof TestCriteriaNew) {
tsin = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCriteria();
}
if (tsin == null) {
throw new IllegalArgumentException("Refresh error: Unexpected tree selection type=" + selectedObj.getClass().getName());
}
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsin);
tasksV.add(new TFUpdateRunningStatus(getTestingFrameworkWindowManager(), tsin));
tasksV.add(tfRefreshTreeTask);
// getTestingFrameworkWindowManager().updateSimRunningStatus();
} else if (e.getActionCommand().equals(TestingFrameworkPanel.ADD_TESTCASE)) {
if (selectedObj instanceof TestSuiteInfoNew) {
TestSuiteInfoNew tsInfo = (TestSuiteInfoNew) selectedObj;
TestCaseNew[] tcnArr = getTestingFrameworkWindowManager().getNewTestCaseArr();
tasksV.add(new cbit.vcell.client.task.TFAddTestCases(getTestingFrameworkWindowManager(), tsInfo, tcnArr));
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a test suite! Cannot add a test case");
}
} else if (e.getActionCommand().equals("Run All")) {
if (selectedTreePaths == null || selectedTreePaths.length != 1) {
throw new IllegalArgumentException("Command '" + e.getActionCommand() + "' Single Selection Only!");
}
if (selectedObj instanceof TestSuiteInfoNew) {
TestSuiteInfoNew tsInfo = (TestSuiteInfoNew) selectedObj;
String okString = "Ok";
String confirm = PopupGenerator.showWarningDialog(this, "Run All Sims for TestSuite '" + tsInfo.getTSID() + "'?", new String[] { okString, "Cancel" }, okString);
if (confirm.equals(okString)) {
tasksV.add(new TFRunSims(getTestingFrameworkWindowManager(), tsInfo));
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
}
} else {
throw new Exception("Selected Object is not a test suite!");
}
} else if (e.getActionCommand().equals("Run Simulations")) {
if (selectedTreePaths == null || selectedTreePaths.length != 1) {
throw new IllegalArgumentException("Command '" + e.getActionCommand() + "' Single Selection Only!");
}
if (selectedObj instanceof TestCaseNew) {
TestCaseNew testCase = (TestCaseNew) selectedObj;
String okString = "Ok";
String confirm = PopupGenerator.showWarningDialog(this, "Run All Sims for TestCase '" + testCase.getVersion().getName() + "'?", new String[] { okString, "Cancel" }, okString);
if (confirm.equals(okString)) {
tasksV.add(new TFRunSims(getTestingFrameworkWindowManager(), testCase));
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCase();
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
}
} else {
throw new Exception("Selected Object is not a TestCase! Cannot run simulations");
}
} else if (e.getActionCommand().equals("Run")) {
if (selectedTreePaths != null && selectedTreePaths.length > 0 && selectedTreePaths[0].getLastPathComponent() instanceof BioModelNode && ((BioModelNode) selectedTreePaths[0].getLastPathComponent()).getUserObject() instanceof TestCriteriaNew) {
for (int i = 0; i < selectedTreePaths.length; i += 1) {
TestCriteriaNew tCriteria = (TestCriteriaNew) ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
tasksV.add(new TFRunSims(getTestingFrameworkWindowManager(), tCriteria));
}
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCriteria();
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a TestCriteria!");
}
} else if (e.getActionCommand().equals("View Results")) {
if (selectedObj instanceof cbit.vcell.numericstest.TestCriteriaNew) {
TestCriteriaNew tCriteria = (TestCriteriaNew) selectedObj;
getTestingFrameworkWindowManager().viewResults(tCriteria);
} else {
PopupGenerator.showErrorDialog(TestingFrameworkWindowPanel.this, "Selected Object is not a TestCriteria!");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.COMPARERREGR_INTERNALREF_TESTCRITERIA) || e.getActionCommand().equals(TestingFrameworkPanel.COMPARERREGR_USERDEFREF_TESTCRITERIA)) {
if (selectedObj instanceof cbit.vcell.numericstest.TestCriteriaNew) {
TestCriteriaNew tCriteria = (TestCriteriaNew) selectedObj;
SimulationStatus simStatus = getTestingFrameworkWindowManager().getRequestManager().getServerSimulationStatus(tCriteria.getSimInfo());
if (simStatus.isRunning()) {
PopupGenerator.showErrorDialog(TestingFrameworkWindowPanel.this, "Selected simulation is still running!");
return;
}
SimulationInfo simulationInfo = tCriteria.getRegressionSimInfo();
if (e.getActionCommand().equals(TestingFrameworkPanel.COMPARERREGR_USERDEFREF_TESTCRITERIA)) {
try {
simulationInfo = getUserSelectedSimulationInfo().getSimInfo();
} catch (UserCancelException e2) {
return;
}
}
if (simulationInfo == null) {
PopupGenerator.showErrorDialog(TestingFrameworkWindowPanel.this, "Either the selected simulation does not belong to a REGRESSION test or the regression simInfo is not set!");
return;
}
getTestingFrameworkWindowManager().compare(tCriteria, simulationInfo);
} else {
PopupGenerator.showErrorDialog(TestingFrameworkWindowPanel.this, "Selected Object is not a TestCriteria!");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.DUPLICATE_TESTSUITE)) {
if (selectedObj instanceof TestSuiteInfoNew) {
TestSuiteInfoNew tsInfoOriginal = (TestSuiteInfoNew) selectedObj;
TestingFrameworkWindowManager.NewTestSuiteUserInformation newTestSuiteUserInfo = getTestingFrameworkWindowManager().getNewTestSuiteInfoFromUser(tsInfoOriginal.getTSAnnotation(), tsInfoOriginal.getTSID());
tasksV.add(new TFDuplicateTestSuite(getTestingFrameworkWindowManager(), tsInfoOriginal, newTestSuiteUserInfo.testSuiteInfoNew, newTestSuiteUserInfo.regrRefFlag));
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), newTestSuiteUserInfo.testSuiteInfoNew);
tasksV.add(tfRefreshTreeTask);
// getTestingFrameworkWindowManager().duplicateTestSuite(tsInfo);
} else {
throw new Exception("Selected Object is not a test suite! Cannot duplicate");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.REMOVE_TESTCASE)) {
if (selectedObj instanceof TestCaseNew) {
String[][] rowData = new String[selectedTreePaths.length][3];
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCase();
for (int i = 0; i < selectedTreePaths.length; i += 1) {
TestCaseNew tCase = (TestCaseNew) ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
rowData[i][0] = tsInfo.getTSID();
tasksV.add(new TFRemove(getTestingFrameworkWindowManager(), tCase));
if (tCase instanceof TestCaseNewBioModel) {
rowData[i][1] = "BM " + tCase.getVersion().getName();
rowData[i][2] = ((TestCaseNewBioModel) tCase).getSimContextName();
} else {
rowData[i][1] = "MM " + tCase.getVersion().getName();
rowData[i][2] = "N/A";
}
}
DialogUtils.showComponentOKCancelTableList(this, "Confirm Remove TestCase(s)", new String[] { "Test Suite", "Test Case", "App" }, rowData, null);
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a TestCase, cannot remove selection!");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.REMOVE_TESTSUITE)) {
if (selectedObj instanceof TestSuiteInfoNew) {
TestSuiteInfoNew tsInfo = (TestSuiteInfoNew) selectedObj;
String confirm = PopupGenerator.showWarningDialog(this, UserMessage.warn_deleteDocument.getMessage(tsInfo.getTSID()), UserMessage.warn_deleteDocument.getOptions(), UserMessage.warn_deleteDocument.getDefaultSelection());
if (confirm.equals(UserMessage.OPTION_DELETE)) {
tasksV.add(new TFRemove(getTestingFrameworkWindowManager(), tsInfo));
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw UserCancelException.CANCEL_GENERIC;
}
// getTestingFrameworkWindowManager().removeTestSuite(tsInfo);
} else {
throw new Exception("Selected Object is not a test suite! Cannot add a test case");
}
} else if (e.getActionCommand().equals("Generate TestSuite Report")) {
final TreePath[] selectedTreePathsLocal = selectedTreePaths;
new Thread(new Runnable() {
public void run() {
try {
for (int i = 0; selectedTreePathsLocal != null && i < selectedTreePathsLocal.length; i += 1) {
Object selTreeNode = ((BioModelNode) selectedTreePathsLocal[i].getLastPathComponent()).getUserObject();
if (selTreeNode instanceof TestSuiteInfoNew) {
Vector<AsynchClientTask> tasksVLocal = new java.util.Vector<AsynchClientTask>();
TestSuiteInfoNew tsInfo = (TestSuiteInfoNew) selTreeNode;
tasksVLocal.add(new cbit.vcell.client.task.TFUpdateRunningStatus(getTestingFrameworkWindowManager(), tsInfo));
tasksVLocal.add(new TFGenerateReport(getTestingFrameworkWindowManager(), tsInfo));
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);
}
});
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksVLocal.add(tfRefreshTreeTask);
AsynchClientTask[] tasksArr = new AsynchClientTask[tasksVLocal.size()];
tasksVLocal.copyInto(tasksArr);
Hashtable<String, Object> hashLocal = new Hashtable<String, Object>();
ClientTaskDispatcher.dispatch(TestingFrameworkWindowPanel.this, 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);
}
} else {
throw new Exception("Error GenerateTestSuiteReport\nSelected Object is not a TestSuite");
}
}
} catch (Exception e) {
e.printStackTrace();
PopupGenerator.showErrorDialog(TestingFrameworkWindowPanel.this, "Error GenerateTestSuiteReport\n" + e.getMessage(), e);
return;
}
}
}).start();
return;
} else if (e.getActionCommand().equals("Generate TestCase Report")) {
Vector<TestSuiteInfoNew> tsinV = new Vector<TestSuiteInfoNew>();
for (int i = 0; selectedTreePaths != null && i < selectedTreePaths.length; i += 1) {
Object selTreeNode = ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
if (selTreeNode instanceof TestCaseNew) {
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfTreePath(selectedTreePaths[i]);
if (!tsinV.contains(tsInfo)) {
tsinV.add(tsInfo);
tasksV.add(new cbit.vcell.client.task.TFUpdateRunningStatus(getTestingFrameworkWindowManager(), tsInfo));
}
tasksV.add(new TFGenerateReport(getTestingFrameworkWindowManager(), (TestCaseNew) selTreeNode));
} else {
throw new Exception("Selected Object is not a TestCase");
}
}
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), (tsinV.size() == 1 ? tsinV.elementAt(0) : null));
tasksV.add(tfRefreshTreeTask);
} else if (e.getActionCommand().equals(TestingFrameworkPanel.GENTCRITREPORT_INTERNALREF_TESTCRITERIA) || e.getActionCommand().equals(TestingFrameworkPanel.GENTCRITREPORT_USERDEFREF_TESTCRITERIA)) {
TFGenerateReport.VCDocumentAndSimInfo userDefinedRegrRef = null;
if (e.getActionCommand().equals(TestingFrameworkPanel.GENTCRITREPORT_USERDEFREF_TESTCRITERIA)) {
try {
userDefinedRegrRef = getUserSelectedSimulationInfo();
} catch (UserCancelException e2) {
return;
}
}
Vector<TestSuiteInfoNew> tsinV = new Vector<TestSuiteInfoNew>();
for (int i = 0; selectedTreePaths != null && i < selectedTreePaths.length; i += 1) {
Object selTreeNode = ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
if (selTreeNode instanceof TestCriteriaNew) {
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfTreePath(selectedTreePaths[i]);
if (!tsinV.contains(tsInfo)) {
tsinV.add(tsInfo);
tasksV.add(new cbit.vcell.client.task.TFUpdateRunningStatus(getTestingFrameworkWindowManager(), tsInfo));
}
tasksV.add(new TFGenerateReport(getTestingFrameworkWindowManager(), (TestCaseNew) ((BioModelNode) selectedTreePaths[i].getParentPath().getLastPathComponent()).getUserObject(), (TestCriteriaNew) selTreeNode, userDefinedRegrRef));
} else {
throw new Exception("Selected Object is not a TestCriteria");
}
}
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), (tsinV.size() == 1 ? tsinV.elementAt(0) : null));
tasksV.add(tfRefreshTreeTask);
} else if (e.getActionCommand().equals(TestingFrameworkPanel.REMOVE_DIFF_TESTCRITERIA)) {
final int OLDER = 0;
final int NEWER = 1;
final TestSuiteInfoNew[] testSuiteInfoHolder = new TestSuiteInfoNew[2];
if (selectedTreePaths.length == 2 && ((BioModelNode) selectedTreePaths[0].getLastPathComponent()).getUserObject() instanceof TestSuiteInfoNew && ((BioModelNode) selectedTreePaths[1].getLastPathComponent()).getUserObject() instanceof TestSuiteInfoNew) {
// do outside task because its quick
TestSuiteInfoNew testSuiteInfoOlder = (TestSuiteInfoNew) ((BioModelNode) selectedTreePaths[0].getLastPathComponent()).getUserObject();
TestSuiteInfoNew testSuiteInfoNewer = (TestSuiteInfoNew) ((BioModelNode) selectedTreePaths[1].getLastPathComponent()).getUserObject();
if (testSuiteInfoOlder.getTSDate().compareTo(testSuiteInfoNewer.getTSDate()) > 0) {
TestSuiteInfoNew temp = testSuiteInfoOlder;
testSuiteInfoOlder = testSuiteInfoNewer;
testSuiteInfoNewer = temp;
}
testSuiteInfoHolder[OLDER] = testSuiteInfoOlder;
testSuiteInfoHolder[NEWER] = testSuiteInfoNewer;
AsynchClientTask showDiffTask = new AsynchClientTask("Show Differential TestCriteria...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
ArrayList<TestSuiteNew> bothTestSuites = new ArrayList<TestSuiteNew>();
if (getClientTaskStatusSupport() != null) {
getClientTaskStatusSupport().setProgress(25);
getClientTaskStatusSupport().setMessage("Getting TestSuiteInfo '" + testSuiteInfoHolder[OLDER].getTSID() + "'");
}
bothTestSuites.add(getDocumentManager().getTestSuite(testSuiteInfoHolder[OLDER].getTSKey()));
if (getClientTaskStatusSupport() != null) {
getClientTaskStatusSupport().setProgress(50);
getClientTaskStatusSupport().setMessage("Getting TestSuiteInfo '" + testSuiteInfoHolder[NEWER].getTSID() + "'");
}
bothTestSuites.add(getDocumentManager().getTestSuite(testSuiteInfoHolder[NEWER].getTSKey()));
HashMap<String, TestCriteriaNew> olderTestCritHashMap = new HashMap<String, TestCriteriaNew>();
ArrayList<String> olderTestCaseBaseNames = new ArrayList<String>();
TreeMap<String, TestCriteriaNew> newDiffTestCriteria = new TreeMap<String, TestCriteriaNew>();
int excludedCount = 0;
for (TestSuiteNew currentTestSuite : bothTestSuites) {
BigDecimal currentTestSuiteKey = currentTestSuite.getTSInfoNew().getTSKey();
for (TestCaseNew tcn : currentTestSuite.getTestCases()) {
String prefixInfo = "TS='" + currentTestSuite.getTSInfoNew().getTSID() + "' Type='" + tcn.getType() + "' ";
String baseName = (tcn instanceof TestCaseNewBioModel ? "BioModel='" + ((TestCaseNewBioModel) tcn).getBioModelInfo().getVersion().getName() + "' App='" + ((TestCaseNewBioModel) tcn).getSimContextName() + "'" : "MathModel='" + ((TestCaseNewMathModel) tcn).getMathModelInfo().getVersion().getName()) + "'";
if (currentTestSuite.getTSInfoNew().getTSKey().equals(testSuiteInfoHolder[OLDER].getTSKey())) {
if (!olderTestCaseBaseNames.contains(baseName)) {
olderTestCaseBaseNames.add(baseName);
} else {
throw new Exception("Old testcase names duplicated.");
}
}
for (TestCriteriaNew tcrit : tcn.getTestCriterias()) {
String name = baseName + " Sim='" + tcrit.getSimInfo().getName() + "'";
if (olderTestCritHashMap.containsKey(name)) {
if (currentTestSuiteKey.equals(testSuiteInfoHolder[OLDER].getTSKey())) {
throw new Exception("---Problem--- Older names not unique");
}
continue;
} else if (currentTestSuiteKey.equals(testSuiteInfoHolder[NEWER].getTSKey())) {
if (!olderTestCaseBaseNames.contains(baseName)) {
// this happens when new TestSuite has added TestCase after duplication
excludedCount += 1;
} else if (newDiffTestCriteria.put(prefixInfo + name, tcrit) != null) {
throw new Exception("---Problem--- Newer added names not unique");
}
continue;
}
olderTestCritHashMap.put(name, tcrit);
}
}
}
if (newDiffTestCriteria.size() > 0) {
if (getClientTaskStatusSupport() != null) {
getClientTaskStatusSupport().setMessage("Showing Differential list...");
}
String[][] rowData = new String[newDiffTestCriteria.size()][1];
String[] addedNamesArr = newDiffTestCriteria.keySet().toArray(new String[0]);
for (int i = 0; i < addedNamesArr.length; i++) {
rowData[i][0] = addedNamesArr[i];
}
final String DELETE = "Delete";
TableListResult result = DialogUtils.showComponentOptionsTableList(gettestingFrameworkPanel(), "Remove TestCriteria in TS='" + testSuiteInfoHolder[NEWER].getTSID() + "' that were not in TS='" + testSuiteInfoHolder[OLDER].getTSID() + "' (count=" + rowData.length + " of " + olderTestCritHashMap.size() + ", excluded=" + excludedCount + ")", new String[] { "Diff TestCriteria" }, rowData, ListSelectionModel.MULTIPLE_INTERVAL_SELECTION, null, new String[] { DELETE, "Cancel" }, DELETE, null);
if (result != null && result.selectedOption != null && result.selectedOption.equals(DELETE) && result.selectedTableRows != null && result.selectedTableRows.length > 0) {
TestCriteriaNew[] allNewDiffTeestCritArr = newDiffTestCriteria.values().toArray(new TestCriteriaNew[0]);
TestCriteriaNew[] selTestCritsArr = new TestCriteriaNew[result.selectedTableRows.length];
for (int i = 0; i < result.selectedTableRows.length; i++) {
selTestCritsArr[i] = allNewDiffTeestCritArr[result.selectedTableRows[i]];
// System.out.println("Selected= "+rowData[result.selectedTableRows[i]][0]+" -- SimName="+selTestCritsArrHolder[0][i].getSimInfo().getVersion().getName());
}
hashTable.put(TFRemoveTestCriteria.REMOVE_THESE_TESTCRITERIAS, selTestCritsArr);
} else {
throw UserCancelException.CANCEL_GENERIC;
}
} else {
throw new Exception("No differential TestCriteria found");
}
}
};
AsynchClientTask shouldRefreshTask = new // Prevent annoying refresh if cancel
AsynchClientTask(// Prevent annoying refresh if cancel
"", // Prevent annoying refresh if cancel
AsynchClientTask.TASKTYPE_SWING_NONBLOCKING) {
public void run(Hashtable<String, Object> hashTable) throws Exception {
new TFRefresh(getTestingFrameworkWindowManager(), testSuiteInfoHolder[NEWER]).run(hashTable);
}
};
tasksV.add(showDiffTask);
tasksV.add(new TFRemoveTestCriteria(getTestingFrameworkWindowManager()));
tasksV.add(shouldRefreshTask);
// tasksV.add(new TFRefresh(getTestingFrameworkWindowManager(),testSuiteInfoHolder[NEWER]));
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.REMOVE_TESTCRITERIA)) {
if (selectedObj instanceof TestCriteriaNew) {
ArrayList<TestCriteriaNew> selTestCritsArr = new ArrayList<TestCriteriaNew>();
for (int i = 0; selectedTreePaths != null && i < selectedTreePaths.length; i += 1) {
Object selTreeNode = ((BioModelNode) selectedTreePaths[i].getLastPathComponent()).getUserObject();
if (selTreeNode instanceof TestCriteriaNew) {
selTestCritsArr.add(((TestCriteriaNew) selTreeNode));
}
}
final String DELETE = "Delete";
String response = DialogUtils.showWarningDialog(gettestingFrameworkPanel(), "Delete " + selTestCritsArr.size() + " TestCriterias?", new String[] { DELETE, "Cancel" }, DELETE);
if (response != null && response.equals(DELETE)) {
tasksV.add(new TFRemoveTestCriteria(getTestingFrameworkWindowManager(), selTestCritsArr.toArray(new TestCriteriaNew[0])));
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCriteria();
tasksV.add(new TFRefresh(getTestingFrameworkWindowManager(), tsInfo));
} else {
throw UserCancelException.CANCEL_GENERIC;
}
} else {
throw new Exception("Selected Object is not a TestCriteria! Cannot remove test criteria.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.EDIT_TESTCRITERIA)) {
if (selectedObj instanceof TestCriteriaNew) {
TestCriteriaNew tCriteria = (TestCriteriaNew) selectedObj;
TestCaseNew testCase = gettestingFrameworkPanel().getTestCaseOfSelectedCriteria();
TestCriteriaNew tcritNew = getTestingFrameworkWindowManager().getNewTestCriteriaFromUser(testCase.getType(), tCriteria);
tasksV.add(new TFUpdateTestCriteria(getTestingFrameworkWindowManager(), tCriteria, tcritNew));
TestSuiteInfoNew tsInfo = gettestingFrameworkPanel().getTestSuiteInfoOfSelectedTestCriteria();
tfRefreshTreeTask = new TFRefresh(getTestingFrameworkWindowManager(), tsInfo);
tasksV.add(tfRefreshTreeTask);
} else {
throw new Exception("Selected Object is not a TestCriteria! Cannot edit test criteria.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.COPY_TCRIT_SIMID)) {
if (selectedObj instanceof TestCriteriaNew) {
TestCriteriaNew tCriteria = (TestCriteriaNew) selectedObj;
KeyValue testCritSimID = tCriteria.getSimInfo().getVersion().getVersionKey();
VCellTransferable.sendToClipboard(testCritSimID.toString());
return;
} else {
throw new Exception("Selected Object is not a TestCriteria! Copy simid failed.");
}
} else if (e.getActionCommand().equals(TestingFrameworkPanel.LOAD_MODEL)) {
final String LOAD_THIS_MODEL = "LOAD_THIS_MODEL";
AsynchClientTask modelInfoTask = new AsynchClientTask("Finding Model Info...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
VCDocumentInfo vcDocumentInfo = null;
if (selectedObj instanceof TestCaseNew) {
TestCaseNew testCase = (TestCaseNew) selectedObj;
if (testCase instanceof TestCaseNewMathModel) {
vcDocumentInfo = ((TestCaseNewMathModel) testCase).getMathModelInfo();
} else if (testCase instanceof TestCaseNewBioModel) {
vcDocumentInfo = ((TestCaseNewBioModel) testCase).getBioModelInfo();
} else {
throw new IllegalArgumentException("Unexpected TestCase type=" + testCase.getClass().getName());
}
hashTable.put(LOAD_THIS_MODEL, vcDocumentInfo);
} else if (selectedObj instanceof LoadTestTreeInfo) {
throw new Exception("Not yet implemented for LoadTest.");
// LoadTestTreeInfo loadTestTreeInfo = (LoadTestTreeInfo)selectedObj;
// if(loadTestTreeInfo.modelType.equals(LoadTestInfoOpResults.MODELTYPE_BIO)){
// vcDocumentInfo = getDocumentManager().getBioModelInfo(loadTestTreeInfo.bioOrMathModelKey);
// }else if(loadTestTreeInfo.modelType.equals(LoadTestInfoOpResults.MODELTYPE_MATH)){
// vcDocumentInfo = getDocumentManager().getMathModelInfo(loadTestTreeInfo.bioOrMathModelKey);
// }else{
// throw new IllegalArgumentException("Unexpected LoadTestTreeInfo type="+loadTestTreeInfo.modelType);
// }
// hashTable.put(LOAD_THIS_MODEL, vcDocumentInfo);
}
}
};
AsynchClientTask openModelTask = new AsynchClientTask("Opening model...", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
if (selectedObj instanceof TestCaseNew) {
getTestingFrameworkWindowManager().loadModel((VCDocumentInfo) hashTable.get(LOAD_THIS_MODEL));
} else if (selectedObj instanceof LoadTestTreeInfo) {
throw new Exception("Not yet implemented for LoadTest.");
} else {
throw new Exception("Load Model expecting TestCaseNew or LoadTestTreeInfo but got " + selectedObj.getClass().getName());
}
}
};
tasksV.add(modelInfoTask);
tasksV.add(openModelTask);
}
// tasksV.add(tfRefreshTreeTask);
AsynchClientTask[] tasksArr = new AsynchClientTask[tasksV.size()];
tasksV.copyInto(tasksArr);
ClientTaskDispatcher.dispatch(this, hash, tasksArr, true);
} catch (Throwable exc) {
if (!(exc instanceof UserCancelException) && !(exc instanceof UtilCancelException)) {
exc.printStackTrace(System.out);
PopupGenerator.showErrorDialog(TestingFrameworkWindowPanel.this, exc.getMessage(), exc);
}
}
}
use of cbit.vcell.numericstest.LoadTestInfoOP in project vcell by virtualcell.
the class TestingFrameworkWindowManager method getLoadTestDetails.
public LoadTestInfoOpResults getLoadTestDetails(Integer slowLoadThreshold, String loadTestSQLCondition) throws DataAccessException {
LoadTestInfoOP loadTestInfoOP = new LoadTestInfoOP(LoadTestOpFlag.info, slowLoadThreshold, loadTestSQLCondition);
TestSuiteOPResults testSuiteOPResults = getRequestManager().getDocumentManager().doTestSuiteOP(loadTestInfoOP);
if (testSuiteOPResults instanceof LoadTestInfoOpResults) {
LoadTestInfoOpResults loadTestInfoOpResults = (LoadTestInfoOpResults) testSuiteOPResults;
return loadTestInfoOpResults;
}
throw new IllegalArgumentException("getLoadTestDetails Expecting LoadTestInfoOpResults");
}
use of cbit.vcell.numericstest.LoadTestInfoOP in project vcell by virtualcell.
the class DbDriver method testSuiteOP.
/**
* Insert the method's description here.
* Creation date: (10/19/2004 6:55:36 AM)
* @return cbit.vcell.numericstest.TestSuiteNew
* @param tsop cbit.vcell.numericstest.TestSuiteOP
*/
public static TestSuiteOPResults testSuiteOP(TestSuiteOP tsop, Connection con, User user, KeyFactory keyFactory) throws SQLException, DataAccessException {
java.util.TreeSet<BigDecimal> changedTestSuiteKeys = new java.util.TreeSet<BigDecimal>();
String sql = null;
Statement stmt = null;
try {
if (tsop instanceof ModelGeometryOP) {
ModelGeometryOP modelGeometryOP = (ModelGeometryOP) tsop;
if (modelGeometryOP.getVCDocumentInfo() instanceof BioModelInfo) {
BioModelInfo bioModelInfo = (BioModelInfo) modelGeometryOP.getVCDocumentInfo();
sql = "SELECT " + SimContextTable.table.geometryRef.getQualifiedColName() + " FROM " + SimContextTable.table.getTableName() + "," + BioModelSimContextLinkTable.table.getTableName() + " WHERE " + SimContextTable.table.name.getQualifiedColName() + " = '" + modelGeometryOP.getBioModelApplicationName() + "'" + " AND " + BioModelSimContextLinkTable.table.simContextRef.getQualifiedColName() + " = " + SimContextTable.table.id.getQualifiedColName() + " AND " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + " = " + bioModelInfo.getVersion().getVersionKey().toString();
} else if (modelGeometryOP.getVCDocumentInfo() instanceof MathModelInfo) {
MathModelInfo mathModelInfo = (MathModelInfo) modelGeometryOP.getVCDocumentInfo();
sql = "SELECT " + MathDescTable.table.geometryRef.getQualifiedColName() + " FROM " + MathDescTable.table.getTableName() + "," + MathModelTable.table.getTableName() + " WHERE " + MathModelTable.table.id.getQualifiedColName() + " = " + mathModelInfo.getVersion().getVersionKey().toString() + " AND " + MathModelTable.table.mathRef.getQualifiedColName() + " = " + MathDescTable.table.id.getQualifiedColName();
} else {
throw new IllegalArgumentException("UnImplemented VCDocumentInfo type=" + modelGeometryOP.getVCDocumentInfo().getClass().getName());
}
stmt = con.createStatement();
ResultSet rset = stmt.executeQuery(sql);
BigDecimal geometryKey = null;
if (rset.next()) {
geometryKey = rset.getBigDecimal(1);
if (rset.next()) {
throw new DataAccessException("Expecting only 1 Geometry but found at least 2");
}
} else {
throw new DataAccessException("No Geometry found using criteria");
}
rset.close();
stmt.close();
return new ModelGeometryOPResults(new KeyValue(geometryKey));
} else //
if (tsop instanceof LoadTestInfoOP) {
//
if (((LoadTestInfoOP) tsop).getLoadTestOpFlag() == LoadTestOpFlag.delete) {
// Delete before return details
LoadTestSoftwareVersionTimeStamp[] deleteTheseVersTimeStamps = ((LoadTestInfoOP) tsop).getLoadTestSoftwareVersionTimeStamps();
for (int i = 0; i < deleteTheseVersTimeStamps.length; i++) {
sql = "DELETE FROM " + LoadModelsStatTable.table.getTableName() + " WHERE " + LoadModelsStatTable.table.softwareVers + " = " + "'" + deleteTheseVersTimeStamps[i].getSoftwareVersion() + "'" + " AND " + LoadModelsStatTable.table.timeStamp + " = " + "'" + deleteTheseVersTimeStamps[i].getRunTimeStamp() + "'";
DbDriver.updateCleanSQL(con, sql);
}
return null;
}
// Check if Date info is requested
if (((LoadTestInfoOP) tsop).getLoadTestOpFlag() == LoadTestOpFlag.info && ((LoadTestInfoOP) tsop).getBeginDate() != null) {
final String YMD_FORMAT_STRING = "yyyy-MM-dd";
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(YMD_FORMAT_STRING);
final String BETWEEN_CONDITION = " BETWEEN " + " TO_DATE('" + simpleDateFormat.format(((LoadTestInfoOP) tsop).getBeginDate()) + " 00:00:00', '" + YMD_FORMAT_STRING + " HH24:MI:SS') " + " AND " + " TO_DATE('" + simpleDateFormat.format(((LoadTestInfoOP) tsop).getEndDate()) + " 23:59:59', '" + YMD_FORMAT_STRING + " HH24:MI:SS') ";
sql = "SELECT " + BioModelTable.table.id.getQualifiedColName() + "," + UserTable.table.userid.getUnqualifiedColName() + " FROM " + BioModelTable.table.getTableName() + "," + UserTable.table.getTableName() + " WHERE " + UserTable.table.id.getQualifiedColName() + " = " + BioModelTable.table.ownerRef.getQualifiedColName() + " AND " + BioModelTable.table.versionDate.getQualifiedColName() + BETWEEN_CONDITION + " UNION " + "SELECT " + MathModelTable.table.id.getQualifiedColName() + "," + UserTable.table.userid.getUnqualifiedColName() + " FROM " + MathModelTable.table.getTableName() + "," + UserTable.table.getTableName() + " WHERE " + UserTable.table.id.getQualifiedColName() + " = " + MathModelTable.table.ownerRef.getQualifiedColName() + " AND " + MathModelTable.table.versionDate.getQualifiedColName() + BETWEEN_CONDITION;
stmt = con.createStatement();
ResultSet rset = stmt.executeQuery(sql);
TreeSet<String> uniqueUserIDTreeSet = new TreeSet<String>();
Vector<KeyValue> keyValuesBetweenDatesV = new Vector<KeyValue>();
while (rset.next()) {
uniqueUserIDTreeSet.add(rset.getString(UserTable.table.userid.getUnqualifiedColName()));
keyValuesBetweenDatesV.add(new KeyValue(rset.getBigDecimal(1)));
}
rset.close();
stmt.close();
return new LoadTestInfoOpResults(((LoadTestInfoOP) tsop).getBeginDate(), ((LoadTestInfoOP) tsop).getEndDate(), keyValuesBetweenDatesV.toArray(new KeyValue[0]), uniqueUserIDTreeSet.toArray(new String[0]));
}
//
// Get LoadTest Info
//
// Get existing SoftwareVersion-Timestamp count
//
Vector<Integer> loadTestInfoCountV = new Vector<Integer>();
stmt = con.createStatement();
sql = "SELECT COUNT(*)," + LoadModelsStatTable.table.softwareVers.getUnqualifiedColName() + "," + LoadModelsStatTable.table.timeStamp.getUnqualifiedColName() + " FROM " + LoadModelsStatTable.table.getTableName() + " GROUP BY " + LoadModelsStatTable.table.softwareVers.getUnqualifiedColName() + "," + LoadModelsStatTable.table.timeStamp.getUnqualifiedColName();
Vector<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp> loadTestSoftwareVersionTimeStampsExistingV = new Vector<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp>();
ResultSet rset = stmt.executeQuery(sql);
while (rset.next()) {
String softwareVersion = TokenMangler.getSQLRestoredString(rset.getString(LoadModelsStatTable.table.softwareVers.getUnqualifiedColName()));
String runTimeStamp = rset.getString(LoadModelsStatTable.table.timeStamp.getUnqualifiedColName());
loadTestSoftwareVersionTimeStampsExistingV.add(new LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp(softwareVersion, runTimeStamp));
loadTestInfoCountV.add(rset.getInt(1));
}
rset.close();
stmt.close();
//
// Get empty test info count (models that haven't been checked yet during a test run)
//
stmt = con.createStatement();
sql = "SELECT COUNT(*)," + LoadModelsStatTable.table.softwareVers.getUnqualifiedColName() + "," + LoadModelsStatTable.table.timeStamp.getUnqualifiedColName() + " FROM " + LoadModelsStatTable.table.getTableName() + " WHERE " + LoadModelsStatTable.table.resultFlag.getUnqualifiedColName() + " IS NULL" + " GROUP BY " + LoadModelsStatTable.table.softwareVers.getUnqualifiedColName() + "," + LoadModelsStatTable.table.timeStamp.getUnqualifiedColName();
Vector<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp> loadTestSoftwareVersionTimeStampsEmptyV = new Vector<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp>();
rset = stmt.executeQuery(sql);
Integer[] loadTestInfoCountEmptyArr = new Integer[loadTestInfoCountV.size()];
while (rset.next()) {
String softwareVersion = TokenMangler.getSQLRestoredString(rset.getString(LoadModelsStatTable.table.softwareVers.getUnqualifiedColName()));
String runTimeStamp = rset.getString(LoadModelsStatTable.table.timeStamp.getUnqualifiedColName());
loadTestSoftwareVersionTimeStampsEmptyV.add(new LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp(softwareVersion, runTimeStamp));
// match to existing array index so full and empty match
for (int i = 0; i < loadTestSoftwareVersionTimeStampsExistingV.size(); i++) {
if (loadTestSoftwareVersionTimeStampsExistingV.elementAt(i).getSoftwareVersion().equals(softwareVersion) && loadTestSoftwareVersionTimeStampsExistingV.elementAt(i).getRunTimeStamp().equals(runTimeStamp)) {
loadTestInfoCountEmptyArr[i] = rset.getInt(1);
}
}
}
rset.close();
stmt.close();
//
// Get total Math and Bio model count
//
int totalBioMathModelCount = 0;
stmt = con.createStatement();
sql = "SELECT COUNT(*) FROM " + BioModelTable.table.getTableName() + " UNION " + "SELECT COUNT(*) FROM " + MathModelTable.table.getTableName();
rset = stmt.executeQuery(sql);
if (rset.next()) {
totalBioMathModelCount = rset.getInt(1);
if (rset.next()) {
totalBioMathModelCount += rset.getInt(1);
} else {
totalBioMathModelCount = 0;
}
}
if (totalBioMathModelCount == 0) {
throw new DataAccessException("No results when querying bio and Mathmodel count");
}
rset.close();
stmt.close();
//
// Get slow Loads
//
Object loadTestSlowHash = null;
if (((LoadTestInfoOP) tsop).getSlowLoadThresholdMilliSec() != null) {
Integer slowLoaderThreshold = ((LoadTestInfoOP) tsop).getSlowLoadThresholdMilliSec();
loadTestSlowHash = getLoadTestDetails(con, slowLoaderThreshold, null);
}
//
// Get failed loads
//
Object loadTestFailHash = getLoadTestDetails(con, null, null);
//
// Get user specified query info.
//
Object loadTestUserQueryHash = null;
if (((LoadTestInfoOP) tsop).getUserQueryCondition() != null) {
loadTestUserQueryHash = getLoadTestDetails(con, null, ((LoadTestInfoOP) tsop).getUserQueryCondition());
}
return new LoadTestInfoOpResults(loadTestInfoCountV.toArray(new Integer[0]), loadTestInfoCountEmptyArr, totalBioMathModelCount, loadTestSoftwareVersionTimeStampsExistingV.toArray(new LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp[0]), (Hashtable<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp, Vector<LoadTestInfoOpResults.LoadTestFailDetails>>) loadTestFailHash, (Hashtable<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp, Vector<LoadTestInfoOpResults.LoadTestSlowDetails>>) loadTestSlowHash, (Hashtable<LoadTestInfoOpResults.LoadTestSoftwareVersionTimeStamp, Vector<LoadTestInfoOpResults.LoadTestDetails>>) loadTestUserQueryHash, ((LoadTestInfoOP) tsop).getSlowLoadThresholdMilliSec());
}
//
// TestSuite operations ---------------------------------------------------------------------------------------------------
//
stmt = con.createStatement();
if (tsop instanceof AddTestSuiteOP) {
AddTestSuiteOP addts_tsop = (AddTestSuiteOP) tsop;
String annotation = addts_tsop.getTestSuiteAnnotation();
if (annotation != null) {
if (annotation.length() == 0) {
annotation = null;
} else {
annotation = TokenMangler.getSQLEscapedString(annotation);
}
}
BigDecimal changedTSKey = keyFactory.getUniqueBigDecimal(con);
final int NOT_LOCKED = 0;
sql = "INSERT INTO " + TFTestSuiteTable.table.getTableName() + " VALUES(" + changedTSKey + ",'" + addts_tsop.getTestSuiteVersionID() + "'," + "'" + addts_tsop.getVCellBuildVersionID() + "'" + "," + "'" + addts_tsop.getNumericsBuildVersionID() + "'" + "," + "current_timestamp,current_timestamp," + (annotation == null ? "NULL" : "'" + annotation + "'") + "," + NOT_LOCKED + ")";
stmt.executeUpdate(sql);
if (addts_tsop.getAddTestCasesOPs() != null) {
for (int i = 0; i < addts_tsop.getAddTestCasesOPs().length; i += 1) {
// Set new TSKey and do child OPs
AddTestCasesOP atcOP = addts_tsop.getAddTestCasesOPs()[i];
if (atcOP instanceof AddTestCasesOPMathModel) {
testSuiteOP(new AddTestCasesOPMathModel(changedTSKey, ((AddTestCasesOPMathModel) atcOP).getMathModelKey(), atcOP.getTestCaseType(), atcOP.getAnnotation(), ((AddTestCasesOPMathModel) atcOP).getAddTestCriteriaOPsMathModel()), con, user, keyFactory);
} else if (atcOP instanceof AddTestCasesOPBioModel) {
testSuiteOP(new AddTestCasesOPBioModel(changedTSKey, ((AddTestCasesOPBioModel) atcOP).getBioModelKey(), ((AddTestCasesOPBioModel) atcOP).getSimContextKey(), atcOP.getTestCaseType(), atcOP.getAnnotation(), ((AddTestCasesOPBioModel) atcOP).getAddTestCriteriaOPsBioModel()), con, user, keyFactory);
}
}
}
changedTestSuiteKeys.add(changedTSKey);
} else if (tsop instanceof AddTestCasesOPBioModel) {
AddTestCasesOPBioModel addtc_tsop = (AddTestCasesOPBioModel) tsop;
//
BigDecimal bmSimContextLinkRef = null;
// Convert BioModelKey and SimContextKey to bmsimcontext key
sql = "SELECT " + BioModelSimContextLinkTable.table.id.getQualifiedColName() + " FROM " + BioModelSimContextLinkTable.table.getTableName() + " WHERE " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + "=" + addtc_tsop.getBioModelKey().toString() + " AND " + BioModelSimContextLinkTable.table.simContextRef.getQualifiedColName() + "=" + addtc_tsop.getSimContextKey().toString();
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
bmSimContextLinkRef = rset.getBigDecimal(BioModelSimContextLinkTable.table.id.getUnqualifiedColName());
if (rset.next()) {
throw new DataAccessException("Too many MathModelSimLink found for bmKey=" + addtc_tsop.getBioModelKey() + " simContextKey=" + addtc_tsop.getSimContextKey());
}
} else {
throw new DataAccessException("No BioModelSimcontextLink found for bmKey=" + addtc_tsop.getBioModelKey() + " simContextKey=" + addtc_tsop.getSimContextKey());
}
rset.close();
//
BigDecimal tcKey = keyFactory.getUniqueBigDecimal(con);
String annotation = addtc_tsop.getAnnotation();
if (annotation != null) {
annotation = TokenMangler.getSQLEscapedString(annotation);
}
stmt.executeUpdate("INSERT INTO " + TFTestCaseTable.table.getTableName() + " VALUES(" + tcKey.toString() + "," + addtc_tsop.getTestSuiteKey().toString() + ",NULL," + "'" + addtc_tsop.getTestCaseType() + "'" + "," + "'" + annotation + "'" + "," + "current_timestamp" + "," + bmSimContextLinkRef.toString() + ")");
if (addtc_tsop.getAddTestCriteriaOPsBioModel() != null) {
for (int i = 0; i < addtc_tsop.getAddTestCriteriaOPsBioModel().length; i += 1) {
// Set new TSKey,TCaseKey and do child OPs
AddTestCriteriaOPBioModel atcritOP = addtc_tsop.getAddTestCriteriaOPsBioModel()[i];
testSuiteOP(new AddTestCriteriaOPBioModel(tcKey, atcritOP.getBioModelSimKey(), atcritOP.getRegressionBioModelKey(), atcritOP.getRegressionBioModelSimKey(), atcritOP.getMaxAbsoluteError(), atcritOP.getMaxRelativeError(), atcritOP.getAddTestResultsOP()), con, user, keyFactory);
}
}
changedTestSuiteKeys.add(addtc_tsop.getTestSuiteKey());
} else if (tsop instanceof AddTestCasesOPMathModel) {
AddTestCasesOPMathModel addtc_tsop = (AddTestCasesOPMathModel) tsop;
BigDecimal tcKey = keyFactory.getUniqueBigDecimal(con);
KeyValue mmKey = addtc_tsop.getMathModelKey();
String annotation = addtc_tsop.getAnnotation();
if (annotation != null) {
annotation = TokenMangler.getSQLEscapedString(annotation);
}
stmt.executeUpdate("INSERT INTO " + TFTestCaseTable.table.getTableName() + " VALUES(" + tcKey.toString() + "," + addtc_tsop.getTestSuiteKey().toString() + "," + mmKey.toString() + "," + "'" + addtc_tsop.getTestCaseType() + "'" + "," + "'" + annotation + "'" + "," + "current_timestamp" + ",NULL)");
if (addtc_tsop.getAddTestCriteriaOPsMathModel() != null) {
for (int i = 0; i < addtc_tsop.getAddTestCriteriaOPsMathModel().length; i += 1) {
// Set new TSKey,TCaseKey and do child OPs
AddTestCriteriaOPMathModel atcritOP = addtc_tsop.getAddTestCriteriaOPsMathModel()[i];
testSuiteOP(new AddTestCriteriaOPMathModel(tcKey, atcritOP.getMathModelSimKey(), atcritOP.getRegressionMathModelKey(), atcritOP.getRegressionMathModelSimKey(), atcritOP.getMaxAbsoluteError(), atcritOP.getMaxRelativeError(), atcritOP.getAddTestResultsOP()), con, user, keyFactory);
}
}
changedTestSuiteKeys.add(addtc_tsop.getTestSuiteKey());
} else if (tsop instanceof RemoveTestCasesOP) {
RemoveTestCasesOP removetc_tsop = (RemoveTestCasesOP) tsop;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < removetc_tsop.getTestCasesKeys().length; i += 1) {
if (i != 0) {
sb.append(",");
}
sb.append(removetc_tsop.getTestCasesKeys()[i].toString());
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + " IN (" + sb.toString() + ")" + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
int numRowsUpdated = stmt.executeUpdate("DELETE FROM " + TFTestCaseTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getUnqualifiedColName() + " IN (" + sb.toString() + ")");
if (numRowsUpdated != removetc_tsop.getTestCasesKeys().length) {
throw new DataAccessException("Remove TestCase keys=" + sb.toString() + " from TSKey=" + removetc_tsop.getTestSuiteKey() + " removed row count=" + numRowsUpdated + " expected " + removetc_tsop.getTestCasesKeys().length);
}
} else if (tsop instanceof AddTestCriteriaOPMathModel) {
AddTestCriteriaOPMathModel addtcrit_tsop = (AddTestCriteriaOPMathModel) tsop;
BigDecimal tcritKey = keyFactory.getUniqueBigDecimal(con);
BigDecimal tcKey = addtcrit_tsop.getTestCaseKey();
KeyValue simKey = addtcrit_tsop.getMathModelSimKey();
// Check that there is a single mathmodel associated with simkey and parentsimref is null
sql = "SELECT " + MathModelSimulationLinkTable.table.id.getQualifiedColName() + " FROM " + MathModelSimulationLinkTable.table.getTableName() + "," + SimulationTable.table.getTableName() + " WHERE " + MathModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + simKey.toString() + " AND " + MathModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + " AND " + SimulationTable.table.getTableName() + "." + SimulationTable.versionParentSimRef_ColumnName + " IS NULL";
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
if (rset.next()) {
throw new DataAccessException("Too many MathModelSimulationLink found for simKey=" + simKey);
}
} else {
throw new DataAccessException("No MathModelSimulationLink found for simKey=" + simKey);
}
rset.close();
// //
// //Make sure TestCase type and regressionRef match
// sql = "SELECT "+TFTestCaseTable.table.id.getQualifiedColName()+
// " FROM "+TFTestCaseTable.table.getTableName()+
// " WHERE "+
// TFTestCaseTable.table.id.getQualifiedColName()+"="+tcKey.toString()+
// " AND "+
// TFTestCaseTable.table.tcSolutionType.getQualifiedColName()+
// (regrSimKey != null?"=":"!=")+
// "'"+cbit.vcell.numericstest.TestCaseNew.REGRESSION+"'";
// rset = stmt.executeQuery(sql);
// if(!rset.next()){
// throw new DataAccessException("TestCase type not compatible with regressionSimKey");
// }
// rset.close();
//
//
// Get simDataRef from simKey
BigDecimal simDataRef = null;
// sql =
// "SELECT "+ResultSetMetaDataTable.table.id.getQualifiedColName()+
// " FROM " +ResultSetMetaDataTable.table.getTableName()+
// " WHERE "+
// ResultSetMetaDataTable.table.simRef.getQualifiedColName()+"="+simKey.toString();
// rset = stmt.executeQuery(sql);
// if(rset.next()){
// simDataRef = rset.getBigDecimal(MathModelSimulationLinkTable.table.id.getUnqualifiedColName());
// if(rset.next()){
// throw new DataAccessException("Too many ResultSetMetaData found for simKey="+simKey);
// }
// }
// else{
// throw new DataAccessException("No ResultSetMetaData found for simKey="+simKey);
// }
rset.close();
//
// Insert TestCriteria
sql = "INSERT INTO " + TFTestCriteriaTable.table.getTableName() + " VALUES(" + tcritKey.toString() + "," + tcKey.toString() + "," + simKey.toString() + "," + (simDataRef != null ? simDataRef.toString() : null) + "," + "NULL" + "," + (addtcrit_tsop.getMaxRelativeError() != null ? "TO_NUMBER('" + addtcrit_tsop.getMaxRelativeError().toString() + "')" : "null") + "," + (addtcrit_tsop.getMaxAbsoluteError() != null ? "TO_NUMBER('" + addtcrit_tsop.getMaxAbsoluteError().toString() + "')" : "null") + "," + "NULL,NULL," + "'" + TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT + "'" + ",null" + ")";
stmt.executeUpdate(sql);
if (addtcrit_tsop.getRegressionMathModelSimKey() != null) {
testSuiteOP(new EditTestCriteriaOPMathModel(tcritKey, addtcrit_tsop.getRegressionMathModelKey(), addtcrit_tsop.getRegressionMathModelSimKey(), addtcrit_tsop.getMaxAbsoluteError(), addtcrit_tsop.getMaxRelativeError()), con, user, keyFactory);
}
if (addtcrit_tsop.getAddTestResultsOP() != null) {
AddTestResultsOP atrOP = addtcrit_tsop.getAddTestResultsOP();
// Set new TSKey,TCritKey and do child OPs
testSuiteOP(new AddTestResultsOP(tcritKey, atrOP.getVariableComparisonSummaries()), con, user, keyFactory);
}
rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + tcritKey.toString() + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof AddTestCriteriaOPBioModel) {
AddTestCriteriaOPBioModel addtcrit_tsop = (AddTestCriteriaOPBioModel) tsop;
BigDecimal tcritKey = keyFactory.getUniqueBigDecimal(con);
BigDecimal tcKey = addtcrit_tsop.getTestCaseKey();
KeyValue simKey = addtcrit_tsop.getBioModelSimKey();
// Check that there is a single biomodel associated with simkey and parentsimref is null
sql = "SELECT " + BioModelSimulationLinkTable.table.id.getQualifiedColName() + " FROM " + BioModelSimulationLinkTable.table.getTableName() + "," + SimulationTable.table.getTableName() + " WHERE " + BioModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + simKey.toString() + " AND " + BioModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + " AND " + SimulationTable.table.getTableName() + "." + SimulationTable.versionParentSimRef_ColumnName + " IS NULL";
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
if (rset.next()) {
throw new DataAccessException("Too many BioModelSimulationLink found for simKey=" + simKey);
}
} else {
throw new DataAccessException("No BioModelSimulationLink found for simKey=" + simKey);
}
rset.close();
// //
// //Make sure TestCase type and regressionRef match
// sql = "SELECT "+TFTestCaseTable.table.id.getQualifiedColName()+
// " FROM "+TFTestCaseTable.table.getTableName()+
// " WHERE "+
// TFTestCaseTable.table.id.getQualifiedColName()+"="+tcKey.toString()+
// " AND "+
// TFTestCaseTable.table.tcSolutionType.getQualifiedColName()+
// (regrSimKey != null?"=":"!=")+
// "'"+cbit.vcell.numericstest.TestCaseNew.REGRESSION+"'";
// rset = stmt.executeQuery(sql);
// if(!rset.next()){
// throw new DataAccessException("TestCase type not compatible with regressionSimKey");
// }
// rset.close();
//
//
// Get simDataRef from simKey
BigDecimal simDataRef = null;
// sql =
// "SELECT "+ResultSetMetaDataTable.table.id.getQualifiedColName()+
// " FROM " +ResultSetMetaDataTable.table.getTableName()+
// " WHERE "+
// ResultSetMetaDataTable.table.simRef.getQualifiedColName()+"="+simKey.toString();
// rset = stmt.executeQuery(sql);
// if(rset.next()){
// simDataRef = rset.getBigDecimal(BioModelSimulationLinkTable.table.id.getUnqualifiedColName());
// if(rset.next()){
// throw new DataAccessException("Too many ResultSetMetaData found for simKey="+simKey);
// }
// }
// else{
// throw new DataAccessException("No ResultSetMetaData found for simKey="+simKey);
// }
rset.close();
//
// Insert TestCriteria
sql = "INSERT INTO " + TFTestCriteriaTable.table.getTableName() + " VALUES(" + tcritKey.toString() + "," + tcKey.toString() + "," + simKey.toString() + "," + (simDataRef != null ? simDataRef.toString() : null) + "," + "null" + "," + (addtcrit_tsop.getMaxRelativeError() != null ? "TO_NUMBER('" + addtcrit_tsop.getMaxRelativeError().toString() + "')" : "null") + "," + (addtcrit_tsop.getMaxAbsoluteError() != null ? "TO_NUMBER('" + addtcrit_tsop.getMaxAbsoluteError().toString() + "')" : "null") + "," + "NULL,NULL," + "'" + TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT + "'" + ",null" + ")";
stmt.executeUpdate(sql);
if (addtcrit_tsop.getRegressionBioModelSimKey() != null) {
testSuiteOP(new EditTestCriteriaOPBioModel(tcritKey, addtcrit_tsop.getRegressionBioModelKey(), addtcrit_tsop.getRegressionBioModelSimKey(), addtcrit_tsop.getMaxAbsoluteError(), addtcrit_tsop.getMaxRelativeError()), con, user, keyFactory);
}
if (addtcrit_tsop.getAddTestResultsOP() != null) {
AddTestResultsOP atrOP = addtcrit_tsop.getAddTestResultsOP();
// Set new TSKey,TCritKey and do child OPs
testSuiteOP(new AddTestResultsOP(tcritKey, atrOP.getVariableComparisonSummaries()), con, user, keyFactory);
}
rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + tcritKey.toString() + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof RemoveTestCriteriaOP) {
RemoveTestCriteriaOP removetcrit_tsop = (RemoveTestCriteriaOP) tsop;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < removetcrit_tsop.getTestCriterias().length; i += 1) {
if (i != 0) {
sb.append(",");
}
sb.append(removetcrit_tsop.getTestCriterias()[i].getTCritKey().toString());
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + " IN (" + sb.toString() + ")" + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
int numRowsUpdated = stmt.executeUpdate("DELETE FROM " + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCriteriaTable.table.id.getUnqualifiedColName() + " IN (" + sb.toString() + ")");
if (numRowsUpdated != removetcrit_tsop.getTestCriterias().length) {
throw new DataAccessException("Remove TestCriteria keys=" + sb.toString() + " removed row count=" + numRowsUpdated + " expected " + removetcrit_tsop.getTestCriterias().length);
}
} else if (tsop instanceof RemoveTestSuiteOP) {
RemoveTestSuiteOP removets_tsop = (RemoveTestSuiteOP) tsop;
int numRowsUpdated = stmt.executeUpdate("DELETE FROM " + TFTestSuiteTable.table.getTableName() + " WHERE " + TFTestSuiteTable.table.id.getUnqualifiedColName() + "=" + removets_tsop.getTestSuiteKey().toString());
if (numRowsUpdated != 1) {
throw new DataAccessException("Remove SINGLE TestSuite - key=" + removets_tsop.getTestSuiteKey().toString() + " removed row count=" + numRowsUpdated);
}
changedTestSuiteKeys.add(removets_tsop.getTestSuiteKey());
} else if (tsop instanceof AddTestResultsOP) {
AddTestResultsOP addtr_tsop = (AddTestResultsOP) tsop;
VariableComparisonSummary[] vcs = addtr_tsop.getVariableComparisonSummaries();
if (vcs == null || vcs.length == 0) {
throw new DataAccessException(RemoveTestCasesOP.class.getName() + " had no TestResults");
}
for (int i = 0; i < vcs.length; i += 1) {
if (vcs[i] == null) {
throw new DataAccessException(RemoveTestCasesOP.class.getName() + " Array element was null");
}
}
ResultSet rset = stmt.executeQuery("SELECT " + TFTestResultTable.table.id.getUnqualifiedColName() + " FROM " + TFTestResultTable.table.getTableName() + " WHERE " + TFTestResultTable.table.testCriteriaRef.getUnqualifiedColName() + "=" + addtr_tsop.getTestCriteriaKey().toString());
if (rset.next()) {
throw new DataAccessException("AddTestResultsOP Criteria key=" + addtr_tsop.getTestCriteriaKey() + " has results");
}
rset.close();
for (int i = 0; i < vcs.length; i += 1) {
sql = "INSERT INTO " + TFTestResultTable.table.getTableName() + " VALUES(" + "NEWSEQ.NEXTVAL" + "," + addtr_tsop.getTestCriteriaKey().toString() + "," + "'" + vcs[i].getName() + "'" + "," + "TO_NUMBER('" + vcs[i].getAbsoluteError() + "')" + "," + "TO_NUMBER('" + vcs[i].getRelativeError() + "')" + "," + "TO_NUMBER('" + vcs[i].getMaxRef() + "')" + "," + "TO_NUMBER('" + vcs[i].getMinRef() + "')" + "," + "TO_NUMBER('" + vcs[i].getMeanSqError() + "')" + "," + "TO_NUMBER('" + vcs[i].getTimeAbsoluteError() + "')" + "," + "TO_NUMBER('" + vcs[i].getIndexAbsoluteError() + "')" + "," + "TO_NUMBER('" + vcs[i].getTimeRelativeError() + "')" + "," + "TO_NUMBER('" + vcs[i].getIndexRelativeError() + "')" + ")";
stmt.executeUpdate(sql);
}
rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + addtr_tsop.getTestCriteriaKey().toString() + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof RemoveTestResultsOP) {
RemoveTestResultsOP removetr_tsop = (RemoveTestResultsOP) tsop;
StringBuffer sb = new StringBuffer();
for (int i = 0; i < removetr_tsop.getTestCriteriaKeys().length; i += 1) {
if (i != 0) {
sb.append(",");
}
sb.append(removetr_tsop.getTestCriteriaKeys()[i].toString());
stmt.executeUpdate("DELETE FROM " + TFTestResultTable.table.getTableName() + " WHERE " + TFTestResultTable.table.testCriteriaRef.getUnqualifiedColName() + "=" + removetr_tsop.getTestCriteriaKeys()[i].toString());
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + " IN (" + sb.toString() + ")" + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof EditTestCriteriaOPReportStatus) {
EditTestCriteriaOPReportStatus edittcrit_tsop = (EditTestCriteriaOPReportStatus) tsop;
BigDecimal tcritKey = edittcrit_tsop.getTestCriteriaKey();
if (tcritKey == null) {
throw new DataAccessException(tsop.getClass().getName() + " had no TestCriteria keys");
}
String newRS = edittcrit_tsop.getNewReportStatus();
if (newRS == null || (!newRS.equals(TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_FAILEDVARS) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_NODATA) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_NOREFREGR) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_PASSED) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_RPERROR) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_SIMFAILED) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_SIMRUNNING) && !newRS.equals(TestCriteriaNew.TCRIT_STATUS_SIMNOTRUNFAILDONE))) {
throw new DataAccessException("Unsupported ReportStatus=" + edittcrit_tsop.getNewReportStatus());
}
String reportStatusMessage = edittcrit_tsop.getNewReportStatusMessage();
if (reportStatusMessage != null) {
reportStatusMessage = TokenMangler.getSQLEscapedString(reportStatusMessage);
reportStatusMessage = reportStatusMessage.substring(0, Math.min(TFTestCriteriaTable.MAX_MESSAGE_SIZE, reportStatusMessage.length()));
}
stmt.executeUpdate("UPDATE " + TFTestCriteriaTable.table.getTableName() + " SET " + TFTestCriteriaTable.table.reportStatus.getQualifiedColName() + "=" + (newRS != null ? "'" + newRS + "'" : "null") + "," + TFTestCriteriaTable.table.reportMessage.getQualifiedColName() + "=" + (reportStatusMessage != null ? "'" + reportStatusMessage + "'" : "null") + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + tcritKey.toString());
if (newRS.equals(TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT)) {
testSuiteOP(new RemoveTestResultsOP(new BigDecimal[] { tcritKey }), con, user, keyFactory);
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + " = " + tcritKey.toString() + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof EditTestCriteriaOPMathModel) {
EditTestCriteriaOPMathModel edittcrit_tsop = (EditTestCriteriaOPMathModel) tsop;
BigDecimal tcritKey = edittcrit_tsop.getTestCriteriaKey();
if (tcritKey == null) {
throw new DataAccessException(tsop.getClass().getName() + " had no TestCriteria keys");
}
if ((edittcrit_tsop.getMathModelRegressionRef() == null && edittcrit_tsop.getMathModelRegressionSimRef() != null) || (edittcrit_tsop.getMathModelRegressionRef() != null && edittcrit_tsop.getMathModelRegressionSimRef() == null)) {
throw new DataAccessException(tsop.getClass().getName() + " MathRef and SimRef must both be null or both not null");
}
Double maxAbsError = edittcrit_tsop.getNewMaxAbsError();
Double maxRelError = edittcrit_tsop.getNewMaxRelError();
KeyValue regrSimRef = edittcrit_tsop.getMathModelRegressionSimRef();
// Convert regrSimKey to regrMathModelSimLinkKey
BigDecimal regrMathModelSimLink = null;
if (regrSimRef != null) {
sql = "SELECT " + MathModelSimulationLinkTable.table.id.getQualifiedColName() + " FROM " + MathModelSimulationLinkTable.table.getTableName() + " WHERE " + MathModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + regrSimRef.toString();
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
regrMathModelSimLink = rset.getBigDecimal(MathModelSimulationLinkTable.table.id.getUnqualifiedColName());
if (rset.next()) {
throw new DataAccessException("Too many MathModelSimLink found for regrSimKey=" + regrSimRef);
}
} else {
throw new DataAccessException("No MathModelSimLink found for regrSimKey=" + regrSimRef);
}
rset.close();
}
stmt.executeUpdate("UPDATE " + TFTestCriteriaTable.table.getTableName() + " SET " + TFTestCriteriaTable.table.maxAbsError.getQualifiedColName() + "=" + (maxAbsError != null ? "TO_NUMBER(" + maxAbsError.toString() + ")" : "null") + "," + TFTestCriteriaTable.table.maxRelError.getQualifiedColName() + "=" + (maxRelError != null ? "TO_NUMBER(" + maxRelError.toString() + ")" : "null") + "," + TFTestCriteriaTable.table.regressionMMSimRef.getQualifiedColName() + "=" + (regrMathModelSimLink != null ? regrMathModelSimLink.toString() : "null") + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + tcritKey.toString());
testSuiteOP(new EditTestCriteriaOPReportStatus(tcritKey, TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null), con, user, keyFactory);
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + " = " + tcritKey.toString() + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof EditTestCriteriaOPBioModel) {
EditTestCriteriaOPBioModel edittcrit_tsop = (EditTestCriteriaOPBioModel) tsop;
BigDecimal tcritKey = edittcrit_tsop.getTestCriteriaKey();
if (tcritKey == null) {
throw new DataAccessException(tsop.getClass().getName() + " had no TestCriteria keys");
}
if ((edittcrit_tsop.getBioModelRegressionRef() == null && edittcrit_tsop.getBioModelRegressionSimRef() != null) || (edittcrit_tsop.getBioModelRegressionRef() != null && edittcrit_tsop.getBioModelRegressionSimRef() == null)) {
throw new DataAccessException(tsop.getClass().getName() + " ApplicationRef and SimRef must both be null or both not null");
}
Double maxAbsError = edittcrit_tsop.getNewMaxAbsError();
Double maxRelError = edittcrit_tsop.getNewMaxRelError();
BigDecimal bmscAppKey = null;
BigDecimal bmsltSimKey = null;
final String BMSLT = "BMSLT";
if (edittcrit_tsop.getBioModelRegressionSimRef() != null) {
sql = "SELECT " + BioModelSimContextLinkTable.table.id.getQualifiedColName() + "," + BioModelSimulationLinkTable.table.id.getQualifiedColName() + " " + BMSLT + " FROM " + BioModelSimContextLinkTable.table.getTableName() + "," + SimContextTable.table.getTableName() + "," + SimulationTable.table.getTableName() + "," + BioModelSimulationLinkTable.table.getTableName() + " WHERE " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + "=" + edittcrit_tsop.getBioModelRegressionRef() + " AND " + BioModelSimContextLinkTable.table.simContextRef.getQualifiedColName() + "=" + SimContextTable.table.id.getQualifiedColName() + " AND " + SimContextTable.table.mathRef.getQualifiedColName() + "=" + SimulationTable.table.mathRef.getQualifiedColName() + " AND " + SimulationTable.table.id.getQualifiedColName() + "=" + edittcrit_tsop.getBioModelRegressionSimRef().toString() + " AND " + BioModelSimulationLinkTable.table.bioModelRef.getQualifiedColName() + " = " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + " AND " + BioModelSimulationLinkTable.table.simRef.getQualifiedColName() + " = " + SimulationTable.table.id.getQualifiedColName();
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
bmscAppKey = rset.getBigDecimal(BioModelSimContextLinkTable.table.id.getUnqualifiedColName());
bmsltSimKey = rset.getBigDecimal(BMSLT);
if (rset.next()) {
throw new DataAccessException("Too many ResultSetMetaData found for simKey=" + edittcrit_tsop.getBioModelRegressionSimRef());
}
}
rset.close();
}
stmt.executeUpdate("UPDATE " + TFTestCriteriaTable.table.getTableName() + " SET " + TFTestCriteriaTable.table.maxAbsError.getQualifiedColName() + "=" + (maxAbsError != null ? "TO_NUMBER(" + maxAbsError.toString() + ")" : "null") + "," + TFTestCriteriaTable.table.maxRelError.getQualifiedColName() + "=" + (maxRelError != null ? "TO_NUMBER(" + maxRelError.toString() + ")" : "null") + "," + TFTestCriteriaTable.table.regressionBMAPPRef.getQualifiedColName() + "=" + (bmscAppKey != null ? bmscAppKey.toString() : "NULL") + "," + TFTestCriteriaTable.table.regressionBMSimRef.getQualifiedColName() + "=" + (bmsltSimKey != null ? bmsltSimKey.toString() : "NULL") + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + tcritKey.toString());
testSuiteOP(new EditTestCriteriaOPReportStatus(tcritKey, TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null), con, user, keyFactory);
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + " = " + tcritKey.toString() + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof ChangeTestCriteriaErrorLimitOP) {
ChangeTestCriteriaErrorLimitOP edittcrit_tsop = (ChangeTestCriteriaErrorLimitOP) tsop;
BigDecimal[] tcritKeyArr = edittcrit_tsop.getTestCriteriaKeys();
double[] maxAbsErrorArr = edittcrit_tsop.getAbsErrorLimits();
double[] maxRelErrorArr = edittcrit_tsop.getRelErrorLimits();
if (tcritKeyArr == null || (maxAbsErrorArr != null && maxAbsErrorArr.length != tcritKeyArr.length) || (maxAbsErrorArr != null && maxRelErrorArr.length != tcritKeyArr.length)) {
throw new DataAccessException(tsop.getClass().getName() + " Improper arguments.");
}
StringBuffer tcritList = new StringBuffer();
for (int i = 0; i < tcritKeyArr.length; i++) {
if (i != 0) {
tcritList.append(",");
}
tcritList.append(tcritKeyArr[i]);
stmt.executeUpdate("UPDATE " + TFTestCriteriaTable.table.getTableName() + " SET " + (maxAbsErrorArr != null ? TFTestCriteriaTable.table.maxAbsError.getQualifiedColName() + "=" + maxAbsErrorArr[i] : "") + (maxAbsErrorArr != null && maxRelErrorArr != null ? "," : "") + (maxRelErrorArr != null ? TFTestCriteriaTable.table.maxRelError.getQualifiedColName() + "=" + maxRelErrorArr[i] : "") + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + tcritKeyArr[i].toString());
testSuiteOP(new EditTestCriteriaOPReportStatus(tcritKeyArr[i], TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null), con, user, keyFactory);
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.id.getQualifiedColName() + " IN (" + tcritList.toString() + ")" + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
} else if (tsop instanceof EditTestCasesOP) {
EditTestCasesOP edittc_tsop = (EditTestCasesOP) tsop;
BigDecimal[] tcaseKeys = edittc_tsop.getTestCasesKeys();
String[] annots = edittc_tsop.getNewAnnotations();
boolean[] newSteadyStates = edittc_tsop.getNewSteadyStates();
if (tcaseKeys == null || tcaseKeys.length == 0) {
throw new DataAccessException(tsop.getClass().getName() + " had no TestCase keys");
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < tcaseKeys.length; i += 1) {
if (i != 0) {
sb.append(",");
}
sb.append(tcaseKeys[i].toString());
if (annots != null) {
String annotation = annots[i];
if (annotation != null) {
if (annotation.length() == 0) {
annotation = null;
} else {
annotation = TokenMangler.getSQLEscapedString(annotation);
}
}
stmt.executeUpdate("UPDATE " + TFTestCaseTable.table.getTableName() + " SET " + TFTestCaseTable.table.tcAnnotation.getQualifiedColName() + "=" + (annotation == null ? "NULL" : "'" + annotation + "'") + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + tcaseKeys[i].toString());
}
if (newSteadyStates != null) {
// Make sure the change is for EXACT type
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestCriteriaTable.table.id.getQualifiedColName() + " FROM " + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + tcaseKeys[i].toString() + " AND " + "(" + TFTestCaseTable.table.tcSolutionType.getQualifiedColName() + "='" + TestCaseNew.EXACT + "'" + " OR " + TFTestCaseTable.table.tcSolutionType.getQualifiedColName() + "='" + TestCaseNew.EXACT_STEADY + "'" + ")" + " AND " + TFTestCriteriaTable.table.testCaseRef + "=" + TFTestCaseTable.table.id.getQualifiedColName());
// Get TestCriteria Keys for Test case
Vector<BigDecimal> tcritKeyV = new Vector<BigDecimal>();
while (rset.next()) {
tcritKeyV.add(rset.getBigDecimal(TFTestCriteriaTable.table.id.getUnqualifiedColName()));
}
if (tcritKeyV.size() == 0) {
throw new DataAccessException("Updating SteadyState on TestCase that is not EXACT is NOT allowed.");
}
rset.close();
// Change SteadyState type for TestCase
boolean newSteadyState = newSteadyStates[i];
stmt.executeUpdate("UPDATE " + TFTestCaseTable.table.getTableName() + " SET " + TFTestCaseTable.table.tcSolutionType.getQualifiedColName() + "=" + (newSteadyState ? "'" + TestCaseNew.EXACT_STEADY + "'" : "'" + TestCaseNew.EXACT + "'") + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + "=" + tcaseKeys[i].toString());
// Change Report status
for (int j = 0; j < tcritKeyV.size(); j++) {
EditTestCriteriaOPReportStatus etcors = new EditTestCriteriaOPReportStatus(tcritKeyV.elementAt(j), TestCriteriaNew.TCRIT_STATUS_NEEDSREPORT, null);
testSuiteOP(etcors, con, user, keyFactory);
}
}
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + " WHERE " + TFTestCaseTable.table.id.getQualifiedColName() + " IN (" + sb.toString() + ")" + " AND " + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + "=" + TFTestSuiteTable.table.id.getQualifiedColName());
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof EditTestSuiteOP) {
EditTestSuiteOP editts_tsop = (EditTestSuiteOP) tsop;
BigDecimal[] tsKeys = editts_tsop.getTestSuiteKeys();
String[] annots = editts_tsop.getNewAnnotations();
if (tsKeys == null || tsKeys.length == 0) {
throw new DataAccessException(tsop.getClass().getName() + " had no TestSuite keys");
}
StringBuffer sb = new StringBuffer();
for (int i = 0; i < tsKeys.length; i += 1) {
if (i != 0) {
sb.append(",");
}
sb.append(tsKeys[i].toString());
if (editts_tsop.isLock() != null) {
stmt.executeUpdate("UPDATE " + TFTestSuiteTable.table.getTableName() + " SET " + TFTestSuiteTable.table.isLocked.getQualifiedColName() + "= 1" + " WHERE " + TFTestSuiteTable.table.id.getQualifiedColName() + "=" + tsKeys[i].toString());
} else {
if (annots != null) {
String annotation = annots[i];
if (annotation != null) {
if (annotation.length() == 0) {
annotation = null;
} else {
annotation = TokenMangler.getSQLEscapedString(annotation);
}
}
stmt.executeUpdate("UPDATE " + TFTestSuiteTable.table.getTableName() + " SET " + TFTestSuiteTable.table.tsAnnotation.getQualifiedColName() + "=" + (annotation == null ? "NULL" : "'" + annotation + "'") + " WHERE " + TFTestSuiteTable.table.id.getQualifiedColName() + "=" + tsKeys[i].toString());
}
}
}
ResultSet rset = stmt.executeQuery("SELECT DISTINCT " + TFTestSuiteTable.table.id.getQualifiedColName() + " FROM " + TFTestSuiteTable.table.getTableName() + " WHERE " + TFTestSuiteTable.table.id.getQualifiedColName() + " IN (" + sb.toString() + ")");
while (rset.next()) {
changedTestSuiteKeys.add(rset.getBigDecimal(TFTestSuiteTable.table.id.getUnqualifiedColName()));
}
rset.close();
} else if (tsop instanceof QueryTestCriteriaCrossRefOP) {
QueryTestCriteriaCrossRefOP qtcritxr_tsop = (QueryTestCriteriaCrossRefOP) tsop;
Vector<TestCriteriaCrossRefOPResults.CrossRefData> crossRefV = new Vector<TestCriteriaCrossRefOPResults.CrossRefData>();
//
// BioModel query
//
String TSID = "tsid";
String TCID = "tcid";
String TCRID = "tcrid";
String BMNAME = "bmname";
String SCNAME = "scname";
String SIMNAME = "simname";
String TSALT = "TSALT";
String TCALT = "TCALT";
String TCRALT = "TCRALT";
String BSCALT = "BSCALT";
String MMSIMALT = "MMSIMALT";
String MODELID = "MODELID";
String REFTSUITEKEY = "REFTSUITEKEY";
String REFTCASEKEY = "REFTCASEKEY";
String REFTCRITKEY = "REFTCRITKEY";
// String TCRALT2 = "TCRALT2";
// String SIM2 = "SIM2";
sql = "SELECT DISTINCT " + TFTestSuiteTable.table.tsVersion.getQualifiedColName() + "," + TFTestSuiteTable.table.id.getQualifiedColName() + " " + TSID + "," + TFTestCaseTable.table.id.getQualifiedColName() + " " + TCID + "," + TFTestCriteriaTable.table.id.getQualifiedColName() + " " + TCRID + "," + BioModelTable.table.name.getQualifiedColName() + " " + BMNAME + "," + SimContextTable.table.name.getQualifiedColName() + " " + SCNAME + "," + SimulationTable.table.name.getQualifiedColName() + " " + SIMNAME + "," + TFTestCriteriaTable.table.maxAbsError.getQualifiedColName() + "," + TFTestCriteriaTable.table.maxRelError.getQualifiedColName() + "," + TFTestResultTable.table.varName.getQualifiedColName() + "," + TFTestResultTable.table.minRef.getQualifiedColName() + "," + TFTestResultTable.table.maxRef.getQualifiedColName() + "," + TFTestResultTable.table.absError.getQualifiedColName() + "," + TFTestResultTable.table.relError.getQualifiedColName() + "," + TFTestResultTable.table.meanSqrError.getQualifiedColName() + "," + TFTestResultTable.table.timeAbsError.getQualifiedColName() + "," + TFTestResultTable.table.indexAbsError.getQualifiedColName() + "," + TFTestResultTable.table.timeRelError.getQualifiedColName() + "," + TFTestResultTable.table.indexRelError.getQualifiedColName() + "," + TSALT + "." + TFTestSuiteTable.table.tsVersion.getUnqualifiedColName() + "," + BSCALT + "." + BioModelSimContextLinkTable.table.bioModelRef.getUnqualifiedColName() + "," + TFTestCaseTable.table.tcSolutionType.getQualifiedColName() + "," + BioModelTable.table.id.getQualifiedColName() + " " + MODELID + "," + TSALT + "." + TFTestSuiteTable.table.id.getUnqualifiedColName() + " " + REFTSUITEKEY + "," + TCALT + "." + TFTestCaseTable.table.id.getUnqualifiedColName() + " " + REFTCASEKEY + "," + "NULL " + // TCRALT2+"."+TFTestCriteriaTable.table.id.getUnqualifiedColName() +" "+REFTCRITKEY +
REFTCRITKEY + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + "," + TFTestResultTable.table.getTableName() + "," + BioModelSimContextLinkTable.table.getTableName() + "," + BioModelTable.table.getTableName() + "," + SimContextTable.table.getTableName() + "," + SimulationTable.table.getTableName() + "," + BioModelSimulationLinkTable.table.getTableName() + "," + TFTestSuiteTable.table.getTableName() + " " + TSALT + "," + TFTestCaseTable.table.getTableName() + " " + TCALT + "," + TFTestCriteriaTable.table.getTableName() + " " + TCRALT + "," + BioModelSimContextLinkTable.table.getTableName() + " " + BSCALT + // ","+TFTestCriteriaTable.table.getTableName()+" "+TCRALT2+
" WHERE " + TFTestSuiteTable.table.id.getQualifiedColName() + "=" + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + "=" + TFTestCaseTable.table.id.getQualifiedColName() + " AND " + TFTestResultTable.table.testCriteriaRef.getQualifiedColName() + "(+)" + "=" + TFTestCriteriaTable.table.id.getQualifiedColName() + (qtcritxr_tsop.getVarName() != null ? " AND " + TFTestResultTable.table.varName.getQualifiedColName() + "(+)" + "=" + "'" + qtcritxr_tsop.getVarName() + "'" : "") + " AND " + TFTestCaseTable.table.bmAppRef.getQualifiedColName() + "=" + BioModelSimContextLinkTable.table.id.getQualifiedColName() + " AND " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + "=" + BioModelTable.table.id.getQualifiedColName() + " AND " + BioModelSimContextLinkTable.table.simContextRef.getQualifiedColName() + "=" + SimContextTable.table.id.getQualifiedColName() + " AND " + BioModelSimulationLinkTable.table.bioModelRef.getQualifiedColName() + "=" + BioModelTable.table.id.getQualifiedColName() + " AND " + BioModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + " AND " + BioModelTable.table.versionBranchID.getQualifiedColName() + "=" + "(" + "SELECT DISTINCT " + BioModelTable.table.versionBranchID.getQualifiedColName() + " FROM " + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + "," + BioModelSimContextLinkTable.table.getTableName() + "," + BioModelTable.table.getTableName() + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + qtcritxr_tsop.getTestCriterium() + " AND " + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + "=" + TFTestCaseTable.table.id.getQualifiedColName() + " AND " + TFTestCaseTable.table.bmAppRef.getQualifiedColName() + "=" + BioModelSimContextLinkTable.table.id.getQualifiedColName() + " AND " + BioModelSimContextLinkTable.table.bioModelRef.getQualifiedColName() + "=" + BioModelTable.table.id.getQualifiedColName() + ")" + " AND " + SimContextTable.table.name.getQualifiedColName() + "=" + "(" + "SELECT DISTINCT " + SimContextTable.table.name.getQualifiedColName() + " FROM " + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + "," + BioModelSimContextLinkTable.table.getTableName() + "," + SimContextTable.table.getTableName() + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + qtcritxr_tsop.getTestCriterium() + " AND " + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + "=" + TFTestCaseTable.table.id.getQualifiedColName() + " AND " + TFTestCaseTable.table.bmAppRef.getQualifiedColName() + "=" + BioModelSimContextLinkTable.table.id.getQualifiedColName() + " AND " + BioModelSimContextLinkTable.table.simContextRef.getQualifiedColName() + "=" + SimContextTable.table.id.getQualifiedColName() + ")" + " AND " + SimulationTable.table.name.getQualifiedColName() + "=" + "(" + "SELECT DISTINCT " + SimulationTable.table.name.getQualifiedColName() + " FROM " + TFTestCriteriaTable.table.getTableName() + "," + SimulationTable.table.getTableName() + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + qtcritxr_tsop.getTestCriterium() + " AND " + TFTestCriteriaTable.table.simulationRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + ")" + // reference info
" AND " + TSALT + "." + TFTestSuiteTable.table.id.getUnqualifiedColName() + "(+)" + "=" + TCALT + "." + TFTestCaseTable.table.testSuiteRef.getUnqualifiedColName() + " AND " + BSCALT + "." + BioModelSimContextLinkTable.table.id.getUnqualifiedColName() + "(+)" + "=" + TCRALT + "." + TFTestCriteriaTable.table.regressionBMAPPRef.getUnqualifiedColName() + " AND " + TCALT + "." + TFTestCaseTable.table.bmAppRef.getUnqualifiedColName() + "(+)" + "=" + TCRALT + "." + TFTestCriteriaTable.table.regressionBMAPPRef.getUnqualifiedColName() + " AND " + TCRALT + "." + TFTestCriteriaTable.table.id.getUnqualifiedColName() + "=" + TFTestCriteriaTable.table.id.getQualifiedColName() + // SIM2+"."+SimulationTable.table.name.getUnqualifiedColName()+"="+SimulationTable.table.name.getQualifiedColName()+
" ORDER BY " + TSID;
ResultSet rset = stmt.executeQuery(sql);
while (rset.next()) {
crossRefV.add(new TestCriteriaCrossRefOPResults.CrossRefData(rset, true));
}
rset.close();
//
// MathModel query
//
String MMNAME = "mmname";
sql = "SELECT DISTINCT " + TFTestSuiteTable.table.tsVersion.getQualifiedColName() + "," + TFTestSuiteTable.table.id.getQualifiedColName() + " " + TSID + "," + TFTestCaseTable.table.id.getQualifiedColName() + " " + TCID + "," + TFTestCriteriaTable.table.id.getQualifiedColName() + " " + TCRID + "," + MathModelTable.table.name.getQualifiedColName() + " " + MMNAME + "," + SimulationTable.table.name.getQualifiedColName() + " " + SIMNAME + "," + TFTestCriteriaTable.table.maxAbsError.getQualifiedColName() + "," + TFTestCriteriaTable.table.maxRelError.getQualifiedColName() + "," + TFTestResultTable.table.varName.getQualifiedColName() + "," + TFTestResultTable.table.minRef.getQualifiedColName() + "," + TFTestResultTable.table.maxRef.getQualifiedColName() + "," + TFTestResultTable.table.absError.getQualifiedColName() + "," + TFTestResultTable.table.relError.getQualifiedColName() + "," + TFTestResultTable.table.meanSqrError.getQualifiedColName() + "," + TFTestResultTable.table.timeAbsError.getQualifiedColName() + "," + TFTestResultTable.table.indexAbsError.getQualifiedColName() + "," + TFTestResultTable.table.timeRelError.getQualifiedColName() + "," + TFTestResultTable.table.indexRelError.getQualifiedColName() + "," + TSALT + "." + TFTestSuiteTable.table.tsVersion.getUnqualifiedColName() + "," + MMSIMALT + "." + MathModelSimulationLinkTable.table.mathModelRef.getUnqualifiedColName() + "," + TFTestCaseTable.table.tcSolutionType.getQualifiedColName() + "," + MathModelTable.table.id.getQualifiedColName() + " " + MODELID + "," + TSALT + "." + TFTestSuiteTable.table.id.getUnqualifiedColName() + " " + REFTSUITEKEY + "," + TCALT + "." + TFTestCaseTable.table.id.getUnqualifiedColName() + " " + REFTCASEKEY + "," + "NULL " + // TCRALT2+"."+TFTestCriteriaTable.table.id.getUnqualifiedColName() +" "+REFTCRITKEY +
REFTCRITKEY + " FROM " + TFTestSuiteTable.table.getTableName() + "," + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + "," + TFTestResultTable.table.getTableName() + "," + MathModelTable.table.getTableName() + "," + SimulationTable.table.getTableName() + "," + MathModelSimulationLinkTable.table.getTableName() + "," + TFTestSuiteTable.table.getTableName() + " " + TSALT + "," + TFTestCaseTable.table.getTableName() + " " + TCALT + "," + TFTestCriteriaTable.table.getTableName() + " " + TCRALT + "," + MathModelSimulationLinkTable.table.getTableName() + " " + MMSIMALT + // ","+TFTestCriteriaTable.table.getTableName()+" "+TCRALT2+
" WHERE " + TFTestSuiteTable.table.id.getQualifiedColName() + "=" + TFTestCaseTable.table.testSuiteRef.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + "=" + TFTestCaseTable.table.id.getQualifiedColName() + " AND " + TFTestResultTable.table.testCriteriaRef.getQualifiedColName() + "(+)" + "=" + TFTestCriteriaTable.table.id.getQualifiedColName() + (qtcritxr_tsop.getVarName() != null ? " AND " + TFTestResultTable.table.varName.getQualifiedColName() + "(+)" + "=" + "'" + qtcritxr_tsop.getVarName() + "'" : "") + " AND " + TFTestCaseTable.table.mathModelRef.getQualifiedColName() + "=" + MathModelTable.table.id.getQualifiedColName() + " AND " + TFTestCriteriaTable.table.simulationRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + " AND " + MathModelSimulationLinkTable.table.mathModelRef.getQualifiedColName() + "=" + MathModelTable.table.id.getQualifiedColName() + " AND " + MathModelSimulationLinkTable.table.simRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + " AND " + MathModelTable.table.versionBranchID.getQualifiedColName() + "=" + "(" + "SELECT DISTINCT " + MathModelTable.table.versionBranchID.getQualifiedColName() + " FROM " + TFTestCaseTable.table.getTableName() + "," + TFTestCriteriaTable.table.getTableName() + "," + MathModelTable.table.getTableName() + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + qtcritxr_tsop.getTestCriterium() + " AND " + TFTestCriteriaTable.table.testCaseRef.getQualifiedColName() + "=" + TFTestCaseTable.table.id.getQualifiedColName() + " AND " + TFTestCaseTable.table.mathModelRef.getQualifiedColName() + "=" + MathModelTable.table.id.getQualifiedColName() + ")" + " AND " + SimulationTable.table.name.getQualifiedColName() + "=" + "(" + "SELECT DISTINCT " + SimulationTable.table.name.getQualifiedColName() + " FROM " + TFTestCriteriaTable.table.getTableName() + "," + SimulationTable.table.getTableName() + " WHERE " + TFTestCriteriaTable.table.id.getQualifiedColName() + "=" + qtcritxr_tsop.getTestCriterium() + " AND " + TFTestCriteriaTable.table.simulationRef.getQualifiedColName() + "=" + SimulationTable.table.id.getQualifiedColName() + ")" + // reference info
" AND " + TSALT + "." + TFTestSuiteTable.table.id.getUnqualifiedColName() + "(+)" + "=" + TCALT + "." + TFTestCaseTable.table.testSuiteRef.getUnqualifiedColName() + " AND " + TCALT + "." + TFTestCaseTable.table.mathModelRef.getUnqualifiedColName() + "(+)" + "=" + MMSIMALT + "." + MathModelSimulationLinkTable.table.mathModelRef.getUnqualifiedColName() + " AND " + TCRALT + "." + TFTestCriteriaTable.table.regressionMMSimRef.getUnqualifiedColName() + "=" + MMSIMALT + "." + MathModelSimulationLinkTable.table.id.getUnqualifiedColName() + "(+)" + " AND " + TCRALT + "." + TFTestCriteriaTable.table.id.getUnqualifiedColName() + "=" + TFTestCriteriaTable.table.id.getQualifiedColName() + // SIM2+"."+SimulationTable.table.name.getUnqualifiedColName()+"="+SimulationTable.table.name.getQualifiedColName()+
" ORDER BY " + TSID;
rset = stmt.executeQuery(sql);
while (rset.next()) {
crossRefV.add(new TestCriteriaCrossRefOPResults.CrossRefData(rset, false));
}
rset.close();
return new TestCriteriaCrossRefOPResults(qtcritxr_tsop.getTestSuiteKey(), qtcritxr_tsop.getTestCriterium(), crossRefV);
} else {
throw new IllegalArgumentException("Unsupported OP+" + tsop);
}
} finally {
if (stmt != null) {
stmt.close();
}
}
Object[] changedTSKeys = changedTestSuiteKeys.toArray();
for (int i = 0; i < changedTSKeys.length; i += 1) {
System.out.println("TestSuite " + changedTSKeys[i].toString() + " changed");
// testSuiteHash.remove(changedTSKeys[i]);
}
return new TestSuiteOPResults(null);
}
Aggregations