Package com.jcabi.http.mock
Class MkGrizzlyContainer
- java.lang.Object
- 
- com.jcabi.http.mock.MkGrizzlyContainer
 
- 
- All Implemented Interfaces:
- MkContainer,- Closeable,- AutoCloseable
 
 @Loggable(1) public final class MkGrizzlyContainer extends Object implements MkContainer Implementation ofMkContainerbased on Grizzly Server.- Since:
- 0.10
- See Also:
- MkContainer
 
- 
- 
Constructor SummaryConstructors Constructor Description MkGrizzlyContainer()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()URIhome()Get its home.MkContainernext(MkAnswer answer)Give this answer on the next request.MkContainernext(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition)Give this answer on the next request if the matcher condition is satisfied.MkContainernext(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition, int count)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.MkContainerstart()Start it on the first available TCP port.MkContainerstart(int prt)Start it on a provided port.voidstop()Stop container.MkQuerytake()Get the oldest request received (NoSuchElementExceptionif no more elements in the list).MkQuerytake(org.hamcrest.Matcher<MkAnswer> matcher)Get the oldest request received subject to the matching condition.Collection<MkQuery>takeAll(org.hamcrest.Matcher<MkAnswer> matcher)Get the all requests received satisfying the given matcher.
 
- 
- 
- 
Method Detail- 
nextpublic MkContainer next(MkAnswer answer) Description copied from interface:MkContainerGive this answer on the next request.- Specified by:
- nextin interface- MkContainer
- Parameters:
- answer- Next answer to give
- Returns:
- This object
 
 - 
nextpublic MkContainer next(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition) Description copied from interface:MkContainerGive this answer on the next request if the matcher condition is satisfied.- Specified by:
- nextin interface- MkContainer
- Parameters:
- answer- Next answer to give
- condition- The condition to match
- Returns:
- This object
 
 - 
nextpublic MkContainer next(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition, int count) 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 interface- MkContainer
- Parameters:
- answer- Next answer to give
- condition- The condition to match
- count- Number of requests to match
- Returns:
- This object
 
 - 
takepublic MkQuery take() Description copied from interface:MkContainerGet the oldest request received (NoSuchElementExceptionif no more elements in the list).- Specified by:
- takein interface- MkContainer
- Returns:
- Request received
 
 - 
takepublic MkQuery take(org.hamcrest.Matcher<MkAnswer> matcher) Description copied from interface:MkContainerGet the oldest request received subject to the matching condition. (NoSuchElementExceptionif no elements satisfy the condition).- Specified by:
- takein interface- MkContainer
- Parameters:
- matcher- The matcher specifying the condition
- Returns:
- Request received satisfying the matcher
 
 - 
takeAllpublic Collection<MkQuery> takeAll(org.hamcrest.Matcher<MkAnswer> matcher) Description copied from interface:MkContainerGet the all requests received satisfying the given matcher. (NoSuchElementExceptionif no elements satisfy the condition).- Specified by:
- takeAllin interface- MkContainer
- Parameters:
- matcher- The matcher specifying the condition
- Returns:
- Collection of all requests satisfying the matcher, ordered from oldest to newest.
 
 - 
queriespublic int queries() Description copied from interface:MkContainerHow many queries we have left.- Specified by:
- queriesin interface- MkContainer
- Returns:
- Total number of queries you can retrieve with MkContainer.take()
 
 - 
startpublic MkContainer start() throws IOException Description copied from interface:MkContainerStart it on the first available TCP port.- Specified by:
- startin interface- MkContainer
- Returns:
- This object
- Throws:
- IOException- If fails
 
 - 
startpublic MkContainer start(int prt) throws IOException Description copied from interface:MkContainerStart it on a provided port.- Specified by:
- startin interface- MkContainer
- Parameters:
- prt- The port where it should start listening
- Returns:
- This object
- Throws:
- IOException- If fails
 
 - 
stoppublic void stop() Description copied from interface:MkContainerStop container.- Specified by:
- stopin interface- MkContainer
 
 - 
homepublic URI home() Description copied from interface:MkContainerGet its home.- Specified by:
- homein interface- MkContainer
- Returns:
- URI of the started container
 
 - 
closepublic void close() - Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
 
- 
 
-