Пример #1
0
        public void WebClientTest()
        {
            string          serverURL = "http://localhost:8080";
            string          username  = "******";
            string          password  = "******";
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password);

            Assert.IsNotNull(target.WebClient);
        }
Пример #2
0
        public void XWikiHTTPClientConstructorTest()
        {
            string          serverURL = string.Empty; // TODO: Initialize to an appropriate value
            string          username  = string.Empty; // TODO: Initialize to an appropriate value
            string          password  = string.Empty; // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password);

            Assert.Inconclusive("TODO: Implement code to verify target");
        }
Пример #3
0
        public void CookiesTest()
        {
            string          serverURL = "http://localhost:8080";
            string          username  = "******";
            string          password  = "******";
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password);
            List <String>   actual    = target.Cookies;

            Assert.IsNotNull(target);
            Assert.IsNotNull(actual);
        }
Пример #4
0
        public void ServerURLTest()
        {
            string          serverURL = "http://localhost:8080";
            string          username  = "******";
            string          password  = "******";
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password);
            string          actual    = target.ServerURL;

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual, serverURL);
        }
Пример #5
0
        public void HeadersTest()
        {
            string              serverURL = "http://localhost:8080";
            string              username  = "******";
            string              password  = "******";
            XWikiHTTPClient     target    = new XWikiHTTPClient(serverURL, username, password);
            WebHeaderCollection actual    = target.Headers;

            Assert.IsNotNull(target);
            Assert.IsNotNull(actual);
        }
Пример #6
0
        public void GetSpacesTest()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            List <string>   expected  = null;                                               // TODO: Initialize to an appropriate value
            List <string>   actual;

            actual = target.GetSpaces();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #7
0
        public void GetAttachmentContentTest1()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string          URL       = string.Empty;                                       // TODO: Initialize to an appropriate value

            byte[] expected = null;                                                         // TODO: Initialize to an appropriate value
            byte[] actual;
            actual = target.GetAttachmentContent(URL);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #8
0
        public void GetRenderedPageContentTest1()
        {
            string          serverURL    = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username     = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password     = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target       = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string          pageFullName = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          expected     = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          actual;

            actual = target.GetRenderedPageContent(pageFullName);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #9
0
        public void OpenReadTest()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            Uri             address   = null;                                               // TODO: Initialize to an appropriate value
            Stream          expected  = null;                                               // TODO: Initialize to an appropriate value
            Stream          actual;

            actual = target.OpenRead(address);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #10
0
        public void UploadDataTest()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            Uri             address   = null;                                               // TODO: Initialize to an appropriate value

            byte[] data     = null;                                                         // TODO: Initialize to an appropriate value
            byte[] expected = null;                                                         // TODO: Initialize to an appropriate value
            byte[] actual;
            actual = target.UploadData(address, data);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #11
0
        public void AddAttachmentTest2()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string          docName   = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          filePath  = string.Empty;                                       // TODO: Initialize to an appropriate value
            bool            expected  = false;                                              // TODO: Initialize to an appropriate value
            bool            actual;

            actual = target.AddAttachment(docName, filePath);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #12
0
        public void GetURLTest()
        {
            string          serverURL        = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username         = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password         = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target           = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string          documentFullName = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          xwikiAction      = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          expected         = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          actual;

            actual = target.GetURL(documentFullName, xwikiAction);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #13
0
        public void LoginTest()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string          username1 = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password1 = string.Empty;                                       // TODO: Initialize to an appropriate value
            bool            expected  = false;                                              // TODO: Initialize to an appropriate value
            bool            actual;

            actual = target.Login(username1, password1);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #14
0
        public void UploadValuesTest1()
        {
            string          serverURL = "http://localhost:8080";
            string          username  = "******";
            string          password  = "******";
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password);

            target.WebClient = new WebClientMock();
            string address             = string.Empty;
            string method              = string.Empty;
            NameValueCollection values = null;

            byte[] expected = WebClientMock.responseOK;
            byte[] actual;
            actual = target.UploadValues(address, method, values);
        }
Пример #15
0
        public void UploadValuesTest()
        {
            string          serverURL = "http://localhost:8080";
            string          username  = "******";
            string          password  = "******";
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password);

            target.WebClient = new WebClientMock();
            string address             = "http://localhost:8080";
            NameValueCollection values = new NameValueCollection();

            byte[] expected = WebClientMock.responseOK;
            byte[] actual;
            actual = target.UploadValues(address, values);
            Assert.AreEqual(expected, actual);
        }
Пример #16
0
        public void AddObjectTest()
        {
            string              serverURL    = string.Empty;                                       // TODO: Initialize to an appropriate value
            string              username     = string.Empty;                                       // TODO: Initialize to an appropriate value
            string              password     = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient     target       = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string              docName      = string.Empty;                                       // TODO: Initialize to an appropriate value
            string              ClassName    = string.Empty;                                       // TODO: Initialize to an appropriate value
            NameValueCollection fieldsValues = null;                                               // TODO: Initialize to an appropriate value
            int expected = 0;                                                                      // TODO: Initialize to an appropriate value
            int actual;

            actual = target.AddObject(docName, ClassName, fieldsValues);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #17
0
        public void SavePageHTMLTest()
        {
            string          serverURL = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          username  = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          password  = string.Empty;                                       // TODO: Initialize to an appropriate value
            XWikiHTTPClient target    = new XWikiHTTPClient(serverURL, username, password); // TODO: Initialize to an appropriate value
            string          docName   = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          content   = string.Empty;                                       // TODO: Initialize to an appropriate value
            string          syntax    = string.Empty;                                       // TODO: Initialize to an appropriate value
            bool            expected  = false;                                              // TODO: Initialize to an appropriate value
            bool            actual;

            actual = target.SavePageHTML(docName, content, syntax);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        /// <summary>
        /// Gets a list with the protected pages and spaces in the wiki
        /// The names support whildcards.
        /// </summary>
        /// <returns>A list with the protected pages and spaces in the wiki.</returns>
        public List <String> GetProtectedPages()
        {
            String[] separators = { " ", "\n", "\t", "\r", ";", "\\" };
            String   url        = Addin.serverURL + XWikiURLs.ProtectedPagesURL;

            if (Client.ClientType == XWikiClientType.HTTP_Client)
            {
                XWikiHTTPClient httpClient = (XWikiHTTPClient)Client;
                Stream          data       = httpClient.OpenRead(url);
                StreamReader    reader     = new StreamReader(data);
                String          pages      = reader.ReadToEnd();
                String[]        pagesArray = pages.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                return(new List <string>(pagesArray));
            }
            else
            {
                return(new List <string>());
            }
        }