org.backsource.alert.agent
Class UrlCase

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.backsource.alert.agent.BaseCase
              extended byorg.backsource.alert.agent.UrlCase
All Implemented Interfaces:
Agent, junit.framework.Test
Direct Known Subclasses:
DbAliveTest, ServerAliveTest

public class UrlCase
extends BaseCase

BaseClass for URL based testcases.

This class may be used in itself, or as a superclass for other agents that needs to test an URL. It is NOT based on the java.net.URL, becuse* of the need to be able to timeout.It uses two properties PropertyConstants.HTTP_TIMEOUT and PropertyConstants.HTTP_URL.

It is also possible to give authentication information:

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Field Summary
 
Fields inherited from class org.backsource.alert.agent.BaseCase
agentName, prop
 
Constructor Summary
UrlCase(java.lang.String name)
           
 
Method Summary
protected  void checkUrl(java.net.URL url)
          Check the given url, ok if 200 is returned.
protected  void checkUrl(java.net.URL url, java.lang.String find)
          Fetch the given url and check if it contains the string given i find.
static void main(java.lang.String[] args)
           
protected  void setUp()
           
 void testUrl()
          Run the test agains the url given in property PropertyConstants.HTTP_URL.
 
Methods inherited from class org.backsource.alert.agent.BaseCase
getAgentName, getProperties, initialize, toString
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, tearDown
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Constructor Detail

UrlCase

public UrlCase(java.lang.String name)
Method Detail

setUp

protected void setUp()
              throws java.lang.Exception
Overrides:
setUp in class BaseCase
Throws:
java.lang.Exception

testUrl

public void testUrl()
             throws java.lang.Exception
Run the test agains the url given in property PropertyConstants.HTTP_URL.

Throws:
java.lang.Exception

checkUrl

protected void checkUrl(java.net.URL url)
Check the given url, ok if 200 is returned.


checkUrl

protected void checkUrl(java.net.URL url,
                        java.lang.String find)
Fetch the given url and check if it contains the string given i find.


main

public static void main(java.lang.String[] args)


Copyright © 2002-2004 Backsource. All Rights Reserved.