Out-of-the-box, GuiceBerry offers a {@link SharedStaticVarIcStrategy}, which is ideal when you run both test and server in the same ClassLoader/JVM.
When that is not possible, there are other ways to send this sort of data, such as HTTP {@link javax.servlet.http.Cookie}s, {@link java.io.File}s in a shared disk, shared database tables and whatnot.
This class makes the implementation of these stretegies possible. Each of these would simply require an implementation of the {@link IcStrategy.ClientSupport} and {@link IcStrategy.ServerSupport} interfaces.
Note that each of these classes will be instantiated by a different {@link com.google.inject.Injector}.
Also note that these implementations are not directly exposed to the end-user, but rather are a support for the Controllable Injection framework. Note that the {@link IcStrategy.ClientSupport#setOverride(ControllableId,Object)} and{@link IcStrategy.ClientSupport#resetOverride(ControllableId)} methods areindirectly exposed to the end-user through {@link IcClient#setOverride(Object)} and {@link IcClient#resetOverride()}respectivelly.
Finally, note that some strategies might be fundamentally more "capable" than others. E.g. a non-serializable class would pose a problem for a Cookie-based strategy, while the default (shared variable) strategy has no difficulty in supporting it. In fact, the default strategy is fundamentally the most capable strategy, and, thus, we say it's ideal. @author Luiz-Otavio Zorzella
|
|