@Loggable(value=1) public final class MkGrizzlyContainer extends Object implements MkContainer
MkContainer
based on Grizzly Server.MkContainer
Constructor and Description |
---|
MkGrizzlyContainer() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
URI |
home()
Get its home.
|
MkContainer |
next(MkAnswer answer)
Give this answer on the next request.
|
MkContainer |
next(MkAnswer answer,
org.hamcrest.Matcher<MkQuery> condition)
Give this answer on the next request if the matcher condition is
satisfied.
|
MkContainer |
next(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.
|
int |
queries()
How many queries we have left.
|
MkContainer |
start()
Start it on the first available TCP port.
|
MkContainer |
start(int prt)
Start it on a provided port.
|
void |
stop()
Stop container.
|
MkQuery |
take()
Get the oldest request received
(
NoSuchElementException
if no more elements in the list). |
MkQuery |
take(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.
|
public MkContainer next(MkAnswer answer)
MkContainer
next
in interface MkContainer
answer
- Next answer to givepublic MkContainer next(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition)
MkContainer
next
in interface MkContainer
answer
- Next answer to givecondition
- The condition to matchpublic MkContainer next(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition, int count)
MkContainer
next
in interface MkContainer
answer
- Next answer to givecondition
- The condition to matchcount
- Number of requests to matchpublic MkQuery take()
MkContainer
NoSuchElementException
if no more elements in the list).take
in interface MkContainer
public MkQuery take(org.hamcrest.Matcher<MkAnswer> matcher)
MkContainer
NoSuchElementException
if no elements satisfy the
condition).take
in interface MkContainer
matcher
- The matcher specifying the conditionpublic Collection<MkQuery> takeAll(org.hamcrest.Matcher<MkAnswer> matcher)
MkContainer
NoSuchElementException
if no elements satisfy the
condition).takeAll
in interface MkContainer
matcher
- The matcher specifying the conditionpublic int queries()
MkContainer
queries
in interface MkContainer
MkContainer.take()
public MkContainer start() throws IOException
MkContainer
start
in interface MkContainer
IOException
- If failspublic MkContainer start(int prt) throws IOException
MkContainer
start
in interface MkContainer
prt
- The port where it should start listeningIOException
- If failspublic void stop()
MkContainer
stop
in interface MkContainer
public URI home()
MkContainer
home
in interface MkContainer
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2012–2021 jcabi.com. All rights reserved.