Class StubRestConfig
- java.lang.Object
-
- ru.vyarus.dropwizard.guice.test.rest.StubRestConfig
-
public class StubRestConfig extends java.lang.ObjectStub rest configuration forRestStubsHook.- Since:
- 20.04.2025
-
-
Constructor Summary
Constructors Constructor Description StubRestConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestContainerPolicygetContainer()java.util.List<java.lang.Class<?>>getDisableJerseyExtensions()NOTE: if extensions specified ingetJerseyExtensions()then the disable option would be ignored (all required extensions already specified).java.util.List<java.lang.Class<?>>getDisableResources()NOTE: if resources specified ingetResources()then the disable option would be ignored (all required resources already specified).java.util.List<java.lang.Class<?>>getJerseyExtensions()By default, all jersey extension, registered in application, would be registered.java.util.List<java.lang.Class<?>>getResources()By default, all resources would be available.booleanisDisableAllJerseyExtensions()booleanisDisableDropwizardExceptionMappers()booleanisLogRequests()voidsetContainer(TestContainerPolicy container)By default, use a lightweight in-memory container, but switch to grizzly when it's available in classpath (this is the default behavior ofJerseyTest).voidsetDisableAllJerseyExtensions(boolean disableAllJerseyExtensions)NOTE: if extensions specified ingetJerseyExtensions()then the disable option would be ignored (all required extensions already specified).voidsetDisableDropwizardExceptionMappers(boolean disableDropwizardExceptionMappers)By default, all dropwizard exception mappers registered (same as in real application).voidsetLogRequests(boolean logRequests)Requests log enabled by default (like inClientSupport).
-
-
-
Method Detail
-
getResources
public java.util.List<java.lang.Class<?>> getResources()
By default, all resources would be available. Use this option to run a subset of resources.- Returns:
- resources to use in stub
- See Also:
to disable some default resources
-
getDisableResources
public java.util.List<java.lang.Class<?>> getDisableResources()
NOTE: if resources specified ingetResources()then the disable option would be ignored (all required resources already specified). This option is useful to exclude only some resources from the registered application resourcesImportant: affects only resources, recognized as guicey extensions. Manually registered resources would remain!
- Returns:
- resources to disable
-
getJerseyExtensions
public java.util.List<java.lang.Class<?>> getJerseyExtensions()
By default, all jersey extension, registered in application, would be registered. Use this option to specify exact required extensions (all other application extensions would be disabled).Important: this affects only guicey extensions (all other guicey extension would be simply disabled). To disable core dropwizard exception mappers use
setDisableDropwizardExceptionMappers(boolean).- Returns:
- jersey extensions to use in stub
-
isDisableAllJerseyExtensions
public boolean isDisableAllJerseyExtensions()
- Returns:
- true to disable all application jersey extensions
-
setDisableAllJerseyExtensions
public void setDisableAllJerseyExtensions(boolean disableAllJerseyExtensions)
NOTE: if extensions specified ingetJerseyExtensions()then the disable option would be ignored (all required extensions already specified).Does not affect dropwizard default extensions (only affects extension, controlled by guicey). Dropwizard exception mappers could be disabled with
isDisableDropwizardExceptionMappers().- Parameters:
disableAllJerseyExtensions- true to disable all application jersey extensions
-
isDisableDropwizardExceptionMappers
public boolean isDisableDropwizardExceptionMappers()
- Returns:
- true dropwizard exception mappers
-
setDisableDropwizardExceptionMappers
public void setDisableDropwizardExceptionMappers(boolean disableDropwizardExceptionMappers)
By default, all dropwizard exception mappers registered (same as in real application). For tests, it might be more convenient to disable them and receive direct exception objects after test.- Parameters:
disableDropwizardExceptionMappers- true dropwizard exception mappers
-
getDisableJerseyExtensions
public java.util.List<java.lang.Class<?>> getDisableJerseyExtensions()
NOTE: if extensions specified ingetJerseyExtensions()then the disable option would be ignored (all required extensions already specified). This option is useful to exclude only some extensions from the registered application jersey extensions.Does not affect dropwizard default extensions (only affects extension, controlled by guicey). Dropwizard exception mappers could be disabled with
isDisableDropwizardExceptionMappers().- Returns:
- jersey extensions to disable
-
isLogRequests
public boolean isLogRequests()
- Returns:
- true to print all requests and responses into console
-
setLogRequests
public void setLogRequests(boolean logRequests)
Requests log enabled by default (like inClientSupport).- Parameters:
logRequests- true to print all requests and responses into console
-
getContainer
public TestContainerPolicy getContainer()
- Returns:
- required test container policy
-
setContainer
public void setContainer(TestContainerPolicy container)
By default, use a lightweight in-memory container, but switch to grizzly when it's available in classpath (this is the default behavior ofJerseyTest).- Parameters:
container- required test container policy
-
-