コード例 #1
0
        //This method tests all the methods when the data searched does not exist in the data base
        public void Test7()
        {
            ResultsStorageImp st = new ResultsStorageImp();

            //testing the getURLResults method with a task that does not exist.
            Console.WriteLine("[] Trying to get the results that have been crawled from task that does not exist:");
            Console.WriteLine("[] For the Url : http://www.sex.com");
            List <Result> resultedUrls = st.getURLResults("3012e088-2319-4a78-9986-89683a7901a3", "http://www.sex.com");

            if (resultedUrls == null)
            {
                Console.WriteLine("-PASSED-");
            }

            //testing the getTotalURLs method with task that does not exist
            Console.WriteLine("[] Trying to get the Total number of crawled urls from task that does not exist :");

            ulong numUrls = st.getTotalURLs("7ec2bfb8-0a0d-406b-9132-2d65abb811f0", null);

            if (numUrls == 0)
            {
                Console.WriteLine("-PASSED-");
            }

            //testing the getURlsFromCategory method with category that does not exist
            Console.WriteLine("[] Trying to get all the urls that belong to the a category that does not exist :");

            List <Result> urls = st.getURLsFromCategory("7e32bfb1-0a0d-406b-9132-2d65abb811f0",
                                                        "75d7e9f8-a1aa-49eb-8ec6-274la036f3f5", Order.NormalOrder, 1, 4);

            if (urls.Count == 0)
            {
                Console.WriteLine("-PASSED-");
            }
        }
コード例 #2
0
 /**
  * This function returns a list of urls which suits a specific category.
  */
 public List <Result> getURLsFromCategory(String taskId, String categoryId, Order order, int from, int to)
 {
     return(_resultsStorageImp.getURLsFromCategory(taskId, categoryId, order, from, to));
 }
コード例 #3
0
        //This method tests the getURLsFromCategory method
        public void Test2()
        {
            ResultsStorageImp st = new ResultsStorageImp();
            Console.WriteLine("[] Trying to get all the urls that belong to the category with id :");
            Console.WriteLine("75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5");

            List<Result> urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.NormalOrder, 1, 4);
            Console.WriteLine("The urls in a normal order: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.AscendingRank, 1, 2);
            Console.WriteLine("The urls in a ascending order of the rank: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.DescendingRank, 0, 3);
            Console.WriteLine("The urls in a descending order of the rank: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.AscendingTrust, 1, 3);
            Console.WriteLine("The urls in a ascending order of the trustmeter: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.DescendingTrust, 1, 4);
            Console.WriteLine("The urls in a descending order of the trustmeter: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            Console.WriteLine("-PASSED-");
        }
コード例 #4
0
        //This method tests all the methods when the data searched does not exist in the data base
        public void Test7()
        {
            ResultsStorageImp st = new ResultsStorageImp();
            //testing the getURLResults method with a task that does not exist.
            Console.WriteLine("[] Trying to get the results that have been crawled from task that does not exist:");
            Console.WriteLine("[] For the Url : http://www.sex.com");
            List<Result> resultedUrls = st.getURLResults("3012e088-2319-4a78-9986-89683a7901a3", "http://www.sex.com");

            if (resultedUrls==null)
                Console.WriteLine("-PASSED-");

            //testing the getTotalURLs method with task that does not exist
            Console.WriteLine("[] Trying to get the Total number of crawled urls from task that does not exist :");

            ulong numUrls = st.getTotalURLs("7ec2bfb8-0a0d-406b-9132-2d65abb811f0", null);

            if (numUrls == 0) Console.WriteLine("-PASSED-");

            //testing the getURlsFromCategory method with category that does not exist
            Console.WriteLine("[] Trying to get all the urls that belong to the a category that does not exist :");

            List<Result> urls = st.getURLsFromCategory("7e32bfb1-0a0d-406b-9132-2d65abb811f0",
                                "75d7e9f8-a1aa-49eb-8ec6-274la036f3f5", Order.NormalOrder, 1, 4);

            if (urls.Count == 0) Console.WriteLine("-PASSED-");
        }
コード例 #5
0
        //This method tests the getURLsFromCategory method
        public void Test2()
        {
            ResultsStorageImp st = new ResultsStorageImp();

            Console.WriteLine("[] Trying to get all the urls that belong to the category with id :");
            Console.WriteLine("75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5");

            List <Result> urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                                        "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.NormalOrder, 1, 4);

            Console.WriteLine("The urls in a normal order: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                          "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.AscendingRank, 1, 2);
            Console.WriteLine("The urls in a ascending order of the rank: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                          "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.DescendingRank, 0, 3);
            Console.WriteLine("The urls in a descending order of the rank: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                          "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.AscendingTrust, 1, 3);
            Console.WriteLine("The urls in a ascending order of the trustmeter: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            urls = st.getURLsFromCategory("7ec2bfb1-0a0d-406b-9132-2d65abb811f0",
                                          "75d7e9f8-a1aa-49eb-8ec6-274e8036f3f5", Order.DescendingTrust, 1, 4);
            Console.WriteLine("The urls in a descending order of the trustmeter: ");
            foreach (Result resultUrl in urls)
            {
                Console.WriteLine("The url is : " + resultUrl.getUrl());
                Console.WriteLine("The resultID is : " + resultUrl.getResultID());
                Console.WriteLine("The categoryID is : " + resultUrl.getCategoryID());
                Console.WriteLine("The rank of the url is :" + resultUrl.getRank());
                Console.WriteLine("The trustmeter of the url is :" + resultUrl.getTrustMeter());
                Console.WriteLine("============================================================");
            }

            Console.WriteLine("-PASSED-");
        }