Class FederatedCswMockServer

java.lang.Object
org.codice.ddf.itests.common.csw.mock.FederatedCswMockServer

public class FederatedCswMockServer extends Object
Encompasses a Restito CSW Stub Server for use in integration testing. Handles handshake responses and federated query responses for a csw endpoint.
  • Field Details

    • LOGGER

      protected static final org.slf4j.Logger LOGGER
  • Constructor Details

    • FederatedCswMockServer

      public FederatedCswMockServer(String sourceId, String httpRoot, int port)
      Constructor for the federated CSW Restito stub server.
      Parameters:
      sourceId - DDF sourceId to give to the stub server.
      httpRoot - httpRoot address. Typically the non-secure root "http://localhost:".
      port - Port number on which to respond.
  • Method Details

    • setupDefaultCapabilityResponseExpectation

      public void setupDefaultCapabilityResponseExpectation(String response)
      Sets the default response for the GetCapabilities request. Will be used when this stub server is started and must be set before start() is called. If a different response is needed after startup, the normal whenHttp() should be used instead of replacing this default response.
      Parameters:
      response - response to be returned
    • setupDefaultQueryResponseExpectation

      public void setupDefaultQueryResponseExpectation(String response)
      Sets the default response for the GetRecords request. Will be used when this stub server is started and must be set before start() is called. If a different response is needed after startup, the normal whenHttp() should be used instead of replacing this default response.
      Parameters:
      response - response to be returned
    • setupDefaultInsertTransactionResponseExpectation

      public void setupDefaultInsertTransactionResponseExpectation(String response)
    • setupDefaultUpdateTransactionResponseExpectation

      public void setupDefaultUpdateTransactionResponseExpectation(String response)
    • setupDefaultDeleteTransactionResponseExpectation

      public void setupDefaultDeleteTransactionResponseExpectation(String response)
    • start

      public void start()
      Starts the Restito stub server.
    • stop

      public void stop()
      Stops the Restito stub server.
    • reset

      public void reset()
      Resets the Restito server by stopping and starting it.
    • whenHttp

      public com.xebialabs.restito.builder.stub.StubHttp whenHttp()
      Returns StubHttp's whenHttp method with the stub server as the parameter. Use is the same. Sets up an Action when a specific Http call is made.
      Returns:
      StubHttp using whenHttp method with the stub server as the parameter.
    • verifyHttp

      public com.xebialabs.restito.builder.verify.VerifyHttp verifyHttp()
      Returns VerifyHttp's verifyHttp method with the stub server as the parameter. Use is the same. Provides itest verification when a specific Http call is made.
      Returns:
      VerifyHttp using verifyHttp method with the stub server as the parameter.
    • getPort

      public int getPort()
      Get the port being used by the stub server.
      Returns:
      the port being used by the stub server.
    • getRoot

      public String getRoot()
      Get the root url being used by the stub server.
      Returns:
      the root url being used by the stub server.
    • getServer

      public com.xebialabs.restito.server.StubServer getServer()
      Returns the restito stub server to allow for any unsupported actions
      Returns:
      the stub server managed by this class