use of java.sql.Timestamp in project head by mifos.
the class SavingsAdjustmentAccountingEntryTest method setUpOneVoluntarySavingsTest.
private void setUpOneVoluntarySavingsTest(SavingsType savingsType, AccountActionTypes accountActionType, GLCategoryType bankCategoryType, GLCategoryType savingsCategoryType, FinancialConstants debitOrCreditToBankGLAccount, FinancialActionConstants financialAction) throws FinancialException {
when(mockedFinancialActivity.getAccountTrxn()).thenReturn(mockedIncomingTransaction);
when(mockedIncomingTransaction.getAccount()).thenReturn(mockedSavingsBO);
when(mockedIncomingTransaction.getWithdrawlAmount()).thenReturn(withdrawalAmount);
when(mockedIncomingTransaction.getDepositAmount()).thenReturn(depositAmount);
when(mockedIncomingTransaction.getActionDate()).thenReturn(transactionActionDate.toDate());
when(mockedIncomingTransaction.getTrxnCreatedDate()).thenReturn(new Timestamp(transactionPostedDate.getMillis()));
when(mockedIncomingTransaction.getPersonnel()).thenReturn(mockedTransactionCreator);
when(mockedIncomingTransaction.getComments()).thenReturn(commentString);
when(mockedSavingsBO.getSavingsOffering()).thenReturn(mockedSavingsOffering);
when(mockedSavingsBO.isMandatory()).thenReturn(false);
when(mockedSavingsBO.isVoluntary()).thenReturn(true);
when(mockedSavingsOffering.getDepositGLCode()).thenReturn(mockedSavingsDepositGLCode);
when(mockedSavingsDepositGLCode.getGlcode()).thenReturn(savingsDepositGLCodeString);
when(mockedSavingsGLAccount.getGlCode()).thenReturn(savingsDepositGLCodeString);
when(mockedSavingsGLAccount.getAccountName()).thenReturn("Clients Accounts");
when(mockedSavingsGLAccount.getTopLevelCategoryType()).thenReturn(savingsCategoryType);
when(mockedBankGLAccount.getAssociatedGlcode()).thenReturn(mockedBankGLCode);
when(mockedBankGLAccount.getGlCode()).thenReturn(bankGLCodeString);
when(mockedBankGLAccount.getTopLevelCategoryType()).thenReturn(bankCategoryType);
when(mockedBankGLCode.getGlcode()).thenReturn(bankGLCodeString);
when(mockedFinancialBusinessService.getGlAccount(savingsDepositGLCodeString)).thenReturn(mockedSavingsGLAccount);
when(mockedFinancialBusinessService.getGlAccount(bankGLCodeString)).thenReturn(mockedBankGLAccount);
when(mockedFinancialBusinessService.getFinancialAction(financialAction)).thenReturn(mockedFinancialAction);
if (debitOrCreditToBankGLAccount.equals(FinancialConstants.DEBIT)) {
when(mockedFinancialAction.getApplicableDebitCharts()).thenReturn(setWith(mockedBankGLAccount));
} else {
when(mockedFinancialAction.getApplicableCreditCharts()).thenReturn(setWith(mockedBankGLAccount));
}
when(mockedSavingsType.getId()).thenReturn(savingsType.getValue());
when(mockedSavingsHelper.getPaymentActionType((AccountPaymentEntity) any())).thenReturn(accountActionType.getValue());
}
use of java.sql.Timestamp in project head by mifos.
the class SavingsAdjustmentAccountingEntryTest method setUpOneMandatorySavingsTest.
private void setUpOneMandatorySavingsTest(SavingsType savingsType, AccountActionTypes accountActionType, GLCategoryType bankCategoryType, GLCategoryType savingsCategoryType, FinancialConstants debitOrCreditToBankGLAccount, FinancialActionConstants financialAction) throws FinancialException {
when(mockedFinancialActivity.getAccountTrxn()).thenReturn(mockedIncomingTransaction);
when(mockedIncomingTransaction.getAccount()).thenReturn(mockedSavingsBO);
when(mockedIncomingTransaction.getWithdrawlAmount()).thenReturn(withdrawalAmount);
when(mockedIncomingTransaction.getDepositAmount()).thenReturn(depositAmount);
when(mockedIncomingTransaction.getActionDate()).thenReturn(transactionActionDate.toDate());
when(mockedIncomingTransaction.getTrxnCreatedDate()).thenReturn(new Timestamp(transactionPostedDate.getMillis()));
when(mockedIncomingTransaction.getPersonnel()).thenReturn(mockedTransactionCreator);
when(mockedIncomingTransaction.getComments()).thenReturn(commentString);
when(mockedSavingsBO.getSavingsOffering()).thenReturn(mockedSavingsOffering);
when(mockedSavingsBO.isMandatory()).thenReturn(true);
when(mockedSavingsOffering.getDepositGLCode()).thenReturn(mockedSavingsDepositGLCode);
when(mockedSavingsDepositGLCode.getGlcode()).thenReturn(savingsDepositGLCodeString);
when(mockedSavingsGLAccount.getGlCode()).thenReturn(savingsDepositGLCodeString);
when(mockedSavingsGLAccount.getAccountName()).thenReturn("Clients Accounts");
when(mockedSavingsGLAccount.getTopLevelCategoryType()).thenReturn(savingsCategoryType);
when(mockedBankGLAccount.getAssociatedGlcode()).thenReturn(mockedBankGLCode);
when(mockedBankGLAccount.getGlCode()).thenReturn(bankGLCodeString);
when(mockedBankGLAccount.getTopLevelCategoryType()).thenReturn(bankCategoryType);
when(mockedBankGLCode.getGlcode()).thenReturn(bankGLCodeString);
when(mockedFinancialBusinessService.getGlAccount(savingsDepositGLCodeString)).thenReturn(mockedSavingsGLAccount);
when(mockedFinancialBusinessService.getGlAccount(bankGLCodeString)).thenReturn(mockedBankGLAccount);
when(mockedFinancialBusinessService.getFinancialAction(financialAction)).thenReturn(mockedFinancialAction);
if (debitOrCreditToBankGLAccount.equals(FinancialConstants.DEBIT)) {
when(mockedFinancialAction.getApplicableDebitCharts()).thenReturn(setWith(mockedBankGLAccount));
} else {
when(mockedFinancialAction.getApplicableCreditCharts()).thenReturn(setWith(mockedBankGLAccount));
}
when(mockedSavingsType.getId()).thenReturn(savingsType.getValue());
when(mockedSavingsHelper.getPaymentActionType((AccountPaymentEntity) any())).thenReturn(accountActionType.getValue());
}
use of java.sql.Timestamp in project pinot by linkedin.
the class StarTreeClusterIntegrationTest method waitForExternalViewUpdate.
/**
* Wait for External View to be in sync with Ideal State.
* @return
*/
private boolean waitForExternalViewUpdate() {
final ZKHelixAdmin helixAdmin = new ZKHelixAdmin(ZkStarter.DEFAULT_ZK_STR);
ClusterStateVerifier.Verifier customVerifier = new ClusterStateVerifier.Verifier() {
@Override
public boolean verify() {
String clusterName = getHelixClusterName();
List<String> resourcesInCluster = helixAdmin.getResourcesInCluster(clusterName);
LOGGER.info("Waiting for external view to update for resources: {} startTime: {}", resourcesInCluster, new Timestamp(System.currentTimeMillis()));
for (String resourceName : resourcesInCluster) {
IdealState idealState = helixAdmin.getResourceIdealState(clusterName, resourceName);
ExternalView externalView = helixAdmin.getResourceExternalView(clusterName, resourceName);
LOGGER.info("HERE for {},\n IS:{} \n EV:{}", resourceName, idealState, externalView);
if (idealState == null || externalView == null) {
return false;
}
Set<String> partitionSet = idealState.getPartitionSet();
for (String partition : partitionSet) {
Map<String, String> instanceStateMapIS = idealState.getInstanceStateMap(partition);
Map<String, String> instanceStateMapEV = externalView.getStateMap(partition);
if (instanceStateMapIS == null || instanceStateMapEV == null) {
return false;
}
if (!instanceStateMapIS.equals(instanceStateMapEV)) {
return false;
}
}
LOGGER.info("External View updated successfully for {},\n IS:{} \n EV:{}", resourceName, idealState, externalView);
}
LOGGER.info("External View updated successfully for {}", resourcesInCluster);
return true;
}
};
return ClusterStateVerifier.verifyByPolling(customVerifier, TIMEOUT_IN_MILLISECONDS);
}
use of java.sql.Timestamp in project head by mifos.
the class ImportedFilesDaoHibernateIntegrationTest method testSaveConstraintVoilation.
/**
* ignoring as can't get first
*/
@Test(expected = MifosRuntimeException.class)
public void testSaveConstraintVoilation() throws Exception {
Short personnelId = new Short("1");
PersonnelBO personnelBO = TestObjectFactory.getPersonnel(personnelId);
Timestamp timeStamp = new Timestamp(123134554L);
String fileName = "testFile.xls";
ImportedFilesEntity expected = new ImportedFilesEntity(fileName, timeStamp, personnelBO, null, false, false);
StaticHibernateUtil.startTransaction();
importedFilesDao.saveImportedFile(expected);
StaticHibernateUtil.flushSession();
ImportedFilesEntity shouldViolateConstraint = new ImportedFilesEntity(fileName, timeStamp, personnelBO, null, false, false);
importedFilesDao.saveImportedFile(shouldViolateConstraint);
StaticHibernateUtil.flushSession();
}
use of java.sql.Timestamp in project head by mifos.
the class ImportedFilesDaoHibernateIntegrationTest method testSaveAndFind.
@Test
public void testSaveAndFind() throws Exception {
Short personnelId = new Short("1");
PersonnelBO personnelBO = TestObjectFactory.getPersonnel(personnelId);
Timestamp timeStamp = new Timestamp(123134554L);
String fileName = "testFile.xls";
ImportedFilesEntity expected = new ImportedFilesEntity(fileName, timeStamp, personnelBO, null, false, false);
StaticHibernateUtil.startTransaction();
importedFilesDao.saveImportedFile(expected);
StaticHibernateUtil.flushSession();
ImportedFilesEntity actual = importedFilesDao.findImportedFileByName(fileName);
Assert.assertEquals(fileName, actual.getFileName());
Assert.assertEquals(personnelId, actual.getSubmittedBy().getPersonnelId());
Assert.assertEquals(timeStamp, actual.getSubmittedOn());
}
Aggregations