com.github.dreamhead.moco
Class Moco

java.lang.Object
  extended by com.github.dreamhead.moco.Moco

public class Moco
extends java.lang.Object


Method Summary
static RequestMatcher and(RequestMatcher... matchers)
           
static MocoEventAction async(MocoEventAction action)
           
static MocoEventAction async(MocoEventAction action, LatencyProcedure procedure)
           
static RequestMatcher by(Resource resource)
           
static RequestMatcher by(java.lang.String content)
           
static MocoEventTrigger complete(MocoEventAction action)
           
static MocoConfig context(java.lang.String context)
           
static RequestExtractor<java.lang.String> cookie(java.lang.String key)
           
static ResponseHandler cookie(java.lang.String key, Resource resource)
           
static ResponseHandler cookie(java.lang.String key, java.lang.String value)
           
static
<T> RequestMatcher
eq(RequestExtractor<T> extractor, Resource expected)
           
static
<T> RequestMatcher
eq(RequestExtractor<T> extractor, java.lang.String expected)
           
static Failover failover(java.lang.String file)
           
static ContentResource file(java.lang.String filename)
           
static MocoConfig fileRoot(java.lang.String fileRoot)
           
static RequestExtractor<java.lang.String> form(java.lang.String key)
           
static MocoEventAction get(java.lang.String url)
           
static RequestExtractor<java.lang.String> header(java.lang.String header)
           
static ResponseHandler header(java.lang.String name, Resource value)
           
static ResponseHandler header(java.lang.String name, java.lang.String value)
           
static HttpServer httpserver(int port, MocoConfig... configs)
           
static HttpServer httpserver(int port, MocoMonitor monitor, MocoConfig... configs)
           
static HttpServer httpserver(MocoConfig... configs)
           
static HttpServer httpserver(MocoMonitor monitor, MocoConfig... configs)
           
static RequestMatcher json(Resource resource)
           
static JsonPathRequestExtractor jsonPath(java.lang.String jsonPath)
           
static LatencyProcedure latency(long millis)
           
static
<T> RequestMatcher
match(RequestExtractor<T> extractor, java.lang.String expected)
           
static RequestMatcher match(Resource resource)
           
static Resource method(java.lang.String httpMethod)
           
static RequestMatcher or(RequestMatcher... matchers)
           
static ContentResource pathResource(java.lang.String filename)
           
static MocoEventAction post(java.lang.String url, ContentResource content)
           
static MocoEventAction post(java.lang.String url, java.lang.String content)
           
static ResponseHandler proxy(java.lang.String url)
           
static ResponseHandler proxy(java.lang.String url, Failover failover)
           
static RequestExtractor<java.lang.String> query(java.lang.String param)
           
static ResponseHandler seq(Resource... contents)
           
static ResponseHandler seq(ResponseHandler... handlers)
           
static ResponseHandler seq(java.lang.String... contents)
           
static ResponseHandler status(int code)
           
static Resource template(ContentResource resource)
           
static Resource template(java.lang.String template)
           
static ContentResource text(java.lang.String text)
           
static Resource uri(java.lang.String uri)
           
static Resource version(Resource resource)
           
static Resource version(java.lang.String version)
           
static ResponseHandler with(MocoProcedure procedure)
           
static ResponseHandler with(Resource resource)
           
static ResponseHandler with(java.lang.String text)
           
static RequestMatcher xml(Resource resource)
           
static XPathRequestExtractor xpath(java.lang.String xpath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

httpserver

public static HttpServer httpserver(int port,
                                    MocoConfig... configs)

httpserver

public static HttpServer httpserver(int port,
                                    MocoMonitor monitor,
                                    MocoConfig... configs)

httpserver

public static HttpServer httpserver(MocoConfig... configs)

httpserver

public static HttpServer httpserver(MocoMonitor monitor,
                                    MocoConfig... configs)

context

public static MocoConfig context(java.lang.String context)

fileRoot

public static MocoConfig fileRoot(java.lang.String fileRoot)

by

public static RequestMatcher by(java.lang.String content)

by

public static RequestMatcher by(Resource resource)

eq

public static <T> RequestMatcher eq(RequestExtractor<T> extractor,
                                    java.lang.String expected)

eq

public static <T> RequestMatcher eq(RequestExtractor<T> extractor,
                                    Resource expected)

match

public static RequestMatcher match(Resource resource)

match

public static <T> RequestMatcher match(RequestExtractor<T> extractor,
                                       java.lang.String expected)

and

public static RequestMatcher and(RequestMatcher... matchers)

or

public static RequestMatcher or(RequestMatcher... matchers)

text

public static ContentResource text(java.lang.String text)

with

public static ResponseHandler with(java.lang.String text)

with

public static ResponseHandler with(Resource resource)

with

public static ResponseHandler with(MocoProcedure procedure)

uri

public static Resource uri(java.lang.String uri)

method

public static Resource method(java.lang.String httpMethod)

header

public static RequestExtractor<java.lang.String> header(java.lang.String header)

header

public static ResponseHandler header(java.lang.String name,
                                     java.lang.String value)

header

public static ResponseHandler header(java.lang.String name,
                                     Resource value)

cookie

public static RequestExtractor<java.lang.String> cookie(java.lang.String key)

cookie

public static ResponseHandler cookie(java.lang.String key,
                                     java.lang.String value)

cookie

public static ResponseHandler cookie(java.lang.String key,
                                     Resource resource)

form

public static RequestExtractor<java.lang.String> form(java.lang.String key)

latency

public static LatencyProcedure latency(long millis)

query

public static RequestExtractor<java.lang.String> query(java.lang.String param)

xpath

public static XPathRequestExtractor xpath(java.lang.String xpath)

xml

public static RequestMatcher xml(Resource resource)

json

public static RequestMatcher json(Resource resource)

jsonPath

public static JsonPathRequestExtractor jsonPath(java.lang.String jsonPath)

seq

public static ResponseHandler seq(java.lang.String... contents)

seq

public static ResponseHandler seq(Resource... contents)

seq

public static ResponseHandler seq(ResponseHandler... handlers)

file

public static ContentResource file(java.lang.String filename)

pathResource

public static ContentResource pathResource(java.lang.String filename)

version

public static Resource version(Resource resource)

version

public static Resource version(java.lang.String version)

status

public static ResponseHandler status(int code)

proxy

public static ResponseHandler proxy(java.lang.String url)

proxy

public static ResponseHandler proxy(java.lang.String url,
                                    Failover failover)

template

public static Resource template(java.lang.String template)

template

public static Resource template(ContentResource resource)

failover

public static Failover failover(java.lang.String file)

complete

public static MocoEventTrigger complete(MocoEventAction action)

async

public static MocoEventAction async(MocoEventAction action)

async

public static MocoEventAction async(MocoEventAction action,
                                    LatencyProcedure procedure)

get

public static MocoEventAction get(java.lang.String url)

post

public static MocoEventAction post(java.lang.String url,
                                   ContentResource content)

post

public static MocoEventAction post(java.lang.String url,
                                   java.lang.String content)