Compare commits

...

2 commits

Author SHA1 Message Date
ialbert
18bbd2a856 потер комменты в *.java файлах 2023-07-25 15:03:44 +03:00
ialbert
738bb38b52 потер комменты в *.java файлах 2023-07-25 15:02:15 +03:00
651 changed files with 512 additions and 7485 deletions

View file

@ -18,12 +18,10 @@ import ru.spcex.platform.classes.base.SpcexObjectBase;
import ru.spcex.platform.enumeration.AccountStatus;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.ServiceStatus;
import ru.spcex.platform.enumeration.WorkflowStatus;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
import ru.spcex.platform.imdg.validation.ImdgValidationContext;
import ru.spcex.platform.utils.enumeration.IErrorEnumId;
import ru.spcex.platform.utils.validation.IValidator;
import ru.spcex.platform.utils.validation.ValidatorImpl;
@ -55,7 +53,6 @@ public class AccountValidationConfig {
Company.class,
AccountError.RequiredFieldEmpty,
AccountError.CompanyNotFound
// company -> WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive
),
FieldRequiredRule.instance("account",
CorrespondentAccountNewRequest::getAccount,

View file

@ -7,7 +7,6 @@ import ru.clearing.classes.statics.data.account.BankAccount;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
import ru.clearing.platform.dictionary.WorkflowStatusDictionary;
import ru.spcex.clearing.account.errors.AccountError;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
@ -20,7 +19,6 @@ import ru.spcex.platform.classes.base.SpcexObjectBase;
import ru.spcex.platform.enumeration.AccountStatus;
import ru.spcex.platform.enumeration.AccountType;
import ru.spcex.platform.enumeration.ServiceStatus;
import ru.spcex.platform.enumeration.WorkflowStatus;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
@ -124,7 +122,6 @@ public class BankAccountValidationConfig {
);
Account account = accountImdg.getSingleObjectByID(accountId);
if (account == null) return AccountError.AccountNotFound;
// if (!AccountStatus.ACTIVE.equalsByKey(account.getStatus())) return AccountError.AccountNotActive;
return null;
}),
DictionaryPresentRule.instance("currency",

View file

@ -51,7 +51,6 @@ public class ClearingAccountValidationConfig {
Company.class,
AccountError.RequiredFieldEmpty,
AccountError.CompanyNotFound
// company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null
),
FieldRequiredRule.instance("account",
ClearingAccountNewRequest::getAccount,

View file

@ -148,7 +148,6 @@ public class ClientCodeValidationConfig {
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
addImdg.accept(IMDGDistributedNames.Map_ClientCode);
return new ValidatorImpl<>(context,
// FieldRequiredRule.instance("id", CommonDeleteRequest::getId, CompanyErrors.RequiredFieldEmpty),
IdPresentRule.instance("id",
CommonDeleteRequest::getId,
IMDGDistributedNames.Map_ClientCode,

View file

@ -48,7 +48,6 @@ public class DepoAccountValidationConfig {
Company.class,
AccountError.RequiredFieldEmpty,
AccountError.CompanyNotFound
// company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null
),
FieldRequiredRule.instance("account",
DepoAccountNewRequest::getAccount,

View file

@ -83,26 +83,10 @@ public class TradingClearingRegistryValidationConfig {
return AccountError.AccountNotFound;
} else {
if (AccountType.Clrn.equalsByKey(account.getAccountType()) || AccountType.Info.equalsByKey(account.getAccountType())) {
// ok
} else {
// неправильный тип
return AccountError.AccountNotFound;
}
}
// Imdg<ClearingAccount> clearingAccountImdg = context.obtainMap(
// IMDGDistributedNames.Map_ClearingAccount, ClearingAccount.class
// );
// ClearingAccount clearingAccount = clearingAccountImdg.getSingleObjectByFieldValues(
// Map.of("accountId",moneyAccountId)
// );
// if (clearingAccount == null) {
// Imdg<InformationAccount> informationAccountImdg = context.obtainMap(
// IMDGDistributedNames.Map_InformationAccount, InformationAccount.class
// );
// InformationAccount infoAccount = informationAccountImdg.getSingleObjectByFieldValues(
// Map.of("accountId",moneyAccountId));
// if (infoAccount == null) return AccountError.AccountNotFound;
// }
return null;
}),
FieldRequiredRule.instance("depoAccountId",
@ -139,11 +123,6 @@ public class TradingClearingRegistryValidationConfig {
if (validatedObject.getMoneyAccountId() == null) {
return of(AccountError.RequiredFieldEmpty, "MoneyAccountId");
}
//Map<String, Comparable<?>> query = new HashMap<>();
// query.put("moneyAccountId", validatedObject.getMoneyAccountId());
// if (validatedObject.getDepoAccountId() != null) {
// query.put("depoAccountId", validatedObject.getDepoAccountId());
// }
ImdgPredicateBuilder pb = tcrMap.predicateBuilder();
ImdgPredicate query = pb.equals("moneyAccountId", validatedObject.getMoneyAccountId());
if (validatedObject.getDepoAccountId() != null) {

View file

@ -8,7 +8,10 @@ import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.company.CompanySymbols;
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
import ru.clearing.platform.dictionary.*;
import ru.clearing.platform.dictionary.AccountTypeDictionary;
import ru.clearing.platform.dictionary.ClearingAccountTypeDictionary;
import ru.clearing.platform.dictionary.CurrencyCodeDictionary;
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.validation.common.ValidationHelper;
import ru.spcex.platform.classes.base.SpcexObjectBase;
@ -41,8 +44,6 @@ public class ValidationConfig {
addImdg.accept(IMDGDistributedNames.Map_DepoAccount, DepoAccount.class);
addImdg.accept(IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class);
addImdg.accept(IMDGDistributedNames.Map_TradingClearingRegistry, TradingClearingRegistry.class);
//for ClientCodeValidationConfig
addImdg.accept(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
return imdg;

View file

@ -19,7 +19,7 @@ public enum AccountError implements IErrorEnumId {
DepoAccountNotFound(5017L),
MoneyAccountNotFound(5018L),
ClearingCategoryNotFound(5019L),
ClearingCompanySymbolNotFound(5022L), // Для компании %s отсутствует клиринговый код».
ClearingCompanySymbolNotFound(5022L),
AccountForTradingClearingRegistryAlreadyUsed(5023L),
TradingClearingRegistryNotFound(3022L),
;

View file

@ -17,13 +17,8 @@ import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountUpdateRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdf01Request;
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart;
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountTerminationRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.balance.AccountSdfToStatementRequestPart;
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonIdRequest;
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
import ru.spcex.clearing.platform.messaging.service.Status;
@ -44,9 +39,7 @@ import ru.spcex.platform.utils.enumeration.IMessageResolver;
import ru.spcex.platform.utils.validation.IValidator;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Function;
@Service
@ -200,7 +193,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
log.debug("AccountTerminationRequest received, id={}", userRequest.getId());
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
if (requestInfoUpdate != null) return requestInfoUpdate; // never - system
if (requestInfoUpdate != null) return requestInfoUpdate;
AccountTerminationRequest req = userRequest.getRequestPayload();
final Long companyId = req.getCompanyId();
@ -212,7 +205,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
try {
tx.beginTransaction();
for (Account account : accounts) {
//Account account = accountMap.getSingleObjectByID(request.getId());
if (!ServiceStatus.Blocked.equalsByKey(account.getStatus())) {
account.setStatus(ServiceStatus.Blocked.getKey());
account.setUpdated(Instant.now());
@ -238,11 +230,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
}
/**
* Заполняет поля relationId и companyId из соответствующей записи Relation
*
* @param requestId Идентификатор запроса для вывода лога
*/
public RequestInfoUpdate fillAccountFromRelation(Account account, Long requestId, boolean checkClearingMemberCategory) {
Long companyId = account.getCompanyId();
Collection<Relation> relations;
@ -269,7 +256,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
} else {
log.info("ClearingCategoryNotFound with clearingCategoryValue={} not implemented. Do not search Relation.", clearingCategoryValue);
return null;
//return makeError(requestId, AccountError.ClearingCategoryNotFound, companyId, clearingCategoryValue + " (case not implemented)");
}
finalRelationPredicate = relationPredicateBuilder.and(consumerIdPredicate, servicePredicate);
relations = relationMap.getCollectionObjectsByPredicate(finalRelationPredicate);
@ -279,7 +265,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
}
if (relations.isEmpty()) {
//return makeError(requestId, AccountError.WrongFieldValue, "companyId", finalRelationPredicate.toString());
log.info("Relation not found: {}", finalRelationPredicate.toString());
return null;
}

View file

@ -221,7 +221,6 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
account.setUpdated(Instant.now());
accountMap.update(account);
//без изменений bankAccountMap.update(bankAccount);
log.debug("successfully block, existing bankAccount with id {}", bankAccount.getId());
return null;

View file

@ -221,11 +221,11 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
account.setUpdated(now);
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
if (requestInfoUpdate != null) {
log.warn("Error fill new account from relation. {}", /*account.getId(),*/ requestInfoUpdate.getMessage());
log.warn("Error fill new account from relation. {}", requestInfoUpdate.getMessage());
{
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
responsePart.setSdfId(accountReq.getSdfId());
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId()); // see accountService.fillAccountFromRelation
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId());
responsePart.setErrorText(requestInfoUpdate.getMessage());
accountToStatement.add(responsePart);
continue accountsLoop;
@ -286,7 +286,7 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
request.setGroupId(groupingSdf01Id);
request.setAccountCreationResults(results);
request.setContinueSdf(true);
request.setTable(SdfTable.SDF_01); // по нему запрос получили
request.setTable(SdfTable.SDF_01);
log.debug("Send message to kafka \"{}\": {}", Consts.STATEMENT_PROCESS, LogFormatter.toStringWrapper(request));
kafkaSender.sendRequestToQueue(Consts.STATEMENT_PROCESS, request);
}

View file

@ -115,18 +115,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
}
/**
* Проверки
* 3.5.1 если не была найдена запись в tradingClearingRegistry по companyId, moneyAccountId, depoAccountId и tradingClearingRegistryType=B (п 3.5.1)
* 3.5.2 если не заполнены поля moneyAccountId ИЛИ moneyAccountId и depoAccountId
* @param userRequest
* @param moneyAccountId req.getMoneyAccountId()
* @param depoAccountId req.getDepoAccountId()
* @param companyId req.getCompanyId()
* @return
*/
RequestInfoUpdate crossValidate(BaseRequest<?> userRequest, Long moneyAccountId, Long depoAccountId, Long companyId) {
if (moneyAccountId == null) { // Если не заполнены moneyAccountId ИЛИ moneyAccountId и depoAccountId
if (moneyAccountId == null) {
EnumMessage error = null;
if (companyId == null) {
error = new EnumMessage(AccountError.RequiredFieldEmpty, "companyId");
@ -153,7 +143,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
if (requestInfoUpdate != null) return requestInfoUpdate;
ClientCodeNewRequest req = userRequest.getRequestPayload();
// дополнительная проверка
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
if (requestInfoUpdate != null) return requestInfoUpdate;
@ -190,7 +179,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
ClientCodeNewRequest req = userRequest.getRequestPayload();
// дополнительная проверка
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
if (requestInfoUpdate != null) return requestInfoUpdate;
@ -224,7 +212,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, clientCodeUpdateRequestValidator);
if (requestInfoUpdate != null) return requestInfoUpdate;
// дополнительная проверка
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
if (requestInfoUpdate != null) return requestInfoUpdate;
@ -297,7 +284,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
}
private boolean checkNeedCreateTCR(Long companyId, Long moneyAccountId, Long depoAccountId) {
// moneyAccountId обязателен, depoAccountId опционален
if (moneyAccountId == null) {
return false;
}
@ -321,11 +307,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
requestPayload.setCompanyId(companyId);
requestPayload.setMoneyAccountId(moneyAccountId);
requestPayload.setDepoAccountId(depoAccountId);
// requestPayload.setStatus(WorkflowStatus.Active.getKey());
requestPayload.setTradingClearingRegistryType(TradingClearingRegistryType.Client_B.getKey());
request.setRequestPayload(requestPayload);
// Следующий вызываемый метод обязательно должен быть synchronized.
RequestInfoUpdate reply = tradingClearingRegistryService.tradingClearingRegistryNew(request);
if (reply != null && Status.Error.equals(reply.getStatus())) {
log.warn("tradingClearingRegistryService return error: " + reply.getMessage());
@ -355,11 +338,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
}
/**
* @param queue Consts.*
* @param message BaseRequest
* @return
*/
private Long sendMessage(String queue, BaseRequest<?> message) {
Long sentRequestId = message.getId();
if (sentRequestId == null) {
@ -383,13 +361,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
return null;
}
/**
* @param req требуется заполнить tradingClearingRegistryId по tradingClearingRegistry.code
* @return
*/
private ClientCode buildClientCode(ClientCodeNewRequest req) {
ClientCode clientCode = new ClientCode();
// clientCode.setId(idSequence.newId()); add in insert
clientCode.setCreated(Instant.now());
clientCode.setUpdated(clientCode.getCreated());

View file

@ -146,8 +146,6 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
accountsLoop:
for (AccountSdfRequestPart accountReq : req.getAccounts()) {
// DepoAccountNewRequest req = userRequest.getRequestPayload();
Instant now = Instant.now();
Account account = new Account();
account.setAccount(accountReq.getAccount());
@ -158,11 +156,11 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
account.setUpdated(now);
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
if (requestInfoUpdate != null) {
log.warn("Error fill new account from relation. {}", /*account.getId(),*/ requestInfoUpdate.getMessage());
log.warn("Error fill new account from relation. {}", requestInfoUpdate.getMessage());
{
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
responsePart.setSdfId(accountReq.getSdfId());
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId()); // see accountService.fillAccountFromRelation
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId());
responsePart.setErrorText(requestInfoUpdate.getMessage());
accountToStatement.add(responsePart);
continue accountsLoop;
@ -222,9 +220,9 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
public void sendStatementRequestBack(Long groupingSdf01Id, List<AccountSdfToStatementRequestPart> results) {
StatementRequest request = new StatementRequest();
request.setGroupId(groupingSdf01Id);
request.setContinueSdf(true); //fixme????
request.setContinueSdf(true);
request.setAccountCreationResults(results);
request.setTable(SdfTable.SDF_08); // по нему запрос получили
request.setTable(SdfTable.SDF_08);
log.debug("Send message to kafka \"{}\": {}", Consts.STATEMENT_PROCESS, LogFormatter.toStringWrapper(request));
kafkaSender.sendRequestToQueue(Consts.STATEMENT_PROCESS, request);
}

View file

@ -16,7 +16,6 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.account.InformationAccountNewRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.reports.NotificationRequest;
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
@ -57,10 +56,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
private final Function<InformationAccountNewRequest, IValidator> infoAccountNewRequestValidator;
private final Imdg<InformationAccount> informationAccountImdg;
private final Imdg<Account> accountImdg;
/**
* Кэш-счётчик сквозных номеров счетов.
* См. accountNextId()
*/
protected AtomicLong infoCounter;
@Autowired
@ -183,12 +178,10 @@ public class InformationAccountService extends QueueConsumer implements Initiali
log.debug("InformationAccountNewRequest received (system), request id={}", userRequest.getId());
RequestInfoUpdate requestInfoUpdate;
// RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, infoAccountNewRequestValidator);
// if (requestInfoUpdate != null) return requestInfoUpdate;
final Long forCompanyId = userRequest.getRequestPayload().getCompanyId();
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
{ // Проверка существования счёта
{
Collection<Account> accountsAnlt = accountImdg.getCollectionObjectsByFieldValues(Map.of(
"companyId", forCompanyId,
"accountType", AccountType.Info.getKey()
@ -202,7 +195,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
Long newId = informationAccountImdg.nextIDSequenceFor();
Long infoSequenceId = accountNextId(); // требуется последовательность n+1
Long infoSequenceId = accountNextId();
String accountValue = generateInfoAccount(infoSequenceId);
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
@ -268,17 +261,12 @@ public class InformationAccountService extends QueueConsumer implements Initiali
imdgTransaction.rollbackTransaction();
}
}
// send to kafka
sendNotificationToReport(informationAccount, account);
return null;
}
/**
* Формирование уведолмения о регистрации УК
*/
protected void sendNotificationToReport(InformationAccount informationAccount, Account account) {
NotificationRequest request = new NotificationRequest();
request.setConsumerId(account.getCompanyId());
@ -291,11 +279,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
}
/**
* Сквозной номер инфо-счетов
*
* @return infoCounter++
*/
protected Long accountNextId() {
if (infoCounter == null) synchronized (this) {
if (infoCounter == null) {
@ -308,7 +291,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
Pattern accPattern = Pattern.compile("39911810([0-9]{8})7000");
int maxN = 1;
int parsedCount = 0;
String lastAccount = null; // for debug
String lastAccount = null;
for (Account acc : allInfoAcc) {
try {
String number = acc.getAccount();

View file

@ -99,7 +99,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
this.relationImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
this.tradingClearingRegistryNewRequestValidator = tradingClearingRegistryNewRequestValidator;
this.tradingClearingRegistryAutoNewRequestValidator = tradingClearingRegistryNewRequestValidator; // без relation.
this.tradingClearingRegistryAutoNewRequestValidator = tradingClearingRegistryNewRequestValidator;
this.tradingClearingRegistryUpdateRequestValidator = tradingClearingRegistryUpdateRequestValidator;
this.tradingClearingRegistryBlockRequestValidator = tradingClearingRegistryBlockRequestValidator;
this.messageResolver = messageResolver;
@ -108,7 +108,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
@Override
public void afterPropertiesSet() throws Exception {
imdgProvider.waitAvailable();
callback(TradingClearingRegistryNewRequest.class) // todo deprecated - unused.
callback(TradingClearingRegistryNewRequest.class)
.setFunction(this::tradingClearingRegistryAutoNew)
.forDestination(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_AUTO_NEW, callbacks::put);
callback(TradingClearingRegistryNewRequest.class)
@ -143,18 +143,13 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
Account depoAccountMain = req.getDepoAccountId() != null ? accountImdg.getSingleObjectByID(req.getDepoAccountId()) : null;
DepoAccount depoAccount = depoAccountMain != null ? depoAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getDepoAccountId())) : null;
// InformationAccount infoAccount = null;
ClearingAccount clearingAccount = null;
Account accountMain = null;
if (req.getMoneyAccountId() != null) {
clearingAccount = clearingAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
// if (clearingAccount == null) infoAccount = informationAccountImdg.getSingleObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
Long accountId = req.getMoneyAccountId(); //clearingAccount != null ? clearingAccount.getAccountId() : infoAccount.getAccountId();
Long accountId = req.getMoneyAccountId();
accountMain = accountImdg.getSingleObjectByID(accountId);
}
// кроссвалидация
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
if (registryByCompany == null) {
@ -194,7 +189,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
}
if (accountId != null) {
accountMain = accountImdg.getSingleObjectByID(accountId);
if (accountMain == null) { // never, только с инконсистентными данными
if (accountMain == null) {
log.warn("Account {} not exist.", accountId);
} else {
tradingClearingRegistry.setMoneyAccountId(accountId);
@ -262,9 +257,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
tradingClearingRegistryImdg.insert(tradingClearingRegistry);
log.debug("New TCR.id={} was created", tradingClearingRegistry.getId());
// sendNotificationToCompanySvc(tradingClearingRegistry); при автосоздании ТКР в company-service не отправлять.
// sendNotificationToClearingSvc(tradingClearingRegistry);
sendNotificationToReportSvc(tradingClearingRegistry);
sendNotificationToClearingSvc(tradingClearingRegistry);
@ -285,7 +277,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
}
TradingClearingRegistryNewRequest req = userRequest.getRequestPayload();
// Дополнительная проверка
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
if (registryByCompany == null) {
@ -394,14 +385,14 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
if (code.length() > 4)
code = code.substring(code.length() - 4);
code = "%4s".formatted(code).replace(' ', '0');
code += registryPurpose.getKey(); // C / M / ...
String trType = tradingRegistryType + "T"; // 2 символа
code += registryPurpose.getKey();
String trType = tradingRegistryType + "T";
code += trType;
String sId = "%5s".formatted(id).replace(' ', '0');
if (sId.length() > 5)
sId = sId.substring(sId.length() - 5);
code += sId;
return code; // 12 имволов
return code;
}
public RequestInfoUpdate tradingClearingRegistryUpdate(BaseRequest<TradingClearingRegistryUpdateRequest> userRequest) {
@ -414,16 +405,12 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
TradingClearingRegistryUpdateRequest req = userRequest.getRequestPayload();
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByID(req.getId());
// кроссвалидация - нельзя менять эти поля:
if (req.getMoneyAccountId() != null && !req.getMoneyAccountId().equals(tradingClearingRegistry.getMoneyAccountId())) {
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "MoneyAccountId", req.getMoneyAccountId());
}
if (req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())) {
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "DepoAccountId", req.getDepoAccountId());
}
// tradingClearingRegistry.setMoneyAccountId(req.getMoneyAccountId());
// tradingClearingRegistry.setDepoAccountId(req.getDepoAccountId());
if (req.getStatus() != null && !Objects.equals(req.getStatus(), tradingClearingRegistry.getStatus())) {
@ -461,9 +448,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
}
/**
* company-service сообщение об успешном добавлении ТКР клиента с параметром tradingClearingRegistry.code
*/
protected void sendNotificationToCompanySvc(TradingClearingRegistry tradingClearingRegistry) {
ClientCodeNewRequest request = new ClientCodeNewRequest();
request.setTradingClearingRegistryId(tradingClearingRegistry.getId());
@ -475,9 +459,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
kafkaSender.sendRequestToQueue(Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, request);
}
/**
* clearing-service сообщение на открытие клиринговых регистров;
*/
protected void sendNotificationToClearingSvc(TradingClearingRegistry tradingClearingRegistry) {
CreateRegistryRequest request = new CreateRegistryRequest();
request.setCompanyId(tradingClearingRegistry.getCompanyId());
@ -486,9 +467,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
kafkaSender.sendRequestToQueue(Consts.REGISTRY_NEW, request);
}
/**
* report-service сообщение на формирование уведомления о создании нового ТКР
*/
protected void sendNotificationToReportSvc(TradingClearingRegistry tradingClearingRegistry) {
NotificationRequest request = new NotificationRequest();
request.setConsumerId(tradingClearingRegistry.getCompanyId());

View file

@ -29,7 +29,6 @@ public enum AccountValidationRule implements IValidationRule<ImdgValidationConte
if (!Status.Active.equalsByKey(company.getWorkflowStatus())) {
return of(AccountError.CompanyNotActive);
}
// context.storeObject(ValidationStored.Company, company);
return empty();
}
},

View file

@ -1,7 +1,5 @@
package ru.spcex.clearing.account.service;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.kafka.clients.consumer.MockConsumer;
import org.apache.kafka.clients.producer.MockProducer;
import org.apache.kafka.clients.producer.Producer;
@ -26,37 +24,24 @@ import ru.spcex.clearing.account.config.validation.AccountValidationConfig;
import ru.spcex.clearing.account.config.validation.ValidationConfig;
import ru.spcex.clearing.account.utils.MatcherFactory;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.ActionType;
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountUpdateRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdf01Request;
import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart;
import ru.spcex.clearing.platform.messaging.domain.cud.balance.AccountSdfToStatementRequestPart;
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest;
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
import ru.spcex.clearing.platform.messaging.service.Status;
import ru.spcex.clearing.test.TestObjectCreator;
import ru.spcex.clearing.test.config.ImdgTestConfig;
import ru.spcex.clearing.test.config.KafkaTestConfig;
import ru.spcex.platform.enumeration.*;
import ru.spcex.platform.imdg.api.Imdg;
import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast;
import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
import javax.annotation.PostConstruct;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
import static ru.spcex.clearing.test.TestUtils.*;
import static ru.spcex.clearing.test.config.ImdgTestConfig.currentID;
@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {
@ -197,15 +182,11 @@ class AccountServiceTest {
String jsonString = getJsonStringForUpdate(correspondentAccountUpdateRequest, 0);
//ACT
addRecordToKafka((MockConsumer) accountService.getConsumer(),
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE,
PARTITION,
0,
jsonString);
//ASSERT
waitingSendAndCheckRecord(0L, mockProducer);
Account resultUpdating = accountImdg.getSingleObjectByID(accountId);
@ -227,15 +208,11 @@ class AccountServiceTest {
commonDeleteRequest.setId(accountId);
String jsonString = getJsonStringForDelete(commonDeleteRequest, 0);
//ACT
addRecordToKafka((MockConsumer) accountService.getConsumer(),
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK,
PARTITION,
0,
jsonString);
//ASSERT
waitingSendAndCheckRecord(0L, mockProducer);
Account resultBlock = accountImdg.getSingleObjectByID(accountId);

View file

@ -133,23 +133,8 @@ public class BankAccountServiceTest {
new TestObjectCreator(hazelcastServiceTest).createUserAdmin(1000L);
}
/**
* {@link BankAccountService#bankAccountNew(BaseRequest request)}<br>
* Тест проверяет генерацию сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.<br>
* Входной запрос {@link BankAccountNewRequest}:<br>
* {@link BankAccountNewRequest#bankIdentificationCode} - 99999<br>
* {@link BankAccountNewRequest#bankName} - ооо тинькофф<br>
* {@link BankAccountNewRequest#correspondentAccount} - 9294189285498598598<br>
* {@link BankAccountNewRequest#correspondentAccountName} - BIK OF<br>
* {@link BankAccountNewRequest#currency} - RUB<br>
* {@link BankAccountNewRequest#destination} - OOO ROGA I KOPITA<br>
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 848484848484<br>
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886<br>
* {@link BankAccountNewRequest#account} - 123456789123<br>
*/
@Test
public void bankAccountNew() {
//ARRANGE
BankAccount predictableBankAccount = getBankAccount();
Company company = getTestCompany();
@ -174,8 +159,6 @@ public class BankAccountServiceTest {
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
//ACT
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonString);
waitingSendAndCheckRecord(ID, mockProducer);
@ -184,26 +167,10 @@ public class BankAccountServiceTest {
predictableBankAccount.setAccountId(accountResult.getId());
predictableBankAccount.setId(bankAccountResult.getId());
setSameValueToField(accountResult, predictableAccount);
//ASSERT
BANK_ACCOUNT_MATCHER.assertMatch(bankAccountResult, predictableBankAccount);
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
}
/**
* {@link BankAccountService#bankAccountNew(BaseRequest request)}<br>
* Тест проверяет валидацию.<br>
* Входной запрос {@link BankAccountNewRequest}:<br>
* {@link BankAccountNewRequest#bankIdentificationCode} - 99999<br>
* {@link BankAccountNewRequest#bankName} - ооо тинькофф<br>
* {@link BankAccountNewRequest#correspondentAccount} - 9294189285498598598<br>
* {@link BankAccountNewRequest#correspondentAccountName} - BIK OF<br>
* {@link BankAccountNewRequest#currency} - RUB<br>
* {@link BankAccountNewRequest#destination} - OOO ROGA I KOPITA<br>
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 848484848484<br>
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886<br>
* {@link BankAccountNewRequest#account} - 123456789123<br>
*/
@Test
public void validatedBankAccountNew() {
clearImdg(accountImdg);
@ -213,8 +180,6 @@ public class BankAccountServiceTest {
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
String errMsg;
//AccountValidationRule.RequiredFields
//WrongFieldValue
bankAccountNewRequest.setCurrency(null);
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "currency"));
checkError(errMsg, bankAccountNewRequest);
@ -248,22 +213,14 @@ public class BankAccountServiceTest {
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "companyId"));
checkError(errMsg, bankAccountNewRequest);
bankAccountNewRequest.setCompanyId(addresseeIdNew);
//AccountValidationRule.CompanyPresent
//CompanyNotFound
bankAccountNewRequest.setCompanyId(999924535239L);
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotFound, "companyId"));
checkError(errMsg, bankAccountNewRequest);
//CompanyNotActive
company.setWorkflowStatus(Status.Blocked.getKey());
companyImdg.insert(company);
bankAccountNewRequest.setCompanyId(company.getId());
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotActive, "companyId"));
checkError(errMsg, bankAccountNewRequest);
//AccountValidationRule.AccountIsNew
//AccountAlreadyExist
company.setWorkflowStatus(Status.Active.getKey());
companyImdg.insert(company);
Account existAccount = getTestAccount(accountId, acc);
@ -274,7 +231,6 @@ public class BankAccountServiceTest {
}
private void checkError(String errorMsg, BankAccountNewRequest bankAccountNewRequest) {
//ARRANGE
int currentTime = countRun.getAndIncrement();
long currentOffset = currentTime;
BaseRequest<Object> predictableBaseRequest = new BaseRequest<>();
@ -287,40 +243,17 @@ public class BankAccountServiceTest {
predictableBaseRequest.setRequestPayload(requestInfoUpdate);
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
//ACT
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, currentOffset, jsonString);
//waiting for kafka producer send message (finale event)
verify(producer, timeout(30_000L).times(currentTime))
.send(producerRecord.capture());
BaseRequest<Object> baseRequestResult = (BaseRequest<Object>) producerRecord.getValue().value();
//ASSERT
assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic());
BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest);
}
/**
* {@link BankAccountService#bankAccountUpdate(BaseRequest)}<br>
* Тест проверяет обновление сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.<br>
* Входной запрос {@link BankAccountUpdateRequest}:<br>
* {@link BankAccountUpdateRequest#bankIdentificationCode} - NEW BUNK NAME<br>
* {@link BankAccountUpdateRequest#bankName} - 88888<br>
* {@link BankAccountUpdateRequest#correspondentAccount} - 894984646541316<br>
* {@link BankAccountUpdateRequest#correspondentAccountName} - BIK OF NEW BUNK<br>
* {@link BankAccountUpdateRequest#currency} - EU<br>
* {@link BankAccountUpdateRequest#destination} - OOO NEW BUNK<br>
* {@link BankAccountUpdateRequest#taxpayerIdentificationNumber} - 65468461321<br>
* {@link BankAccountUpdateRequest#taxRegistrationReasonCode} - 532137<br>
* {@link BankAccountUpdateRequest#account} - 326984656514<br>
*/
@Test
void bankAccountUpdate() {
clearImdg(accountImdg);
//ARRANGE
// Company company = getTestCompany();
// companyImdg.insert(company);
Account predictableAccount = getTestAccount(accountId, acc);
accountImdg.insert(predictableAccount);
@ -351,11 +284,7 @@ public class BankAccountServiceTest {
bankAccountUpdateRequest.setAccount(predictableUpdateBankAccount.getAccount());
String jsonString = getJsonStringForUpdate(bankAccountUpdateRequest, ID);
//ACT
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_UPDATE, PARTITION, 0, jsonString);
//ASSERT
waitingSendAndCheckRecord(ID, mockProducer);
Account accountResult = accountImdg.getSingleObjectByID(predictableAccount.getId());
@ -367,15 +296,8 @@ public class BankAccountServiceTest {
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
}
/**
* {@link BankAccountService#bankAccountDelete(BaseRequest)}
* Тест проверяет удаление сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.
* Входной запрос {@link CommonDeleteRequest}:
* {@link CommonDeleteRequest#id} - Идентификатор записи
*/
@Test
void bankAccountDelete() {
//ARRANGE
BankAccount bankAccountExists = getBankAccount();
bankAccountImdg.insert(bankAccountExists);
Account account = new Account();
@ -386,11 +308,7 @@ public class BankAccountServiceTest {
CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest();
commonDeleteRequest.setId(ID);
String jsonString = getJsonStringForDelete(commonDeleteRequest, ID);
//ACT
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_DELETE, PARTITION, 0, jsonString);
//ASSERT
waitingSendAndCheckRecord(ID, mockProducer);
BankAccount bankAccount = bankAccountImdg.getSingleObjectByID(ID);

View file

@ -223,78 +223,4 @@ class ClearingAccountServiceTest {
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
}
// /**
// * {@link ClearingAccountService#accountNewSdf01(BaseRequest)}<br>
// * Тест проверяет создание сущности {@link BaseRequest} в Hazelcast при передаче из Apache Kafka.<br>
// * Входной запрос {@link AccountSdf01Request}:<br>
// * {@link AccountSdfRequestPart#setSdfId} - текущий Id<br>
// * {@link AccountSdfRequestPart#setAccount} - 123456789123<br>
// * {@link AccountSdfRequestPart#setCompanyId} - текущий Id<br>
// * {@link AccountSdf01Request#setGroupingSdf01Id} - текущий Id<br>
// * {@link AccountSdf01Request#setAccounts} - Collections.singletonList(AccountSdfRequestPart)<br>
// */
// @Test
// void accountSdf01New() throws InterruptedException {
// //ARRANGE
// Long firstID = currentID.getAndIncrement();
// Long secondID = currentID.getAndIncrement();
// AccountSdfRequestPart accountSdfRequestPart = new AccountSdfRequestPart();
// accountSdfRequestPart.setSdfId(firstID);
// accountSdfRequestPart.setAccount(account);
// accountSdfRequestPart.setCompanyId(firstID);
// AccountSdf01Request accountSdf01Request = new AccountSdf01Request();
// accountSdf01Request.setGroupingSdf01Id(firstID);
// accountSdf01Request.setAccounts(Collections.singletonList(accountSdfRequestPart));
// BaseRequest<AccountSdf01Request> baseNewRequest = new BaseRequest<>();
// baseNewRequest.setRequestPayload(accountSdf01Request);
// baseNewRequest.setId(firstID);
// baseNewRequest.setActionType(ActionType.NEW);
// String jsonBaseNewRequest;
// ObjectMapper objectMapper = new ObjectMapper();
// try {
// jsonBaseNewRequest = objectMapper.writeValueAsString(baseNewRequest);
// } catch (JsonProcessingException e) {
// throw new RuntimeException(e);
// }
//
// AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
// responsePart.setSdfId(firstID);
// responsePart.setErrorCode(null);
// responsePart.setErrorText(null);
// List<AccountSdfToStatementRequestPart> accountToStatement = Collections.singletonList(responsePart);
// StatementRequest statementRequest = new StatementRequest();
// statementRequest.setGroupId(firstID);
// statementRequest.setAccountCreationResults(accountToStatement);
//
// BaseRequest<Object> baseRequest = new BaseRequest<>();
// baseRequest.setId(secondID);
// baseRequest.setActionType(ActionType.SYSTEM);
// baseRequest.setRequestPayload(statementRequest);
//
// Account predictableAccount = new Account();
// predictableAccount.setAccount(account);
// predictableAccount.setCompanyId(firstID);
//
// RequestInfo predictableRequestInfo = new RequestInfo();
// predictableRequestInfo.setId(secondID);
// predictableRequestInfo.setStatus(Status.Processing);
//
// //KAFKA
// final String TOPIC_ACCOUNT_NEW = Consts.ACCOUNT_NEW_SDF01;
// addRecordToKafka((MockConsumer) accountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonBaseNewRequest);
//
// //waiting for kafka producer send message (finale event)
// verify(producer, timeout(30_000L).times(2))
// .send(producerRecord.capture());
// //todo переписать валидацию ожидания на новые waitingSendAndCheckRecord / waitingWhenTryAddRecordAndCheckError
//
// ImdgHazelcast<Account> accountImdg = (ImdgHazelcast<Account>) hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Account, Account.class);
//
// //ASSERT
// Account accountResult = accountImdg.getSingleObjectBySQL(String.format("account = %s", account));
// predictableAccount.setId(accountResult.getId());
// ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
// accountImdg.delete(accountResult);
// }
}

View file

@ -26,7 +26,6 @@ import ru.spcex.clearing.account.config.validation.TradingClearingRegistryValida
import ru.spcex.clearing.account.config.validation.ValidationConfig;
import ru.spcex.clearing.account.utils.MatcherFactory;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.BaseRequest;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest;
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeUpdateRequest;
@ -80,15 +79,10 @@ class ClientCodeServiceTest {
private Imdg<ClientCode> clientCodeImdg;
// ****************************-*******************
@PostConstruct
private void init() {
hazelcastServiceTest.waitAvailable();
clientCodeImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
// Словари для теста, применяются в ValidationConfig
putToDictionary(IMDGDistributedNames.Map_WorkflowStatusDictionary, new WorkflowStatusDictionary(), "ACTV");
putToDictionary(IMDGDistributedNames.Map_CompanySymbolDictionary, new CompanySymbolDictionary(), "CLRC");
putToDictionary(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, new CorporationSoleTypeDictionary(), "GDIR");
@ -129,7 +123,7 @@ class ClientCodeServiceTest {
moneyAccount.setId(131L);
moneyAccount.setAccount("AAAA-4444");
moneyAccount.setStatus("ACTV");
moneyAccount.setCompanyId(COMPANY_ID); // для валидации принадлежности счёта
moneyAccount.setCompanyId(COMPANY_ID);
accounts.insert(moneyAccount);
ClearingAccount clsAcc = new ClearingAccount();
clsAcc.setId(moneyAccount.getId());
@ -141,7 +135,7 @@ class ClientCodeServiceTest {
depoAccount.setId(132L);
depoAccount.setAccount("AAAB-44654");
depoAccount.setStatus("ACTV");
depoAccount.setCompanyId(COMPANY_ID); // для валидации принадлежности счёта
depoAccount.setCompanyId(COMPANY_ID);
accounts.insert(depoAccount);
DepoAccount depoAcc = new DepoAccount();
depoAcc.setId(depoAccount.getId());
@ -176,14 +170,8 @@ class ClientCodeServiceTest {
}
/**
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
* Тест проверяет создание {@link ClientCode} в IMDG при передаче из Apache Kafka (очередь 1).<br>
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest}:<br>
**/
@Test
void clientCodeNew1() {
//ARRANGE
final String ccCode = "Lucky planet";
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
clientCodeNewRequest.setCompanyId(COMPANY_ID);
@ -197,16 +185,9 @@ class ClientCodeServiceTest {
predictableClientCode.setCode(ccCode);
predictableClientCode.setStatus("ACTV");
predictableClientCode.setCompanyId(COMPANY_ID);
// predictableClientCode.setMoneyAccountId(131L);
// predictableClientCode.setDepoAccountId(132L);
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
//ACT
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
//ASSERT
waitingSendAndCheckRecord(ID, mockProducer);
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
predictableClientCode.setId(resultNew.getId());
@ -214,14 +195,8 @@ class ClientCodeServiceTest {
assertNotNull(resultNew.getCreated());
}
/**
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
* Тест проверяет создание {@link ClientCode} в IMDG при передаче из Apache Kafka (очередь 2).<br>
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest}:<br>
**/
@Test
void clientCodeNew2() {
//ARRANGE
final String ccCode = "Lucky planet";
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
clientCodeNewRequest.setCompanyId(COMPANY_ID);
@ -235,16 +210,9 @@ class ClientCodeServiceTest {
predictableClientCode.setCode(ccCode);
predictableClientCode.setStatus("ACTV");
predictableClientCode.setCompanyId(COMPANY_ID);
// predictableClientCode.setMoneyAccountId(131L);
// predictableClientCode.setDepoAccountId(132L);
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
//ACT
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, PARTITION, 0, jsonString);
//ASSERT
TestUtils.waitingSendAndCheckRecord(ID, mockProducer, producerRecord);
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
predictableClientCode.setId(resultNew.getId());
@ -253,15 +221,8 @@ class ClientCodeServiceTest {
}
/**
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
* Тест проверяет создание {@link ClientCode} в IMDG при передаче из Apache Kafka (очередь 1).<br>
* NEW с заполненными MoneyAccountId(131L), DepoAccountId(132L); - от этого будет создан ТКР.
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest}:<br>
**/
@Test
void clientCodeNew3() {
//ARRANGE
final String ccCode = "Lucky planet2";
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
clientCodeNewRequest.setCompanyId(COMPANY_ID);
@ -278,13 +239,9 @@ class ClientCodeServiceTest {
predictableClientCode.setMoneyAccountId(131L);
predictableClientCode.setDepoAccountId(132L);
predictableClientCode.setTradingClearingRegistryId(TCR_ID);
//ACT
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
//ASSERT
waitingSendAndCheckRecord(ID, mockProducer);
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
predictableClientCode.setId(resultNew.getId());
@ -292,14 +249,8 @@ class ClientCodeServiceTest {
assertNotNull(resultNew.getCreated());
}
/**
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
* Тест проверяет обновление сущности {@link ClientCode} в IMDG при передаче из Apache Kafka.<br>
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeUpdateRequest}:<br>
**/
@Test
void clientCodeUpdate() {
//ARRANGE
ClientCode existsClientCode = new ClientCode();
existsClientCode.setId(ID);
existsClientCode.setCompanyId(COMPANY_ID);
@ -327,13 +278,9 @@ class ClientCodeServiceTest {
predictableClientCode.setMoneyAccountId(131L);
predictableClientCode.setDepoAccountId(132L);
predictableClientCode.setStatus("ACTV");
//ACT
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeUpdateRequest, ID);
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_UPDATE, PARTITION, 0, jsonString);
//ASSERT
waitingSendAndCheckRecord(ID, mockProducer);
ClientCode resultUpdating = clientCodeImdg.getSingleObjectByID(ID);
@ -342,19 +289,12 @@ class ClientCodeServiceTest {
}
/**
* {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
* Тест проверяет удаление {@link ClientCode} из IMDG при передаче из Apache Kafka.<br>
* Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest}:<br>
**/
@Test
void clientCodeDelete1() {
//ARRANGE
ClientCode existsClientCode = new ClientCode();
existsClientCode.setId(ID);
existsClientCode.setCompanyId(COMPANY_ID);
existsClientCode.setCode("0000");
// Если следующие поля заполнить, то дополнительно отправит сообщение в trading-clearing-registry-update:
existsClientCode.setTradingClearingRegistryId(null);
existsClientCode.setMoneyAccountId(null);
existsClientCode.setDepoAccountId(null);
@ -365,56 +305,14 @@ class ClientCodeServiceTest {
CommonDeleteRequest clientCodeDeleteRequest = new CommonDeleteRequest();
clientCodeDeleteRequest.setId(ID);
Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID)); // verify test data
//ACT
Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID));
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeDeleteRequest, ID);
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_DELETE, PARTITION, 0, jsonString);
//ASSERT
waitingSendAndCheckRecord(ID, mockProducer);
ClientCode resultUpdate = clientCodeImdg.getSingleObjectByID(ID);
Assertions.assertNull(resultUpdate);
}
// /**
// * {@link ClientCodeService#clientCodeUpdate(BaseRequest)}<br>
// * Тест проверяет удаление {@link ClientCode} из IMDG при передаче из Apache Kafka.<br>
// * У ClientCode заполнены MoneyAccountId, DepoAccountId - по этому при удалении должно направиться дополнительное сообщение в очередь DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE<br>
// * Входной запрос {@link ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest}:<br>
// **/
// @Test
// void clientCodeDelete2() {
// //ARRANGE
// ClientCode existsClientCode = new ClientCode();
// existsClientCode.setId(ID);
// existsClientCode.setCompanyId(COMPANY_ID);
// existsClientCode.setCode("0000");
// // Если следующие поля заполнить, то дополнительно отправит сообщение в trading-clearing-registry-update:
// existsClientCode.setTradingClearingRegistryId(TCR_ID);
// existsClientCode.setMoneyAccountId(131L);
// existsClientCode.setDepoAccountId(132L);
// existsClientCode.setStatus("ACTV");
//
// clientCodeImdg.insert(existsClientCode);
//
// CommonDeleteRequest clientCodeDeleteRequest = new CommonDeleteRequest();
// clientCodeDeleteRequest.setId(ID);
//
// Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID)); // verify test data
//
// //ACT
// String jsonString = getJsonStringForUpdate(clientCodeDeleteRequest, ID);
//
// addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_DELETE, PARTITION, 0, jsonString);
//
// //ASSERT
//
// waitingWhenAddedRecordAndCheckIt(ID, mockProducer, producerRecord);
// ClientCode resultUpdate = clientCodeImdg.getSingleObjectByID(ID);
// Assertions.assertNull(resultUpdate);
// }
}

View file

@ -151,8 +151,6 @@ class InformationAccountServiceTest {
PARTITION,
0,
jsonString);
//waiting for kafka producer send message (finale event)
verify(producer, timeout(30_000L).times(2))
.send(producerRecord.capture());

View file

@ -275,15 +275,11 @@ class TradingClearingRegistryServiceTest {
tradingClearingRegistryUpdateRequest.setId(registryId);
String jsonString = getJsonStringForUpdate(tradingClearingRegistryUpdateRequest, 0);
//ACT
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE,
PARTITION,
0,
jsonString);
//ASSERT
waitingSendAndCheckRecord(0L, producer, producerRecord);
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
@ -303,15 +299,11 @@ class TradingClearingRegistryServiceTest {
tradingClearingRegistryDeleteRequest.setId(registryId);
String jsonString = getJsonStringForDelete(tradingClearingRegistryDeleteRequest, 0);
//ACT
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_BLOCK,
PARTITION,
0,
jsonString);
//ASSERT
waitingSendAndCheckRecord(0L, producer, producerRecord);
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);

View file

@ -39,14 +39,13 @@ public class ImapEvent<T> {
}
public void waitWhenHappened() throws InterruptedException {
//running timer task as daemon thread
Timer timer = new Timer(true);
timer.scheduleAtFixedRate(new TimerTask() {
boolean secondRan;
@Override
public void run() {
checkEventHappened.set(secondRan);//если что-то пойдет не так не тормозить основной поток
checkEventHappened.set(secondRan);
secondRan = true;
}
}, 0, 30 * 1000);
@ -55,7 +54,6 @@ public class ImapEvent<T> {
checkEventHappened.wait(100);
}
}
//preparing hazelcastImdgProvider for next test
iMap.removeEntryListener(listenerAdding);
iMap.removeEntryListener(listenerUpdating);
iMap.removeEntryListener(listenerRemoving);

View file

@ -4,11 +4,6 @@ import java.util.Arrays;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Factory for creating test matchers.
* <p>
* Comparing actual and expected objects via AssertJ
*/
public class MatcherFactory {
public static <T> Matcher<T> usingIgnoringFieldsComparator(String... fieldsToIgnore) {

View file

@ -26,7 +26,6 @@ public class BackendApiApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
setKeycloakConfigFile();
// springApplicationBuilder.initializers(DfaConfig.get().getLoggingInitializer());
return builder.sources(BackendApiApplication.class);
}
@ -35,9 +34,6 @@ public class BackendApiApplication extends SpringBootServletInitializer {
return super.run(application);
}
/**
* чтобы переместить настройки keycloak в keycloak.json вместо application.properties
*/
private static void setKeycloakConfigFile() {
System.setProperty("keycloak.configurationFile", "classpath:keycloak.json");
}

View file

@ -22,7 +22,6 @@ import java.util.function.Consumer;
@SuppressWarnings("Duplicates")
@Configuration
@EnableWebMvc
//todo remove? see ClearingCorsFilter
@CrossOrigin
public class WebConfig implements WebMvcConfigurer {
private final MappingJackson2HttpMessageConverter customJsonHttpConverter;

View file

@ -4,7 +4,6 @@ import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
import ru.spcex.clearing.backendapi.domain.actions.IAction;
import ru.spcex.clearing.backendapi.service.IOperator;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
public abstract class AbstractQueueController {
@ -22,9 +21,6 @@ public abstract class AbstractQueueController {
return responseToClient;
}
/**
* Для оптимизации передачи userId
*/
protected <T> CudResponse processRequest(String destination, IAction<T> iAction, Long userId) throws ExecutionException, InterruptedException {
CudResponse responseToClient = new CudResponse();
responseToClient.setPayload(operator.sendRequestToQueue(destination, iAction, userId));

View file

@ -82,8 +82,6 @@ public class LauncherController extends AbstractQueueController {
}
launcherCommand.setTask(dictionaryName);
launcherCommand.setUserId(user.getId());
//топики ограничиваются наличием в taskDictionary
//подписываются на разные топики в разных модулях, см. ru.spcex.platform.enumeration.Task#topic
return processRequest(Consts.LAUNCHER_NEW, launcherCommand);
}

View file

@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import ru.clearing.classes.statics.data.instrument.issue.EquitySecurity;
import ru.clearing.classes.statics.data.instrument.issue.FixedIncomeSecurity;
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
import ru.clearing.classes.statics.data.security.Security;
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
import ru.spcex.clearing.backendapi.service.IStateLoader;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
@ -20,9 +19,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Map;
/**
* SecurityController и MoneyMarketSecurityController разные контроллеры, не путать.
*/
@Controller
@RequestMapping("/securities")
public class SecurityController {

View file

@ -90,10 +90,6 @@ public class UserController extends AbstractQueueController {
log.warn("user {} sended update request for user {}", username, userUpdateAction.getUsername());
throw new IllegalStateException("cannot perform delete action for " + username);
}
// User user = userImdg.getSingleObjectByFieldValues(Map.of("identifier", username));
// if (user == null) {
// log.info("update user {} authenticated, but User object was not created", username);
// }
return processRequest(Consts.USER_UPDATE, userUpdateAction);
}

View file

@ -58,8 +58,6 @@ public class StatementController extends AbstractQueueController {
Optional<Statement> statement = stateLoader.getById(id, IMDGDistributedNames.Map_Statement, Statement.class);
CommonGetByIdResponse response = new CommonGetByIdResponse();
if (statement.isEmpty()) {
//можно так, либо response.setCode(404); response.setMessage("blabla"); но тогда еще нужно
//отдельно HTTP статус проставлять
throw new NotFound404Exception(String.valueOf(id));
}
Statement stmt = statement.get();

View file

@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import ru.clearing.classes.statics.data.company.Company;
import ru.clearing.classes.statics.data.profile.CompanyInfo;
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
import java.util.ArrayList;
@ -51,25 +50,6 @@ public class CompanyBackendGetAll extends BasicSpcexResponse {
singleItem.setFullName(company.getFullName());
singleItem.setCreated(company.getCreated());
singleItem.setUpdated(company.getUpdated());
// CompanyInfo profile = company.getProfile();
// if (profile != null) {
// singleItem.setCorporationSoleType(profile.getCorporationSoleType());
// singleItem.setCountryCode(profile.getCountryCode());
// singleItem.setDescription(profile.getDescription());
// singleItem.setProfessionalSign(profile.getProfessionalSign());
// singleItem.setLegalKind(profile.getLegalKind());
// singleItem.setOrganizationType(profile.getOrganizationType());
// singleItem.setResidence(profile.getResidence());
// singleItem.setShortNameEng(profile.getShortNameEng());
// singleItem.setFullNameEng(profile.getFullNameEng());
// }
/* todo
CompanySymbol companySymbol = ;
if (companySymbol!=null) {
singleItem.setCompanySymbol(profile.getCompanySymbol());
singleItem.setCompanySymbolValue(profile.getCompanySymbolValue());
}*/
payload.getItems().add(singleItem);
}

View file

@ -6,12 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
/**
* Банковские реквизиты для перечисления денежных средств
*
* @ApiModel(description = "Ответ в результате отправки операции в топик Kafka.")
* @ApiModelProperty(value = "Информация о принятом запросе")
**/
@ApiModel(description = "Ответ при получении объекта TradingClearingRegistry.")
public class TradingClearingRegistryBackendGetById extends BasicSpcexResponse {

View file

@ -9,11 +9,6 @@ import ru.spcex.clearing.platform.messaging.domain.json.serialize.EnumSerializer
import ru.spcex.clearing.platform.messaging.service.Status;
/**
* Банковские реквизиты для перечисления денежных средств
* @ApiModel(description = "Ответ в результате отправки операции в топик Kafka.")
* @ApiModelProperty(value = "Информация о принятом запросе")
**/
@ApiModel(description = "Ответ при получении статуса запроса.")
public class RequestInfoResponse extends BasicSpcexResponse {

View file

@ -19,18 +19,14 @@ import java.io.IOException;
public class ClearingCorsFilter extends OncePerRequestFilter {
private final Logger log = LoggerFactory.getLogger(getClass());
// private final AConfigurationProperties configuration;
//todo cors settings
private final String[] meth = new String[] {};//"*"
private final String[] orig = new String[] {};//"/**"
private final String[] meth = new String[] {};
private final String[] orig = new String[] {};
private final String[] head = new String[] {};
private final CorsAllowedOriginsService allowedOriginsService;
public ClearingCorsFilter(
// AConfigurationProperties configuration,
CorsAllowedOriginsService allowedOriginsService
) {
// this.configuration = configuration;
this.allowedOriginsService = allowedOriginsService;
}
@ -63,21 +59,7 @@ public class ClearingCorsFilter extends OncePerRequestFilter {
log.trace("cors filter -> effectiveOrigin={}", effectiveOrigin);
if (effectiveOrigin != null) {
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_ORIGIN, effectiveOrigin);
// String methods;
// if (meth.length > 0) {
// methods = String.join(", ", meth).toUpperCase(Locale.ROOT);
// } else {
// methods = "*";
// }
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_METHODS, "*");
// String headers;
// if (head.length > 0) {
// headers = String.join(", ", head).toLowerCase(Locale.ROOT);
// } else {
// headers = "*";
// }
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_HEADERS, "*");
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");

View file

@ -12,7 +12,6 @@ public class CorsAllowedOriginsService {
private final List<Pattern> originPatterns = new ArrayList<>();
//todo cors settings
public CorsAllowedOriginsService() {
for (String originRegex : new String[]{".*"}) {
originPatterns.add(Pattern.compile(originRegex));

View file

@ -22,8 +22,6 @@ public class ActionElement {
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Boolean isArray = null;
// @JsonProperty(value = "fields", required = true)
// private List<Map<String, ActionField>> fields = new LinkedList<>();
@JsonProperty(value = "fields", required = true)
private List<ActionField> fields = new LinkedList<>();

View file

@ -10,9 +10,6 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
import java.util.HashMap;
import java.util.Map;
/**
* todo временная заглушка: нужно добавить парсинг meta.xml и получать инфу оттуда
*/
@Service
public class CudMetaService {
private final Map<String, Class<? extends IAction<?>>> mapping;

View file

@ -58,10 +58,6 @@ public abstract class FieldExtracted {
if (result == null)
break;
}
//fixme somehow externalize custom serialization for type
// тут нужно вернуть список id объектов а не список самих объектов для случая
// - add(r, "addresseeId", o.getAddressee() == null ? null : o.getAddressee().stream().map(ObjectBase::getId).collect(Collectors.toSet()), fieldFilter);
if (result instanceof Set && ((Set) result).size() > 0) {
try {
Set t = new HashSet();
@ -70,7 +66,7 @@ public abstract class FieldExtracted {
t.add(citem.getMethod(RfHelper.GETTER_NAME_ID).invoke(item));
}
result = t;
} catch (Throwable ignored) {// вернем сами объекты
} catch (Throwable ignored) {
}
} else if (result instanceof LocalDate) {
result = result.toString();

View file

@ -34,9 +34,6 @@ public class GetResponseFactory {
.collect(Collectors.toList());
}
/**
* dictionaryName - это имя тэга внутри <enum>
*/
public Map<String, Object> responseFromDictionary(String dictionaryName, Object o) {
ObjectExtracted objectExtracted = meta.getEnumsExtractedByTagName().get(dictionaryName);
if (objectExtracted == null) {
@ -53,12 +50,6 @@ public class GetResponseFactory {
return responseFromObjectExtracted(o, objExtr);
}
/**
* Варианты методов с Class сделаны для сценариев, когда хотим распарсить объект,
* по мете для родительского класса объекта
* Т.е. вместо извлечение класса o.getClass, берем clazz извне. clazz - base class для o
*
*/
public <T> Collection<Map<String, Object>> responseFromObjectCollection(Collection<?> o, Class<T> clazz) {
return o.stream()
.map((Function<Object, Map<String, Object>>) o1 -> responseFromObject(o1, clazz))
@ -82,7 +73,6 @@ public class GetResponseFactory {
continue;
}
currentField = field;
// if (fieldsToAdd.contains(field.getField().getCode())) {
try {
add(r, field, field.extractValue(o));
} catch (Throwable e) {
@ -95,7 +85,6 @@ public class GetResponseFactory {
)))
);
}
// }
}
} catch (Exception e) {
log.error(ExceptionUtils.getStackTrace(e));
@ -134,45 +123,4 @@ public class GetResponseFactory {
.ofPattern("yyyy-MM-dd'T'HH:mm:ss+03:00")
.withLocale(Locale.US)
.withZone(ZoneId.of("Europe/Moscow"));
// public Map<String, Object> newX(Object o, Collection<String> fieldFilter, String destination) {
// ObjectExtracted targetClazz = getTargetClazz(o, destination);
// if (targetClazz == null)
// throw new FrontendException(String.format("Unknown response class: %s", o.getClass().getName()));
// Collection<String> fieldsToAdd = getFilteredFields(targetClazz, fieldFilter);
// Map<String, Object> r = new LinkedHashMap<>();
// FieldExtracted currentField = null;
// try {
// for (FieldExtracted field : targetClazz.getFields()) {
// if (field.getField().isVirtual() != null && field.getField().isVirtual()) {
// continue;
// }
// currentField = field;
// if (fieldsToAdd.contains(field.getField().getCode())) {
// try {
// add(r, field.getField().getCode(), field.extractValue(o));
// } catch (Throwable e) {
// log.warn(ExceptionUtils.getStackTrace(
// new FrontendException(String.format("Can't extract value for field='%s' of %s(%s): %s -> %s\n%s",
// field.getField().getCode(),
// o.getClass().getSimpleName(), targetClazz.getClazz().getSimpleName(),
// e.getClass().getSimpleName(), e.getLocalizedMessage(),
// JsonHelper.writeAnyClassToLog(currentField)
// )))
// );
// }
// }
// }
// } catch (FrontendException e) {
// throw e;
// } catch (Throwable e) {
// throw new FrontendException(String.format("Can't get field of %s(%s): %s -> %s\n%s",
// o.getClass().getSimpleName(), targetClazz.getClazz().getSimpleName(),
// e.getClass().getSimpleName(), e.getLocalizedMessage(),
// JsonHelper.writeAnyClassToLog(currentField)
// ));
// }
// return r;
// }
}

View file

@ -82,7 +82,7 @@ public class MetaServer extends MetaBase {
log.warn("META SERVER >>> {}", e.getLocalizedMessage());
continue;
}
String actionDestination = // обычно бывают =null о этому эффективнее по имени класса а не по: objectElement.getSubscription().destination + "/"+ actionElement.getDestination();
String actionDestination =
oe.getClassName();
actionObjectsExtracted.put(actionDestination, oe);
}
@ -101,20 +101,6 @@ public class MetaServer extends MetaBase {
log.warn("{} {}", key, ExceptionUtils.getStackTrace(e));
continue;
}
/**
* можно было бы хранить только для нестандартных словарей (где не только id, name, code)
*/
// List<FieldExtracted> dictFields = oe.getFields();
// boolean add = false;
// for (FieldExtracted dictField : dictFields) {
// if (!dictionaryDefaultFields.contains(dictField.getMemberName())) {
// add = true;
// break;
// }
// }
// if (add) {
// enumsExtractedByTagName.put(key, oe);
// }
enumsExtractedByTagName.put(key, oe);
}
@ -127,7 +113,6 @@ public class MetaServer extends MetaBase {
if (!RfHelper.isAbstract(o.getClazz())) {
try {
Object instance = newInstance(o.getClassName());
// создается успешно.
} catch (Throwable e) {
log.warn("META SERVER >>> Не удается создать класс {} !", o.getClassName());
}
@ -139,32 +124,8 @@ public class MetaServer extends MetaBase {
throw new ClearingMetaServerValidationException(e.getLocalizedMessage());
}
}
//
// for (ObjectExtracted o : this.actionObjectsExtracted.values()) {
// try {
// if (!RfHelper.isAbstract(o.getClazz())) {
// try {
// Object instance = newInstance(o.getClassName());
// // создается успешно.
// } catch (Throwable e) {
// log.warn("META SERVER ACTION >>> Не удается создать класс {} !", o.getClassName());
// }
// }
// validateGetterForObject(o);
// } catch (ClrxMetaServerGetterNotFoundException e) {
// throw e;
// } catch (Throwable e) {
// throw new ClearingMetaServerValidationException(e.getLocalizedMessage());
// }
// }
}
/**
* проверим наличие геттеров к полям
*
* @param o
* @throws ClassNotFoundException
*/
private void validateGetterForObject(ObjectExtracted o) throws ClassNotFoundException {
for (FieldExtracted field : o.getFields()) {
Class<?> c = o.getClazz();

View file

@ -47,7 +47,7 @@ public class RfHelper {
Class<?> raw = Class.forName(((ParameterizedType) t).getRawType().getTypeName());
if (BUSINESS_OBJECT_REF.equals(raw.getSimpleName())) {
return Class.forName(((ParameterizedType) t).getActualTypeArguments()[0].getTypeName());
} else if ("Set".equals(raw.getSimpleName())) { // множества пока не распаковываем
} else if ("Set".equals(raw.getSimpleName())) {
return Class.forName(raw.getName());
}
}

View file

@ -85,7 +85,6 @@ public class KeycloakRestTemplateAuthenticationProvider implements Authenticatio
throw new AuthenticationServiceException("keycloak direct access grant auth failed: bad token");
}
AccessToken accessToken = AdapterTokenVerifier.verifyToken(accessTokenString, deployment);
//todo cors settings
accessToken.setAllowedOrigins(Collections.singleton("*"));
RefreshableKeycloakSecurityContext skSession = new RefreshableKeycloakSecurityContext(deployment, null, accessTokenString, accessToken, null, null, refreshTokenString);

View file

@ -4,18 +4,17 @@ import org.keycloak.KeycloakPrincipal;
import org.keycloak.adapters.spi.KeycloakAccount;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.Authentication;
;
public class KeycloakUtils {
static Logger log = LoggerFactory.getLogger(KeycloakUtils.class);
/**
* Достать username из Keycloak имплементации Authentication
*/
public static String getUserNameFromAuthentication(Authentication authentication) {
if (authentication == null) return null;
if (!(authentication instanceof KeycloakAuthenticationToken)) { // AnonymousAuthenticationToken
if (!(authentication instanceof KeycloakAuthenticationToken)) {
log.trace("Authentication token class {} is not KeycloakAuthenticationToken", authentication.getClass().getName());
return null;
}

View file

@ -20,11 +20,6 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;
/**
* при bearer only false
* клиент сюда не попадает
* срабатывает KeycloakAuthenticationProvider с редиректом на логин keycloak
*/
@Controller
@RequestMapping("/sso")
public class LoginController {

View file

@ -17,9 +17,6 @@ public class RestTemplateConfig {
this.builder = builder;
}
/**
* В настоящий момент используется для выгрузки AFS данных
*/
@Bean("clearing-rest")
public RestTemplate restTemplate() {
return builder

View file

@ -6,10 +6,8 @@ import org.springframework.stereotype.Component;
@Component
public class SimpleUserDetailService
// implements UserDetailsService
{
// @Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
return null;
}
}

View file

@ -52,11 +52,7 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
super.configure(http);
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.AuthorizedUrl anyReq = http
// .formLogin()
// .loginProcessingUrl("/backend-api-login/perform-login")
// .and()
//todo remove? see ClearingCorsFilter
.cors()
.cors()
.and()
.csrf().disable()
.authorizeRequests()
@ -84,7 +80,6 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
@Bean
public GrantedAuthorityDefaults grantedAuthorityDefaults() {
// Remove the ROLE_ prefix
return new GrantedAuthorityDefaults("");
}

View file

@ -8,16 +8,5 @@ import java.util.concurrent.ExecutionException;
public interface IOperator {
QueueSuccessResponse sendRequestToQueue(String destination, IAction<?> iAction, boolean appendUserId) throws ExecutionException, InterruptedException;
/**
* Для оптимизации проставления userId.
* Аналог sendRequestToQueue(String destination, IAction<?> iAction, true)
*
* @param destination
* @param iAction
* @param userId совершивший запрос
* @return
* @throws ExecutionException
* @throws InterruptedException
*/
QueueSuccessResponse sendRequestToQueue(String destination, IAction<?> iAction, Long userId) throws ExecutionException, InterruptedException;
}

View file

@ -6,9 +6,6 @@ import java.util.Collection;
import java.util.Map;
import java.util.Optional;
/**
* сделал чтобы не привязывать все контроллеры к Imdg API
*/
public interface IStateLoader {
<T extends SpcexObjectBase> Optional<T> getById(Long id, String mapName, Class<T> clazz);
<T extends SpcexObjectBase> Collection<T> getAll(String mapName, Class<T> clazz);

View file

@ -35,7 +35,6 @@ public class RequestInfoAccepter extends QueueConsumer implements InitializingBe
}
private void updateRequestInfo(BaseRequest<RequestInfoUpdate> requestInfoUpdateBaseRequest) {
//will throw exception for any class other than RequestInfoUpdate
RequestInfoUpdate statusInfo = requestInfoUpdateBaseRequest.getRequestPayload();
RequestInfo requestInfo = requestInfoImdg.getSingleObjectByID(statusInfo.getId());
if (requestInfo == null) {

View file

@ -40,7 +40,7 @@ public class UserAuthProcessor {
requestData.setUsername(identifier);
requestData.setTime(Instant.now());
requestData.setRoles(new ArrayList<>(roles));
requestData.setServerIp(serverIp + ":" + serverPort); //getServerAddress() + ":" + serverPort
requestData.setServerIp(serverIp + ":" + serverPort);
requestData.setClientIp(userIp);
requestData.setEmail(email);
requestData.setName(name);
@ -48,7 +48,7 @@ public class UserAuthProcessor {
requestData.setMiddleName(middleName);
try {
operator.sendRequestToQueue(Consts.USER_AUTH_SUCCESS, authEvent, false);
} catch (Throwable e) { //ExecutionException | InterruptedException
} catch (Throwable e) {
log.error(ExceptionUtils.getStackTrace(e));
}
}

View file

@ -62,10 +62,8 @@ public class OperatorImpl implements IOperator {
if (user == null) {
log.warn("UserID not found by login \"{}\"", username);
return null;
//throw new IllegalStateException("cannot obtain userId from logged in user " + username);
}
return user.getId();
// todo добавить кэш, с очисткой по времени
}
@Override
@ -78,7 +76,6 @@ public class OperatorImpl implements IOperator {
if (appendUserId) {
request.setUserId(currentUserId());
}
//сохраняет данные о запросе в хранилище
saveRequestToStorage(destination, request);
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
send.get();
@ -98,7 +95,6 @@ public class OperatorImpl implements IOperator {
} else {
request.setUserId(userId);
}
//сохраняет данные о запросе в хранилище
saveRequestToStorage(destination, request);
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
send.get();
@ -114,12 +110,10 @@ public class OperatorImpl implements IOperator {
}
private void throwValidate(String destination, IAction<?> iAction) {
//простая валидация - которую можно запилить прямо внутри класса (наличие полей, отношения между датами etc.)
Collection<EnumMessage> validationErrors = iAction.validate();
if (validationErrors.size() > 0) {
throw new ActionValidationException(validationErrors);
}
// Валидация по мете (рекомендуется использовать её,а не iAction.validate();
IValidator metaValidator = actionMetaValidation.getValidator(destination, iAction);
if (metaValidator != null) {
metaValidator.tillFirstError().ifPresent(enumMessage -> {
@ -130,8 +124,6 @@ public class OperatorImpl implements IOperator {
}
});
}
//валидация требующая IMDG поиска других сущностей и т.д.
IValidator validator = validation.getValidator(destination, iAction);
if (validator != null) {
validator.tillFirstError().ifPresent(enumMessage -> {

View file

@ -25,9 +25,6 @@ import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
/**
* Проверка обязательности полей для IAction по мете
*/
@Component
public class ActionMetaValidation implements InitializingBean {
protected static final Logger log = LoggerFactory.getLogger(ActionMetaValidation.class);
@ -55,8 +52,7 @@ public class ActionMetaValidation implements InitializingBean {
public IValidator getValidator(String destination, Object action) {
if (action == null)
return null;
//if (destination == null) destination = action.getClass().getName();
String actionDestination = action.getClass().getName(); // см. реализацию в MetaServer String actionDestination =...
String actionDestination = action.getClass().getName();
Function<Object, IValidator> constructor = (Function<Object, IValidator>) validators.get(actionDestination);
if (constructor != null)
return constructor.apply(action);
@ -70,10 +66,8 @@ public class ActionMetaValidation implements InitializingBean {
private <T extends Object> Function<T, IValidator> validatorConstructor(ObjectExtracted metaAction) {
if (!metaAction.getFields().stream().anyMatch(field -> isTrue(field.getField().isRequired()))) {
log.debug("Action {}: no any required fields. Do not need validator.", metaAction.getClassName());
// нет обязательных полей для валидации
return null;
}
// Тестирование getter
{
Object object;
try {
@ -98,7 +92,6 @@ public class ActionMetaValidation implements InitializingBean {
ctx.setValidatedObject(iAcc);
ValidatorImpl<ImdgValidationContext<T>> iValidator = new ValidatorImpl(ctx);
iValidator.addRule(metaValidatorRule);
// в дальнейшем можно улучшить и разделить валидатор по полям
return iValidator;
};
}
@ -119,12 +112,9 @@ public class ActionMetaValidation implements InitializingBean {
Object value = field.extractValue(object);
if (value == null)
return of(BackEndError.ValidationError, field.getMemberName());
// if (value instanceof String && ((String)value).isEmpty()) // пустое поле, но не null
// return of(BackEndError.ValidationError, field.getMemberName());
}
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
if (object instanceof MoneyMarketSecurityUpdateAction) {
//todo в мете для moneyMarketSecurity / actions / put / для поля lotSize field="securityId" исключение - там надо оставить field, требуется для frontend
if (((MoneyMarketSecurityUpdateAction) object).getLotSize() == null)
return of(BackEndError.ValidationError, "LotSize");
} else {

View file

@ -81,14 +81,11 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
@ContextConfiguration(classes = {
//account
AccountController.class,
BankAccountController.class,
ClearingAccountController.class,
DepoAccountController.class,
//account misc
ClientCodeController.class,
//company
CompanyRoleSetController.class,
CompanyController.class,
ClearingMemberCategoryController.class,
@ -97,24 +94,18 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
ContactController.class,
ProfileDocumentController.class,
RelationController.class,
//execution
ExecutionDepositController.class,
ExecutionFondController.class,
//journal
InDocumentJournalController.class,
ManagementJournalController.class,
OutDocumentJournalController.class,
//liabilities
//misc
CurrencyController.class,
ErrorTextController.class,
ListingController.class,
MarketController.class,
NotificationController.class,
SessionController.class,
//payment
PaymentInstructionController.class,
//register
AdmittedLiabilitiesRegisterController.class,
CoveredLiabilitiesRegisterController.class,
DepoBalanceRegisterController.class,
@ -125,16 +116,13 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
MoneyBalanceRegisterController.class,
ContractRegisterController.class,
ReportRegisterController.class,
//registry
RegistryController.class,
TradingClearingRegistryController.class,
//scheduler
ClearingCalendarController.class,
LauncherController.class,
PlannerAllTodayController.class,
PlannerController.class,
PlannerTemplateController.class,
//securities
MoneyMarketSecurityController.class,
CouponPeriodController.class,
EquitySecurityController.class,
@ -142,13 +130,10 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
FixedIncomeSecurityController.class,
InformationAccountController.class,
SecurityController.class,
//user
UserController.class,
UserRoleSessionController.class,
//utilities
StatementController.class,
UserSettingsController.class,
//******* common configs *******
WebTestConfig.class,
IOperatorTest.class,
HazelcastServiceTestConfiguration.class,
@ -156,10 +141,8 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
WebSecurityTestConfigurer.class,
MessagesTestConfig.class,
Jackson2HttpConverterTestConfig.class})
//todo может быть указать пакедж а не список контроллеров
@ExtendWith(SpringExtension.class)
@WebMvcTest
//@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/")
public abstract class AbstractControllerTest {
protected static final MatcherFactoryWithJson.Matcher<BaseRequest> BASE_REQUEST_MATCHER = usingIgnoringFieldsComparatorForClass(BaseRequest.class,"userId");
protected static final MatcherFactoryWithJson.Matcher<CudResponse> CUD_RESPONSE_MATCHER = usingIgnoringFieldsComparatorForClass(CudResponse.class);
@ -200,8 +183,7 @@ public abstract class AbstractControllerTest {
mockMvc = MockMvcBuilders
.webAppContextSetup(webApplicationContext)
.addFilter(CHARACTER_ENCODING_FILTER)
// .apply(springSecurity())
.build();
.build();
TestUtils.FutureRecordMetadata future = spy(TestUtils.FutureRecordMetadata.class);
doReturn(future).when(producer).send(producerRecord.capture());
userImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_User, User.class);
@ -225,15 +207,12 @@ public abstract class AbstractControllerTest {
CudResponse expected = new CudResponse();
expected.setCode(0L);
expected.setMessage("success");
//ACT
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL)
.contentType(MediaType.APPLICATION_JSON)
.content(writeValue(action)))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
//.andExpect(content().json(writeValue(expected)))
.andReturn();
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
@ -245,16 +224,12 @@ public abstract class AbstractControllerTest {
expected.setCode(0L);
expected.setMessage("success");
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
//ACT
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL + existsId)
.contentType(MediaType.APPLICATION_JSON)
.content(writeValue(action)))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
//.andExpect(content().json(writeValue(expected)));
.andReturn();
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
@ -273,16 +248,12 @@ public abstract class AbstractControllerTest {
expected.setCode(0L);
expected.setMessage("success");
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
//ACT
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL)
.contentType(MediaType.APPLICATION_JSON)
.content(writeValue(action)))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
//.andExpect(content().json(writeValue(expected)));
.andReturn();
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
@ -296,15 +267,12 @@ public abstract class AbstractControllerTest {
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, existsId));
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(existsId);
//ACT
MvcResult mvcResult = perform(MockMvcRequestBuilders.delete(REST_URL + existsId)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
// .andExpect(content().json(writeValue(expected)));
.andReturn();
.andReturn();
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, cudResponseTest.getPayload().getId()));
CUD_RESPONSE_MATCHER.assertMatch(cudResponseTest, expected);
@ -320,18 +288,15 @@ public abstract class AbstractControllerTest {
protected <T extends SpcexObjectBase> void checkGettingAllFromRestApi(String imdgDistributedNames, T existsObj, String restUrl) throws Exception {
Class<T> clazz = (Class<T>) existsObj.getClass();
Imdg<T> testingImdg = hazelcastServiceTest.getImdg(imdgDistributedNames, clazz);
// ((ImdgHazelcast<T>)testingImdg).clear(); // предварительная очистка
testingImdg.insert(existsObj);
Collection<T> values = testingImdg.getAllValues();
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(restUrl)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
// ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));

View file

@ -12,51 +12,28 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
class AccountControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/accounting/accounts/";
/**
* {@link AccountController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
* Входной запрос /accounting/accounts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Account existBankAccount = new Account();
existBankAccount.setAccountType("99");
existBankAccount.setAccount("123456789123");
existBankAccount.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Account, existBankAccount, REST_URL);
}
/**
* {@link AccountController#add(AccountNewAction)} <br>
* Тест проверяет получение сущности {@link AccountNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link AccountNewAction}:<br>
*/
@Test
void add() throws Exception {
//ARRANGE
AccountNewAction accountNewAction = new AccountNewAction();
accountNewAction.setStatus("ACTV");
accountNewAction.setAccount("A11112222333");
accountNewAction.setCompanyId(5L);
accountNewAction.setAccountType("BANK");
//ACT and ASSERT
checkAddingByRestApi(REST_URL, accountNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW, accountNewAction);
}
/**
* {@link AccountController#update(Long, AccountUpdateAction)} <br>
* Тест проверяет получение сущности {@link AccountUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link AccountUpdateAction}:<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
AccountUpdateAction accountUpdateAction = new AccountUpdateAction();
accountUpdateAction.setId(id);
@ -65,27 +42,17 @@ class AccountControllerTest extends AbstractControllerTest {
accountUpdateAction.setCompanyId(5L);
accountUpdateAction.setAccountType("BANK");
Account account = getAccount(id);
//ACT and ASSERT
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
REST_URL, accountUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE, accountUpdateAction);
}
/**
* {@link AccountController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /securities/account/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
Account account = getAccount(id);
//ACT and ASSERT
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, deleteAction);

View file

@ -9,13 +9,11 @@ import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction;
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetByIdResponse;
import ru.spcex.clearing.backendapi.domain.actions.IAction;
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest;
import ru.spcex.platform.imdg.api.Imdg;
import java.util.HashMap;
@ -30,23 +28,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class BankAccountControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/accounting/bank-accounts/";
/**
* {@link BankAccountController#add(BankAccountNewAction)}<br>
* Тест проверяет получение сущности {@link BankAccountNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link BankAccountNewRequest}:<br>
* {@link BankAccountNewRequest#bankIdentificationCode} - 044525776<br>
* {@link BankAccountNewRequest#bankName} - Beta Money Bank<br>
* {@link BankAccountNewRequest#correspondentAccount} - 30101111111111111776<br>
* {@link BankAccountNewRequest#correspondentAccountName} - correspondent<br>
* {@link BankAccountNewRequest#currency} - RUB<br>
* {@link BankAccountNewRequest#destination} - destination<br>
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 3664011397<br>
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 01<br>
* {@link BankAccountNewRequest#account} - 11111222223333344444<br>
*/
@Test
void add() throws Exception {
//ARRANGE
BankAccountNewAction bankAccountNewAction = getBankAccountNewAction(
0, "044525776",
"Beta Money Bank",
@ -57,26 +40,10 @@ class BankAccountControllerTest extends AbstractControllerTest {
"3664011397",
"01",
"11111222223333344444");
//ACT and ASSERT
checkAddingByRestApi(REST_URL, bankAccountNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_NEW, bankAccountNewAction);
}
/**
* {@link BankAccountController#add(BankAccountNewAction)}<br>
* Тест проверяет работу валидации сущности {@link BankAccountNewAction} принятой по REST API для отправку в Apache Kafka.<br>
* Входной запрос {@link BankAccountNewRequest}:<br>
* {@link BankAccountNewRequest#bankIdentificationCode} - 044525776 или ""<br>
* {@link BankAccountNewRequest#bankName} - Beta Money Bank или ""<br>
* {@link BankAccountNewRequest#correspondentAccount} - 30101111111111111776 или ""<br>
* {@link BankAccountNewRequest#correspondentAccountName} - correspondent или ""<br>
* {@link BankAccountNewRequest#currency} - RUB или ""<br>
* {@link BankAccountNewRequest#destination} - destinatio или ""n<br>
* {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 3664011397 или ""<br>
* {@link BankAccountNewRequest#taxRegistrationReasonCode} - 01 или ""<br>
* {@link BankAccountNewRequest#account} - 11111222223333344444 или ""<br>
*/
@Test
void addWithException() {
assertThrowsFor(getBankAccountNewAction(0, "", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", "11111222223333344444"));
@ -90,22 +57,8 @@ class BankAccountControllerTest extends AbstractControllerTest {
assertThrowsFor(getBankAccountNewAction(0, "044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", ""));
}
/**
* {@link BankAccountController#update(Long, BankAccountUpdateAction)}<br>
* Тест проверяет получение сущности {@link BankAccountUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link BankAccountUpdateAction}:<br>
* {@link BankAccountUpdateAction#bankIdentificationCode} - 044525776<br>
* {@link BankAccountUpdateAction#bankName} - Beta Money Bank<br>
* {@link BankAccountUpdateAction#correspondentAccount} - 30101111111111111776<br>
* {@link BankAccountUpdateAction#correspondentAccountName} - correspondent<br>
* {@link BankAccountUpdateAction#currency} - RUB<br>
* {@link BankAccountUpdateAction#destination} - destination<br>
* {@link BankAccountUpdateAction#taxpayerIdentificationNumber} - 3664011397<br>
* {@link BankAccountUpdateAction#taxRegistrationReasonCode} - 01<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = 0;
BankAccountUpdateAction bankAccountUpdateAction = getBankAccountUpdateAction(
id,
@ -118,37 +71,21 @@ class BankAccountControllerTest extends AbstractControllerTest {
"3664011397",
"01",
"11111222223333344444");
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, bankAccountUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_UPDATE, bankAccountUpdateAction);
}
/**
* {@link BankAccountController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /accounting/bank-accounts/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_BLOCK, deleteAction);
}
/**
* {@link BankAccountController#getById(Long)} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
* Входной запрос /accounting/bank-accounts/{@link Long}: - 0L <br>
* Ответ BankAccountBackendGetById <br>
*/
@Test
void getById() throws Exception {
//ARRANGE
BankAccount existBankAccount = new BankAccount();
existBankAccount.setBankName("ooo tinkoff");
existBankAccount.setBankIdentificationCode("99999");
@ -164,7 +101,6 @@ class BankAccountControllerTest extends AbstractControllerTest {
inDocumentJournalImdg.insert(existBankAccount);
CommonGetByIdResponse expected = new CommonGetByIdResponse();
//expected.getPayload().
Map<String, Object> payload = new HashMap<>();
payload.put("bankName", "ooo tinkoff");
payload.put("bankIdentificationCode", "99999");
@ -176,25 +112,16 @@ class BankAccountControllerTest extends AbstractControllerTest {
payload.put("taxRegistrationReasonCode", "886886");
payload.put("id", existBankAccount.getId());
expected.fromEntity(payload);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId())
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
// ASSERT
.andExpect(status().isOk())
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));
}
/**
* {@link BankAccountController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
* Входной запрос /accounting/bank-accounts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
BankAccount existBankAccount = new BankAccount();
existBankAccount.setBankName("ooo tinkoff");
existBankAccount.setBankIdentificationCode("99999");
@ -205,8 +132,6 @@ class BankAccountControllerTest extends AbstractControllerTest {
existBankAccount.setTaxpayerIdentificationNumber("848484848484");
existBankAccount.setTaxRegistrationReasonCode("886886");
existBankAccount.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_BankAccount, existBankAccount, REST_URL);
}

View file

@ -8,22 +8,13 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
class ClearingAccountControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/accounting/clearing-accounts/";
/**
* {@link ClearingAccountController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingAccount.<br>
* Входной запрос /securities/clearing-accounts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ClearingAccount existClearingAccount = new ClearingAccount();
existClearingAccount.setAccountId(99L);
existClearingAccount.setClearingAccountType("CATPE-1");
existClearingAccount.setCompanyId(6L);
existClearingAccount.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingAccount, existClearingAccount, REST_URL);
}

View file

@ -22,16 +22,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class ClientCodeControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/client-codes/";
/**
* {@link ClientCodeController#add(ClientCodeNewAction)}<br>
* Тест проверяет получение сущности {@link ClientCodeNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClientCodeNewRequest}:<br>
* {@link ClientCodeNewRequest#} - 044525776<br>
* ...
*/
@Test
void add() throws Exception {
//ARRANGE
ClientCodeNewAction clientCodeNewAction = getClientCodeNewAction(
0,
"044525776",
@ -40,24 +32,10 @@ class ClientCodeControllerTest extends AbstractControllerTest {
1010L,
1020L,
1030L);
//ACT and ASSERT
checkAddingByRestApi(REST_URL, clientCodeNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_NEW, clientCodeNewAction);
}
/**
* {@link ClientCodeController#add(ClientCodeNewAction)}<br>
* Тест проверяет работу валидации сущности {@link ClientCodeNewAction} принятой по REST API для отправку в Apache Kafka.<br>
* Входной запрос {@link ClientCodeNewAction}:<br>
* {@link ClientCodeNewAction#id} - (generated)<br>
* {@link ClientCodeNewAction#code} - "044525776" или null или ""<br>
* {@link ClientCodeNewAction#status} - "ACTV"<br>
* {@link ClientCodeNewAction#companyId} - 1000L или null<br>
* {@link ClientCodeNewAction#depoAccountId} - 1010L<br>
* {@link ClientCodeNewAction#moneyAccountId} - 1020L<br>
* {@link ClientCodeNewAction#tradingClearingRegistryId} - 1030L<br>
*/
@Test
void addWithException() {
assertThrowsFor(getClientCodeNewAction(0, "", "ACTV", 1000L, 1010L, 1020L, 1030L));
@ -65,21 +43,8 @@ class ClientCodeControllerTest extends AbstractControllerTest {
assertThrowsFor(getClientCodeNewAction(0, "044525776", "ACTV", null, 1010L, 1020L, 1030L));
}
/**
* {@link ClientCodeController#update(Long, ClientCodeUpdateAction)}<br>
* Тест проверяет получение сущности {@link ClientCodeUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClientCodeUpdateAction}:<br>
* {@link ClientCodeUpdateAction#id} - (generated)<br>
* {@link ClientCodeUpdateAction#code} - "044525776"<br>
* {@link ClientCodeUpdateAction#status} - "ACTV"<br>
* {@link ClientCodeUpdateAction#companyId} - 1000L<br>
* {@link ClientCodeUpdateAction#depoAccountId} - 1010L<br>
* {@link ClientCodeUpdateAction#moneyAccountId} - 1020L<br>
* {@link ClientCodeUpdateAction#tradingClearingRegistryId} - 1030L<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = 0;
ClientCodeUpdateAction clientCodeUpdateAction = getClientCodeUpdateAction(
id,
@ -89,37 +54,21 @@ class ClientCodeControllerTest extends AbstractControllerTest {
1010L,
1020L,
1030L);
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, clientCodeUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_UPDATE, clientCodeUpdateAction);
}
/**
* {@link ClientCodeController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /client-codes/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_DELETE, deleteAction);
}
/**
* {@link ClientCodeController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClientCode.<br>
* Входной запрос /client-codes/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ClientCode existClientCode = new ClientCode();
existClientCode.setCode("ooo tinkoff");
existClientCode.setCompanyId(1000L);
@ -130,8 +79,6 @@ class ClientCodeControllerTest extends AbstractControllerTest {
existClientCode.setCreated(Instant.now());
existClientCode.setUpdated(Instant.now());
existClientCode.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClientCode, existClientCode, REST_URL);
}

View file

@ -8,22 +8,13 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
class DepoAccountControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/accounting/depo-accounts/";
/**
* {@link DepoAccountController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingAccount.<br>
* Входной запрос /securities/depo-accounts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
DepoAccount existDepoAccount = new DepoAccount();
existDepoAccount.setAccountId(99L);
existDepoAccount.setDepoAccountType("T1001");
existDepoAccount.setCompanyId(6L);
existDepoAccount.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoAccount, existDepoAccount, REST_URL);
}

View file

@ -3,28 +3,18 @@ package ru.spcex.clearing.backendapi.controller.queue.account;
import org.junit.jupiter.api.Test;
import ru.clearing.classes.statics.data.account.InformationAccount;
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.backendapi.controller.queue.account.InformationAccountController;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
class InformationAccountControllerTest extends AbstractControllerTest {
public static final String REST_URL = "/accounting/information-accounts/";
/**
* {@link InformationAccountController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /accounting/information-accounts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
InformationAccount informationAccount = new InformationAccount();
informationAccount.setId(currentId.get());
informationAccount.setCompanyId(currentId.get());
informationAccount.setClearingAccountId(currentId.get());
informationAccount.setAccountId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InformationAccount, informationAccount, REST_URL);
}
}

View file

@ -20,88 +20,44 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class ClearingMemberCategoryControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/clearing-member-categories/";
/**
* {@link ClearingMemberCategoryController#add(ClearingMemberCategoryNewAction)}<br>
* Тест проверяет получение сущности {@link ClearingMemberCategoryNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClearingMemberCategoryNewAction}:<br>
* {@link ClearingMemberCategoryNewAction#clearingMemberCategory} - "Category"<br>
* {@link ClearingMemberCategoryNewAction#companyId} - currentId<br>
*/
@Test
void add() throws Exception {
//ARRANGE
ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction();
clearingMemberCategoryNewAction.setClearingMemberCategory("Category");
clearingMemberCategoryNewAction.setCompanyId(0L);
//ACT and ASSERT
checkAddingByRestApi(REST_URL, clearingMemberCategoryNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_NEW, clearingMemberCategoryNewAction);
}
/**
* {@link ClearingMemberCategoryController#add(ClearingMemberCategoryNewAction)}<br>
* Тест проверяет получение сущности {@link ClearingMemberCategoryNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClearingMemberCategoryNewAction}:<br>
* {@link ClearingMemberCategoryNewAction#clearingMemberCategory} - "Category"<br>
* {@link ClearingMemberCategoryNewAction#companyId} - currentId<br>
*/
// @Test валидации пока нет
void addWithException() {
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
}
/**
* {@link ClearingMemberCategoryController#update(Long, ClearingMemberCategoryUpdateAction)}<br>
* Тест проверяет получение сущности {@link ClearingMemberCategoryUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClearingMemberCategoryUpdateAction}:<br>
* {@link ClearingMemberCategoryUpdateAction#clearingMemberCategory} - Category<br>
* {@link ClearingMemberCategoryUpdateAction#id} - currentId<br>
*/
@Test
void update() throws Exception {
//ARRANGE
ClearingMemberCategoryUpdateAction clearingMemberCategoryUpdateAction = new ClearingMemberCategoryUpdateAction();
clearingMemberCategoryUpdateAction.setClearingMemberCategory("Category");
clearingMemberCategoryUpdateAction.setId(currentId.get());
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, clearingMemberCategoryUpdateAction, clearingMemberCategoryUpdateAction.getId());
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE, clearingMemberCategoryUpdateAction);
}
/**
* {@link ClearingMemberCategoryController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /clearing-member-categories/{@link Long}: - currentId<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE, deleteAction);
}
/**
* {@link ClearingMemberCategoryController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingMemberCategory.<br>
* Входной запрос /clearing-member-categories/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ClearingMemberCategory clearingMemberCategory = new ClearingMemberCategory();
clearingMemberCategory.setClearingMemberCategory("Category");
clearingMemberCategory.setCompanyId(1000000L);
clearingMemberCategory.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingMemberCategory, clearingMemberCategory, REST_URL);
}

View file

@ -3,41 +3,25 @@ package ru.spcex.clearing.backendapi.controller.queue.company;
import org.junit.jupiter.api.Test;
import ru.clearing.classes.statics.data.company.Company;
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.backendapi.controller.queue.registry.TradingClearingRegistryController;
import ru.spcex.clearing.backendapi.controller.request.cud.common.CommonDeleteAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyNewAction;
import ru.spcex.clearing.backendapi.controller.request.cud.registry.TradingClearingRegistryNewAction;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
class CompanyControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/companies/";
/**
* {@link CompanyController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /companies/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_DELETE, deleteAction);
}
/**
* {@link CompanyController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.<br>
* Входной запрос /companies <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Company existCompany = new Company();
existCompany.setTradingCode("ooo tinkoff");
existCompany.setClearingCode("99999");
@ -45,26 +29,12 @@ class CompanyControllerTest extends AbstractControllerTest {
existCompany.setShortName("OOO ROGA I KOPITA");
existCompany.setTradingCode("848484848484");
existCompany.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Company, existCompany, REST_URL);
}
/**
* {@link CompanyController#add(CompanyNewAction)}<br>
* Тест проверяет создание сущности {@link CompanyNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link CompanyNewAction}:<br>
* {@link CompanyNewAction#fullName "Full name"<br>
* {@link CompanyNewAction#companySymbol "CLRC"<br>
* {@link CompanyNewAction#companySymbolValue "NAME1"<br>
* {@link CompanyNewAction#workflowStatus "ACTV"<br>
*/
@Test
void add() throws Exception {
//ARRANGE
CompanyNewAction newAction = getCompanyNewAction();
//ACT and ASSERT
checkAddingByRestApi(REST_URL, newAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_NEW, newAction);
}

View file

@ -30,51 +30,13 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class CompanyInfoControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/company-infos/";
/**
* {@link CompanyInfoController#update(Long, CompanyInfoUpdateAction)}<br>
* Тест проверяет получение сущности {@link CompanyInfoUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link CompanyInfoUpdateAction}:<br>
* {@link CompanyInfoUpdateAction#workflowStatus} - ACTV<br>
* {@link CompanyInfoUpdateAction#corporationSoleType} - 0000<br>
* {@link CompanyInfoUpdateAction#countryCode} - 0000<br>
* {@link CompanyInfoUpdateAction#description} - exists description<br>
* {@link CompanyInfoUpdateAction#professionalSign} - 0000<br>
* {@link CompanyInfoUpdateAction#legalKind} - 0000<br>
* {@link CompanyInfoUpdateAction#organizationType} - 0000<br>
* {@link CompanyInfoUpdateAction#residence} - 0000<br>
* {@link CompanyInfoUpdateAction#shortNameEng} - exists shortNameEng<br>
* {@link CompanyInfoUpdateAction#fullNameEng} - exists fullNameEng<br>
* {@link CompanyInfoUpdateAction#shortName} - exists shortName<br>
* {@link CompanyInfoUpdateAction#fullName} - exists fullName<br>
* {@link CompanyInfoUpdateAction#id} - currentId<br>
*/
// @Test валидации пока нет
void addWithException() {
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
}
/**
* {@link CompanyInfoController#update(Long, CompanyInfoUpdateAction)}<br>
* Тест проверяет получение сущности {@link CompanyInfoUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link CompanyInfoUpdateAction}:<br>
* {@link CompanyInfoUpdateAction#workflowStatus} - ACTV<br>
* {@link CompanyInfoUpdateAction#corporationSoleType} - 0000<br>
* {@link CompanyInfoUpdateAction#countryCode} - 0000<br>
* {@link CompanyInfoUpdateAction#description} - exists description<br>
* {@link CompanyInfoUpdateAction#professionalSign} - 0000<br>
* {@link CompanyInfoUpdateAction#legalKind} - 0000<br>
* {@link CompanyInfoUpdateAction#organizationType} - 0000<br>
* {@link CompanyInfoUpdateAction#residence} - 0000<br>
* {@link CompanyInfoUpdateAction#shortNameEng} - exists shortNameEng<br>
* {@link CompanyInfoUpdateAction#fullNameEng} - exists fullNameEng<br>
* {@link CompanyInfoUpdateAction#shortName} - exists shortName<br>
* {@link CompanyInfoUpdateAction#fullName} - exists fullName<br>
* {@link CompanyInfoUpdateAction#id} - currentId<br>
*/
@Test
void update() throws Exception {
//ARRANGE
CompanyInfoUpdateAction companyInfoUpdateAction = new CompanyInfoUpdateAction();
companyInfoUpdateAction.setWorkflowStatus("ACTV");
companyInfoUpdateAction.setCorporationSoleType("0000");
@ -89,21 +51,12 @@ class CompanyInfoControllerTest extends AbstractControllerTest {
companyInfoUpdateAction.setShortName("exists shortName");
companyInfoUpdateAction.setFullName("exists fullName");
companyInfoUpdateAction.setId(currentId.get());
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, companyInfoUpdateAction, companyInfoUpdateAction.getId());
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_INFO_UPDATE, companyInfoUpdateAction);
}
/**
* {@link CompanyInfoController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.<br>
* Входной запрос /company-infos/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Long ID = 0L;
CompanyInfo existsCompanyInfo = new CompanyInfo();
existsCompanyInfo.setId(ID);
@ -128,17 +81,15 @@ class CompanyInfoControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = new ArrayList<>();
Collection<Company> companies = companyImdg.getAllValues();
for (Company company : companies) {
if (company.getProfile() != null && company.getProfile().getId() != null) { // пока возвращает "пустой" CompanyInfo если его нет для Company
if (company.getProfile() != null && company.getProfile().getId() != null) {
all.add(responseFactory.responseFromObject(company.getProfile()));
}
}
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));

View file

@ -8,22 +8,12 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
class CompanyRoleSetControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/company-role-sets/";
/**
* {@link CompanyRoleSetController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
* Входной запрос /company-role-sets/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
CompanyRoleSet existBankAccount = new CompanyRoleSet();
existBankAccount.setCompanyId(11L);
existBankAccount.setCompanyRole("CLRM");
existBankAccount.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CompanyRoleSet, existBankAccount, REST_URL);
}
}

View file

@ -19,57 +19,28 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class CompanySymbolControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/company-symbols/";
/**
* {@link CompanySymbolController#update(Long, CompanySymbolUpdateAction)}<br>
* Тест проверяет получение сущности {@link CompanySymbolUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link CompanySymbolUpdateAction}:<br>
* {@link CompanySymbolUpdateAction#companyId} - 1000L<br>
* {@link CompanySymbolUpdateAction#companySymbolValue} - SymbolValue<br>
* {@link CompanySymbolUpdateAction#id} - currentId<br>
*/
// @Test валидации пока нет
void addWithException() {
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
}
/**
* {@link CompanySymbolController#update(Long, CompanySymbolUpdateAction)}<br>
* Тест проверяет получение сущности {@link CompanySymbolUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link CompanySymbolUpdateAction}:<br>
* {@link CompanySymbolUpdateAction#companyId} - 1000L<br>
* {@link CompanySymbolUpdateAction#companySymbolValue} - SymbolValue<br>
* {@link CompanySymbolUpdateAction#id} - currentId<br>
*/
@Test
void update() throws Exception {
//ARRANGE
CompanySymbolUpdateAction companySymbolUpdateAction = new CompanySymbolUpdateAction();
companySymbolUpdateAction.setCompanyId(1000L);
companySymbolUpdateAction.setCompanySymbolValue("SymbolValue");
companySymbolUpdateAction.setId(currentId.get());
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, companySymbolUpdateAction, companySymbolUpdateAction.getId());
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_SYMBOL_UPDATE, companySymbolUpdateAction);
}
/**
* {@link CompanySymbolController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_CompanySymbols.<br>
* Входной запрос /clearing-member-categories/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
CompanySymbols companySymbols = new CompanySymbols();
companySymbols.setCompanyId(1000L);
companySymbols.setCompanySymbol("Symbol");
companySymbols.setCompanySymbolValue("SymbolValue");
companySymbols.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CompanySymbols, companySymbols, REST_URL);
}

View file

@ -7,7 +7,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import ru.clearing.classes.statics.data.profile.Contact;
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.backendapi.controller.request.cud.company.ClearingMemberCategoryNewAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanySymbolUpdateAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactNewAction;
import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactUpdateAction;
import ru.spcex.clearing.backendapi.domain.actions.IAction;
@ -21,80 +20,39 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class ContactControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/contacts/";
/**
* {@link CompanySymbolController#update(Long, CompanySymbolUpdateAction)}<br>
* Тест проверяет получение сущности {@link CompanySymbolUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link CompanySymbolUpdateAction}:<br>
* {@link CompanySymbolUpdateAction#companyId} - 1000L<br>
* {@link CompanySymbolUpdateAction#companySymbol} - Symbol<br>
* {@link CompanySymbolUpdateAction#companySymbolValue} - SymbolValue<br>
* {@link CompanySymbolUpdateAction#id} - currentId<br>
*/
// @Test валидации пока нет
void addWithException() {
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
}
/**
* {@link ContactController#create(Long, ContactNewAction)}<br>
* Тест проверяет получение сущности {@link ContactNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ContactNewAction}:<br>
* {@link ContactNewAction#contactType} - ContactType<br>
* {@link ContactNewAction#contactValue} - ContactValue<br>
* {@link ContactNewAction#id} - currentId<br>
*/
@Test
void create() throws Exception {
//ARRANGE
ContactNewAction companySymbolNewAction = new ContactNewAction();
companySymbolNewAction.setContactType("ContactType");
companySymbolNewAction.setContactValue("ContactValue");
companySymbolNewAction.setCompanyId(currentId.get());
//ACT and ASSERT
checkAddingByRestApi(REST_URL, companySymbolNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_CONTACT_NEW, companySymbolNewAction);
}
/**
* {@link ContactController#update(Long, ContactUpdateAction)}<br>
* Тест проверяет получение сущности {@link ContactUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ContactUpdateAction}:<br>
* {@link ContactUpdateAction#contactType} - ContactType<br>
* {@link ContactUpdateAction#contactValue} - ContactValue<br>
* {@link ContactUpdateAction#id} - currentId<br>
*/
@Test
void update() throws Exception {
//ARRANGE
ContactUpdateAction companySymbolUpdateAction = new ContactUpdateAction();
companySymbolUpdateAction.setContactType("ContactType");
companySymbolUpdateAction.setContactValue("ContactValue");
companySymbolUpdateAction.setId(currentId.get());
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, companySymbolUpdateAction, companySymbolUpdateAction.getId());
checkSendedMessegeFromKafka(Consts.DESTINATION_CONTACT_UPDATE, companySymbolUpdateAction);
}
/**
* {@link ContactController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Contact.<br>
* Входной запрос /contacts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Contact companySymbolUpdateAction = new Contact();
companySymbolUpdateAction.setCompanyId(1000L);
companySymbolUpdateAction.setContactType("ContactType");
companySymbolUpdateAction.setContactValue("ContactValue");
companySymbolUpdateAction.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Contact, companySymbolUpdateAction, REST_URL);
}

View file

@ -10,15 +10,8 @@ import java.time.LocalDate;
class ProfileDocumentControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/profile-documents/";
/**
* {@link ProfileDocumentController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ProfileDocument.<br>
* Входной запрос /profile-documents/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ProfileDocument profileDocument = new ProfileDocument();
profileDocument.setCompanyId(1000L);
profileDocument.setDocumentType("DocumentType");
@ -33,8 +26,6 @@ class ProfileDocumentControllerTest extends AbstractControllerTest {
profileDocument.setValidToDate(LocalDate.now());
profileDocument.setLink("Link");
profileDocument.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ProfileDocument, profileDocument, REST_URL);
}
}

View file

@ -19,15 +19,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class RelationControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/relations/";
/**
* {@link RelationController#update(Long, RelationUpdateAction)}<br>
* Тест проверяет получение сущности {@link RelationUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос: id, {@link RelationUpdateAction}:<br>
* <br>
*/
@Test
void update() throws Exception {
//ARRANGE
Long existsId = 123L;
RelationUpdateAction relationUpdateAction = new RelationUpdateAction();
relationUpdateAction.setId(existsId);
@ -36,22 +29,13 @@ class RelationControllerTest extends AbstractControllerTest {
Relation relation = new Relation();
relation.setId(existsId);
//ACT and ASSERT
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Relation, relation,
REST_URL, relationUpdateAction, existsId);
checkSendedMessegeFromKafka(Consts.DESTINATION_RELATION_UPDATE, relationUpdateAction);
}
/**
* {@link RelationController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
* Входной запрос /relations/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Long existsId = 123L;
BankAccount existBankAccount = new BankAccount();
existBankAccount.setBankName("ooo tinkoff");
@ -66,8 +50,6 @@ class RelationControllerTest extends AbstractControllerTest {
Relation relation = new Relation();
relation.setId(existsId);
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Relation, relation, REST_URL);
}

View file

@ -12,15 +12,8 @@ import java.time.LocalDate;
class ExecutionDepositControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/execution-deposits/";
/**
* {@link ExecutionDepositController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /execution-deposits/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ExecutionDeposit executionDeposit = new ExecutionDeposit();
executionDeposit.setId(currentId.get());
executionDeposit.setExchangeExecutionId(currentId.get());
@ -52,8 +45,6 @@ class ExecutionDepositControllerTest extends AbstractControllerTest {
executionDeposit.setCoverageStatus("cov");
executionDeposit.setSessionId(currentId.get());
executionDeposit.setClearingDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionDeposit, executionDeposit, REST_URL);
}
}

View file

@ -12,15 +12,8 @@ import java.time.LocalDate;
class ExecutionFondControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/execution-fonds/";
/**
* {@link ExecutionFondController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /execution-fonds/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ExecutionFond executionFond = new ExecutionFond();
executionFond.setId(currentId.get());
executionFond.setExchangeExecutionId(currentId.get());
@ -50,8 +43,6 @@ class ExecutionFondControllerTest extends AbstractControllerTest {
executionFond.setSettlementCode("settl1");
executionFond.setSettlementDate(LocalDate.now());
executionFond.setExchangeExecutionMicroseconds(Instant.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionFond, executionFond, REST_URL);
}
}

View file

@ -12,15 +12,8 @@ import java.time.LocalTime;
class InDocumentJournalControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/in-document-journals/";
/**
* {@link InDocumentJournalController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /in-document-journals/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
InDocumentJournal inDocumentJournal = new InDocumentJournal();
inDocumentJournal.setId(currentId.get());
inDocumentJournal.setComment("Comment");
@ -37,8 +30,6 @@ class InDocumentJournalControllerTest extends AbstractControllerTest {
inDocumentJournal.setQuantity(0L);
inDocumentJournal.setClearingCode("dosser");
inDocumentJournal.setEmailDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InDocumentJournal, inDocumentJournal, REST_URL);
}
}

View file

@ -10,15 +10,8 @@ import java.time.Instant;
class ManagementJournalControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/management-journals/";
/**
* {@link ManagementJournalController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /management-journals/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ManagementJournal managementJournal = new ManagementJournal();
managementJournal.setId(currentId.get());
managementJournal.setCompanyId(currentId.get());
@ -30,8 +23,6 @@ class ManagementJournalControllerTest extends AbstractControllerTest {
managementJournal.setChangeAccessSign("send");
managementJournal.setChangeDataSign("dos");
managementJournal.setEventDate(Instant.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ManagementJournal, managementJournal, REST_URL);
}
}

View file

@ -12,15 +12,8 @@ import java.time.LocalTime;
class OutDocumentJournalControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/out-document-journals/";
/**
* {@link OutDocumentJournalController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /out-document-journals/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
OutDocumentJournal outDocumentJournal = new OutDocumentJournal();
outDocumentJournal.setId(currentId.get());
outDocumentJournal.setRegistrationDate(LocalDate.now());
@ -36,8 +29,6 @@ class OutDocumentJournalControllerTest extends AbstractControllerTest {
outDocumentJournal.setDossierNumber("doc");
outDocumentJournal.setPostDate(LocalDate.now());
outDocumentJournal.setResultStatus("res");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_OutDocumentJournal, outDocumentJournal, REST_URL);
}
}

View file

@ -8,21 +8,12 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
class CurrencyControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/currencies/";
/**
* {@link CurrencyController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /currencies/ <br>
* Ответ CurrencyController <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Currency currency = new Currency();
currency.setId(currentId.get());
currency.setCountryCode("acc");
currency.setCurrencyCode("acc");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Currency, currency, REST_URL);
}
}

View file

@ -10,15 +10,8 @@ import java.time.LocalDate;
class ErrorTextControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/error-texts/";
/**
* {@link ErrorTextController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /error-texts/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ErrorText errorText = new ErrorText();
errorText.setId(currentId.get());
errorText.setText("text");

View file

@ -10,15 +10,8 @@ import java.math.BigDecimal;
class ListingControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/listings/";
/**
* {@link ListingController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /listings/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Listing liabilitiesClaimsAssets = new Listing();
liabilitiesClaimsAssets.setId(currentId.get());
liabilitiesClaimsAssets.setSecurityId(currentId.get());
@ -28,8 +21,6 @@ class ListingControllerTest extends AbstractControllerTest {
liabilitiesClaimsAssets.setSymbolName("res");
liabilitiesClaimsAssets.setTradingCurrency("trad");
liabilitiesClaimsAssets.setWorkflowStatus("work");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Listing, liabilitiesClaimsAssets, REST_URL);
}
}

View file

@ -8,15 +8,8 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
class MarketControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/markets/";
/**
* {@link MarketController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /markets/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Market liabilitiesClaimsAssets = new Market();
liabilitiesClaimsAssets.setId(currentId.get());
liabilitiesClaimsAssets.setDescription("des");
@ -25,8 +18,6 @@ class MarketControllerTest extends AbstractControllerTest {
liabilitiesClaimsAssets.setCode("man");
liabilitiesClaimsAssets.setSettlementCurrency("res");
liabilitiesClaimsAssets.setSection("sec");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Market, liabilitiesClaimsAssets, REST_URL);
}
}

View file

@ -9,7 +9,6 @@ import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import java.time.Instant;
import java.time.LocalDate;
import java.util.Collection;
import java.util.Map;
@ -22,15 +21,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class NotificationControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/notifications/";
/**
* {@link NotificationController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Notification.<br>
* Входной запрос /notifications/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Notification profileDocument = new Notification();
profileDocument.setClearingDate(LocalDate.now());
profileDocument.setSenderId(1000L);
@ -47,11 +39,9 @@ class NotificationControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));

View file

@ -21,15 +21,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class SessionControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/sessions/";
/**
* {@link SessionController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Session.<br>
* Входной запрос /sessions/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Session session = new Session();
session.setClearingDate(LocalDate.now());
session.setSessionStatus("Ok");
@ -42,11 +35,9 @@ class SessionControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));

View file

@ -25,15 +25,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class PaymentInstructionControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/payment-instructions/";
/**
* {@link PaymentInstructionController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_PaymentInstruction.<br>
* Входной запрос /paymentInstructions/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
PaymentInstruction paymentInstruction = new PaymentInstruction();
paymentInstruction.setSenderId(1010L);
@ -72,11 +65,9 @@ class PaymentInstructionControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));
@ -84,7 +75,6 @@ class PaymentInstructionControllerTest extends AbstractControllerTest {
@Test
void clearingOutboundAction() throws Exception {
//ARRANGE
PIClearingOutbondActionNew piClearingOutbondActionNew = new PIClearingOutbondActionNew();
piClearingOutbondActionNew.setSenderId(111L);
piClearingOutbondActionNew.setAddresseeId(222L);
@ -92,7 +82,6 @@ class PaymentInstructionControllerTest extends AbstractControllerTest {
piClearingOutbondActionNew.setCreditLeg_amount(BigDecimal.valueOf(120.99));
piClearingOutbondActionNew.setCreditLeg_accountId(333L);
piClearingOutbondActionNew.setDebitLeg_accountId(335L);
//ACT and ASSERT
checkAddingByRestApi("/payment-instructions/clearing-outbound/", piClearingOutbondActionNew);
checkSendedMessegeFromKafka(Consts.PAYMENT_INSTRUCTION_CLEARING_OUTBOUND_ACTION, piClearingOutbondActionNew);
}

View file

@ -11,15 +11,8 @@ import java.time.LocalDate;
class AdmittedLiabilitiesRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/admitted-liabilities-registers/";
/**
* {@link AdmittedLiabilitiesRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /admitted-liabilities-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
AdmittedLiabilitiesRegister admittedLiabilitiesRegister = new AdmittedLiabilitiesRegister();
admittedLiabilitiesRegister.setId(currentId.get());
admittedLiabilitiesRegister.setCompanyFullName("fuill nme");
@ -31,8 +24,6 @@ class AdmittedLiabilitiesRegisterControllerTest extends AbstractControllerTest {
admittedLiabilitiesRegister.setAccount("ACC1");
admittedLiabilitiesRegister.setAmount(BigDecimal.valueOf(12.15));
admittedLiabilitiesRegister.setClearingDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_AdmittedLiabilitiesRegister, admittedLiabilitiesRegister, REST_URL);
}
}

View file

@ -10,15 +10,8 @@ import java.time.LocalDate;
class ContractRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/contract-registers/";
/**
* {@link ContractRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /contract-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ContractRegister contractRegister = new ContractRegister();
contractRegister.setId(currentId.get());
contractRegister.setName("code");
@ -35,8 +28,6 @@ class ContractRegisterControllerTest extends AbstractControllerTest {
contractRegister.setValidToDate(LocalDate.now());
contractRegister.setCloseDate(LocalDate.now());
contractRegister.setComment("ocpo");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ContractRegister, contractRegister, REST_URL);
}
}

View file

@ -11,15 +11,8 @@ import java.time.LocalDate;
class CoveredLiabilitiesRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/covered-liabilities-registers/";
/**
* {@link CoveredLiabilitiesRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /covered-liabilities-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
CoveredLiabilitiesRegister coveredLiabilitiesRegister = new CoveredLiabilitiesRegister();
coveredLiabilitiesRegister.setId(currentId.get());
coveredLiabilitiesRegister.setCompanyFullName("fuill nme");
@ -31,8 +24,6 @@ class CoveredLiabilitiesRegisterControllerTest extends AbstractControllerTest {
coveredLiabilitiesRegister.setAccount("ACC1");
coveredLiabilitiesRegister.setAmount(BigDecimal.valueOf(12.15));
coveredLiabilitiesRegister.setClearingDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CoveredLiabilitiesRegister, coveredLiabilitiesRegister, REST_URL);
}
}

View file

@ -8,23 +8,14 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
class DepoBalanceRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/depo-balance-registers/";
/**
* {@link DepoBalanceRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /depo-balance-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
DepoBalanceRegister depoBalanceRegister = new DepoBalanceRegister();
depoBalanceRegister.setId(currentId.get());
depoBalanceRegister.setSessionId(111L);
depoBalanceRegister.setSecuritySymbol("RUB");
depoBalanceRegister.setCompanyId(222L);
depoBalanceRegister.setDepoCode("DCDE");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoBalanceRegister, depoBalanceRegister, REST_URL);
}
}

View file

@ -10,15 +10,8 @@ import java.math.BigDecimal;
class DepoPaymentInstructionRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/depo-payment-instruction-registers/";
/**
* {@link DepoPaymentInstructionRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /depo-payment-instruction-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister();
depoPaymentInstructionRegister.setId(currentId.get());
depoPaymentInstructionRegister.setCompanyId(currentId.get());
@ -28,8 +21,6 @@ class DepoPaymentInstructionRegisterControllerTest extends AbstractControllerTes
depoPaymentInstructionRegister.setQuantity(BigDecimal.valueOf(12.15));
depoPaymentInstructionRegister.setDirection(currentId.get());
depoPaymentInstructionRegister.setSessionId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoPaymentInstructionRegister, depoPaymentInstructionRegister, REST_URL);
}
}

View file

@ -11,15 +11,8 @@ import java.time.LocalDate;
class ExcludeLiabilitiesRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/exclude-liabilities-registers/";
/**
* {@link ExcludeLiabilitiesRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /exclude-liabilities-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ExcludeLiabilitiesRegister excludeLiabilitiesRegister = new ExcludeLiabilitiesRegister();
excludeLiabilitiesRegister.setId(currentId.get());
excludeLiabilitiesRegister.setSessionId(222L);
@ -35,8 +28,6 @@ class ExcludeLiabilitiesRegisterControllerTest extends AbstractControllerTest {
excludeLiabilitiesRegister.setCurrency("Currency");
excludeLiabilitiesRegister.setSumLiabilities(BigDecimal.valueOf(12.15));
excludeLiabilitiesRegister.setSettlementDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExcludeLiabilitiesRegister, excludeLiabilitiesRegister, REST_URL);
}
}

View file

@ -12,15 +12,8 @@ import java.time.LocalDate;
class ExecutionRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/execution-registers/";
/**
* {@link ExecutionRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /execution-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ExecutionRegister executionRegister = new ExecutionRegister();
executionRegister.setId(currentId.get());
executionRegister.setTradingDate(LocalDate.now());
@ -40,9 +33,6 @@ class ExecutionRegisterControllerTest extends AbstractControllerTest {
executionRegister.setAmount(BigDecimal.valueOf(14.55));
executionRegister.setQuantity(BigDecimal.valueOf(0.1));
executionRegister.setClearingDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionRegister, executionRegister, REST_URL);
}
}

View file

@ -11,15 +11,8 @@ import java.time.LocalDate;
class LiabilitiesRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/liabilities-registers/";
/**
* {@link LiabilitiesRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /liabilities-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
LiabilitiesRegister liabilitiesRegister = new LiabilitiesRegister();
liabilitiesRegister.setId(currentId.get());
liabilitiesRegister.setSessionId(111L);
@ -35,9 +28,6 @@ class LiabilitiesRegisterControllerTest extends AbstractControllerTest {
liabilitiesRegister.setCurrency("RUB");
liabilitiesRegister.setSumLiabilities(BigDecimal.TEN);
liabilitiesRegister.setSettlementDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_LiabilitiesRegister, liabilitiesRegister, REST_URL);
}
}

View file

@ -10,15 +10,8 @@ import java.math.BigDecimal;
class MoneyBalanceRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/money-balance-registers/";
/**
* {@link MoneyBalanceRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /money-balance-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
MoneyBalanceRegister moneyBalanceRegister = new MoneyBalanceRegister();
moneyBalanceRegister.setId(currentId.get());
moneyBalanceRegister.setSetHouseName("setHouseName");
@ -31,9 +24,6 @@ class MoneyBalanceRegisterControllerTest extends AbstractControllerTest {
moneyBalanceRegister.setSessionId(456L);
moneyBalanceRegister.setCompanyFullName("companyFullName");
moneyBalanceRegister.setCompanyId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_MoneyBalanceRegister, moneyBalanceRegister, REST_URL);
}
}

View file

@ -1,31 +1,20 @@
package ru.spcex.clearing.backendapi.controller.queue.register;
import org.junit.jupiter.api.Test;
import ru.clearing.classes.statics.data.register.ContractRegister;
import ru.clearing.classes.statics.data.registry.Registry;
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
import ru.spcex.clearing.backendapi.controller.request.cud.registry.RSplitDepositActionNew;
import ru.spcex.clearing.backendapi.controller.request.cud.registry.TradingClearingRegistryNewAction;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import java.math.BigDecimal;
import java.time.LocalDate;
import static org.junit.jupiter.api.Assertions.*;
class RegistryControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/registries/";
/**
* {@link RegistryController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /registries/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Registry registry = new Registry();
registry.setId(currentId.get());
registry.setCompanyId(currentId.get());
@ -71,20 +60,16 @@ class RegistryControllerTest extends AbstractControllerTest {
registry.setGroupId(currentId.get());
registry.setSessionId(currentId.get());
registry.setSessionType("CLR1");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Registry, registry, REST_URL);
}
@Test
void splitDepositAction() throws Exception {
//ARRANGE
RSplitDepositActionNew rSplitDepositActionNew=new RSplitDepositActionNew();
rSplitDepositActionNew.setComment("comment");
rSplitDepositActionNew.setContract("CONTRACT-1");
rSplitDepositActionNew.setRefundDate(LocalDate.now());
rSplitDepositActionNew.setOutboundAmount(BigDecimal.ONE);
//ACT and ASSERT
checkAddingByRestApi("/registries/splitDeposit/", rSplitDepositActionNew);
checkSendedMessegeFromKafka(Consts.REGISTRY_SPLIT_DEPOSIT_ACTION, rSplitDepositActionNew);

View file

@ -10,15 +10,8 @@ import java.time.LocalDate;
class ReportRegisterControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/report-registers/";
/**
* {@link ReportRegisterController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /report-registers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ReportRegister reportRegister = new ReportRegister();
reportRegister.setId(currentId.get());
reportRegister.setCompanyFullName("code");
@ -28,8 +21,6 @@ class ReportRegisterControllerTest extends AbstractControllerTest {
reportRegister.setName("cat");
reportRegister.setQuantity(currentId.get());
reportRegister.setClearingDate(LocalDate.now());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ReportRegister, reportRegister, REST_URL);
}
}

View file

@ -15,7 +15,6 @@ import ru.spcex.clearing.backendapi.domain.actions.IAction;
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
import ru.spcex.clearing.imdg.IMDGDistributedNames;
import ru.spcex.clearing.platform.messaging.domain.Consts;
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
import ru.spcex.platform.imdg.api.Imdg;
import static org.junit.jupiter.api.Assertions.assertThrows;
@ -27,88 +26,43 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class TradingClearingRegistryControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/trading-clearing-registries/";
/**
* {@link TradingClearingRegistryController#add(TradingClearingRegistryNewAction)}<br>
* Тест проверяет получение сущности {@link TradingClearingRegistryNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link TradingClearingRegistryNewRequest}:<br>
* {@link TradingClearingRegistryNewRequest#companyId} - 1234567890<br>
* {@link TradingClearingRegistryNewRequest#moneyAccountId} - 18415056336414057<br>
* {@link TradingClearingRegistryNewRequest#depoAccountId} - 21239757374450030<br>
* {@link TradingClearingRegistryNewRequest#status} - ACTV<br>
*/
@Test
void add() throws Exception {
//ARRANGE
TradingClearingRegistryNewAction tradingClearingRegistryNewAction = getTradingClearingRegistryNewAction(
0,
1234567890L, 18415056336414057L, 21239757374450030L, "ACTV"
);
//ACT and ASSERT
checkAddingByRestApi(REST_URL, tradingClearingRegistryNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_NEW, tradingClearingRegistryNewAction);
}
/**
* {@link TradingClearingRegistryController#add(TradingClearingRegistryNewAction)}<br>
* Тест проверяет работу валидации сущности {@link TradingClearingRegistryNewAction} принятой по REST API для отправку в Apache Kafka.<br>
* Входной запрос {@link TradingClearingRegistryNewRequest}:<br>
* {@link TradingClearingRegistryNewRequest#companyId} - 1234567890 / null<br>
* {@link TradingClearingRegistryNewRequest#moneyAccountId} - 18415056336414057 / null<br>
* {@link TradingClearingRegistryNewRequest#depoAccountId} - 21239757374450030<br>
* {@link TradingClearingRegistryNewRequest#status} - ACTV<br>
*/
@Test
void addWithException() {
assertThrowsForNew(getTradingClearingRegistryNewAction(0, null, 18415056336414057L, 21239757374450030L, "ACTV"));
assertThrowsForNew(getTradingClearingRegistryNewAction(0, 1234567890L, null, 21239757374450030L, "ACTV"));
}
/**
* {@link TradingClearingRegistryController#update(Long, TradingClearingRegistryUpdateAction)}<br>
* Тест проверяет получение сущности {@link TradingClearingRegistryUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link TradingClearingRegistryUpdateAction}:<br>
* {@link TradingClearingRegistryUpdateAction#id} - generated<br>
* {@link TradingClearingRegistryUpdateAction#code} - ACTV<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = 0;
TradingClearingRegistryUpdateAction tradingClearingRegistryUpdateAction = getTradingClearingRegistryUpdateAction(
id, "ACTV"
);
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, tradingClearingRegistryUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE, tradingClearingRegistryUpdateAction);
}
/**
* {@link TradingClearingRegistryController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /trading-clearing-registries/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_BLOCK, deleteAction);
}
/**
* {@link TradingClearingRegistryController#getById(Long)} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_TradingClearingRegistry.<br>
* Входной запрос /trading-clearing-registries/{@link Long}: - 0L <br>
* Ответ BankAccountBackendGetById <br>
*/
@Test
void getById() throws Exception {
//ARRANGE
TradingClearingRegistry existTradingClearingRegistry = new TradingClearingRegistry();
existTradingClearingRegistry.setCompanyId(365L);
existTradingClearingRegistry.setCode("99999");
@ -137,25 +91,16 @@ class TradingClearingRegistryControllerTest extends AbstractControllerTest {
payload.setCreatedAt(existTradingClearingRegistry.getCreated());
payload.setUpdatedAt(existTradingClearingRegistry.getUpdated());
expected.setPayload(payload);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL + existTradingClearingRegistry.getId())
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
// ASSERT
.andExpect(status().isOk())
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));
}
/**
* {@link TradingClearingRegistryController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
* Входной запрос /trading-clearing-registries/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
TradingClearingRegistry existTradingClearingRegistry = new TradingClearingRegistry();
existTradingClearingRegistry.setCompanyId(365L);
existTradingClearingRegistry.setCode("99999");
@ -166,8 +111,6 @@ class TradingClearingRegistryControllerTest extends AbstractControllerTest {
existTradingClearingRegistry.setTradingClearingRegistryPurpose("848484848484");
existTradingClearingRegistry.setStatus("ACTV");
existTradingClearingRegistry.setId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_TradingClearingRegistry, existTradingClearingRegistry, REST_URL);
}

View file

@ -14,76 +14,43 @@ import java.time.LocalDate;
class ClearingCalendarControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/schedule/clearing-calendars/";
/**
* {@link ClearingCalendarController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /schedule/clearing-calendars/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
ClearingCalendar clearingCalendar = new ClearingCalendar();
clearingCalendar.setId(currentId.get());
clearingCalendar.setCompanyId(currentId.get());
clearingCalendar.setClearingDate(LocalDate.now());
clearingCalendar.setDayStatus("status");
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingCalendar, clearingCalendar, REST_URL);
}
/**
* {@link ClearingCalendarController#add(ClearingCalendarNewAction)} <br>
* Тест проверяет получение сущности {@link ClearingCalendarNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClearingCalendarNewAction}:<br>
*/
@Test
void add() throws Exception {
//ARRANGE
ClearingCalendarNewAction clearingCalendarNewAction = new ClearingCalendarNewAction();
clearingCalendarNewAction.setCompanyId(currentId.get());
clearingCalendarNewAction.setClearingDate(LocalDate.now());
clearingCalendarNewAction.setDayStatus("status");
//ACT and ASSERT
checkAddingByRestApi(REST_URL, clearingCalendarNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_NEW, clearingCalendarNewAction);
}
/**
* {@link ClearingCalendarController#update(Long, ClearingCalendarUpdateAction)} <br>
* Тест проверяет получение сущности {@link ClearingCalendarUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link ClearingCalendarUpdateAction}:<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
ClearingCalendarUpdateAction clearingCalendarUpdateAction = new ClearingCalendarUpdateAction();
clearingCalendarUpdateAction.setId(id);
clearingCalendarUpdateAction.setCompanyId(currentId.get());
clearingCalendarUpdateAction.setClearingDate(LocalDate.now());
clearingCalendarUpdateAction.setDayStatus("status");
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, clearingCalendarUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_UPDATE, clearingCalendarUpdateAction);
}
/**
* {@link ClearingCalendarController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /schedule/clearing-calendars/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_DELETE, deleteAction);
}

View file

@ -38,15 +38,8 @@ class LauncherControllerTest extends AbstractControllerTest {
private static final String START_OF_CLEARING = Task.startOfClearing.getKey();
private static final long ID = 0;
/**
* {@link LauncherController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_TaskRunner.<br>
* Входной запрос /task-runners/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Launcher taskRunner = new Launcher();
taskRunner.setTask("Task");
taskRunner.setSenderId(10210L);
@ -59,23 +52,16 @@ class LauncherControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));
}
/**
* {@link LauncherController#add(String)}<br>
* Тест проверяет получение сущности {@link LauncherController} по REST API и отправку в Apache Kafka.<br>
*/
@Test
void add() throws Exception {
//ARRANGE
TaskDictionary taskDictionary = new TaskDictionary();
taskDictionary.setCode(CODE);
taskDictionary.setId(ID);
@ -92,25 +78,17 @@ class LauncherControllerTest extends AbstractControllerTest {
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement()));
setUserNameInMockSecurityContextAndMapUser(CODE, ID);
//ACT
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL + CODE))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
// .andExpect(content().json(writeValue(expected)));
.andReturn();
.andReturn();
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
CUD_RESPONSE_MATCHER.assertMatch(cudResponseTest, expected);
checkSendedMessegeFromKafka(Consts.LAUNCHER_NEW, launcherCommand);
}
/**
* {@link LauncherController#add(String)}<br>
* Тест проверяет работу валидации {@link LauncherController}<br>
*/
@Test
void addWithException() throws Exception {
BasicSpcexResponse response = new BasicSpcexResponse();
@ -118,23 +96,16 @@ class LauncherControllerTest extends AbstractControllerTest {
EnumMessage message = ex.getError();
response.setCode(message.getSubject().getId());
response.setMessage(errorResolver.resolve(message));
//ACT
perform(MockMvcRequestBuilders.post(REST_URL + null)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isNotFound())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(response)));
}
/**
* {@link LauncherController#addSpecific}<br>
* Тест проверяет получение сущности {@link LauncherController} по REST API и отправку в Apache Kafka.<br>
*/
@Test
void addSpecific() throws Exception {
//ARRANGE
LauncherNew launcherCommand = new LauncherNew();
launcherCommand.setTask(START_OF_CLEARING);
launcherCommand.setUserId(ID);
@ -153,27 +124,19 @@ class LauncherControllerTest extends AbstractControllerTest {
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement()));
setUserNameInMockSecurityContextAndMapUser(START_OF_CLEARING, ID);
//ACT
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL + "specific")
.contentType(MediaType.APPLICATION_JSON)
.content(writeValue(launcherCommand)))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
// .andExpect(content().json(writeValue(expected)));
.andReturn();
.andReturn();
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
CUD_RESPONSE_MATCHER.assertMatch(cudResponseTest, expected);
checkSendedMessegeFromKafka(Consts.LAUNCHER_NEW, launcherCommand);
}
/**
* {@link LauncherController#addSpecific}<br>
* Тест проверяет работу валидации {@link LauncherController}<br>
*/
@Test
void addSpecificWithException() throws Exception {
LauncherNew launcherCommand = new LauncherNew();
@ -184,12 +147,10 @@ class LauncherControllerTest extends AbstractControllerTest {
EnumMessage message = ex.getError();
response.setCode(message.getSubject().getId());
response.setMessage(errorResolver.resolve(message));
//ACT
perform(MockMvcRequestBuilders.post(REST_URL + "specific")
.contentType(MediaType.APPLICATION_JSON)
.content(writeValue(launcherCommand)))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isNotFound())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(response)));
@ -199,8 +160,7 @@ class LauncherControllerTest extends AbstractControllerTest {
perform(MockMvcRequestBuilders.post(REST_URL + "specific")
.contentType(MediaType.APPLICATION_JSON)
.content(writeValue(launcherCommand)))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isNotFound())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(response)));

View file

@ -22,15 +22,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class PlannerAllTodayControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/schedule/planners-all-today/";
/**
* {@link PlannerAllTodayController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_SchedulerAllToday.<br>
* Входной запрос /schedule/schedulers-all-today/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
PlannerAllToday schedulerAllToday = new PlannerAllToday();
schedulerAllToday.setTask("Task");
schedulerAllToday.setTaskTime(LocalTime.now());
@ -49,11 +42,9 @@ class PlannerAllTodayControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));

View file

@ -22,15 +22,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
class PlannerControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/schedule/planners/";
/**
* {@link PlannerController#getAll()} <br>
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Scheduler.<br>
* Входной запрос /schedule/schedulers/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
Planner scheduler = new Planner();
scheduler.setTask("Task");
scheduler.setTaskTime(LocalTime.now());
@ -47,11 +40,9 @@ class PlannerControllerTest extends AbstractControllerTest {
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
CommonGetAllResponse expected = new CommonGetAllResponse();
expected.fromEntity(all);
//ACT
perform(MockMvcRequestBuilders.get(REST_URL)
.contentType(MediaType.APPLICATION_JSON))
.andDo(print())//output to the log request and response
//ASSERT
.andDo(print())
.andExpect(status().isOk())
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
.andExpect(content().json(writeValue(expected)));

View file

@ -14,15 +14,8 @@ import java.time.LocalTime;
class PlannerTemplateControllerTest extends AbstractControllerTest {
private static final String REST_URL = "/schedule/planner-templates/";
/**
* {@link PlannerTemplateController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /schedule/planner-templates/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
PlannerTemplate plannerTemplate = new PlannerTemplate();
plannerTemplate.setId(currentId.get());
plannerTemplate.setTask("task");
@ -30,39 +23,23 @@ class PlannerTemplateControllerTest extends AbstractControllerTest {
plannerTemplate.setTaskStatus("status");
plannerTemplate.setCompanyId(currentId.get());
plannerTemplate.setSecurityId(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_PlannerTemplate, plannerTemplate, REST_URL);
}
/**
* {@link PlannerTemplateController#add(PlannerTemplateNewAction)}<br>
* Тест проверяет получение сущности {@link PlannerTemplateNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link PlannerTemplateNewAction}:<br>
*/
@Test
void add() throws Exception {
//ARRANGE
PlannerTemplateNewAction plannerTemplateNewAction = new PlannerTemplateNewAction();
plannerTemplateNewAction.setTask("task");
plannerTemplateNewAction.setTaskTime(LocalTime.now().withNano(0));
plannerTemplateNewAction.setTaskStatus("status");
plannerTemplateNewAction.setCompanyId(currentId.get());
plannerTemplateNewAction.setSecurityId(currentId.get());
//ACT and ASSERT
checkAddingByRestApi(REST_URL, plannerTemplateNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_PLANNER_TEMPLATE_NEW, plannerTemplateNewAction);
}
/**
* {@link PlannerTemplateController#update(Long, PlannerTemplateUpdateAction)} <br>
* Тест проверяет получение сущности {@link PlannerTemplateUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link PlannerTemplateUpdateAction}:<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
PlannerTemplateUpdateAction plannerTemplateUpdateAction = new PlannerTemplateUpdateAction();
plannerTemplateUpdateAction.setId(id);
@ -71,25 +48,15 @@ class PlannerTemplateControllerTest extends AbstractControllerTest {
plannerTemplateUpdateAction.setTaskStatus("status");
plannerTemplateUpdateAction.setCompanyId(currentId.get());
plannerTemplateUpdateAction.setSecurityId(currentId.get());
//ACT and ASSERT
checkUpdatingByRestApi(REST_URL, plannerTemplateUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_PLANNER_TEMPLATE_UPDATE, plannerTemplateUpdateAction);
}
/**
* {@link PlannerTemplateController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /schedule/planner-templates/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
//ACT and ASSERT
checkDeletingByRestApi(REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_PLANNER_TEMPLATE_DELETE, deleteAction);
}

View file

@ -11,18 +11,9 @@ import java.time.LocalDate;
class CouponPeriodControllerTest extends AbstractControllerTest {
public static final String REST_URL = "/securities/coupon-periods/";
/**
* {@link CouponPeriodController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /securities/coupon-periods/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
CouponPeriod couponPeriod = getCouponPeriod(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CouponPeriod, couponPeriod, REST_URL);
}

View file

@ -15,14 +15,8 @@ import java.math.BigDecimal;
class EquitySecurityControllerTest extends AbstractControllerTest {
public static final String REST_URL = "/securities/equity-securities/";
/**
* {@link EquitySecurityController#add(EquitySecurityNewAction)} <br>
* Тест проверяет получение сущности {@link EquitySecurityNewAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link EquitySecurityNewAction}:<br>
*/
@Test
void add() throws Exception {
//ARRANGE
EquitySecurityNewAction equitySecurityNewAction = new EquitySecurityNewAction();
equitySecurityNewAction.setShareType("shType");
equitySecurityNewAction.setLotSize(BigDecimal.valueOf(120.33));
@ -32,20 +26,12 @@ class EquitySecurityControllerTest extends AbstractControllerTest {
equitySecurityNewAction.setInstrumentType("status T");
equitySecurityNewAction.setSecuritySymbol("symbol1");
equitySecurityNewAction.setLotSize(new BigDecimal("3.5"));
//ACT and ASSERT
checkAddingByRestApi(REST_URL, equitySecurityNewAction);
checkSendedMessegeFromKafka(Consts.DESTINATION_EQUITY_SECURITY_NEW, equitySecurityNewAction);
}
/**
* {@link EquitySecurityController#update(Long, EquitySecurityUpdateAction)} <br>
* Тест проверяет получение сущности {@link EquitySecurityUpdateAction} по REST API и отправку в Apache Kafka.<br>
* Входной запрос {@link EquitySecurityUpdateAction}:<br>
*/
@Test
void update() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
EquitySecurityUpdateAction equitySecurityUpdateAction = new EquitySecurityUpdateAction();
equitySecurityUpdateAction.setId(id);
@ -58,44 +44,25 @@ class EquitySecurityControllerTest extends AbstractControllerTest {
equitySecurityUpdateAction.setSecuritySymbol("symbol1");
equitySecurityUpdateAction.setLotSize(new BigDecimal("3.5"));
EquitySecurity equitySecurity = getEquitySecurity(id);
//ACT and ASSERT
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_EquitySecurity, equitySecurity,
REST_URL, equitySecurityUpdateAction, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_EQUITY_SECURITY_UPDATE, equitySecurityUpdateAction);
}
/**
* {@link EquitySecurityController#delete(Long)} <br>
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.<br>
* Входной запрос /securities/equity-securities/{@link Long}: - 0L<br>
*/
@Test
void delete() throws Exception {
//ARRANGE
long id = currentId.getAndIncrement();
CommonDeleteAction deleteAction = new CommonDeleteAction();
deleteAction.setId(id);
EquitySecurity equitySecurity = getEquitySecurity(id);
//ACT and ASSERT
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_MoneyMarketSecurity, equitySecurity,
REST_URL, id);
checkSendedMessegeFromKafka(Consts.DESTINATION_EQUITY_SECURITY_DELETE, deleteAction);
}
/**
* {@link EquitySecurityController#getAll()} <br>
* Тест проверяет получение запроса по REST API.<br>
* Входной запрос /securities/equity-securities/ <br>
* Ответ CommonGetAllResponse <br>
*/
@Test
void getAll() throws Exception {
//ARRANGE
EquitySecurity equitySecurity = getEquitySecurity(currentId.get());
//ACT and ASSERT
checkGettingAllFromRestApi(IMDGDistributedNames.Map_EquitySecurity, equitySecurity, REST_URL);
}

Some files were not shown because too many files have changed in this diff Show more