public void StartWorkflowTest()
        {
            kt_document_detail response = this._kt.start_document_workflow(this._session, this._doc1.docId, "Review Process");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Review Process", response.workflow);
        }
Example #2
0
        public void Checkin2PhaseDocument()
        {
            String filename = "kt unit test1";

            if (this._verbose)
            {
                System.Console.WriteLine("Checking out document : " + filename);
            }

            kt_document_detail response = this._kt.checkout_document(this._session, this._docId, "unit test - going to checkout and then checkin", false);

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Administrator", response.checked_out_by);
            Assert.IsTrue(null != response.checked_out_date);

            FileUploader uploader = new FileUploader();

            uploader.upload(this._session, this._filename);
            String tempname = uploader.getFilename();

            kt_document_detail checkin = this._kt.checkin_document(this._session, this._docId, filename, "unit test - doing checkin", tempname, false);

            Assert.AreEqual(0, checkin.status_code);
            Assert.AreEqual("n/a", checkin.checked_out_by);
            Assert.AreEqual("n/a", checkin.checked_out_date);
        }
Example #3
0
        public void UpdateDocumentMetadataTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[1];
            fs[0]                 = new kt_metadata_fieldset();
            fs[0].fieldset        = "General information";
            fs[0].fields          = new kt_metadata_field[3];
            fs[0].fields[0]       = new kt_metadata_field();
            fs[0].fields[0].name  = "Category";
            fs[0].fields[0].value = "Technical";
            fs[0].fields[1]       = new kt_metadata_field();
            fs[0].fields[1].name  = "Document Author";
            fs[0].fields[1].value = "Joe Soap";
            fs[0].fields[2]       = new kt_metadata_field();
            fs[0].fields[2].name  = "Media Type";
            fs[0].fields[2].value = "Text";

            kt_sysdata_item[] sysdata = new kt_sysdata_item[0];

            kt_document_detail update_resp = this._kt.update_document_metadata(this._session, this._docId, fs, sysdata);

            Assert.AreEqual(0, update_resp.status_code);
            Assert.AreEqual("General information", update_resp.metadata[1].fieldset);

            Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
            Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);

            Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
            Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);

            Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
            Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);
        }
Example #4
0
        public void RenameWithInvalidCharactersTest()
        {
            kt_document_detail response = this._kt.rename_document_filename(this._session, this._doc1.docId, "te<s'`me");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("te-s--me", response.filename);
        }
Example #5
0
        public void GetDetailByTitle2Test()
        {
            kt_document_detail response = this._kt.get_document_detail_by_title(this._session, 1, "Root Folder/kt unit test1", "");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual(this._docId, response.document_id);
        }
Example #6
0
        public void GetDetailByFile2Test()
        {
            kt_document_detail response = this._kt.get_document_detail_by_filename(this._session, 1, "Root Folder/kt_unit_test1.txt", "");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual(this._docId, response.document_id);
        }
Example #7
0
        public void AddDocument()
        {
            String folder = "kt test folder";

            if (this._verbose)
            {
                System.Console.WriteLine("Creating folder : " + folder);
            }
            kt_folder_detail folderDetail = this._kt.create_folder(this._session, 1, folder);

            this._folderId = folderDetail.id;
            if (this._verbose)
            {
                System.Console.WriteLine("Got folder id : " + this._folderId);
            }

            String filename = "kt unit test1";

            if (this._verbose)
            {
                System.Console.WriteLine("Adding document : " + filename);
            }


            kt_document_detail response1 = this._kt.add_base64_document(this._session, this._folderId, filename, this._filename, "Default", Helper.ConvertFileToBase64Encoding(this._filename));

            Assert.AreEqual(0, response1.status_code);
            Assert.AreEqual("kt unit test1", 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.updated_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);

            Assert.AreEqual("/" + folder + "/kt unit test1", response1.full_path);

            this._docId = response1.document_id;
        }
Example #8
0
        public void ChangeOwnerTest()
        {
            kt_document_detail response = this._kt.change_document_owner(this._session, this._doc1.docId, "anonymous", "just trying to change owner");

            Assert.AreEqual(0, response.status_code);

            // test to non existant user
            response = this._kt.change_document_owner(this._session, this._doc1.docId, "blah", "just trying to change owner");
            Assert.IsFalse(0 == response.status_code);
        }
Example #9
0
        public void RenameTest()
        {
            kt_document_detail response = this._kt.rename_document_filename(this._session, this._doc1.docId, "test fname");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("test fname", response.filename);

            response = this._kt.rename_document_title(this._session, this._doc1.docId, "test title");
            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("test title", response.title);
        }
Example #10
0
        public void FindDocumentAfterDelete()
        {
            if (this._verbose)
            {
                System.Console.WriteLine("Checking that document is gone!");
            }

            kt_document_detail documentDetail = this._kt.get_document_detail_by_title(this._session, 1, "Root Folder/kt test folder/kt unit test1", "");

            Assert.IsTrue(0 != documentDetail.status_code);
        }
Example #11
0
        public void FindDocumentAfterMove()
        {
            String filename = "Root 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, "");

            Assert.AreEqual(0, documentDetail.status_code);
        }
Example #12
0
        public void CopyTest()
        {
            kt_folder_detail response2 = this._kt.create_folder(this._session, 1, "kt_unit_test_move");

            Assert.AreEqual(0, response2.status_code);
            int folderId = response2.id;

            kt_document_detail linkresp = this._kt.copy_document(this._session, this._doc1.docId, folderId, "copy", "");

            Assert.AreEqual(0, linkresp.status_code);
            Assert.AreEqual("kt_unit_test1.txt", linkresp.filename);
            Assert.AreEqual("kt unit test1", linkresp.title);
        }
Example #13
0
        public void GetTransitionsTest()
        {
            kt_document_detail response = this._kt.start_document_workflow(this._session, this._doc1.docId, "Review Process");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Review Process", response.workflow);

            kt_workflow_transitions_response trans_resp = this._kt.get_document_workflow_transitions(this._session, this._doc1.docId);

            Assert.AreEqual(0, trans_resp.status_code);
            Assert.AreEqual(1, trans_resp.transitions.Length);
            Assert.AreEqual("Request Approval", trans_resp.transitions[0]);
        }
Example #14
0
        public void DocumentExistanceTest()
        {
            kt_document_detail response = this._kt.get_document_detail(this._session, this._docId, "MLTVH");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual(this._docId, response.document_id);
            Assert.AreEqual("kt unit test1", response.title);
            Assert.AreEqual("n/a", response.custom_document_no);
            Assert.AreEqual("n/a", response.oem_document_no);
            Assert.AreEqual("Default", response.document_type);
            Assert.AreEqual("/kt unit test1", response.full_path);
            Assert.AreEqual("kt_unit_test1.txt", response.filename);
            Assert.AreEqual(this._content.Length + 1, response.filesize);
            Assert.AreEqual(this._folderId, response.folder_id);
            Assert.AreEqual("Administrator", response.created_by);
            Assert.IsTrue("" != response.created_date);
            Assert.AreEqual("n/a", response.checked_out_by);
            Assert.IsTrue("" != response.checked_out_date);
            Assert.AreEqual("Administrator", response.modified_by);
            Assert.IsTrue("" != response.modified_date);
            Assert.AreEqual("Administrator", response.owned_by);
            Assert.AreEqual(0.1, response.version);
            Assert.AreEqual(false, response.is_immutable);
            Assert.AreEqual("RW", response.permissions);
            Assert.AreEqual("n/a", response.workflow);
            Assert.AreEqual("n/a", response.workflow_state);
            Assert.AreEqual("text/plain", response.mime_type);
            Assert.AreEqual("text", response.mime_icon_path);
            Assert.AreEqual("Plain Text", response.mime_display);
            Assert.IsTrue("" != response.storage_path);
            Assert.AreEqual(2, response.metadata.Length);
            Assert.AreEqual(null, response.links);

            Assert.AreEqual(1, response.transaction_history.Length);
            Assert.AreEqual("Create", response.transaction_history[0].transaction_name);
            Assert.AreEqual("Administrator", response.transaction_history[0].username);
            Assert.AreEqual(0.1, response.transaction_history[0].version);
            Assert.AreEqual("Document created", response.transaction_history[0].comment);
            Assert.IsTrue("" != response.transaction_history[0].datetime);

            Assert.AreEqual(1, response.version_history.Length);
            Assert.AreEqual("Administrator", response.version_history[0].user);
            Assert.AreEqual(0, response.version_history[0].metadata_version);
            Assert.AreEqual(0.1, response.version_history[0].content_version);



            Assert.AreEqual(null, response.transitions);
        }
Example #15
0
        //[Test]
        public void AddDocumentWithMetadataTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[1];
            fs[0]                 = new kt_metadata_fieldset();
            fs[0].fieldset        = "General information";
            fs[0].fields          = new kt_metadata_field[3];
            fs[0].fields[0]       = new kt_metadata_field();
            fs[0].fields[0].name  = "Document Author";
            fs[0].fields[0].value = "Joe Soap";
            fs[0].fields[1]       = new kt_metadata_field();
            fs[0].fields[1].name  = "Category";
            fs[0].fields[1].value = "Technical";
            fs[0].fields[2]       = new kt_metadata_field();
            fs[0].fields[2].name  = "Media Type";
            fs[0].fields[2].value = "Text";

            kt_sysdata_item[] sysdata = new kt_sysdata_item[3];
            sysdata[0]       = new kt_sysdata_item();
            sysdata[0].name  = "created_by";
            sysdata[0].value = "Anonymous";
            sysdata[1]       = new kt_sysdata_item();
            sysdata[1].name  = "created_date";
            sysdata[1].value = "2007-01-17";


            sysdata[2]       = new kt_sysdata_item();
            sysdata[2].name  = "index_content";
            sysdata[2].value = "happy happy. this is a test with hippos and rhinos under the sun. unbrellas are required to create shade when trees are not abound.";



            this._doc2.local = true;
            this._doc2.createFile(this._folderId);



            for (int i = 0; i < 1; i++)
            {
                FileUploader uploader = new FileUploader( );

                uploader.upload(this._session, this._doc2.filename);

                System.Console.WriteLine("uploaded: " + uploader.filename);

                kt_document_detail response1 = this._kt.add_document_with_metadata(this._session, this._folderId, this._doc2.title + i, this._doc2.filename + i, "Default", uploader.filename, fs, sysdata);

                Assert.AreEqual(0, response1.status_code);
            }
        }
Example #16
0
        public void UpdateOemNoMetadataTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[0];

            kt_sysdata_item[] sysdata = new kt_sysdata_item[1];
            sysdata[0]       = new kt_sysdata_item();
            sysdata[0].name  = "oem_document_no";
            sysdata[0].value = "1234";

            kt_document_detail update_resp = this._kt.update_document_metadata(this._session, this._docId, fs, sysdata);

            Assert.AreEqual(0, update_resp.status_code);

            Assert.AreEqual("1234", update_resp.oem_document_no);
        }
Example #17
0
        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);
        }
Example #18
0
        public void ProblemMetadataNoFieldTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[1];
            fs[0]                 = new kt_metadata_fieldset();
            fs[0].fieldset        = "General information";
            fs[0].fields          = new kt_metadata_field[1];
            fs[0].fields[0]       = new kt_metadata_field();
            fs[0].fields[0].name  = "Document Owner";
            fs[0].fields[0].value = "Joe \\Soap";

            kt_sysdata_item[] sysdata = new kt_sysdata_item[0];

            kt_document_detail update_resp = this._kt.update_document_metadata(this._session, this._docId, fs, sysdata);

            Assert.AreEqual(0, update_resp.status_code);
        }
Example #19
0
        public void CheckinSmallDocumentWithMetadataTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[1];
            fs[0]                 = new kt_metadata_fieldset();
            fs[0].fieldset        = "General information";
            fs[0].fields          = new kt_metadata_field[3];
            fs[0].fields[0]       = new kt_metadata_field();
            fs[0].fields[0].name  = "Document Author";
            fs[0].fields[0].value = "Joe Soap";
            fs[0].fields[1]       = new kt_metadata_field();
            fs[0].fields[1].name  = "Category";
            fs[0].fields[1].value = "Technical";
            fs[0].fields[2]       = new kt_metadata_field();
            fs[0].fields[2].name  = "Media Type";
            fs[0].fields[2].value = "Text";

            kt_sysdata_item[] sysdata = new kt_sysdata_item[2];
            sysdata[0]       = new kt_sysdata_item();
            sysdata[0].name  = "created_by";
            sysdata[0].value = "Anonymous";
            sysdata[1]       = new kt_sysdata_item();
            sysdata[1].name  = "created_date";
            sysdata[1].value = "2007-01-17";

            kt_document_detail resp = this._kt.checkout_base64_document(this._session, this._doc1.docId, "test checkin", false);

            Assert.AreEqual(0, resp.status_code);



            kt_document_detail update_resp = this._doc1.checkinFileWithMetadata(this._folderId, fs, sysdata);

            Assert.AreEqual(0, update_resp.status_code);
            Assert.AreEqual("General information", update_resp.metadata[1].fieldset);

            Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
            Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);

            Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
            Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);

            Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
            Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);

            Assert.AreEqual("Anonymous", update_resp.created_by);
            Assert.AreEqual("2007-01-17 00:00:00", update_resp.created_date);
        }
Example #20
0
        public void UpdateDocumentMetadataTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[1];
            fs[0]                 = new kt_metadata_fieldset();
            fs[0].fieldset        = "General information";
            fs[0].fields          = new kt_metadata_field[3];
            fs[0].fields[0]       = new kt_metadata_field();
            fs[0].fields[0].name  = "Document Author";
            fs[0].fields[0].value = "Joe Soap";
            fs[0].fields[1]       = new kt_metadata_field();
            fs[0].fields[1].name  = "Category";
            fs[0].fields[1].value = "Technical";
            fs[0].fields[2]       = new kt_metadata_field();
            fs[0].fields[2].name  = "Media Type";
            fs[0].fields[2].value = "Text";

            kt_sysdata_item[] sysdata = new kt_sysdata_item[3];
            sysdata[0]       = new kt_sysdata_item();
            sysdata[0].name  = "created_by";
            sysdata[0].value = "Anonymous";
            sysdata[1]       = new kt_sysdata_item();
            sysdata[1].name  = "created_date";
            sysdata[1].value = "2007-01-17";
            sysdata[2]       = new kt_sysdata_item();
            sysdata[2].name  = "modified_by";
            sysdata[2].value = "admin";


            kt_document_detail update_resp = this._kt.update_document_metadata(this._session, this._doc1.docId, fs, sysdata);

            Assert.AreEqual(0, update_resp.status_code);
            Assert.AreEqual("General information", update_resp.metadata[1].fieldset);

            Assert.AreEqual("Category", update_resp.metadata[1].fields[1].name);
            Assert.AreEqual("Technical", update_resp.metadata[1].fields[1].value);

            Assert.AreEqual("Document Author", update_resp.metadata[1].fields[0].name);
            Assert.AreEqual("Joe Soap", update_resp.metadata[1].fields[0].value);

            Assert.AreEqual("Media Type", update_resp.metadata[1].fields[2].name);
            Assert.AreEqual("Text", update_resp.metadata[1].fields[2].value);

            Assert.AreEqual("Anonymous", update_resp.created_by);
            Assert.AreEqual("2007-01-17 00:00:00", update_resp.created_date);
            Assert.AreEqual("Administrator", update_resp.modified_by);
            Assert.AreEqual("2007-01-17 00:00:00", update_resp.created_date);
        }
Example #21
0
        public void ChangeTypeTest()
        {
            // NOTE: Create the following type 'NewType' via the admin pages

            kt_document_detail response = this._kt.change_document_type(this._session, this._doc1.docId, "NewType");

            Assert.AreEqual(0, response.status_code);
            if (0 != response.status_code)
            {
                System.Console.WriteLine("Please check that the document type 'NewType' exists in the database! This test should pass if it exists!");
                System.Console.WriteLine("SQL: insert into document_types_lookup(name) values('NewType');");
            }

            // NOTE: we need to test with an unknown type as well

            response = this._kt.change_document_type(this._session, this._doc1.docId, "UnknownType");
            Assert.IsTrue(0 != response.status_code);
        }
Example #22
0
        public void WorkflowTransitionTest()
        {
            kt_document_detail response = this._kt.start_document_workflow(this._session, this._doc1.docId, "Review Process");

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Review Process", response.workflow);
            Assert.AreEqual("Draft", response.workflow_state);

            response = this._kt.perform_document_workflow_transition(this._session, this._doc1.docId, "Request Approval", "Please approve me");
            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Review Process", response.workflow);
            Assert.AreEqual("Approval", response.workflow_state);

            response = this._kt.perform_document_workflow_transition(this._session, this._doc1.docId, "Approve", "Ok!");
            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Review Process", response.workflow);
            Assert.AreEqual("Published", response.workflow_state);
        }
Example #23
0
        public void SetUp()
        {
            this._filename = Helper.isUnix()?"/tmp/kt_unit_test1.txt":"c:\\kt_unit_test1.txt";

            String filename = "kt unit test1";

            this._content = "hello world!";

            Helper.writeFile(this._filename, this._content);
            this._folderId = 1;

            kt_document_detail response1 = this._kt.add_base64_document(this._session, this._folderId, filename, this._filename, "Default", Helper.ConvertFileToBase64Encoding(this._filename));

            if (this._verbose && response1.status_code != 0)
            {
                System.Console.WriteLine("Could not create file: " + this._filename);
            }
            this._docId = response1.document_id;
        }
Example #24
0
        public void MoveTest()
        {
            kt_folder_detail response2 = this._kt.create_folder(this._session, 1, "kt_unit_test_move");

            Assert.AreEqual(0, response2.status_code);
            int folderId = _folderId2 = response2.id;

            System.Console.WriteLine("The folder id is: " + folderId);


            System.Console.WriteLine("The document id is: " + this._doc1.docId);

            kt_document_detail linkresp = this._kt.move_document(this._session, this._doc1.docId, folderId, "move ", "");

            Assert.AreEqual(0, linkresp.status_code);
            Assert.AreEqual("kt_unit_test1.txt", linkresp.filename);
            Assert.AreEqual("kt unit test1", linkresp.title);
            Assert.AreEqual(folderId, linkresp.folder_id);
        }
Example #25
0
        public void CheckoutDocument()
        {
            String filename = "kt unit test1";

            if (this._verbose)
            {
                System.Console.WriteLine("Checking out document : " + filename);
            }

            kt_document_detail response = this._kt.checkout_base64_document(this._session, this._docId, "unit test - going to checkout and then undo", false);

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Administrator", response.checked_out_by);
            Assert.IsTrue(null != response.checked_out_date);

            response = this._kt.undo_document_checkout(this._session, this._docId, "unit test - doing undo");
            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("n/a", response.checked_out_by);
            Assert.AreEqual("n/a", response.checked_out_date);
        }
Example #26
0
        public void FindDocumentBeforeDelete()
        {
            if (this._verbose)
            {
                System.Console.WriteLine("Find document before delete");
            }
            kt_document_detail documentDetail = this._kt.get_document_detail_by_name(this._session, 1, "Root Folder/kt test folder/kt unit test1", "T", "");

            Assert.AreEqual(0, documentDetail.status_code);
            Assert.AreEqual(this._docId, documentDetail.document_id);



            if (this._verbose)
            {
                System.Console.WriteLine("Find document before delete without the Root Folder's explicit naming");
            }
            documentDetail = this._kt.get_document_detail_by_title(this._session, 1, "/kt test folder/kt unit test1", "");
            Assert.AreEqual(0, documentDetail.status_code);
            Assert.AreEqual(this._docId, documentDetail.document_id);
        }
Example #27
0
        public kt_document_detail createFileWithMetadata(int folderId, kt_metadata_fieldset[] metadata, kt_sysdata_item[] sysdata)
        {
            Helper.writeFile(this.filename, this.content);

            this.filesize = this.content.Length;

            if (this.local)
            {
                return(null);
            }

            kt_document_detail d1 = this.kt.get_document_detail_by_title(this.session, folderId, this.title, "");

            if (d1.status_code == 1)
            {
                this.docId = d1.document_id;
                this.deleteFile();
            }

            kt_document_detail response1 = this.kt.add_base64_document_with_metadata(this.session, folderId, this.title, this.filename, "Default", Helper.ConvertFileToBase64Encoding(this.filename), metadata, sysdata);

            if (response1.status_code == 0)
            {
                this.docId = response1.document_id;
            }

            if (this.verbose)
            {
                if (response1.status_code == 0)
                {
                    System.Console.WriteLine("docid: " + this.docId + " filename: " + this.filename);
                }
                else
                {
                    System.Console.WriteLine("Could not create file: " + this.filename);
                }
            }

            return(response1);
        }
Example #28
0
        public void CheckinDocument()
        {
            String filename = "kt unit test1";

            if (this._verbose)
            {
                System.Console.WriteLine("Checking out document : " + filename);
            }

            kt_document_detail response = this._kt.checkout_base64_document(this._session, this._docId, "unit test - going to checkout and then checkin", false);

            Assert.AreEqual(0, response.status_code);
            Assert.AreEqual("Administrator", response.checked_out_by);
            Assert.IsTrue(null != response.checked_out_date);


            kt_document_detail checkin = this._kt.checkin_base64_document(this._session, this._docId, filename, "unit test - doing checkin", Helper.ConvertFileToBase64Encoding(this._filename), false);

            Assert.AreEqual(0, checkin.status_code);
            Assert.AreEqual("n/a", checkin.checked_out_by);
            Assert.AreEqual("n/a", checkin.checked_out_date);
        }
Example #29
0
        public void UpdateUniqueOemNoMetadataTest()
        {
            kt_metadata_fieldset[] fs = new kt_metadata_fieldset[0];

            kt_sysdata_item[] sysdata = new kt_sysdata_item[1];
            sysdata[0]       = new kt_sysdata_item();
            sysdata[0].name  = "unique_oem_document_no";
            sysdata[0].value = "1234";

            kt_document_detail update_resp = this._kt.update_document_metadata(this._session, this._docId, fs, sysdata);

            Assert.AreEqual(0, update_resp.status_code);

            Assert.AreEqual("1234", update_resp.oem_document_no);


            kt_document_collection_response response = this._kt.get_documents_by_oem_no(this._session, "1234", "");

            Assert.AreEqual(1, response.collection.Length);
            Assert.AreEqual(this._docId, response.collection[0].document_id);
            Assert.AreEqual("1234", response.collection[0].oem_document_no);
        }
Example #30
0
        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!");
            }
        }