Search in sources :

Example 11 with ConfigurationLocator

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

the class PentahoReportLocator method getPathToUploadedReport.

private static String getPathToUploadedReport(String reportFileName) {
    ConfigurationLocator configurationLocator = new ConfigurationLocator();
    String configPath = configurationLocator.getConfigurationDirectory() + "/uploads";
    String uploadsDir = configPath;
    StringBuilder sb;
    if (File.separatorChar == '\\') {
        // windows platform
        uploadsDir = uploadsDir.replaceAll("/", "\\\\");
        sb = new StringBuilder("file:/");
    } else {
        sb = new StringBuilder("file://");
    }
    sb.append(uploadsDir);
    if (!uploadsDir.endsWith(File.separator)) {
        sb.append(File.separator);
    }
    sb.append("report").append(File.separator).append(reportFileName);
    return sb.toString();
}
Also used : ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator)

Example 12 with ConfigurationLocator

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

the class LoanArrearsTaskIntegrationTest 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) MifosScheduler(org.mifos.framework.components.batchjobs.MifosScheduler)

Example 13 with ConfigurationLocator

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

the class LoanArrearsAndPortfolioAtRiskIntegrationTest 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) MifosScheduler(org.mifos.framework.components.batchjobs.MifosScheduler)

Example 14 with ConfigurationLocator

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

the class PentahoReportsServiceImpl method getLogoParameterForReport.

private PentahoInputParameter getLogoParameterForReport() throws IOException {
    ConfigurationLocator configurationLocator = new ConfigurationLocator();
    org.springframework.core.io.Resource logo = configurationLocator.getUploadedMifosLogo();
    PentahoInputParameter logoParameter = new PentahoInputParameter();
    logoParameter.setParamName("mifosLogoPath");
    logoParameter.setLabelName("mifosLogoPath");
    String logoPath = logo.getFile().getAbsolutePath();
    logoParameter.setValue(logoPath);
    return logoParameter;
}
Also used : PentahoInputParameter(org.mifos.reports.pentaho.params.PentahoInputParameter) ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator)

Example 15 with ConfigurationLocator

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

the class PPITest method verifyPPIQuestionGroup.

//http://mifosforge.jira.com/browse/MIFOSTEST-147
public void verifyPPIQuestionGroup() throws Exception {
    //Given
    initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, "acceptance_small_008_dbunit.xml", dataSource, selenium);
    String configPath = new ConfigurationLocator().getConfigurationDirectory();
    String fileName = "PPISurveyBANGLADESH2009.xml";
    String sourcePath = PPITest.class.getResource("/mpesa/" + fileName).getFile();
    String qgDestPath = configPath + "/uploads/questionGroups/";
    String destPath = qgDestPath + fileName;
    new File(qgDestPath).mkdirs();
    File sourceFile = new File(sourcePath);
    File destFile = new File(destPath);
    List<String> QGlist = new ArrayList<String>();
    QGlist.add("PPI Bangladesh 2009");
    CreateClientEnterPersonalDataPage.SubmitFormParameters formParameters = FormParametersHelper.getClientEnterPersonalDataPageFormParameters();
    QuestionResponseParameters responseParams = getQuestionResponseParametersForPPIIndia2008();
    AttachQuestionGroupParameters attachParams = new AttachQuestionGroupParameters();
    attachParams.setQuestionGroupName("PPI Bangladesh 2009");
    attachParams.addTextResponse("Date Survey Was Taken", "24/01/2011");
    attachParams.addCheckResponse("How many household members are 11-years-old or younger?", "Four or more");
    attachParams.addCheckResponse("Does any household member work for a daily wage?", "Yes");
    attachParams.addCheckResponse("What type of latrine does the household use?", "Open field");
    attachParams.addCheckResponse("How many rooms does the household occupy (excluding rooms used for business)?", "Four");
    attachParams.addCheckResponse("What is the main construction material of the walls?", "Brick/cement");
    attachParams.addCheckResponse("What is the main construction material of the roof?", "Cement");
    attachParams.addCheckResponse("What is the total cultivable agricultural land owned by the household?", "More than 1 acre");
    attachParams.addCheckResponse("Does the household own a television?", "Yes");
    attachParams.addCheckResponse("Does the household own a two-in-one cassette player?", "No");
    attachParams.addCheckResponse("Does the household own a wristwatch?", "Yes");
    String[] eventList = { "View Client", "Create Client", "Close Client" };
    //When
    if (!destFile.exists()) {
        copyFile(sourceFile, destFile);
    }
    questionGroupTestHelper.activatePPI("BANGLADESH2009");
    questionGroupTestHelper.changeAppliesTo("PPI Bangladesh 2009", eventList);
    questionGroupTestHelper.navigateToViewQuestionGroups(QGlist);
    String clientName = clientTestHelper.createClientWithQuestionGroups(formParameters, "MyGroup1232993846342", responseParams).getHeading();
    attachParams.setTarget(clientName);
    clientTestHelper.activateClient(clientName);
    questionGroupTestHelper.attachQuestionGroupToClient(attachParams);
    clientTestHelper.closeClientWithQG(clientName, responseParams);
}
Also used : CreateClientEnterPersonalDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage) ArrayList(java.util.ArrayList) AttachQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.AttachQuestionGroupParameters) ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator) File(java.io.File) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)

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