public void testShutDownManager() throws Exception { String strLastDate = AppConfig.dateCORPACTIONDOWNLOADMANAGER.Value; String strInCompleteList = AppConfig.corpActionDownloadErrorList.Value; Hashtable<PMDate, Vector<CompanyActionVO>> htConsidated = new Hashtable<PMDate, Vector<CompanyActionVO>>(); final Mock compayDAOMock = new Mock(CompanyDAO.class); compayDAOMock.expects(once()).method("writeConsolidatedActionData").with(eq(htConsidated)); final Mock synchronizerMock = new Mock(CorpActionSynchronizer.class); synchronizerMock.expects(once()).method("applyCorpAction").withNoArguments(); CorpActionDownloadManager manager = new CorpActionDownloadManager(null) { { inCompleteList = new Vector<String>(); inCompleteList.add(STOCKCODE1); } @Override CompanyDAO getCompanyDAO() { return (CompanyDAO) compayDAOMock.proxy(); } CorpActionSynchronizer getSynchronizer() { return (CorpActionSynchronizer) synchronizerMock.proxy(); } }; manager.shutDownManager(); assertTrue( PMDateFormatter.formatYYYYMMDD(new PMDate()) .equals(AppConfig.dateCORPACTIONDOWNLOADMANAGER.Value)); assertTrue(STOCKCODE1.equals(AppConfig.corpActionDownloadErrorList.Value)); AppConfig.dateCORPACTIONDOWNLOADMANAGER.Value = strLastDate; AppConfig.corpActionDownloadErrorList.Value = strInCompleteList; AppConfig.saveConfigDetails(); compayDAOMock.verify(); synchronizerMock.verify(); }
public void setLastRunDetails(PMDate date, boolean status) { AppConfig.valueOf(DATE_PREFIX + name()).setValueWithoutSave(date); AppConfig.valueOf(STATUS_PREFIX + name()).setValueWithoutSave(status); AppConfig.saveConfigDetails(); }