Class NCTestClientBuilder


  • public class NCTestClientBuilder
    extends Object
    Test client builder for NCTestClient instances. Note that all configuration values have sensible defaults. Most of the time only user credentials will have to be changed if not testing with default account.
    • Constructor Detail

      • NCTestClientBuilder

        public NCTestClientBuilder()
    • Method Detail

      • newBuilder

        public NCTestClientBuilder newBuilder()
        Creates new builder instance with all defaults set.
        Returns:
        Builder instance.
      • setRequestConfig

        public NCTestClientBuilder setRequestConfig​(org.apache.http.client.config.RequestConfig reqCfg)
        Sets optional HTTP REST client configuration parameters.
        Parameters:
        reqCfg - HTTP REST client configuration parameters.
        Returns:
        Builder instance for chaining calls.
      • setHttpClientSupplier

        public NCTestClientBuilder setHttpClientSupplier​(Supplier<org.apache.http.impl.client.CloseableHttpClient> cliSup)
        Sets non-default CloseableHttpClient custom supplier. By default CloseableHttpClient created with HttpClients.createDefault().
        Parameters:
        cliSup - CloseableHttpClient custom supplier.
        Returns:
        Builder instance for chaining calls.
      • setBaseUrl

        public NCTestClientBuilder setBaseUrl​(String baseUrl)
        Sets non-default API base URL. Only change it if your server is not running on localhost. By default DFLT_BASEURL is used.
        Parameters:
        baseUrl - API base URL.
        Returns:
        Builder instance for chaining calls.
      • setUser

        public NCTestClientBuilder setUser​(String email,
                                           String pswd)
        Sets non-default user credentials. By default DFLT_EMAIL and DFLT_PASSWORD are used and they match the default NLPCraft server user.
        Parameters:
        email - User email.
        pswd - User password.
        Returns:
        Builder instance for chaining calls.
      • setEmbeddedMode

        public NCTestClientBuilder setEmbeddedMode​(boolean embedded)
        Sets the embedded probe mode flag. Default value is DFLT_EMBEDDED. If set to true the test client will expect the embedded probe running in the same JVM and will use local callbacks for quicker results instead of a full REST roundtrip.
        Parameters:
        embedded - Embedded probe mode flag.
        Returns:
        Builder instance for chaining calls.
        See Also:
        NCEmbeddedProbe
      • setResponseLog

        public NCTestClientBuilder setResponseLog​(boolean respLog)
        Sets whether or not to log responses from the probe. Default value is DFLT_RESP_LOG.
        Parameters:
        respLog - true to log responses, false otherwise.
        Returns:
        Builder instance for chaining calls.
      • build

        public NCTestClient build()
        Build new configured test client instance.
        Returns:
        Newly built test client instance.