Class DefaultTestClientFactory

  • All Implemented Interfaces:
    TestClientFactory

    public class DefaultTestClientFactory
    extends java.lang.Object
    implements TestClientFactory
    Default client factory for ClientSupport. Enables INFO logging of all requests and responses into ClientSupport 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String USE_LOGGER
      System property name used to disable direct console logs.
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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
    • Constructor Detail

      • DefaultTestClientFactory

        public DefaultTestClientFactory()
    • Method Detail

      • disableConsoleLog

        public static void disableConsoleLog()
        Disable client logs into system out. Instead, logs would go into ClientSupport logger.
      • enableConsoleLog

        public static void enableConsoleLog()
        Enable client logs into system out. Could be used to revert disableConsoleLog() 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 interface TestClientFactory
        Parameters:
        support - support object
        Returns:
        client instance