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 of MkContainer based on Grizzly Server.
Since:
0.10
See Also:
  • Constructor Details

    • MkGrizzlyContainer

      public MkGrizzlyContainer()
  • Method Details

    • next

      public MkContainer next(MkAnswer answer)
      Description copied from interface: MkContainer
      Give this answer on the next request.
      Specified by:
      next in interface MkContainer
      Parameters:
      answer - Next answer to give
      Returns:
      This object
    • next

      public MkContainer next(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition)
      Description copied from interface: MkContainer
      Give this answer on the next request if the matcher condition is satisfied.
      Specified by:
      next in interface MkContainer
      Parameters:
      answer - Next answer to give
      condition - The condition to match
      Returns:
      This object
    • next

      public MkContainer next(MkAnswer answer, org.hamcrest.Matcher<MkQuery> condition, int count)
      Description copied from interface: MkContainer
      Give this answer on the next request(s) if the matcher condition is satisfied up to a certain number of requests.
      Specified by:
      next in interface MkContainer
      Parameters:
      answer - Next answer to give
      condition - The condition to match
      count - Number of requests to match
      Returns:
      This object
    • take

      public MkQuery take()
      Description copied from interface: MkContainer
      Get the oldest request received (NoSuchElementException if no more elements in the list).
      Specified by:
      take in interface MkContainer
      Returns:
      Request received
    • take

      public MkQuery take(org.hamcrest.Matcher<MkAnswer> matcher)
      Description copied from interface: MkContainer
      Get the oldest request received subject to the matching condition. (NoSuchElementException if no elements satisfy the condition).
      Specified by:
      take in interface MkContainer
      Parameters:
      matcher - The matcher specifying the condition
      Returns:
      Request received satisfying the matcher
    • takeAll

      public Collection<MkQuery> takeAll(org.hamcrest.Matcher<MkAnswer> matcher)
      Description copied from interface: MkContainer
      Get the all requests received satisfying the given matcher. (NoSuchElementException if no elements satisfy the condition).
      Specified by:
      takeAll in interface MkContainer
      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: MkContainer
      How many queries we have left.
      Specified by:
      queries in interface MkContainer
      Returns:
      Total number of queries you can retrieve with MkContainer.take()
    • start

      public MkContainer start() throws IOException
      Description copied from interface: MkContainer
      Start it on the first available TCP port.
      Specified by:
      start in interface MkContainer
      Returns:
      This object
      Throws:
      IOException - If fails
    • start

      public MkContainer start(int prt) throws IOException
      Description copied from interface: MkContainer
      Start it on a provided port.
      Specified by:
      start in interface MkContainer
      Parameters:
      prt - The port where it should start listening
      Returns:
      This object
      Throws:
      IOException - If fails
    • stop

      public void stop()
      Description copied from interface: MkContainer
      Stop container.
      Specified by:
      stop in interface MkContainer
    • home

      public URI home()
      Description copied from interface: MkContainer
      Get its home.
      Specified by:
      home in interface MkContainer
      Returns:
      URI of the started container
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable