//Case 1364: 1.9.1_WorkFlow_CreateVolume_GetVolumeInfo_customdata public void Run_3D_CreateVolume_GetVolumeInfo_Customdata_Case1364() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "WorkFlow CreateVolume_GetVolume_CustomData"); try { VolumeService vs = new VolumeService(); string volumeID = null; XMLParameterCollection cInputData = new XMLParameterCollection(); XMLParameter cSeriesData = new XMLParameter("series"); XMLParameter cVolumeData = new XMLParameter("volume"); XMLParameter cSlicePathData = new XMLParameter("slices_path_list"); string studyUID = string.Empty; for (int i = 0; i < ids.InputParameters.Count; i++) { switch (ids.InputParameters.GetParameter(i).Step) { case "na": studyUID = ids.InputParameters.GetParameter(i).Value; break; case "series": cSeriesData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false); break; case "volume": cVolumeData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false); break; case "slices_path_list": cSlicePathData.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value, false); break; } } string ep_3dscanmode = null; string ep_3dscanobject = null; string ep_3dfunctionalmode = null; for (int i = 0; i < ids.ExpectedValues.Count; i++) { if (ids.ExpectedValues.GetParameter(i).Step == "get") { switch (ids.ExpectedValues.GetParameter(i).Key) { case "3dscanmode": ep_3dscanmode = ids.ExpectedValues.GetParameter(i).Value; break; case "3dscanobject": ep_3dscanobject = ids.ExpectedValues.GetParameter(i).Value; break; case "3dfunctionalmode": ep_3dfunctionalmode = ids.ExpectedValues.GetParameter(i).Value; break; default: break; } } } CheckPoint pCreate = new CheckPoint("Create", "WorkFlow CreateVolume_GetVolume_CustomData"); r.CheckPoints.Add(pCreate); cInputData.Add(cSeriesData); cInputData.Add(cVolumeData); cInputData.Add(cSlicePathData); XMLResult rslCreate = vs.createVolume(studyUID, cInputData); if (!rslCreate.IsErrorOccured) { pCreate.Result = TestResult.Pass; volumeID = rslCreate.SingleResult; pCreate.Outputs.AddParameter("Create", "CreateVolume_GetVolume_CustomData Success", volumeID); } else { pCreate.Result = TestResult.Fail; pCreate.Outputs.AddParameter("Create", "CreateVolume_GetVolume_CustomData Fail", rslCreate.ResultContent); SaveRound(r); continue; } CheckPoint pGet = new CheckPoint("Get", "WorkFlow CreateVolume_GetVolume_CustomData"); r.CheckPoints.Add(pGet); XMLParameter filter = new XMLParameter("volume"); filter.AddParameter("internal_id", volumeID); filter.AddParameter("path_type", "all"); string str1 = string.Empty; string str2 = string.Empty; string str3 = string.Empty; XMLResult rslget = vs.getVolumeInfo(filter); foreach (XMLParameter p in rslget.MultiResults) { if (p.Name == "volume") { str1 = p.GetParameterValue("3dscanmode"); str2 = p.GetParameterValue("3dscanobject"); str3 = p.GetParameterValue("3dfunctionalmode"); } } if (!rslget.IsErrorOccured && str1 == ep_3dscanmode && str2 == ep_3dscanobject && str3 == ep_3dfunctionalmode) { pGet.Result = TestResult.Pass; pGet.Outputs.AddParameter("Get", "CreateVolume_GetVolume_CustomData Success", rslget.ResultContent); vs.deleteVolume(volumeID); } else { pGet.Result = TestResult.Fail; pGet.Outputs.AddParameter("Get", "CreateVolume_GetVolume_CustomData Fail", rslget.ResultContent); } vs.deleteVolume(volumeID); SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Outputs.AddParameter("Exception thrown", "Exception Message: ", ex.Message); cp.Result = TestResult.Fail; SaveRound(r); } } Output(); }
//Case 1220: 1.9.1_WorkFlow_N2_Import CS Model_GetVolumeInfo public void Run_3D_ImportCSModel_GetVolumeInfo_Case1220() { int runCount = 0; string patientUID = string.Empty; bool isCreatePatient = false; bool isDeletePatient = true; foreach (InputDataSet ids in this.Input.DataSets) { isCreatePatient = false; runCount++; Round r = this.NewRound(runCount.ToString(), "Import image"); ImportService importSvc = new ImportService(); XMLParameter pCreatePatient = new XMLParameter("patient"); XMLParameter pImportImage = new XMLParameter("import"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "create") { pCreatePatient.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); isCreatePatient = true; } if (ids.InputParameters.GetParameter(i).Step == "import") { pImportImage.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); } } XMLParameter epGetVolumeInfo = new XMLParameter(); for (int i = 0; i < ids.ExpectedValues.Count; i++) { if (ids.ExpectedValues.GetParameter(i).Step == "getVolumeInfo") { epGetVolumeInfo.AddParameter(ids.ExpectedValues.GetParameter(i).Key, ids.ExpectedValues.GetParameter(i).Value); } } try { PatientService patientSvc = new PatientService(); if (isCreatePatient) { CheckPoint pCreate = new CheckPoint("Create Patient", "Test create"); r.CheckPoints.Add(pCreate); XMLResult result = patientSvc.createPatient(pCreatePatient); if (!result.IsErrorOccured) { patientUID = result.SingleResult; pCreate.Result = TestResult.Pass; pCreate.Outputs.AddParameter("Create patient UID", "Create Patient", patientUID); } else { pCreate.Result = TestResult.Fail; pCreate.Outputs.AddParameter("Create patient returns error", "Create Patient", result.ResultContent); } } CheckPoint cpImport = new CheckPoint("Import Image", "Test import"); r.CheckPoints.Add(cpImport); string filePath = string.Empty; string archivePath = string.Empty; bool overrideExisted = false; for (int c = 0; c < pImportImage.Length; c++) { if (pImportImage.GetParameterName(c) == "path") filePath = pImportImage.GetParameterValue(c); if (pImportImage.GetParameterName(c) == "archivePath") archivePath = pImportImage.GetParameterValue(c); if (pImportImage.GetParameterName(c) == "move") { if (pImportImage.GetParameterValue(c) == "true") overrideExisted = true; } } XMLResult rtlImport = importSvc.importObject(patientUID, "", filePath, archivePath, overrideExisted, "false"); /********************************************** import return sample: - <trophy type="result" version="1.0"> <status code="0" message="ok" /> - <volume> <parameter key="internal_id" value="5412d81a-c096-4b0d-ab93-524266af21b6" /> </volume> </trophy> * **********************************************/ if (rtlImport.IsErrorOccured) { cpImport.Result = TestResult.Fail; cpImport.Outputs.AddParameter("Import volume fail", "Import", rtlImport.Message); cpImport.Outputs.AddParameter("Import volume returns error code", "Import", rtlImport.Code.ToString()); } else { // Check the return contiains image id and ps id string volumeID = null; volumeID = rtlImport.MultiResults[0].GetParameterValueByName("internal_id"); // image internal_id if (volumeID == null || volumeID == string.Empty) { cpImport.Result = TestResult.Fail; cpImport.Outputs.AddParameter("Import volume returns wrong volume internal id", "Import", rtlImport.ResultContent); } else { cpImport.Result = TestResult.Pass; cpImport.Outputs.AddParameter("import volume returns OK", "Import", rtlImport.ResultContent); } #region Call getVolumeInfo to check expected key and value VolumeService volumeSvc = new VolumeService(); XMLParameter pGetVolumeInfo = new XMLParameter("volume"); pGetVolumeInfo.AddParameter("internal_id", volumeID); CheckPoint cpGetVolumeInfo = new CheckPoint("GetVolumeInfo", "Call GetVolumeInfo to check the return value"); r.CheckPoints.Add(cpGetVolumeInfo); XMLResult rtGetVolumeInfo = volumeSvc.getVolumeInfo(pGetVolumeInfo); if (rtGetVolumeInfo.IsErrorOccured) { cpGetVolumeInfo.Result = TestResult.Fail; cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info return error", "GetVolumeInfo", rtGetVolumeInfo.ResultContent); } else { cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info return success", "GetVolumeInfo", rtGetVolumeInfo.Message); //Check the return info contain the expected key and value: parameter key="XXX" value="XXX" foreach (XMLParameterNode node in epGetVolumeInfo.Parameters) { if (!rtGetVolumeInfo.ResultContent.Contains("parameter key=\"" + node.ParameterName + "\" value=\"" + node.ParameterValue + "\"")) { cpGetVolumeInfo.Result = TestResult.Fail; cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info returns wrong key-value info for: " + node.ParameterName, "GetVolumeInfo", rtGetVolumeInfo.ResultContent); continue; } else { cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info returns correct key-value info for: " + node.ParameterName, "GetVolumeInfo", "ok"); } } if (cpGetVolumeInfo.Result != TestResult.Fail) { cpGetVolumeInfo.Result = TestResult.Pass; cpGetVolumeInfo.Outputs.AddParameter("Get Volume Info returns all correct info", "GetVolumeInfo", rtGetVolumeInfo.ResultContent); } } #endregion } if (isDeletePatient) { CheckPoint cpDelete = new CheckPoint("Delete Patient", "Test delete patient"); r.CheckPoints.Add(cpDelete); XMLResult rltDelete = patientSvc.deletePatient(patientUID); if (rltDelete.IsErrorOccured) { cpDelete.Outputs.AddParameter("Delete created patient returns error", "Delete Patient", rltDelete.Message); cpDelete.Result = TestResult.Fail; } else { cpDelete.Outputs.AddParameter("Delete created patient returns OK", "Delete Patient", rltDelete.Message); cpDelete.Result = TestResult.Pass; } } SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString()); cp.Result = TestResult.Fail; SaveRound(r); } } Output(); }
//Case 1627: 1.1.12.01_Set Name for 3d objects public void Run_3D_SetNameFor3DObjects_Case1627() { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), "Set 3D Object Name"); CheckPoint pset = new CheckPoint("Set 3DObject Name", " Check for 3d object set name"); r.CheckPoints.Add(pset); string threedid = ids.InputParameters.GetParameter("threedid" + runCount.ToString()).Value; string testname = ids.InputParameters.GetParameter("testname" + runCount.ToString()).Value; XMLParameter cInputSet = new XMLParameter("volume"); cInputSet.AddParameter("name", testname); XMLParameter cInputGet = new XMLParameter("volume"); cInputGet.AddParameter("internal_id", threedid); cInputGet.AddParameter("path_type", "all"); try { VolumeService vs = new VolumeService(); XMLResult rslset = vs.setVolume(threedid, cInputSet); if (rslset.IsErrorOccured) { pset.Result = TestResult.Fail; pset.Outputs.AddParameter("set volume", "fail", rslset.Message); SaveRound(r); continue; } XMLResult rslget = vs.getVolumeInfo(cInputGet); if (rslget.IsErrorOccured) { pset.Result = TestResult.Fail; pset.Outputs.AddParameter("get volume", "fail", rslget.Message); SaveRound(r); continue; } string getname = string.Empty; foreach (XMLParameterNode x in rslget.MultiResults[2].Parameters) { if (x.ParameterName == "name") { getname = x.ParameterValue; } } if (getname != testname) { pset.Result = TestResult.Fail; pset.Outputs.AddParameter("set volume", "fail", "Get Value is not equal to set Value"); SaveRound(r); continue; } pset.Result = TestResult.Pass; pset.Outputs.AddParameter("set volume", "Success", "OK"); SaveRound(r); } catch (Exception e) { pset.Result = TestResult.Fail; pset.Outputs.AddParameter("set volume", "Exception caught", e.Message); SaveRound(r); continue; } } Output(); }
public void Run_WorkFlow_3Dv_openVolume_with_default_a3d_Case1659() // Case 1559: 1.9.1_WorkFlow_3Dv_openVolume_with_default_a3d { int runCount = 0; foreach (InputDataSet ids in this.Input.DataSets) { runCount++; Round r = this.NewRound(runCount.ToString(), ids.Description); try { #region Parameter initialize string volumeid = ""; string criteriaOfAnalysis = ""; XMLParameter xmlVolumeInfoFilter = new XMLParameter("volume"); for (int i = 0; i < ids.InputParameters.Count; i++) { if (ids.InputParameters.GetParameter(i).Step == "VolumeInfo") { xmlVolumeInfoFilter.AddParameter(ids.InputParameters.GetParameter(i).Key, ids.InputParameters.GetParameter(i).Value); if (ids.InputParameters.GetParameter(i).Key == "internal_id") { volumeid = ids.InputParameters.GetParameter(i).Value; } } if (ids.InputParameters.GetParameter(i).Step == "Analyses3D") { if (ids.InputParameters.GetParameter(i).Key == "criteria") { criteriaOfAnalysis = ids.InputParameters.GetParameter(i).Value; } } } #endregion #region Step 1: Get Volume Info CheckPoint cpGetVolumeInfo = new CheckPoint("Get Volume Info", "Call getVolumeInfo"); r.CheckPoints.Add(cpGetVolumeInfo); VolumeService volumesrv = new VolumeService(); XMLResult rtVolumeGet = volumesrv.getVolumeInfo(xmlVolumeInfoFilter); if (rtVolumeGet.IsErrorOccured) { cpGetVolumeInfo.Result = TestResult.Fail; cpGetVolumeInfo.Outputs.AddParameter("Get volume info returns error", "Get volume info", rtVolumeGet.Message); SaveRound(r); continue; } else { cpGetVolumeInfo.Result = TestResult.Pass; cpGetVolumeInfo.Outputs.AddParameter("Get volume info returns success", "Get volume info", rtVolumeGet.ResultContent); } #endregion #region Step 1-1: create analysis3d for volume Analysis3DService a3dsrv = new Analysis3DService(); XMLParameter a3dpara = new XMLParameter("analysis3d"); a3dpara.AddParameter("analysis3D_xml", "Only for list analysis3d"); a3dpara.AddParameter("current", "true"); a3dsrv.createAnalysis3D(volumeid, a3dpara); #endregion #region Step 2: List Volume Analysis3D CheckPoint cpGetAnalysis3d = new CheckPoint("Get Volume Of Analysis3D", "Call listAnalyses3DOfVolume"); r.CheckPoints.Add(cpGetAnalysis3d); XMLResult rtAnalysis3d = volumesrv.listAnalyses3DOfVolume(volumeid, criteriaOfAnalysis); if (rtAnalysis3d.IsErrorOccured) { cpGetAnalysis3d.Result = TestResult.Fail; cpGetAnalysis3d.Outputs.AddParameter("Get volume info returns error", "Get volume info", rtAnalysis3d.Message); SaveRound(r); continue; } else { cpGetAnalysis3d.Result = TestResult.Pass; cpGetAnalysis3d.Outputs.AddParameter("Get volume info returns success", "Get volume info", rtAnalysis3d.ResultContent); } #endregion #region Step 3: Get Anaylysis3D's Images CheckPoint cpGetAnalysis3dImages = new CheckPoint("List Images of Analysis3d", "Call listImagesOfAnalysis3D"); r.CheckPoints.Add(cpGetAnalysis3dImages); ParseXMLContent pc = new ParseXMLContent(rtAnalysis3d.ResultContent); pc.getValueFromPath("trophy/analysis3d"); string analysis3duids = pc.getValueByKey("internal_id"); if (analysis3duids != "") { string analysis3duid = ""; do { int count = 1; int indexPath = analysis3duids.IndexOf(";"); if (indexPath != -1) { analysis3duid = analysis3duids.Substring(0, indexPath); analysis3duids = analysis3duids.Substring(indexPath + 1); } XMLResult imagesfroma3d = a3dsrv.listImagesOfAnalysis3D(analysis3duid); if (imagesfroma3d.IsErrorOccured) { cpGetAnalysis3dImages.Result = TestResult.Fail; cpGetAnalysis3dImages.Outputs.AddParameter("List Images of Analysis3d", "Call listImagesOfAnalysis3D", imagesfroma3d.Message); break; } else { cpGetAnalysis3dImages.Result = TestResult.Pass; cpGetAnalysis3dImages.Outputs.AddParameter("List Images of Analysis3d " + count + " :", "Call listImagesOfAnalysis3D", imagesfroma3d.ResultContent); } count++; } while (analysis3duids != ""); } else { cpGetAnalysis3dImages.Result = TestResult.Fail; cpGetAnalysis3dImages.Outputs.AddParameter("Get images from Analysis3D", "Get images of Analysis3D", "No Analysis3D id return by listAnalyses3DOfVolume"); } #endregion SaveRound(r); } catch (Exception ex) { CheckPoint cp = new CheckPoint(); r.CheckPoints.Add(cp); cp.Result = TestResult.Fail; cp.Outputs.AddParameter("Exception thrown", "Exception Message", ex.ToString()); SaveRound(r); } } Output(); }