use of com.instaclustr.threading.ExecutorsModule in project esop by instaclustr.
the class ManifestTest method setup.
@BeforeMethod
public void setup() throws Exception {
final List<Module> modules = new ArrayList<Module>() {
{
add(new KubernetesApiModule());
add(new ExecutorsModule());
add(new CassandraModule());
add(new JacksonModule());
}
};
final Injector injector = Guice.createInjector(modules);
injector.injectMembers(this);
operationsService = new OperationsService(executorServiceSupplier.get());
cassandra = getCassandra();
cassandra.start();
waitForCql();
session = CqlSession.builder().build();
}
use of com.instaclustr.threading.ExecutorsModule in project esop by instaclustr.
the class Esop method init.
static void init(final Runnable command, final CassandraJMXSpec jmxSpec, final HashSpec hashSpec, final OperationRequest operationRequest, final Logger logger, final List<Module> appSpecificModules) {
final List<Module> modules = new ArrayList<>();
if (jmxSpec != null) {
modules.add(new CassandraModule(new CassandraJMXConnectionInfo(jmxSpec)));
} else {
modules.add(new AbstractModule() {
@Override
protected void configure() {
bind(StorageServiceMBean.class).toProvider(() -> null);
bind(Cassandra4StorageServiceMBean.class).toProvider(() -> null);
}
});
}
modules.add(new JacksonModule());
modules.add(new OperationsModule());
modules.add(new StorageModules());
modules.add(new ExecutorsModule());
modules.add(new UploadingModule());
modules.add(new DownloadingModule());
modules.add(new HashModule(hashSpec));
modules.addAll(appSpecificModules);
final Injector injector = Guice.createInjector(// production binds singletons as eager by default
Stage.PRODUCTION, modules);
GuiceInjectorHolder.INSTANCE.setInjector(injector);
injector.injectMembers(command);
final Validator validator = Validation.byDefaultProvider().configure().constraintValidatorFactory(new GuiceInjectingConstraintValidatorFactory()).buildValidatorFactory().getValidator();
final Set<ConstraintViolation<OperationRequest>> violations = validator.validate(operationRequest);
if (!violations.isEmpty()) {
violations.forEach(violation -> logger.error(violation.getMessage()));
throw new ValidationException();
}
}
Aggregations