@SuppressWarnings({"deprecation"})
  @Before
  public void before() throws Exception {
    EhourHomeUtil.setEhourHome("src/test/resources");
    configService =
        createMock(
            ConfigurationServiceImpl.class,
            ConfigurationServiceImpl.class.getMethod("getConfiguration"),
            ConfigurationServiceImpl.class.getMethod("persistConfiguration", EhourConfig.class));
    getMockContext().putBean("configService", configService);

    mailService = createMock(MailService.class);
    getMockContext().putBean("mailService", mailService);

    config = new EhourConfigStub();
    expect(configService.getConfiguration()).andReturn(config);
  }
Beispiel #2
0
  @PostConstruct
  public void scanTranslations() {
    String absoluteTranslationsPath =
        EhourHomeUtil.getTranslationsDir(
            systemConfig.getEhourHome(), systemConfig.getTranslationsDir());

    File transDir = new File(absoluteTranslationsPath);

    LOG.info("Looking for translations in " + transDir.getAbsolutePath());

    if (transDir.exists()) {
      translations = scanTranslations(transDir);
    } else {
      LOG.fatal("Translations dir " + transDir + " does not exist");
      translations = null;
    }
  }
  @Before
  public void before() throws Exception {
    EhourHomeUtil.setEhourHome("src/test/resources");

    config = new EhourConfigStub();

    when(configService.getConfiguration()).thenReturn(config);
    getMockContext().putBean("configService", configService);

    SystemInfoService infoService = mock(SystemInfoService.class);
    getMockContext().putBean(infoService);
    when(infoService.info()).thenReturn(new SystemInfo("a", "b", "c"));

    getMockContext().putBean("mailMan", mailMan);
    getMockContext().putBean("userService", userService);
    getMockContext().putBean("configurationPersistence", iPersistConfiguration);
  }