Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
        }
        //[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);
            }
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public void CheckinDocumentWithMetadataTest()
        {
            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);

            FileUploader uploader = new FileUploader( );

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

            kt_document_detail update_resp = this._kt.checkin_document(this._session, this._doc1.docId, this._doc1.filename, "unit test - doing checkin", uploader.filename, false);

            Assert.AreEqual(0, update_resp.status_code);
        }
        public void CheckinDocumentWithMetadataTest()
        {
            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);

            FileUploader uploader = new FileUploader( );

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

            kt_document_detail update_resp = this._kt.checkin_document(this._session, this._doc1.docId, this._doc1.filename, "unit test - doing checkin", uploader.filename, false);
            Assert.AreEqual(0, update_resp.status_code);
        }