brooklyn.test
Class WebAppMonitor

java.lang.Object
  extended by brooklyn.test.WebAppMonitor
All Implemented Interfaces:
Runnable

public class WebAppMonitor
extends Object
implements Runnable

Repeatedly polls a given URL, to check if it is always available.


Constructor Summary
WebAppMonitor()
           
WebAppMonitor(String url)
           
 
Method Summary
 WebAppMonitor assertAttemptsMade(int minAttempts, String message)
           
 WebAppMonitor assertNoFailures(String message)
           
 WebAppMonitor assertSuccessFraction(String message, double percentage)
           
 WebAppMonitor delayMillis(long val)
           
 WebAppMonitor expectedResponseCode(int val)
           
 int getAttempts()
           
 long getDelayMillis()
           
 int getFailures()
           
 Object getLastFailure()
          result code (int) or exception
 Object getLastStatus()
           
 long getLastTime()
           
 boolean getLastWasFailed()
           
 Object getProblem()
           
 int getSuccesses()
           
 String getUrl()
           
 boolean isResponseOkay(Object code)
           
 WebAppMonitor logFailures(org.slf4j.Logger log)
           
 void onFailure(Object problem)
           
 boolean preAttempt()
          return false to skip a run
 WebAppMonitor resetCounts()
           
 void run()
           
 void setDelayMillis(long delayMillis)
           
 void setUrl(String url)
           
 void terminate()
           
 WebAppMonitor url(String val)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebAppMonitor

public WebAppMonitor(String url)

WebAppMonitor

public WebAppMonitor()
Method Detail

logFailures

public WebAppMonitor logFailures(org.slf4j.Logger log)

delayMillis

public WebAppMonitor delayMillis(long val)

expectedResponseCode

public WebAppMonitor expectedResponseCode(int val)

url

public WebAppMonitor url(String val)

run

public void run()
Specified by:
run in interface Runnable

isResponseOkay

public boolean isResponseOkay(Object code)

setDelayMillis

public void setDelayMillis(long delayMillis)

getDelayMillis

public long getDelayMillis()

terminate

public void terminate()
               throws InterruptedException
Throws:
InterruptedException

getFailures

public int getFailures()

getSuccesses

public int getSuccesses()

setUrl

public void setUrl(String url)

getUrl

public String getUrl()

getProblem

public Object getProblem()

getAttempts

public int getAttempts()

getLastWasFailed

public boolean getLastWasFailed()

getLastStatus

public Object getLastStatus()

getLastTime

public long getLastTime()

getLastFailure

public Object getLastFailure()
result code (int) or exception


onFailure

public void onFailure(Object problem)

preAttempt

public boolean preAttempt()
return false to skip a run


assertNoFailures

public WebAppMonitor assertNoFailures(String message)

assertAttemptsMade

public WebAppMonitor assertAttemptsMade(int minAttempts,
                                        String message)

assertSuccessFraction

public WebAppMonitor assertSuccessFraction(String message,
                                           double percentage)

resetCounts

public WebAppMonitor resetCounts()


Copyright © 2013. All Rights Reserved.