added some more url parser unit tests for jon, a=chris

Chris Pollett [2015-01-18 20:Jan:th]
added some more url parser unit tests for jon, a=chris
Filename
bin/queue_server.php
controllers/components/crawl_component.php
tests/url_parser_test.php
diff --git a/bin/queue_server.php b/bin/queue_server.php
index adc829c1b..f826dc002 100755
--- a/bin/queue_server.php
+++ b/bin/queue_server.php
@@ -1095,7 +1095,7 @@ class QueueServer implements CrawlConstants, Join
             $site_parts = explode("#", $this->disallowed_sites[$i]);
             if(count($site_parts) > 1) {
                 $quota = intval(array_pop($site_parts));
-                if($quota <= 0) continue;
+                if($quota <= 0) { continue; }
                 $this->disallowed_sites[$i] = false;
                 $quota_site = implode("#", $site_parts);
                 $active_quota_sites[] = $quota_site;
diff --git a/controllers/components/crawl_component.php b/controllers/components/crawl_component.php
index 89a624472..6c1eef8cc 100644
--- a/controllers/components/crawl_component.php
+++ b/controllers/components/crawl_component.php
@@ -215,7 +215,6 @@ class CrawlComponent extends Component implements CrawlConstants
                 }
             }
         }
-
         /*
            Write the new crawl parameters to the name server, so
            that it can pass them along in the case of a new archive
@@ -225,7 +224,6 @@ class CrawlComponent extends Component implements CrawlConstants
             "/schedules/name_server_messages.txt";
         file_put_contents($filename, serialize($crawl_params));
         chmod($filename, 0777);
-
         $crawl_model->sendStartCrawlMessage($crawl_params,
             $seed_info, $machine_urls);
     }
diff --git a/tests/url_parser_test.php b/tests/url_parser_test.php
index 54076bd24..c35800fbc 100644
--- a/tests/url_parser_test.php
+++ b/tests/url_parser_test.php
@@ -192,7 +192,10 @@ class UrlParserTest extends UnitTest
             "http://www.cs.sjsu.edu/faculty/pollett/*/*/",
             "http://www.bing.com/video/search?*&*&",
             "http://*.cool.*/a/*/", "domain:ucla.edu",
-            "domain:foodnetwork.com");
+            "domain:foodnetwork.com",
+            "domain:.ottawa.ca",
+            "domain:.ottawa2.ca",
+            "http://ottawa2.ca/");
        $test_urls = array(
             array("http://www.cs.sjsu.edu/faculty/pollett/", false,
                 "regex url negative 1"),
@@ -216,6 +219,14 @@ class UrlParserTest extends UnitTest
                 "domain gopher stest positive"),
             array("http://www.foodnetworkstore.com/small-appliances/", false,
                 "domain test negative"),
+            array("http://a.ottawa.ca/", true,
+                "domain starting dot test positive"),
+            array("http://ottawa.ca/", false,
+                "domain starting dot test negative"),
+            array("http://a.ottawa2.ca/", true,
+                "domain starting dot test positive 2"),
+            array("http://ottawa2.ca/", true,
+                "domain starting dot test positive 3"),
         );
         foreach($test_urls as $test_url) {
             $result = UrlParser::urlMemberSiteArray($test_url[0], $sites,
ViewGit