Search in sources :

Example 6 with ConfigurationLocator

use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.

the class ApplicationInitializer method copyLogo.

private void copyLogo(ServletContext servletContext) throws IOException {
    ConfigurationLocator configurationLocator = new ConfigurationLocator();
    Resource logoResource = configurationLocator.getUploadedMifosLogo();
    if (!logoResource.exists()) {
        InputStream defaultLogoStream = servletContext.getResourceAsStream("/pages/framework/images/logo.jpg");
        File logoDir = new File(configurationLocator.getConfigurationDirectory() + File.separator + configurationLocator.getLogoDirectory());
        logoDir.mkdir();
        File logo = new File(logoDir, configurationLocator.getLogoName());
        FileUtils.copyInputStreamToFile(defaultLogoStream, logo);
        logger.info("Copy default logo to: " + logo.getAbsolutePath());
    }
}
Also used : JarInputStream(java.util.jar.JarInputStream) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) Resource(org.springframework.core.io.Resource) ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator) File(java.io.File)

Example 7 with ConfigurationLocator

use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.

the class MifosIntegrationTestCase method init.

@BeforeClass
public static void init() throws Exception {
    Log4jConfigurer.initLogging(new ConfigurationLocator().getFilePath(FilePaths.LOG_CONFIGURATION_FILE));
    verifyDatabaseState = false;
    if (!isTestingModeSet) {
        new StandardTestingService().setTestMode(TestMode.INTEGRATION);
        isTestingModeSet = true;
    }
}
Also used : StandardTestingService(org.mifos.framework.util.StandardTestingService) ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator) BeforeClass(org.junit.BeforeClass)

Example 8 with ConfigurationLocator

use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.

the class TaskRunningIntegrationTest method getMifosSchedulerOldConfigurationFile.

private MifosScheduler getMifosSchedulerOldConfigurationFile(String taskResource, String quartzResource) throws IOException, TaskSystemException {
    ConfigurationLocator mockConfigurationLocator = createMock(ConfigurationLocator.class);
    expect(mockConfigurationLocator.getResource(SchedulerConstants.CONFIGURATION_FILE_NAME)).andReturn(MifosResourceUtil.getClassPathResourceAsResource(taskResource));
    expect(mockConfigurationLocator.getResource(SchedulerConstants.SCHEDULER_CONFIGURATION_FILE_NAME)).andReturn(MifosResourceUtil.getClassPathResourceAsResource(quartzResource));
    replay(mockConfigurationLocator);
    MifosScheduler mifosScheduler = new MifosScheduler();
    mifosScheduler.setConfigurationLocator(mockConfigurationLocator);
    mifosScheduler.initialize();
    return mifosScheduler;
}
Also used : ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator)

Example 9 with ConfigurationLocator

use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.

the class TaskRunningIntegrationTest method getMifosScheduler.

private MifosScheduler getMifosScheduler(String taskConfiguration) throws TaskSystemException, IOException, FileNotFoundException {
    ConfigurationLocator mockConfigurationLocator = createMock(ConfigurationLocator.class);
    expect(mockConfigurationLocator.getResource(SchedulerConstants.CONFIGURATION_FILE_NAME)).andReturn(MifosResourceUtil.getClassPathResourceAsResource(taskConfiguration));
    expectLastCall().times(2);
    replay(mockConfigurationLocator);
    MifosScheduler mifosScheduler = new MifosScheduler();
    mifosScheduler.setConfigurationLocator(mockConfigurationLocator);
    mifosScheduler.initialize();
    return mifosScheduler;
}
Also used : ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator)

Example 10 with ConfigurationLocator

use of org.mifos.framework.util.ConfigurationLocator in project head by mifos.

the class BatchJobCatchUpIntegrationTest method getMifosScheduler.

private MifosScheduler getMifosScheduler(String taskConfigurationPath) throws TaskSystemException, IOException, FileNotFoundException {
    ConfigurationLocator mockConfigurationLocator = createMock(ConfigurationLocator.class);
    expect(mockConfigurationLocator.getResource(SchedulerConstants.CONFIGURATION_FILE_NAME)).andReturn(MifosResourceUtil.getClassPathResourceAsResource(taskConfigurationPath));
    expectLastCall().times(2);
    replay(mockConfigurationLocator);
    MifosScheduler mifosScheduler = new MifosScheduler();
    mifosScheduler.setConfigurationLocator(mockConfigurationLocator);
    mifosScheduler.initialize();
    return mifosScheduler;
}
Also used : ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator)

Aggregations

ConfigurationLocator (org.mifos.framework.util.ConfigurationLocator)25 File (java.io.File)9 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 URL (java.net.URL)3 ArrayList (java.util.ArrayList)3 MifosScheduler (org.mifos.framework.components.batchjobs.MifosScheduler)3 Resource (org.springframework.core.io.Resource)3 FileInputStream (java.io.FileInputStream)2 Properties (java.util.Properties)2 JarInputStream (java.util.jar.JarInputStream)2 Graphics2D (java.awt.Graphics2D)1 BufferedImage (java.awt.image.BufferedImage)1 BufferedReader (java.io.BufferedReader)1 FileNotFoundException (java.io.FileNotFoundException)1 FileReader (java.io.FileReader)1 InputStreamReader (java.io.InputStreamReader)1 PrintWriter (java.io.PrintWriter)1 URLClassLoader (java.net.URLClassLoader)1 SQLException (java.sql.SQLException)1