@Test
public void testInjection() throws Exception {

  final Injector injector = Guice.createInjector(
      new AzkabanCommonModule(props),
      new AzkabanWebServerModule(props)
  );
  SERVICE_PROVIDER.unsetInjector();
  SERVICE_PROVIDER.setInjector(injector);
  final ExecutorLoader executorLoader = injector.getInstance(ExecutorLoader.class);
  assertNotNull(executorLoader);
  final Executor executor = executorLoader.addExecutor("localhost", 60000);
  executor.setActive(true);
  executorLoader.updateExecutor(executor);
  assertNotNull(injector.getInstance(ExecutionFlowDao.class));
  assertNotNull(injector.getInstance(DatabaseOperator.class));
  //Test if triggermanager is singletonly guiced. If not, the below test will fail.
  assertSingleton(ExecutorLoader.class, injector);
  assertSingleton(ExecutorManagerAdapter.class, injector);
  assertSingleton(ProjectLoader.class, injector);
  assertSingleton(ProjectManager.class, injector);
  assertSingleton(Storage.class, injector);
  assertSingleton(TriggerLoader.class, injector);
  assertSingleton(TriggerManager.class, injector);
  assertSingleton(AlerterHolder.class, injector);
  assertSingleton(Emailer.class, injector);
  assertSingleton(ExecutionFlowDao.class, injector);
  assertSingleton(ExecutorDao.class, injector);
  assertSingleton(ExecutionJobDao.class, injector);
  assertSingleton(ExecutionLogsDao.class, injector);
  assertSingleton(ExecutorEventsDao.class, injector);
  assertSingleton(ActiveExecutingFlowsDao.class, injector);
  assertSingleton(FlowTriggerScheduler.class, injector);
  assertSingleton(FetchActiveFlowDao.class, injector);
  assertSingleton(AzkabanWebServer.class, injector);
  assertSingleton(H2FileDataSource.class, injector);
  assertSingleton(QuartzScheduler.class, injector);
  SERVICE_PROVIDER.unsetInjector();
}