This commit is contained in:
parent
31de64e5bb
commit
8deebfafbb
7 changed files with 224 additions and 41 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package ru.spcex.clearing.reports.builders.ks;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.misc.Session;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
|
@ -14,6 +15,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
|||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
|
|
@ -28,12 +30,14 @@ import java.util.stream.Collectors;
|
|||
public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam, KSRepCashNettoReport> {
|
||||
private final Imdg<Registry> registryImdg;
|
||||
private final Imdg<Session> sessionImdg;
|
||||
private final Imdg<Account> accountImdg;
|
||||
|
||||
private List<KSRepCashNettoReport> rows = null;
|
||||
|
||||
public KSRepCashNettoReportBuilder(ImdgProvider imdgProvider) {
|
||||
registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
sessionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Session, Session.class);
|
||||
accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -158,7 +162,19 @@ public class KSRepCashNettoReportBuilder extends CSVReportBuilder<SessionIdParam
|
|||
if (session != null && session.getCreated() != null)
|
||||
ksRepCashNettoReport.setSessionDate(LocalDateTime.ofInstant(session.getCreated(), getReportZoneId()));
|
||||
|
||||
ksRepCashNettoReport.setAccount(registry.getAccount());
|
||||
|
||||
String account = "";
|
||||
AccountType accountType = IEnumKey.getEnumByKey(AccountType.class, registry.getAccountType());
|
||||
if (accountType == AccountType.Clrn) {
|
||||
account = registry.getAccount();
|
||||
} else if (accountType == AccountType.Info) {
|
||||
Account accountFromIMDG = accountImdg.getFirstObjectByFieldValues(Map.of(
|
||||
"companyId", 1L,
|
||||
"accountType", AccountType.Anlt.getKey()
|
||||
));
|
||||
if (accountFromIMDG != null) account = accountFromIMDG.getAccount();
|
||||
}
|
||||
ksRepCashNettoReport.setAccount(account);
|
||||
ksRepCashNettoReport.setTkr(registry.getTradingClearingRegistry());
|
||||
ksRepCashNettoReport.setDate(nowDate);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package ru.spcex.clearing.reports.builders.ks;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
|
|
@ -13,6 +14,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
|||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
|
|
@ -22,17 +24,20 @@ import java.time.temporal.ChronoUnit;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyParams, KSRepCashRegisterSumsReport> {
|
||||
private final Imdg<Company> companyImdg;
|
||||
private final Imdg<Registry> registryImdg;
|
||||
private final Imdg<Account> accountImdg;
|
||||
|
||||
private List<KSRepCashRegisterSumsReport> rows = null;
|
||||
|
||||
public KSRepCashRegisterSumsReportBuilder(ImdgProvider imdgProvider) {
|
||||
registryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Registry, Registry.class);
|
||||
companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -105,8 +110,19 @@ public class KSRepCashRegisterSumsReportBuilder extends CSVReportBuilder<EmptyPa
|
|||
pairRegistry.getId());
|
||||
}
|
||||
|
||||
String account = "";
|
||||
AccountType accountType = IEnumKey.getEnumByKey(AccountType.class, registry.getAccountType());
|
||||
if (accountType == AccountType.Clrn) {
|
||||
account = registry.getAccount();
|
||||
} else if (accountType == AccountType.Info) {
|
||||
Account accountFromIMDG = accountImdg.getFirstObjectByFieldValues(Map.of(
|
||||
"companyId", 1L,
|
||||
"accountType", AccountType.Anlt.getKey()
|
||||
));
|
||||
if (accountFromIMDG != null) account = accountFromIMDG.getAccount();
|
||||
}
|
||||
|
||||
String firmId = registry.getTradingCode();
|
||||
String account = registry.getAccount();
|
||||
String tkr = registry.getTradingClearingRegistry();
|
||||
String tradeNum = "";
|
||||
String registerCode = pairRegistry != null ? pairRegistry.getRegistryCode() : "";
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package ru.spcex.clearing.reports.builders.ks;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import ru.clearing.classes.statics.data.account.Account;
|
||||
import ru.clearing.classes.statics.data.company.Company;
|
||||
import ru.clearing.classes.statics.data.misc.Session;
|
||||
import ru.clearing.classes.statics.data.registry.Registry;
|
||||
|
|
@ -15,6 +16,7 @@ import ru.spcex.platform.imdg.api.ImdgProvider;
|
|||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
||||
import ru.spcex.platform.imdg.api.predicate.specific.RegistryCodeSqlBuilder;
|
||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
|
|
@ -31,6 +33,7 @@ public class KSRepCashRegistersReportBuilder extends CSVReportBuilder<EmptyParam
|
|||
private final Imdg<Company> companyImdg;
|
||||
private final Imdg<RegistryCodeDictionary> registryCodeDictionaryImdg;
|
||||
private final Imdg<Session> sessionImdg;
|
||||
private final Imdg<Account> accountImdg;
|
||||
|
||||
|
||||
private List<KSRepCashRegistersReport> rows = null;
|
||||
|
|
@ -40,6 +43,7 @@ public class KSRepCashRegistersReportBuilder extends CSVReportBuilder<EmptyParam
|
|||
companyImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Company, Company.class);
|
||||
registryCodeDictionaryImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RegistryCodeDictionary, RegistryCodeDictionary.class);
|
||||
sessionImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Session, Session.class);
|
||||
accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -96,9 +100,20 @@ public class KSRepCashRegistersReportBuilder extends CSVReportBuilder<EmptyParam
|
|||
}
|
||||
if (!WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus())) continue;
|
||||
|
||||
KSRepCashRegistersReport ksRepCashRegistersReport = new KSRepCashRegistersReport();
|
||||
String account = "";
|
||||
AccountType accountType = IEnumKey.getEnumByKey(AccountType.class, registry.getAccountType());
|
||||
if (accountType == AccountType.Clrn) {
|
||||
account = registry.getAccount();
|
||||
} else if (accountType == AccountType.Info) {
|
||||
Account accountFromIMDG = accountImdg.getFirstObjectByFieldValues(Map.of(
|
||||
"companyId", 1L,
|
||||
"accountType", AccountType.Anlt.getKey()
|
||||
));
|
||||
if (accountFromIMDG != null) account = accountFromIMDG.getAccount();
|
||||
} KSRepCashRegistersReport ksRepCashRegistersReport = new KSRepCashRegistersReport();
|
||||
|
||||
ksRepCashRegistersReport.setFirmId(registry.getTradingCode());
|
||||
ksRepCashRegistersReport.setAccount(registry.getAccount());
|
||||
ksRepCashRegistersReport.setAccount(account);
|
||||
ksRepCashRegistersReport.setTkr(registry.getTradingClearingRegistry());
|
||||
ksRepCashRegistersReport.setDate(nowDate);
|
||||
ksRepCashRegistersReport.setRegisterCode(registry.getRegistryCode());
|
||||
|
|
|
|||
|
|
@ -129,26 +129,53 @@ public class ReportServiceTest_KS {
|
|||
registryCodeDictionary.setName("AM_T_NAME");
|
||||
registryCodeDictionaryImdg.insert(registryCodeDictionary);
|
||||
|
||||
Registry registry = new Registry();
|
||||
registry.setCompanyId(COMPANY_ID);
|
||||
registry.setSecurityId(777L);
|
||||
registry.setAccountId(888L);
|
||||
registry.setRegistryCode("AM_T");
|
||||
registry.setRegistryDesignation(RegistryDesignation.A.getKey());
|
||||
registry.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
||||
registry.setRegistryUnit(RegistryUnit.T.getKey());
|
||||
registry.setUpdated(Instant.now());
|
||||
registry.setTradingCode("TRADING_CODE");
|
||||
registry.setTradingClearingRegistry("TRADING_CLEARING_REGISTRY");
|
||||
registry.setAccount("ACCOUNT");
|
||||
registry.setAccountType(AccountType.Clrn.getKey());
|
||||
registry.setOpenBalance(BigDecimal.valueOf(77.777777777));
|
||||
registry.setSettledCredit(BigDecimal.valueOf(88.88888888));
|
||||
registry.setSettledDebit(BigDecimal.valueOf(22.2222222));
|
||||
registry.setCredit(BigDecimal.valueOf(88.88888888));
|
||||
registry.setDebit(BigDecimal.valueOf(22.2222222));
|
||||
registry.setCloseBalance(BigDecimal.valueOf(11.11111111));
|
||||
registryImdg.insert(registry);
|
||||
Registry registry_1 = new Registry();
|
||||
registry_1.setCompanyId(COMPANY_ID);
|
||||
registry_1.setSecurityId(777L);
|
||||
registry_1.setAccountId(888L);
|
||||
registry_1.setRegistryCode("AM_T");
|
||||
registry_1.setRegistryDesignation(RegistryDesignation.A.getKey());
|
||||
registry_1.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
||||
registry_1.setRegistryUnit(RegistryUnit.T.getKey());
|
||||
registry_1.setUpdated(Instant.now());
|
||||
registry_1.setTradingCode("TRADING_CODE");
|
||||
registry_1.setTradingClearingRegistry("TRADING_CLEARING_REGISTRY");
|
||||
registry_1.setAccount("ACCOUNT");
|
||||
registry_1.setAccountType(AccountType.Clrn.getKey());
|
||||
registry_1.setOpenBalance(BigDecimal.valueOf(77.777777777));
|
||||
registry_1.setSettledCredit(BigDecimal.valueOf(88.88888888));
|
||||
registry_1.setSettledDebit(BigDecimal.valueOf(22.2222222));
|
||||
registry_1.setCredit(BigDecimal.valueOf(88.88888888));
|
||||
registry_1.setDebit(BigDecimal.valueOf(22.2222222));
|
||||
registry_1.setCloseBalance(BigDecimal.valueOf(11.11111111));
|
||||
registryImdg.insert(registry_1);
|
||||
|
||||
Account account = new Account();
|
||||
account.setCompanyId(1L);
|
||||
account.setAccount("ACCOUNT_FROM_ACCOUNT");
|
||||
account.setAccountType(AccountType.Anlt.getKey());
|
||||
accountImdg.insert(account);
|
||||
|
||||
Registry registry_2 = new Registry();
|
||||
registry_2.setCompanyId(COMPANY_ID);
|
||||
registry_2.setSecurityId(777L);
|
||||
registry_2.setAccountId(888L);
|
||||
registry_2.setRegistryCode("AM_T");
|
||||
registry_2.setRegistryDesignation(RegistryDesignation.A.getKey());
|
||||
registry_2.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
||||
registry_2.setRegistryUnit(RegistryUnit.T.getKey());
|
||||
registry_2.setUpdated(Instant.now());
|
||||
registry_2.setTradingCode("TRADING_CODE");
|
||||
registry_2.setTradingClearingRegistry("TRADING_CLEARING_REGISTRY");
|
||||
registry_2.setAccount("ACCOUNT");
|
||||
registry_2.setAccountType(AccountType.Info.getKey());
|
||||
registry_2.setOpenBalance(BigDecimal.valueOf(77.777777777));
|
||||
registry_2.setSettledCredit(BigDecimal.valueOf(88.88888888));
|
||||
registry_2.setSettledDebit(BigDecimal.valueOf(22.2222222));
|
||||
registry_2.setCredit(BigDecimal.valueOf(88.88888888));
|
||||
registry_2.setDebit(BigDecimal.valueOf(22.2222222));
|
||||
registry_2.setCloseBalance(BigDecimal.valueOf(11.11111111));
|
||||
registryImdg.insert(registry_2);
|
||||
|
||||
Session sessionForDay = new Session();
|
||||
sessionForDay.setClearingDate(LocalDate.now());
|
||||
|
|
@ -287,7 +314,8 @@ public class ReportServiceTest_KS {
|
|||
compareCSVFiles(expectedFile, outFile, Arrays.asList("DATE"));
|
||||
|
||||
registryCodeDictionaryImdg.delete(registryCodeDictionary);
|
||||
registryImdg.delete(registry);
|
||||
registryImdg.delete(registry_1);
|
||||
registryImdg.delete(registry_2);
|
||||
registryImdg.delete(addWithdrawRegistry_1);
|
||||
registryImdg.delete(addWithdrawRegistry_2);
|
||||
registryImdg.delete(addWithdrawRegistry_3);
|
||||
|
|
@ -298,6 +326,7 @@ public class ReportServiceTest_KS {
|
|||
registryImdg.delete(lmtRegistry_2);
|
||||
registryImdg.delete(lmtRegistry_3);
|
||||
sessionImdg.delete(sessionForDay);
|
||||
accountImdg.delete(account);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -314,6 +343,7 @@ public class ReportServiceTest_KS {
|
|||
registry_1.setTradingCode("TRADING_CODE");
|
||||
registry_1.setTradingClearingRegistry("0008CAT00001");
|
||||
registry_1.setCompanyId(COMPANY_ID);
|
||||
registry_1.setAccountType(AccountType.Clrn.getKey());
|
||||
registry_1.setAccount("ACCOUNT");
|
||||
registry_1.setRegistryCode("DM_I");
|
||||
registry_1.setRegistryDesignation("D");
|
||||
|
|
@ -321,6 +351,40 @@ public class ReportServiceTest_KS {
|
|||
registry_1.setRegistryUnit("I");
|
||||
registryImdg.insert(registry_1);
|
||||
|
||||
Account account = new Account();
|
||||
account.setCompanyId(1L);
|
||||
account.setAccountType(AccountType.Anlt.getKey());
|
||||
account.setAccount("ACCOUNT_FROM_ACCOUNT");
|
||||
accountImdg.insert(account);
|
||||
|
||||
Registry registry_2 = new Registry();
|
||||
registry_2.setUpdated(Instant.now());
|
||||
registry_2.setRegistryStatus(RegistryStatus.OK.getKey());
|
||||
registry_2.setTradingCode("TRADING_CODE");
|
||||
registry_2.setTradingClearingRegistry("0008CAT00001");
|
||||
registry_2.setCompanyId(COMPANY_ID);
|
||||
registry_2.setAccountType(AccountType.Info.getKey());
|
||||
registry_2.setAccount("ACCOUNT");
|
||||
registry_2.setRegistryCode("DM_I");
|
||||
registry_2.setRegistryDesignation("D");
|
||||
registry_2.setRegistryInstrumentType("M");
|
||||
registry_2.setRegistryUnit("I");
|
||||
registryImdg.insert(registry_2);
|
||||
|
||||
Registry registry_3 = new Registry();
|
||||
registry_3.setUpdated(Instant.now());
|
||||
registry_3.setRegistryStatus(RegistryStatus.OK.getKey());
|
||||
registry_3.setTradingCode("TRADING_CODE");
|
||||
registry_3.setTradingClearingRegistry("0008CAT00001");
|
||||
registry_3.setCompanyId(COMPANY_ID);
|
||||
registry_3.setAccountType(AccountType.Anlt.getKey());
|
||||
registry_3.setAccount("ACCOUNT");
|
||||
registry_3.setRegistryCode("DM_I");
|
||||
registry_3.setRegistryDesignation("D");
|
||||
registry_3.setRegistryInstrumentType("M");
|
||||
registry_3.setRegistryUnit("I");
|
||||
registryImdg.insert(registry_3);
|
||||
|
||||
Registry pairRegistry = new Registry();
|
||||
pairRegistry.setTradingCode("TRADING_CODE");
|
||||
pairRegistry.setAccount("ACCOUNT");
|
||||
|
|
@ -342,10 +406,15 @@ public class ReportServiceTest_KS {
|
|||
|
||||
File outFile = outFolder.listFiles()[0];
|
||||
File expectedFile = new File(getClass().getClassLoader().getResource("expected_reports_csv/ks/KS_REP_CASH_REGISTER_SUMS_expected.csv").getFile());
|
||||
// account не проверяем, строки могут быть в разной последовательности
|
||||
// главное что есть проверка на 3 строки, и что все остальные поля есть
|
||||
compareCSVFiles(expectedFile, outFile, Arrays.asList("FIRMID", "ADD_DATE", "ADD_TIME"));
|
||||
|
||||
registryImdg.delete(registry_1);
|
||||
registryImdg.delete(registry_2);
|
||||
registryImdg.delete(registry_3);
|
||||
registryImdg.delete(pairRegistry);
|
||||
accountImdg.delete(account);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -638,6 +707,46 @@ public class ReportServiceTest_KS {
|
|||
registry_2.setBalance(BigDecimal.valueOf(44.4444444));
|
||||
registryImdg.insert(registry_2);
|
||||
|
||||
Account account = new Account();
|
||||
account.setCompanyId(1L);
|
||||
account.setAccount("ACCOUNT_FROM_ACCOUNT");
|
||||
account.setAccountType(AccountType.Anlt.getKey());
|
||||
accountImdg.insert(account);
|
||||
|
||||
Registry registry_3 = new Registry();
|
||||
registry_3.setTradingCode("TRADING_CODE");
|
||||
registry_3.setSettlementDate(LocalDate.now());
|
||||
registry_3.setGroupId(Long.MAX_VALUE);
|
||||
registry_3.setClearingDate(LocalDate.now());
|
||||
registry_3.setRegistryCode("LM_T");
|
||||
registry_3.setTradingClearingRegistry("TKR");
|
||||
registry_3.setRegistryStatus(RegistryStatus.PROC.getKey());
|
||||
registry_3.setRegistryDesignation(RegistryDesignation.L.getKey());
|
||||
registry_3.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
||||
registry_3.setRegistryUnit(RegistryUnit.T.getKey());
|
||||
registry_3.setSessionId(sessionId);
|
||||
registry_3.setAccount("ACCOUNT_1");
|
||||
registry_3.setAccountType(AccountType.Info.getKey());
|
||||
registry_3.setBalance(BigDecimal.valueOf(22.2222222));
|
||||
registryImdg.insert(registry_3);
|
||||
|
||||
Registry registry_4 = new Registry();
|
||||
registry_4.setTradingCode("TRADING_CODE");
|
||||
registry_4.setSettlementDate(LocalDate.now());
|
||||
registry_4.setGroupId(Long.MAX_VALUE);
|
||||
registry_4.setClearingDate(LocalDate.now());
|
||||
registry_4.setRegistryCode("CM_T");
|
||||
registry_4.setTradingClearingRegistry("TKR");
|
||||
registry_4.setRegistryStatus(RegistryStatus.PROC.getKey());
|
||||
registry_4.setRegistryDesignation(RegistryDesignation.C.getKey());
|
||||
registry_4.setRegistryInstrumentType(RegistryInstrumentType.M.getKey());
|
||||
registry_4.setRegistryUnit(RegistryUnit.T.getKey());
|
||||
registry_4.setSessionId(sessionId);
|
||||
registry_4.setAccount("ACCOUNT_1");
|
||||
registry_4.setAccountType(AccountType.Info.getKey());
|
||||
registry_4.setBalance(BigDecimal.valueOf(44.4444444));
|
||||
registryImdg.insert(registry_4);
|
||||
|
||||
String jsonString = TestUtils.getJsonStringForSystem(reportRequest, 0L);
|
||||
|
||||
TestUtils.addRecordToKafka((MockConsumer) reportService.getConsumer(),
|
||||
|
|
@ -654,6 +763,9 @@ public class ReportServiceTest_KS {
|
|||
|
||||
registryImdg.delete(registry_1);
|
||||
registryImdg.delete(registry_2);
|
||||
registryImdg.delete(registry_3);
|
||||
registryImdg.delete(registry_4);
|
||||
accountImdg.delete(account);
|
||||
sessionImdg.delete(session);
|
||||
}
|
||||
|
||||
|
|
@ -924,23 +1036,43 @@ public class ReportServiceTest_KS {
|
|||
if (!columnsForSkip.contains(actualHeader)) actualValueForColumn.put(actualHeader, headerIdx);
|
||||
}
|
||||
|
||||
List<String[]> expectedLines = new ArrayList<>();
|
||||
do {
|
||||
String[] expectedLines = expectedCSVReader.readNext();
|
||||
String[] actualLines = actualCSVReader.readNext();
|
||||
if (expectedLines == null || actualLines == null) {
|
||||
if (expectedLines == null && actualLines == null) {
|
||||
String[] expectedLine = expectedCSVReader.readNext();
|
||||
if (expectedLine == null) break;
|
||||
expectedLines.add(expectedLine);
|
||||
} while (true);
|
||||
|
||||
List<String[]> actualLines = new ArrayList<>();
|
||||
do {
|
||||
String[] actualLine = actualCSVReader.readNext();
|
||||
if (actualLine == null) break;
|
||||
actualLines.add(actualLine);
|
||||
} while (true);
|
||||
if (expectedLines.size() != actualLines.size()) {
|
||||
Assertions.fail("expected and actual lines not equal");
|
||||
}
|
||||
|
||||
for (String[] actualLine : actualLines) {
|
||||
boolean findEqual = false;
|
||||
for (String[] expectedLine : expectedLines) {
|
||||
boolean lineEqual = true;
|
||||
for (String expectedHeader : expectedValueForColumn.keySet()) {
|
||||
int expectedIdx = expectedValueForColumn.get(expectedHeader);
|
||||
int actualIdx = actualValueForColumn.get(expectedHeader);
|
||||
String expected = expectedLine[expectedIdx];
|
||||
String actual = actualLine[actualIdx];
|
||||
lineEqual = expected.equals(actual);
|
||||
if (!lineEqual) break;
|
||||
}
|
||||
if (lineEqual) {
|
||||
findEqual = true;
|
||||
break;
|
||||
}
|
||||
Assertions.fail("expected and actual lines not equal");
|
||||
}
|
||||
for (String expectedHeader : expectedValueForColumn.keySet()) {
|
||||
int expectedIdx = expectedValueForColumn.get(expectedHeader);
|
||||
int actualIdx = actualValueForColumn.get(expectedHeader);
|
||||
String expected = expectedLines[expectedIdx];
|
||||
String actual = actualLines[actualIdx];
|
||||
assertEquals(expected, actual, expectedHeader);
|
||||
}
|
||||
} while (true);
|
||||
if (findEqual) continue;
|
||||
Assertions.fail("For actual line '%s' not found expected line".formatted(String.join(",", actualLine)));
|
||||
}
|
||||
|
||||
expectedCSVReader.close();
|
||||
actualCSVReader.close();
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
"FIRMID","SESSION_ID","SESSION_DATE","ACCOUNT","TKR","VALUE","DATE"
|
||||
"TRADING_CODE","2","20.01.1970T02:49:58","ACCOUNT","TKR","22.22","31.10.2023"
|
||||
"TRADING_CODE","2","20.01.1970T02:49:58","ACCOUNT","TKR","22.22","01.11.2023"
|
||||
"TRADING_CODE","2","20.01.1970T02:49:58","ACCOUNT_FROM_ACCOUNT","TKR","22.22","01.11.2023"
|
||||
|
|
|
|||
|
|
|
@ -1,2 +1,3 @@
|
|||
"FIRMID","ACCOUNT","TKR","DATE","REGISTER_CODE","REGISTER_NAME","OPEN_BALANCE","CHANGE_BALANCE","ADD_WITHDRAW","CLOSE_BALANCE","REMARKS","TRADE_NUM"
|
||||
"TRADING_CODE","ACCOUNT","TRADING_CLEARING_REGISTRY","31.10.2023","AM_T","AM_T_NAME","77.78","300.00","111.00","488.78","",""
|
||||
"TRADING_CODE","ACCOUNT_FROM_ACCOUNT","TRADING_CLEARING_REGISTRY","01.11.2023","AM_T","AM_T_NAME","77.78","300.00","111.00","488.78","",""
|
||||
"TRADING_CODE","ACCOUNT","TRADING_CLEARING_REGISTRY","01.11.2023","AM_T","AM_T_NAME","77.78","300.00","111.00","488.78","",""
|
||||
|
|
|
|||
|
|
|
@ -1,2 +1,4 @@
|
|||
"FIRMID","ACCOUNT","TKR","REGISTER_CODE","ADD_SUM","ADD_TIME","ADD_DATE","TRADE_NUM"
|
||||
"TRADING_CODE","ACCOUNT","0008CAT00001","AM_T","0.00","13:02:50","02.10.2023",""
|
||||
"TRADING_CODE","","0008CAT00001","AM_T","0.00","15:30:57","01.11.2023",""
|
||||
"TRADING_CODE","ACCOUNT","0008CAT00001","AM_T","0.00","15:30:57","01.11.2023",""
|
||||
"TRADING_CODE","ACCOUNT_FROM_ACCOUNT","0008CAT00001","AM_T","0.00","15:30:57","01.11.2023",""
|
||||
|
|
|
|||
|
Loading…
Add table
Reference in a new issue