Package com.jcabi.http.mock
Class MkGrizzlyContainer
java.lang.Object
com.jcabi.http.mock.MkGrizzlyContainer
- All Implemented Interfaces:
MkContainer,Closeable,AutoCloseable
Implementation of
MkContainer based on Grizzly Server.- Since:
- 0.10
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()home()Get its home.Give this answer on the next request.Give this answer on the next request if the matcher condition is satisfied.Give this answer on the next request(s) if the matcher condition is satisfied up to a certain number of requests.intqueries()How many queries we have left.start()Start it on the first available TCP port.start(int prt) Start it on a provided port.voidstop()Stop container.take()Get the oldest request received (NoSuchElementExceptionif no more elements in the list).Get the oldest request received subject to the matching conditionGet the all requests received satisfying the given matcher
-
Constructor Details
-
MkGrizzlyContainer
public MkGrizzlyContainer()
-
-
Method Details
-
next
Description copied from interface:MkContainerGive this answer on the next request.- Specified by:
nextin interfaceMkContainer- Parameters:
answer- Next answer to give- Returns:
- This object
-
next
Description copied from interface:MkContainerGive this answer on the next request if the matcher condition is satisfied.- Specified by:
nextin interfaceMkContainer- Parameters:
answer- Next answer to givecondition- The condition to match- Returns:
- This object
-
next
Description copied from interface:MkContainerGive this answer on the next request(s) if the matcher condition is satisfied up to a certain number of requests.- Specified by:
nextin interfaceMkContainer- Parameters:
answer- Next answer to givecondition- The condition to matchcount- Number of requests to match- Returns:
- This object
-
take
Description copied from interface:MkContainerGet the oldest request received (NoSuchElementExceptionif no more elements in the list).- Specified by:
takein interfaceMkContainer- Returns:
- Request received
-
take
Description copied from interface:MkContainerGet the oldest request received subject to the matching condition. (NoSuchElementExceptionif no elements satisfy the condition).- Specified by:
takein interfaceMkContainer- Parameters:
matcher- The matcher specifying the condition- Returns:
- Request received satisfying the matcher
-
takeAll
Description copied from interface:MkContainerGet the all requests received satisfying the given matcher. (NoSuchElementExceptionif no elements satisfy the condition).- Specified by:
takeAllin interfaceMkContainer- Parameters:
matcher- The matcher specifying the condition- Returns:
- Collection of all requests satisfying the matcher, ordered from oldest to newest.
-
queries
public int queries()Description copied from interface:MkContainerHow many queries we have left.- Specified by:
queriesin interfaceMkContainer- Returns:
- Total number of queries you can retrieve with
MkContainer.take()
-
start
Description copied from interface:MkContainerStart it on the first available TCP port.- Specified by:
startin interfaceMkContainer- Returns:
- This object
- Throws:
IOException- If fails
-
start
Description copied from interface:MkContainerStart it on a provided port.- Specified by:
startin interfaceMkContainer- Parameters:
prt- The port where it should start listening- Returns:
- This object
- Throws:
IOException- If fails
-
stop
public void stop()Description copied from interface:MkContainerStop container.- Specified by:
stopin interfaceMkContainer
-
home
Description copied from interface:MkContainerGet its home.- Specified by:
homein interfaceMkContainer- Returns:
- URI of the started container
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-