use of org.glassfish.hk2.runlevel.RunLevel in project Payara by payara.
the class BasicModularityTest method ensureRunLevel.
// TODO add more tests to cover token processing and i18n support
private void ensureRunLevel(int runlevel) {
RunLevelController controller = habitat.getService(RunLevelController.class);
controller.proceedTo(runlevel);
}
use of org.glassfish.hk2.runlevel.RunLevel in project Payara by payara.
the class AppServerStartupTest method bindService.
private void bindService(DynamicConfiguration configurator, Class<?> service) {
final DescriptorBuilder descriptorBuilder = BuilderHelper.link(service);
final RunLevel rla = service.getAnnotation(RunLevel.class);
if (rla != null) {
descriptorBuilder.to(RunLevel.class).has(RunLevel.RUNLEVEL_VAL_META_TAG, Collections.singletonList(((Integer) rla.value()).toString())).has(RunLevel.RUNLEVEL_MODE_META_TAG, Collections.singletonList(((Integer) rla.mode()).toString()));
descriptorBuilder.in(RunLevel.class);
}
Class clazz = service;
while (clazz != null) {
Class<?>[] interfaces = clazz.getInterfaces();
for (int j = 0; j < interfaces.length; j++) {
descriptorBuilder.to(interfaces[j]);
}
clazz = clazz.getSuperclass();
}
final Named named = service.getAnnotation(Named.class);
if (named != null) {
descriptorBuilder.named(named.value());
}
configurator.bind(descriptorBuilder.build());
}
Aggregations