Exemplo n.º 1
0
  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();
  }
Exemplo n.º 2
0
 public void setLastRunDetails(PMDate date, boolean status) {
   AppConfig.valueOf(DATE_PREFIX + name()).setValueWithoutSave(date);
   AppConfig.valueOf(STATUS_PREFIX + name()).setValueWithoutSave(status);
   AppConfig.saveConfigDetails();
 }
Exemplo n.º 3
0
 public boolean getLastRunStatus() {
   return AppConfig.valueOf(STATUS_PREFIX + name()).getBooleanValue();
 }
Exemplo n.º 4
0
 public PMDate getLastRunDate() {
   return AppConfig.valueOf(DATE_PREFIX + name()).getDateValue();
 }