/*
    Copyright 2006 Ernest Micklei @ PhilemonWorks.com

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
   
*/
package com.philemonworks.selfdiagnose.test;

import java.net.URL;

import com.philemonworks.selfdiagnose.DiagnosticTaskResult;
import com.philemonworks.selfdiagnose.check.CheckURLReachable;

public class CheckURLReachableTest extends BasicDiagnosticTaskTest {
	public void testURLString(){
		CheckURLReachable task = new CheckURLReachable();
		task.setUrl("http://www.philemonworks.com");
		this.run(task);
	}
    public void testGoogle(){
        CheckURLReachable task = new CheckURLReachable();
        task.setUrl("http://www.google.com");
        task.setPattern(".*");
        DiagnosticTaskResult result = this.run(task);
        assertTrue(result.isPassed());
    }	
	public void testURLInContext() throws Exception {
		CheckURLReachable task = new CheckURLReachable();
		ctx.setValue("theurl", new URL("http://www.philemonworks.com"));
		task.setUrl("${theurl}");
		this.run(task);
	}	
}

@@ -693,24 +693,52 @@
 net.URL;%0D%0A%0D%0A
+import org.junit.Ignore;%0D%0A%0D%0A
 import com.p
@@ -786,16 +786,16 @@
 esult;%0D%0A
-
 import c
@@ -852,16 +852,25 @@
 ble;%0D%0A%0D%0A
+@Ignore%0D%0A
 public c
@@ -931,17 +931,20 @@
 Test %7B%0D%0A
-%09
+    
 public v
@@ -962,21 +962,28 @@
 String()
+ 
 %7B%0D%0A
-%09%09
+        
 CheckURL
@@ -1021,26 +1021,32 @@
 achable();%0D%0A
-%09%09
+        
 task.setUrl(
@@ -1075,26 +1075,32 @@
 rks.com%22);%0D%0A
-%09%09
+        
 this.run(tas
@@ -1104,18 +1104,23 @@
 task);%0D%0A
-%09%7D
+    %7D%0D%0A
 %0D%0A    pu
@@ -1141,16 +1141,17 @@
 Google()
+ 
 %7B%0D%0A     
@@ -1387,12 +1387,16 @@
    %7D
-%09%0D%0A%09
+%0D%0A%0D%0A    
 publ
@@ -1442,18 +1442,24 @@
 tion %7B%0D%0A
-%09%09
+        
 CheckURL
@@ -1501,18 +1501,24 @@
 ble();%0D%0A
-%09%09
+        
 ctx.setV
@@ -1575,18 +1575,24 @@
 om%22));%0D%0A
-%09%09
+        
 task.set
@@ -1614,10 +1614,16 @@
 );%0D%0A
-%09%09
+        
 this
@@ -1639,11 +1639,13 @@
 );%0D%0A
-%09%7D%09
+    %7D
 %0D%0A%7D%0D

disable test that needs internet access