Compare commits
1 commit
10_01_2024
...
dev_releas
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
247c02c569 |
732 changed files with 623 additions and 8784 deletions
|
|
@ -55,7 +55,6 @@ public class AccountValidationConfig {
|
||||||
Company.class,
|
Company.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.CompanyNotFound
|
AccountError.CompanyNotFound
|
||||||
// company -> WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? null : AccountError.CompanyNotActive
|
|
||||||
),
|
),
|
||||||
FieldRequiredSpecificRule.instance("account",
|
FieldRequiredSpecificRule.instance("account",
|
||||||
CorrespondentAccountNewRequest::getAccount,
|
CorrespondentAccountNewRequest::getAccount,
|
||||||
|
|
@ -85,10 +84,6 @@ public class AccountValidationConfig {
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.DictionaryNotFound,
|
AccountError.DictionaryNotFound,
|
||||||
false
|
false
|
||||||
// , statusValue -> {
|
|
||||||
// if (ServiceStatus.Active.equalsByKey(statusValue.getCode())) return null;
|
|
||||||
// return AccountError.WrongFieldValue;
|
|
||||||
// }
|
|
||||||
),
|
),
|
||||||
DictionaryPresentRule.instance("accountType",
|
DictionaryPresentRule.instance("accountType",
|
||||||
CorrespondentAccountNewRequest::getAccountType,
|
CorrespondentAccountNewRequest::getAccountType,
|
||||||
|
|
@ -156,10 +151,6 @@ public class AccountValidationConfig {
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.DictionaryNotFound,
|
AccountError.DictionaryNotFound,
|
||||||
false
|
false
|
||||||
// accountType -> {
|
|
||||||
// if (AccountType.Corr.equalsByKey(accountType.getCode())) return null;
|
|
||||||
// return AccountError.WrongFieldValue;
|
|
||||||
// }
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,6 @@ import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.specific.FieldRequiredSpecificRule;
|
|
||||||
import ru.spcex.clearing.validation.common.rules.specific.IdPresentSpecificRule;
|
import ru.spcex.clearing.validation.common.rules.specific.IdPresentSpecificRule;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
import ru.spcex.platform.enumeration.AccountStatus;
|
import ru.spcex.platform.enumeration.AccountStatus;
|
||||||
|
|
@ -27,7 +26,6 @@ import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||||
import ru.spcex.platform.utils.validation.IValidator;
|
import ru.spcex.platform.utils.validation.IValidator;
|
||||||
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
@ -110,7 +108,6 @@ public class BankAccountValidationConfig {
|
||||||
);
|
);
|
||||||
Account account = accountImdg.getSingleObjectByID(accountId);
|
Account account = accountImdg.getSingleObjectByID(accountId);
|
||||||
if (account == null) return AccountError.AccountNotFound;
|
if (account == null) return AccountError.AccountNotFound;
|
||||||
// if (!AccountStatus.ACTIVE.equalsByKey(account.getStatus())) return AccountError.AccountNotActive;
|
|
||||||
return null;
|
return null;
|
||||||
}),
|
}),
|
||||||
DictionaryPresentRule.instance("currency",
|
DictionaryPresentRule.instance("currency",
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.specific.FieldRequiredSpecificRule;
|
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
import ru.spcex.platform.enumeration.AccountType;
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
import ru.spcex.platform.enumeration.ServiceStatus;
|
import ru.spcex.platform.enumeration.ServiceStatus;
|
||||||
|
|
@ -53,7 +52,6 @@ public class ClearingAccountValidationConfig {
|
||||||
Company.class,
|
Company.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.CompanyNotFound
|
AccountError.CompanyNotFound
|
||||||
// company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null
|
|
||||||
),
|
),
|
||||||
FieldNotBlankRequiredRule.instance("account",
|
FieldNotBlankRequiredRule.instance("account",
|
||||||
ClearingAccountNewRequest::getAccount,
|
ClearingAccountNewRequest::getAccount,
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,6 @@ public class ClientCodeValidationConfig {
|
||||||
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
Consumer<String> addImdg = (s) -> context.addImdg(s, imdgForValidation.get(s));
|
||||||
addImdg.accept(IMDGDistributedNames.Map_ClientCode);
|
addImdg.accept(IMDGDistributedNames.Map_ClientCode);
|
||||||
return new ValidatorImpl<>(context,
|
return new ValidatorImpl<>(context,
|
||||||
// FieldRequiredRule.instance("id", CommonDeleteRequest::getId, CompanyErrors.RequiredFieldEmpty),
|
|
||||||
IdPresentRule.instance("id",
|
IdPresentRule.instance("id",
|
||||||
CommonDeleteRequest::getId,
|
CommonDeleteRequest::getId,
|
||||||
IMDGDistributedNames.Map_ClientCode,
|
IMDGDistributedNames.Map_ClientCode,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ package ru.spcex.clearing.account.config.validation;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import ru.clearing.classes.statics.data.account.Account;
|
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
|
import ru.clearing.platform.dictionary.ServiceStatusDictionary;
|
||||||
import ru.spcex.clearing.account.errors.AccountError;
|
import ru.spcex.clearing.account.errors.AccountError;
|
||||||
|
|
@ -12,7 +11,6 @@ import ru.spcex.clearing.validation.common.rules.DictionaryPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
import ru.spcex.clearing.validation.common.rules.FieldNotBlankRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
import ru.spcex.clearing.validation.common.rules.FieldRequiredRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
import ru.spcex.clearing.validation.common.rules.IdPresentRule;
|
||||||
import ru.spcex.clearing.validation.common.rules.specific.FieldRequiredSpecificRule;
|
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
||||||
import ru.spcex.platform.enumeration.AccountType;
|
import ru.spcex.platform.enumeration.AccountType;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
|
@ -20,7 +18,6 @@ import ru.spcex.platform.imdg.validation.ImdgValidationContext;
|
||||||
import ru.spcex.platform.utils.validation.IValidator;
|
import ru.spcex.platform.utils.validation.IValidator;
|
||||||
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
import ru.spcex.platform.utils.validation.ValidatorImpl;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
@ -47,7 +44,6 @@ public class DepoAccountValidationConfig {
|
||||||
Company.class,
|
Company.class,
|
||||||
AccountError.RequiredFieldEmpty,
|
AccountError.RequiredFieldEmpty,
|
||||||
AccountError.CompanyNotFound
|
AccountError.CompanyNotFound
|
||||||
// company -> !WorkflowStatus.Active.equalsByKey(company.getWorkflowStatus()) ? AccountError.CompanyNotActive : null
|
|
||||||
),
|
),
|
||||||
FieldNotBlankRequiredRule.instance("account",
|
FieldNotBlankRequiredRule.instance("account",
|
||||||
DepoAccountNewRequest::getAccount,
|
DepoAccountNewRequest::getAccount,
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class SameAccountValidationRule<R> implements IValidationRule<ImdgValidationCont
|
||||||
final Function<R, String> accountGetter;
|
final Function<R, String> accountGetter;
|
||||||
|
|
||||||
public SameAccountValidationRule(AccountType accountType, Function<R, String> accountGetter) {
|
public SameAccountValidationRule(AccountType accountType, Function<R, String> accountGetter) {
|
||||||
this.accountType = accountType.getKey(); // or req.getAccountType()
|
this.accountType = accountType.getKey();
|
||||||
this.accountGetter = accountGetter;
|
this.accountGetter = accountGetter;
|
||||||
Objects.requireNonNull(accountGetter);
|
Objects.requireNonNull(accountGetter);
|
||||||
}
|
}
|
||||||
|
|
@ -32,8 +32,7 @@ class SameAccountValidationRule<R> implements IValidationRule<ImdgValidationCont
|
||||||
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
Imdg<Account> accountImdg = context.obtainMap(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
ImdgPredicate query = pb.and(
|
ImdgPredicate query = pb.and(
|
||||||
pb.equals("account", accountGetter.apply(req)), // req.getAccount()
|
pb.equals("account", accountGetter.apply(req)),
|
||||||
// pb.equals("accountType", accountType), имена всех счетов уникальны, вне зависимости от типа
|
|
||||||
pb.in("status", ServiceStatus.Active.getKey(), ServiceStatus.Reopened.getKey(), ServiceStatus.Appl.getKey())
|
pb.in("status", ServiceStatus.Active.getKey(), ServiceStatus.Reopened.getKey(), ServiceStatus.Appl.getKey())
|
||||||
);
|
);
|
||||||
Account existAccount = accountImdg.getFirstObjectByPredicate(query);
|
Account existAccount = accountImdg.getFirstObjectByPredicate(query);
|
||||||
|
|
|
||||||
|
|
@ -84,26 +84,10 @@ public class TradingClearingRegistryValidationConfig {
|
||||||
return AccountError.AccountNotFound;
|
return AccountError.AccountNotFound;
|
||||||
} else {
|
} else {
|
||||||
if (AccountType.Clrn.equalsByKey(account.getAccountType()) || AccountType.Info.equalsByKey(account.getAccountType())) {
|
if (AccountType.Clrn.equalsByKey(account.getAccountType()) || AccountType.Info.equalsByKey(account.getAccountType())) {
|
||||||
// ok
|
|
||||||
} else {
|
} else {
|
||||||
// неправильный тип
|
|
||||||
return AccountError.AccountNotFound;
|
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;
|
return null;
|
||||||
}),
|
}),
|
||||||
FieldRequiredRule.instance("depoAccountId",
|
FieldRequiredRule.instance("depoAccountId",
|
||||||
|
|
@ -140,11 +124,6 @@ public class TradingClearingRegistryValidationConfig {
|
||||||
if (validatedObject.getMoneyAccountId() == null) {
|
if (validatedObject.getMoneyAccountId() == null) {
|
||||||
return of(AccountError.RequiredFieldEmpty, "MoneyAccountId");
|
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();
|
ImdgPredicateBuilder pb = tcrMap.predicateBuilder();
|
||||||
ImdgPredicate query = pb.equals("moneyAccountId", validatedObject.getMoneyAccountId());
|
ImdgPredicate query = pb.equals("moneyAccountId", validatedObject.getMoneyAccountId());
|
||||||
if (validatedObject.getDepoAccountId() != null) {
|
if (validatedObject.getDepoAccountId() != null) {
|
||||||
|
|
@ -160,8 +139,6 @@ public class TradingClearingRegistryValidationConfig {
|
||||||
Account account = accountImdg.getSingleObjectByID(validatedObject.getMoneyAccountId());
|
Account account = accountImdg.getSingleObjectByID(validatedObject.getMoneyAccountId());
|
||||||
if (account == null && validatedObject.getDepoAccountId() != null) account = accountImdg.getSingleObjectByID(validatedObject.getDepoAccountId());
|
if (account == null && validatedObject.getDepoAccountId() != null) account = accountImdg.getSingleObjectByID(validatedObject.getDepoAccountId());
|
||||||
return of(AccountError.AccountForTradingClearingRegistryAlreadyUsed, account.getAccount());
|
return of(AccountError.AccountForTradingClearingRegistryAlreadyUsed, account.getAccount());
|
||||||
// String tcrIds = existTCR.stream().map(tcr -> String.valueOf(tcr.getId())).collect(Collectors.joining(";"));
|
|
||||||
// return of(AccountError.AccountForTradingClearingRegistryAlreadyUsed, tcrIds);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.Company;
|
||||||
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
import ru.clearing.classes.statics.data.company.CompanySymbols;
|
||||||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
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.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.validation.common.ValidationHelper;
|
import ru.spcex.clearing.validation.common.ValidationHelper;
|
||||||
import ru.spcex.platform.classes.base.SpcexObjectBase;
|
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_DepoAccount, DepoAccount.class);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class);
|
addImdg.accept(IMDGDistributedNames.Map_ServiceStatusDictionary, ServiceStatusDictionary.class);
|
||||||
addImdg.accept(IMDGDistributedNames.Map_TradingClearingRegistry, TradingClearingRegistry.class);
|
addImdg.accept(IMDGDistributedNames.Map_TradingClearingRegistry, TradingClearingRegistry.class);
|
||||||
|
|
||||||
//for ClientCodeValidationConfig
|
|
||||||
addImdg.accept(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
|
addImdg.accept(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
|
||||||
|
|
||||||
return imdg;
|
return imdg;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ public enum AccountError implements IErrorEnumId {
|
||||||
DepoAccountNotFound(5017L),
|
DepoAccountNotFound(5017L),
|
||||||
MoneyAccountNotFound(5018L),
|
MoneyAccountNotFound(5018L),
|
||||||
ClearingCategoryNotFound(5019L),
|
ClearingCategoryNotFound(5019L),
|
||||||
ClearingCompanySymbolNotFound(5022L), // Для компании %s отсутствует клиринговый код».
|
ClearingCompanySymbolNotFound(5022L),
|
||||||
AccountForTradingClearingRegistryAlreadyUsed(5023L),
|
AccountForTradingClearingRegistryAlreadyUsed(5023L),
|
||||||
AccountFieldNotSet(5024L),
|
AccountFieldNotSet(5024L),
|
||||||
TradingClearingRegistryNotFound(3022L),
|
TradingClearingRegistryNotFound(3022L),
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ package ru.spcex.clearing.account.service;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.clearing.classes.statics.data.account.Account;
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
import ru.clearing.classes.statics.data.company.ClearingMemberCategory;
|
||||||
|
|
@ -12,7 +11,7 @@ import ru.spcex.clearing.account.errors.AccountError;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||||
import ru.spcex.clearing.platform.messaging.service.Status;
|
import ru.spcex.clearing.platform.messaging.service.Status;
|
||||||
import ru.spcex.platform.enumeration.*;
|
import ru.spcex.platform.enumeration.ClearingCategory;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
||||||
|
|
@ -42,11 +41,6 @@ public class AccountHelper {
|
||||||
this.messageResolver = messageResolver;
|
this.messageResolver = messageResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Заполняет поля relationId и companyId из соответствующей записи Relation
|
|
||||||
*
|
|
||||||
* @param requestId Идентификатор запроса для вывода лога
|
|
||||||
*/
|
|
||||||
public RequestInfoUpdate fillAccountFromRelation(Account account, Long requestId, boolean checkClearingMemberCategory) {
|
public RequestInfoUpdate fillAccountFromRelation(Account account, Long requestId, boolean checkClearingMemberCategory) {
|
||||||
Long companyId = account.getCompanyId();
|
Long companyId = account.getCompanyId();
|
||||||
Collection<Relation> relations;
|
Collection<Relation> relations;
|
||||||
|
|
@ -73,7 +67,6 @@ public class AccountHelper {
|
||||||
} else {
|
} else {
|
||||||
log.info("ClearingCategoryNotFound with clearingCategoryValue={} not implemented. Do not search Relation.", clearingCategoryValue);
|
log.info("ClearingCategoryNotFound with clearingCategoryValue={} not implemented. Do not search Relation.", clearingCategoryValue);
|
||||||
return null;
|
return null;
|
||||||
//return makeError(requestId, AccountError.ClearingCategoryNotFound, companyId, clearingCategoryValue + " (case not implemented)");
|
|
||||||
}
|
}
|
||||||
finalRelationPredicate = relationPredicateBuilder.and(consumerIdPredicate, servicePredicate);
|
finalRelationPredicate = relationPredicateBuilder.and(consumerIdPredicate, servicePredicate);
|
||||||
relations = relationMap.getCollectionObjectsByPredicate(finalRelationPredicate);
|
relations = relationMap.getCollectionObjectsByPredicate(finalRelationPredicate);
|
||||||
|
|
@ -83,7 +76,6 @@ public class AccountHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relations.isEmpty()) {
|
if (relations.isEmpty()) {
|
||||||
//return makeError(requestId, AccountError.WrongFieldValue, "companyId", finalRelationPredicate.toString());
|
|
||||||
log.info("Relation not found: {}", finalRelationPredicate.toString());
|
log.info("Relation not found: {}", finalRelationPredicate.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,10 +32,7 @@ import ru.spcex.platform.enumeration.*;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicate;
|
|
||||||
import ru.spcex.platform.imdg.api.predicate.ImdgPredicateBuilder;
|
|
||||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||||
import ru.spcex.platform.utils.enumeration.IEnumKey;
|
|
||||||
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
import ru.spcex.platform.utils.enumeration.IMessageResolver;
|
||||||
import ru.spcex.platform.utils.validation.IValidator;
|
import ru.spcex.platform.utils.validation.IValidator;
|
||||||
|
|
||||||
|
|
@ -155,10 +152,8 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
|
|
||||||
Long newId = null;
|
Long newId = null;
|
||||||
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
||||||
// default, дополнительные таблицы не требуются
|
|
||||||
newId = accountMap.insert(account);
|
newId = accountMap.insert(account);
|
||||||
} else {
|
} else {
|
||||||
// Транзакцией
|
|
||||||
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
ImdgTransaction imdgTransaction = imdgProvider.newTransaction();
|
||||||
imdgTransaction.beginTransaction();
|
imdgTransaction.beginTransaction();
|
||||||
boolean txOk = false;
|
boolean txOk = false;
|
||||||
|
|
@ -167,7 +162,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
newId = accountMap.insert(account);
|
newId = accountMap.insert(account);
|
||||||
|
|
||||||
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
if (AccountType.Corr.equalsByKey(account.getAccountType())) {
|
||||||
// default, дополнительные таблицы не требуются
|
|
||||||
} else if (AccountType.Info.equalsByKey(account.getAccountType()))
|
} else if (AccountType.Info.equalsByKey(account.getAccountType()))
|
||||||
makeInfoPart(imdgTransaction, account);
|
makeInfoPart(imdgTransaction, account);
|
||||||
else if (AccountType.Depo.equalsByKey(account.getAccountType()))
|
else if (AccountType.Depo.equalsByKey(account.getAccountType()))
|
||||||
|
|
@ -218,7 +212,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
if (account.getAccount() != null && account.getAccount().contains("BC")) {
|
if (account.getAccount() != null && account.getAccount().contains("BC")) {
|
||||||
depoAcc.setDepoAccountType(DepoAccountType.C.getKey());
|
depoAcc.setDepoAccountType(DepoAccountType.C.getKey());
|
||||||
} else {
|
} else {
|
||||||
//todo в реквесте нет поля depoAcc.setDepoAccountType(req.getDepoAccountType());
|
|
||||||
}
|
}
|
||||||
Long depoId = depoAccountMap.insert(depoAcc);
|
Long depoId = depoAccountMap.insert(depoAcc);
|
||||||
log.debug("For account id={} make DepoAccount id={}", account.getId(), depoId);
|
log.debug("For account id={} make DepoAccount id={}", account.getId(), depoId);
|
||||||
|
|
@ -286,7 +279,7 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
log.debug("AccountTerminationRequest received, id={}", userRequest.getId());
|
log.debug("AccountTerminationRequest received, id={}", userRequest.getId());
|
||||||
|
|
||||||
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
RequestInfoUpdate requestInfoUpdate = userRoleVerification.validateRoleAndGetResult(userRequest);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate; // never - system
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
AccountTerminationRequest req = userRequest.getRequestPayload();
|
AccountTerminationRequest req = userRequest.getRequestPayload();
|
||||||
final Long companyId = req.getCompanyId();
|
final Long companyId = req.getCompanyId();
|
||||||
|
|
@ -298,7 +291,6 @@ public class AccountService extends QueueConsumer implements InitializingBean {
|
||||||
try {
|
try {
|
||||||
tx.beginTransaction();
|
tx.beginTransaction();
|
||||||
for (Account account : accounts) {
|
for (Account account : accounts) {
|
||||||
//Account account = accountMap.getSingleObjectByID(request.getId());
|
|
||||||
if (!ServiceStatus.Blocked.equalsByKey(account.getStatus())) {
|
if (!ServiceStatus.Blocked.equalsByKey(account.getStatus())) {
|
||||||
account.setStatus(ServiceStatus.Blocked.getKey());
|
account.setStatus(ServiceStatus.Blocked.getKey());
|
||||||
account.setUpdated(Instant.now());
|
account.setUpdated(Instant.now());
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,6 @@ public class BankAccountService extends QueueConsumer implements InitializingBea
|
||||||
account.setUpdated(Instant.now());
|
account.setUpdated(Instant.now());
|
||||||
|
|
||||||
accountMap.update(account);
|
accountMap.update(account);
|
||||||
//без изменений bankAccountMap.update(bankAccount);
|
|
||||||
|
|
||||||
log.debug("successfully block, existing bankAccount with id {}", bankAccount.getId());
|
log.debug("successfully block, existing bankAccount with id {}", bankAccount.getId());
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -260,11 +260,11 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
account.setUpdated(now);
|
account.setUpdated(now);
|
||||||
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
|
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
|
||||||
if (requestInfoUpdate != null) {
|
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();
|
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
|
||||||
responsePart.setSdfId(accountReq.getSdfId());
|
responsePart.setSdfId(accountReq.getSdfId());
|
||||||
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId()); // see accountService.fillAccountFromRelation
|
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId());
|
||||||
responsePart.setErrorText(requestInfoUpdate.getMessage());
|
responsePart.setErrorText(requestInfoUpdate.getMessage());
|
||||||
accountToStatement.add(responsePart);
|
accountToStatement.add(responsePart);
|
||||||
continue accountsLoop;
|
continue accountsLoop;
|
||||||
|
|
@ -338,7 +338,7 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
|
|
||||||
List<Pair<SDf52, Account>> toUpdate = new ArrayList<>();
|
List<Pair<SDf52, Account>> toUpdate = new ArrayList<>();
|
||||||
List<Triple<SDf52, Account, String>> toProcessSDF53 = new ArrayList<>();
|
List<Triple<SDf52, Account, String>> toProcessSDF53 = new ArrayList<>();
|
||||||
{ // 1. Выборка данных
|
{
|
||||||
for (SDf52 sDf52 : sdfs) {
|
for (SDf52 sDf52 : sdfs) {
|
||||||
if (sdfProcessService.parseSdf52Status(sDf52.getStatus()) == null) {
|
if (sdfProcessService.parseSdf52Status(sDf52.getStatus()) == null) {
|
||||||
String msg = messageResolver.resolve(new EnumMessage(AccountError.WrongFieldValue, "status"));
|
String msg = messageResolver.resolve(new EnumMessage(AccountError.WrongFieldValue, "status"));
|
||||||
|
|
@ -373,26 +373,23 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.debug("Selected to update {} account's", toUpdate.size());
|
log.debug("Selected to update {} account's", toUpdate.size());
|
||||||
|
|
||||||
// 4. to notification
|
|
||||||
List<Long> notificationAccountIds = new ArrayList<>();
|
List<Long> notificationAccountIds = new ArrayList<>();
|
||||||
for (Pair<SDf52, Account> item : toUpdate) {
|
for (Pair<SDf52, Account> item : toUpdate) {
|
||||||
SDf52 sdf = item.getFirst();
|
SDf52 sdf = item.getFirst();
|
||||||
Account account = item.getSecond();
|
Account account = item.getSecond();
|
||||||
AccountStatus newStatus = sdfProcessService.parseSdf52Status(sdf.getStatus());
|
AccountStatus newStatus = sdfProcessService.parseSdf52Status(sdf.getStatus());
|
||||||
if (newStatus == null) { // never
|
if (newStatus == null) {
|
||||||
throw new IllegalArgumentException("Can not parse sdf status " + sdf.getStatus());
|
throw new IllegalArgumentException("Can not parse sdf status " + sdf.getStatus());
|
||||||
}
|
}
|
||||||
if (newStatus.equalsByKey(account.getStatus())) {
|
if (newStatus.equalsByKey(account.getStatus())) {
|
||||||
// одинаковых обычно не бывает.
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (AccountStatus.BLOCKED == newStatus || AccountStatus.CLOSE == newStatus) { // статус 0/2
|
if (AccountStatus.BLOCKED == newStatus || AccountStatus.CLOSE == newStatus) {
|
||||||
sendNotificationRequest(ObjectType.account_block, account, newStatus);
|
sendNotificationRequest(ObjectType.account_block, account, newStatus);
|
||||||
notificationAccountIds.add(account.getId());
|
notificationAccountIds.add(account.getId());
|
||||||
putNotificationWaiting(systemRequest, item.getFirst(), item.getSecond());
|
putNotificationWaiting(systemRequest, item.getFirst(), item.getSecond());
|
||||||
}
|
}
|
||||||
if (AccountStatus.ACTIVE == newStatus) { // статус 1/3
|
if (AccountStatus.ACTIVE == newStatus) {
|
||||||
sendNotificationRequest(ObjectType.account_active, account, newStatus);
|
sendNotificationRequest(ObjectType.account_active, account, newStatus);
|
||||||
notificationAccountIds.add(account.getId());
|
notificationAccountIds.add(account.getId());
|
||||||
putNotificationWaiting(systemRequest, item.getFirst(), item.getSecond());
|
putNotificationWaiting(systemRequest, item.getFirst(), item.getSecond());
|
||||||
|
|
@ -431,32 +428,26 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
protected RequestInfoUpdate accountUpdateSdf52_part2(BaseRequest<StatementRequest> systemRequest1,
|
protected RequestInfoUpdate accountUpdateSdf52_part2(BaseRequest<StatementRequest> systemRequest1,
|
||||||
SDf52 sdf, Account account,
|
SDf52 sdf, Account account,
|
||||||
BaseRequest<NotificationFeedbackRequest> secondSystemRequest2) {
|
BaseRequest<NotificationFeedbackRequest> secondSystemRequest2) {
|
||||||
// 5. from notification:
|
|
||||||
StatementRequest req = systemRequest1.getRequestPayload();
|
StatementRequest req = systemRequest1.getRequestPayload();
|
||||||
Long groupId = req.getGroupId();
|
Long groupId = req.getGroupId();
|
||||||
log.info("Continue Sdf52 groupId={}, first request id={}, second request id={}",
|
log.info("Continue Sdf52 groupId={}, first request id={}, second request id={}",
|
||||||
groupId, systemRequest1 == null ? null : systemRequest1.getId(), secondSystemRequest2 == null ? null : secondSystemRequest2.getId());
|
groupId, systemRequest1 == null ? null : systemRequest1.getId(), secondSystemRequest2 == null ? null : secondSystemRequest2.getId());
|
||||||
|
|
||||||
int countOfUpdated = 0;
|
int countOfUpdated = 0;
|
||||||
|
|
||||||
// 2. обновление данных
|
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
AccountStatus newStatus = sdfProcessService.parseSdf52Status(sdf.getStatus());
|
AccountStatus newStatus = sdfProcessService.parseSdf52Status(sdf.getStatus());
|
||||||
if (newStatus == null) {
|
if (newStatus == null) {
|
||||||
throw new IllegalArgumentException("Can not parse sdf status " + sdf.getStatus());
|
throw new IllegalArgumentException("Can not parse sdf status " + sdf.getStatus());
|
||||||
}
|
}
|
||||||
// За долгое время ожидания пользователя счёт мог быть обновлён, прочитать его ещё раз
|
|
||||||
account = accountImdg.getSingleObjectByID(account.getId());
|
account = accountImdg.getSingleObjectByID(account.getId());
|
||||||
if (!newStatus.equalsByKey(account.getStatus())) {
|
if (!newStatus.equalsByKey(account.getStatus())) {
|
||||||
// Обновление счёта
|
|
||||||
String oldStatus = account.getStatus();
|
String oldStatus = account.getStatus();
|
||||||
account.setStatus(newStatus.getKey());
|
account.setStatus(newStatus.getKey());
|
||||||
account.setUpdated(now);
|
account.setUpdated(now);
|
||||||
accountImdg.update(account);
|
accountImdg.update(account);
|
||||||
log.trace("S_DF52[{}] do update status to {} for account[{}]",
|
log.trace("S_DF52[{}] do update status to {} for account[{}]",
|
||||||
sdf.getId(), newStatus.getKey(), account.getId());
|
sdf.getId(), newStatus.getKey(), account.getId());
|
||||||
if (AccountStatus.ACTIVE.equalsByKey(oldStatus) && AccountStatus.ACTIVE != newStatus) { // счёт заблокировали - значит блокируем ТКР, наоборот не надо.
|
if (AccountStatus.ACTIVE.equalsByKey(oldStatus) && AccountStatus.ACTIVE != newStatus) {
|
||||||
// Отправка в ТКР
|
|
||||||
TradingClearingRegistryUpdateRequest tcrReq = new TradingClearingRegistryUpdateRequest();
|
TradingClearingRegistryUpdateRequest tcrReq = new TradingClearingRegistryUpdateRequest();
|
||||||
tcrReq.setMoneyAccountId(account.getId());
|
tcrReq.setMoneyAccountId(account.getId());
|
||||||
tcrReq.setCompanyId(account.getCompanyId());
|
tcrReq.setCompanyId(account.getCompanyId());
|
||||||
|
|
@ -500,7 +491,7 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
request.setChildGenerationId(groupSdf02Id);
|
request.setChildGenerationId(groupSdf02Id);
|
||||||
request.setAccountCreationResults(results);
|
request.setAccountCreationResults(results);
|
||||||
request.setContinueSdf(true);
|
request.setContinueSdf(true);
|
||||||
request.setTable(SdfTable.SDF_01); // по нему запрос получили
|
request.setTable(SdfTable.SDF_01);
|
||||||
log.debug("Send message to kafka \"{}\": {}", destination, LogFormatter.toStringWrapper(request));
|
log.debug("Send message to kafka \"{}\": {}", destination, LogFormatter.toStringWrapper(request));
|
||||||
kafkaSender.sendRequestToQueue(destination, request);
|
kafkaSender.sendRequestToQueue(destination, request);
|
||||||
}
|
}
|
||||||
|
|
@ -524,7 +515,6 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --------- notification apply system -----------
|
|
||||||
public static class SDF52WaitingData {
|
public static class SDF52WaitingData {
|
||||||
public BaseRequest<StatementRequest> systemRequest;
|
public BaseRequest<StatementRequest> systemRequest;
|
||||||
public SDf52 sdf;
|
public SDf52 sdf;
|
||||||
|
|
@ -558,9 +548,6 @@ public class ClearingAccountService extends QueueConsumer implements Initializin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return triggered SDF52WaitingData or null
|
|
||||||
*/
|
|
||||||
public SDF52WaitingData onNotificationResponse(NotificationFeedbackRequest onNotification) {
|
public SDF52WaitingData onNotificationResponse(NotificationFeedbackRequest onNotification) {
|
||||||
if (onNotification.getNotificationId() == null) {
|
if (onNotification.getNotificationId() == null) {
|
||||||
log.trace("notificationId was empty");
|
log.trace("notificationId was empty");
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
RequestInfoUpdate crossValidate(BaseRequest<?> userRequest, Long moneyAccountId, Long depoAccountId, Long companyId) {
|
||||||
if (moneyAccountId == null) { // Если не заполнены moneyAccountId ИЛИ moneyAccountId и depoAccountId
|
if (moneyAccountId == null) {
|
||||||
EnumMessage error = null;
|
EnumMessage error = null;
|
||||||
if (companyId == null) {
|
if (companyId == null) {
|
||||||
error = new EnumMessage(AccountError.RequiredFieldEmpty, "companyId");
|
error = new EnumMessage(AccountError.RequiredFieldEmpty, "companyId");
|
||||||
|
|
@ -153,7 +143,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
ClientCodeNewRequest req = userRequest.getRequestPayload();
|
ClientCodeNewRequest req = userRequest.getRequestPayload();
|
||||||
// дополнительная проверка
|
|
||||||
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
|
|
@ -190,7 +179,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
||||||
|
|
||||||
|
|
||||||
ClientCodeNewRequest req = userRequest.getRequestPayload();
|
ClientCodeNewRequest req = userRequest.getRequestPayload();
|
||||||
// дополнительная проверка
|
|
||||||
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
|
|
||||||
|
|
@ -224,7 +212,6 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
||||||
|
|
||||||
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, clientCodeUpdateRequestValidator);
|
requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, clientCodeUpdateRequestValidator);
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
if (requestInfoUpdate != null) return requestInfoUpdate;
|
||||||
// дополнительная проверка
|
|
||||||
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
requestInfoUpdate = crossValidate(userRequest, req.getMoneyAccountId(), req.getDepoAccountId(), req.getCompanyId());
|
||||||
if (requestInfoUpdate != null) return requestInfoUpdate;
|
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) {
|
private boolean checkNeedCreateTCR(Long companyId, Long moneyAccountId, Long depoAccountId) {
|
||||||
// moneyAccountId обязателен, depoAccountId опционален
|
|
||||||
if (moneyAccountId == null) {
|
if (moneyAccountId == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -321,11 +307,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
||||||
requestPayload.setCompanyId(companyId);
|
requestPayload.setCompanyId(companyId);
|
||||||
requestPayload.setMoneyAccountId(moneyAccountId);
|
requestPayload.setMoneyAccountId(moneyAccountId);
|
||||||
requestPayload.setDepoAccountId(depoAccountId);
|
requestPayload.setDepoAccountId(depoAccountId);
|
||||||
// requestPayload.setStatus(WorkflowStatus.Active.getKey());
|
|
||||||
requestPayload.setTradingClearingRegistryType(TradingClearingRegistryType.Client_B.getKey());
|
requestPayload.setTradingClearingRegistryType(TradingClearingRegistryType.Client_B.getKey());
|
||||||
request.setRequestPayload(requestPayload);
|
request.setRequestPayload(requestPayload);
|
||||||
|
|
||||||
// Следующий вызываемый метод обязательно должен быть synchronized.
|
|
||||||
RequestInfoUpdate reply = tradingClearingRegistryService.tradingClearingRegistryNew(request);
|
RequestInfoUpdate reply = tradingClearingRegistryService.tradingClearingRegistryNew(request);
|
||||||
if (reply != null && Status.Error.equals(reply.getStatus())) {
|
if (reply != null && Status.Error.equals(reply.getStatus())) {
|
||||||
log.warn("tradingClearingRegistryService return error: " + reply.getMessage());
|
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) {
|
private Long sendMessage(String queue, BaseRequest<?> message) {
|
||||||
Long sentRequestId = message.getId();
|
Long sentRequestId = message.getId();
|
||||||
if (sentRequestId == null) {
|
if (sentRequestId == null) {
|
||||||
|
|
@ -383,13 +361,8 @@ public class ClientCodeService extends QueueConsumer implements InitializingBean
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param req требуется заполнить tradingClearingRegistryId по tradingClearingRegistry.code
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private ClientCode buildClientCode(ClientCodeNewRequest req) {
|
private ClientCode buildClientCode(ClientCodeNewRequest req) {
|
||||||
ClientCode clientCode = new ClientCode();
|
ClientCode clientCode = new ClientCode();
|
||||||
// clientCode.setId(idSequence.newId()); add in insert
|
|
||||||
clientCode.setCreated(Instant.now());
|
clientCode.setCreated(Instant.now());
|
||||||
clientCode.setUpdated(clientCode.getCreated());
|
clientCode.setUpdated(clientCode.getCreated());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -147,8 +147,6 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
|
||||||
accountsLoop:
|
accountsLoop:
|
||||||
for (AccountSdfRequestPart accountReq : req.getAccounts()) {
|
for (AccountSdfRequestPart accountReq : req.getAccounts()) {
|
||||||
|
|
||||||
// DepoAccountNewRequest req = userRequest.getRequestPayload();
|
|
||||||
|
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
account.setAccount(accountReq.getAccount());
|
account.setAccount(accountReq.getAccount());
|
||||||
|
|
@ -159,11 +157,11 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
|
||||||
account.setUpdated(now);
|
account.setUpdated(now);
|
||||||
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
|
RequestInfoUpdate requestInfoUpdate = accountService.fillAccountFromRelation(account, userRequest.getId(), true);
|
||||||
if (requestInfoUpdate != null) {
|
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();
|
AccountSdfToStatementRequestPart responsePart = new AccountSdfToStatementRequestPart();
|
||||||
responsePart.setSdfId(accountReq.getSdfId());
|
responsePart.setSdfId(accountReq.getSdfId());
|
||||||
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId()); // see accountService.fillAccountFromRelation
|
responsePart.setErrorCode(AccountError.ClearingCategoryNotFound.getId());
|
||||||
responsePart.setErrorText(requestInfoUpdate.getMessage());
|
responsePart.setErrorText(requestInfoUpdate.getMessage());
|
||||||
accountToStatement.add(responsePart);
|
accountToStatement.add(responsePart);
|
||||||
continue accountsLoop;
|
continue accountsLoop;
|
||||||
|
|
@ -228,9 +226,9 @@ public class DepoAccountService extends QueueConsumer implements InitializingBea
|
||||||
StatementRequest request = new StatementRequest();
|
StatementRequest request = new StatementRequest();
|
||||||
request.setGroupId(groupingSdf01Id);
|
request.setGroupId(groupingSdf01Id);
|
||||||
request.setChildGenerationId(groupingSdf02Id);
|
request.setChildGenerationId(groupingSdf02Id);
|
||||||
request.setContinueSdf(true); //fixme????
|
request.setContinueSdf(true);
|
||||||
request.setAccountCreationResults(results);
|
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));
|
log.debug("Send message to kafka \"{}\": {}", Consts.STATEMENT_PROCESS, LogFormatter.toStringWrapper(request));
|
||||||
kafkaSender.sendRequestToQueue(Consts.STATEMENT_PROCESS, request);
|
kafkaSender.sendRequestToQueue(Consts.STATEMENT_PROCESS, request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.BaseRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
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.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.domain.cud.reports.NotificationRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
import ru.spcex.clearing.platform.messaging.serialization.LogFormatter;
|
||||||
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
import ru.spcex.clearing.platform.messaging.service.QueueConsumer;
|
||||||
|
|
@ -59,10 +58,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
private final Function<InformationAccountNewRequest, IValidator> infoAccountNewRequestValidator;
|
private final Function<InformationAccountNewRequest, IValidator> infoAccountNewRequestValidator;
|
||||||
private final Imdg<InformationAccount> informationAccountImdg;
|
private final Imdg<InformationAccount> informationAccountImdg;
|
||||||
private final Imdg<Account> accountImdg;
|
private final Imdg<Account> accountImdg;
|
||||||
/**
|
|
||||||
* Кэш-счётчик сквозных номеров счетов.
|
|
||||||
* См. accountNextId()
|
|
||||||
*/
|
|
||||||
protected AtomicLong infoCounter;
|
protected AtomicLong infoCounter;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -191,12 +186,10 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
log.debug("InformationAccountNewRequest received (system), request id={}", userRequest.getId());
|
log.debug("InformationAccountNewRequest received (system), request id={}", userRequest.getId());
|
||||||
|
|
||||||
RequestInfoUpdate requestInfoUpdate;
|
RequestInfoUpdate requestInfoUpdate;
|
||||||
// RequestInfoUpdate requestInfoUpdate = validationHelper.validateTillFirstError(userRequest, infoAccountNewRequestValidator);
|
|
||||||
// if (requestInfoUpdate != null) return requestInfoUpdate;
|
|
||||||
final Long forCompanyId = userRequest.getRequestPayload().getCompanyId();
|
final Long forCompanyId = userRequest.getRequestPayload().getCompanyId();
|
||||||
|
|
||||||
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
ImdgPredicateBuilder pb = accountImdg.predicateBuilder();
|
||||||
{ // Проверка существования счёта
|
{
|
||||||
Collection<Account> accountsAnlt = accountImdg.getCollectionObjectsByFieldValues(Map.of(
|
Collection<Account> accountsAnlt = accountImdg.getCollectionObjectsByFieldValues(Map.of(
|
||||||
"companyId", forCompanyId,
|
"companyId", forCompanyId,
|
||||||
"accountType", AccountType.Info.getKey()
|
"accountType", AccountType.Info.getKey()
|
||||||
|
|
@ -210,7 +203,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
|
|
||||||
|
|
||||||
Long newId = informationAccountImdg.nextIDSequenceFor();
|
Long newId = informationAccountImdg.nextIDSequenceFor();
|
||||||
Long infoSequenceId = accountNextId(); // требуется последовательность n+1
|
Long infoSequenceId = accountNextId();
|
||||||
String accountValue = generateInfoAccount(infoSequenceId);
|
String accountValue = generateInfoAccount(infoSequenceId);
|
||||||
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
log.trace("New info-account id={}, sequenceId={}, account={}", newId, infoSequenceId, accountValue);
|
||||||
|
|
||||||
|
|
@ -276,17 +269,12 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
imdgTransaction.rollbackTransaction();
|
imdgTransaction.rollbackTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// send to kafka
|
|
||||||
sendNotificationToReport(informationAccount, account);
|
sendNotificationToReport(informationAccount, account);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Формирование уведолмения о регистрации УК
|
|
||||||
*/
|
|
||||||
protected void sendNotificationToReport(InformationAccount informationAccount, Account account) {
|
protected void sendNotificationToReport(InformationAccount informationAccount, Account account) {
|
||||||
NotificationRequest request = new NotificationRequest();
|
NotificationRequest request = new NotificationRequest();
|
||||||
request.setConsumerId(account.getCompanyId());
|
request.setConsumerId(account.getCompanyId());
|
||||||
|
|
@ -299,11 +287,6 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Сквозной номер инфо-счетов
|
|
||||||
*
|
|
||||||
* @return infoCounter++
|
|
||||||
*/
|
|
||||||
public synchronized Long accountNextId() {
|
public synchronized Long accountNextId() {
|
||||||
if (infoCounter == null) synchronized (this) {
|
if (infoCounter == null) synchronized (this) {
|
||||||
if (infoCounter == null) {
|
if (infoCounter == null) {
|
||||||
|
|
@ -316,7 +299,7 @@ public class InformationAccountService extends QueueConsumer implements Initiali
|
||||||
Pattern accPattern = Pattern.compile("39911810([0-9]{8})7000");
|
Pattern accPattern = Pattern.compile("39911810([0-9]{8})7000");
|
||||||
int maxN = 1;
|
int maxN = 1;
|
||||||
int parsedCount = 0;
|
int parsedCount = 0;
|
||||||
String lastAccount = null; // for debug
|
String lastAccount = null;
|
||||||
for (Account acc : allInfoAcc) {
|
for (Account acc : allInfoAcc) {
|
||||||
try {
|
try {
|
||||||
String number = acc.getAccount();
|
String number = acc.getAccount();
|
||||||
|
|
|
||||||
|
|
@ -6,37 +6,30 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import ru.clearing.classes.statics.data.account.Account;
|
import ru.clearing.classes.statics.data.account.Account;
|
||||||
import ru.clearing.classes.statics.data.misc.Notification;
|
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf52;
|
import ru.clearing.classes.statics.data.sdf.SDf52;
|
||||||
import ru.clearing.classes.statics.data.sdf.SDf53;
|
import ru.clearing.classes.statics.data.sdf.SDf53;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
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.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.utilities.NotificationFeedbackRequest;
|
|
||||||
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender;
|
||||||
import ru.spcex.platform.enumeration.AccountStatus;
|
import ru.spcex.platform.enumeration.AccountStatus;
|
||||||
import ru.spcex.platform.enumeration.NotificationStatus;
|
|
||||||
import ru.spcex.platform.enumeration.ObjectType;
|
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgId;
|
import ru.spcex.platform.imdg.api.ImdgId;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
import ru.spcex.platform.imdg.api.ImdgTransaction;
|
||||||
import ru.spcex.platform.utils.collection.Pair;
|
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SDFProcessService {
|
public class SDFProcessService {
|
||||||
public static final String SDF_STATUS_OK = "OK"; // (Операция выполнена успешно) - если account обновлена по sDf52;
|
public static final String SDF_STATUS_OK = "OK";
|
||||||
public static final String SDF_STATUS_ERROR_REPEAT = "1"; // (Ошибка. Попытка повторно исполнить операцию)
|
public static final String SDF_STATUS_ERROR_REPEAT = "1";
|
||||||
public static final String SDF_STATUS_ERROR_COMPANY_NOT_FOUND = "2"; // (Ошибка. Участник не найден) - если получена ошибка (5013) "Компания %s не найдена" (т.е. account НЕ обновлена по sDf52);
|
public static final String SDF_STATUS_ERROR_COMPANY_NOT_FOUND = "2";
|
||||||
public static final String SDF_STATUS_ERROR_LIMIT_SUMM = "3"; // (Ошибка. Сумма списания превышает сумму средств на торговом счете участника в ТС)
|
public static final String SDF_STATUS_ERROR_LIMIT_SUMM = "3";
|
||||||
public static final String SDF_STATUS_ERROR_NO_TRADE = "4"; // (Ошибка. Торги не идут)
|
public static final String SDF_STATUS_ERROR_NO_TRADE = "4";
|
||||||
public static final String SDF_STATUS_ERROR = "9"; // (Другие ошибки, выявленные в КС) - если получены другие ошибки (т.е. account НЕ обновлена по sDf52).
|
public static final String SDF_STATUS_ERROR = "9";
|
||||||
|
|
||||||
final protected Logger log = LoggerFactory.getLogger(getClass());
|
final protected Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
|
|
@ -75,7 +68,7 @@ public class SDFProcessService {
|
||||||
boolean txOk = false;
|
boolean txOk = false;
|
||||||
imdgTransaction.beginTransaction();
|
imdgTransaction.beginTransaction();
|
||||||
HashSet<String> fileNames = new HashSet<>();
|
HashSet<String> fileNames = new HashSet<>();
|
||||||
try { // 2. обновление данных, в транзакции
|
try {
|
||||||
Imdg<SDf53> sdf53Imdg = imdgTransaction.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
Imdg<SDf53> sdf53Imdg = imdgTransaction.getImdg(IMDGDistributedNames.Map_SDf53, SDf53.class);
|
||||||
|
|
||||||
Instant now = Instant.now();
|
Instant now = Instant.now();
|
||||||
|
|
@ -114,7 +107,7 @@ public class SDFProcessService {
|
||||||
newSdf.setResult(result);
|
newSdf.setResult(result);
|
||||||
newSdf.setGenerationTime(now);
|
newSdf.setGenerationTime(now);
|
||||||
newSdf.setGenerationId(sdf52.getGenerationId());
|
newSdf.setGenerationId(sdf52.getGenerationId());
|
||||||
if (!Objects.equals(newGenerationId, newSdf.getGenerationId())) { // never
|
if (!Objects.equals(newGenerationId, newSdf.getGenerationId())) {
|
||||||
log.warn("Different GenerationId={} for sdf53[{}] and GenerationId={} for group of sdf52",
|
log.warn("Different GenerationId={} for sdf53[{}] and GenerationId={} for group of sdf52",
|
||||||
newSdf.getGenerationId(), newSdf.getId(), newGenerationId
|
newSdf.getGenerationId(), newSdf.getId(), newGenerationId
|
||||||
);
|
);
|
||||||
|
|
@ -124,10 +117,6 @@ public class SDFProcessService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param status sdf.getStatus()
|
|
||||||
* @return AccountStatus или null
|
|
||||||
*/
|
|
||||||
public AccountStatus parseSdf52Status(Long status) {
|
public AccountStatus parseSdf52Status(Long status) {
|
||||||
if (Long.valueOf(1L).equals(status) || Long.valueOf(3L).equals(status)) {
|
if (Long.valueOf(1L).equals(status) || Long.valueOf(3L).equals(status)) {
|
||||||
return AccountStatus.ACTIVE;
|
return AccountStatus.ACTIVE;
|
||||||
|
|
@ -142,9 +131,9 @@ public class SDFProcessService {
|
||||||
|
|
||||||
|
|
||||||
void messageStatementToExport53(Long groupId, String fileName) {
|
void messageStatementToExport53(Long groupId, String fileName) {
|
||||||
final String destination = Consts.EXPORT_PROCESS; // dbf-exporter
|
final String destination = Consts.EXPORT_PROCESS;
|
||||||
ExportToFileRequest request = new ExportToFileRequest();
|
ExportToFileRequest request = new ExportToFileRequest();
|
||||||
request.setNameOfTable("DF-53"); // SdfTable.SDF_53
|
request.setNameOfTable("DF-53");
|
||||||
request.setSdfGroupId(groupId);
|
request.setSdfGroupId(groupId);
|
||||||
request.setFileName(fileName);
|
request.setFileName(fileName);
|
||||||
Long msgId = kafkaSender.sendRequestToQueue(destination, request);
|
Long msgId = kafkaSender.sendRequestToQueue(destination, request);
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
this.accountImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Account, Account.class);
|
||||||
this.relationImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
|
this.relationImdg = imdgProvider.getImdg(IMDGDistributedNames.Map_Relation, Relation.class);
|
||||||
this.tradingClearingRegistryNewRequestValidator = tradingClearingRegistryNewRequestValidator;
|
this.tradingClearingRegistryNewRequestValidator = tradingClearingRegistryNewRequestValidator;
|
||||||
this.tradingClearingRegistryAutoNewRequestValidator = tradingClearingRegistryNewRequestValidator; // без relation.
|
this.tradingClearingRegistryAutoNewRequestValidator = tradingClearingRegistryNewRequestValidator;
|
||||||
this.tradingClearingRegistryUpdateRequestValidator = tradingClearingRegistryUpdateRequestValidator;
|
this.tradingClearingRegistryUpdateRequestValidator = tradingClearingRegistryUpdateRequestValidator;
|
||||||
this.tradingClearingRegistryBlockRequestValidator = tradingClearingRegistryBlockRequestValidator;
|
this.tradingClearingRegistryBlockRequestValidator = tradingClearingRegistryBlockRequestValidator;
|
||||||
this.messageResolver = messageResolver;
|
this.messageResolver = messageResolver;
|
||||||
|
|
@ -108,7 +108,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
@Override
|
@Override
|
||||||
public void afterPropertiesSet() throws Exception {
|
public void afterPropertiesSet() throws Exception {
|
||||||
imdgProvider.waitAvailable();
|
imdgProvider.waitAvailable();
|
||||||
callback(TradingClearingRegistryNewRequest.class) // todo deprecated - unused.
|
callback(TradingClearingRegistryNewRequest.class)
|
||||||
.setFunction(this::tradingClearingRegistryAutoNew)
|
.setFunction(this::tradingClearingRegistryAutoNew)
|
||||||
.forDestination(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_AUTO_NEW, callbacks::put);
|
.forDestination(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_AUTO_NEW, callbacks::put);
|
||||||
callback(TradingClearingRegistryNewRequest.class)
|
callback(TradingClearingRegistryNewRequest.class)
|
||||||
|
|
@ -143,18 +143,13 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
|
|
||||||
Account depoAccountMain = req.getDepoAccountId() != null ? accountImdg.getSingleObjectByID(req.getDepoAccountId()) : null;
|
Account depoAccountMain = req.getDepoAccountId() != null ? accountImdg.getSingleObjectByID(req.getDepoAccountId()) : null;
|
||||||
DepoAccount depoAccount = depoAccountMain != null ? depoAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getDepoAccountId())) : null;
|
DepoAccount depoAccount = depoAccountMain != null ? depoAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getDepoAccountId())) : null;
|
||||||
|
|
||||||
// InformationAccount infoAccount = null;
|
|
||||||
ClearingAccount clearingAccount = null;
|
ClearingAccount clearingAccount = null;
|
||||||
Account accountMain = null;
|
Account accountMain = null;
|
||||||
if (req.getMoneyAccountId() != null) {
|
if (req.getMoneyAccountId() != null) {
|
||||||
clearingAccount = clearingAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
|
clearingAccount = clearingAccountImdg.getFirstObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
|
||||||
// if (clearingAccount == null) infoAccount = informationAccountImdg.getSingleObjectByFieldValues(Map.of("accountId", req.getMoneyAccountId()));
|
Long accountId = req.getMoneyAccountId();
|
||||||
Long accountId = req.getMoneyAccountId(); //clearingAccount != null ? clearingAccount.getAccountId() : infoAccount.getAccountId();
|
|
||||||
accountMain = accountImdg.getSingleObjectByID(accountId);
|
accountMain = accountImdg.getSingleObjectByID(accountId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// кроссвалидация
|
|
||||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||||
if (registryByCompany == null) {
|
if (registryByCompany == null) {
|
||||||
|
|
@ -194,7 +189,7 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
}
|
}
|
||||||
if (accountId != null) {
|
if (accountId != null) {
|
||||||
accountMain = accountImdg.getSingleObjectByID(accountId);
|
accountMain = accountImdg.getSingleObjectByID(accountId);
|
||||||
if (accountMain == null) { // never, только с инконсистентными данными
|
if (accountMain == null) {
|
||||||
log.warn("Account {} not exist.", accountId);
|
log.warn("Account {} not exist.", accountId);
|
||||||
} else {
|
} else {
|
||||||
tradingClearingRegistry.setMoneyAccountId(accountId);
|
tradingClearingRegistry.setMoneyAccountId(accountId);
|
||||||
|
|
@ -262,9 +257,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
|
|
||||||
tradingClearingRegistryImdg.insert(tradingClearingRegistry);
|
tradingClearingRegistryImdg.insert(tradingClearingRegistry);
|
||||||
log.debug("New TCR.id={} was created", tradingClearingRegistry.getId());
|
log.debug("New TCR.id={} was created", tradingClearingRegistry.getId());
|
||||||
|
|
||||||
// sendNotificationToCompanySvc(tradingClearingRegistry); при автосоздании ТКР в company-service не отправлять.
|
|
||||||
// sendNotificationToClearingSvc(tradingClearingRegistry);
|
|
||||||
sendNotificationToReportSvc(tradingClearingRegistry);
|
sendNotificationToReportSvc(tradingClearingRegistry);
|
||||||
sendNotificationToClearingSvc(tradingClearingRegistry);
|
sendNotificationToClearingSvc(tradingClearingRegistry);
|
||||||
|
|
||||||
|
|
@ -285,7 +277,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
}
|
}
|
||||||
|
|
||||||
TradingClearingRegistryNewRequest req = userRequest.getRequestPayload();
|
TradingClearingRegistryNewRequest req = userRequest.getRequestPayload();
|
||||||
// Дополнительная проверка
|
|
||||||
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
if (req.getMoneyAccountId() == null && (req.getMoneyAccountId() == null || req.getDepoAccountId() == null)) {
|
||||||
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
TradingClearingRegistry registryByCompany = tradingClearingRegistryImdg.getFirstObjectByFieldValues(Map.of("companyId", req.getCompanyId()));
|
||||||
if (registryByCompany == null) {
|
if (registryByCompany == null) {
|
||||||
|
|
@ -394,14 +385,14 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
if (code.length() > 4)
|
if (code.length() > 4)
|
||||||
code = code.substring(code.length() - 4);
|
code = code.substring(code.length() - 4);
|
||||||
code = "%4s".formatted(code).replace(' ', '0');
|
code = "%4s".formatted(code).replace(' ', '0');
|
||||||
code += registryPurpose.getKey(); // C / M / ...
|
code += registryPurpose.getKey();
|
||||||
String trType = tradingRegistryType + "T"; // 2 символа
|
String trType = tradingRegistryType + "T";
|
||||||
code += trType;
|
code += trType;
|
||||||
String sId = "%5s".formatted(id).replace(' ', '0');
|
String sId = "%5s".formatted(id).replace(' ', '0');
|
||||||
if (sId.length() > 5)
|
if (sId.length() > 5)
|
||||||
sId = sId.substring(sId.length() - 5);
|
sId = sId.substring(sId.length() - 5);
|
||||||
code += sId;
|
code += sId;
|
||||||
return code; // 12 имволов
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequestInfoUpdate tradingClearingRegistryUpdate(BaseRequest<TradingClearingRegistryUpdateRequest> userRequest) {
|
public RequestInfoUpdate tradingClearingRegistryUpdate(BaseRequest<TradingClearingRegistryUpdateRequest> userRequest) {
|
||||||
|
|
@ -414,16 +405,12 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
|
|
||||||
TradingClearingRegistryUpdateRequest req = userRequest.getRequestPayload();
|
TradingClearingRegistryUpdateRequest req = userRequest.getRequestPayload();
|
||||||
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByID(req.getId());
|
TradingClearingRegistry tradingClearingRegistry = tradingClearingRegistryImdg.getSingleObjectByID(req.getId());
|
||||||
|
|
||||||
// кроссвалидация - нельзя менять эти поля:
|
|
||||||
if (req.getMoneyAccountId() != null && !req.getMoneyAccountId().equals(tradingClearingRegistry.getMoneyAccountId())) {
|
if (req.getMoneyAccountId() != null && !req.getMoneyAccountId().equals(tradingClearingRegistry.getMoneyAccountId())) {
|
||||||
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "MoneyAccountId", req.getMoneyAccountId());
|
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "MoneyAccountId", req.getMoneyAccountId());
|
||||||
}
|
}
|
||||||
if (req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())) {
|
if (req.getDepoAccountId() != null && !req.getDepoAccountId().equals(tradingClearingRegistry.getDepoAccountId())) {
|
||||||
return requestHelper.makeErrorResponse(userRequest, AccountError.WrongFieldValue, "DepoAccountId", req.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())) {
|
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) {
|
protected void sendNotificationToCompanySvc(TradingClearingRegistry tradingClearingRegistry) {
|
||||||
ClientCodeNewRequest request = new ClientCodeNewRequest();
|
ClientCodeNewRequest request = new ClientCodeNewRequest();
|
||||||
request.setTradingClearingRegistryId(tradingClearingRegistry.getId());
|
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);
|
kafkaSender.sendRequestToQueue(Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clearing-service сообщение на открытие клиринговых регистров;
|
|
||||||
*/
|
|
||||||
protected void sendNotificationToClearingSvc(TradingClearingRegistry tradingClearingRegistry) {
|
protected void sendNotificationToClearingSvc(TradingClearingRegistry tradingClearingRegistry) {
|
||||||
CreateRegistryRequest request = new CreateRegistryRequest();
|
CreateRegistryRequest request = new CreateRegistryRequest();
|
||||||
request.setCompanyId(tradingClearingRegistry.getCompanyId());
|
request.setCompanyId(tradingClearingRegistry.getCompanyId());
|
||||||
|
|
@ -486,9 +467,6 @@ public class TradingClearingRegistryService extends QueueConsumer implements Ini
|
||||||
kafkaSender.sendRequestToQueue(Consts.REGISTRY_NEW, request);
|
kafkaSender.sendRequestToQueue(Consts.REGISTRY_NEW, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* report-service сообщение на формирование уведомления о создании нового ТКР
|
|
||||||
*/
|
|
||||||
protected void sendNotificationToReportSvc(TradingClearingRegistry tradingClearingRegistry) {
|
protected void sendNotificationToReportSvc(TradingClearingRegistry tradingClearingRegistry) {
|
||||||
NotificationRequest request = new NotificationRequest();
|
NotificationRequest request = new NotificationRequest();
|
||||||
request.setConsumerId(tradingClearingRegistry.getCompanyId());
|
request.setConsumerId(tradingClearingRegistry.getCompanyId());
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ public enum AccountValidationRule implements IValidationRule<ImdgValidationConte
|
||||||
if (!Status.Active.equalsByKey(company.getWorkflowStatus())) {
|
if (!Status.Active.equalsByKey(company.getWorkflowStatus())) {
|
||||||
return of(AccountError.CompanyNotActive);
|
return of(AccountError.CompanyNotActive);
|
||||||
}
|
}
|
||||||
// context.storeObject(ValidationStored.Company, company);
|
|
||||||
return empty();
|
return empty();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package ru.spcex.clearing.account.service;
|
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.consumer.MockConsumer;
|
||||||
import org.apache.kafka.clients.producer.MockProducer;
|
import org.apache.kafka.clients.producer.MockProducer;
|
||||||
import org.apache.kafka.clients.producer.Producer;
|
import org.apache.kafka.clients.producer.Producer;
|
||||||
|
|
@ -27,37 +25,24 @@ import ru.spcex.clearing.account.config.validation.InformationAccountValidationC
|
||||||
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
import ru.spcex.clearing.account.config.validation.ValidationConfig;
|
||||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
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.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.CorrespondentAccountNewRequest;
|
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.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.domain.cud.common.CommonDeleteRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.service.RequestInfo;
|
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.TestObjectCreator;
|
||||||
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
import ru.spcex.clearing.test.config.ImdgTestConfig;
|
||||||
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
import ru.spcex.clearing.test.config.KafkaTestConfig;
|
||||||
import ru.spcex.platform.enumeration.*;
|
import ru.spcex.platform.enumeration.*;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
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 ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
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.account.utils.MatcherFactory.usingIgnoringFieldsComparator;
|
||||||
import static ru.spcex.clearing.test.TestUtils.*;
|
import static ru.spcex.clearing.test.TestUtils.*;
|
||||||
import static ru.spcex.clearing.test.config.ImdgTestConfig.currentID;
|
|
||||||
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@ContextConfiguration(classes = {
|
@ContextConfiguration(classes = {
|
||||||
|
|
@ -201,15 +186,11 @@ class AccountServiceTest {
|
||||||
|
|
||||||
|
|
||||||
String jsonString = getJsonStringForUpdate(correspondentAccountUpdateRequest, 0);
|
String jsonString = getJsonStringForUpdate(correspondentAccountUpdateRequest, 0);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||||
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE,
|
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(0L, mockProducer);
|
waitingSendAndCheckRecord(0L, mockProducer);
|
||||||
|
|
||||||
Account resultUpdating = accountImdg.getSingleObjectByID(accountId);
|
Account resultUpdating = accountImdg.getSingleObjectByID(accountId);
|
||||||
|
|
@ -239,15 +220,11 @@ class AccountServiceTest {
|
||||||
commonDeleteRequest.setId(accountId);
|
commonDeleteRequest.setId(accountId);
|
||||||
|
|
||||||
String jsonString = getJsonStringForDelete(commonDeleteRequest, 0);
|
String jsonString = getJsonStringForDelete(commonDeleteRequest, 0);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
addRecordToKafka((MockConsumer) accountService.getConsumer(),
|
||||||
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK,
|
Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(0L, mockProducer);
|
waitingSendAndCheckRecord(0L, mockProducer);
|
||||||
|
|
||||||
Account resultBlock = accountImdg.getSingleObjectByID(accountId);
|
Account resultBlock = accountImdg.getSingleObjectByID(accountId);
|
||||||
|
|
|
||||||
|
|
@ -133,23 +133,8 @@ public class BankAccountServiceTest {
|
||||||
new TestObjectCreator(hazelcastServiceTest).createUserAdmin(1000L);
|
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
|
@Test
|
||||||
public void bankAccountNew() {
|
public void bankAccountNew() {
|
||||||
//ARRANGE
|
|
||||||
BankAccount predictableBankAccount = getBankAccount();
|
BankAccount predictableBankAccount = getBankAccount();
|
||||||
|
|
||||||
Company company = getTestCompany();
|
Company company = getTestCompany();
|
||||||
|
|
@ -174,8 +159,6 @@ public class BankAccountServiceTest {
|
||||||
|
|
||||||
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
|
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
|
||||||
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
|
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonString);
|
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonString);
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
|
|
||||||
|
|
@ -184,26 +167,10 @@ public class BankAccountServiceTest {
|
||||||
predictableBankAccount.setAccountId(accountResult.getId());
|
predictableBankAccount.setAccountId(accountResult.getId());
|
||||||
predictableBankAccount.setId(bankAccountResult.getId());
|
predictableBankAccount.setId(bankAccountResult.getId());
|
||||||
setSameValueToField(accountResult, predictableAccount);
|
setSameValueToField(accountResult, predictableAccount);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
BANK_ACCOUNT_MATCHER.assertMatch(bankAccountResult, predictableBankAccount);
|
BANK_ACCOUNT_MATCHER.assertMatch(bankAccountResult, predictableBankAccount);
|
||||||
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
|
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
|
@Test
|
||||||
public void validatedBankAccountNew() {
|
public void validatedBankAccountNew() {
|
||||||
clearImdg(accountImdg);
|
clearImdg(accountImdg);
|
||||||
|
|
@ -213,8 +180,6 @@ public class BankAccountServiceTest {
|
||||||
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
|
BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount);
|
||||||
|
|
||||||
String errMsg;
|
String errMsg;
|
||||||
//AccountValidationRule.RequiredFields
|
|
||||||
//WrongFieldValue
|
|
||||||
bankAccountNewRequest.setCurrency(null);
|
bankAccountNewRequest.setCurrency(null);
|
||||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "currency"));
|
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "currency"));
|
||||||
checkError(errMsg, bankAccountNewRequest);
|
checkError(errMsg, bankAccountNewRequest);
|
||||||
|
|
@ -248,22 +213,14 @@ public class BankAccountServiceTest {
|
||||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "companyId"));
|
errMsg = messageResolver.resolve(new EnumMessage(AccountError.RequiredFieldEmpty, "companyId"));
|
||||||
checkError(errMsg, bankAccountNewRequest);
|
checkError(errMsg, bankAccountNewRequest);
|
||||||
bankAccountNewRequest.setCompanyId(addresseeIdNew);
|
bankAccountNewRequest.setCompanyId(addresseeIdNew);
|
||||||
|
|
||||||
//AccountValidationRule.CompanyPresent
|
|
||||||
//CompanyNotFound
|
|
||||||
bankAccountNewRequest.setCompanyId(999924535239L);
|
bankAccountNewRequest.setCompanyId(999924535239L);
|
||||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotFound, "companyId"));
|
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotFound, "companyId"));
|
||||||
checkError(errMsg, bankAccountNewRequest);
|
checkError(errMsg, bankAccountNewRequest);
|
||||||
|
|
||||||
//CompanyNotActive
|
|
||||||
company.setWorkflowStatus(Status.Blocked.getKey());
|
company.setWorkflowStatus(Status.Blocked.getKey());
|
||||||
companyImdg.insert(company);
|
companyImdg.insert(company);
|
||||||
bankAccountNewRequest.setCompanyId(company.getId());
|
bankAccountNewRequest.setCompanyId(company.getId());
|
||||||
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotActive, "companyId"));
|
errMsg = messageResolver.resolve(new EnumMessage(AccountError.CompanyNotActive, "companyId"));
|
||||||
checkError(errMsg, bankAccountNewRequest);
|
checkError(errMsg, bankAccountNewRequest);
|
||||||
|
|
||||||
//AccountValidationRule.AccountIsNew
|
|
||||||
//AccountAlreadyExist
|
|
||||||
company.setWorkflowStatus(Status.Active.getKey());
|
company.setWorkflowStatus(Status.Active.getKey());
|
||||||
companyImdg.insert(company);
|
companyImdg.insert(company);
|
||||||
Account existAccount = getTestAccount(accountId, acc);
|
Account existAccount = getTestAccount(accountId, acc);
|
||||||
|
|
@ -274,7 +231,6 @@ public class BankAccountServiceTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkError(String errorMsg, BankAccountNewRequest bankAccountNewRequest) {
|
private void checkError(String errorMsg, BankAccountNewRequest bankAccountNewRequest) {
|
||||||
//ARRANGE
|
|
||||||
int currentTime = countRun.getAndIncrement();
|
int currentTime = countRun.getAndIncrement();
|
||||||
long currentOffset = currentTime;
|
long currentOffset = currentTime;
|
||||||
BaseRequest<Object> predictableBaseRequest = new BaseRequest<>();
|
BaseRequest<Object> predictableBaseRequest = new BaseRequest<>();
|
||||||
|
|
@ -287,40 +243,17 @@ public class BankAccountServiceTest {
|
||||||
predictableBaseRequest.setRequestPayload(requestInfoUpdate);
|
predictableBaseRequest.setRequestPayload(requestInfoUpdate);
|
||||||
|
|
||||||
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
|
String jsonString = getJsonStringForNew(bankAccountNewRequest, ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, currentOffset, jsonString);
|
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))
|
verify(producer, timeout(30_000L).times(currentTime))
|
||||||
.send(producerRecord.capture());
|
.send(producerRecord.capture());
|
||||||
BaseRequest<Object> baseRequestResult = (BaseRequest<Object>) producerRecord.getValue().value();
|
BaseRequest<Object> baseRequestResult = (BaseRequest<Object>) producerRecord.getValue().value();
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic());
|
assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic());
|
||||||
BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest);
|
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
|
@Test
|
||||||
void bankAccountUpdate() {
|
void bankAccountUpdate() {
|
||||||
clearImdg(accountImdg);
|
clearImdg(accountImdg);
|
||||||
//ARRANGE
|
|
||||||
// Company company = getTestCompany();
|
|
||||||
// companyImdg.insert(company);
|
|
||||||
Account predictableAccount = getTestAccount(accountId, acc);
|
Account predictableAccount = getTestAccount(accountId, acc);
|
||||||
accountImdg.insert(predictableAccount);
|
accountImdg.insert(predictableAccount);
|
||||||
|
|
||||||
|
|
@ -351,11 +284,7 @@ public class BankAccountServiceTest {
|
||||||
bankAccountUpdateRequest.setAccount(predictableUpdateBankAccount.getAccount());
|
bankAccountUpdateRequest.setAccount(predictableUpdateBankAccount.getAccount());
|
||||||
|
|
||||||
String jsonString = getJsonStringForUpdate(bankAccountUpdateRequest, ID);
|
String jsonString = getJsonStringForUpdate(bankAccountUpdateRequest, ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_UPDATE, PARTITION, 0, jsonString);
|
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_UPDATE, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
|
|
||||||
Account accountResult = accountImdg.getSingleObjectByID(predictableAccount.getId());
|
Account accountResult = accountImdg.getSingleObjectByID(predictableAccount.getId());
|
||||||
|
|
@ -367,15 +296,8 @@ public class BankAccountServiceTest {
|
||||||
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
|
ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link BankAccountService#bankAccountDelete(BaseRequest)}
|
|
||||||
* Тест проверяет удаление сущности {@link BankAccount} в Hazelcast при передаче из Apache Kafka.
|
|
||||||
* Входной запрос {@link CommonDeleteRequest}:
|
|
||||||
* {@link CommonDeleteRequest#id} - Идентификатор записи
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void bankAccountDelete() {
|
void bankAccountDelete() {
|
||||||
//ARRANGE
|
|
||||||
BankAccount bankAccountExists = getBankAccount();
|
BankAccount bankAccountExists = getBankAccount();
|
||||||
bankAccountImdg.insert(bankAccountExists);
|
bankAccountImdg.insert(bankAccountExists);
|
||||||
Account account = new Account();
|
Account account = new Account();
|
||||||
|
|
@ -386,11 +308,7 @@ public class BankAccountServiceTest {
|
||||||
CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest();
|
CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest();
|
||||||
commonDeleteRequest.setId(ID);
|
commonDeleteRequest.setId(ID);
|
||||||
String jsonString = getJsonStringForDelete(commonDeleteRequest, ID);
|
String jsonString = getJsonStringForDelete(commonDeleteRequest, ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_DELETE, PARTITION, 0, jsonString);
|
addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_DELETE, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
|
|
||||||
BankAccount bankAccount = bankAccountImdg.getSingleObjectByID(ID);
|
BankAccount bankAccount = bankAccountImdg.getSingleObjectByID(ID);
|
||||||
|
|
|
||||||
|
|
@ -232,78 +232,4 @@ class ClearingAccountServiceTest {
|
||||||
Assertions.assertEquals("013", clearingAccountService.makeSdfErrorText(AccountError.CompanyNotFound, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND));
|
Assertions.assertEquals("013", clearingAccountService.makeSdfErrorText(AccountError.CompanyNotFound, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND));
|
||||||
Assertions.assertEquals("2", clearingAccountService.makeSdfErrorText(null, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND));
|
Assertions.assertEquals("2", clearingAccountService.makeSdfErrorText(null, SDFProcessService.SDF_STATUS_ERROR_COMPANY_NOT_FOUND));
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * {@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);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
@ -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.config.validation.ValidationConfig;
|
||||||
import ru.spcex.clearing.account.utils.MatcherFactory;
|
import ru.spcex.clearing.account.utils.MatcherFactory;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
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.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeNewRequest;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeUpdateRequest;
|
import ru.spcex.clearing.platform.messaging.domain.cud.account.ClientCodeUpdateRequest;
|
||||||
|
|
@ -80,15 +79,10 @@ class ClientCodeServiceTest {
|
||||||
|
|
||||||
private Imdg<ClientCode> clientCodeImdg;
|
private Imdg<ClientCode> clientCodeImdg;
|
||||||
|
|
||||||
|
|
||||||
// ****************************-*******************
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
private void init() {
|
private void init() {
|
||||||
hazelcastServiceTest.waitAvailable();
|
hazelcastServiceTest.waitAvailable();
|
||||||
clientCodeImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
|
clientCodeImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_ClientCode, ClientCode.class);
|
||||||
|
|
||||||
// Словари для теста, применяются в ValidationConfig
|
|
||||||
putToDictionary(IMDGDistributedNames.Map_WorkflowStatusDictionary, new WorkflowStatusDictionary(), "ACTV");
|
putToDictionary(IMDGDistributedNames.Map_WorkflowStatusDictionary, new WorkflowStatusDictionary(), "ACTV");
|
||||||
putToDictionary(IMDGDistributedNames.Map_CompanySymbolDictionary, new CompanySymbolDictionary(), "CLRC");
|
putToDictionary(IMDGDistributedNames.Map_CompanySymbolDictionary, new CompanySymbolDictionary(), "CLRC");
|
||||||
putToDictionary(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, new CorporationSoleTypeDictionary(), "GDIR");
|
putToDictionary(IMDGDistributedNames.Map_CorporationSoleTypeDictionary, new CorporationSoleTypeDictionary(), "GDIR");
|
||||||
|
|
@ -129,7 +123,7 @@ class ClientCodeServiceTest {
|
||||||
moneyAccount.setId(131L);
|
moneyAccount.setId(131L);
|
||||||
moneyAccount.setAccount("AAAA-4444");
|
moneyAccount.setAccount("AAAA-4444");
|
||||||
moneyAccount.setStatus("ACTV");
|
moneyAccount.setStatus("ACTV");
|
||||||
moneyAccount.setCompanyId(COMPANY_ID); // для валидации принадлежности счёта
|
moneyAccount.setCompanyId(COMPANY_ID);
|
||||||
accounts.insert(moneyAccount);
|
accounts.insert(moneyAccount);
|
||||||
ClearingAccount clsAcc = new ClearingAccount();
|
ClearingAccount clsAcc = new ClearingAccount();
|
||||||
clsAcc.setId(moneyAccount.getId());
|
clsAcc.setId(moneyAccount.getId());
|
||||||
|
|
@ -141,7 +135,7 @@ class ClientCodeServiceTest {
|
||||||
depoAccount.setId(132L);
|
depoAccount.setId(132L);
|
||||||
depoAccount.setAccount("AAAB-44654");
|
depoAccount.setAccount("AAAB-44654");
|
||||||
depoAccount.setStatus("ACTV");
|
depoAccount.setStatus("ACTV");
|
||||||
depoAccount.setCompanyId(COMPANY_ID); // для валидации принадлежности счёта
|
depoAccount.setCompanyId(COMPANY_ID);
|
||||||
accounts.insert(depoAccount);
|
accounts.insert(depoAccount);
|
||||||
DepoAccount depoAcc = new DepoAccount();
|
DepoAccount depoAcc = new DepoAccount();
|
||||||
depoAcc.setId(depoAccount.getId());
|
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
|
@Test
|
||||||
void clientCodeNew1() {
|
void clientCodeNew1() {
|
||||||
//ARRANGE
|
|
||||||
final String ccCode = "Lucky planet";
|
final String ccCode = "Lucky planet";
|
||||||
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
||||||
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
||||||
|
|
@ -197,16 +185,9 @@ class ClientCodeServiceTest {
|
||||||
predictableClientCode.setCode(ccCode);
|
predictableClientCode.setCode(ccCode);
|
||||||
predictableClientCode.setStatus("ACTV");
|
predictableClientCode.setStatus("ACTV");
|
||||||
predictableClientCode.setCompanyId(COMPANY_ID);
|
predictableClientCode.setCompanyId(COMPANY_ID);
|
||||||
// predictableClientCode.setMoneyAccountId(131L);
|
|
||||||
// predictableClientCode.setDepoAccountId(132L);
|
|
||||||
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
|
||||||
|
|
||||||
//ACT
|
|
||||||
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
||||||
|
|
||||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
|
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
||||||
predictableClientCode.setId(resultNew.getId());
|
predictableClientCode.setId(resultNew.getId());
|
||||||
|
|
@ -214,14 +195,8 @@ class ClientCodeServiceTest {
|
||||||
assertNotNull(resultNew.getCreated());
|
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
|
@Test
|
||||||
void clientCodeNew2() {
|
void clientCodeNew2() {
|
||||||
//ARRANGE
|
|
||||||
final String ccCode = "Lucky planet";
|
final String ccCode = "Lucky planet";
|
||||||
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
||||||
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
||||||
|
|
@ -235,16 +210,9 @@ class ClientCodeServiceTest {
|
||||||
predictableClientCode.setCode(ccCode);
|
predictableClientCode.setCode(ccCode);
|
||||||
predictableClientCode.setStatus("ACTV");
|
predictableClientCode.setStatus("ACTV");
|
||||||
predictableClientCode.setCompanyId(COMPANY_ID);
|
predictableClientCode.setCompanyId(COMPANY_ID);
|
||||||
// predictableClientCode.setMoneyAccountId(131L);
|
|
||||||
// predictableClientCode.setDepoAccountId(132L);
|
|
||||||
// predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
|
||||||
|
|
||||||
//ACT
|
|
||||||
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
||||||
|
|
||||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, PARTITION, 0, jsonString);
|
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW_UM_COMPANY, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
TestUtils.waitingSendAndCheckRecord(ID, mockProducer, producerRecord);
|
TestUtils.waitingSendAndCheckRecord(ID, mockProducer, producerRecord);
|
||||||
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
||||||
predictableClientCode.setId(resultNew.getId());
|
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
|
@Test
|
||||||
void clientCodeNew3() {
|
void clientCodeNew3() {
|
||||||
//ARRANGE
|
|
||||||
final String ccCode = "Lucky planet2";
|
final String ccCode = "Lucky planet2";
|
||||||
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
ClientCodeNewRequest clientCodeNewRequest = new ClientCodeNewRequest();
|
||||||
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
clientCodeNewRequest.setCompanyId(COMPANY_ID);
|
||||||
|
|
@ -278,13 +239,9 @@ class ClientCodeServiceTest {
|
||||||
predictableClientCode.setMoneyAccountId(131L);
|
predictableClientCode.setMoneyAccountId(131L);
|
||||||
predictableClientCode.setDepoAccountId(132L);
|
predictableClientCode.setDepoAccountId(132L);
|
||||||
predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
predictableClientCode.setTradingClearingRegistryId(TCR_ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
String jsonString = TestUtils.getJsonStringForNew(clientCodeNewRequest, ID);
|
||||||
|
|
||||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
|
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_NEW, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
ClientCode resultNew = clientCodeImdg.getFirstObjectBySQL(String.format("code = '%s'", ccCode));
|
||||||
predictableClientCode.setId(resultNew.getId());
|
predictableClientCode.setId(resultNew.getId());
|
||||||
|
|
@ -292,14 +249,8 @@ class ClientCodeServiceTest {
|
||||||
assertNotNull(resultNew.getCreated());
|
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
|
@Test
|
||||||
void clientCodeUpdate() {
|
void clientCodeUpdate() {
|
||||||
//ARRANGE
|
|
||||||
ClientCode existsClientCode = new ClientCode();
|
ClientCode existsClientCode = new ClientCode();
|
||||||
existsClientCode.setId(ID);
|
existsClientCode.setId(ID);
|
||||||
existsClientCode.setCompanyId(COMPANY_ID);
|
existsClientCode.setCompanyId(COMPANY_ID);
|
||||||
|
|
@ -327,13 +278,9 @@ class ClientCodeServiceTest {
|
||||||
predictableClientCode.setMoneyAccountId(131L);
|
predictableClientCode.setMoneyAccountId(131L);
|
||||||
predictableClientCode.setDepoAccountId(132L);
|
predictableClientCode.setDepoAccountId(132L);
|
||||||
predictableClientCode.setStatus("ACTV");
|
predictableClientCode.setStatus("ACTV");
|
||||||
|
|
||||||
//ACT
|
|
||||||
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeUpdateRequest, ID);
|
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeUpdateRequest, ID);
|
||||||
|
|
||||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_UPDATE, PARTITION, 0, jsonString);
|
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_UPDATE, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
|
|
||||||
ClientCode resultUpdating = clientCodeImdg.getSingleObjectByID(ID);
|
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
|
@Test
|
||||||
void clientCodeDelete1() {
|
void clientCodeDelete1() {
|
||||||
//ARRANGE
|
|
||||||
ClientCode existsClientCode = new ClientCode();
|
ClientCode existsClientCode = new ClientCode();
|
||||||
existsClientCode.setId(ID);
|
existsClientCode.setId(ID);
|
||||||
existsClientCode.setCompanyId(COMPANY_ID);
|
existsClientCode.setCompanyId(COMPANY_ID);
|
||||||
existsClientCode.setCode("0000");
|
existsClientCode.setCode("0000");
|
||||||
// Если следующие поля заполнить, то дополнительно отправит сообщение в trading-clearing-registry-update:
|
|
||||||
existsClientCode.setTradingClearingRegistryId(null);
|
existsClientCode.setTradingClearingRegistryId(null);
|
||||||
existsClientCode.setMoneyAccountId(null);
|
existsClientCode.setMoneyAccountId(null);
|
||||||
existsClientCode.setDepoAccountId(null);
|
existsClientCode.setDepoAccountId(null);
|
||||||
|
|
@ -365,56 +305,14 @@ class ClientCodeServiceTest {
|
||||||
CommonDeleteRequest clientCodeDeleteRequest = new CommonDeleteRequest();
|
CommonDeleteRequest clientCodeDeleteRequest = new CommonDeleteRequest();
|
||||||
clientCodeDeleteRequest.setId(ID);
|
clientCodeDeleteRequest.setId(ID);
|
||||||
|
|
||||||
Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID)); // verify test data
|
Assertions.assertNotNull(clientCodeImdg.getSingleObjectByID(ID));
|
||||||
|
|
||||||
//ACT
|
|
||||||
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeDeleteRequest, ID);
|
String jsonString = TestUtils.getJsonStringForUpdate(clientCodeDeleteRequest, ID);
|
||||||
|
|
||||||
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_DELETE, PARTITION, 0, jsonString);
|
TestUtils.addRecordToKafka((MockConsumer) clientCodeService.getConsumer(), Consts.DESTINATION_CLIENT_CODE_DELETE, PARTITION, 0, jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
|
|
||||||
waitingSendAndCheckRecord(ID, mockProducer);
|
waitingSendAndCheckRecord(ID, mockProducer);
|
||||||
ClientCode resultUpdate = clientCodeImdg.getSingleObjectByID(ID);
|
ClientCode resultUpdate = clientCodeImdg.getSingleObjectByID(ID);
|
||||||
Assertions.assertNull(resultUpdate);
|
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);
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -153,8 +153,6 @@ class InformationAccountServiceTest {
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
||||||
//waiting for kafka producer send message (finale event)
|
|
||||||
verify(producer, timeout(30_000L).times(2))
|
verify(producer, timeout(30_000L).times(2))
|
||||||
.send(producerRecord.capture());
|
.send(producerRecord.capture());
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -275,15 +275,11 @@ class TradingClearingRegistryServiceTest {
|
||||||
tradingClearingRegistryUpdateRequest.setId(registryId);
|
tradingClearingRegistryUpdateRequest.setId(registryId);
|
||||||
|
|
||||||
String jsonString = getJsonStringForUpdate(tradingClearingRegistryUpdateRequest, 0);
|
String jsonString = getJsonStringForUpdate(tradingClearingRegistryUpdateRequest, 0);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
|
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
|
||||||
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE,
|
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
||||||
|
|
||||||
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
|
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
|
||||||
|
|
@ -303,15 +299,11 @@ class TradingClearingRegistryServiceTest {
|
||||||
tradingClearingRegistryDeleteRequest.setId(registryId);
|
tradingClearingRegistryDeleteRequest.setId(registryId);
|
||||||
|
|
||||||
String jsonString = getJsonStringForDelete(tradingClearingRegistryDeleteRequest, 0);
|
String jsonString = getJsonStringForDelete(tradingClearingRegistryDeleteRequest, 0);
|
||||||
|
|
||||||
//ACT
|
|
||||||
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
|
addRecordToKafka((MockConsumer) tradingClearingRegistryService.getConsumer(),
|
||||||
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_BLOCK,
|
Consts.DESTINATION_TRADING_CLEARING_REGISTRY_BLOCK,
|
||||||
PARTITION,
|
PARTITION,
|
||||||
0,
|
0,
|
||||||
jsonString);
|
jsonString);
|
||||||
|
|
||||||
//ASSERT
|
|
||||||
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
waitingSendAndCheckRecord(0L, producer, producerRecord);
|
||||||
|
|
||||||
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
|
TradingClearingRegistry resultUpdating = tradingClearingRegistryImdg.getSingleObjectByID(registryId);
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,13 @@ public class ImapEvent<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitWhenHappened() throws InterruptedException {
|
public void waitWhenHappened() throws InterruptedException {
|
||||||
//running timer task as daemon thread
|
|
||||||
Timer timer = new Timer(true);
|
Timer timer = new Timer(true);
|
||||||
timer.scheduleAtFixedRate(new TimerTask() {
|
timer.scheduleAtFixedRate(new TimerTask() {
|
||||||
boolean secondRan;
|
boolean secondRan;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
checkEventHappened.set(secondRan);//если что-то пойдет не так не тормозить основной поток
|
checkEventHappened.set(secondRan);
|
||||||
secondRan = true;
|
secondRan = true;
|
||||||
}
|
}
|
||||||
}, 0, 30 * 1000);
|
}, 0, 30 * 1000);
|
||||||
|
|
@ -55,7 +54,6 @@ public class ImapEvent<T> {
|
||||||
checkEventHappened.wait(100);
|
checkEventHappened.wait(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//preparing hazelcastImdgProvider for next test
|
|
||||||
iMap.removeEntryListener(listenerAdding);
|
iMap.removeEntryListener(listenerAdding);
|
||||||
iMap.removeEntryListener(listenerUpdating);
|
iMap.removeEntryListener(listenerUpdating);
|
||||||
iMap.removeEntryListener(listenerRemoving);
|
iMap.removeEntryListener(listenerRemoving);
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,6 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
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 class MatcherFactory {
|
||||||
|
|
||||||
public static <T> Matcher<T> usingIgnoringFieldsComparator(String... fieldsToIgnore) {
|
public static <T> Matcher<T> usingIgnoringFieldsComparator(String... fieldsToIgnore) {
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ public class BackendApiApplication extends SpringBootServletInitializer {
|
||||||
@Override
|
@Override
|
||||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
||||||
setKeycloakConfigFile();
|
setKeycloakConfigFile();
|
||||||
// springApplicationBuilder.initializers(DfaConfig.get().getLoggingInitializer());
|
|
||||||
return builder.sources(BackendApiApplication.class);
|
return builder.sources(BackendApiApplication.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,9 +34,6 @@ public class BackendApiApplication extends SpringBootServletInitializer {
|
||||||
return super.run(application);
|
return super.run(application);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* чтобы переместить настройки keycloak в keycloak.json вместо application.properties
|
|
||||||
*/
|
|
||||||
private static void setKeycloakConfigFile() {
|
private static void setKeycloakConfigFile() {
|
||||||
System.setProperty("keycloak.configurationFile", "classpath:keycloak.json");
|
System.setProperty("keycloak.configurationFile", "classpath:keycloak.json");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ public class BackEndApiImdgConfig {
|
||||||
ImdgProvider imdg = new HazelcastService(taskExecutorHazelcastClientInitializer,
|
ImdgProvider imdg = new HazelcastService(taskExecutorHazelcastClientInitializer,
|
||||||
taskExecutorIdGeneratorAwaiter,
|
taskExecutorIdGeneratorAwaiter,
|
||||||
clientSetting.getHazelcast());
|
clientSetting.getHazelcast());
|
||||||
// todo корректное ожидание готовности imdg.waitAvailable();
|
|
||||||
return imdg;
|
return imdg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import java.util.function.Consumer;
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
//todo remove? see ClearingCorsFilter
|
|
||||||
@CrossOrigin
|
@CrossOrigin
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
private final MappingJackson2HttpMessageConverter customJsonHttpConverter;
|
private final MappingJackson2HttpMessageConverter customJsonHttpConverter;
|
||||||
|
|
|
||||||
|
|
@ -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.domain.actions.IAction;
|
||||||
import ru.spcex.clearing.backendapi.service.IOperator;
|
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||||
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
public abstract class AbstractQueueController {
|
public abstract class AbstractQueueController {
|
||||||
|
|
@ -22,9 +21,6 @@ public abstract class AbstractQueueController {
|
||||||
return responseToClient;
|
return responseToClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Для оптимизации передачи userId
|
|
||||||
*/
|
|
||||||
protected <T> CudResponse processRequest(String destination, IAction<T> iAction, Long userId) throws ExecutionException, InterruptedException {
|
protected <T> CudResponse processRequest(String destination, IAction<T> iAction, Long userId) throws ExecutionException, InterruptedException {
|
||||||
CudResponse responseToClient = new CudResponse();
|
CudResponse responseToClient = new CudResponse();
|
||||||
responseToClient.setPayload(operator.sendRequestToQueue(destination, iAction, userId));
|
responseToClient.setPayload(operator.sendRequestToQueue(destination, iAction, userId));
|
||||||
|
|
|
||||||
|
|
@ -1,31 +1,22 @@
|
||||||
package ru.spcex.clearing.backendapi.controller.queue.account;
|
package ru.spcex.clearing.backendapi.controller.queue.account;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
|
||||||
import io.swagger.annotations.ApiResponse;
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.annotations.ApiResponses;
|
import io.swagger.annotations.ApiResponses;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.MediaType;
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
import ru.spcex.clearing.backendapi.controller.queue.AbstractQueueController;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.AccountInformationNewAction;
|
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction;
|
|
||||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
|
||||||
import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse;
|
|
||||||
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
import ru.spcex.clearing.backendapi.service.IOperator;
|
import ru.spcex.clearing.backendapi.service.IOperator;
|
||||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ExecutionException;
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/accounting/information-accounts")
|
@RequestMapping("/accounting/information-accounts")
|
||||||
|
|
@ -49,15 +40,4 @@ public class InformationAccountController extends AbstractQueueController {
|
||||||
response.fromEntity(all);
|
response.fromEntity(all);
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @ApiOperation(value = "Добавление информационного счета.")
|
|
||||||
// @ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
|
||||||
// @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
// @ResponseBody
|
|
||||||
// public CudResponse add(
|
|
||||||
// @ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
|
||||||
// @RequestBody AccountInformationNewAction accountNewInformationAction) throws ExecutionException, InterruptedException {
|
|
||||||
// return processRequest(Consts.DESTINATION_INFORMATION_ACCOUNT_NEW, accountNewInformationAction);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,8 +86,6 @@ public class LauncherController extends AbstractQueueController {
|
||||||
}
|
}
|
||||||
launcherCommand.setTask(dictionaryName);
|
launcherCommand.setTask(dictionaryName);
|
||||||
launcherCommand.setUserId(user.getId());
|
launcherCommand.setUserId(user.getId());
|
||||||
//топики ограничиваются наличием в taskDictionary
|
|
||||||
//подписываются на разные топики в разных модулях, см. ru.spcex.platform.enumeration.Task#topic
|
|
||||||
return processRequest(Consts.LAUNCHER_NEW, launcherCommand);
|
return processRequest(Consts.LAUNCHER_NEW, launcherCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +104,7 @@ public class LauncherController extends AbstractQueueController {
|
||||||
}
|
}
|
||||||
if (!IEnumKey.contains(taskEnum.getCode(), Task.startOfClearing, Task.dbfExport_OUTV)) {
|
if (!IEnumKey.contains(taskEnum.getCode(), Task.startOfClearing, Task.dbfExport_OUTV)) {
|
||||||
log.warn(String.format("Task %s not support request with body", taskEnum.getCode()));
|
log.warn(String.format("Task %s not support request with body", taskEnum.getCode()));
|
||||||
} // else В мете эти модели с дополнительными параметрами (OUTV).
|
}
|
||||||
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
|
||||||
String username = KeycloakUtils.getUserNameFromAuthentication(authentication);
|
String username = KeycloakUtils.getUserNameFromAuthentication(authentication);
|
||||||
User user = userImdg.getFirstObjectByFieldValues(Map.of("identifier", username));
|
User user = userImdg.getFirstObjectByFieldValues(Map.of("identifier", username));
|
||||||
|
|
|
||||||
|
|
@ -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.EquitySecurity;
|
||||||
import ru.clearing.classes.statics.data.instrument.issue.FixedIncomeSecurity;
|
import ru.clearing.classes.statics.data.instrument.issue.FixedIncomeSecurity;
|
||||||
import ru.clearing.classes.statics.data.security.MoneyMarketSecurity;
|
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.controller.response.entity.CommonGetAllResponse;
|
||||||
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
import ru.spcex.clearing.backendapi.service.IStateLoader;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
|
@ -20,9 +19,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* SecurityController и MoneyMarketSecurityController разные контроллеры, не путать.
|
|
||||||
*/
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/securities")
|
@RequestMapping("/securities")
|
||||||
public class SecurityController {
|
public class SecurityController {
|
||||||
|
|
|
||||||
|
|
@ -90,10 +90,6 @@ public class UserController extends AbstractQueueController {
|
||||||
log.warn("user {} sended update request for user {}", username, userUpdateAction.getUsername());
|
log.warn("user {} sended update request for user {}", username, userUpdateAction.getUsername());
|
||||||
throw new IllegalStateException("cannot perform delete action for " + username);
|
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);
|
return processRequest(Consts.USER_UPDATE, userUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,6 @@ public class StatementController extends AbstractQueueController {
|
||||||
Optional<Statement> statement = stateLoader.getById(id, IMDGDistributedNames.Map_Statement, Statement.class);
|
Optional<Statement> statement = stateLoader.getById(id, IMDGDistributedNames.Map_Statement, Statement.class);
|
||||||
CommonGetByIdResponse response = new CommonGetByIdResponse();
|
CommonGetByIdResponse response = new CommonGetByIdResponse();
|
||||||
if (statement.isEmpty()) {
|
if (statement.isEmpty()) {
|
||||||
//можно так, либо response.setCode(404); response.setMessage("blabla"); но тогда еще нужно
|
|
||||||
//отдельно HTTP статус проставлять
|
|
||||||
throw new NotFound404Exception(String.valueOf(id));
|
throw new NotFound404Exception(String.valueOf(id));
|
||||||
}
|
}
|
||||||
Statement stmt = statement.get();
|
Statement stmt = statement.get();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
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 ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -51,25 +50,6 @@ public class CompanyBackendGetAll extends BasicSpcexResponse {
|
||||||
singleItem.setFullName(company.getFullName());
|
singleItem.setFullName(company.getFullName());
|
||||||
singleItem.setCreated(company.getCreated());
|
singleItem.setCreated(company.getCreated());
|
||||||
singleItem.setUpdated(company.getUpdated());
|
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);
|
payload.getItems().add(singleItem);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,6 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
import ru.clearing.classes.statics.data.registry.TradingClearingRegistry;
|
||||||
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
import ru.spcex.clearing.backendapi.controller.response.BasicSpcexResponse;
|
||||||
|
|
||||||
/**
|
|
||||||
* Банковские реквизиты для перечисления денежных средств
|
|
||||||
*
|
|
||||||
* @ApiModel(description = "Ответ в результате отправки операции в топик Kafka.")
|
|
||||||
* @ApiModelProperty(value = "Информация о принятом запросе")
|
|
||||||
**/
|
|
||||||
@ApiModel(description = "Ответ при получении объекта TradingClearingRegistry.")
|
@ApiModel(description = "Ответ при получении объекта TradingClearingRegistry.")
|
||||||
public class TradingClearingRegistryBackendGetById extends BasicSpcexResponse {
|
public class TradingClearingRegistryBackendGetById extends BasicSpcexResponse {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,6 @@ import ru.spcex.clearing.platform.messaging.domain.json.serialize.EnumSerializer
|
||||||
import ru.spcex.clearing.platform.messaging.service.Status;
|
import ru.spcex.clearing.platform.messaging.service.Status;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Банковские реквизиты для перечисления денежных средств
|
|
||||||
* @ApiModel(description = "Ответ в результате отправки операции в топик Kafka.")
|
|
||||||
* @ApiModelProperty(value = "Информация о принятом запросе")
|
|
||||||
**/
|
|
||||||
@ApiModel(description = "Ответ при получении статуса запроса.")
|
@ApiModel(description = "Ответ при получении статуса запроса.")
|
||||||
public class RequestInfoResponse extends BasicSpcexResponse {
|
public class RequestInfoResponse extends BasicSpcexResponse {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,18 +19,14 @@ import java.io.IOException;
|
||||||
public class ClearingCorsFilter extends OncePerRequestFilter {
|
public class ClearingCorsFilter extends OncePerRequestFilter {
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
||||||
// private final AConfigurationProperties configuration;
|
private final String[] meth = new String[] {};
|
||||||
//todo cors settings
|
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 String[] head = new String[] {};
|
||||||
private final CorsAllowedOriginsService allowedOriginsService;
|
private final CorsAllowedOriginsService allowedOriginsService;
|
||||||
|
|
||||||
public ClearingCorsFilter(
|
public ClearingCorsFilter(
|
||||||
// AConfigurationProperties configuration,
|
|
||||||
CorsAllowedOriginsService allowedOriginsService
|
CorsAllowedOriginsService allowedOriginsService
|
||||||
) {
|
) {
|
||||||
// this.configuration = configuration;
|
|
||||||
this.allowedOriginsService = allowedOriginsService;
|
this.allowedOriginsService = allowedOriginsService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,21 +59,7 @@ public class ClearingCorsFilter extends OncePerRequestFilter {
|
||||||
log.trace("cors filter -> effectiveOrigin={}", effectiveOrigin);
|
log.trace("cors filter -> effectiveOrigin={}", effectiveOrigin);
|
||||||
if (effectiveOrigin != null) {
|
if (effectiveOrigin != null) {
|
||||||
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_ORIGIN, effectiveOrigin);
|
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, "*");
|
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_HEADERS, "*");
|
||||||
|
|
||||||
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
|
setHeaderValue(httpServletResponse, H_ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ public class CorsAllowedOriginsService {
|
||||||
|
|
||||||
private final List<Pattern> originPatterns = new ArrayList<>();
|
private final List<Pattern> originPatterns = new ArrayList<>();
|
||||||
|
|
||||||
//todo cors settings
|
|
||||||
public CorsAllowedOriginsService() {
|
public CorsAllowedOriginsService() {
|
||||||
for (String originRegex : new String[]{".*"}) {
|
for (String originRegex : new String[]{".*"}) {
|
||||||
originPatterns.add(Pattern.compile(originRegex));
|
originPatterns.add(Pattern.compile(originRegex));
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@ public class ActionElement {
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
private Boolean isArray = null;
|
private Boolean isArray = null;
|
||||||
|
|
||||||
// @JsonProperty(value = "fields", required = true)
|
|
||||||
// private List<Map<String, ActionField>> fields = new LinkedList<>();
|
|
||||||
@JsonProperty(value = "fields", required = true)
|
@JsonProperty(value = "fields", required = true)
|
||||||
private List<ActionField> fields = new LinkedList<>();
|
private List<ActionField> fields = new LinkedList<>();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,6 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* todo временная заглушка: нужно добавить парсинг meta.xml и получать инфу оттуда
|
|
||||||
*/
|
|
||||||
@Service
|
@Service
|
||||||
public class CudMetaService {
|
public class CudMetaService {
|
||||||
private final Map<String, Class<? extends IAction<?>>> mapping;
|
private final Map<String, Class<? extends IAction<?>>> mapping;
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,6 @@ public abstract class FieldExtracted {
|
||||||
if (result == null)
|
if (result == null)
|
||||||
break;
|
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) {
|
if (result instanceof Set && ((Set) result).size() > 0) {
|
||||||
try {
|
try {
|
||||||
Set t = new HashSet();
|
Set t = new HashSet();
|
||||||
|
|
@ -70,7 +66,7 @@ public abstract class FieldExtracted {
|
||||||
t.add(citem.getMethod(RfHelper.GETTER_NAME_ID).invoke(item));
|
t.add(citem.getMethod(RfHelper.GETTER_NAME_ID).invoke(item));
|
||||||
}
|
}
|
||||||
result = t;
|
result = t;
|
||||||
} catch (Throwable ignored) {// вернем сами объекты
|
} catch (Throwable ignored) {
|
||||||
}
|
}
|
||||||
} else if (result instanceof LocalDate) {
|
} else if (result instanceof LocalDate) {
|
||||||
result = result.toString();
|
result = result.toString();
|
||||||
|
|
|
||||||
|
|
@ -34,9 +34,6 @@ public class GetResponseFactory {
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* dictionaryName - это имя тэга внутри <enum>
|
|
||||||
*/
|
|
||||||
public Map<String, Object> responseFromDictionary(String dictionaryName, Object o) {
|
public Map<String, Object> responseFromDictionary(String dictionaryName, Object o) {
|
||||||
ObjectExtracted objectExtracted = meta.getEnumsExtractedByTagName().get(dictionaryName);
|
ObjectExtracted objectExtracted = meta.getEnumsExtractedByTagName().get(dictionaryName);
|
||||||
if (objectExtracted == null) {
|
if (objectExtracted == null) {
|
||||||
|
|
@ -53,12 +50,6 @@ public class GetResponseFactory {
|
||||||
return responseFromObjectExtracted(o, objExtr);
|
return responseFromObjectExtracted(o, objExtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Варианты методов с Class сделаны для сценариев, когда хотим распарсить объект,
|
|
||||||
* по мете для родительского класса объекта
|
|
||||||
* Т.е. вместо извлечение класса o.getClass, берем clazz извне. clazz - base class для o
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public <T> Collection<Map<String, Object>> responseFromObjectCollection(Collection<?> o, Class<T> clazz) {
|
public <T> Collection<Map<String, Object>> responseFromObjectCollection(Collection<?> o, Class<T> clazz) {
|
||||||
return o.stream()
|
return o.stream()
|
||||||
.map((Function<Object, Map<String, Object>>) o1 -> responseFromObject(o1, clazz))
|
.map((Function<Object, Map<String, Object>>) o1 -> responseFromObject(o1, clazz))
|
||||||
|
|
@ -82,7 +73,6 @@ public class GetResponseFactory {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
currentField = field;
|
currentField = field;
|
||||||
// if (fieldsToAdd.contains(field.getField().getCode())) {
|
|
||||||
try {
|
try {
|
||||||
add(r, field, field.extractValue(o));
|
add(r, field, field.extractValue(o));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
@ -95,7 +85,6 @@ public class GetResponseFactory {
|
||||||
)))
|
)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(ExceptionUtils.getStackTrace(e));
|
log.error(ExceptionUtils.getStackTrace(e));
|
||||||
|
|
@ -134,45 +123,4 @@ public class GetResponseFactory {
|
||||||
.ofPattern("yyyy-MM-dd'T'HH:mm:ss+03:00")
|
.ofPattern("yyyy-MM-dd'T'HH:mm:ss+03:00")
|
||||||
.withLocale(Locale.US)
|
.withLocale(Locale.US)
|
||||||
.withZone(ZoneId.of("Europe/Moscow"));
|
.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;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ public class MetaServer extends MetaBase {
|
||||||
log.warn("META SERVER >>> {}", e.getLocalizedMessage());
|
log.warn("META SERVER >>> {}", e.getLocalizedMessage());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String actionDestination = // обычно бывают =null о этому эффективнее по имени класса а не по: objectElement.getSubscription().destination + "/"+ actionElement.getDestination();
|
String actionDestination =
|
||||||
oe.getClassName();
|
oe.getClassName();
|
||||||
actionObjectsExtracted.put(actionDestination, oe);
|
actionObjectsExtracted.put(actionDestination, oe);
|
||||||
}
|
}
|
||||||
|
|
@ -101,20 +101,6 @@ public class MetaServer extends MetaBase {
|
||||||
log.warn("{} {}", key, ExceptionUtils.getStackTrace(e));
|
log.warn("{} {}", key, ExceptionUtils.getStackTrace(e));
|
||||||
continue;
|
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);
|
enumsExtractedByTagName.put(key, oe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +113,6 @@ public class MetaServer extends MetaBase {
|
||||||
if (!RfHelper.isAbstract(o.getClazz())) {
|
if (!RfHelper.isAbstract(o.getClazz())) {
|
||||||
try {
|
try {
|
||||||
Object instance = newInstance(o.getClassName());
|
Object instance = newInstance(o.getClassName());
|
||||||
// создается успешно.
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.warn("META SERVER >>> Не удается создать класс {} !", o.getClassName());
|
log.warn("META SERVER >>> Не удается создать класс {} !", o.getClassName());
|
||||||
}
|
}
|
||||||
|
|
@ -139,32 +124,8 @@ public class MetaServer extends MetaBase {
|
||||||
throw new ClearingMetaServerValidationException(e.getLocalizedMessage());
|
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 {
|
private void validateGetterForObject(ObjectExtracted o) throws ClassNotFoundException {
|
||||||
for (FieldExtracted field : o.getFields()) {
|
for (FieldExtracted field : o.getFields()) {
|
||||||
Class<?> c = o.getClazz();
|
Class<?> c = o.getClazz();
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ public class RfHelper {
|
||||||
Class<?> raw = Class.forName(((ParameterizedType) t).getRawType().getTypeName());
|
Class<?> raw = Class.forName(((ParameterizedType) t).getRawType().getTypeName());
|
||||||
if (BUSINESS_OBJECT_REF.equals(raw.getSimpleName())) {
|
if (BUSINESS_OBJECT_REF.equals(raw.getSimpleName())) {
|
||||||
return Class.forName(((ParameterizedType) t).getActualTypeArguments()[0].getTypeName());
|
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());
|
return Class.forName(raw.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,6 @@ public class KeycloakRestTemplateAuthenticationProvider implements Authenticatio
|
||||||
throw new AuthenticationServiceException("keycloak direct access grant auth failed: bad token");
|
throw new AuthenticationServiceException("keycloak direct access grant auth failed: bad token");
|
||||||
}
|
}
|
||||||
AccessToken accessToken = AdapterTokenVerifier.verifyToken(accessTokenString, deployment);
|
AccessToken accessToken = AdapterTokenVerifier.verifyToken(accessTokenString, deployment);
|
||||||
//todo cors settings
|
|
||||||
accessToken.setAllowedOrigins(Collections.singleton("*"));
|
accessToken.setAllowedOrigins(Collections.singleton("*"));
|
||||||
|
|
||||||
RefreshableKeycloakSecurityContext skSession = new RefreshableKeycloakSecurityContext(deployment, null, accessTokenString, accessToken, null, null, refreshTokenString);
|
RefreshableKeycloakSecurityContext skSession = new RefreshableKeycloakSecurityContext(deployment, null, accessTokenString, accessToken, null, null, refreshTokenString);
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,17 @@ import org.keycloak.KeycloakPrincipal;
|
||||||
import org.keycloak.adapters.spi.KeycloakAccount;
|
import org.keycloak.adapters.spi.KeycloakAccount;
|
||||||
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
|
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
public class KeycloakUtils {
|
public class KeycloakUtils {
|
||||||
static Logger log = LoggerFactory.getLogger(KeycloakUtils.class);
|
static Logger log = LoggerFactory.getLogger(KeycloakUtils.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* Достать username из Keycloak имплементации Authentication
|
|
||||||
*/
|
|
||||||
public static String getUserNameFromAuthentication(Authentication authentication) {
|
public static String getUserNameFromAuthentication(Authentication authentication) {
|
||||||
if (authentication == null) return null;
|
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());
|
log.trace("Authentication token class {} is not KeycloakAuthenticationToken", authentication.getClass().getName());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,11 +20,6 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
|
||||||
* при bearer only false
|
|
||||||
* клиент сюда не попадает
|
|
||||||
* срабатывает KeycloakAuthenticationProvider с редиректом на логин keycloak
|
|
||||||
*/
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/sso")
|
@RequestMapping("/sso")
|
||||||
public class LoginController {
|
public class LoginController {
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,6 @@ public class RestTemplateConfig {
|
||||||
this.builder = builder;
|
this.builder = builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* В настоящий момент используется для выгрузки AFS данных
|
|
||||||
*/
|
|
||||||
@Bean("clearing-rest")
|
@Bean("clearing-rest")
|
||||||
public RestTemplate restTemplate() {
|
public RestTemplate restTemplate() {
|
||||||
return builder
|
return builder
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,7 @@ import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class SimpleUserDetailService
|
public class SimpleUserDetailService
|
||||||
// implements UserDetailsService
|
|
||||||
{
|
{
|
||||||
// @Override
|
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,10 +52,6 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
super.configure(http);
|
super.configure(http);
|
||||||
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.AuthorizedUrl anyReq = http
|
ExpressionUrlAuthorizationConfigurer<HttpSecurity>.AuthorizedUrl anyReq = http
|
||||||
// .formLogin()
|
|
||||||
// .loginProcessingUrl("/backend-api-login/perform-login")
|
|
||||||
// .and()
|
|
||||||
//todo remove? see ClearingCorsFilter
|
|
||||||
.cors()
|
.cors()
|
||||||
.and()
|
.and()
|
||||||
.csrf().disable()
|
.csrf().disable()
|
||||||
|
|
@ -84,7 +80,6 @@ public class WebSecurityConfig extends KeycloakWebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public GrantedAuthorityDefaults grantedAuthorityDefaults() {
|
public GrantedAuthorityDefaults grantedAuthorityDefaults() {
|
||||||
// Remove the ROLE_ prefix
|
|
||||||
return new GrantedAuthorityDefaults("");
|
return new GrantedAuthorityDefaults("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,16 +8,5 @@ import java.util.concurrent.ExecutionException;
|
||||||
public interface IOperator {
|
public interface IOperator {
|
||||||
QueueSuccessResponse sendRequestToQueue(String destination, IAction<?> iAction, boolean appendUserId) throws ExecutionException, InterruptedException;
|
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;
|
QueueSuccessResponse sendRequestToQueue(String destination, IAction<?> iAction, Long userId) throws ExecutionException, InterruptedException;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,6 @@ import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
|
||||||
* сделал чтобы не привязывать все контроллеры к Imdg API
|
|
||||||
*/
|
|
||||||
public interface IStateLoader {
|
public interface IStateLoader {
|
||||||
<T extends SpcexObjectBase> Optional<T> getById(Long id, String mapName, Class<T> clazz);
|
<T extends SpcexObjectBase> Optional<T> getById(Long id, String mapName, Class<T> clazz);
|
||||||
<T extends SpcexObjectBase> Collection<T> getAll(String mapName, Class<T> clazz);
|
<T extends SpcexObjectBase> Collection<T> getAll(String mapName, Class<T> clazz);
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,6 @@ import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate;
|
||||||
import ru.spcex.platform.imdg.api.Imdg;
|
import ru.spcex.platform.imdg.api.Imdg;
|
||||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||||
|
|
||||||
/**
|
|
||||||
* Сервис для сигнализирования результатов запросов клиентов. Ассинхронное обновление статуса.
|
|
||||||
* Клиент запрашивает периодически (или по событию) таблицу Map_RequestInfo и видит результат выполнения запросов.
|
|
||||||
*/
|
|
||||||
@Service
|
@Service
|
||||||
public class RequestInfoAccepter extends QueueConsumer implements InitializingBean {
|
public class RequestInfoAccepter extends QueueConsumer implements InitializingBean {
|
||||||
private final Logger log = LoggerFactory.getLogger(getClass());
|
private final Logger log = LoggerFactory.getLogger(getClass());
|
||||||
|
|
@ -39,7 +35,6 @@ public class RequestInfoAccepter extends QueueConsumer implements InitializingBe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRequestInfo(BaseRequest<RequestInfoUpdate> requestInfoUpdateBaseRequest) {
|
private void updateRequestInfo(BaseRequest<RequestInfoUpdate> requestInfoUpdateBaseRequest) {
|
||||||
//will throw exception for any class other than RequestInfoUpdate
|
|
||||||
RequestInfoUpdate statusInfo = requestInfoUpdateBaseRequest.getRequestPayload();
|
RequestInfoUpdate statusInfo = requestInfoUpdateBaseRequest.getRequestPayload();
|
||||||
if (statusInfo == null || statusInfo.getId() == null) {
|
if (statusInfo == null || statusInfo.getId() == null) {
|
||||||
log.warn("BaseRequest id={}, RequestPayload={}: requestInfo id was null",
|
log.warn("BaseRequest id={}, RequestPayload={}: requestInfo id was null",
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ public class UserAuthProcessor {
|
||||||
requestData.setUsername(identifier);
|
requestData.setUsername(identifier);
|
||||||
requestData.setTime(Instant.now());
|
requestData.setTime(Instant.now());
|
||||||
requestData.setRoles(new ArrayList<>(roles));
|
requestData.setRoles(new ArrayList<>(roles));
|
||||||
requestData.setServerIp(serverIp + ":" + serverPort); //getServerAddress() + ":" + serverPort
|
requestData.setServerIp(serverIp + ":" + serverPort);
|
||||||
requestData.setClientIp(userIp);
|
requestData.setClientIp(userIp);
|
||||||
requestData.setEmail(email);
|
requestData.setEmail(email);
|
||||||
requestData.setName(name);
|
requestData.setName(name);
|
||||||
|
|
@ -48,7 +48,7 @@ public class UserAuthProcessor {
|
||||||
requestData.setMiddleName(middleName);
|
requestData.setMiddleName(middleName);
|
||||||
try {
|
try {
|
||||||
operator.sendRequestToQueue(Consts.USER_AUTH_SUCCESS, authEvent, false);
|
operator.sendRequestToQueue(Consts.USER_AUTH_SUCCESS, authEvent, false);
|
||||||
} catch (Throwable e) { //ExecutionException | InterruptedException
|
} catch (Throwable e) {
|
||||||
log.error(ExceptionUtils.getStackTrace(e));
|
log.error(ExceptionUtils.getStackTrace(e));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,8 @@ public class OperatorImpl implements IOperator {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
log.warn("UserID not found by login \"{}\"", username);
|
log.warn("UserID not found by login \"{}\"", username);
|
||||||
return null;
|
return null;
|
||||||
//throw new IllegalStateException("cannot obtain userId from logged in user " + username);
|
|
||||||
}
|
}
|
||||||
return user.getId();
|
return user.getId();
|
||||||
// todo добавить кэш, с очисткой по времени
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -78,7 +76,6 @@ public class OperatorImpl implements IOperator {
|
||||||
if (appendUserId) {
|
if (appendUserId) {
|
||||||
request.setUserId(currentUserId());
|
request.setUserId(currentUserId());
|
||||||
}
|
}
|
||||||
//сохраняет данные о запросе в хранилище
|
|
||||||
saveRequestToStorage(destination, request);
|
saveRequestToStorage(destination, request);
|
||||||
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
|
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
|
||||||
send.get();
|
send.get();
|
||||||
|
|
@ -98,7 +95,6 @@ public class OperatorImpl implements IOperator {
|
||||||
} else {
|
} else {
|
||||||
request.setUserId(userId);
|
request.setUserId(userId);
|
||||||
}
|
}
|
||||||
//сохраняет данные о запросе в хранилище
|
|
||||||
saveRequestToStorage(destination, request);
|
saveRequestToStorage(destination, request);
|
||||||
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
|
Future<RecordMetadata> send = kafka.send(new ProducerRecord<>(destination, request));
|
||||||
send.get();
|
send.get();
|
||||||
|
|
@ -114,12 +110,10 @@ public class OperatorImpl implements IOperator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void throwValidate(String destination, IAction<?> iAction) {
|
private void throwValidate(String destination, IAction<?> iAction) {
|
||||||
//простая валидация - которую можно запилить прямо внутри класса (наличие полей, отношения между датами etc.)
|
|
||||||
Collection<EnumMessage> validationErrors = iAction.validate();
|
Collection<EnumMessage> validationErrors = iAction.validate();
|
||||||
if (validationErrors.size() > 0) {
|
if (validationErrors.size() > 0) {
|
||||||
throw new ActionValidationException(validationErrors);
|
throw new ActionValidationException(validationErrors);
|
||||||
}
|
}
|
||||||
// Валидация по мете (рекомендуется использовать её,а не iAction.validate();
|
|
||||||
IValidator metaValidator = actionMetaValidation.getValidator(destination, iAction);
|
IValidator metaValidator = actionMetaValidation.getValidator(destination, iAction);
|
||||||
if (metaValidator != null) {
|
if (metaValidator != null) {
|
||||||
metaValidator.tillFirstError().ifPresent(enumMessage -> {
|
metaValidator.tillFirstError().ifPresent(enumMessage -> {
|
||||||
|
|
@ -130,8 +124,6 @@ public class OperatorImpl implements IOperator {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//валидация требующая IMDG поиска других сущностей и т.д.
|
|
||||||
IValidator validator = validation.getValidator(destination, iAction);
|
IValidator validator = validation.getValidator(destination, iAction);
|
||||||
if (validator != null) {
|
if (validator != null) {
|
||||||
validator.tillFirstError().ifPresent(enumMessage -> {
|
validator.tillFirstError().ifPresent(enumMessage -> {
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,6 @@ import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
/**
|
|
||||||
* Проверка обязательности полей для IAction по мете
|
|
||||||
*/
|
|
||||||
@Component
|
@Component
|
||||||
public class ActionMetaValidation implements InitializingBean {
|
public class ActionMetaValidation implements InitializingBean {
|
||||||
protected static final Logger log = LoggerFactory.getLogger(ActionMetaValidation.class);
|
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) {
|
public IValidator getValidator(String destination, Object action) {
|
||||||
if (action == null)
|
if (action == null)
|
||||||
return null;
|
return null;
|
||||||
//if (destination == null) destination = action.getClass().getName();
|
String actionDestination = action.getClass().getName();
|
||||||
String actionDestination = action.getClass().getName(); // см. реализацию в MetaServer String actionDestination =...
|
|
||||||
Function<Object, IValidator> constructor = (Function<Object, IValidator>) validators.get(actionDestination);
|
Function<Object, IValidator> constructor = (Function<Object, IValidator>) validators.get(actionDestination);
|
||||||
if (constructor != null)
|
if (constructor != null)
|
||||||
return constructor.apply(action);
|
return constructor.apply(action);
|
||||||
|
|
@ -70,10 +66,8 @@ public class ActionMetaValidation implements InitializingBean {
|
||||||
private <T extends Object> Function<T, IValidator> validatorConstructor(ObjectExtracted metaAction) {
|
private <T extends Object> Function<T, IValidator> validatorConstructor(ObjectExtracted metaAction) {
|
||||||
if (!metaAction.getFields().stream().anyMatch(field -> isTrue(field.getField().isRequired()))) {
|
if (!metaAction.getFields().stream().anyMatch(field -> isTrue(field.getField().isRequired()))) {
|
||||||
log.debug("Action {}: no any required fields. Do not need validator.", metaAction.getClassName());
|
log.debug("Action {}: no any required fields. Do not need validator.", metaAction.getClassName());
|
||||||
// нет обязательных полей для валидации
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Тестирование getter
|
|
||||||
{
|
{
|
||||||
Object object;
|
Object object;
|
||||||
try {
|
try {
|
||||||
|
|
@ -104,7 +98,6 @@ public class ActionMetaValidation implements InitializingBean {
|
||||||
ctx.setValidatedObject(iAcc);
|
ctx.setValidatedObject(iAcc);
|
||||||
ValidatorImpl<ImdgValidationContext<T>> iValidator = new ValidatorImpl(ctx);
|
ValidatorImpl<ImdgValidationContext<T>> iValidator = new ValidatorImpl(ctx);
|
||||||
iValidator.addRule(metaValidatorRule);
|
iValidator.addRule(metaValidatorRule);
|
||||||
// в дальнейшем можно улучшить и разделить валидатор по полям
|
|
||||||
return iValidator;
|
return iValidator;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -125,12 +118,9 @@ public class ActionMetaValidation implements InitializingBean {
|
||||||
Object value = field.extractValue(object);
|
Object value = field.extractValue(object);
|
||||||
if (value == null)
|
if (value == null)
|
||||||
return of(BackEndError.ValidationError, field.getMemberName());
|
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) {
|
} catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
|
||||||
if (object instanceof MoneyMarketSecurityUpdateAction) {
|
if (object instanceof MoneyMarketSecurityUpdateAction) {
|
||||||
//todo в мете для moneyMarketSecurity / actions / put / для поля lotSize field="securityId" исключение - там надо оставить field, требуется для frontend
|
|
||||||
if (((MoneyMarketSecurityUpdateAction) object).getLotSize() == null)
|
if (((MoneyMarketSecurityUpdateAction) object).getLotSize() == null)
|
||||||
return of(BackEndError.ValidationError, "LotSize");
|
return of(BackEndError.ValidationError, "LotSize");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -81,14 +81,11 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
||||||
|
|
||||||
|
|
||||||
@ContextConfiguration(classes = {
|
@ContextConfiguration(classes = {
|
||||||
//account
|
|
||||||
AccountController.class,
|
AccountController.class,
|
||||||
BankAccountController.class,
|
BankAccountController.class,
|
||||||
ClearingAccountController.class,
|
ClearingAccountController.class,
|
||||||
DepoAccountController.class,
|
DepoAccountController.class,
|
||||||
//account misc
|
|
||||||
ClientCodeController.class,
|
ClientCodeController.class,
|
||||||
//company
|
|
||||||
CompanyRoleSetController.class,
|
CompanyRoleSetController.class,
|
||||||
CompanyController.class,
|
CompanyController.class,
|
||||||
ClearingMemberCategoryController.class,
|
ClearingMemberCategoryController.class,
|
||||||
|
|
@ -97,24 +94,18 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
||||||
ContactController.class,
|
ContactController.class,
|
||||||
ProfileDocumentController.class,
|
ProfileDocumentController.class,
|
||||||
RelationController.class,
|
RelationController.class,
|
||||||
//execution
|
|
||||||
ExecutionDepositController.class,
|
ExecutionDepositController.class,
|
||||||
ExecutionFondController.class,
|
ExecutionFondController.class,
|
||||||
//journal
|
|
||||||
InDocumentJournalController.class,
|
InDocumentJournalController.class,
|
||||||
ManagementJournalController.class,
|
ManagementJournalController.class,
|
||||||
OutDocumentJournalController.class,
|
OutDocumentJournalController.class,
|
||||||
//liabilities
|
|
||||||
//misc
|
|
||||||
CurrencyController.class,
|
CurrencyController.class,
|
||||||
ErrorTextController.class,
|
ErrorTextController.class,
|
||||||
ListingController.class,
|
ListingController.class,
|
||||||
MarketController.class,
|
MarketController.class,
|
||||||
NotificationController.class,
|
NotificationController.class,
|
||||||
SessionController.class,
|
SessionController.class,
|
||||||
//payment
|
|
||||||
PaymentInstructionController.class,
|
PaymentInstructionController.class,
|
||||||
//register
|
|
||||||
AdmittedLiabilitiesRegisterController.class,
|
AdmittedLiabilitiesRegisterController.class,
|
||||||
CoveredLiabilitiesRegisterController.class,
|
CoveredLiabilitiesRegisterController.class,
|
||||||
DepoBalanceRegisterController.class,
|
DepoBalanceRegisterController.class,
|
||||||
|
|
@ -125,16 +116,13 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
||||||
MoneyBalanceRegisterController.class,
|
MoneyBalanceRegisterController.class,
|
||||||
ContractRegisterController.class,
|
ContractRegisterController.class,
|
||||||
ReportRegisterController.class,
|
ReportRegisterController.class,
|
||||||
//registry
|
|
||||||
RegistryController.class,
|
RegistryController.class,
|
||||||
TradingClearingRegistryController.class,
|
TradingClearingRegistryController.class,
|
||||||
//scheduler
|
|
||||||
ClearingCalendarController.class,
|
ClearingCalendarController.class,
|
||||||
LauncherController.class,
|
LauncherController.class,
|
||||||
PlannerAllTodayController.class,
|
PlannerAllTodayController.class,
|
||||||
PlannerController.class,
|
PlannerController.class,
|
||||||
PlannerTemplateController.class,
|
PlannerTemplateController.class,
|
||||||
//securities
|
|
||||||
MoneyMarketSecurityController.class,
|
MoneyMarketSecurityController.class,
|
||||||
CouponPeriodController.class,
|
CouponPeriodController.class,
|
||||||
EquitySecurityController.class,
|
EquitySecurityController.class,
|
||||||
|
|
@ -142,13 +130,10 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
||||||
FixedIncomeSecurityController.class,
|
FixedIncomeSecurityController.class,
|
||||||
InformationAccountController.class,
|
InformationAccountController.class,
|
||||||
SecurityController.class,
|
SecurityController.class,
|
||||||
//user
|
|
||||||
UserController.class,
|
UserController.class,
|
||||||
UserRoleSessionController.class,
|
UserRoleSessionController.class,
|
||||||
//utilities
|
|
||||||
StatementController.class,
|
StatementController.class,
|
||||||
UserSettingsController.class,
|
UserSettingsController.class,
|
||||||
//******* common configs *******
|
|
||||||
WebTestConfig.class,
|
WebTestConfig.class,
|
||||||
IOperatorTest.class,
|
IOperatorTest.class,
|
||||||
HazelcastServiceTestConfiguration.class,
|
HazelcastServiceTestConfiguration.class,
|
||||||
|
|
@ -156,10 +141,8 @@ import static ru.spcex.clearing.test.json.MatcherFactoryWithJson.usingIgnoringFi
|
||||||
WebSecurityTestConfigurer.class,
|
WebSecurityTestConfigurer.class,
|
||||||
MessagesTestConfig.class,
|
MessagesTestConfig.class,
|
||||||
Jackson2HttpConverterTestConfig.class})
|
Jackson2HttpConverterTestConfig.class})
|
||||||
//todo может быть указать пакедж а не список контроллеров
|
|
||||||
@ExtendWith(SpringExtension.class)
|
@ExtendWith(SpringExtension.class)
|
||||||
@WebMvcTest
|
@WebMvcTest
|
||||||
//@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/")
|
|
||||||
public abstract class AbstractControllerTest {
|
public abstract class AbstractControllerTest {
|
||||||
protected static final MatcherFactoryWithJson.Matcher<BaseRequest> BASE_REQUEST_MATCHER = usingIgnoringFieldsComparatorForClass(BaseRequest.class,"userId");
|
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);
|
protected static final MatcherFactoryWithJson.Matcher<CudResponse> CUD_RESPONSE_MATCHER = usingIgnoringFieldsComparatorForClass(CudResponse.class);
|
||||||
|
|
@ -200,7 +183,6 @@ public abstract class AbstractControllerTest {
|
||||||
mockMvc = MockMvcBuilders
|
mockMvc = MockMvcBuilders
|
||||||
.webAppContextSetup(webApplicationContext)
|
.webAppContextSetup(webApplicationContext)
|
||||||
.addFilter(CHARACTER_ENCODING_FILTER)
|
.addFilter(CHARACTER_ENCODING_FILTER)
|
||||||
// .apply(springSecurity())
|
|
||||||
.build();
|
.build();
|
||||||
TestUtils.FutureRecordMetadata future = spy(TestUtils.FutureRecordMetadata.class);
|
TestUtils.FutureRecordMetadata future = spy(TestUtils.FutureRecordMetadata.class);
|
||||||
doReturn(future).when(producer).send(producerRecord.capture());
|
doReturn(future).when(producer).send(producerRecord.capture());
|
||||||
|
|
@ -225,15 +207,12 @@ public abstract class AbstractControllerTest {
|
||||||
CudResponse expected = new CudResponse();
|
CudResponse expected = new CudResponse();
|
||||||
expected.setCode(0L);
|
expected.setCode(0L);
|
||||||
expected.setMessage("success");
|
expected.setMessage("success");
|
||||||
//ACT
|
|
||||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL)
|
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(writeValue(action)))
|
.content(writeValue(action)))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
//.andExpect(content().json(writeValue(expected)))
|
|
||||||
.andReturn();
|
.andReturn();
|
||||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
||||||
|
|
@ -245,16 +224,12 @@ public abstract class AbstractControllerTest {
|
||||||
expected.setCode(0L);
|
expected.setCode(0L);
|
||||||
expected.setMessage("success");
|
expected.setMessage("success");
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
|
||||||
|
|
||||||
//ACT
|
|
||||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL + existsId)
|
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL + existsId)
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(writeValue(action)))
|
.content(writeValue(action)))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
//.andExpect(content().json(writeValue(expected)));
|
|
||||||
.andReturn();
|
.andReturn();
|
||||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
|
||||||
|
|
@ -273,16 +248,12 @@ public abstract class AbstractControllerTest {
|
||||||
expected.setCode(0L);
|
expected.setCode(0L);
|
||||||
expected.setMessage("success");
|
expected.setMessage("success");
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement()));
|
||||||
|
|
||||||
//ACT
|
|
||||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL)
|
MvcResult mvcResult = perform(MockMvcRequestBuilders.put(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(writeValue(action)))
|
.content(writeValue(action)))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
//.andExpect(content().json(writeValue(expected)));
|
|
||||||
.andReturn();
|
.andReturn();
|
||||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, cudResponseTest.getPayload().getId()));
|
||||||
|
|
@ -296,14 +267,11 @@ public abstract class AbstractControllerTest {
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, existsId));
|
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, existsId));
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(existsId);
|
deleteAction.setId(existsId);
|
||||||
//ACT
|
|
||||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.delete(REST_URL + existsId)
|
MvcResult mvcResult = perform(MockMvcRequestBuilders.delete(REST_URL + existsId)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
// .andExpect(content().json(writeValue(expected)));
|
|
||||||
.andReturn();
|
.andReturn();
|
||||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, cudResponseTest.getPayload().getId()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, cudResponseTest.getPayload().getId()));
|
||||||
|
|
@ -320,18 +288,15 @@ public abstract class AbstractControllerTest {
|
||||||
protected <T extends SpcexObjectBase> void checkGettingAllFromRestApi(String imdgDistributedNames, T existsObj, String restUrl) throws Exception {
|
protected <T extends SpcexObjectBase> void checkGettingAllFromRestApi(String imdgDistributedNames, T existsObj, String restUrl) throws Exception {
|
||||||
Class<T> clazz = (Class<T>) existsObj.getClass();
|
Class<T> clazz = (Class<T>) existsObj.getClass();
|
||||||
Imdg<T> testingImdg = hazelcastServiceTest.getImdg(imdgDistributedNames, clazz);
|
Imdg<T> testingImdg = hazelcastServiceTest.getImdg(imdgDistributedNames, clazz);
|
||||||
// ((ImdgHazelcast<T>)testingImdg).clear(); // предварительная очистка
|
|
||||||
testingImdg.insert(existsObj);
|
testingImdg.insert(existsObj);
|
||||||
|
|
||||||
Collection<T> values = testingImdg.getAllValues();
|
Collection<T> values = testingImdg.getAllValues();
|
||||||
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
||||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||||
expected.fromEntity(all);
|
expected.fromEntity(all);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(restUrl)
|
perform(MockMvcRequestBuilders.get(restUrl)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
// ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
|
|
|
||||||
|
|
@ -12,51 +12,28 @@ import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
class AccountControllerTest extends AbstractControllerTest {
|
class AccountControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/accounting/accounts/";
|
private static final String REST_URL = "/accounting/accounts/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link AccountController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
|
||||||
* Входной запрос /accounting/accounts/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Account existBankAccount = new Account();
|
Account existBankAccount = new Account();
|
||||||
existBankAccount.setAccountType("99");
|
existBankAccount.setAccountType("99");
|
||||||
existBankAccount.setAccount("123456789123");
|
existBankAccount.setAccount("123456789123");
|
||||||
existBankAccount.setId(currentId.get());
|
existBankAccount.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Account, existBankAccount, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Account, existBankAccount, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link AccountController#add(AccountNewAction)} <br>
|
|
||||||
* Тест проверяет получение сущности {@link AccountNewAction} по REST API и отправку в Apache Kafka.<br>
|
|
||||||
* Входной запрос {@link AccountNewAction}:<br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
AccountNewAction accountNewAction = new AccountNewAction();
|
AccountNewAction accountNewAction = new AccountNewAction();
|
||||||
accountNewAction.setStatus("ACTV");
|
accountNewAction.setStatus("ACTV");
|
||||||
accountNewAction.setAccount("A11112222333");
|
accountNewAction.setAccount("A11112222333");
|
||||||
accountNewAction.setCompanyId(5L);
|
accountNewAction.setCompanyId(5L);
|
||||||
accountNewAction.setAccountType("BANK");
|
accountNewAction.setAccountType("BANK");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, accountNewAction);
|
checkAddingByRestApi(REST_URL, accountNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_NEW, 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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
AccountUpdateAction accountUpdateAction = new AccountUpdateAction();
|
AccountUpdateAction accountUpdateAction = new AccountUpdateAction();
|
||||||
accountUpdateAction.setId(id);
|
accountUpdateAction.setId(id);
|
||||||
|
|
@ -65,27 +42,17 @@ class AccountControllerTest extends AbstractControllerTest {
|
||||||
accountUpdateAction.setCompanyId(5L);
|
accountUpdateAction.setCompanyId(5L);
|
||||||
accountUpdateAction.setAccountType("BANK");
|
accountUpdateAction.setAccountType("BANK");
|
||||||
Account account = getAccount(id);
|
Account account = getAccount(id);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
||||||
REST_URL, accountUpdateAction, id);
|
REST_URL, accountUpdateAction, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_UPDATE, accountUpdateAction);
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
Account account = getAccount(id);
|
Account account = getAccount(id);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
checkDeletingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Account, account,
|
||||||
REST_URL, id);
|
REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, deleteAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CORRESPONDENT_ACCOUNT_BLOCK, deleteAction);
|
||||||
|
|
|
||||||
|
|
@ -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.BankAccountNewAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction;
|
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.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.controller.response.entity.CommonGetByIdResponse;
|
||||||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||||
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
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 ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -30,23 +28,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class BankAccountControllerTest extends AbstractControllerTest {
|
class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/accounting/bank-accounts/";
|
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
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
BankAccountNewAction bankAccountNewAction = getBankAccountNewAction(
|
BankAccountNewAction bankAccountNewAction = getBankAccountNewAction(
|
||||||
0, "044525776",
|
0, "044525776",
|
||||||
"Beta Money Bank",
|
"Beta Money Bank",
|
||||||
|
|
@ -57,26 +40,10 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
"3664011397",
|
"3664011397",
|
||||||
"01",
|
"01",
|
||||||
"11111222223333344444");
|
"11111222223333344444");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, bankAccountNewAction);
|
checkAddingByRestApi(REST_URL, bankAccountNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_NEW, 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
|
@Test
|
||||||
void addWithException() {
|
void addWithException() {
|
||||||
assertThrowsFor(getBankAccountNewAction(0, "", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", "11111222223333344444"));
|
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", ""));
|
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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = 0;
|
long id = 0;
|
||||||
BankAccountUpdateAction bankAccountUpdateAction = getBankAccountUpdateAction(
|
BankAccountUpdateAction bankAccountUpdateAction = getBankAccountUpdateAction(
|
||||||
id,
|
id,
|
||||||
|
|
@ -118,37 +71,21 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
"3664011397",
|
"3664011397",
|
||||||
"01",
|
"01",
|
||||||
"11111222223333344444");
|
"11111222223333344444");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, bankAccountUpdateAction, id);
|
checkUpdatingByRestApi(REST_URL, bankAccountUpdateAction, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_UPDATE, bankAccountUpdateAction);
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingByRestApi(REST_URL, id);
|
checkDeletingByRestApi(REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_BANK_ACCOUNT_BLOCK, deleteAction);
|
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
|
@Test
|
||||||
void getById() throws Exception {
|
void getById() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
BankAccount existBankAccount = new BankAccount();
|
BankAccount existBankAccount = new BankAccount();
|
||||||
existBankAccount.setBankName("ooo tinkoff");
|
existBankAccount.setBankName("ooo tinkoff");
|
||||||
existBankAccount.setBankIdentificationCode("99999");
|
existBankAccount.setBankIdentificationCode("99999");
|
||||||
|
|
@ -164,7 +101,6 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
inDocumentJournalImdg.insert(existBankAccount);
|
inDocumentJournalImdg.insert(existBankAccount);
|
||||||
|
|
||||||
CommonGetByIdResponse expected = new CommonGetByIdResponse();
|
CommonGetByIdResponse expected = new CommonGetByIdResponse();
|
||||||
//expected.getPayload().
|
|
||||||
Map<String, Object> payload = new HashMap<>();
|
Map<String, Object> payload = new HashMap<>();
|
||||||
payload.put("bankName", "ooo tinkoff");
|
payload.put("bankName", "ooo tinkoff");
|
||||||
payload.put("bankIdentificationCode", "99999");
|
payload.put("bankIdentificationCode", "99999");
|
||||||
|
|
@ -176,25 +112,16 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
payload.put("taxRegistrationReasonCode", "886886");
|
payload.put("taxRegistrationReasonCode", "886886");
|
||||||
payload.put("id", existBankAccount.getId());
|
payload.put("id", existBankAccount.getId());
|
||||||
expected.fromEntity(payload);
|
expected.fromEntity(payload);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId())
|
perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
// ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link BankAccountController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
|
||||||
* Входной запрос /accounting/bank-accounts/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
BankAccount existBankAccount = new BankAccount();
|
BankAccount existBankAccount = new BankAccount();
|
||||||
existBankAccount.setBankName("ooo tinkoff");
|
existBankAccount.setBankName("ooo tinkoff");
|
||||||
existBankAccount.setBankIdentificationCode("99999");
|
existBankAccount.setBankIdentificationCode("99999");
|
||||||
|
|
@ -205,8 +132,6 @@ class BankAccountControllerTest extends AbstractControllerTest {
|
||||||
existBankAccount.setTaxpayerIdentificationNumber("848484848484");
|
existBankAccount.setTaxpayerIdentificationNumber("848484848484");
|
||||||
existBankAccount.setTaxRegistrationReasonCode("886886");
|
existBankAccount.setTaxRegistrationReasonCode("886886");
|
||||||
existBankAccount.setId(currentId.get());
|
existBankAccount.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_BankAccount, existBankAccount, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_BankAccount, existBankAccount, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,13 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
class ClearingAccountControllerTest extends AbstractControllerTest {
|
class ClearingAccountControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/accounting/clearing-accounts/";
|
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
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClearingAccount existClearingAccount = new ClearingAccount();
|
ClearingAccount existClearingAccount = new ClearingAccount();
|
||||||
existClearingAccount.setAccountId(99L);
|
existClearingAccount.setAccountId(99L);
|
||||||
existClearingAccount.setClearingAccountType("CATPE-1");
|
existClearingAccount.setClearingAccountType("CATPE-1");
|
||||||
existClearingAccount.setCompanyId(6L);
|
existClearingAccount.setCompanyId(6L);
|
||||||
existClearingAccount.setId(currentId.get());
|
existClearingAccount.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingAccount, existClearingAccount, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingAccount, existClearingAccount, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class ClientCodeControllerTest extends AbstractControllerTest {
|
class ClientCodeControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/client-codes/";
|
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
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClientCodeNewAction clientCodeNewAction = getClientCodeNewAction(
|
ClientCodeNewAction clientCodeNewAction = getClientCodeNewAction(
|
||||||
0,
|
0,
|
||||||
"044525776",
|
"044525776",
|
||||||
|
|
@ -40,24 +32,10 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
||||||
1010L,
|
1010L,
|
||||||
1020L,
|
1020L,
|
||||||
1030L);
|
1030L);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, clientCodeNewAction);
|
checkAddingByRestApi(REST_URL, clientCodeNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_NEW, 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
|
@Test
|
||||||
void addWithException() {
|
void addWithException() {
|
||||||
assertThrowsFor(getClientCodeNewAction(0, "", "ACTV", 1000L, 1010L, 1020L, 1030L));
|
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));
|
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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = 0;
|
long id = 0;
|
||||||
ClientCodeUpdateAction clientCodeUpdateAction = getClientCodeUpdateAction(
|
ClientCodeUpdateAction clientCodeUpdateAction = getClientCodeUpdateAction(
|
||||||
id,
|
id,
|
||||||
|
|
@ -89,37 +54,21 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
||||||
1010L,
|
1010L,
|
||||||
1020L,
|
1020L,
|
||||||
1030L);
|
1030L);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, clientCodeUpdateAction, id);
|
checkUpdatingByRestApi(REST_URL, clientCodeUpdateAction, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_UPDATE, clientCodeUpdateAction);
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingByRestApi(REST_URL, id);
|
checkDeletingByRestApi(REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_DELETE, deleteAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CLIENT_CODE_DELETE, deleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ClientCodeController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClientCode.<br>
|
|
||||||
* Входной запрос /client-codes/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClientCode existClientCode = new ClientCode();
|
ClientCode existClientCode = new ClientCode();
|
||||||
existClientCode.setCode("ooo tinkoff");
|
existClientCode.setCode("ooo tinkoff");
|
||||||
existClientCode.setCompanyId(1000L);
|
existClientCode.setCompanyId(1000L);
|
||||||
|
|
@ -130,8 +79,6 @@ class ClientCodeControllerTest extends AbstractControllerTest {
|
||||||
existClientCode.setCreated(Instant.now());
|
existClientCode.setCreated(Instant.now());
|
||||||
existClientCode.setUpdated(Instant.now());
|
existClientCode.setUpdated(Instant.now());
|
||||||
existClientCode.setId(currentId.get());
|
existClientCode.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClientCode, existClientCode, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClientCode, existClientCode, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,13 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
class DepoAccountControllerTest extends AbstractControllerTest {
|
class DepoAccountControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/accounting/depo-accounts/";
|
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
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
DepoAccount existDepoAccount = new DepoAccount();
|
DepoAccount existDepoAccount = new DepoAccount();
|
||||||
existDepoAccount.setAccountId(99L);
|
existDepoAccount.setAccountId(99L);
|
||||||
existDepoAccount.setDepoAccountType("T1001");
|
existDepoAccount.setDepoAccountType("T1001");
|
||||||
existDepoAccount.setCompanyId(6L);
|
existDepoAccount.setCompanyId(6L);
|
||||||
existDepoAccount.setId(currentId.get());
|
existDepoAccount.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoAccount, existDepoAccount, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoAccount, existDepoAccount, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,28 +3,18 @@ package ru.spcex.clearing.backendapi.controller.queue.account;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import ru.clearing.classes.statics.data.account.InformationAccount;
|
import ru.clearing.classes.statics.data.account.InformationAccount;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.account.InformationAccountController;
|
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
|
||||||
class InformationAccountControllerTest extends AbstractControllerTest {
|
class InformationAccountControllerTest extends AbstractControllerTest {
|
||||||
public static final String REST_URL = "/accounting/information-accounts/";
|
public static final String REST_URL = "/accounting/information-accounts/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link InformationAccountController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /accounting/information-accounts/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
InformationAccount informationAccount = new InformationAccount();
|
InformationAccount informationAccount = new InformationAccount();
|
||||||
informationAccount.setId(currentId.get());
|
informationAccount.setId(currentId.get());
|
||||||
informationAccount.setCompanyId(currentId.get());
|
informationAccount.setCompanyId(currentId.get());
|
||||||
informationAccount.setClearingAccountId(currentId.get());
|
informationAccount.setClearingAccountId(currentId.get());
|
||||||
informationAccount.setAccountId(currentId.get());
|
informationAccount.setAccountId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InformationAccount, informationAccount, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InformationAccount, informationAccount, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -20,88 +20,44 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class ClearingMemberCategoryControllerTest extends AbstractControllerTest {
|
class ClearingMemberCategoryControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/clearing-member-categories/";
|
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
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction();
|
ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction();
|
||||||
clearingMemberCategoryNewAction.setClearingMemberCategory("Category");
|
clearingMemberCategoryNewAction.setClearingMemberCategory("Category");
|
||||||
clearingMemberCategoryNewAction.setCompanyId(0L);
|
clearingMemberCategoryNewAction.setCompanyId(0L);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, clearingMemberCategoryNewAction);
|
checkAddingByRestApi(REST_URL, clearingMemberCategoryNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_NEW, 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() {
|
void addWithException() {
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
|
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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClearingMemberCategoryUpdateAction clearingMemberCategoryUpdateAction = new ClearingMemberCategoryUpdateAction();
|
ClearingMemberCategoryUpdateAction clearingMemberCategoryUpdateAction = new ClearingMemberCategoryUpdateAction();
|
||||||
clearingMemberCategoryUpdateAction.setClearingMemberCategory("Category");
|
clearingMemberCategoryUpdateAction.setClearingMemberCategory("Category");
|
||||||
clearingMemberCategoryUpdateAction.setId(currentId.get());
|
clearingMemberCategoryUpdateAction.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, clearingMemberCategoryUpdateAction, clearingMemberCategoryUpdateAction.getId());
|
checkUpdatingByRestApi(REST_URL, clearingMemberCategoryUpdateAction, clearingMemberCategoryUpdateAction.getId());
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE, clearingMemberCategoryUpdateAction);
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingByRestApi(REST_URL, id);
|
checkDeletingByRestApi(REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE, deleteAction);
|
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
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClearingMemberCategory clearingMemberCategory = new ClearingMemberCategory();
|
ClearingMemberCategory clearingMemberCategory = new ClearingMemberCategory();
|
||||||
clearingMemberCategory.setClearingMemberCategory("Category");
|
clearingMemberCategory.setClearingMemberCategory("Category");
|
||||||
clearingMemberCategory.setCompanyId(1000000L);
|
clearingMemberCategory.setCompanyId(1000000L);
|
||||||
clearingMemberCategory.setId(currentId.get());
|
clearingMemberCategory.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingMemberCategory, clearingMemberCategory, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingMemberCategory, clearingMemberCategory, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,41 +3,25 @@ package ru.spcex.clearing.backendapi.controller.queue.company;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import ru.clearing.classes.statics.data.company.Company;
|
import ru.clearing.classes.statics.data.company.Company;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
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.common.CommonDeleteAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanyNewAction;
|
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.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.cud.registry.TradingClearingRegistryNewRequest;
|
|
||||||
|
|
||||||
class CompanyControllerTest extends AbstractControllerTest {
|
class CompanyControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/companies/";
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingByRestApi(REST_URL, id);
|
checkDeletingByRestApi(REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_DELETE, deleteAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_DELETE, deleteAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link CompanyController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.<br>
|
|
||||||
* Входной запрос /companies <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Company existCompany = new Company();
|
Company existCompany = new Company();
|
||||||
existCompany.setTradingCode("ooo tinkoff");
|
existCompany.setTradingCode("ooo tinkoff");
|
||||||
existCompany.setClearingCode("99999");
|
existCompany.setClearingCode("99999");
|
||||||
|
|
@ -45,26 +29,12 @@ class CompanyControllerTest extends AbstractControllerTest {
|
||||||
existCompany.setShortName("OOO ROGA I KOPITA");
|
existCompany.setShortName("OOO ROGA I KOPITA");
|
||||||
existCompany.setTradingCode("848484848484");
|
existCompany.setTradingCode("848484848484");
|
||||||
existCompany.setId(currentId.get());
|
existCompany.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Company, existCompany, REST_URL);
|
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
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
CompanyNewAction newAction = getCompanyNewAction();
|
CompanyNewAction newAction = getCompanyNewAction();
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, newAction);
|
checkAddingByRestApi(REST_URL, newAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_NEW, newAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_NEW, newAction);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,51 +30,13 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class CompanyInfoControllerTest extends AbstractControllerTest {
|
class CompanyInfoControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/company-infos/";
|
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() {
|
void addWithException() {
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
|
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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
CompanyInfoUpdateAction companyInfoUpdateAction = new CompanyInfoUpdateAction();
|
CompanyInfoUpdateAction companyInfoUpdateAction = new CompanyInfoUpdateAction();
|
||||||
companyInfoUpdateAction.setWorkflowStatus("ACTV");
|
companyInfoUpdateAction.setWorkflowStatus("ACTV");
|
||||||
companyInfoUpdateAction.setCorporationSoleType("0000");
|
companyInfoUpdateAction.setCorporationSoleType("0000");
|
||||||
|
|
@ -89,21 +51,12 @@ class CompanyInfoControllerTest extends AbstractControllerTest {
|
||||||
companyInfoUpdateAction.setShortName("exists shortName");
|
companyInfoUpdateAction.setShortName("exists shortName");
|
||||||
companyInfoUpdateAction.setFullName("exists fullName");
|
companyInfoUpdateAction.setFullName("exists fullName");
|
||||||
companyInfoUpdateAction.setId(currentId.get());
|
companyInfoUpdateAction.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, companyInfoUpdateAction, companyInfoUpdateAction.getId());
|
checkUpdatingByRestApi(REST_URL, companyInfoUpdateAction, companyInfoUpdateAction.getId());
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_INFO_UPDATE, companyInfoUpdateAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_INFO_UPDATE, companyInfoUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link CompanyInfoController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.<br>
|
|
||||||
* Входной запрос /company-infos/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Long ID = 0L;
|
Long ID = 0L;
|
||||||
CompanyInfo existsCompanyInfo = new CompanyInfo();
|
CompanyInfo existsCompanyInfo = new CompanyInfo();
|
||||||
existsCompanyInfo.setId(ID);
|
existsCompanyInfo.setId(ID);
|
||||||
|
|
@ -128,17 +81,15 @@ class CompanyInfoControllerTest extends AbstractControllerTest {
|
||||||
Collection<Map<String, Object>> all = new ArrayList<>();
|
Collection<Map<String, Object>> all = new ArrayList<>();
|
||||||
Collection<Company> companies = companyImdg.getAllValues();
|
Collection<Company> companies = companyImdg.getAllValues();
|
||||||
for (Company company : companies) {
|
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()));
|
all.add(responseFactory.responseFromObject(company.getProfile()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||||
expected.fromEntity(all);
|
expected.fromEntity(all);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL)
|
perform(MockMvcRequestBuilders.get(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
|
|
|
||||||
|
|
@ -8,22 +8,12 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
class CompanyRoleSetControllerTest extends AbstractControllerTest {
|
class CompanyRoleSetControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/company-role-sets/";
|
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
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
CompanyRoleSet existBankAccount = new CompanyRoleSet();
|
CompanyRoleSet existBankAccount = new CompanyRoleSet();
|
||||||
existBankAccount.setCompanyId(11L);
|
existBankAccount.setCompanyId(11L);
|
||||||
existBankAccount.setCompanyRole("CLRM");
|
existBankAccount.setCompanyRole("CLRM");
|
||||||
existBankAccount.setId(currentId.get());
|
existBankAccount.setId(currentId.get());
|
||||||
|
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CompanyRoleSet, existBankAccount, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CompanyRoleSet, existBankAccount, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,57 +19,28 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class CompanySymbolControllerTest extends AbstractControllerTest {
|
class CompanySymbolControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/company-symbols/";
|
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() {
|
void addWithException() {
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
|
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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
CompanySymbolUpdateAction companySymbolUpdateAction = new CompanySymbolUpdateAction();
|
CompanySymbolUpdateAction companySymbolUpdateAction = new CompanySymbolUpdateAction();
|
||||||
companySymbolUpdateAction.setCompanyId(1000L);
|
companySymbolUpdateAction.setCompanyId(1000L);
|
||||||
companySymbolUpdateAction.setCompanySymbolValue("SymbolValue");
|
companySymbolUpdateAction.setCompanySymbolValue("SymbolValue");
|
||||||
companySymbolUpdateAction.setId(currentId.get());
|
companySymbolUpdateAction.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, companySymbolUpdateAction, companySymbolUpdateAction.getId());
|
checkUpdatingByRestApi(REST_URL, companySymbolUpdateAction, companySymbolUpdateAction.getId());
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_SYMBOL_UPDATE, companySymbolUpdateAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_COMPANY_SYMBOL_UPDATE, companySymbolUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link CompanySymbolController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_CompanySymbols.<br>
|
|
||||||
* Входной запрос /clearing-member-categories/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
CompanySymbols companySymbols = new CompanySymbols();
|
CompanySymbols companySymbols = new CompanySymbols();
|
||||||
companySymbols.setCompanyId(1000L);
|
companySymbols.setCompanyId(1000L);
|
||||||
companySymbols.setCompanySymbol("Symbol");
|
companySymbols.setCompanySymbol("Symbol");
|
||||||
companySymbols.setCompanySymbolValue("SymbolValue");
|
companySymbols.setCompanySymbolValue("SymbolValue");
|
||||||
companySymbols.setId(currentId.get());
|
companySymbols.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CompanySymbols, companySymbols, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CompanySymbols, companySymbols, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||||
import ru.clearing.classes.statics.data.profile.Contact;
|
import ru.clearing.classes.statics.data.profile.Contact;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
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.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.ContactNewAction;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactUpdateAction;
|
import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactUpdateAction;
|
||||||
import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
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 {
|
class ContactControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/contacts/";
|
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() {
|
void addWithException() {
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
assertThrowsFor(getClearingMemberCategoryNewAction("Category", null));
|
||||||
assertThrowsFor(getClearingMemberCategoryNewAction("", 0L));
|
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
|
@Test
|
||||||
void create() throws Exception {
|
void create() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ContactNewAction companySymbolNewAction = new ContactNewAction();
|
ContactNewAction companySymbolNewAction = new ContactNewAction();
|
||||||
companySymbolNewAction.setContactType("ContactType");
|
companySymbolNewAction.setContactType("ContactType");
|
||||||
companySymbolNewAction.setContactValue("ContactValue");
|
companySymbolNewAction.setContactValue("ContactValue");
|
||||||
companySymbolNewAction.setCompanyId(currentId.get());
|
companySymbolNewAction.setCompanyId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, companySymbolNewAction);
|
checkAddingByRestApi(REST_URL, companySymbolNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CONTACT_NEW, 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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ContactUpdateAction companySymbolUpdateAction = new ContactUpdateAction();
|
ContactUpdateAction companySymbolUpdateAction = new ContactUpdateAction();
|
||||||
companySymbolUpdateAction.setContactType("ContactType");
|
companySymbolUpdateAction.setContactType("ContactType");
|
||||||
companySymbolUpdateAction.setContactValue("ContactValue");
|
companySymbolUpdateAction.setContactValue("ContactValue");
|
||||||
companySymbolUpdateAction.setId(currentId.get());
|
companySymbolUpdateAction.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, companySymbolUpdateAction, companySymbolUpdateAction.getId());
|
checkUpdatingByRestApi(REST_URL, companySymbolUpdateAction, companySymbolUpdateAction.getId());
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CONTACT_UPDATE, companySymbolUpdateAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CONTACT_UPDATE, companySymbolUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ContactController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Contact.<br>
|
|
||||||
* Входной запрос /contacts/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Contact companySymbolUpdateAction = new Contact();
|
Contact companySymbolUpdateAction = new Contact();
|
||||||
companySymbolUpdateAction.setCompanyId(1000L);
|
companySymbolUpdateAction.setCompanyId(1000L);
|
||||||
companySymbolUpdateAction.setContactType("ContactType");
|
companySymbolUpdateAction.setContactType("ContactType");
|
||||||
companySymbolUpdateAction.setContactValue("ContactValue");
|
companySymbolUpdateAction.setContactValue("ContactValue");
|
||||||
companySymbolUpdateAction.setId(currentId.get());
|
companySymbolUpdateAction.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Contact, companySymbolUpdateAction, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Contact, companySymbolUpdateAction, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,8 @@ import java.time.LocalDate;
|
||||||
class ProfileDocumentControllerTest extends AbstractControllerTest {
|
class ProfileDocumentControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/profile-documents/";
|
private static final String REST_URL = "/profile-documents/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ProfileDocumentController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ProfileDocument.<br>
|
|
||||||
* Входной запрос /profile-documents/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ProfileDocument profileDocument = new ProfileDocument();
|
ProfileDocument profileDocument = new ProfileDocument();
|
||||||
profileDocument.setCompanyId(1000L);
|
profileDocument.setCompanyId(1000L);
|
||||||
profileDocument.setDocumentType("DocumentType");
|
profileDocument.setDocumentType("DocumentType");
|
||||||
|
|
@ -33,8 +26,6 @@ class ProfileDocumentControllerTest extends AbstractControllerTest {
|
||||||
profileDocument.setValidToDate(LocalDate.now());
|
profileDocument.setValidToDate(LocalDate.now());
|
||||||
profileDocument.setLink("Link");
|
profileDocument.setLink("Link");
|
||||||
profileDocument.setId(currentId.get());
|
profileDocument.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ProfileDocument, profileDocument, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ProfileDocument, profileDocument, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,15 +19,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class RelationControllerTest extends AbstractControllerTest {
|
class RelationControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/relations/";
|
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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Long existsId = 123L;
|
Long existsId = 123L;
|
||||||
RelationUpdateAction relationUpdateAction = new RelationUpdateAction();
|
RelationUpdateAction relationUpdateAction = new RelationUpdateAction();
|
||||||
relationUpdateAction.setId(existsId);
|
relationUpdateAction.setId(existsId);
|
||||||
|
|
@ -36,22 +29,13 @@ class RelationControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
Relation relation = new Relation();
|
Relation relation = new Relation();
|
||||||
relation.setId(existsId);
|
relation.setId(existsId);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Relation, relation,
|
checkUpdatingWithIdVolidationByRestApi(IMDGDistributedNames.Map_Relation, relation,
|
||||||
REST_URL, relationUpdateAction, existsId);
|
REST_URL, relationUpdateAction, existsId);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_RELATION_UPDATE, relationUpdateAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_RELATION_UPDATE, relationUpdateAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link RelationController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
|
||||||
* Входной запрос /relations/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Long existsId = 123L;
|
Long existsId = 123L;
|
||||||
BankAccount existBankAccount = new BankAccount();
|
BankAccount existBankAccount = new BankAccount();
|
||||||
existBankAccount.setBankName("ooo tinkoff");
|
existBankAccount.setBankName("ooo tinkoff");
|
||||||
|
|
@ -66,8 +50,6 @@ class RelationControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
Relation relation = new Relation();
|
Relation relation = new Relation();
|
||||||
relation.setId(existsId);
|
relation.setId(existsId);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Relation, relation, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Relation, relation, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,15 +12,8 @@ import java.time.LocalDate;
|
||||||
class ExecutionDepositControllerTest extends AbstractControllerTest {
|
class ExecutionDepositControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/execution-deposits/";
|
private static final String REST_URL = "/execution-deposits/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ExecutionDepositController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /execution-deposits/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ExecutionDeposit executionDeposit = new ExecutionDeposit();
|
ExecutionDeposit executionDeposit = new ExecutionDeposit();
|
||||||
executionDeposit.setId(currentId.get());
|
executionDeposit.setId(currentId.get());
|
||||||
executionDeposit.setExchangeExecutionId(currentId.get());
|
executionDeposit.setExchangeExecutionId(currentId.get());
|
||||||
|
|
@ -52,8 +45,6 @@ class ExecutionDepositControllerTest extends AbstractControllerTest {
|
||||||
executionDeposit.setCoverageStatus("cov");
|
executionDeposit.setCoverageStatus("cov");
|
||||||
executionDeposit.setSessionId(currentId.get());
|
executionDeposit.setSessionId(currentId.get());
|
||||||
executionDeposit.setClearingDate(LocalDate.now());
|
executionDeposit.setClearingDate(LocalDate.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionDeposit, executionDeposit, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionDeposit, executionDeposit, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,15 +12,8 @@ import java.time.LocalDate;
|
||||||
class ExecutionFondControllerTest extends AbstractControllerTest {
|
class ExecutionFondControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/execution-fonds/";
|
private static final String REST_URL = "/execution-fonds/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ExecutionFondController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /execution-fonds/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ExecutionFond executionFond = new ExecutionFond();
|
ExecutionFond executionFond = new ExecutionFond();
|
||||||
executionFond.setId(currentId.get());
|
executionFond.setId(currentId.get());
|
||||||
executionFond.setExchangeExecutionId(currentId.get());
|
executionFond.setExchangeExecutionId(currentId.get());
|
||||||
|
|
@ -50,8 +43,6 @@ class ExecutionFondControllerTest extends AbstractControllerTest {
|
||||||
executionFond.setSettlementCode("settl1");
|
executionFond.setSettlementCode("settl1");
|
||||||
executionFond.setSettlementDate(LocalDate.now());
|
executionFond.setSettlementDate(LocalDate.now());
|
||||||
executionFond.setExchangeExecutionMicroseconds(Instant.now());
|
executionFond.setExchangeExecutionMicroseconds(Instant.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionFond, executionFond, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionFond, executionFond, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,15 +12,8 @@ import java.time.LocalTime;
|
||||||
class InDocumentJournalControllerTest extends AbstractControllerTest {
|
class InDocumentJournalControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/in-document-journals/";
|
private static final String REST_URL = "/in-document-journals/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link InDocumentJournalController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /in-document-journals/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
InDocumentJournal inDocumentJournal = new InDocumentJournal();
|
InDocumentJournal inDocumentJournal = new InDocumentJournal();
|
||||||
inDocumentJournal.setId(currentId.get());
|
inDocumentJournal.setId(currentId.get());
|
||||||
inDocumentJournal.setComment("Comment");
|
inDocumentJournal.setComment("Comment");
|
||||||
|
|
@ -37,8 +30,6 @@ class InDocumentJournalControllerTest extends AbstractControllerTest {
|
||||||
inDocumentJournal.setQuantity(0L);
|
inDocumentJournal.setQuantity(0L);
|
||||||
inDocumentJournal.setClearingCode("dosser");
|
inDocumentJournal.setClearingCode("dosser");
|
||||||
inDocumentJournal.setEmailDate(LocalDate.now());
|
inDocumentJournal.setEmailDate(LocalDate.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InDocumentJournal, inDocumentJournal, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_InDocumentJournal, inDocumentJournal, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,15 +10,8 @@ import java.time.Instant;
|
||||||
class ManagementJournalControllerTest extends AbstractControllerTest {
|
class ManagementJournalControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/management-journals/";
|
private static final String REST_URL = "/management-journals/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ManagementJournalController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /management-journals/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ManagementJournal managementJournal = new ManagementJournal();
|
ManagementJournal managementJournal = new ManagementJournal();
|
||||||
managementJournal.setId(currentId.get());
|
managementJournal.setId(currentId.get());
|
||||||
managementJournal.setCompanyId(currentId.get());
|
managementJournal.setCompanyId(currentId.get());
|
||||||
|
|
@ -30,8 +23,6 @@ class ManagementJournalControllerTest extends AbstractControllerTest {
|
||||||
managementJournal.setChangeAccessSign("send");
|
managementJournal.setChangeAccessSign("send");
|
||||||
managementJournal.setChangeDataSign("dos");
|
managementJournal.setChangeDataSign("dos");
|
||||||
managementJournal.setEventDate(Instant.now());
|
managementJournal.setEventDate(Instant.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ManagementJournal, managementJournal, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ManagementJournal, managementJournal, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,15 +12,8 @@ import java.time.LocalTime;
|
||||||
class OutDocumentJournalControllerTest extends AbstractControllerTest {
|
class OutDocumentJournalControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/out-document-journals/";
|
private static final String REST_URL = "/out-document-journals/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link OutDocumentJournalController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /out-document-journals/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
OutDocumentJournal outDocumentJournal = new OutDocumentJournal();
|
OutDocumentJournal outDocumentJournal = new OutDocumentJournal();
|
||||||
outDocumentJournal.setId(currentId.get());
|
outDocumentJournal.setId(currentId.get());
|
||||||
outDocumentJournal.setRegistrationDate(LocalDate.now());
|
outDocumentJournal.setRegistrationDate(LocalDate.now());
|
||||||
|
|
@ -36,8 +29,6 @@ class OutDocumentJournalControllerTest extends AbstractControllerTest {
|
||||||
outDocumentJournal.setDossierNumber("doc");
|
outDocumentJournal.setDossierNumber("doc");
|
||||||
outDocumentJournal.setPostDate(LocalDate.now());
|
outDocumentJournal.setPostDate(LocalDate.now());
|
||||||
outDocumentJournal.setResultStatus("res");
|
outDocumentJournal.setResultStatus("res");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_OutDocumentJournal, outDocumentJournal, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_OutDocumentJournal, outDocumentJournal, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,21 +8,12 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
class CurrencyControllerTest extends AbstractControllerTest {
|
class CurrencyControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/currencies/";
|
private static final String REST_URL = "/currencies/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link CurrencyController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /currencies/ <br>
|
|
||||||
* Ответ CurrencyController <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Currency currency = new Currency();
|
Currency currency = new Currency();
|
||||||
currency.setId(currentId.get());
|
currency.setId(currentId.get());
|
||||||
currency.setCountryCode("acc");
|
currency.setCountryCode("acc");
|
||||||
currency.setCurrencyCode("acc");
|
currency.setCurrencyCode("acc");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Currency, currency, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Currency, currency, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,15 +10,8 @@ import java.time.LocalDate;
|
||||||
class ErrorTextControllerTest extends AbstractControllerTest {
|
class ErrorTextControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/error-texts/";
|
private static final String REST_URL = "/error-texts/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ErrorTextController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /error-texts/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ErrorText errorText = new ErrorText();
|
ErrorText errorText = new ErrorText();
|
||||||
errorText.setId(currentId.get());
|
errorText.setId(currentId.get());
|
||||||
errorText.setText("text");
|
errorText.setText("text");
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,8 @@ import java.math.BigDecimal;
|
||||||
class ListingControllerTest extends AbstractControllerTest {
|
class ListingControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/listings/";
|
private static final String REST_URL = "/listings/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ListingController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /listings/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Listing liabilitiesClaimsAssets = new Listing();
|
Listing liabilitiesClaimsAssets = new Listing();
|
||||||
liabilitiesClaimsAssets.setId(currentId.get());
|
liabilitiesClaimsAssets.setId(currentId.get());
|
||||||
liabilitiesClaimsAssets.setSecurityId(currentId.get());
|
liabilitiesClaimsAssets.setSecurityId(currentId.get());
|
||||||
|
|
@ -28,8 +21,6 @@ class ListingControllerTest extends AbstractControllerTest {
|
||||||
liabilitiesClaimsAssets.setSymbolName("res");
|
liabilitiesClaimsAssets.setSymbolName("res");
|
||||||
liabilitiesClaimsAssets.setTradingCurrency("trad");
|
liabilitiesClaimsAssets.setTradingCurrency("trad");
|
||||||
liabilitiesClaimsAssets.setWorkflowStatus("work");
|
liabilitiesClaimsAssets.setWorkflowStatus("work");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Listing, liabilitiesClaimsAssets, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Listing, liabilitiesClaimsAssets, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,15 +8,8 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
class MarketControllerTest extends AbstractControllerTest {
|
class MarketControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/markets/";
|
private static final String REST_URL = "/markets/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link MarketController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /markets/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Market liabilitiesClaimsAssets = new Market();
|
Market liabilitiesClaimsAssets = new Market();
|
||||||
liabilitiesClaimsAssets.setId(currentId.get());
|
liabilitiesClaimsAssets.setId(currentId.get());
|
||||||
liabilitiesClaimsAssets.setDescription("des");
|
liabilitiesClaimsAssets.setDescription("des");
|
||||||
|
|
@ -25,8 +18,6 @@ class MarketControllerTest extends AbstractControllerTest {
|
||||||
liabilitiesClaimsAssets.setCode("man");
|
liabilitiesClaimsAssets.setCode("man");
|
||||||
liabilitiesClaimsAssets.setSettlementCurrency("res");
|
liabilitiesClaimsAssets.setSettlementCurrency("res");
|
||||||
liabilitiesClaimsAssets.setSection("sec");
|
liabilitiesClaimsAssets.setSection("sec");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Market, liabilitiesClaimsAssets, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Market, liabilitiesClaimsAssets, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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.backendapi.controller.response.entity.CommonGetAllResponse;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
|
|
||||||
import java.time.Instant;
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
@ -22,15 +21,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class NotificationControllerTest extends AbstractControllerTest {
|
class NotificationControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/notifications/";
|
private static final String REST_URL = "/notifications/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link NotificationController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Notification.<br>
|
|
||||||
* Входной запрос /notifications/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Notification profileDocument = new Notification();
|
Notification profileDocument = new Notification();
|
||||||
profileDocument.setClearingDate(LocalDate.now());
|
profileDocument.setClearingDate(LocalDate.now());
|
||||||
profileDocument.setSenderId(1000L);
|
profileDocument.setSenderId(1000L);
|
||||||
|
|
@ -47,11 +39,9 @@ class NotificationControllerTest extends AbstractControllerTest {
|
||||||
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
||||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||||
expected.fromEntity(all);
|
expected.fromEntity(all);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL)
|
perform(MockMvcRequestBuilders.get(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class SessionControllerTest extends AbstractControllerTest {
|
class SessionControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/sessions/";
|
private static final String REST_URL = "/sessions/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link SessionController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Session.<br>
|
|
||||||
* Входной запрос /sessions/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Session session = new Session();
|
Session session = new Session();
|
||||||
session.setClearingDate(LocalDate.now());
|
session.setClearingDate(LocalDate.now());
|
||||||
session.setSessionStatus("Ok");
|
session.setSessionStatus("Ok");
|
||||||
|
|
@ -42,11 +35,9 @@ class SessionControllerTest extends AbstractControllerTest {
|
||||||
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
||||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||||
expected.fromEntity(all);
|
expected.fromEntity(all);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL)
|
perform(MockMvcRequestBuilders.get(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
|
|
|
||||||
|
|
@ -25,15 +25,8 @@ import static ru.spcex.clearing.test.json.JsonUtil.writeValue;
|
||||||
class PaymentInstructionControllerTest extends AbstractControllerTest {
|
class PaymentInstructionControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/payment-instructions/";
|
private static final String REST_URL = "/payment-instructions/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link PaymentInstructionController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_PaymentInstruction.<br>
|
|
||||||
* Входной запрос /paymentInstructions/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
PaymentInstruction paymentInstruction = new PaymentInstruction();
|
PaymentInstruction paymentInstruction = new PaymentInstruction();
|
||||||
|
|
||||||
paymentInstruction.setSenderId(1010L);
|
paymentInstruction.setSenderId(1010L);
|
||||||
|
|
@ -72,11 +65,9 @@ class PaymentInstructionControllerTest extends AbstractControllerTest {
|
||||||
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
||||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||||
expected.fromEntity(all);
|
expected.fromEntity(all);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL)
|
perform(MockMvcRequestBuilders.get(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
|
|
@ -84,7 +75,6 @@ class PaymentInstructionControllerTest extends AbstractControllerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void clearingOutboundAction() throws Exception {
|
void clearingOutboundAction() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
PIClearingOutbondActionNew piClearingOutbondActionNew = new PIClearingOutbondActionNew();
|
PIClearingOutbondActionNew piClearingOutbondActionNew = new PIClearingOutbondActionNew();
|
||||||
piClearingOutbondActionNew.setSenderId(111L);
|
piClearingOutbondActionNew.setSenderId(111L);
|
||||||
piClearingOutbondActionNew.setAddresseeId(222L);
|
piClearingOutbondActionNew.setAddresseeId(222L);
|
||||||
|
|
@ -92,7 +82,6 @@ class PaymentInstructionControllerTest extends AbstractControllerTest {
|
||||||
piClearingOutbondActionNew.setCreditLeg_amount(BigDecimal.valueOf(120.99));
|
piClearingOutbondActionNew.setCreditLeg_amount(BigDecimal.valueOf(120.99));
|
||||||
piClearingOutbondActionNew.setCreditLeg_accountId(333L);
|
piClearingOutbondActionNew.setCreditLeg_accountId(333L);
|
||||||
piClearingOutbondActionNew.setDebitLeg_accountId(335L);
|
piClearingOutbondActionNew.setDebitLeg_accountId(335L);
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi("/payment-instructions/clearing-outbound/", piClearingOutbondActionNew);
|
checkAddingByRestApi("/payment-instructions/clearing-outbound/", piClearingOutbondActionNew);
|
||||||
checkSendedMessegeFromKafka(Consts.PAYMENT_INSTRUCTION_CLEARING_OUTBOUND_ACTION, piClearingOutbondActionNew);
|
checkSendedMessegeFromKafka(Consts.PAYMENT_INSTRUCTION_CLEARING_OUTBOUND_ACTION, piClearingOutbondActionNew);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,15 +11,8 @@ import java.time.LocalDate;
|
||||||
class AdmittedLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
class AdmittedLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/admitted-liabilities-registers/";
|
private static final String REST_URL = "/admitted-liabilities-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link AdmittedLiabilitiesRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /admitted-liabilities-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
AdmittedLiabilitiesRegister admittedLiabilitiesRegister = new AdmittedLiabilitiesRegister();
|
AdmittedLiabilitiesRegister admittedLiabilitiesRegister = new AdmittedLiabilitiesRegister();
|
||||||
admittedLiabilitiesRegister.setId(currentId.get());
|
admittedLiabilitiesRegister.setId(currentId.get());
|
||||||
admittedLiabilitiesRegister.setCompanyFullName("fuill nme");
|
admittedLiabilitiesRegister.setCompanyFullName("fuill nme");
|
||||||
|
|
@ -31,8 +24,6 @@ class AdmittedLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
admittedLiabilitiesRegister.setAccount("ACC1");
|
admittedLiabilitiesRegister.setAccount("ACC1");
|
||||||
admittedLiabilitiesRegister.setAmount(BigDecimal.valueOf(12.15));
|
admittedLiabilitiesRegister.setAmount(BigDecimal.valueOf(12.15));
|
||||||
admittedLiabilitiesRegister.setClearingDate(LocalDate.now());
|
admittedLiabilitiesRegister.setClearingDate(LocalDate.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_AdmittedLiabilitiesRegister, admittedLiabilitiesRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_AdmittedLiabilitiesRegister, admittedLiabilitiesRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,15 +10,8 @@ import java.time.LocalDate;
|
||||||
class ContractRegisterControllerTest extends AbstractControllerTest {
|
class ContractRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/contract-registers/";
|
private static final String REST_URL = "/contract-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ContractRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /contract-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ContractRegister contractRegister = new ContractRegister();
|
ContractRegister contractRegister = new ContractRegister();
|
||||||
contractRegister.setId(currentId.get());
|
contractRegister.setId(currentId.get());
|
||||||
contractRegister.setName("code");
|
contractRegister.setName("code");
|
||||||
|
|
@ -35,8 +28,6 @@ class ContractRegisterControllerTest extends AbstractControllerTest {
|
||||||
contractRegister.setValidToDate(LocalDate.now());
|
contractRegister.setValidToDate(LocalDate.now());
|
||||||
contractRegister.setCloseDate(LocalDate.now());
|
contractRegister.setCloseDate(LocalDate.now());
|
||||||
contractRegister.setComment("ocpo");
|
contractRegister.setComment("ocpo");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ContractRegister, contractRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ContractRegister, contractRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,15 +11,8 @@ import java.time.LocalDate;
|
||||||
class CoveredLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
class CoveredLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/covered-liabilities-registers/";
|
private static final String REST_URL = "/covered-liabilities-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link CoveredLiabilitiesRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /covered-liabilities-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
CoveredLiabilitiesRegister coveredLiabilitiesRegister = new CoveredLiabilitiesRegister();
|
CoveredLiabilitiesRegister coveredLiabilitiesRegister = new CoveredLiabilitiesRegister();
|
||||||
coveredLiabilitiesRegister.setId(currentId.get());
|
coveredLiabilitiesRegister.setId(currentId.get());
|
||||||
coveredLiabilitiesRegister.setCompanyFullName("fuill nme");
|
coveredLiabilitiesRegister.setCompanyFullName("fuill nme");
|
||||||
|
|
@ -31,8 +24,6 @@ class CoveredLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
coveredLiabilitiesRegister.setAccount("ACC1");
|
coveredLiabilitiesRegister.setAccount("ACC1");
|
||||||
coveredLiabilitiesRegister.setAmount(BigDecimal.valueOf(12.15));
|
coveredLiabilitiesRegister.setAmount(BigDecimal.valueOf(12.15));
|
||||||
coveredLiabilitiesRegister.setClearingDate(LocalDate.now());
|
coveredLiabilitiesRegister.setClearingDate(LocalDate.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CoveredLiabilitiesRegister, coveredLiabilitiesRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_CoveredLiabilitiesRegister, coveredLiabilitiesRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,23 +8,14 @@ import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
class DepoBalanceRegisterControllerTest extends AbstractControllerTest {
|
class DepoBalanceRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/depo-balance-registers/";
|
private static final String REST_URL = "/depo-balance-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link DepoBalanceRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /depo-balance-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
DepoBalanceRegister depoBalanceRegister = new DepoBalanceRegister();
|
DepoBalanceRegister depoBalanceRegister = new DepoBalanceRegister();
|
||||||
depoBalanceRegister.setId(currentId.get());
|
depoBalanceRegister.setId(currentId.get());
|
||||||
depoBalanceRegister.setSessionId(111L);
|
depoBalanceRegister.setSessionId(111L);
|
||||||
depoBalanceRegister.setSecuritySymbol("RUB");
|
depoBalanceRegister.setSecuritySymbol("RUB");
|
||||||
depoBalanceRegister.setCompanyId(222L);
|
depoBalanceRegister.setCompanyId(222L);
|
||||||
depoBalanceRegister.setDepoCode("DCDE");
|
depoBalanceRegister.setDepoCode("DCDE");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoBalanceRegister, depoBalanceRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoBalanceRegister, depoBalanceRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,15 +10,8 @@ import java.math.BigDecimal;
|
||||||
class DepoPaymentInstructionRegisterControllerTest extends AbstractControllerTest {
|
class DepoPaymentInstructionRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/depo-payment-instruction-registers/";
|
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
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister();
|
DepoPaymentInstructionRegister depoPaymentInstructionRegister = new DepoPaymentInstructionRegister();
|
||||||
depoPaymentInstructionRegister.setId(currentId.get());
|
depoPaymentInstructionRegister.setId(currentId.get());
|
||||||
depoPaymentInstructionRegister.setCompanyId(currentId.get());
|
depoPaymentInstructionRegister.setCompanyId(currentId.get());
|
||||||
|
|
@ -28,8 +21,6 @@ class DepoPaymentInstructionRegisterControllerTest extends AbstractControllerTes
|
||||||
depoPaymentInstructionRegister.setQuantity(BigDecimal.valueOf(12.15));
|
depoPaymentInstructionRegister.setQuantity(BigDecimal.valueOf(12.15));
|
||||||
depoPaymentInstructionRegister.setDirection(currentId.get());
|
depoPaymentInstructionRegister.setDirection(currentId.get());
|
||||||
depoPaymentInstructionRegister.setSessionId(currentId.get());
|
depoPaymentInstructionRegister.setSessionId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoPaymentInstructionRegister, depoPaymentInstructionRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_DepoPaymentInstructionRegister, depoPaymentInstructionRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,15 +11,8 @@ import java.time.LocalDate;
|
||||||
class ExcludeLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
class ExcludeLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/exclude-liabilities-registers/";
|
private static final String REST_URL = "/exclude-liabilities-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ExcludeLiabilitiesRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /exclude-liabilities-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ExcludeLiabilitiesRegister excludeLiabilitiesRegister = new ExcludeLiabilitiesRegister();
|
ExcludeLiabilitiesRegister excludeLiabilitiesRegister = new ExcludeLiabilitiesRegister();
|
||||||
excludeLiabilitiesRegister.setId(currentId.get());
|
excludeLiabilitiesRegister.setId(currentId.get());
|
||||||
excludeLiabilitiesRegister.setSessionId(222L);
|
excludeLiabilitiesRegister.setSessionId(222L);
|
||||||
|
|
@ -35,8 +28,6 @@ class ExcludeLiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
excludeLiabilitiesRegister.setCurrency("Currency");
|
excludeLiabilitiesRegister.setCurrency("Currency");
|
||||||
excludeLiabilitiesRegister.setSumLiabilities(BigDecimal.valueOf(12.15));
|
excludeLiabilitiesRegister.setSumLiabilities(BigDecimal.valueOf(12.15));
|
||||||
excludeLiabilitiesRegister.setSettlementDate(LocalDate.now());
|
excludeLiabilitiesRegister.setSettlementDate(LocalDate.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExcludeLiabilitiesRegister, excludeLiabilitiesRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExcludeLiabilitiesRegister, excludeLiabilitiesRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -12,15 +12,8 @@ import java.time.LocalDate;
|
||||||
class ExecutionRegisterControllerTest extends AbstractControllerTest {
|
class ExecutionRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/execution-registers/";
|
private static final String REST_URL = "/execution-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ExecutionRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /execution-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ExecutionRegister executionRegister = new ExecutionRegister();
|
ExecutionRegister executionRegister = new ExecutionRegister();
|
||||||
executionRegister.setId(currentId.get());
|
executionRegister.setId(currentId.get());
|
||||||
executionRegister.setTradingDate(LocalDate.now());
|
executionRegister.setTradingDate(LocalDate.now());
|
||||||
|
|
@ -40,9 +33,6 @@ class ExecutionRegisterControllerTest extends AbstractControllerTest {
|
||||||
executionRegister.setAmount(BigDecimal.valueOf(14.55));
|
executionRegister.setAmount(BigDecimal.valueOf(14.55));
|
||||||
executionRegister.setQuantity(BigDecimal.valueOf(0.1));
|
executionRegister.setQuantity(BigDecimal.valueOf(0.1));
|
||||||
executionRegister.setClearingDate(LocalDate.now());
|
executionRegister.setClearingDate(LocalDate.now());
|
||||||
|
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionRegister, executionRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ExecutionRegister, executionRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -11,15 +11,8 @@ import java.time.LocalDate;
|
||||||
class LiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
class LiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/liabilities-registers/";
|
private static final String REST_URL = "/liabilities-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LiabilitiesRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /liabilities-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
LiabilitiesRegister liabilitiesRegister = new LiabilitiesRegister();
|
LiabilitiesRegister liabilitiesRegister = new LiabilitiesRegister();
|
||||||
liabilitiesRegister.setId(currentId.get());
|
liabilitiesRegister.setId(currentId.get());
|
||||||
liabilitiesRegister.setSessionId(111L);
|
liabilitiesRegister.setSessionId(111L);
|
||||||
|
|
@ -35,9 +28,6 @@ class LiabilitiesRegisterControllerTest extends AbstractControllerTest {
|
||||||
liabilitiesRegister.setCurrency("RUB");
|
liabilitiesRegister.setCurrency("RUB");
|
||||||
liabilitiesRegister.setSumLiabilities(BigDecimal.TEN);
|
liabilitiesRegister.setSumLiabilities(BigDecimal.TEN);
|
||||||
liabilitiesRegister.setSettlementDate(LocalDate.now());
|
liabilitiesRegister.setSettlementDate(LocalDate.now());
|
||||||
|
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_LiabilitiesRegister, liabilitiesRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_LiabilitiesRegister, liabilitiesRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -10,15 +10,8 @@ import java.math.BigDecimal;
|
||||||
class MoneyBalanceRegisterControllerTest extends AbstractControllerTest {
|
class MoneyBalanceRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/money-balance-registers/";
|
private static final String REST_URL = "/money-balance-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link MoneyBalanceRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /money-balance-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
MoneyBalanceRegister moneyBalanceRegister = new MoneyBalanceRegister();
|
MoneyBalanceRegister moneyBalanceRegister = new MoneyBalanceRegister();
|
||||||
moneyBalanceRegister.setId(currentId.get());
|
moneyBalanceRegister.setId(currentId.get());
|
||||||
moneyBalanceRegister.setSetHouseName("setHouseName");
|
moneyBalanceRegister.setSetHouseName("setHouseName");
|
||||||
|
|
@ -31,9 +24,6 @@ class MoneyBalanceRegisterControllerTest extends AbstractControllerTest {
|
||||||
moneyBalanceRegister.setSessionId(456L);
|
moneyBalanceRegister.setSessionId(456L);
|
||||||
moneyBalanceRegister.setCompanyFullName("companyFullName");
|
moneyBalanceRegister.setCompanyFullName("companyFullName");
|
||||||
moneyBalanceRegister.setCompanyId(currentId.get());
|
moneyBalanceRegister.setCompanyId(currentId.get());
|
||||||
|
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_MoneyBalanceRegister, moneyBalanceRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_MoneyBalanceRegister, moneyBalanceRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,31 +1,20 @@
|
||||||
package ru.spcex.clearing.backendapi.controller.queue.register;
|
package ru.spcex.clearing.backendapi.controller.queue.register;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import ru.clearing.classes.statics.data.register.ContractRegister;
|
|
||||||
import ru.clearing.classes.statics.data.registry.Registry;
|
import ru.clearing.classes.statics.data.registry.Registry;
|
||||||
import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest;
|
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.RSplitDepositActionNew;
|
||||||
import ru.spcex.clearing.backendapi.controller.request.cud.registry.TradingClearingRegistryNewAction;
|
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
class RegistryControllerTest extends AbstractControllerTest {
|
class RegistryControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/registries/";
|
private static final String REST_URL = "/registries/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link RegistryController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /registries/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Registry registry = new Registry();
|
Registry registry = new Registry();
|
||||||
registry.setId(currentId.get());
|
registry.setId(currentId.get());
|
||||||
registry.setCompanyId(currentId.get());
|
registry.setCompanyId(currentId.get());
|
||||||
|
|
@ -71,20 +60,16 @@ class RegistryControllerTest extends AbstractControllerTest {
|
||||||
registry.setGroupId(currentId.get());
|
registry.setGroupId(currentId.get());
|
||||||
registry.setSessionId(currentId.get());
|
registry.setSessionId(currentId.get());
|
||||||
registry.setSessionType("CLR1");
|
registry.setSessionType("CLR1");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Registry, registry, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_Registry, registry, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void splitDepositAction() throws Exception {
|
void splitDepositAction() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
RSplitDepositActionNew rSplitDepositActionNew=new RSplitDepositActionNew();
|
RSplitDepositActionNew rSplitDepositActionNew=new RSplitDepositActionNew();
|
||||||
rSplitDepositActionNew.setComment("comment");
|
rSplitDepositActionNew.setComment("comment");
|
||||||
rSplitDepositActionNew.setContract("CONTRACT-1");
|
rSplitDepositActionNew.setContract("CONTRACT-1");
|
||||||
rSplitDepositActionNew.setRefundDate(LocalDate.now());
|
rSplitDepositActionNew.setRefundDate(LocalDate.now());
|
||||||
rSplitDepositActionNew.setOutboundAmount(BigDecimal.ONE);
|
rSplitDepositActionNew.setOutboundAmount(BigDecimal.ONE);
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi("/registries/splitDeposit/", rSplitDepositActionNew);
|
checkAddingByRestApi("/registries/splitDeposit/", rSplitDepositActionNew);
|
||||||
checkSendedMessegeFromKafka(Consts.REGISTRY_SPLIT_DEPOSIT_ACTION, rSplitDepositActionNew);
|
checkSendedMessegeFromKafka(Consts.REGISTRY_SPLIT_DEPOSIT_ACTION, rSplitDepositActionNew);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,8 @@ import java.time.LocalDate;
|
||||||
class ReportRegisterControllerTest extends AbstractControllerTest {
|
class ReportRegisterControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/report-registers/";
|
private static final String REST_URL = "/report-registers/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ReportRegisterController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /report-registers/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ReportRegister reportRegister = new ReportRegister();
|
ReportRegister reportRegister = new ReportRegister();
|
||||||
reportRegister.setId(currentId.get());
|
reportRegister.setId(currentId.get());
|
||||||
reportRegister.setCompanyFullName("code");
|
reportRegister.setCompanyFullName("code");
|
||||||
|
|
@ -28,8 +21,6 @@ class ReportRegisterControllerTest extends AbstractControllerTest {
|
||||||
reportRegister.setName("cat");
|
reportRegister.setName("cat");
|
||||||
reportRegister.setQuantity(currentId.get());
|
reportRegister.setQuantity(currentId.get());
|
||||||
reportRegister.setClearingDate(LocalDate.now());
|
reportRegister.setClearingDate(LocalDate.now());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ReportRegister, reportRegister, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ReportRegister, reportRegister, REST_URL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -15,7 +15,6 @@ import ru.spcex.clearing.backendapi.domain.actions.IAction;
|
||||||
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
import ru.spcex.clearing.backendapi.errors.ActionValidationException;
|
||||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||||
import ru.spcex.clearing.platform.messaging.domain.Consts;
|
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 ru.spcex.platform.imdg.api.Imdg;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
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 {
|
class TradingClearingRegistryControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/trading-clearing-registries/";
|
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
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
TradingClearingRegistryNewAction tradingClearingRegistryNewAction = getTradingClearingRegistryNewAction(
|
TradingClearingRegistryNewAction tradingClearingRegistryNewAction = getTradingClearingRegistryNewAction(
|
||||||
0,
|
0,
|
||||||
1234567890L, 18415056336414057L, 21239757374450030L, "ACTV"
|
1234567890L, 18415056336414057L, 21239757374450030L, "ACTV"
|
||||||
);
|
);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, tradingClearingRegistryNewAction);
|
checkAddingByRestApi(REST_URL, tradingClearingRegistryNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_NEW, 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
|
@Test
|
||||||
void addWithException() {
|
void addWithException() {
|
||||||
assertThrowsForNew(getTradingClearingRegistryNewAction(0, null, 18415056336414057L, 21239757374450030L, "ACTV"));
|
assertThrowsForNew(getTradingClearingRegistryNewAction(0, null, 18415056336414057L, 21239757374450030L, "ACTV"));
|
||||||
assertThrowsForNew(getTradingClearingRegistryNewAction(0, 1234567890L, null, 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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = 0;
|
long id = 0;
|
||||||
TradingClearingRegistryUpdateAction tradingClearingRegistryUpdateAction = getTradingClearingRegistryUpdateAction(
|
TradingClearingRegistryUpdateAction tradingClearingRegistryUpdateAction = getTradingClearingRegistryUpdateAction(
|
||||||
id, "ACTV"
|
id, "ACTV"
|
||||||
);
|
);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, tradingClearingRegistryUpdateAction, id);
|
checkUpdatingByRestApi(REST_URL, tradingClearingRegistryUpdateAction, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_UPDATE, tradingClearingRegistryUpdateAction);
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingByRestApi(REST_URL, id);
|
checkDeletingByRestApi(REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_TRADING_CLEARING_REGISTRY_BLOCK, deleteAction);
|
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
|
@Test
|
||||||
void getById() throws Exception {
|
void getById() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
TradingClearingRegistry existTradingClearingRegistry = new TradingClearingRegistry();
|
TradingClearingRegistry existTradingClearingRegistry = new TradingClearingRegistry();
|
||||||
existTradingClearingRegistry.setCompanyId(365L);
|
existTradingClearingRegistry.setCompanyId(365L);
|
||||||
existTradingClearingRegistry.setCode("99999");
|
existTradingClearingRegistry.setCode("99999");
|
||||||
|
|
@ -137,25 +91,16 @@ class TradingClearingRegistryControllerTest extends AbstractControllerTest {
|
||||||
payload.setCreatedAt(existTradingClearingRegistry.getCreated());
|
payload.setCreatedAt(existTradingClearingRegistry.getCreated());
|
||||||
payload.setUpdatedAt(existTradingClearingRegistry.getUpdated());
|
payload.setUpdatedAt(existTradingClearingRegistry.getUpdated());
|
||||||
expected.setPayload(payload);
|
expected.setPayload(payload);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL + existTradingClearingRegistry.getId())
|
perform(MockMvcRequestBuilders.get(REST_URL + existTradingClearingRegistry.getId())
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
// ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link TradingClearingRegistryController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.<br>
|
|
||||||
* Входной запрос /trading-clearing-registries/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
TradingClearingRegistry existTradingClearingRegistry = new TradingClearingRegistry();
|
TradingClearingRegistry existTradingClearingRegistry = new TradingClearingRegistry();
|
||||||
existTradingClearingRegistry.setCompanyId(365L);
|
existTradingClearingRegistry.setCompanyId(365L);
|
||||||
existTradingClearingRegistry.setCode("99999");
|
existTradingClearingRegistry.setCode("99999");
|
||||||
|
|
@ -166,8 +111,6 @@ class TradingClearingRegistryControllerTest extends AbstractControllerTest {
|
||||||
existTradingClearingRegistry.setTradingClearingRegistryPurpose("848484848484");
|
existTradingClearingRegistry.setTradingClearingRegistryPurpose("848484848484");
|
||||||
existTradingClearingRegistry.setStatus("ACTV");
|
existTradingClearingRegistry.setStatus("ACTV");
|
||||||
existTradingClearingRegistry.setId(currentId.get());
|
existTradingClearingRegistry.setId(currentId.get());
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_TradingClearingRegistry, existTradingClearingRegistry, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_TradingClearingRegistry, existTradingClearingRegistry, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,76 +14,43 @@ import java.time.LocalDate;
|
||||||
class ClearingCalendarControllerTest extends AbstractControllerTest {
|
class ClearingCalendarControllerTest extends AbstractControllerTest {
|
||||||
private static final String REST_URL = "/schedule/clearing-calendars/";
|
private static final String REST_URL = "/schedule/clearing-calendars/";
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ClearingCalendarController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API.<br>
|
|
||||||
* Входной запрос /schedule/clearing-calendars/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClearingCalendar clearingCalendar = new ClearingCalendar();
|
ClearingCalendar clearingCalendar = new ClearingCalendar();
|
||||||
clearingCalendar.setId(currentId.get());
|
clearingCalendar.setId(currentId.get());
|
||||||
clearingCalendar.setCompanyId(currentId.get());
|
clearingCalendar.setCompanyId(currentId.get());
|
||||||
clearingCalendar.setClearingDate(LocalDate.now());
|
clearingCalendar.setClearingDate(LocalDate.now());
|
||||||
clearingCalendar.setDayStatus("status");
|
clearingCalendar.setDayStatus("status");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingCalendar, clearingCalendar, REST_URL);
|
checkGettingAllFromRestApi(IMDGDistributedNames.Map_ClearingCalendar, clearingCalendar, REST_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link ClearingCalendarController#add(ClearingCalendarNewAction)} <br>
|
|
||||||
* Тест проверяет получение сущности {@link ClearingCalendarNewAction} по REST API и отправку в Apache Kafka.<br>
|
|
||||||
* Входной запрос {@link ClearingCalendarNewAction}:<br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
ClearingCalendarNewAction clearingCalendarNewAction = new ClearingCalendarNewAction();
|
ClearingCalendarNewAction clearingCalendarNewAction = new ClearingCalendarNewAction();
|
||||||
clearingCalendarNewAction.setCompanyId(currentId.get());
|
clearingCalendarNewAction.setCompanyId(currentId.get());
|
||||||
clearingCalendarNewAction.setClearingDate(LocalDate.now());
|
clearingCalendarNewAction.setClearingDate(LocalDate.now());
|
||||||
clearingCalendarNewAction.setDayStatus("status");
|
clearingCalendarNewAction.setDayStatus("status");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkAddingByRestApi(REST_URL, clearingCalendarNewAction);
|
checkAddingByRestApi(REST_URL, clearingCalendarNewAction);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_NEW, 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
|
@Test
|
||||||
void update() throws Exception {
|
void update() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
ClearingCalendarUpdateAction clearingCalendarUpdateAction = new ClearingCalendarUpdateAction();
|
ClearingCalendarUpdateAction clearingCalendarUpdateAction = new ClearingCalendarUpdateAction();
|
||||||
clearingCalendarUpdateAction.setId(id);
|
clearingCalendarUpdateAction.setId(id);
|
||||||
clearingCalendarUpdateAction.setCompanyId(currentId.get());
|
clearingCalendarUpdateAction.setCompanyId(currentId.get());
|
||||||
clearingCalendarUpdateAction.setClearingDate(LocalDate.now());
|
clearingCalendarUpdateAction.setClearingDate(LocalDate.now());
|
||||||
clearingCalendarUpdateAction.setDayStatus("status");
|
clearingCalendarUpdateAction.setDayStatus("status");
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkUpdatingByRestApi(REST_URL, clearingCalendarUpdateAction, id);
|
checkUpdatingByRestApi(REST_URL, clearingCalendarUpdateAction, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_UPDATE, clearingCalendarUpdateAction);
|
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
|
@Test
|
||||||
void delete() throws Exception {
|
void delete() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
long id = currentId.getAndIncrement();
|
long id = currentId.getAndIncrement();
|
||||||
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
CommonDeleteAction deleteAction = new CommonDeleteAction();
|
||||||
deleteAction.setId(id);
|
deleteAction.setId(id);
|
||||||
|
|
||||||
//ACT and ASSERT
|
|
||||||
checkDeletingByRestApi(REST_URL, id);
|
checkDeletingByRestApi(REST_URL, id);
|
||||||
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_DELETE, deleteAction);
|
checkSendedMessegeFromKafka(Consts.DESTINATION_CLEARING_CALENDAR_DELETE, deleteAction);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,15 +38,8 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
private static final String START_OF_CLEARING = Task.startOfClearing.getKey();
|
private static final String START_OF_CLEARING = Task.startOfClearing.getKey();
|
||||||
private static final long ID = 0;
|
private static final long ID = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LauncherController#getAll()} <br>
|
|
||||||
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_TaskRunner.<br>
|
|
||||||
* Входной запрос /task-runners/ <br>
|
|
||||||
* Ответ CommonGetAllResponse <br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void getAll() throws Exception {
|
void getAll() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
Launcher taskRunner = new Launcher();
|
Launcher taskRunner = new Launcher();
|
||||||
taskRunner.setTask("Task");
|
taskRunner.setTask("Task");
|
||||||
taskRunner.setSenderId(10210L);
|
taskRunner.setSenderId(10210L);
|
||||||
|
|
@ -59,23 +52,16 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
Collection<Map<String, Object>> all = responseFactory.responseFromObjectCollection(values);
|
||||||
CommonGetAllResponse expected = new CommonGetAllResponse();
|
CommonGetAllResponse expected = new CommonGetAllResponse();
|
||||||
expected.fromEntity(all);
|
expected.fromEntity(all);
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.get(REST_URL)
|
perform(MockMvcRequestBuilders.get(REST_URL)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(expected)));
|
.andExpect(content().json(writeValue(expected)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LauncherController#add(String)}<br>
|
|
||||||
* Тест проверяет получение сущности {@link LauncherController} по REST API и отправку в Apache Kafka.<br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void add() throws Exception {
|
void add() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
TaskDictionary taskDictionary = new TaskDictionary();
|
TaskDictionary taskDictionary = new TaskDictionary();
|
||||||
taskDictionary.setCode(CODE);
|
taskDictionary.setCode(CODE);
|
||||||
taskDictionary.setId(ID);
|
taskDictionary.setId(ID);
|
||||||
|
|
@ -92,14 +78,10 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement()));
|
||||||
|
|
||||||
setUserNameInMockSecurityContextAndMapUser(CODE, ID);
|
setUserNameInMockSecurityContextAndMapUser(CODE, ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL + CODE))
|
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL + CODE))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
// .andExpect(content().json(writeValue(expected)));
|
|
||||||
.andReturn();
|
.andReturn();
|
||||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
||||||
|
|
@ -107,10 +89,6 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
checkSendedMessegeFromKafka(Consts.LAUNCHER_NEW, launcherCommand);
|
checkSendedMessegeFromKafka(Consts.LAUNCHER_NEW, launcherCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LauncherController#add(String)}<br>
|
|
||||||
* Тест проверяет работу валидации {@link LauncherController}<br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void addWithException() throws Exception {
|
void addWithException() throws Exception {
|
||||||
BasicSpcexResponse response = new BasicSpcexResponse();
|
BasicSpcexResponse response = new BasicSpcexResponse();
|
||||||
|
|
@ -118,23 +96,16 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
EnumMessage message = ex.getError();
|
EnumMessage message = ex.getError();
|
||||||
response.setCode(message.getSubject().getId());
|
response.setCode(message.getSubject().getId());
|
||||||
response.setMessage(errorResolver.resolve(message));
|
response.setMessage(errorResolver.resolve(message));
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.post(REST_URL + null)
|
perform(MockMvcRequestBuilders.post(REST_URL + null)
|
||||||
.contentType(MediaType.APPLICATION_JSON))
|
.contentType(MediaType.APPLICATION_JSON))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isNotFound())
|
.andExpect(status().isNotFound())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(response)));
|
.andExpect(content().json(writeValue(response)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LauncherController#addSpecific}<br>
|
|
||||||
* Тест проверяет получение сущности {@link LauncherController} по REST API и отправку в Apache Kafka.<br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void addSpecific() throws Exception {
|
void addSpecific() throws Exception {
|
||||||
//ARRANGE
|
|
||||||
LauncherNew launcherCommand = new LauncherNew();
|
LauncherNew launcherCommand = new LauncherNew();
|
||||||
launcherCommand.setTask(START_OF_CLEARING);
|
launcherCommand.setTask(START_OF_CLEARING);
|
||||||
launcherCommand.setUserId(ID);
|
launcherCommand.setUserId(ID);
|
||||||
|
|
@ -153,16 +124,12 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement()));
|
||||||
|
|
||||||
setUserNameInMockSecurityContextAndMapUser(START_OF_CLEARING, ID);
|
setUserNameInMockSecurityContextAndMapUser(START_OF_CLEARING, ID);
|
||||||
|
|
||||||
//ACT
|
|
||||||
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL + "specific")
|
MvcResult mvcResult = perform(MockMvcRequestBuilders.post(REST_URL + "specific")
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(writeValue(launcherCommand)))
|
.content(writeValue(launcherCommand)))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isOk())
|
.andExpect(status().isOk())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
// .andExpect(content().json(writeValue(expected)));
|
|
||||||
.andReturn();
|
.andReturn();
|
||||||
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
CudResponseTest cudResponseTest = readValue(mvcResult.getResponse().getContentAsString(), CudResponseTest.class);
|
||||||
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
expected.setPayload(new QueueSuccessResponse(ActionType.NEW, cudResponseTest.getPayload().getId()));
|
||||||
|
|
@ -170,10 +137,6 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
checkSendedMessegeFromKafka(Consts.LAUNCHER_NEW, launcherCommand);
|
checkSendedMessegeFromKafka(Consts.LAUNCHER_NEW, launcherCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LauncherController#addSpecific}<br>
|
|
||||||
* Тест проверяет работу валидации {@link LauncherController}<br>
|
|
||||||
*/
|
|
||||||
@Test
|
@Test
|
||||||
void addSpecificWithException() throws Exception {
|
void addSpecificWithException() throws Exception {
|
||||||
LauncherNew launcherCommand = new LauncherNew();
|
LauncherNew launcherCommand = new LauncherNew();
|
||||||
|
|
@ -184,12 +147,10 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
EnumMessage message = ex.getError();
|
EnumMessage message = ex.getError();
|
||||||
response.setCode(message.getSubject().getId());
|
response.setCode(message.getSubject().getId());
|
||||||
response.setMessage(errorResolver.resolve(message));
|
response.setMessage(errorResolver.resolve(message));
|
||||||
//ACT
|
|
||||||
perform(MockMvcRequestBuilders.post(REST_URL + "specific")
|
perform(MockMvcRequestBuilders.post(REST_URL + "specific")
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(writeValue(launcherCommand)))
|
.content(writeValue(launcherCommand)))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isNotFound())
|
.andExpect(status().isNotFound())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(response)));
|
.andExpect(content().json(writeValue(response)));
|
||||||
|
|
@ -199,8 +160,7 @@ class LauncherControllerTest extends AbstractControllerTest {
|
||||||
perform(MockMvcRequestBuilders.post(REST_URL + "specific")
|
perform(MockMvcRequestBuilders.post(REST_URL + "specific")
|
||||||
.contentType(MediaType.APPLICATION_JSON)
|
.contentType(MediaType.APPLICATION_JSON)
|
||||||
.content(writeValue(launcherCommand)))
|
.content(writeValue(launcherCommand)))
|
||||||
.andDo(print())//output to the log request and response
|
.andDo(print())
|
||||||
//ASSERT
|
|
||||||
.andExpect(status().isNotFound())
|
.andExpect(status().isNotFound())
|
||||||
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
.andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON))
|
||||||
.andExpect(content().json(writeValue(response)));
|
.andExpect(content().json(writeValue(response)));
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue