public void LinkingTest() { kt_linked_document_response linkresp = this._kt.get_document_links(this._session, this._doc1.docId); Assert.AreEqual(0, linkresp.status_code); Assert.AreEqual(null, linkresp.links); kt_response response = this._kt.link_documents(this._session, this._doc1.docId, this._doc2.docId, "Reference"); Assert.AreEqual(0, response.status_code); linkresp = this._kt.get_document_links(this._session, this._doc1.docId); Assert.AreEqual(0, linkresp.status_code); Assert.AreEqual(this._doc1.docId, linkresp.parent_document_id); Assert.AreEqual(1, linkresp.links.Length); Assert.AreEqual(this._doc2.docId, linkresp.links[0].document_id); Assert.AreEqual(this._doc2.title, linkresp.links[0].title); Assert.AreEqual("Default", linkresp.links[0].document_type); Assert.AreEqual(this._doc2.filesize + 1, linkresp.links[0].filesize); Assert.AreEqual(0.1, linkresp.links[0].version); Assert.AreEqual("n/a", linkresp.links[0].workflow); Assert.AreEqual("n/a", linkresp.links[0].workflow_state); Assert.AreEqual("Reference", linkresp.links[0].link_type); Assert.AreEqual("n/a", linkresp.links[0].custom_document_no); Assert.AreEqual("n/a", linkresp.links[0].oem_document_no); response = this._kt.unlink_documents(this._session, this._doc1.docId, this._doc2.docId); Assert.AreEqual(0, response.status_code); linkresp = this._kt.get_document_links(this._session, this._doc1.docId); Assert.AreEqual(0, linkresp.status_code); Assert.AreEqual(null, linkresp.links); }
public void FindFolderBeforeAdd() { String folder = "Root Folder/kt test folder"; if (this._verbose) { System.Console.WriteLine("Finding folder before add: " + folder); } kt_folder_detail folderDetail = this._kt.get_folder_detail_by_name(this._session, folder); if (0 == folderDetail.status_code) { if (this._verbose) { System.Console.WriteLine("Found folder - deleting"); } kt_response response = this._kt.delete_folder(this._session, folderDetail.id, "Delete - cleaning up before add"); Assert.AreEqual(0, response.status_code); } else { if (this._verbose) { System.Console.WriteLine("folder not found. that is ok!"); } } }
public void DeleteDocument() { if (this._verbose) { System.Console.WriteLine("Deleting document"); } kt_response response = this._kt.delete_document(this._session, this._docId, "Delete - cleaning up after add"); Assert.AreEqual(0, response.status_code); }
public void Login() { kt_response response = this._kt.login("admin", "admin", "127.0.0.1"); Assert.AreEqual(0, response.status_code); Assert.IsFalse(response.message == null); Assert.IsFalse(response.message == ""); this._session = response.message; }
public void DropFolder() { if (this._verbose) { System.Console.WriteLine("Drop Folder!"); } kt_response documentDetail = this._kt.delete_folder(this._session, this._folderId, "delete - cleaning up"); Assert.AreEqual(0, documentDetail.status_code); }
public void TearDown() { Helper.deleteFile(this._filename); kt_response response = this._kt.delete_document(this._session, this._docId, "Delete - cleaning up"); if (this._verbose && response.status_code != 0) { System.Console.WriteLine("Could not delete file: " + this._filename); } }
public KTTest() { this._kt = new KTWebService(); kt_response response = this._kt.login("admin", "admin", "127.0.0.1"); this._session = response.message; this._verbose = false; this.setupDb(); //System.Web.Services.Protocols.SoapHttpClientProtocol.ReceiveResponse }
public void RenameFolder() { kt_response response = this._kt.rename_folder(this._session, this._subfolder_id, "subfolde'r2"); Assert.AreEqual(0, response.status_code); kt_folder_detail response2 = this._kt.get_folder_detail(this._session, this._subfolder_id); Assert.AreEqual(0, response2.status_code); Assert.AreEqual(this._subfolder_id, response2.id); Assert.AreEqual("subfolde-r2", response2.folder_name); Assert.AreEqual(this._folder_id, response2.parent_id); Assert.AreEqual("kt_unit_test/subfolde-r2", response2.full_path); }
public void Add2PhaseDocument() { String filename = "kt unit test31"; if (this._verbose) { System.Console.WriteLine("Adding document : " + filename); } FileUploader uploader = new FileUploader(); uploader.upload(this._session, this._filename); String tempname = uploader.getFilename(); kt_document_detail response1 = this._kt.add_document(this._session, this._folderId, filename, this._filename, "Default", tempname); Assert.AreEqual(0, response1.status_code); Assert.AreEqual(filename, response1.title); Assert.AreEqual("Default", response1.document_type); Assert.AreEqual(0.1, response1.version); Assert.AreEqual("kt_unit_test1.txt", response1.filename); Assert.IsFalse(response1.created_date == null); Assert.IsFalse(response1.created_date == ""); Assert.AreEqual("Administrator", response1.created_by); //Assert.IsTrue(response1.modified_date == null); Assert.IsTrue("" != response1.modified_date); Assert.AreEqual("Administrator", response1.modified_by); Assert.IsTrue(response1.document_id > 0); Assert.AreEqual(this._folderId, response1.folder_id); Assert.AreEqual("n/a", response1.workflow); Assert.AreEqual("n/a", response1.workflow_state); this._docId = response1.document_id; kt_response response = this._kt.delete_document(this._session, this._docId, "Delete - cleaning up after add"); Assert.AreEqual(0, response.status_code); }
public void SmallDownloadTest() { kt_response update_resp = this._kt.download_small_document(this._session, this._doc1.docId); Assert.AreEqual(0, update_resp.status_code); String filename = Helper.isUnix()?("/tmp/kt_unit_test_tmp.txt"):("c:\\kt_unit_test_tmp.txt"); long length = Helper.ConvertBase64EncodingToFile(update_resp.message, filename); System.Console.WriteLine(Helper.readFile(filename)); // TODO - why??? Assert.AreEqual(length, this._doc1.filesize + 1); }
public void deleteFile() { Helper.deleteFile(this.filename); if (this.local) { return; } if (this.docId > 0) { kt_response response = this.kt.delete_document(this.session, this.docId, "Delete - cleaning up"); if (this.verbose && response.status_code != 0) { System.Console.WriteLine("Could not delete file: " + this.filename); } } }
public void DownloadTest() { kt_response update_resp = this._kt.download_document(this._session, this._doc1.docId); Assert.AreEqual(0, update_resp.status_code); System.Console.WriteLine("Download...." + update_resp.message); String uri = update_resp.message; HttpWebRequest webrequest = (HttpWebRequest)WebRequest.Create(uri); WebResponse response = webrequest.GetResponse(); StreamReader sr = new StreamReader(response.GetResponseStream()); String content = sr.ReadToEnd(); System.Console.WriteLine(content); }
public void FindDocumentBeforeAdd() { String filename = "Root Folder/kt test folder/kt unit test1"; if (this._verbose) { System.Console.WriteLine("Finding document before add: " + filename); } kt_document_detail documentDetail = this._kt.get_document_detail_by_title(this._session, 1, filename, ""); if (0 == documentDetail.status_code) { if (this._verbose) { System.Console.WriteLine("Found document - deleting"); } kt_response response = this._kt.delete_document(this._session, documentDetail.document_id, "Delete - cleaning up before add"); Assert.AreEqual(0, response.status_code); } else if (this._verbose) { System.Console.WriteLine("document not found. that is ok!"); } }
public void Logout() { kt_response response = this._kt.logout(this._session); Assert.AreEqual(0, response.status_code); }
public void RemoveFolder() { kt_response response = this._kt.delete_folder(this._session, this._folder_id, "unit testing remove"); Assert.AreEqual(0, response.status_code); }