public class NCTestClientBuilder extends Object
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.Modifier and Type | Field and Description |
---|---|
static String |
DFLT_BASEURL
Default public REST API URL (endpoint).
|
static String |
DFLT_EMAIL
Default client email.
|
static boolean |
DFLT_EMBEDDED
Default embedded mode flag.
|
static long |
DFLT_MAX_WAIT_TIME
Maximum test time.
|
static String |
DFLT_PASSWORD
Default client password.
|
Constructor and Description |
---|
NCTestClientBuilder() |
Modifier and Type | Method and Description |
---|---|
NCTestClient |
build()
Build new configured test client instance.
|
NCTestClientBuilder |
newBuilder()
Creates new builder instance with all defaults set.
|
NCTestClientBuilder |
setBaseUrl(String baseUrl)
Sets non-default API base URL.
|
NCTestClientBuilder |
setEmbeddedMode(boolean embedded)
Sets the embedded probe mode flag.
|
NCTestClientBuilder |
setHttpClientSupplier(Supplier<org.apache.http.impl.client.CloseableHttpClient> cliSup)
Sets non-default
CloseableHttpClient custom supplier. |
NCTestClientBuilder |
setRequestConfig(org.apache.http.client.config.RequestConfig reqCfg)
Sets optional HTTP REST client configuration parameters.
|
NCTestClientBuilder |
setUser(String email,
String pswd)
Sets non-default user credentials.
|
public static final String DFLT_BASEURL
public static final String DFLT_EMAIL
public static final String DFLT_PASSWORD
public static final boolean DFLT_EMBEDDED
public static final long DFLT_MAX_WAIT_TIME
public NCTestClientBuilder newBuilder()
public NCTestClientBuilder setRequestConfig(org.apache.http.client.config.RequestConfig reqCfg)
reqCfg
- HTTP REST client configuration parameters.public NCTestClientBuilder setHttpClientSupplier(Supplier<org.apache.http.impl.client.CloseableHttpClient> cliSup)
CloseableHttpClient
custom supplier.
By default CloseableHttpClient
created with HttpClients.createDefault()
.cliSup
- CloseableHttpClient
custom supplier.public NCTestClientBuilder setBaseUrl(String baseUrl)
DFLT_BASEURL
is used.baseUrl
- API base URL.public NCTestClientBuilder setUser(String email, String pswd)
DFLT_EMAIL
and DFLT_PASSWORD
are used
and they match the default NLPCraft server user.email
- User email.pswd
- User password.public NCTestClientBuilder setEmbeddedMode(boolean embedded)
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.embedded
- Embedded probe mode flag.NCEmbeddedProbe
public NCTestClient build()
Copyright © 2020 NLPCraft. All rights reserved.