Class DefaultTestClientFactory
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.test.client.DefaultTestClientFactory
-
- All Implemented Interfaces:
TestClientFactory
public class DefaultTestClientFactory extends java.lang.Object implements TestClientFactory
Default client factory forClientSupport
. Enables INFO logging of all requests and responses intoClientSupport
logger. Auto register multipart feature if it's available in classpath (through dropwizard-froms).By default, log all requests and responses into system out (console). This could be disabled with
disableConsoleLog()
method (system property).- Since:
- 15.11.2023
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DefaultTestClientFactory.ConsoleLogger
"Hacked" logger to print everything directly into system out.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
USE_LOGGER
System property name used to disable direct console logs.
-
Constructor Summary
Constructors Constructor Description DefaultTestClientFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.glassfish.jersey.client.JerseyClient
create(io.dropwizard.testing.DropwizardTestSupport<?> support)
Creates client instance forClientSupport
(once per support instance).static void
disableConsoleLog()
Disable client logs into system out.static void
enableConsoleLog()
Enable client logs into system out.
-
-
-
Field Detail
-
USE_LOGGER
public static final java.lang.String USE_LOGGER
System property name used to disable direct console logs.- See Also:
- Constant Field Values
-
-
Method Detail
-
disableConsoleLog
public static void disableConsoleLog()
Disable client logs into system out. Instead, logs would go intoClientSupport
logger.
-
enableConsoleLog
public static void enableConsoleLog()
Enable client logs into system out. Could be used to revertdisableConsoleLog()
action.
-
create
public org.glassfish.jersey.client.JerseyClient create(io.dropwizard.testing.DropwizardTestSupport<?> support)
Description copied from interface:TestClientFactory
Creates client instance forClientSupport
(once per support instance). Called lazily (only before jersey client is actually required to perform call), so the support object should be already initialized.- Specified by:
create
in interfaceTestClientFactory
- Parameters:
support
- support object- Returns:
- client instance
-
-