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 intoClientSupportlogger. 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 classDefaultTestClientFactory.ConsoleLogger"Hacked" logger to print everything directly into system out.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringUSE_LOGGERSystem 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.JerseyClientcreate(io.dropwizard.testing.DropwizardTestSupport<?> support)Creates client instance forClientSupport(once per support instance).static voiddisableConsoleLog()Disable client logs into system out.static voidenableConsoleLog()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 intoClientSupportlogger.
-
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:TestClientFactoryCreates 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:
createin interfaceTestClientFactory- Parameters:
support- support object- Returns:
- client instance
-
-