Class TestCommand<C extends io.dropwizard.core.Configuration>

java.lang.Object
io.dropwizard.core.cli.Command
io.dropwizard.core.cli.ConfiguredCommand<T>
io.dropwizard.core.cli.EnvironmentCommand<C>
ru.vyarus.dropwizard.guice.test.TestCommand<C>
Type Parameters:
C - configuration type

public class TestCommand<C extends io.dropwizard.core.Configuration> extends io.dropwizard.core.cli.EnvironmentCommand<C>
Lightweight variation of server command for testing purposes. Handles managed objects lifecycle.
Since:
23.10.2014
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Custom container lifecycle with additional objects ignorance.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestCommand(io.dropwizard.core.Application<C> application)
    Create command.
    TestCommand(io.dropwizard.core.Application<C> application, boolean simulateManaged)
    Create command.
    TestCommand(io.dropwizard.core.Application<C> application, boolean simulateManaged, List<ConfigModifier<C>> modifiers)
    Create command.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Class<C>
     
    protected void
    run(io.dropwizard.core.setup.Bootstrap<C> bootstrap, net.sourceforge.argparse4j.inf.Namespace namespace, C configuration)
     
    protected void
    run(io.dropwizard.core.setup.Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, C configuration)
     
    void
    Stop lifecycle.

    Methods inherited from class io.dropwizard.core.cli.EnvironmentCommand

    getEnvironment

    Methods inherited from class io.dropwizard.core.cli.ConfiguredCommand

    addFileArgument, cleanup, cleanupAsynchronously, configure, getConfiguration, run

    Methods inherited from class io.dropwizard.core.cli.Command

    getDescription, getName, onError

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TestCommand

      public TestCommand(io.dropwizard.core.Application<C> application)
      Create command.
      Parameters:
      application - application instance
    • TestCommand

      public TestCommand(io.dropwizard.core.Application<C> application, boolean simulateManaged)
      Create command.
      Parameters:
      application - application instance
      simulateManaged - true to simulate managed lifecycle
    • TestCommand

      public TestCommand(io.dropwizard.core.Application<C> application, boolean simulateManaged, List<ConfigModifier<C>> modifiers)
      Create command.
      Parameters:
      application - application instance
      simulateManaged - true to simulate managed lifecycle
      modifiers - configuration modifiers
  • Method Details

    • run

      protected void run(io.dropwizard.core.setup.Bootstrap<C> bootstrap, net.sourceforge.argparse4j.inf.Namespace namespace, C configuration) throws Exception
      Overrides:
      run in class io.dropwizard.core.cli.EnvironmentCommand<C extends io.dropwizard.core.Configuration>
      Throws:
      Exception
    • run

      protected void run(io.dropwizard.core.setup.Environment environment, net.sourceforge.argparse4j.inf.Namespace namespace, C configuration) throws Exception
      Specified by:
      run in class io.dropwizard.core.cli.EnvironmentCommand<C extends io.dropwizard.core.Configuration>
      Throws:
      Exception
    • stop

      public void stop()
      Stop lifecycle.
    • getConfigurationClass

      protected Class<C> getConfigurationClass()
      Overrides:
      getConfigurationClass in class io.dropwizard.core.cli.ConfiguredCommand<C extends io.dropwizard.core.Configuration>