use of org.springframework.context.ApplicationContext in project head by mifos.
the class PPITestDataGenerator method loadTestDataFiles.
public void loadTestDataFiles(String[] args) throws IOException, TaskSystemException, PersistenceException, ConfigurationException, FinancialException {
parseOptions(args);
ApplicationContext applicationContext = initializeSpring();
customerDao = applicationContext.getBean(CustomerDaoHibernate.class);
questionnaireServiceFacade = applicationContext.getBean(QuestionnaireServiceFacade.class);
if (testDataDirectoryName != null) {
File directory = new File(testDataDirectoryName);
File[] listOfFiles = directory.listFiles();
if (listOfFiles != null) {
int totalFilesToLoad = countFilesToUpgrade(listOfFiles);
int filesLoaded = 0;
for (File listOfFile : listOfFiles) {
String currentFilename = listOfFile.getName();
if (listOfFile.isFile() && currentFilename.endsWith("Testing.properties")) {
String dataFileName = testDataDirectoryName + File.separator + currentFilename;
loadData(dataFileName, applicationContext);
filesLoaded++;
System.out.println("Finished " + filesLoaded + "/" + totalFilesToLoad);
}
}
} else {
fail("No files found in directory: " + testDataDirectoryName);
}
} else {
loadData(dataSetName, applicationContext);
}
}
use of org.springframework.context.ApplicationContext in project head by mifos.
the class JNDIException method checkConfigurationDwDatabase.
public void checkConfigurationDwDatabase(HttpServletRequest request) {
new ApplicationContextHolder();
ApplicationContext ach = ApplicationContextHolder.getApplicationContext();
DriverManagerDataSource dsDW = (DriverManagerDataSource) ach.getBean("dataSourcePentahoDW");
Pattern pat = Pattern.compile("(jdbc:mysql://)(.*)(:)([0-9]+)(/)([a-zA-Z]*)(?)(.*)");
Matcher m = pat.matcher(dsDW.getUrl());
String nameOfDataBase = null;
if (m.find()) {
nameOfDataBase = m.group(6);
}
if (nameOfDataBase.equals("")) {
request.getSession().setAttribute("configureDwDatabase", "false");
} else {
try {
dsDW.getConnection();
request.getSession().setAttribute("configureDwDatabase", "true");
} catch (SQLException ex) {
request.getSession().setAttribute("configureDwDatabase", "false");
}
}
}
use of org.springframework.context.ApplicationContext in project pinpoint by naver.
the class LambdaIT method test.
@Test
public void test() throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("lambda-test.xml");
Maru maru = context.getBean(Maru.class);
Morae morae = context.getBean(Morae.class);
maru.test(morae);
PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
verifier.printCache();
verifier.verifyTrace(Expectations.event("SPRING_BEAN", Maru.class.getMethod("test", Morae.class)));
verifier.verifyTrace(Expectations.event("SPRING_BEAN", Morae.class.getMethod("test", Predicate.class)));
verifier.verifyTrace(Expectations.event("SPRING_BEAN", Mozzi.class.getMethod("getAge")));
verifier.verifyTraceCount(0);
}
use of org.springframework.context.ApplicationContext in project centipede by paulhoule.
the class CentipedeShell method parseOptions.
private CentipedeShellOptions parseOptions(String[] arguments) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
ApplicationContext bootstrapContext = newContext(getBootstrapApplicationContextPath());
OptionParser parser = new OptionParser(CentipedeShellOptions.class);
wireupOptionParser(bootstrapContext, parser);
closeContext(bootstrapContext);
return (CentipedeShellOptions) parser.parse(newArrayList(arguments));
}
use of org.springframework.context.ApplicationContext in project centipede by paulhoule.
the class StaticCentipedeShellTest method defaultEvaluationIsDefinedInFiles.
@Test
public void defaultEvaluationIsDefinedInFiles() {
ApplicationContext c = newContext(objectCountingContext());
assertEquals(1, ObjectThatCountsClassInstances.get());
Object that = c.getBean("l");
assertEquals(2, ObjectThatCountsClassInstances.get());
((AbstractApplicationContext) c).close();
assertEquals(0, ObjectThatCountsClassInstances.get());
}
Aggregations