diff --git a/clearing-parent/account-service/pom.xml b/clearing-parent/account-service/pom.xml index aa06e621d..f2bfdaf25 100644 --- a/clearing-parent/account-service/pom.xml +++ b/clearing-parent/account-service/pom.xml @@ -60,6 +60,11 @@ assertj-core test + + org.springframework.boot + spring-boot-test + test + diff --git a/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/service/BankAccountService.java b/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/service/BankAccountService.java index 0a7c76a63..992297cf5 100644 --- a/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/service/BankAccountService.java +++ b/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/service/BankAccountService.java @@ -11,7 +11,6 @@ import org.springframework.stereotype.Service; import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.BankAccount; import ru.clearing.classes.statics.data.company.relation.Relation; -import ru.spcex.clearing.account.errors.AccountError; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.BaseRequest; import ru.spcex.clearing.platform.messaging.domain.Consts; @@ -42,7 +41,7 @@ public class BankAccountService extends QueueConsumer implements InitializingBea private final Imdg relationMap; private final IMessageResolver messageResolver; -// private final Imdg userImdg; + // private final Imdg userImdg; // private final Imdg userRoleSessionImdg; private final Function bankAccountNewRequestValidator; diff --git a/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/validation/AccountValidationRule.java b/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/validation/AccountValidationRule.java index 4595d7005..7072858ac 100644 --- a/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/validation/AccountValidationRule.java +++ b/clearing-parent/account-service/src/main/java/ru/spcex/clearing/account/validation/AccountValidationRule.java @@ -52,7 +52,7 @@ public enum AccountValidationRule implements IValidationRule validate(ImdgValidationContext context) { BankAccountNewRequest accountReq = context.getValidatedObject(); if (StringUtils.isEmpty(accountReq.getCurrency())) { - return of(AccountError.WrongFieldValue, "Currency"); + return of(AccountError.WrongFieldValue, "currency"); } if (StringUtils.isEmpty(accountReq.getBankIdentificationCode())) { return of(AccountError.WrongFieldValue, "bankIdentificationCode"); diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/HazelcastServiceTestConfiguration.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/HazelcastServiceTestConfiguration.java index 60f94af16..7ee4bc8fa 100644 --- a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/HazelcastServiceTestConfiguration.java +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/HazelcastServiceTestConfiguration.java @@ -13,9 +13,11 @@ import ru.spcex.platform.imdg.iml.hazelcast.util.HazelcastHelper; import java.util.List; import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; @Configuration public class HazelcastServiceTestConfiguration { + public static final AtomicLong currentID = new AtomicLong(0L); private HazelcastInstance hazelcastInstance; private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) { @@ -40,7 +42,7 @@ public class HazelcastServiceTestConfiguration { joinConfig.setTcpIpConfig(new TcpIpConfig().setEnabled(true).setMembers(List.of("127.0.0.1"))); networkConfig.setJoin(joinConfig); cfg.setNetworkConfig(networkConfig); - hazelcastInstance = Hazelcast.newHazelcastInstance(cfg); + hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(cfg); HazelcastHelper.otcSystem_setStorageState(true, hazelcastInstance); return new HazelcastService(taskExecutorHazelcastClientInitializer, taskExecutorIdGeneratorAwaiter, params); } diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java new file mode 100644 index 000000000..fac49db45 --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java @@ -0,0 +1,44 @@ +package ru.spcex.clearing.account.config; + + +import org.apache.kafka.clients.consumer.MockConsumer; +import org.apache.kafka.clients.consumer.OffsetResetStrategy; +import org.apache.kafka.clients.producer.Producer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.service.RequestInfo; +import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender; +import ru.spcex.platform.imdg.api.Imdg; +import ru.spcex.platform.imdg.api.ImdgId; +import ru.spcex.platform.imdg.api.ImdgProvider; + +@Configuration +public class KafkaConfigTest { + + @Autowired + @Bean(name = "kafkaSenderTest") + public KafkaSender kafkaSender(Producer kafkaProducer, @Qualifier("hazelcastServiceTest") ImdgProvider imdgProvider) { + ImdgId imdgIdGenerator = imdgProvider.getImdgIdGenerator(); + return KafkaSender + .setup() + .producer(kafkaProducer) + .idGenerator(imdgIdGenerator::nextId) + .imdgProvider(s -> { + Imdg imdg = imdgProvider.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class); + return imdg::insert; + }) + .build(); + } + + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + @Bean(name = "mockConsumerTest") + public MockConsumer createConsumer() { + return new MockConsumer<>(OffsetResetStrategy.EARLIEST); + } + +} diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java new file mode 100644 index 000000000..50e495b0b --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java @@ -0,0 +1,146 @@ +package ru.spcex.clearing.account.service; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.kafka.clients.consumer.MockConsumer; +import org.apache.kafka.clients.producer.MockProducer; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import ru.clearing.classes.statics.data.account.Account; +import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.KafkaConfigTest; +import ru.spcex.clearing.account.utils.MatcherFactory; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; +import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.clearing.platform.messaging.domain.Consts; +import ru.spcex.clearing.platform.messaging.domain.cud.account.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.service.RequestInfo; +import ru.spcex.clearing.platform.messaging.service.Status; +import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast; +import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; + +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration.currentID; +import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; +import static ru.spcex.clearing.account.utils.TestUtils.addRecordToKafka; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = { + AccountService.class, + HazelcastServiceTestConfiguration.class, + KafkaConfigTest.class}) +class AccountServiceTest { + public static final MatcherFactory.Matcher ACCOUNT_MATCHER = usingIgnoringFieldsComparator(); + public static final MatcherFactory.Matcher REQUEST_INFO_MATCHER_MATCHER = usingIgnoringFieldsComparator("created"); + private static final int PARTITION = 0; + private static final String TOPIC_ACCOUNT_NEW = Consts.ACCOUNT_NEW; + private static final String account = "123456789123"; + @Autowired + AccountService accountService; + @Autowired + @Qualifier("hazelcastServiceTest") + private HazelcastService hazelcastServiceTest; + + @Captor + private ArgumentCaptor producerRecord; + @SpyBean + private MockProducer producer; + + /** + * {@link AccountService#accountNew(BaseRequest)}
+ * Тест проверяет создание сущности {@link BaseRequest} в Hazelcast при передаче из Apache Kafka.
+ * Входной запрос {@link AccountSdf01Request}:
+ * {@link AccountSdfRequestPart#setSdfId} - текущий Id
+ * {@link AccountSdfRequestPart#setAccount} - 123456789123
+ * {@link AccountSdfRequestPart#setCompanyId} - текущий Id
+ * {@link AccountSdf01Request#setGroupingSdf01Id} - текущий Id
+ * {@link AccountSdf01Request#setAccounts} - Collections.singletonList(AccountSdfRequestPart)
+ */ + @Test + void accountNew() 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 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 accountToStatement = Collections.singletonList(responsePart); + StatementRequest statementRequest = new StatementRequest(); + statementRequest.setGroupId(firstID); + statementRequest.setAccountCreationResults(accountToStatement); + + BaseRequest baseRequest = new BaseRequest<>(); + baseRequest.setId(secondID); + baseRequest.setActionType(ActionType.SYSTEM); + baseRequest.setRequestPayload(statementRequest); + + Account predictableAccount = new Account(); + predictableAccount.setAccount(account); + predictableAccount.setId(firstID); + predictableAccount.setCompanyId(firstID); + + RequestInfo predictableRequestInfo = new RequestInfo(); + predictableRequestInfo.setId(secondID); + predictableRequestInfo.setStatus(Status.Processing); + + //ACT + hazelcastServiceTest.waitTillReadyState(); + + //KAFKA + addRecordToKafka((MockConsumer) accountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonBaseNewRequest); + + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); + BaseRequest baseRequestObject = (BaseRequest) producerRecord.getValue().value(); + + ImdgHazelcast accountImdg = (ImdgHazelcast) hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Account, Account.class); + ImdgHazelcast requestInfoImdg = (ImdgHazelcast) hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class); + + //ASSERT + Account accountResult = accountImdg.getSingleObjectBySQL(String.format("account = %s", account)); + RequestInfo requestInfoResult = requestInfoImdg.getSingleObjectByID(baseRequestObject.getId()); + + assertEquals(Consts.STATEMENT_PROCESS, producerRecord.getValue().topic()); + ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount); + REQUEST_INFO_MATCHER_MATCHER.assertMatch(requestInfoResult, predictableRequestInfo); + } +} \ No newline at end of file diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java index b7984aa0c..205eb4d9a 100644 --- a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/BankAccountServiceTest.java @@ -1,24 +1,24 @@ package ru.spcex.clearing.account.service; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.hazelcast.core.IMap; -import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; -import org.apache.kafka.clients.consumer.OffsetResetStrategy; import org.apache.kafka.clients.producer.MockProducer; -import org.apache.kafka.common.TopicPartition; +import org.apache.kafka.clients.producer.ProducerRecord; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; +import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.BankAccount; +import ru.clearing.classes.statics.data.company.Company; import ru.spcex.clearing.account.config.ErrorResolverConfig; import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.KafkaConfigTest; import ru.spcex.clearing.account.config.ValidationConfig; import ru.spcex.clearing.account.utils.MatcherFactory.Matcher; import ru.spcex.clearing.imdg.IMDGDistributedNames; @@ -28,43 +28,75 @@ import ru.spcex.clearing.platform.messaging.domain.Consts; import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountUpdateRequest; import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest; +import ru.spcex.clearing.platform.messaging.service.RequestInfoUpdate; +import ru.spcex.platform.enumeration.AccountType; +import ru.spcex.platform.enumeration.Allowed; +import ru.spcex.platform.enumeration.Status; +import ru.spcex.platform.imdg.api.Imdg; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; -import ru.spcex.platform.utils.enumeration.IMessageResolver; -import ru.spcex.platform.utils.validation.IValidator; -import java.util.Collections; -import java.util.HashMap; -import java.util.function.Function; +import javax.annotation.PostConstruct; +import java.util.concurrent.atomic.AtomicInteger; +import static org.junit.jupiter.api.Assertions.assertEquals; +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.TestUtils.*; +import static ru.spcex.clearing.platform.messaging.service.Status.Error; +import static ru.spcex.clearing.platform.messaging.service.Status.Success; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = { - HazelcastServiceTestConfiguration.class, ErrorResolverConfig.class, - ValidationConfig.class}) + ErrorResolverConfig.class, + BankAccountService.class, + ValidationConfig.class, + HazelcastServiceTestConfiguration.class, + KafkaConfigTest.class}) public class BankAccountServiceTest { public static final Matcher BANK_ACCOUNT_MATCHER = usingIgnoringFieldsComparator(); + public static final Matcher ACCOUNT_MATCHER = usingIgnoringFieldsComparator(); + public static final Matcher> BASE_REQUEST_MATCHER = usingIgnoringFieldsComparator(); private static final int PARTITION = 0; private static final String TOPIC_ACCOUNT_NEW = Consts.DESTINATION_BANK_ACCOUNT_NEW; private static final String TOPIC_ACCOUNT_UPDATE = Consts.DESTINATION_BANK_ACCOUNT_UPDATE; private static final String TOPIC_ACCOUNT_DELETE = Consts.DESTINATION_BANK_ACCOUNT_DELETE; - private static Long currentId = 0L; + private static final Long ID = 0L; + private static final AtomicInteger countRun = new AtomicInteger(1); + private static final Long accountId = 12L; + private static final String currency = "RUB"; + private static final String bankIdentificationCode = "99999"; + private static final String bankName = "ooo tinkoff"; + private static final String destination = "OOO ROGA I KOPITA"; + private static final String correspondentAccount = "9294189285498598598"; + private static final String correspondentAccountName = "BIK OF TINKOFF"; + private static final String taxpayerIdentificationNumber = "848484848484"; + private static final String taxRegistrationReasonCode = "886886"; + protected final Long addresseeIdNew = 2L; + protected final String deal = "111111111"; + private final String acc = "0123456789"; + protected Imdg companyImdg; + private Imdg bankAccountImdg; + private Imdg accountImdg; @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; - @Autowired - private IMessageResolver messageResolver; - private MockConsumer mockConsumer; - private MockProducer mockProducer; @Autowired - private Function bankAccountNewRequestValidator; + private BankAccountService bankAccountService; - @BeforeEach - void setUp() { - mockConsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST); - mockProducer = new MockProducer<>(); + @Captor + private ArgumentCaptor producerRecord; + @SpyBean + private MockProducer producer; + + @PostConstruct + private void init() { + hazelcastServiceTest.waitAvailable(); + companyImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Company, Company.class); + bankAccountImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_BankAccount, BankAccount.class); + accountImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Account, Account.class); } /** @@ -81,73 +113,159 @@ public class BankAccountServiceTest { * {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886
* {@link BankAccountNewRequest#account} - 123456789123
*/ -// @Test - public void bankAccountNew() throws InterruptedException { - //arrange - BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest(); - bankAccountNewRequest.setBankName("ooo tinkoff"); - bankAccountNewRequest.setBankIdentificationCode("99999"); - bankAccountNewRequest.setCorrespondentAccount("9294189285498598598"); - bankAccountNewRequest.setCorrespondentAccountName("BIK OF TINKOFF"); - bankAccountNewRequest.setCurrency("RUB"); - bankAccountNewRequest.setDestination("OOO ROGA I KOPITA"); - bankAccountNewRequest.setTaxpayerIdentificationNumber("848484848484"); - bankAccountNewRequest.setTaxRegistrationReasonCode("886886"); - bankAccountNewRequest.setAccount("123456789123"); + @Test + public void bankAccountNew() { + //ARRANGE + BaseRequest predictableBaseRequest = new BaseRequest<>(); + predictableBaseRequest.setId(ID); + predictableBaseRequest.setActionType(ActionType.SYSTEM); + RequestInfoUpdate requestInfoUpdate = new RequestInfoUpdate(); + requestInfoUpdate.setId(ID); + requestInfoUpdate.setStatus(Success); + predictableBaseRequest.setRequestPayload(requestInfoUpdate); - BaseRequest baseNewRequest = new BaseRequest<>(); - baseNewRequest.setRequestPayload(bankAccountNewRequest); - baseNewRequest.setId(currentId); - baseNewRequest.setActionType(ActionType.NEW); - String jsonBaseNewRequest; - ObjectMapper objectMapper = new ObjectMapper(); - try { - jsonBaseNewRequest = objectMapper.writeValueAsString(baseNewRequest); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - BankAccount predictableResult = new BankAccount(); - predictableResult.setBankName("ooo tinkoff"); - predictableResult.setBankIdentificationCode("99999"); - predictableResult.setCorrespondentAccount("9294189285498598598"); - predictableResult.setCorrespondentAccountName("BIK OF TINKOFF"); - predictableResult.setCurrency("RUB"); - predictableResult.setDestination("OOO ROGA I KOPITA"); - predictableResult.setTaxpayerIdentificationNumber("848484848484"); - predictableResult.setTaxRegistrationReasonCode("886886"); - predictableResult.setId(currentId); - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC_ACCOUNT_NEW, PARTITION, 0, "key", jsonBaseNewRequest)); - }); - - - HashMap startOffsets = new HashMap<>(); - TopicPartition tp = new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION); - startOffsets.put(tp, 0L); - mockConsumer.updateBeginningOffsets(startOffsets); + BankAccount predictableBankAccount = getBankAccount(); + Company company = getTestCompany(); + companyImdg.insert(company); + Account predictableAccount = getTestAccount(accountId, acc); + clearImdg(accountImdg); + BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount); + String jsonString = getJsonStringForNew(bankAccountNewRequest, ID); //ACT + addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, 0, jsonString); - //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, - hazelcastServiceTest, messageResolver, - bankAccountNewRequestValidator); - Thread.sleep(10000); - //callbacks set up - bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); + BaseRequest baseRequestResult = (BaseRequest) producerRecord.getValue().value(); + + Account accountResult = accountImdg.getSingleObjectBySQL(String.format("account = %s", acc)); + BankAccount bankAccountResult = bankAccountImdg.getSingleObjectBySQL(String.format("account = %s or companyId = %s", acc, addresseeIdNew)); + predictableBankAccount.setAccountId(accountResult.getId()); + predictableBankAccount.setId(bankAccountResult.getId()); + setSameValueToField(accountResult, predictableAccount); //ASSERT - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - BankAccount result = iMap.get(currentId); + assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic()); + BANK_ACCOUNT_MATCHER.assertMatch(bankAccountResult, predictableBankAccount); + ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount); + BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest); + } - BANK_ACCOUNT_MATCHER.assertMatch(result, predictableResult); + /** + * {@link BankAccountService#bankAccountNew(BaseRequest request)}
+ * Тест проверяет валидацию.
+ * Входной запрос {@link BankAccountNewRequest}:
+ * {@link BankAccountNewRequest#bankIdentificationCode} - 99999
+ * {@link BankAccountNewRequest#bankName} - ооо тинькофф
+ * {@link BankAccountNewRequest#correspondentAccount} - 9294189285498598598
+ * {@link BankAccountNewRequest#correspondentAccountName} - BIK OF
+ * {@link BankAccountNewRequest#currency} - RUB
+ * {@link BankAccountNewRequest#destination} - OOO ROGA I KOPITA
+ * {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 848484848484
+ * {@link BankAccountNewRequest#taxRegistrationReasonCode} - 886886
+ * {@link BankAccountNewRequest#account} - 123456789123
+ */ + @Test + public void validatedBankAccountNew() { + clearImdg(accountImdg); + BankAccount predictableBankAccount = getBankAccount(); + Company company = getTestCompany(); + companyImdg.insert(company); + BankAccountNewRequest bankAccountNewRequest = getBankAccountNewRequest(predictableBankAccount); - //reset hazelcastService for next test - iMap.clear(); - currentId++; + //AccountValidationRule.RequiredFields + //WrongFieldValue + bankAccountNewRequest.setCurrency(null); + checkError("(5004) args [currency]", bankAccountNewRequest); + + bankAccountNewRequest.setCurrency(currency); + bankAccountNewRequest.setBankIdentificationCode(null); + checkError("(5004) args [bankIdentificationCode]", bankAccountNewRequest); + + bankAccountNewRequest.setBankIdentificationCode(bankIdentificationCode); + bankAccountNewRequest.setBankName(null); + checkError("(5004) args [bankName]", bankAccountNewRequest); + + bankAccountNewRequest.setBankName(bankName); + bankAccountNewRequest.setAccount(null); + checkError("(5004) args [account]", bankAccountNewRequest); + + bankAccountNewRequest.setAccount(acc); + bankAccountNewRequest.setDestination(null); + checkError("(5004) args [destination]", bankAccountNewRequest); + + bankAccountNewRequest.setDestination(destination); + bankAccountNewRequest.setCompanyId(null); + checkError("(5004) args [companyId]", bankAccountNewRequest); + bankAccountNewRequest.setCompanyId(addresseeIdNew); + + //AccountValidationRule.RubRequiredFields + //WrongFieldValue + bankAccountNewRequest.setCorrespondentAccount(null); + checkError("(5004) args [correspondentAccount]", bankAccountNewRequest); + + bankAccountNewRequest.setCorrespondentAccount(correspondentAccount); + bankAccountNewRequest.setCorrespondentAccountName(null); + checkError("(5004) args [correspondentAccountName]", bankAccountNewRequest); + + bankAccountNewRequest.setCorrespondentAccountName(correspondentAccountName); + bankAccountNewRequest.setTaxpayerIdentificationNumber(null); + checkError("(5004) args [taxpayerIdentificationNumber]", bankAccountNewRequest); + + bankAccountNewRequest.setTaxpayerIdentificationNumber(taxpayerIdentificationNumber); + bankAccountNewRequest.setTaxRegistrationReasonCode(null); + checkError("(5004) args [taxRegistrationReasonCode]", bankAccountNewRequest); + bankAccountNewRequest.setTaxRegistrationReasonCode(taxRegistrationReasonCode); + + //AccountValidationRule.CompanyPresent + //CompanyNotFound + bankAccountNewRequest.setCompanyId(999924535239L); + checkError("(5013) args []", bankAccountNewRequest); + + //CompanyNotActive + company.setWorkflowStatus(Status.Blocked.getKey()); + companyImdg.insert(company); + bankAccountNewRequest.setCompanyId(company.getId()); + checkError("(5014) args []", bankAccountNewRequest); + + //AccountValidationRule.AccountIsNew + //AccountAlreadyExist + company.setWorkflowStatus(Status.Active.getKey()); + companyImdg.insert(company); + Account existAccount = getTestAccount(accountId, acc); + accountImdg.insert(existAccount); + checkError("(5010) args []", bankAccountNewRequest); + accountImdg.delete(existAccount); + } + + private void checkError(String errorMsg, BankAccountNewRequest bankAccountNewRequest) { + //ARRANGE + int currentTime = countRun.getAndIncrement(); + long currentOffset = currentTime; + BaseRequest predictableBaseRequest = new BaseRequest<>(); + predictableBaseRequest.setId(ID); + predictableBaseRequest.setActionType(ActionType.SYSTEM); + RequestInfoUpdate requestInfoUpdate = new RequestInfoUpdate(); + requestInfoUpdate.setId(ID); + requestInfoUpdate.setStatus(Error); + requestInfoUpdate.setMessage(errorMsg); + predictableBaseRequest.setRequestPayload(requestInfoUpdate); + + String jsonString = getJsonStringForNew(bankAccountNewRequest, ID); + + //ACT + addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_NEW, PARTITION, currentOffset, jsonString); + + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(currentTime)) + .send(producerRecord.capture()); + BaseRequest baseRequestResult = (BaseRequest) producerRecord.getValue().value(); + + //ASSERT + assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic()); + BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest); } /** @@ -164,104 +282,72 @@ public class BankAccountServiceTest { * {@link BankAccountUpdateRequest#taxRegistrationReasonCode} - 532137
* {@link BankAccountUpdateRequest#account} - 326984656514
*/ -// @Test - void bankAccountUpdate() throws InterruptedException { - //arrange - BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest(); - bankAccountNewRequest.setBankName("ooo tinkoff"); - bankAccountNewRequest.setBankIdentificationCode("99999"); - bankAccountNewRequest.setCorrespondentAccount("9294189285498598598"); - bankAccountNewRequest.setCorrespondentAccountName("BIK OF TINKOFF"); - bankAccountNewRequest.setCurrency("RUB"); - bankAccountNewRequest.setDestination("OOO ROGA I KOPITA"); - bankAccountNewRequest.setTaxpayerIdentificationNumber("848484848484"); - bankAccountNewRequest.setTaxRegistrationReasonCode("886886"); - bankAccountNewRequest.setAccount("123456789123"); + @Test + void bankAccountUpdate() { + //ARRANGE + BaseRequest predictableBaseRequest = new BaseRequest<>(); + predictableBaseRequest.setId(ID); + predictableBaseRequest.setActionType(ActionType.SYSTEM); + RequestInfoUpdate requestInfoUpdate = new RequestInfoUpdate(); + requestInfoUpdate.setId(ID); + requestInfoUpdate.setStatus(Success); + predictableBaseRequest.setRequestPayload(requestInfoUpdate); + +// Company company = getTestCompany(); +// companyImdg.insert(company); + Account predictableAccount = getTestAccount(accountId, acc); + accountImdg.insert(predictableAccount); + + BankAccount bankAccountExists = getBankAccount(); + bankAccountImdg.insert(bankAccountExists); + BankAccount predictableUpdateBankAccount = new BankAccount(); + predictableUpdateBankAccount.setBankName("NEW BUNK NAME"); + predictableUpdateBankAccount.setBankIdentificationCode("88888"); + predictableUpdateBankAccount.setCorrespondentAccount("894984646541316"); + predictableUpdateBankAccount.setCorrespondentAccountName("BIK OF NEW BUNK"); + predictableUpdateBankAccount.setCurrency("EU"); + predictableUpdateBankAccount.setDestination("OOO NEW BUNK"); + predictableUpdateBankAccount.setTaxpayerIdentificationNumber("65468461321"); + predictableUpdateBankAccount.setTaxRegistrationReasonCode("532137"); + predictableUpdateBankAccount.setAccount(acc); + predictableUpdateBankAccount.setId(ID); - BaseRequest baseNewRequest = new BaseRequest<>(); - baseNewRequest.setRequestPayload(bankAccountNewRequest); - baseNewRequest.setId(currentId); - baseNewRequest.setActionType(ActionType.NEW); - String jsonBaseNewRequest; - ObjectMapper objectMapper = new ObjectMapper(); - try { - jsonBaseNewRequest = objectMapper.writeValueAsString(baseNewRequest); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } BankAccountUpdateRequest bankAccountUpdateRequest = new BankAccountUpdateRequest(); - bankAccountUpdateRequest.setId(currentId); - bankAccountUpdateRequest.setBankName("NEW BUNK NAME"); - bankAccountUpdateRequest.setBankIdentificationCode("88888"); - bankAccountUpdateRequest.setCorrespondentAccount("894984646541316"); - bankAccountUpdateRequest.setCorrespondentAccountName("BIK OF NEW BUNK"); - bankAccountUpdateRequest.setCurrency("EU"); - bankAccountUpdateRequest.setDestination("OOO NEW BUNK"); - bankAccountUpdateRequest.setTaxpayerIdentificationNumber("65468461321"); - bankAccountUpdateRequest.setTaxRegistrationReasonCode("532137"); - bankAccountUpdateRequest.setAccount("326984656514"); + bankAccountUpdateRequest.setId(predictableUpdateBankAccount.getId()); + bankAccountUpdateRequest.setBankName(predictableUpdateBankAccount.getBankName()); + bankAccountUpdateRequest.setBankIdentificationCode(predictableUpdateBankAccount.getBankIdentificationCode()); + bankAccountUpdateRequest.setCorrespondentAccount(predictableUpdateBankAccount.getCorrespondentAccount()); + bankAccountUpdateRequest.setCorrespondentAccountName(predictableUpdateBankAccount.getCorrespondentAccountName()); + bankAccountUpdateRequest.setCurrency(predictableUpdateBankAccount.getCurrency()); + bankAccountUpdateRequest.setDestination(predictableUpdateBankAccount.getDestination()); + bankAccountUpdateRequest.setTaxpayerIdentificationNumber(predictableUpdateBankAccount.getTaxpayerIdentificationNumber()); + bankAccountUpdateRequest.setTaxRegistrationReasonCode(predictableUpdateBankAccount.getTaxRegistrationReasonCode()); + bankAccountUpdateRequest.setAccount(predictableUpdateBankAccount.getAccount()); - BaseRequest baseUpdateRequest = new BaseRequest<>(); - baseUpdateRequest.setRequestPayload(bankAccountUpdateRequest); - baseUpdateRequest.setId(currentId); - baseUpdateRequest.setActionType(ActionType.UPDATE); - String jsonBaseUpdateRequest; - try { - jsonBaseUpdateRequest = objectMapper.writeValueAsString(baseUpdateRequest); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - BankAccount predictableUpdateResult = new BankAccount(); - predictableUpdateResult.setBankName("NEW BUNK NAME"); - predictableUpdateResult.setBankIdentificationCode("88888"); - predictableUpdateResult.setCorrespondentAccount("894984646541316"); - predictableUpdateResult.setCorrespondentAccountName("BIK OF NEW BUNK"); - predictableUpdateResult.setCurrency("EU"); - predictableUpdateResult.setDestination("OOO NEW BUNK"); - predictableUpdateResult.setTaxpayerIdentificationNumber("65468461321"); - predictableUpdateResult.setTaxRegistrationReasonCode("532137"); - predictableUpdateResult.setId(currentId); - - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC_ACCOUNT_NEW, PARTITION, 0, "key", jsonBaseNewRequest)); - }); - HashMap startOffsets = new HashMap<>(); - TopicPartition tp = new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION); - startOffsets.put(tp, 0L); - mockConsumer.updateBeginningOffsets(startOffsets); + String jsonString = getJsonStringForUPDATE(bankAccountUpdateRequest, ID); //ACT - //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, - hazelcastServiceTest, messageResolver, - bankAccountNewRequestValidator); - Thread.sleep(10000); - //callbacks set up - bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_UPDATE, PARTITION, 0, jsonString); - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_UPDATE, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC_ACCOUNT_UPDATE, PARTITION, 0, "key", jsonBaseUpdateRequest)); - }); - HashMap startOffsetsUpdating = new HashMap<>(); - TopicPartition tpUpdating = new TopicPartition(TOPIC_ACCOUNT_UPDATE, PARTITION); - startOffsetsUpdating.put(tpUpdating, 0L); - mockConsumer.updateBeginningOffsets(startOffsetsUpdating); + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); + BaseRequest baseRequestResult = (BaseRequest) producerRecord.getValue().value(); + + Account accountResult = accountImdg.getSingleObjectBySQL(String.format("account = %s", acc)); + BankAccount resultUpdating = bankAccountImdg.getSingleObjectBySQL(String.format("account = %s or companyId = %s", acc, addresseeIdNew)); + predictableUpdateBankAccount.setAccountId(resultUpdating.getAccountId()); + predictableUpdateBankAccount.setCompanyId(resultUpdating.getCompanyId()); + predictableAccount.setUpdated(accountResult.getUpdated()); //ASSERT - Thread.sleep(10000); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - BankAccount resultUpdating = iMap.get(currentId); + assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic()); - BANK_ACCOUNT_MATCHER.assertMatch(resultUpdating, predictableUpdateResult); - - //reset hazelcastService for next test - iMap.clear(); - currentId++; + //ASSERT + assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic()); + BANK_ACCOUNT_MATCHER.assertMatch(resultUpdating, predictableUpdateBankAccount); + ACCOUNT_MATCHER.assertMatch(accountResult, predictableAccount); + BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest); } /** @@ -271,80 +357,87 @@ public class BankAccountServiceTest { * {@link CommonDeleteRequest#id} - Идентификатор записи */ @Test - void bankAccountDelete() throws InterruptedException { - //arrange - BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest(); - bankAccountNewRequest.setBankName("ooo tinkoff"); - bankAccountNewRequest.setBankIdentificationCode("99999"); - bankAccountNewRequest.setCorrespondentAccount("9294189285498598598"); - bankAccountNewRequest.setCorrespondentAccountName("BIK OF TINKOFF"); - bankAccountNewRequest.setCurrency("RUB"); - bankAccountNewRequest.setDestination("OOO ROGA I KOPITA"); - bankAccountNewRequest.setTaxpayerIdentificationNumber("848484848484"); - bankAccountNewRequest.setTaxRegistrationReasonCode("886886"); - bankAccountNewRequest.setAccount("123456789123"); - - BaseRequest baseNewRequest = new BaseRequest<>(); - baseNewRequest.setRequestPayload(bankAccountNewRequest); - baseNewRequest.setId(currentId); - baseNewRequest.setActionType(ActionType.NEW); - String jsonBaseNewRequest; - ObjectMapper objectMapper = new ObjectMapper(); - try { - jsonBaseNewRequest = objectMapper.writeValueAsString(baseNewRequest); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } + void bankAccountDelete() { + //ARRANGE + BankAccount bankAccountExists = getBankAccount(); + bankAccountImdg.insert(bankAccountExists); + Account account = new Account(); + account.setId(accountId); + accountImdg.insert(account); CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest(); - commonDeleteRequest.setId(currentId); - BaseRequest baseDeleteRequest = new BaseRequest<>(); - baseDeleteRequest.setRequestPayload(commonDeleteRequest); - baseDeleteRequest.setId(currentId); - baseDeleteRequest.setActionType(ActionType.DELETE); - String jsonDeleteNewRequest; - try { - jsonDeleteNewRequest = objectMapper.writeValueAsString(baseDeleteRequest); - } catch (JsonProcessingException e) { - throw new RuntimeException(e); - } - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC_ACCOUNT_NEW, PARTITION, 0, "key", jsonBaseNewRequest)); - }); - HashMap startOffsets = new HashMap<>(); - TopicPartition tp = new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION); - startOffsets.put(tp, 0L); - mockConsumer.updateBeginningOffsets(startOffsets); + commonDeleteRequest.setId(ID); + String jsonString = getJsonStringForDELETE(commonDeleteRequest, ID); //ACT - //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, - hazelcastServiceTest, messageResolver, - bankAccountNewRequestValidator); - Thread.sleep(10000); - //callbacks set up - bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + addRecordToKafka((MockConsumer) bankAccountService.getConsumer(), TOPIC_ACCOUNT_DELETE, PARTITION, 0, jsonString); - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_DELETE, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC_ACCOUNT_DELETE, PARTITION, 0, "key", jsonDeleteNewRequest)); - }); - HashMap startOffsetsDeleting = new HashMap<>(); - TopicPartition tpDeleting = new TopicPartition(TOPIC_ACCOUNT_DELETE, PARTITION); - startOffsetsDeleting.put(tpDeleting, 0L); - mockConsumer.updateBeginningOffsets(startOffsetsDeleting); + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); //ASSERT - Thread.sleep(10000); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - Assertions.assertEquals(0, iMap.size()); - - //reset hazelcastService for next test - iMap.clear(); - currentId++; + BankAccount bankAccount = bankAccountImdg.getSingleObjectByID(ID); + Assertions.assertNull(bankAccount); + assertEquals(Consts.REQUEST_INFO_UPDATE, producerRecord.getValue().topic()); } + + private Company getTestCompany() { + Company company = new Company(); + company.setId(addresseeIdNew); + company.setWorkflowStatus(Status.Active.getKey()); + company.setTradingCode(deal); + company.setShortName("ShortName"); + company.setFullName("FullName"); + return company; + } + + private Account getTestAccount(Long id, String acc) { + Account account = new Account(); + account.setId(id); + account.setAccount(acc); + account.setAccountType(AccountType.Bank.getKey()); + account.setAccountStatus(Status.Active.getKey()); + account.setProcessingSign(Allowed.ALLOWED.getKey()); + return account; + } + + private void setSameValueToField(Account from, Account to) { + to.setCreated(from.getCreated()); + to.setUpdated(from.getUpdated()); + to.setId(from.getId()); + } + + private BankAccount getBankAccount() { + BankAccount bankAccount = new BankAccount(); + bankAccount.setAccountId(accountId); + bankAccount.setAccount(acc); + bankAccount.setCompanyId(addresseeIdNew); + bankAccount.setId(ID); + bankAccount.setBankName(bankName); + bankAccount.setBankIdentificationCode(bankIdentificationCode); + bankAccount.setCorrespondentAccount(correspondentAccount); + bankAccount.setCorrespondentAccountName(correspondentAccountName); + bankAccount.setCurrency(currency); + bankAccount.setDestination(destination); + bankAccount.setTaxpayerIdentificationNumber(taxpayerIdentificationNumber); + bankAccount.setTaxRegistrationReasonCode(taxRegistrationReasonCode); + return bankAccount; + } + + private BankAccountNewRequest getBankAccountNewRequest(BankAccount bankAccount) { + BankAccountNewRequest bankAccountNewRequest = new BankAccountNewRequest(); + bankAccountNewRequest.setBankName(bankAccount.getBankName()); + bankAccountNewRequest.setBankIdentificationCode(bankAccount.getBankIdentificationCode()); + bankAccountNewRequest.setCorrespondentAccount(bankAccount.getCorrespondentAccount()); + bankAccountNewRequest.setCorrespondentAccountName(bankAccount.getCorrespondentAccountName()); + bankAccountNewRequest.setCurrency(bankAccount.getCurrency()); + bankAccountNewRequest.setDestination(bankAccount.getDestination()); + bankAccountNewRequest.setTaxpayerIdentificationNumber(bankAccount.getTaxpayerIdentificationNumber()); + bankAccountNewRequest.setTaxRegistrationReasonCode(bankAccount.getTaxRegistrationReasonCode()); + bankAccountNewRequest.setAccount(bankAccount.getAccount()); + bankAccountNewRequest.setCompanyId(bankAccount.getCompanyId()); + return bankAccountNewRequest; + } + } \ No newline at end of file diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java new file mode 100644 index 000000000..c018ead9a --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java @@ -0,0 +1,63 @@ +package ru.spcex.clearing.account.utils; + +import com.hazelcast.core.IMap; +import com.hazelcast.map.listener.EntryAddedListener; +import com.hazelcast.map.listener.EntryRemovedListener; +import com.hazelcast.map.listener.EntryUpdatedListener; + +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.atomic.AtomicBoolean; + +public class ImapEvent { + private final IMap iMap; + private final String listenerAdding; + private final String listenerUpdating; + private final String listenerRemoving; + private final AtomicBoolean checkEventHappened = new AtomicBoolean(false); + + public ImapEvent(IMap iMap) { + this.iMap = iMap; + listenerAdding = iMap.addEntryListener((EntryAddedListener) entryEvent -> { + synchronized (checkEventHappened) { + checkEventHappened.set(true); + checkEventHappened.notify(); + } + }, false); + listenerUpdating = iMap.addEntryListener((EntryUpdatedListener) entryEvent -> { + synchronized (checkEventHappened) { + checkEventHappened.set(true); + checkEventHappened.notify(); + } + }, false); + listenerRemoving = iMap.addEntryListener((EntryRemovedListener) entryEvent -> { + synchronized (checkEventHappened) { + checkEventHappened.set(true); + checkEventHappened.notify(); + } + }, false); + } + + public void waitWhenHappened() throws InterruptedException { + //running timer task as daemon thread + Timer timer = new Timer(true); + timer.scheduleAtFixedRate(new TimerTask() { + boolean secondRan; + + @Override + public void run() { + checkEventHappened.set(secondRan);//если что-то пойдет не так не тормозить основной поток + secondRan = true; + } + }, 0, 30 * 1000); + synchronized (checkEventHappened) { + while (!checkEventHappened.get()) { + checkEventHappened.wait(100); + } + } + //preparing hazelcastImdgProvider for next test + iMap.removeEntryListener(listenerAdding); + iMap.removeEntryListener(listenerUpdating); + iMap.removeEntryListener(listenerRemoving); + } +} diff --git a/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/TestUtils.java b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/TestUtils.java new file mode 100644 index 000000000..509cfb8a7 --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/TestUtils.java @@ -0,0 +1,95 @@ +package ru.spcex.clearing.account.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.clients.consumer.MockConsumer; +import org.apache.kafka.clients.producer.RecordMetadata; +import org.apache.kafka.common.TopicPartition; +import ru.spcex.clearing.platform.messaging.domain.ActionType; +import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.platform.classes.base.SpcexObjectBase; +import ru.spcex.platform.imdg.api.Imdg; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class TestUtils { + private static final ObjectMapper objectMapper = new ObjectMapper(); + + public static void addRecordToKafka(MockConsumer mockConsumer, String topic, int partition, long offset, String jsonValue) { + TopicPartition tp = new TopicPartition(topic, partition); + HashMap startOffsets = new HashMap<>(); + startOffsets.put(tp, 0L); + mockConsumer.updateBeginningOffsets(startOffsets); + mockConsumer.schedulePollTask(() -> { + mockConsumer.rebalance(Collections.singletonList(tp)); + mockConsumer.addRecord(new ConsumerRecord<>(topic, partition, offset, "key", jsonValue)); + }); + } + + public static String getJsonStringForNew(T accountRequest, long id) { + return getJsonBaseRequest(accountRequest, id, ActionType.NEW); + } + + public static String getJsonStringForUPDATE(T accountRequest, long id) { + return getJsonBaseRequest(accountRequest, id, ActionType.UPDATE); + } + + public static String getJsonStringForDELETE(T accountRequest, long id) { + return getJsonBaseRequest(accountRequest, id, ActionType.DELETE); + } + + private static String getJsonBaseRequest(T accountRequest, long id, ActionType actionType) { + BaseRequest baseRequest = new BaseRequest<>(); + baseRequest.setRequestPayload(accountRequest); + baseRequest.setId(id); + baseRequest.setActionType(actionType); + String jsonBaseRequest; + try { + jsonBaseRequest = objectMapper.writeValueAsString(baseRequest); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + return jsonBaseRequest; + } + + public static void clearImdg(Imdg imdg) { + Collection values = imdg.getAllValues(); + for (T val : values) { + imdg.delete(val); + } + } + + public static class FutureRecordMetadata implements Future { + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + return false; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + return false; + } + + @Override + public RecordMetadata get() throws InterruptedException, ExecutionException { + return null; + } + + @Override + public RecordMetadata get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + return null; + } + } +} diff --git a/clearing-parent/backend-api/pom.xml b/clearing-parent/backend-api/pom.xml index 71e76bde9..a07748ce8 100644 --- a/clearing-parent/backend-api/pom.xml +++ b/clearing-parent/backend-api/pom.xml @@ -1,6 +1,6 @@ - 4.0.0 backend-api @@ -8,12 +8,12 @@ Clearing backend API module jar - - clearing-parent + + clearing-parent ru.spcex.clearing SPCEX-1.0.0.0 - + 17.0.1 @@ -25,9 +25,9 @@ spring-boot-starter-web - org.springframework.boot - spring-boot-starter-security - + org.springframework.boot + spring-boot-starter-security + org.keycloak keycloak-spring-boot-starter @@ -87,17 +87,26 @@ reflections 0.9.11 + + org.springframework.boot + spring-boot-test-autoconfigure + test + + + org.mockito + mockito-core + - org.keycloak.bom - keycloak-adapter-bom - ${keycloak-spring-boot-starter.version} - pom - import - + org.keycloak.bom + keycloak-adapter-bom + ${keycloak-spring-boot-starter.version} + pom + import + diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/HazelcastServiceTestConfiguration.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/HazelcastServiceTestConfiguration.java similarity index 98% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/HazelcastServiceTestConfiguration.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/HazelcastServiceTestConfiguration.java index 04e64990d..21f476282 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/HazelcastServiceTestConfiguration.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/HazelcastServiceTestConfiguration.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; +package ru.spcex.clearing.backendapi.controller.config; import com.hazelcast.config.*; import com.hazelcast.core.Hazelcast; diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/IOperatorTest.java similarity index 89% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/IOperatorTest.java index 9b6d845e9..e82944594 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/IOperatorTest.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; +package ru.spcex.clearing.backendapi.controller.config; import org.apache.kafka.clients.producer.Producer; import org.springframework.beans.factory.annotation.Autowired; @@ -10,14 +10,14 @@ import ru.spcex.clearing.backendapi.service.validation.ActionValidationProvider; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; @Configuration -public class IOperator { +public class IOperatorTest { @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; @Autowired - @Bean + @Bean("iOperatorTest") public OperatorImpl createIOperator(Producer kafka, ActionValidationProvider validationProvider) { return new OperatorImpl(kafka, hazelcastServiceTest, validationProvider); } diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java similarity index 64% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java index a1f8c5bea..8abb52f95 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java @@ -1,15 +1,17 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; +package ru.spcex.clearing.backendapi.controller.config; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; @Configuration -public class Jackson2HttpConverterConfig { +public class Jackson2HttpConverterTestConfig { @Bean("customJsonHttpConverter") public MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter() { return new MappingJackson2HttpMessageConverter(JacksonObjectMapper.getMapper()); @@ -21,16 +23,13 @@ public class Jackson2HttpConverterConfig { private JacksonObjectMapper() { //настройки Ильи configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true); - - //настройки какие были на курсе пока не нужны.. -// модуль для корректной сериализации LocalDateTime в поля JSON - JavaTimeModule модуль библиотеки jackson-datatype-jsr310 -// registerModule(new JavaTimeModule()); -// configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); - -// запрещаем доступ ко всем полям и методам класса и потом разрешаем доступ только к полям, нужны чтобы не было лишних полей из-за методов как: public ActionType getActionType() у BankAccountNewAction + //модуль для корректной сериализации LocalDateTime в поля JSON - JavaTimeModule модуль библиотеки jackson-datatype-jsr310 + registerModule(new JavaTimeModule()); + configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); + //запрещаем доступ ко всем полям и методам класса и потом разрешаем доступ только к полям, нужны чтобы не было лишних полей из-за методов как: public ActionType getActionType() у BankAccountNewAction setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.NONE); setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY); -// не сериализуем null-поля + //не сериализуем null-поля // setSerializationInclusion(JsonInclude.Include.NON_NULL); } diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/KafkaTestConfig.java similarity index 85% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/KafkaTestConfig.java index e8c020252..6d9e85277 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/KafkaTestConfig.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; +package ru.spcex.clearing.backendapi.controller.config; import org.apache.kafka.clients.producer.MockProducer; import org.apache.kafka.clients.producer.Producer; @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration; import ru.spcex.clearing.platform.messaging.serialization.JsonSerializer; @Configuration -public class KafkaConfig { +public class KafkaTestConfig { @Bean public Producer createProducer() { diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/MessagesTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/MessagesTestConfig.java new file mode 100644 index 000000000..d8f51db0e --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/MessagesTestConfig.java @@ -0,0 +1,28 @@ +package ru.spcex.clearing.backendapi.controller.config; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.ResourceBundleMessageSource; +import ru.spcex.platform.utils.enumeration.IMessageResolver; +import ru.spcex.platform.utils.enumeration.SpringPropertiesMessageResolver; + +import java.util.Locale; + +@Configuration +public class MessagesTestConfig { + @Bean("validation-error-messages-test") + public ResourceBundleMessageSource messages() { + ResourceBundleMessageSource source = new ResourceBundleMessageSource(); + source.setBasenames("messages/error"); + source.setUseCodeAsDefaultMessage(true); + source.setDefaultEncoding("utf8"); + source.setDefaultLocale(Locale.ROOT); + return source; + } + + @Bean("errorTestResolver") + public IMessageResolver errorResolver(@Qualifier("validation-error-messages-test") ResourceBundleMessageSource messageBundle) { + return new SpringPropertiesMessageResolver(messageBundle); + } +} diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplTestConfig.java new file mode 100644 index 000000000..da3f11400 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplTestConfig.java @@ -0,0 +1,32 @@ +package ru.spcex.clearing.backendapi.controller.config; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import ru.spcex.clearing.backendapi.meta.GetResponseFactory; +import ru.spcex.clearing.backendapi.meta.GetResponseFactoryTestConfiguration; +import ru.spcex.clearing.backendapi.meta.MetaServer; +import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; +import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; + +@Configuration +@Import({GetResponseFactoryTestConfiguration.class}) +public class StateLoaderImplTestConfig { + + @Autowired + @Qualifier("hazelcastServiceTest") + private HazelcastService hazelcastServiceTest; + + @Autowired + @Bean(name = "responseFactoryTest") + public GetResponseFactory getResponseFactory(@Qualifier("metaJsonTest") MetaServer meta) { + return new GetResponseFactory(meta); + } + + @Bean(name = "stateLoaderImplTest") + public StateLoaderImpl createStateLoaderImpl(@Qualifier("responseFactoryTest") GetResponseFactory responseFactory) { + return new StateLoaderImpl(hazelcastServiceTest, responseFactory); + } +} diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebSecurityTestConfigurer.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebSecurityTestConfigurer.java new file mode 100644 index 000000000..94d46c3f9 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebSecurityTestConfigurer.java @@ -0,0 +1,41 @@ +package ru.spcex.clearing.backendapi.controller.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.core.userdetails.User; +import org.springframework.security.core.userdetails.UserDetails; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; +import org.springframework.security.provisioning.InMemoryUserDetailsManager; +import org.springframework.security.web.SecurityFilterChain; + +@Configuration +public class WebSecurityTestConfigurer { + + @Bean + public InMemoryUserDetailsManager userDetailsService(PasswordEncoder passwordEncoder) { + UserDetails user = User.withUsername("spring") + .password(passwordEncoder.encode("secret")) + .roles("USER") + .build(); + return new InMemoryUserDetailsManager(user); + } + + @Bean + public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + http.authorizeRequests() + .antMatchers("/task-runners/**") + .hasRole("USER") + .antMatchers("/**") + .permitAll() + .and() + .httpBasic(); + return http.build(); + } + + @Bean + public BCryptPasswordEncoder passwordEncoder() { + return new BCryptPasswordEncoder(); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebTestConfig.java new file mode 100644 index 000000000..b29a3b35b --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebTestConfig.java @@ -0,0 +1,34 @@ +package ru.spcex.clearing.backendapi.controller.config; + +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import ru.spcex.clearing.backendapi.config.WebConfig; +import ru.spcex.clearing.backendapi.config.element.BackendApiSettings; +import ru.spcex.clearing.backendapi.security.element.SecuritySettings; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Properties; + +@Configuration +@Import({BackendApiSettings.class}) +public class WebTestConfig { + + @Bean("webConfigTest") + public WebConfig createWebConfig(@Qualifier("customJsonHttpConverter") MappingJackson2HttpMessageConverter customJsonHttpConverter) throws IOException { + String rootPath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); + String appConfigPath = rootPath + "application.properties"; + + Properties appProps = new Properties(); + appProps.load(new FileInputStream(appConfigPath)); + + BackendApiSettings backendSettings = new BackendApiSettings(); + backendSettings.setSecurity(new SecuritySettings()); + backendSettings.getSecurity().setSameSite(appProps.getProperty("backend-api.security.same-site", "no")); + return new WebConfig(customJsonHttpConverter, backendSettings); + } + +} diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java new file mode 100644 index 000000000..2a5e01787 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java @@ -0,0 +1,119 @@ +package ru.spcex.clearing.backendapi.controller.queue; + +import org.apache.kafka.clients.producer.MockProducer; +import org.apache.kafka.clients.producer.ProducerRecord; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.ResultActions; +import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; +import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.filter.CharacterEncodingFilter; +import ru.spcex.clearing.backendapi.controller.config.*; +import ru.spcex.clearing.backendapi.controller.queue.account.AccountBalanceController; +import ru.spcex.clearing.backendapi.controller.queue.account.AccountController; +import ru.spcex.clearing.backendapi.controller.queue.account.BankAccountController; +import ru.spcex.clearing.backendapi.controller.queue.company.*; +import ru.spcex.clearing.backendapi.controller.queue.misc.NotificationController; +import ru.spcex.clearing.backendapi.controller.queue.misc.SessionController; +import ru.spcex.clearing.backendapi.controller.queue.payment.PaymentInstructionController; +import ru.spcex.clearing.backendapi.controller.queue.scheduler.ClearingCalendarController; +import ru.spcex.clearing.backendapi.controller.queue.scheduler.LauncherController; +import ru.spcex.clearing.backendapi.controller.queue.scheduler.PlannerAllTodayController; +import ru.spcex.clearing.backendapi.controller.utils.MatcherFactory; +import ru.spcex.clearing.backendapi.controller.utils.TestUtils; +import ru.spcex.clearing.backendapi.meta.GetResponseFactory; +import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; + +import javax.annotation.PostConstruct; +import java.util.concurrent.atomic.AtomicLong; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; +import static ru.spcex.clearing.backendapi.controller.utils.MatcherFactory.usingIgnoringFieldsComparator; + + +@ContextConfiguration(classes = { + //account + AccountBalanceController.class, + AccountController.class, + BankAccountController.class, + //company + CompanyRoleSetController.class, + DeleteCompanyController.class, + EditClearingMemberCategoryController.class, + EditCompanyInfoController.class, + EditCompanySymbolController.class, + EditContactController.class, + ProfileDocumentController.class, + RelationController.class, + //misc + NotificationController.class, + SessionController.class, + //payment + PaymentInstructionController.class, + //scheduler + ClearingCalendarController.class, + PlannerAllTodayController.class,//PlanerAllTodayController + LauncherController.class, + //******* common configs ******* + WebTestConfig.class, + IOperatorTest.class, +// KafkaTestConfig.class, + HazelcastServiceTestConfiguration.class, + StateLoaderImplTestConfig.class, + WebSecurityTestConfigurer.class, + MessagesTestConfig.class, + Jackson2HttpConverterTestConfig.class}) +@ExtendWith(SpringExtension.class) +@WebMvcTest//(controllers = DeleteCompanyController.class) +@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/") +public abstract class AbstractControllerTest { + public static final MatcherFactory.Matcher BASE_REQUEST_MATCHER = usingIgnoringFieldsComparator(BaseRequest.class); + protected static final AtomicLong currentId = new AtomicLong(); + private static final CharacterEncodingFilter CHARACTER_ENCODING_FILTER = new CharacterEncodingFilter(); + + static { + CHARACTER_ENCODING_FILTER.setEncoding("UTF-8"); + CHARACTER_ENCODING_FILTER.setForceEncoding(true); + } + + @Autowired + @Qualifier("hazelcastServiceTest") + protected HazelcastService hazelcastServiceTest; + @Autowired + @Qualifier("responseFactoryTest") + protected GetResponseFactory responseFactory; + @Captor + protected ArgumentCaptor producerRecord; + @MockBean + protected MockProducer producer; + private MockMvc mockMvc; + @Autowired + private WebApplicationContext webApplicationContext; + + @PostConstruct + private void postConstruct() { + mockMvc = MockMvcBuilders + .webAppContextSetup(webApplicationContext) + .addFilter(CHARACTER_ENCODING_FILTER) +// .apply(springSecurity()) + .build(); + TestUtils.FutureRecordMetadata future = spy(TestUtils.FutureRecordMetadata.class); + doReturn(future).when(producer).send(producerRecord.capture()); + } + + protected ResultActions perform(MockHttpServletRequestBuilder builder) throws Exception { + return mockMvc.perform(builder); + } +} diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountBalanceControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountBalanceControllerTest.java new file mode 100644 index 000000000..f31d56ecb --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountBalanceControllerTest.java @@ -0,0 +1,53 @@ +package ru.spcex.clearing.backendapi.controller.queue.account; + +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.account.AccountBalance; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.platform.imdg.api.Imdg; + +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class AccountBalanceControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/account-balances/"; + + /** + * {@link AccountBalanceController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /account-balances/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + AccountBalance existBankAccount = new AccountBalance(); + existBankAccount.setAccountType("99"); + existBankAccount.setAccount("123456789123"); + existBankAccount.setId(currentId.get()); + + Imdg accountImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_AccountBalance, AccountBalance.class); + accountImdg.insert(existBankAccount); + + Collection values = accountImdg.getAllValues(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountControllerTest.java new file mode 100644 index 000000000..a92bc478d --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountControllerTest.java @@ -0,0 +1,53 @@ +package ru.spcex.clearing.backendapi.controller.queue.account; + +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.account.Account; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.platform.imdg.api.Imdg; + +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class AccountControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/accounting/accounts/"; + + /** + * {@link AccountController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /securities/bank-accounts/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Account existBankAccount = new Account(); + existBankAccount.setAccountType("99"); + existBankAccount.setAccount("123456789123"); + existBankAccount.setId(currentId.get()); + + Imdg accountImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Account, Account.class); + accountImdg.insert(existBankAccount); + + Collection values = accountImdg.getAllValues(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java similarity index 62% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java index e0705f548..c76881610 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java @@ -1,68 +1,36 @@ package ru.spcex.clearing.backendapi.controller.queue.account; +import com.hazelcast.core.IMap; import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.NestedExceptionUtils; import org.springframework.http.MediaType; -import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; -import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.filter.CharacterEncodingFilter; -import ru.spcex.clearing.backendapi.config.WebConfig; -import ru.spcex.clearing.backendapi.controller.queue.config.*; -import ru.spcex.clearing.backendapi.controller.queue.utils.MatcherFactory; +import ru.clearing.classes.statics.data.account.BankAccount; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction; import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction; import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.account.BankAccountBackendGetById; +import ru.spcex.clearing.backendapi.controller.response.entity.account.BankAccountBackendGetFields; import ru.spcex.clearing.backendapi.domain.actions.IAction; import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; -import javax.annotation.PostConstruct; -import java.util.concurrent.atomic.AtomicLong; +import java.util.Collection; +import java.util.Map; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static ru.spcex.clearing.backendapi.controller.queue.utils.JsonUtil.writeValue; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; -@SpringJUnitWebConfig(classes = { - WebConfig.class, - IOperator.class, - BankAccountControllerConfig.class, - KafkaConfig.class, - HazelcastServiceTestConfiguration.class, - Jackson2HttpConverterConfig.class}) -class BankAccountControllerTest { - - public static final MatcherFactory.Matcher CUD_RESPONSE_MATCHER = MatcherFactory.usingIgnoringFieldsComparator(CudResponse.class); +class BankAccountControllerTest extends AbstractControllerTest { private static final String REST_URL = "/securities/bank-accounts/"; - private static final CharacterEncodingFilter CHARACTER_ENCODING_FILTER = new CharacterEncodingFilter(); - private static final AtomicLong currentId = new AtomicLong(); - - static { - CHARACTER_ENCODING_FILTER.setEncoding("UTF-8"); - CHARACTER_ENCODING_FILTER.setForceEncoding(true); - } - - private MockMvc mockMvc; - - @Autowired - private WebApplicationContext webApplicationContext; - - @PostConstruct - private void postConstruct() { - mockMvc = MockMvcBuilders - .webAppContextSetup(webApplicationContext) - .addFilter(CHARACTER_ENCODING_FILTER) -// .apply(springSecurity()) - .build(); - } /** * {@link BankAccountController#add(BankAccountNewAction)}
@@ -92,19 +60,19 @@ class BankAccountControllerTest { "01", "11111222223333344444"); - CudResponse extended = new CudResponse(); - extended.setCode(0L); - extended.setMessage("success"); - extended.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement())); + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement())); //ACT - mockMvc.perform(MockMvcRequestBuilders.post(REST_URL) - .contentType(MediaType.APPLICATION_JSON) - .content(writeValue(bankAccountNewAction))) + perform(MockMvcRequestBuilders.post(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(bankAccountNewAction))) .andDo(print())//output to the log request and response -// ASSERT + //ASSERT .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().json(writeValue(extended))); + .andExpect(content().json(writeValue(expected))); } /** @@ -146,7 +114,6 @@ class BankAccountControllerTest { * {@link BankAccountUpdateAction#destination} - destination
* {@link BankAccountUpdateAction#taxpayerIdentificationNumber} - 3664011397
* {@link BankAccountUpdateAction#taxRegistrationReasonCode} - 01
- * {@link BankAccountUpdateAction#account} - 11111222223333344444
*/ @Test void update() throws Exception { @@ -162,48 +129,129 @@ class BankAccountControllerTest { "01", "11111222223333344444"); - CudResponse extended = new CudResponse(); - extended.setCode(0L); - extended.setMessage("success"); - extended.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); //ACT - mockMvc.perform(MockMvcRequestBuilders.put(REST_URL + "0") - .contentType(MediaType.APPLICATION_JSON) - .content(writeValue(bankAccountNewAction))) + perform(MockMvcRequestBuilders.put(REST_URL + "0") + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(bankAccountNewAction))) .andDo(print())//output to the log request and response -// ASSERT + // ASSERT .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().json(writeValue(extended))); + .andExpect(content().json(writeValue(expected))); } - /** * {@link BankAccountController#delete(Long)}
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.
- * Входной запрос {@link Long}: - 0L
+ * Входной запрос /securities/bank-accounts/{@link Long}: - 0L
*/ @Test void delete() throws Exception { //ARRANGE - CudResponse extended = new CudResponse(); - extended.setCode(0L); - extended.setMessage("success"); - extended.setPayload(new QueueSuccessResponse(ActionType.DELETE, currentId.getAndIncrement())); + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, currentId.getAndIncrement())); //ACT - mockMvc.perform(MockMvcRequestBuilders.delete(REST_URL + "0") - .contentType(MediaType.APPLICATION_JSON)) + perform(MockMvcRequestBuilders.delete(REST_URL + "0") + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link BankAccountController#getById(Long)}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /securities/bank-accounts/{@link Long}: - 0L
+ * Ответ BankAccountBackendGetById
+ */ + @Test + void getById() throws Exception { + //ARRANGE + BankAccount existBankAccount = new BankAccount(); + existBankAccount.setBankName("ooo tinkoff"); + existBankAccount.setBankIdentificationCode("99999"); + existBankAccount.setCorrespondentAccount("9294189285498598598"); + existBankAccount.setCorrespondentAccountName("BIK OF TINKOFF"); + existBankAccount.setCurrency("RUB"); + existBankAccount.setDestination("OOO ROGA I KOPITA"); + existBankAccount.setTaxpayerIdentificationNumber("848484848484"); + existBankAccount.setTaxRegistrationReasonCode("886886"); + existBankAccount.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); + iMap.put(existBankAccount.getId(), existBankAccount); + + BankAccountBackendGetById expected = new BankAccountBackendGetById(); + BankAccountBackendGetFields payload = new BankAccountBackendGetFields(); + payload.setBankName("ooo tinkoff"); + payload.setBankIdentificationCode("99999"); + payload.setCorrespondentAccount("9294189285498598598"); + payload.setCorrespondentAccountName("BIK OF TINKOFF"); + payload.setCurrency("RUB"); + payload.setDestination("OOO ROGA I KOPITA"); + payload.setTaxpayerIdentificationNumber("848484848484"); + payload.setTaxRegistrationReasonCode("886886"); + payload.setId(existBankAccount.getId()); + expected.setPayload(payload); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId()) + .contentType(MediaType.APPLICATION_JSON)) .andDo(print())//output to the log request and response // ASSERT .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().json(writeValue(extended))); + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link BankAccountController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /securities/bank-accounts/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + BankAccount existBankAccount = new BankAccount(); + existBankAccount.setBankName("ooo tinkoff"); + existBankAccount.setBankIdentificationCode("99999"); + existBankAccount.setCorrespondentAccount("9294189285498598598"); + existBankAccount.setCorrespondentAccountName("BIK OF TINKOFF"); + existBankAccount.setCurrency("RUB"); + existBankAccount.setDestination("OOO ROGA I KOPITA"); + existBankAccount.setTaxpayerIdentificationNumber("848484848484"); + existBankAccount.setTaxRegistrationReasonCode("886886"); + existBankAccount.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); + iMap.put(existBankAccount.getId(), existBankAccount); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); } private void assertThrowsFor(IAction iAction) { assertThrows(ActionValidationException.class, () -> { try { - mockMvc.perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); } catch (Exception e) { Throwable rootCause = NestedExceptionUtils.getRootCause(e); throw rootCause != null ? rootCause : e; @@ -239,7 +287,6 @@ class BankAccountControllerTest { bankAccountUpdateAction.setDestination(Destination); bankAccountUpdateAction.setTaxpayerIdentificationNumber(TaxpayerIdentificationNumber); bankAccountUpdateAction.setTaxRegistrationReasonCode(TaxRegistrationReasonCode); - bankAccountUpdateAction.setAccount(Account); return bankAccountUpdateAction; } } \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/CompanyRoleSetControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/CompanyRoleSetControllerTest.java new file mode 100644 index 000000000..5e3fd3b19 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/CompanyRoleSetControllerTest.java @@ -0,0 +1,53 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.company.CompanyRoleSet; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.platform.imdg.api.Imdg; + +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class CompanyRoleSetControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/company-role-sets/"; + + /** + * {@link CompanyRoleSetController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /company-role-sets/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + CompanyRoleSet existBankAccount = new CompanyRoleSet(); + existBankAccount.setCompanyId(11L); + existBankAccount.setRoleId(12L); + existBankAccount.setId(currentId.get()); + + Imdg accountImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_CompanyRoleSet, CompanyRoleSet.class); + accountImdg.insert(existBankAccount); + + Collection values = accountImdg.getAllValues(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java new file mode 100644 index 000000000..e2c9251b8 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java @@ -0,0 +1,80 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.company.Company; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; + +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class DeleteCompanyControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/companies/"; + + /** + * {@link DeleteCompanyController#delete(Long)}
+ * Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.
+ * Входной запрос /companies/{@link Long}: - 0L
+ */ + @Test + void delete() throws Exception { + //ARRANGE + CudResponse extended = new CudResponse(); + extended.setCode(0L); + extended.setMessage("success"); + extended.setPayload(new QueueSuccessResponse(ActionType.DELETE, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.delete(REST_URL + "0") + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + // ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(extended))); + } + + /** + * {@link DeleteCompanyController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Company.
+ * Входной запрос /companies
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Company existCompany = new Company(); + existCompany.setTradingCode("ooo tinkoff"); + existCompany.setClearingCode("99999"); + existCompany.setFullName("BIK OF TINKOFF"); + existCompany.setShortName("OOO ROGA I KOPITA"); + existCompany.setTradingCode("848484848484"); + existCompany.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Company); + iMap.put(existCompany.getId(), existCompany); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditClearingMemberCategoryControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditClearingMemberCategoryControllerTest.java new file mode 100644 index 000000000..8b23a131d --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditClearingMemberCategoryControllerTest.java @@ -0,0 +1,173 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.core.NestedExceptionUtils; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.generated.ClearingMemberCategory; +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.ClearingMemberCategoryUpdateAction; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; + +import java.util.Collection; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class EditClearingMemberCategoryControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/clearing-member-categories/"; + + /** + * {@link EditClearingMemberCategoryController#add(ClearingMemberCategoryNewAction)}
+ * Тест проверяет получение сущности {@link ClearingMemberCategoryNewAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link ClearingMemberCategoryNewAction}:
+ * {@link ClearingMemberCategoryNewAction#clearingMemberCategory} - "Category"
+ * {@link ClearingMemberCategoryNewAction#companyId} - currentId
+ */ + @Test + void add() throws Exception { + //ARRANGE + ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction(); + clearingMemberCategoryNewAction.setClearingMemberCategory("Category"); + clearingMemberCategoryNewAction.setCompanyId(0L); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.post(REST_URL) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(clearingMemberCategoryNewAction))) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link EditClearingMemberCategoryController#add(ClearingMemberCategoryNewAction)}
+ * Тест проверяет получение сущности {@link ClearingMemberCategoryNewAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link ClearingMemberCategoryNewAction}:
+ * {@link ClearingMemberCategoryNewAction#clearingMemberCategory} - "Category"
+ * {@link ClearingMemberCategoryNewAction#companyId} - currentId
+ */ +// @Test валидации пока нет + void addWithException() { + assertThrowsFor(getClearingMemberCategoryNewAction("Category", null)); + assertThrowsFor(getClearingMemberCategoryNewAction("", 0L)); + } + + /** + * {@link EditClearingMemberCategoryController#update(Long, ClearingMemberCategoryUpdateAction)}
+ * Тест проверяет получение сущности {@link ClearingMemberCategoryUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link ClearingMemberCategoryUpdateAction}:
+ * {@link ClearingMemberCategoryUpdateAction#clearingMemberCategory} - Category
+ * {@link ClearingMemberCategoryUpdateAction#id} - currentId
+ */ + @Test + void update() throws Exception { + //ARRANGE + ClearingMemberCategoryUpdateAction clearingMemberCategoryUpdateAction = new ClearingMemberCategoryUpdateAction(); + clearingMemberCategoryUpdateAction.setClearingMemberCategory("Category"); + clearingMemberCategoryUpdateAction.setId(currentId.get()); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.put(REST_URL + clearingMemberCategoryUpdateAction.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(clearingMemberCategoryUpdateAction))) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link EditClearingMemberCategoryController#delete(Long)}
+ * Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.
+ * Входной запрос /clearing-member-categories/{@link Long}: - currentId
+ */ + @Test + void delete() throws Exception { + //ARRANGE + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.DELETE, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.delete(REST_URL + expected.getPayload().getId()) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link EditClearingMemberCategoryController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingMemberCategory.
+ * Входной запрос /clearing-member-categories/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + ClearingMemberCategory clearingMemberCategory = new ClearingMemberCategory(); + clearingMemberCategory.setClearingMemberCategory("Category"); + clearingMemberCategory.setCompanyId(1000000L); + clearingMemberCategory.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); + iMap.put(clearingMemberCategory.getId(), clearingMemberCategory); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + private void assertThrowsFor(IAction iAction) { + assertThrows(ActionValidationException.class, () -> { + try { + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + } catch (Exception e) { + Throwable rootCause = NestedExceptionUtils.getRootCause(e); + throw rootCause != null ? rootCause : e; + } + }); + } + + private ClearingMemberCategoryNewAction getClearingMemberCategoryNewAction(String category, Long companyId) { + ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction(); + clearingMemberCategoryNewAction.setClearingMemberCategory(category); + clearingMemberCategoryNewAction.setCompanyId(companyId); + return clearingMemberCategoryNewAction; + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanyInfoControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanyInfoControllerTest.java new file mode 100644 index 000000000..8c10171b1 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanyInfoControllerTest.java @@ -0,0 +1,126 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import org.junit.jupiter.api.Test; +import org.springframework.core.NestedExceptionUtils; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +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.CompanyInfoUpdateAction; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.platform.messaging.domain.ActionType; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class EditCompanyInfoControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/company-infos/"; + + /** + * {@link EditCompanyInfoController#update(Long, CompanyInfoUpdateAction)}
+ * Тест проверяет получение сущности {@link CompanyInfoUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link CompanyInfoUpdateAction}:
+ * {@link CompanyInfoUpdateAction#clearingCode} - 11
+ * {@link CompanyInfoUpdateAction#tradingCode} - 11
+ * {@link CompanyInfoUpdateAction#corporationSoleType} - 0000
+ * {@link CompanyInfoUpdateAction#countryCode} - 0000
+ * {@link CompanyInfoUpdateAction#description} - exists description
+ * {@link CompanyInfoUpdateAction#professionalSign} - 0000
+ * {@link CompanyInfoUpdateAction#legalKind} - 0000
+ * {@link CompanyInfoUpdateAction#organizationType} - 0000
+ * {@link CompanyInfoUpdateAction#residence} - 0000
+ * {@link CompanyInfoUpdateAction#shortNameEng} - exists shortNameEng
+ * {@link CompanyInfoUpdateAction#fullNameEng} - exists fullNameEng
+ * {@link CompanyInfoUpdateAction#shortName} - exists shortName
+ * {@link CompanyInfoUpdateAction#fullName} - exists fullName
+ * {@link CompanyInfoUpdateAction- Category
+ * {@link CompanyInfoUpdateAction- Category
+ * {@link CompanyInfoUpdateAction- Category
+ * {@link CompanyInfoUpdateAction#id} - currentId
+ */ +// @Test валидации пока нет + void addWithException() { + assertThrowsFor(getClearingMemberCategoryNewAction("Category", null)); + assertThrowsFor(getClearingMemberCategoryNewAction("", 0L)); + } + + /** + * {@link EditCompanyInfoController#update(Long, CompanyInfoUpdateAction)}
+ * Тест проверяет получение сущности {@link CompanyInfoUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link CompanyInfoUpdateAction}:
+ * {@link CompanyInfoUpdateAction#clearingCode} - 11
+ * {@link CompanyInfoUpdateAction#tradingCode} - 11
+ * {@link CompanyInfoUpdateAction#corporationSoleType} - 0000
+ * {@link CompanyInfoUpdateAction#countryCode} - 0000
+ * {@link CompanyInfoUpdateAction#description} - exists description
+ * {@link CompanyInfoUpdateAction#professionalSign} - 0000
+ * {@link CompanyInfoUpdateAction#legalKind} - 0000
+ * {@link CompanyInfoUpdateAction#organizationType} - 0000
+ * {@link CompanyInfoUpdateAction#residence} - 0000
+ * {@link CompanyInfoUpdateAction#shortNameEng} - exists shortNameEng
+ * {@link CompanyInfoUpdateAction#fullNameEng} - exists fullNameEng
+ * {@link CompanyInfoUpdateAction#shortName} - exists shortName
+ * {@link CompanyInfoUpdateAction#fullName} - exists fullName
+ * {@link CompanyInfoUpdateAction- Category
+ * {@link CompanyInfoUpdateAction- Category
+ * {@link CompanyInfoUpdateAction- Category
+ * {@link CompanyInfoUpdateAction#id} - currentId
+ */ + @Test + void update() throws Exception { + //ARRANGE + CompanyInfoUpdateAction companyInfoUpdateAction = new CompanyInfoUpdateAction(); + companyInfoUpdateAction.setClearingCode("11"); + companyInfoUpdateAction.setTradingCode("11"); + companyInfoUpdateAction.setCorporationSoleType("0000"); + companyInfoUpdateAction.setCountryCode("0000"); + companyInfoUpdateAction.setDescription("exists description"); + companyInfoUpdateAction.setProfessionalSign("0000"); + companyInfoUpdateAction.setLegalKind("0000"); + companyInfoUpdateAction.setOrganizationType("0000"); + companyInfoUpdateAction.setResidence("0000"); + companyInfoUpdateAction.setShortNameEng("exists shortNameEng"); + companyInfoUpdateAction.setFullNameEng("exists fullNameEng"); + companyInfoUpdateAction.setShortName("exists shortName"); + companyInfoUpdateAction.setFullName("exists fullName"); + companyInfoUpdateAction.setId(currentId.get()); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.put(REST_URL + companyInfoUpdateAction.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(companyInfoUpdateAction))) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + private void assertThrowsFor(IAction iAction) { + assertThrows(ActionValidationException.class, () -> { + try { + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + } catch (Exception e) { + Throwable rootCause = NestedExceptionUtils.getRootCause(e); + throw rootCause != null ? rootCause : e; + } + }); + } + + private ClearingMemberCategoryNewAction getClearingMemberCategoryNewAction(String category, Long companyId) { + ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction(); + clearingMemberCategoryNewAction.setClearingMemberCategory(category); + clearingMemberCategoryNewAction.setCompanyId(companyId); + return clearingMemberCategoryNewAction; + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanySymbolControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanySymbolControllerTest.java new file mode 100644 index 000000000..157d217f5 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanySymbolControllerTest.java @@ -0,0 +1,129 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.core.NestedExceptionUtils; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.company.CompanySymbols; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.request.cud.company.ClearingMemberCategoryNewAction; +import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanySymbolUpdateAction; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; + +import java.util.Collection; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class EditCompanySymbolControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/company-symbols/"; + + /** + * {@link EditCompanySymbolController#update(Long, CompanySymbolUpdateAction)}
+ * Тест проверяет получение сущности {@link CompanySymbolUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link CompanySymbolUpdateAction}:
+ * {@link CompanySymbolUpdateAction#companyId} - 1000L
+ * {@link CompanySymbolUpdateAction#companySymbol} - Symbol
+ * {@link CompanySymbolUpdateAction#companySymbolValue} - SymbolValue
+ * {@link CompanySymbolUpdateAction#id} - currentId
+ */ +// @Test валидации пока нет + void addWithException() { + assertThrowsFor(getClearingMemberCategoryNewAction("Category", null)); + assertThrowsFor(getClearingMemberCategoryNewAction("", 0L)); + } + + /** + * {@link EditCompanySymbolController#update(Long, CompanySymbolUpdateAction)}
+ * Тест проверяет получение сущности {@link CompanySymbolUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link CompanySymbolUpdateAction}:
+ * {@link CompanySymbolUpdateAction#companyId} - 1000L
+ * {@link CompanySymbolUpdateAction#companySymbol} - Symbol
+ * {@link CompanySymbolUpdateAction#companySymbolValue} - SymbolValue
+ * {@link CompanySymbolUpdateAction#id} - currentId
+ */ + @Test + void update() throws Exception { + //ARRANGE + CompanySymbolUpdateAction companySymbolUpdateAction = new CompanySymbolUpdateAction(); + companySymbolUpdateAction.setCompanyId(1000L); + companySymbolUpdateAction.setCompanySymbol("Symbol"); + companySymbolUpdateAction.setCompanySymbolValue("SymbolValue"); + companySymbolUpdateAction.setId(currentId.get()); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.put(REST_URL + companySymbolUpdateAction.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(companySymbolUpdateAction))) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link EditCompanySymbolController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_CompanySymbols.
+ * Входной запрос /clearing-member-categories/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + CompanySymbols companySymbols = new CompanySymbols(); + companySymbols.setCompanyId(1000L); + companySymbols.setCompanySymbol("Symbol"); + companySymbols.setCompanySymbolValue("SymbolValue"); + companySymbols.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_CompanySymbols); + iMap.put(companySymbols.getId(), companySymbols); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + private void assertThrowsFor(IAction iAction) { + assertThrows(ActionValidationException.class, () -> { + try { + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + } catch (Exception e) { + Throwable rootCause = NestedExceptionUtils.getRootCause(e); + throw rootCause != null ? rootCause : e; + } + }); + } + + private ClearingMemberCategoryNewAction getClearingMemberCategoryNewAction(String category, Long companyId) { + ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction(); + clearingMemberCategoryNewAction.setClearingMemberCategory(category); + clearingMemberCategoryNewAction.setCompanyId(companyId); + return clearingMemberCategoryNewAction; + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditContactControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditContactControllerTest.java new file mode 100644 index 000000000..bcd732ff7 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditContactControllerTest.java @@ -0,0 +1,130 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.core.NestedExceptionUtils; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.profile.Contact; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.request.cud.company.ClearingMemberCategoryNewAction; +import ru.spcex.clearing.backendapi.controller.request.cud.company.CompanySymbolUpdateAction; +import ru.spcex.clearing.backendapi.controller.request.cud.company.ContactUpdateAction; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; + +import java.util.Collection; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class EditContactControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/contacts/"; + + /** + * {@link EditCompanySymbolController#update(Long, CompanySymbolUpdateAction)}
+ * Тест проверяет получение сущности {@link CompanySymbolUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link CompanySymbolUpdateAction}:
+ * {@link CompanySymbolUpdateAction#companyId} - 1000L
+ * {@link CompanySymbolUpdateAction#companySymbol} - Symbol
+ * {@link CompanySymbolUpdateAction#companySymbolValue} - SymbolValue
+ * {@link CompanySymbolUpdateAction#id} - currentId
+ */ +// @Test валидации пока нет + void addWithException() { + assertThrowsFor(getClearingMemberCategoryNewAction("Category", null)); + assertThrowsFor(getClearingMemberCategoryNewAction("", 0L)); + } + + /** + * {@link EditContactController#update(Long, ContactUpdateAction)}
+ * Тест проверяет получение сущности {@link ContactUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link ContactUpdateAction}:
+ * {@link ContactUpdateAction#companyId} - 1000L
+ * {@link ContactUpdateAction#contactType} - ContactType
+ * {@link ContactUpdateAction#contactValue} - ContactValue
+ * {@link ContactUpdateAction#id} - currentId
+ */ + @Test + void update() throws Exception { + //ARRANGE + ContactUpdateAction companySymbolUpdateAction = new ContactUpdateAction(); + companySymbolUpdateAction.setCompanyId(1000L); + companySymbolUpdateAction.setContactType("ContactType"); + companySymbolUpdateAction.setContactValue("ContactValue"); + companySymbolUpdateAction.setId(currentId.get()); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); + //ACT + perform(MockMvcRequestBuilders.put(REST_URL + companySymbolUpdateAction.getId()) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(companySymbolUpdateAction))) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + /** + * {@link EditContactController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Contact.
+ * Входной запрос /contacts/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Contact companySymbolUpdateAction = new Contact(); + companySymbolUpdateAction.setCompanyId(1000L); + companySymbolUpdateAction.setContactType("ContactType"); + companySymbolUpdateAction.setContactValue("ContactValue"); + companySymbolUpdateAction.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Contact); + iMap.put(companySymbolUpdateAction.getId(), companySymbolUpdateAction); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + private void assertThrowsFor(IAction iAction) { + assertThrows(ActionValidationException.class, () -> { + try { + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + } catch (Exception e) { + Throwable rootCause = NestedExceptionUtils.getRootCause(e); + throw rootCause != null ? rootCause : e; + } + }); + } + + private ClearingMemberCategoryNewAction getClearingMemberCategoryNewAction(String category, Long companyId) { + ClearingMemberCategoryNewAction clearingMemberCategoryNewAction = new ClearingMemberCategoryNewAction(); + clearingMemberCategoryNewAction.setClearingMemberCategory(category); + clearingMemberCategoryNewAction.setCompanyId(companyId); + return clearingMemberCategoryNewAction; + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/ProfileDocumentControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/ProfileDocumentControllerTest.java new file mode 100644 index 000000000..95b798af2 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/ProfileDocumentControllerTest.java @@ -0,0 +1,64 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.profile.ProfileDocument; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; + +import java.time.LocalDate; +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class ProfileDocumentControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/profile-documents/"; + + /** + * {@link ProfileDocumentController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ProfileDocument.
+ * Входной запрос /profile-documents/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + ProfileDocument profileDocument = new ProfileDocument(); + profileDocument.setCompanyId(1000L); + profileDocument.setDocumentType("DocumentType"); + profileDocument.setIssueDate(LocalDate.now()); + profileDocument.setIssuePlace("IssuePlace"); + profileDocument.setIssuer("Issuer"); + profileDocument.setIssuerCode("IssuerCode"); + profileDocument.setName("Name"); + profileDocument.setNumber("Number"); + profileDocument.setPlace("Place"); + profileDocument.setValidFromDate(LocalDate.now()); + profileDocument.setValidToDate(LocalDate.now()); + profileDocument.setLink("Link"); + profileDocument.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ProfileDocument); + iMap.put(profileDocument.getId(), profileDocument); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/RelationControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/RelationControllerTest.java new file mode 100644 index 000000000..788a2fec3 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/RelationControllerTest.java @@ -0,0 +1,138 @@ +package ru.spcex.clearing.backendapi.controller.queue.company; + +import org.junit.jupiter.api.Test; +import org.springframework.core.NestedExceptionUtils; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.account.BankAccount; +import ru.clearing.classes.statics.data.company.relation.Relation; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.queue.account.BankAccountController; +import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUpdateAction; +import ru.spcex.clearing.backendapi.controller.request.cud.company.RelationUpdateAction; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; +import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.clearing.platform.messaging.domain.Consts; +import ru.spcex.platform.imdg.api.Imdg; + +import java.util.Collection; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class RelationControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/relations/"; + + /** + * {@link BankAccountController#update(Long, BankAccountUpdateAction)}
+ * Тест проверяет получение сущности {@link BankAccountUpdateAction} по REST API и отправку в Apache Kafka.
+ * Входной запрос {@link BankAccountUpdateAction}:
+ * {@link BankAccountUpdateAction#bankIdentificationCode} - 044525776
+ * {@link BankAccountUpdateAction#bankName} - Beta Money Bank
+ * {@link BankAccountUpdateAction#correspondentAccount} - 30101111111111111776
+ * {@link BankAccountUpdateAction#correspondentAccountName} - correspondent
+ * {@link BankAccountUpdateAction#currency} - RUB
+ * {@link BankAccountUpdateAction#destination} - destination
+ * {@link BankAccountUpdateAction#taxpayerIdentificationNumber} - 3664011397
+ * {@link BankAccountUpdateAction#taxRegistrationReasonCode} - 01
+ */ + @Test + void update() throws Exception { + //ARRANGE + Long existsId = 123L; + RelationUpdateAction relationUpdateAction = new RelationUpdateAction(); + relationUpdateAction.setId(existsId); + relationUpdateAction.setServiceStatus("Ok"); + relationUpdateAction.setComment("It`s good"); + BaseRequest predictableBaseRequest = new BaseRequest<>(); + predictableBaseRequest.setActionType(relationUpdateAction.getActionType()); + predictableBaseRequest.setRequestPayload(relationUpdateAction.toRequest()); + + Relation relation = new Relation(); + relation.setId(existsId); + Imdg relationImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Relation, Relation.class); + relationImdg.insert(relation); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.UPDATE, currentId.getAndIncrement())); + + //ACT + perform(MockMvcRequestBuilders.put(REST_URL + existsId) + .contentType(MediaType.APPLICATION_JSON) + .content(writeValue(relationUpdateAction))) + .andDo(print())//output to the log request and response + // ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + assertEquals(Consts.DESTINATION_RELATION_UPDATE, producerRecord.getValue().topic()); + BaseRequest baseRequestResult = (BaseRequest) producerRecord.getValue().value(); + predictableBaseRequest.setId(baseRequestResult.getId()); + BASE_REQUEST_MATCHER.assertMatch(baseRequestResult, predictableBaseRequest); + } + + /** + * {@link RelationController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /relations/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Long existsId = 123L; + BankAccount existBankAccount = new BankAccount(); + existBankAccount.setBankName("ooo tinkoff"); + existBankAccount.setBankIdentificationCode("99999"); + existBankAccount.setCorrespondentAccount("9294189285498598598"); + existBankAccount.setCorrespondentAccountName("BIK OF TINKOFF"); + existBankAccount.setCurrency("RUB"); + existBankAccount.setDestination("OOO ROGA I KOPITA"); + existBankAccount.setTaxpayerIdentificationNumber("848484848484"); + existBankAccount.setTaxRegistrationReasonCode("886886"); + existBankAccount.setId(currentId.get()); + + + Relation relation = new Relation(); + relation.setId(existsId); + Imdg relationImdg = hazelcastServiceTest.getImdg(IMDGDistributedNames.Map_Relation, Relation.class); + relationImdg.insert(relation); + + Collection values = relationImdg.getAllValues(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + private void assertThrowsFor(IAction iAction) { + assertThrows(ActionValidationException.class, () -> { + try { + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + } catch (Exception e) { + Throwable rootCause = NestedExceptionUtils.getRootCause(e); + throw rootCause != null ? rootCause : e; + } + }); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/NotificationControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/NotificationControllerTest.java new file mode 100644 index 000000000..708cb12c3 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/NotificationControllerTest.java @@ -0,0 +1,59 @@ +package ru.spcex.clearing.backendapi.controller.queue.misc; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.misc.Notification; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; + +import java.time.Instant; +import java.time.LocalDate; +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class NotificationControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/notifications/"; + + /** + * {@link NotificationController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Notification.
+ * Входной запрос /notifications/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Notification profileDocument = new Notification(); + profileDocument.setClearingDate(LocalDate.now()); + profileDocument.setSenderId(1000L); + profileDocument.setAddresseeId(1000L); + profileDocument.setObjectType("ObjectType"); + profileDocument.setObjectId(Instant.now()); + profileDocument.setNotificationStatus("Status"); + profileDocument.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Notification); + iMap.put(profileDocument.getId(), profileDocument); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/SessionControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/SessionControllerTest.java new file mode 100644 index 000000000..83d4ebcef --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/SessionControllerTest.java @@ -0,0 +1,54 @@ +package ru.spcex.clearing.backendapi.controller.queue.misc; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.misc.Session; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; + +import java.time.LocalDate; +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class SessionControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/sessions/"; + + /** + * {@link SessionController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Session.
+ * Входной запрос /sessions/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Session session = new Session(); + session.setClearingDate(LocalDate.now()); + session.setSessionStatus("Ok"); + session.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Session); + iMap.put(session.getId(), session); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/payment/PaymentInstructionControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/payment/PaymentInstructionControllerTest.java new file mode 100644 index 000000000..e2df876d8 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/payment/PaymentInstructionControllerTest.java @@ -0,0 +1,77 @@ +package ru.spcex.clearing.backendapi.controller.queue.payment; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.payment.PaymentInstruction; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; + +import java.time.Instant; +import java.time.LocalDate; +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class PaymentInstructionControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/paymentInstructions/"; + + /** + * {@link PaymentInstructionController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_PaymentInstruction.
+ * Входной запрос /paymentInstructions/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + PaymentInstruction paymentInstruction = new PaymentInstruction(); + paymentInstruction.setSenderId(1010L); + paymentInstruction.setAddresseeId(1010L); + paymentInstruction.setAdresseeBic("123456789"); + paymentInstruction.setPayeeBankName("BankName"); + paymentInstruction.setPayeeBic("123456789"); + paymentInstruction.setAddresseeBankName("BankName"); + paymentInstruction.setPaymentDate(Instant.now()); + paymentInstruction.setPaymentPurpose("Purpose"); + paymentInstruction.setSettlementDate(LocalDate.now()); + paymentInstruction.setCreditLegAmount(2020L); + paymentInstruction.setDebitLegAmount(2020L); + paymentInstruction.setCreditLegAccountId(2020L); + paymentInstruction.setCreditCsAccount("Ok"); + paymentInstruction.setCreditLegAccount("123456789"); + paymentInstruction.setDebitLegAccountId(3030L); + paymentInstruction.setDebitCsAccount("123456789"); + paymentInstruction.setDebitLegAccount("123456789"); + paymentInstruction.setCreditLegDirection(3030L); + paymentInstruction.setDebitLegDirection(3030L); + paymentInstruction.setCreditLegCurrencyCode("123456789"); + paymentInstruction.setDebitLegCurrencyCode("123456789"); + paymentInstruction.setClearingDate(LocalDate.now()); + paymentInstruction.setTransactionStatus("Status"); + paymentInstruction.setDocumentNumber("123456789"); + paymentInstruction.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_PaymentInstruction); + iMap.put(paymentInstruction.getId(), paymentInstruction); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/LauncherControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/LauncherControllerTest.java new file mode 100644 index 000000000..b8b55a42b --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/LauncherControllerTest.java @@ -0,0 +1,169 @@ +package ru.spcex.clearing.backendapi.controller.queue.scheduler; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.keycloak.KeycloakPrincipal; +import org.keycloak.KeycloakSecurityContext; +import org.keycloak.adapters.spi.KeycloakAccount; +import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken; +import org.keycloak.representations.AccessToken; +import org.springframework.core.NestedExceptionUtils; +import org.springframework.http.MediaType; +import org.springframework.security.core.context.SecurityContextHolder; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.scheduler.Launcher; +import ru.clearing.classes.statics.data.user.User; +import ru.clearing.platform.dictionary.TaskDictionary; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.queue.account.BankAccountController; +import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction; +import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; +import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.backendapi.domain.actions.IAction; +import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.imdg.IMDGDistributedNames; +import ru.spcex.clearing.platform.messaging.domain.ActionType; +import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; + +import java.util.Collection; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class LauncherControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/task-runners/"; + + /** + * {@link LauncherController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_TaskRunner.
+ * Входной запрос /task-runners/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Launcher taskRunner = new Launcher(); + taskRunner.setTask("Task"); + taskRunner.setSenderId(10210L); + taskRunner.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Launcher); + iMap.put(taskRunner.getId(), taskRunner); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + + // @Test todo пока не работает ( + void add() throws Exception { + //ARRANGE + TaskDictionary taskDictionary = new TaskDictionary(); + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_TaskDictionary); + iMap.put(taskDictionary.getId(), taskDictionary); + + CudResponse expected = new CudResponse(); + expected.setCode(0L); + expected.setMessage("success"); + expected.setPayload(new QueueSuccessResponse(ActionType.NEW, currentId.getAndIncrement())); + + setUserNameInMockSecurityContextAndMapUser("existUser"); + + //ACT + perform(MockMvcRequestBuilders.post(REST_URL + "ABLK") + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } + + private void setUserNameInMockSecurityContextAndMapUser(String username) { + User user = new User(); + user.setIdentifier(username); + user.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_User); + iMap.put(user.getId(), user); + + AccessToken accessToken = mock(AccessToken.class); + when(accessToken.getPreferredUsername()).thenReturn(username); + + KeycloakSecurityContext keycloakSecurityContext = mock(KeycloakSecurityContext.class); + when(keycloakSecurityContext.getToken()).thenReturn(accessToken); + + KeycloakPrincipal keycloakPrincipal = mock(KeycloakPrincipal.class); + when(keycloakPrincipal.getKeycloakSecurityContext()).thenReturn(keycloakSecurityContext); + + KeycloakAccount details = mock(KeycloakAccount.class); + when(details.getPrincipal()).thenReturn(keycloakPrincipal); + + KeycloakAuthenticationToken authentication = mock(KeycloakAuthenticationToken.class); + when(authentication.getDetails()).thenReturn(details); + SecurityContextHolder.getContext().setAuthentication(authentication); + } +// @Test +// void testWithPostProcessor() выдает Exception { +// perform(MockMvcRequestBuilders.get("/greet").with(jwt().jwt(jwt -> { +// jwt.claim("preferred_username", "Tonton Pirate"); +// }).authorities(List.of(new SimpleGrantedAuthority("NICE_GUY"), new SimpleGrantedAuthority("AUTHOR"))))) +// .andExpect(status().isOk()) +// .andExpect(content().string("Hi Tonton Pirate! You are granted with: [NICE_GUY, AUTHOR].")); +// } + + /** + * {@link BankAccountController#add(BankAccountNewAction)}
+ * Тест проверяет работу валидации сущности {@link BankAccountNewAction} принятой по REST API для отправку в Apache Kafka.
+ * Входной запрос {@link BankAccountNewRequest}:
+ * {@link BankAccountNewRequest#bankIdentificationCode} - 044525776 или ""
+ * {@link BankAccountNewRequest#bankName} - Beta Money Bank или ""
+ * {@link BankAccountNewRequest#correspondentAccount} - 30101111111111111776 или ""
+ * {@link BankAccountNewRequest#correspondentAccountName} - correspondent или ""
+ * {@link BankAccountNewRequest#currency} - RUB или ""
+ * {@link BankAccountNewRequest#destination} - destinatio или ""n
+ * {@link BankAccountNewRequest#taxpayerIdentificationNumber} - 3664011397 или ""
+ * {@link BankAccountNewRequest#taxRegistrationReasonCode} - 01 или ""
+ * {@link BankAccountNewRequest#account} - 11111222223333344444 или ""
+ */ + @Test + void addWithException() { +// assertThrowsFor(getBankAccountNewAction("", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "", "correspondent", "RUB", "destination", "3664011397", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "30101111111111111776", "", "RUB", "destination", "3664011397", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "", "destination", "3664011397", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "", "3664011397", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "", "01", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "", "11111222223333344444")); +// assertThrowsFor(getBankAccountNewAction("044525776", "Beta Money Bank", "30101111111111111776", "correspondent", "RUB", "destination", "3664011397", "01", "")); + } + + private void assertThrowsFor(IAction iAction) { + assertThrows(ActionValidationException.class, () -> { + try { + perform(MockMvcRequestBuilders.post(REST_URL).contentType(MediaType.APPLICATION_JSON).content(writeValue(iAction))); + } catch (Exception e) { + Throwable rootCause = NestedExceptionUtils.getRootCause(e); + throw rootCause != null ? rootCause : e; + } + }); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerAllTodayControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerAllTodayControllerTest.java new file mode 100644 index 000000000..1133c7a05 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerAllTodayControllerTest.java @@ -0,0 +1,61 @@ +package ru.spcex.clearing.backendapi.controller.queue.scheduler; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.scheduler.PlannerAllToday; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class PlannerAllTodayControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/schedule/schedulers-all-today/"; + + /** + * {@link PlannerAllTodayController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_SchedulerAllToday.
+ * Входной запрос /schedule/schedulers-all-today/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + PlannerAllToday schedulerAllToday = new PlannerAllToday(); + schedulerAllToday.setTask("Task"); + schedulerAllToday.setTaskTime(LocalTime.now()); + schedulerAllToday.setClearingDate(LocalDate.now()); + schedulerAllToday.setMarket("Market"); + schedulerAllToday.setTaskStatus("Ok"); + schedulerAllToday.setSecurityId(10210L); + schedulerAllToday.setParent("Source"); + schedulerAllToday.setParentId(1010L); + schedulerAllToday.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_PlannerAllToday); + iMap.put(schedulerAllToday.getId(), schedulerAllToday); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerControllerTest.java new file mode 100644 index 000000000..744fc355e --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerControllerTest.java @@ -0,0 +1,59 @@ +package ru.spcex.clearing.backendapi.controller.queue.scheduler; + +import com.hazelcast.core.IMap; +import org.junit.jupiter.api.Test; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; +import ru.clearing.classes.statics.data.scheduler.Planner; +import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; +import ru.spcex.clearing.backendapi.controller.response.entity.CommonGetAllResponse; +import ru.spcex.clearing.imdg.IMDGDistributedNames; + +import java.time.LocalDate; +import java.time.LocalTime; +import java.util.Collection; +import java.util.Map; + +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; + +class PlannerControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/schedule/schedulers/"; + + /** + * {@link PlannerController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Scheduler.
+ * Входной запрос /schedule/schedulers/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Planner scheduler = new Planner(); + scheduler.setTask("Task"); + scheduler.setTaskTime(LocalTime.now()); + scheduler.setClearingDate(LocalDate.now()); + scheduler.setMarket("Market"); + scheduler.setTaskStatus("Ok"); + scheduler.setSecurityId(10210L); + scheduler.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Planner); + iMap.put(scheduler.getId(), scheduler); + + Collection values = iMap.values(); + Collection> all = responseFactory.responseFromObjectCollection(values); + CommonGetAllResponse expected = new CommonGetAllResponse(); + expected.fromEntity(all); + //ACT + perform(MockMvcRequestBuilders.get(REST_URL) + .contentType(MediaType.APPLICATION_JSON)) + .andDo(print())//output to the log request and response + //ASSERT + .andExpect(status().isOk()) + .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) + .andExpect(content().json(writeValue(expected))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/JsonUtil.java similarity index 88% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/JsonUtil.java index 2780f9465..cfbac9b79 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/JsonUtil.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.utils; +package ru.spcex.clearing.backendapi.controller.utils; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; @@ -9,7 +9,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static ru.spcex.clearing.backendapi.controller.queue.config.Jackson2HttpConverterConfig.JacksonObjectMapper.getMapper; +import static ru.spcex.clearing.backendapi.controller.config.Jackson2HttpConverterTestConfig.JacksonObjectMapper.getMapper; public class JsonUtil { diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/utils/MatcherFactory.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/MatcherFactory.java similarity index 98% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/utils/MatcherFactory.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/MatcherFactory.java index 1143b031a..c72317938 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/utils/MatcherFactory.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/MatcherFactory.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.utils; +package ru.spcex.clearing.backendapi.controller.utils; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.ResultActions; diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/TestUtils.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/TestUtils.java new file mode 100644 index 000000000..45091310f --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/utils/TestUtils.java @@ -0,0 +1,95 @@ +package ru.spcex.clearing.backendapi.controller.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.clients.consumer.MockConsumer; +import org.apache.kafka.clients.producer.RecordMetadata; +import org.apache.kafka.common.TopicPartition; +import ru.spcex.clearing.platform.messaging.domain.ActionType; +import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.platform.classes.base.SpcexObjectBase; +import ru.spcex.platform.imdg.api.Imdg; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class TestUtils { + private static final ObjectMapper objectMapper = new ObjectMapper(); + + public static void addRecordToKafka(MockConsumer mockConsumer, String topic, int partition, long offset, String jsonValue) { + TopicPartition tp = new TopicPartition(topic, partition); + HashMap startOffsets = new HashMap<>(); + startOffsets.put(tp, 0L); + mockConsumer.updateBeginningOffsets(startOffsets); + mockConsumer.schedulePollTask(() -> { + mockConsumer.rebalance(Collections.singletonList(tp)); + mockConsumer.addRecord(new ConsumerRecord<>(topic, partition, offset, "key", jsonValue)); + }); + } + + public static String getJsonStringForNew(T accountRequest, long id) { + return getJsonBaseRequest(accountRequest, id, ActionType.NEW); + } + + public static String getJsonStringForUPDATE(T accountRequest, long id) { + return getJsonBaseRequest(accountRequest, id, ActionType.UPDATE); + } + + public static String getJsonStringForDELETE(T accountRequest, long id) { + return getJsonBaseRequest(accountRequest, id, ActionType.DELETE); + } + + private static String getJsonBaseRequest(T accountRequest, long id, ActionType actionType) { + BaseRequest baseRequest = new BaseRequest<>(); + baseRequest.setRequestPayload(accountRequest); + baseRequest.setId(id); + baseRequest.setActionType(actionType); + String jsonBaseRequest; + try { + jsonBaseRequest = objectMapper.writeValueAsString(baseRequest); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + return jsonBaseRequest; + } + + public static void clearImdg(Imdg imdg) { + Collection values = imdg.getAllValues(); + for (T val : values) { + imdg.delete(val); + } + } + + public static class FutureRecordMetadata implements Future { + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + return false; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + return false; + } + + @Override + public RecordMetadata get() throws InterruptedException, ExecutionException { + return null; + } + + @Override + public RecordMetadata get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + return null; + } + } +} diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTestConfiguration.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTestConfiguration.java index f3a989d58..ce01e1103 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTestConfiguration.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTestConfiguration.java @@ -24,7 +24,7 @@ public class GetResponseFactoryTestConfiguration { return new PathResource(path); } -// @Value("file:${spring.config.location}/meta.json") + // @Value("file:${spring.config.location}/meta.json") // private Resource meta; // @Bean("metaJsonTestRaw") @@ -32,7 +32,8 @@ public class GetResponseFactoryTestConfiguration { if (!meta.isReadable()) throw new IllegalStateException("cannot read meta.json from meta " + meta.getFile()); return Files.readString(meta.getFile().toPath()); } -// + + // @Autowired @Bean("metaJsonTest") public MetaServer metaServer(@Qualifier("metaJsonTestRaw") String metaJson) throws JsonProcessingException { diff --git a/clearing-parent/backend-api/src/test/resources/application.properties b/clearing-parent/backend-api/src/test/resources/application.properties new file mode 100644 index 000000000..c375b65ed --- /dev/null +++ b/clearing-parent/backend-api/src/test/resources/application.properties @@ -0,0 +1,51 @@ +server.port=8080 +server.servlet.context-path=/backend-api +server.ssl.key-store-type=PKCS12 +server.ssl.key-store=classpath:keystore/client.p12 +server.ssl.key-store-password=Aa123456 +server.ssl.enabled=true +spring.main.web-application-type=servlet + +backend-api.example-setting=test + +backend-api.hazelcast.cluster-members=127.0.0.1:5701 +backend-api.hazelcast.login=dev +backend-api.hazelcast.password=dev-pass + +backend-api.kafka-producer.bootstrap-servers=localhost:9092 +backend-api.kafka-producer.acks=all +backend-api.kafka-producer.retries=0 +backend-api.kafka-producer.batch-size=16384 +backend-api.kafka-producer.linger-ms=1 +backend-api.kafka-producer.buffer-memory=33554432 + +backend-api.kafka-consumer.bootstrap-servers=localhost:9092 +backend-api.kafka-consumer.group-id=dev-group-backend-api +backend-api.kafka-consumer.enable-auto-commit=true +backend-api.kafka-consumer.session-timeout-ms=30000 +backend-api.kafka-consumer.auto-offset-reset=latest +backend-api.kafka-consumer.linger-ms=1 +backend-api.kafka-consumer.buffer-memory=33554432 + +backend-api.security.authorization-disabled=false + + +##keycloak +##keycloak.auth-server-url=http://10.200.200.147:8080/ +##keycloak.realm=master +##keycloak.resource=clearing +##keycloak.public-client=true +##keycloak.credentials.secret=WnOVCxcAmrUYc8IjiFHOuRif5Oesoyfr +##keycloak.security-constraints[0].authRoles[0]=admin +##keycloak.security-constraints[0].securityCollections[0].patterns[0]=/backend-api/users/* +# +# +##keycloak.policy-enforcer-config.paths[0].path=/* +##keycloak.policy-enforcer-config.paths[0].enforcementMode=ENFORCING +##keycloak.policy-enforcer-config.paths[1].path=/backend-api/anonymous/method1 +##keycloak.policy-enforcer-config.paths[1].enforcementMode=DISABLED +##keycloak.security-constraints[1].auth-roles[0]=* +##keycloak.security-constraints[1].security-collections[0].patterns[0]=/backend-api/anonymous/method1 +# +##keycloak.security-constraints[1].securityCollections[0].name=anonymous-methods +##keycloak.security-constraints[1].securityCollections[0].patterns[0]=/backend-api/anonymous/method1 \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/resources/meta.json b/clearing-parent/backend-api/src/test/resources/meta.json new file mode 100644 index 000000000..7beadc9aa --- /dev/null +++ b/clearing-parent/backend-api/src/test/resources/meta.json @@ -0,0 +1,6698 @@ + + { + "version": "1.2.0.0", + + "enums": { + + "chargeDirection": { + + "name": "Направление начисления комиссии", + + "class": "ru.clearing.platform.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Направление комиссии","shortname": "Направление комиссии","type": 2,"length": 50 + } + ] + } + , + "chargeType": { + + "name": "Справочник типов комиссий", + + "class": "ru.clearing.platform.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Тип комиссии","shortname": "Тип комиссии","type": 2,"length": 50 + } + ] + } + , + "courierType": { + + "name": "Способ доставки документа", + + "class": "ru.clearing.platform.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Способ доставки","shortname": "Способ доставки","type": 2,"length": 50 + } + ] + } + , + "interestStatus": { + + "name": "Справочник статусов возвращения процентов", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "termType": { + + "name": "Справочник видов инструментов денежного рынка", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "task": { + + "name": "Справочник задач", + + "class": "com.spicex.dictionary.TaskDictionary", + + "table": "TaskDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Задача","shortname": "Задача","type": 2,"length": 150 + } + ] + } + , + "taskStatus": { + + "name": "Справочник статусов задач", + + "class": "com.spicex.dictionary.TaskStatusDictionary", + + "table": "TaskStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Статус","shortname": "Статус","type": 2,"length": 50 + } + ] + } + , + "tradingStatus": { + + "name": "Справочник торговых статусов", + + "class": "com.spicex.dictionary.TradingStatusDictionary", + + "table": "TradingStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Торговый статус","shortname": "Статус","type": 2,"length": 50 + } + ] + } + , + "transactionStatus": { + + "name": "Справочник статусов транзакций", + + "class": "com.spicex.dictionary.TransactionStatusDictionary", + + "table": "TransactionStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Статус транзакции","shortname": "Статус","type": 2,"length": 50 + } + ] + } + , + "source": { + + "name": "Справочник источников", + + "class": "com.spicex.dictionary.SourceDictionary", + + "table": "SourceDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Источник","type": 2,"length": 50 + } + ] + } + , + "clearingStatus": { + + "name": "Справочник результатов клиринга", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "workflowStatus": { + + "name": "Справочник статусов бизнес-процессов", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "accountStatus": { + + "name": "Справочник статусов счетов", + + "class": "com.spicex.dictionary.AccountStatus", + + "table": "AccountStatus", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 50 + } + ] + } + , + "allowed": { + + "name": "Справочник признаков допустимости использования объектов", + + "class": "com.spicex.platform.dictionary.AllowedDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Признак допустимости","shortname": "Допустимость","type": 2,"length": 50 + } + ] + } + , + "moneyFlowSide": { + + "name": "Направление заявки", + + "class": "ru.clearing.platform.dictionary.MoneyFlowSideDictionary", + + "table": "MoneyFlowSideDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Значение","shortname": "Значение","type": 2,"length": 255 + } + ] + } + , + "inOutDirection": { + + "name": "Справочник значений направления денежного потока", + + "class": "ru.clearing.platform.dictionary.InOutDirectionDictionary", + + "table": "InOutDirectionDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Значение","shortname": "Значение","type": 2,"length": 255 + } + ] + } + , + "statementType": { + + "name": "Справочник типов поступлений/списаний от ПРЦ", + + "class": "ru.clearing.platform.dictionary.StatementTypeDictionary", + + "table": "StatementTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Значение","shortname": "Значение","type": 2,"length": 255 + } + ] + } + , + "operationType": { + + "name": "Справочник типов операций", + + "class": "ru.clearing.platform.dictionary.OperationTypeDictionary", + + "table": "OperationTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Значение","shortname": "Значение","type": 2,"length": 255 + } + ] + } + , + "operationStatus": { + + "name": "Справочник статусов операций", + + "class": "ru.clearing.platform.dictionary.OperationStatusDictionary", + + "table": "OperationStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Значение","shortname": "Значение","type": 2,"length": 255 + } + ] + } + , + "balanceAccountType": { + + "name": "Справочник типов лимитов", + + "class": "com.spicex.platform.dictionary.balanceAccountTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Тип лимитов","shortname": "Тип","type": 2,"length": 50 + } + ] + } + , + "countryCode": { + + "name": "Справочник кодов стран", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","type": 2,"length": 255 + } + ] + } + , + "clearingCategory": { + + "name": "Справочник категорий участника клиринга", + + "class": "com.spicex.dictionary.ClearingMemberCategoryDictionary", + + "table": "ClearingMemberCategoryDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "contactType": { + + "name": "Справочник типов контактов Компании", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "corporationSoleType": { + + "name": "Единоличный исполнительный орган", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "connectionState": { + + "name": "Справочник состояний соединений", + + "class": "com.spicex.dictionary.ConnectionStateDictionary", + + "table": "ConnectionStateDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Состояние","type": 2,"length": 50 + } + ] + } + , + "documentType": { + + "name": "Справочник типов документов", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "legalKind": { + + "name": "Справочник видов субъекта", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Вид","type": 2,"length": 255 + } + ] + } + , + "organizationType": { + + "name": "Справочник типов организаций", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "companySymbol": { + + "name": "Справочник имен Компании", + + "class": "com.spicex.dictionary.", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Полное имя","type": 2,"length": 255 + } + , + {"code": "shortname", + "name": "Краткое наименование","shortname": "Имя","type": 2,"length": 255 + } + ] + } + , + "companyRole": { + + "name": "Справочник ролей Компаний", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Роль Участника","shortname": "Роль","type": 2,"length": 255 + } + ] + } + , + "userRole": { + + "name": "Роли пользователей", + + "class": "com.spicex.dictionary.UserRole", + + "table": "UserRoleDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Роль пользователя","shortname": "Роль","type": 2,"length": 50 + } + ] + } + , + "accountType": { + + "name": "Справочник типов счетов", + + "class": "com.spicex.dictionary.AccountTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "instrumentType": { + + "name": "Справочник типов инструмента", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Тип","type": 2,"length": 255 + } + ] + } + , + "currencyCode": { + + "name": "Справочник кодов валют", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "serviceStatus": { + + "name": "Справочник услуги", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "service": { + + "name": "Справочник услуги", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "serviceProduct": { + + "name": "Справочник продукта для услуги", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "sector": { + + "name": "Справочник секций", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 255 + } + ] + } + , + "resultStatus": { + + "name": "Статус обработки", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Статус обработки","shortname": "Статус","type": 2,"length": 255 + } + ] + } + , + "errorCode": { + + "name": "Коды ошибок", + + "class": "com.spicex.dictionary.", + + "fields": [ + {"code": "id", + "name": "Идентификатор записи","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Текст ошибки","shortname": "Ошибка","type": 2,"length": 255 + } + ] + } + , + "managementJournalStatus": { + + "name": "Справочник статусов журнала мониторинга и контроля", + + "class": "ru.clearing.platform.dictionary.managementJournalStatusDictionary", + + "table": "МanagementJournalStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Статус сообщения","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + , + "managementJournalType": { + + "name": "Справочник типов записей в журнале мониторинга и контроля", + + "class": "ru.clearing.platform.dictionary.managementJournalTypeDictionary", + + "table": "МanagementJournalTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Тип записи","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + , + "managementJournalPurpose": { + + "name": "Справочник целей записей в журнале мониторинга и контроля", + + "class": "ru.clearing.platform.dictionary.managementJournalPurposeDictionary", + + "table": "managementJournalPurposeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Тип записи","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + , + "inOutSDfType": { + + "name": "Справочник типов входящих и исходящих записей", + + "class": "ru.clearing.platform.dictionary.inOutSDfTypeDictionary", + + "table": "InOutSDfTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Тип записи","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + , + "sessionStatus": { + + "name": "Справочник статусов клиринговой сессии", + + "class": "ru.clearing.platform.dictionary.SessionStatusDictionary", + + "table": "SessionStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + , + "objectType": { + + "name": "Справочник типов объектов", + + "class": "ru.clearing.platform.dictionary.ObjectTypeDictionary", + + "table": "ObjectTypeDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + , + "notificationStatus": { + + "name": "Справочник статусов сообщений", + + "class": "ru.clearing.platform.dictionary.NotificationStatusDictionary", + + "table": "NotificationStatusDictionary", + + "fields": [ + {"code": "id", + "name": "Идентификатор","shortname": "ID","type": 1 + } + , + {"code": "code", + "name": "Код","shortname": "Код","type": 12 + } + , + {"code": "name", + "name": "Наименование","shortname": "Наименование","type": 2,"length": 50 + } + ] + } + + } + + ,"objects": { + + "userCls": { + + "name": "Пользователь", + + "class": "ru.clearing.classes.statics.data.user.User", + + "logUpdates": "true", + + "table": "UserCls", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "identifier", + "type": 2,"length": 250,"name": "Внешний идентификатор","shortname": "Идентификатор","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"put", + + "name": "Авторизация пользователя", + + "destination": "", + + "fields": [ + {"code": "userName", + "type": 2,"length": 255,"name": "Логин пользователя","required": true + } + , + {"code": "roles", + "type": 2,"length": 255,"name": "Роли пользователя","required": false + } + ] + } + ] + } + , + "userRoleSession": { + + "name": "Набор ролей", + + "class": "ru.clearing.classes.statics.data.user.UserRoleSession", + + "table": "UserRoleSession", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "userId", + "type": 1,"name": "Идентификатор пользователя","shortname": "Пользователь","searchable": true,"sortable": true,"visible": true,"link": "userCls" + } + , + {"code": "userRole", + "type": 12,"name": "Идентификатор роли","shortname": "Роль","searchable": true,"sortable": true,"visible": true,"link": "userRole" + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор компании","shortname": "Компания","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "status", + "type": 12,"name": "Статус","shortname": "Статус","searchable": true,"sortable": true,"link": "workflowStatus" + } + ] + + } + , + "userSettings": { + + "name": "Настройки пользователя", + + "class": "ru.clearing.classes.statics.data.user.UserSettings", + + "table": "userSettings", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "userId", + "type": 1,"name": "Пользователь","shortname": "Пользователь","searchable": true,"sortable": true,"visible": true,"link": "userCls" + } + , + {"code": "version", + "type": 2,"length": 50,"name": "Версия настроек пользователя","shortname": "Версия","searchable": false,"sortable": false,"visible": true + } + , + {"code": "json", + "type": 2,"length": 200000,"name": "Данные конфигурации","shortname": "Конфигурация","searchable": false,"sortable": false,"visible": true + } + ] + ,"actions":[ + {"method":"put", + + "name": "Изменение настроек пользователя", + + "destination": "", + + "fields": [ + {"code": "userId", + "type": 1,"name": "Пользователь","required": false,"link": "userCls" + } + , + {"code": "version", + "type": 2,"length": 50,"name": "Версия","required": false + } + , + {"code": "json", + "type": 2,"length": 200000,"name": "Настройки","required": false + } + ] + } + ] + } + , + "userConnect": { + + "name": "Активность пользователей в системе", + + "class": "ru.clearing.classes.statics.data.user.UserConnect", + + "logUpdates": "true", + + "table": "UserConnect", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "userId", + "type": 1,"name": "Пользователь","shortname": "Пользователь","searchable": true,"sortable": true,"visible": true,"link": "userCls" + } + , + {"code": "connectionTime", + "type": 4,"name": "Последнее соединение","shortname": "Вход","searchable": true,"sortable": true + } + , + {"code": "disconnectionTime", + "type": 4,"name": "Разрыв соединения","shortname": "Выход","searchable": true,"sortable": true + } + , + {"code": "serverIP", + "type": 2,"name": "IP адрес сервера","shortname": "IP сервера","searchable": true,"sortable": true,"visible": true,"length": 250 + } + , + {"code": "clientIP", + "type": 2,"name": "IP адрес клиента","shortname": "IP клиента","searchable": true,"sortable": true,"visible": true,"length": 250 + } + , + {"code": "connectionState", + "type": 12,"name": "Статус соединения","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "connectionState" + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": true,"sortable": true + } + , + {"code": "errorCode", + "type": 1,"name": "Код ошибки","shortname": "Код ошибки","searchable": true,"sortable": true,"link": "errorCode","linkCode": "code" + } + , + {"code": "errorText", + "type": 12,"name": "Полный текст ошибки","shortname": "Ошибка","searchable": true,"sortable": true,"link": "errorText","linkCode": "text" + } + ] + + } + , + "timetable": { + + "name": "Постоянное расписание операционного дня", + + "class": "ru.clearing.classes.statics.data.scheduler.Timetable", + + "table": "Timetable", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","searchable": false,"sortable": false,"visible": true,"link": "task" + } + , + {"code": "taskTime", + "type": 5,"name": "Время задачи","shortname": "Время","searchable": false,"sortable": false,"visible": true + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": false,"sortable": true,"visible": true,"link": "taskStatus" + } + ] + ,"actions":[ + {"method":"post", + + "name": "Новое расписание операционного дня", + + "destination": "", + + "fields": [ + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","link": "task","required": true + } + , + {"code": "taskTime", + "type": 5,"name": "Время задачи","shortname": "Время","required": true + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","link": "taskStatus","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение расписания операционного дня", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "timetable","linkCode": "id","required": true + } + , + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","link": "task" + } + , + {"code": "taskTime", + "type": 5,"name": "Время задачи","shortname": "Время" + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","link": "taskStatus" + } + ] + } + , + {"method":"delete", + + "name": "Удаление расписания операционного дня", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "timetable","linkCode": "id","required": true + } + ] + } + ] + } + , + "tradingCalendar": { + + "name": "Торговые и неторговые дни", + + "class": "ru.clearing.classes.statics.data.scheduler.TradingCalendar", + + "table": "TradingCalendar", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": false,"sortable": false,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Компания","shortname": "Компания","searchable": false,"sortable": false,"visible": true,"link": "company" + } + , + {"code": "tradingStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": false,"sortable": true,"visible": true,"link": "tradingStatus" + } + ] + ,"actions":[ + {"method":"post", + + "name": "Добавление записи в календарь", + + "destination": "", + + "fields": [ + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","required": true + } + , + {"code": "companyId", + "type": 1,"name": "Компания","shortname": "Компания","link": "company" + } + , + {"code": "tradingStatus", + "type": 12,"name": "Статус","shortname": "Статус","link": "tradingStatus","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение записи в календаре", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "tradingCalendar","linkCode": "id","required": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата" + } + , + {"code": "companyId", + "type": 1,"name": "Компания","shortname": "Компания","link": "company" + } + , + {"code": "tradingStatus", + "type": 12,"name": "Статус","shortname": "Статус","link": "tradingStatus" + } + ] + } + , + {"method":"delete", + + "name": "Удаление записи из календаря", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "tradingCalendar","linkCode": "id","required": true + } + ] + } + ] + } + , + "scheduler": { + + "name": "Расписание планировщика", + + "class": "ru.clearing.classes.statics.data.scheduler.Scheduler", + + "table": "Scheduler", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","searchable": false,"sortable": false,"visible": true,"link": "task" + } + , + {"code": "taskTime", + "type": 5,"name": "Время","shortname": "Время","searchable": false,"sortable": false,"visible": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": false,"sortable": false,"visible": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","searchable": false,"sortable": false,"visible": true,"link": "market" + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": false,"sortable": true,"visible": true,"link": "taskStatus" + } + , + {"code": "securityId", + "type": 1,"name": "Инструмент","shortname": "Инструмент","searchable": false,"sortable": true,"visible": true,"link": "security" + } + ] + ,"actions":[ + {"method":"post", + + "name": "Новое расписание планировщика", + + "destination": "", + + "fields": [ + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","link": "task","required": true + } + , + {"code": "taskTime", + "type": 5,"name": "Время","shortname": "Время","required": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","required": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","link": "market" + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","link": "taskStatus","required": true + } + , + {"code": "securityId", + "type": 1,"name": "Инструмент","shortname": "Инструмент","link": "security" + } + ] + } + , + {"method":"put", + + "name": "Изменение расписания планировщика", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "scheduler","required": true,"linkCode": "id" + } + , + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","link": "task" + } + , + {"code": "taskTime", + "type": 5,"name": "Время","shortname": "Время" + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата" + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","link": "market" + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","link": "taskStatus" + } + , + {"code": "securityId", + "type": 1,"name": "Инструмент","shortname": "Инструмент","link": "security" + } + ] + } + , + {"method":"delete", + + "name": "Удаление расписания планировщика", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "scheduler","linkCode": "id","required": true + } + ] + } + ] + } + , + "schedulerAllToday": { + + "name": "Расписание на текущий день", + + "class": "ru.clearing.classes.statics.data.scheduler.SchedulerAllToday", + + "table": "SchedulerAllToday", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "task", + "type": 12,"name": "Идентификатор задачи","shortname": "Задача","searchable": true,"sortable": true,"visible": true,"link": "task" + } + , + {"code": "taskTime", + "type": 5,"name": "Время","shortname": "Время","searchable": true,"sortable": true,"visible": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","searchable": true,"sortable": true,"visible": true,"link": "market" + } + , + {"code": "taskStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "taskStatus" + } + , + {"code": "securityId", + "type": 1,"name": "Инструмент","shortname": "Инструмент","searchable": true,"sortable": true,"visible": true,"link": "security" + } + , + {"code": "source", + "type": 12,"name": "Источник записи расписания","shortname": "Источник","searchable": true,"sortable": true,"link": "source" + } + , + {"code": "origId", + "type": 1,"name": "Идентификатор источника","shortname": "ID","searchable": false,"sortable": false + } + ] + + } + , + "taskRunner": { + + "name": "Запуск задачи", + + "class": "ru.clearing.classes.statics.data.scheduler.TaskRunner", + + "table": "TaskRunnerRequest", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "senderId", + "type": 1,"name": "Отправитель","shortname": "Отправитель","searchable": true,"sortable": true,"visible": true,"link": "userCls" + } + , + {"code": "task", + "type": 12,"name": "Задача","shortname": "Задача","searchable": true,"sortable": true,"link": "task" + } + ] + ,"actions":[ + {"method":"getBalance", + + "group": "Обмен с расчетной организацией", + + "name": "Зачисление остатков (загрузка ДФ-01)", + + "destination": "", + + "fields": [] + } + , + {"method":"accBlock", + + "group": "Обмен с расчетной организацией", + + "name": "Блокировка счета (загрузка ДФ-12)", + + "destination": "", + + "fields": [] + } + , + {"method":"getAllBalance", + + "group": "Обмен с расчетной организацией", + + "name": "Запрос остатков по всем счетам (экспорт ДФ-08)", + + "destination": "", + + "fields": [] + } + , + {"method":"addBalance", + + "group": "Обмен с расчетной организацией", + + "name": "Дозачисление/списание остатков (загрузка ДФ-16)", + + "destination": "", + + "fields": [] + } + , + {"method":"getBalanceDiff", + + "group": "Обмен с расчетной организацией", + + "name": "Поступление средств (загрузка ДФ-09)", + + "destination": "", + + "fields": [] + } + , + {"method":"createOrder", + + "group": "Обмен с расчетной организацией", + + "name": "Формирование сводного платежного поручения (экспорт ДФ-03/ДФ-11)", + + "destination": "", + + "fields": [] + } + , + {"method":"createOrderConfirm", + + "group": "Обмен с расчетной организацией", + + "name": "Получение подтверждения переводов (загрузка ДФ-04)", + + "destination": "", + + "fields": [] + } + , + {"method":"getTrades", + + "group": "Обмен с Торговой системой", + + "name": "Получение сделок из Торговой системы", + + "destination": "", + + "fields": [] + } + ] + } + , + "company": { + + "name": "Участник", + + "class": "ru.clearing.classes.statics.data.company.Company", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "tradingCode", + "type": 2,"length": 255,"name": "Код участника торгов","shortname": "Торговый код","searchable": true,"sortable": true,"visible": true + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код участника клиринга","shortname": "Клиринговый код","searchable": true,"sortable": true,"visible": true + } + , + {"code": "registrationCode", + "type": 2,"length": 255,"name": "Регистрационный код участника","shortname": "Регистрационный код","searchable": true,"sortable": true,"visible": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": true,"sortable": true,"link": "workflowStatus" + } + , + {"code": "shortName", + "type": 2,"length": 255,"name": "Краткое наименование Компании","shortname": "Краткое наименование Компании","searchable": true,"sortable": true,"visible": true + } + , + {"code": "fullName", + "type": 2,"length": 255,"name": "Полное наименование Компании","shortname": "Полное наименование Компании","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"delete", + + "name": "Удаление участника", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "company","linkCode": "id","required": true + } + ] + } + ] + } + , + "companyInfo": { + + "name": "Профиль Компании", + + "class": "ru.clearing.classes.statics.data.profile.CompanyInfo", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "corporationSoleType", + "type": 12,"name": "Идентификатор единоличного исполнительного органа","shortname": "Единоличный исполнительный орган","searchable": true,"sortable": true,"visible": true,"link": "corporationSoleType" + } + , + {"code": "countryCode", + "type": 12,"name": "Идентификатор кода страны","shortname": "Юрисдикция","searchable": true,"sortable": true,"visible": true,"link": "countryCode" + } + , + {"code": "description", + "type": 2,"length": 255,"name": "Описание","shortname": "Описание Участника","searchable": true,"sortable": true,"visible": true + } + , + {"code": "professionalSign", + "type": 12,"name": "Признак проф. Участника","shortname": "Признак проф. Участника","searchable": true,"sortable": true,"visible": true,"link": "allowed" + } + , + {"code": "legalKind", + "type": 12,"name": "Идентификатор вида субъекта","shortname": "Юр. лицо/Физ. Лицо","searchable": true,"sortable": true,"visible": true,"link": "legalKind" + } + , + {"code": "organizationType", + "type": 12,"name": "Идентификатор типа организации","shortname": "Тип организации","searchable": true,"sortable": true,"visible": true,"link": "organizationType" + } + , + {"code": "residence", + "type": 12,"name": "Идентификатор кода страны","shortname": "Резиденция","searchable": true,"sortable": true,"visible": true,"link": "countryCode" + } + , + {"code": "shortNameEng", + "type": 2,"length": 255,"name": "Краткое наименование Компании на английском","shortname": "Краткое наименование на английском","searchable": true,"sortable": true,"visible": true + } + , + {"code": "fullNameEng", + "type": 2,"length": 255,"name": "Полное наименование Компании на английском","shortname": "Полное наименование на английском","searchable": true,"sortable": true,"visible": true + } + , + {"code": "shortName", + "type": 2,"length": 255,"name": "Краткое наименование Компании","shortname": "Краткое наименование","searchable": true,"sortable": true,"visible": true,"extends": "company" + } + , + {"code": "fullName", + "type": 2,"length": 255,"name": "Полное наименование Компании","shortname": "Полное наименование","searchable": true,"sortable": true,"visible": true,"extends": "company" + } + , + {"code": "tradingCode", + "type": 2,"length": 255,"name": "Код участника торгов","shortname": "Торговый код","searchable": true,"sortable": true,"visible": true,"extends": "company" + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код участника клиринга","shortname": "Клиринговый код","searchable": true,"sortable": true,"visible": true,"extends": "company" + } + , + {"code": "registrationCode", + "type": 2,"length": 255,"name": "Регистрационный код участника","shortname": "Регистрационный код","searchable": true,"sortable": true,"visible": true,"extends": "company" + } + ] + ,"actions":[ + {"method":"put", + + "name": "Изменение профиля компании", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "companyInfo","linkCode": "id","required": true + } + , + {"code": "corporationSoleType", + "type": 12,"name": "Идентификатор единоличного исполнительного органа","shortname": "Единоличный исполнительный орган","link": "corporationSoleType" + } + , + {"code": "countryCode", + "type": 12,"name": "Идентификатор кода страны","shortname": "Юрисдикция","link": "countryCode" + } + , + {"code": "description", + "type": 2,"name": "Описание","shortname": "Описание Участника" + } + , + {"code": "professionalSign", + "type": 12,"name": "Признак проф. Участника","shortname": "Признак проф. Участника","link": "allowed" + } + , + {"code": "legalKind", + "type": 12,"name": "Идентификатор вида субъекта","shortname": "Юр. лицо/Физ. Лицо","link": "legalKind" + } + , + {"code": "organizationType", + "type": 12,"name": "Идентификатор типа организации","shortname": "Тип организации","link": "organizationType" + } + , + {"code": "residence", + "type": 12,"name": "Идентификатор кода страны","shortname": "Резиденция","link": "countryCode" + } + , + {"code": "shortNameEng", + "type": 2,"length": 255,"name": "Краткое наименование Компании на английском","shortname": "Краткое наименование на английском" + } + , + {"code": "fullNameEng", + "type": 2,"length": 255,"name": "Полное наименование Компании на английском","shortname": "Полное наименование на английском" + } + , + {"code": "shortName", + "type": 2,"length": 255,"name": "Краткое наименование Компании","shortname": "Краткое наименование" + } + , + {"code": "fullName", + "type": 2,"length": 255,"name": "Полное наименование Компании","shortname": "Полное наименование" + } + ] + } + ] + } + , + "clearingMemberCategory": { + + "name": "Категории Участника клиринга", + + "class": "ru.clearing.classes.statics.data.generated.ClearingMemberCategory", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "clearingMemberCategory", + "type": 12,"name": "Идентификатор категории участника клиринга","shortname": "Категория","searchable": true,"sortable": true,"visible": true,"link": "clearingCategory" + } + ] + ,"actions":[ + {"method":"post", + + "name": "Добавление категории участника клиринга", + + "destination": "", + + "fields": [ + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","link": "company","required": true + } + , + {"code": "clearingMemberCategory", + "type": 12,"name": "Идентификатор категории участника клиринга","shortname": "Категория","link": "clearingCategory","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение категории участника клиринга", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "clearingCategory","linkCode": "id","required": true + } + , + {"code": "clearingMemberCategory", + "type": 12,"name": "Идентификатор категории участника клиринга","shortname": "Категория","link": "clearingCategory" + } + ] + } + , + {"method":"delete", + + "name": "Удаление категории участника клиринга", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "clearingCategory","linkCode": "id","required": true + } + ] + } + ] + } + , + "contact": { + + "name": "Контакты Компании", + + "class": "ru.clearing.classes.statics.data.profile.Contact", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "contactType", + "type": 12,"name": "Идентификатор справочника","shortname": "Тип контакта","searchable": true,"sortable": true,"visible": true,"link": "contactType" + } + , + {"code": "contactValue", + "type": 2,"length": 255,"name": "Значение справочника","shortname": "Значение","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"put", + + "name": "Изменение контактов компании", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "contact","linkCode": "id","required": true + } + , + {"code": "contactType", + "type": 12,"name": "Идентификатор справочника","shortname": "Тип контакта","link": "contactType" + } + , + {"code": "contactValue", + "type": 2,"length": 255,"name": "Значение справочника","shortname": "Значение" + } + ] + } + ] + } + , + "profileDocument": { + + "name": "Досье Компании", + + "class": "ru.clearing.classes.statics.data.profile.ProfileDocument", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "documentType", + "type": 12,"name": "Идентификатор типа документа","shortname": "Идентификатор типа документа","searchable": true,"sortable": true,"visible": true,"link": "documentType" + } + , + {"code": "issueDate", + "type": 6,"name": "Дата выдачи","shortname": "Дата выдачи","searchable": true,"sortable": true + } + , + {"code": "issuePlace", + "type": 2,"length": 255,"name": "Место выдачи","shortname": "Место выдачи","searchable": true,"sortable": true,"visible": true + } + , + {"code": "issuer", + "type": 2,"length": 255,"name": "Кем выдан","shortname": "Кем выдан","searchable": true,"sortable": true,"visible": true + } + , + {"code": "issuerCode", + "type": 2,"length": 255,"name": "Код выдавшего органа","shortname": "Код выдавшего органа","searchable": true,"sortable": true,"visible": true + } + , + {"code": "name", + "type": 2,"length": 255,"name": "Наименование","shortname": "Наименование","searchable": true,"sortable": true,"visible": true + } + , + {"code": "number", + "type": 2,"length": 255,"name": "Номер","shortname": "Номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "place", + "type": 2,"length": 255,"name": "Место","shortname": "Место","searchable": true,"sortable": true,"visible": true + } + , + {"code": "validFromDate", + "type": 6,"name": "Дата начала срока действия","shortname": "Дата начала срока действия","searchable": true,"sortable": true + } + , + {"code": "validToDate", + "type": 6,"name": "Дата окончания срока действия","shortname": "Дата окончания срока действия","searchable": true,"sortable": true + } + , + {"code": "link", + "type": 2,"length": 255,"name": "Ссылка на документ","shortname": "Ссылка на документ","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"post", + + "name": "Добавление документов", + + "destination": "", + + "fields": [ + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company","required": true + } + , + {"code": "documentType", + "type": 12,"name": "Идентификатор типа документа","shortname": "Идентификатор типа документа","searchable": true,"sortable": true,"visible": true,"link": "documentType","required": true + } + , + {"code": "issueDate", + "type": 6,"name": "Дата выдачи","shortname": "Дата выдачи","searchable": true,"sortable": true,"required": true + } + , + {"code": "issuePlace", + "type": 2,"length": 255,"name": "Место выдачи","shortname": "Место выдачи","searchable": true,"sortable": true,"visible": true,"required": true + } + , + {"code": "issuer", + "type": 2,"length": 255,"name": "Кем выдан","shortname": "Кем выдан","searchable": true,"sortable": true,"visible": true,"required": true + } + , + {"code": "issuerCode", + "type": 2,"length": 255,"name": "Код выдавшего органа","shortname": "Код выдавшего органа","searchable": true,"sortable": true,"visible": true,"required": true + } + , + {"code": "name", + "type": 2,"length": 255,"name": "Наименование","shortname": "Наименование","searchable": true,"sortable": true,"visible": true,"required": true + } + , + {"code": "number", + "type": 2,"length": 255,"name": "Номер","shortname": "Номер","searchable": true,"sortable": true,"visible": true,"required": true + } + , + {"code": "place", + "type": 2,"length": 255,"name": "Место","shortname": "Место","searchable": true,"sortable": true,"visible": true,"required": true + } + , + {"code": "validFromDate", + "type": 6,"name": "Дата начала срока действия","shortname": "Дата начала срока действия","searchable": true,"sortable": true,"required": true + } + , + {"code": "validToDate", + "type": 6,"name": "Дата окончания срока действия","shortname": "Дата окончания срока действия","searchable": true,"sortable": true,"required": true + } + , + {"code": "link", + "type": 2,"length": 255,"name": "Ссылка на документ","shortname": "Ссылка на документ","searchable": true,"sortable": true,"visible": true + } + ] + } + ] + } + , + "companySymbols": { + + "name": "Реквизиты Компании", + + "class": "ru.clearing.classes.statics.data.company.CompanySymbols", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "companySymbol", + "type": 12,"name": "Идентификатор справочника","shortname": "Тип реквизита","searchable": true,"sortable": true,"visible": true,"link": "companySymbol" + } + , + {"code": "companySymbolValue", + "type": 2,"length": 255,"name": "Значение справочника","shortname": "Значение","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"put", + + "name": "Изменение реквизитов компании", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "companySymbols","linkCode": "id","required": true + } + , + {"code": "companySymbol", + "type": 12,"name": "Идентификатор справочника","shortname": "Тип реквизита","link": "companySymbol" + } + , + {"code": "companySymbolValue", + "type": 2,"length": 255,"name": "Значение справочника","shortname": "Значение" + } + ] + } + ] + } + , + "clearmemberRegistry": { + + "name": "Реестр участников клиринга", + + "serviceProduct": "MKR", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "tradingCode", + "type": 2,"length": 255,"name": "Код участника торгов","shortname": "Торговый код","searchable": true,"sortable": true,"visible": true + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код участника клиринга","shortname": "Клиринговый код","searchable": true,"sortable": true,"visible": true + } + , + {"code": "fullName", + "type": 2,"length": 255,"name": "Полное наименование участника клиринга","shortname": "Полное наименование УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "shortName", + "type": 2,"length": 255,"name": "Краткое наименование участника клиринга","shortname": "Краткое наименование УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "categoryList", + "type": 12,"name": "Идентификатор категории участника клиринга","shortname": "Категория","searchable": true,"sortable": true,"visible": true,"link": "clearingCategory" + } + , + {"code": "corporationSole", + "type": 12,"name": "Идентификатор единоличного исполнительного органа","shortname": "Исполнительный орган","searchable": true,"sortable": true,"visible": true,"link": "corporationSoleType" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Cчета","shortname": "Счет","searchable": true,"sortable": true,"visible": true + } + , + {"code": "bank", + "type": 1,"name": "Банк","shortname": "Банк","searchable": true,"sortable": true,"visible": true,"link": "bankAccount" + } + , + {"code": "bankName", + "type": 2,"length": 255,"name": "Наименование банка","shortname": "Банк","searchable": true,"sortable": true,"visible": true + } + , + {"code": "inn", + "type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "bic", + "type": 2,"length": 255,"name": "Банковский идентификационный код (БИК)","shortname": "БИК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "ogrn", + "type": 2,"length": 255,"name": "Основной государственный регистрационный номер","shortname": "ОГРН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "cpp", + "type": 2,"length": 255,"name": "Код причины постановки (КПП)","shortname": "КПП","searchable": true,"sortable": true,"visible": true + } + , + {"code": "ocpo", + "type": 2,"length": 255,"name": "Код в Общероссийском классификаторе предприятий","shortname": "ОКПО","searchable": true,"sortable": true,"visible": true + } + , + {"code": "contractNumber", + "type": 2,"name": "Номер договора","shortname": "Номер договора","searchable": true,"sortable": true,"visible": true,"length": 255 + } + , + {"code": "contractDate", + "type": 6,"name": "Дата выдачи","shortname": "Дата выдачи","searchable": true,"sortable": true + } + , + {"code": "registrationDate", + "type": 6,"name": "Дата регистрации","shortname": "Дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "systemDate", + "type": 6,"name": "Системная дата","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "accessDate", + "type": 4,"name": "Дата допуска к КО","shortname": "Дата допуска к КО","searchable": true,"sortable": true + } + , + {"code": "suspentionDate", + "type": 4,"name": "Дата приостановления","shortname": "Дата приостановления","searchable": true,"sortable": true + } + , + {"code": "reopeningDate", + "type": 4,"name": "Дата возобновления","shortname": "Дата возобновления","searchable": true,"sortable": true + } + , + {"code": "closeDate", + "type": 4,"name": "Дата прекращения","shortname": "Дата прекращения","searchable": true,"sortable": true + } + , + {"code": "exclusionDate", + "type": 4,"name": "Дата исключения из реестра","shortname": "Дата исключения из реестра","searchable": true,"sortable": true + } + , + {"code": "address", + "type": 2,"length": 255,"name": "Адрес местонахождения","shortname": "Адрес","searchable": true,"sortable": true,"visible": true + } + , + {"code": "email", + "type": 2,"length": 255,"name": "Электронная почта","shortname": "Эл. почта","searchable": true,"sortable": true,"visible": true + } + ] + + } + , + "clearmemberRegistryChange": { + + "name": "Журнал изменений информации участников клиринга", + + "fields": [ + {"code": "date", + "type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код участника клиринга","shortname": "Клиринговый код","searchable": true,"sortable": true,"visible": true + } + , + {"code": "comment", + "type": 2,"length": 255,"name": "Комментарий","shortname": "Комментарий","searchable": true,"sortable": true,"visible": true + } + ] + + } + , + "keyRate": { + + "name": "Ключевая ставка ЦБ", + + "class": "ru.clearing.classes.statics.data.misc.KeyRate", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "rate", + "type": 10,"name": "Ключевая ставка ЦБ РФ","shortname": "Ставка","searchable": true,"sortable": true,"visible": true + } + , + {"code": "startDate", + "type": 6,"name": "Дата начала действия ключевой ставки","shortname": "Начальная дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "endDate", + "type": 6,"name": "Дата окончания действия ключевой ставки","shortname": "Конечная дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "document", + "type": 2,"length": 255,"name": "Документ ЦБ РФ, регламентирующий установку величины ключевой ставки","shortname": "Документ ЦБ","searchable": true,"sortable": true,"visible": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "workflowStatus" + } + ] + ,"actions":[ + {"method":"post", + + "name": "Добавление ключевой ставки ЦБ", + + "destination": "", + + "fields": [ + {"code": "rate", + "type": 10,"name": "Ключевая ставка ЦБ РФ","shortname": "Ставка","required": true + } + , + {"code": "startDate", + "type": 6,"name": "Дата начала действия ключевой ставки","shortname": "Начальная дата","required": true + } + , + {"code": "endDate", + "type": 6,"name": "Дата окончания действия ключевой ставки","shortname": "Конечная дата","required": true + } + , + {"code": "document", + "type": 2,"length": 255,"name": "Документ ЦБ","shortname": "Документ ЦБ","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение ключевой ставки ЦБ", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "keyRate","linkCode": "id","required": true + } + , + {"code": "rate", + "type": 10,"name": "Ключевая ставка ЦБ РФ","shortname": "Ставка" + } + , + {"code": "startDate", + "type": 6,"name": "Дата начала действия ключевой ставки","shortname": "Начальная дата" + } + , + {"code": "endDate", + "type": 6,"name": "Дата окончания действия ключевой ставки","shortname": "Конечная дата" + } + , + {"code": "document", + "type": 2,"length": 255,"name": "Документ ЦБ","shortname": "Документ ЦБ" + } + ] + } + , + {"method":"delete", + + "name": "Удаление ключевой ставки ЦБ", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "keyRate","linkCode": "id","required": true + } + ] + } + ] + } + , + "companyRoleSet": { + + "name": "Таблица ролей Компании", + + "class": "ru.clearing.classes.statics.data.company.CompanyRoleSet", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор списка ролей Компании","shortname": "Идентификатор списка ролей Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "roleId", + "type": 1,"name": "Значение справочника","shortname": "Значение","searchable": true,"sortable": true,"visible": true,"link": "companyRole" + } + ] + + } + , + "account": { + + "name": "Счета", + + "class": "ru.clearing.classes.statics.data.account.Account", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Номер счета","shortname": "Счёт","searchable": true,"sortable": true,"visible": true + } + , + {"code": "accountType", + "type": 12,"name": "Идентификатор типа счета","shortname": "Тип","searchable": true,"sortable": true,"visible": true,"link": "accountType" + } + , + {"code": "relationId", + "type": 1,"name": "Идентификатор договорных отношений","shortname": "Договор","searchable": true,"sortable": true,"visible": true,"link": "relation" + } + , + {"code": "accountStatus", + "type": 12,"name": "Идентификатор статуса","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "accountStatus" + } + , + {"code": "processingSign", + "type": 12,"name": "Признак обработки счета","shortname": "Обработка счета","searchable": true,"sortable": true,"visible": true,"link": "allowed" + } + ] + + } + , + "relation": { + + "name": "Договорные отношения", + + "class": "ru.clearing.classes.statics.data.company.relation.Relation", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "consumerId", + "type": 1,"name": "Идентификатор Компании пользователя услуги","shortname": "Потребитель","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "supplierId", + "type": 1,"name": "Идентификатор Компании поставщика услуги","shortname": "Поставщик","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "serviceStatus", + "type": 12,"name": "Идентификатор статуса","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "workflowStatus" + } + , + {"code": "service", + "type": 12,"name": "Идентификатор сервиса","shortname": "Услуга","searchable": true,"sortable": true,"visible": true,"link": "service" + } + , + {"code": "serviceProduct", + "type": 12,"name": "Идентификатор продукта","shortname": "Продукт","searchable": true,"sortable": true,"visible": true,"link": "serviceProduct" + } + , + {"code": "comment", + "type": 2,"length": 255,"name": "Текст причины","shortname": "Причина","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"put", + + "name": "Изменение банковских реквизитов для перечисления денежных средств", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "relation","linkCode": "id","required": true + } + , + {"code": "serviceStatus", + "type": 12,"name": "Идентификатор статуса","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "workflowStatus" + } + , + {"code": "comment", + "type": 2,"length": 255,"name": "Текст причины","shortname": "Причина","searchable": true,"sortable": true,"visible": true + } + ] + } + ] + } + , + "bankAccount": { + + "name": "Банковские реквизиты для перечисления денежных средств", + + "class": "ru.clearing.classes.statics.data.account.BankAccount", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "ID","searchable": true,"sortable": true,"visible": true,"link": "account" + } + , + {"code": "bankIdentificationCode", + "type": 2,"length": 255,"name": "Банковский идентификационный код (БИК)","shortname": "БИК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "bankName", + "type": 2,"length": 255,"name": "Наименование банка","shortname": "Наименование","searchable": true,"sortable": true,"visible": true + } + , + {"code": "correspondentAccount", + "type": 2,"length": 255,"name": "Корреспондентский счет","shortname": "Корр. счет","searchable": true,"sortable": true,"visible": true + } + , + {"code": "correspondentAccountName", + "type": 2,"length": 255,"name": "Наименование корреспондентского счета","shortname": "Наименование корр. счета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "currency", + "type": 12,"name": "Идентификатор валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currencyCode" + } + , + {"code": "destination", + "type": 2,"length": 255,"name": "Назначение","shortname": "Назначение","searchable": true,"sortable": true,"visible": true + } + , + {"code": "iban", + "type": 2,"length": 255,"name": "Международный номер банковского счета","shortname": "Международный номер банковского счета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "internationalTransferSign", + "type": 12,"name": "Доступность международных переводов","shortname": "Доступность международных переводов","searchable": true,"sortable": true,"visible": true,"link": "allowed" + } + , + {"code": "swiftCode", + "type": 2,"length": 255,"name": "Код SWIFT","shortname": "SWIFT","searchable": true,"sortable": true,"visible": true + } + , + {"code": "taxpayerIdentificationNumber", + "type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "taxRegistrationReasonCode", + "type": 2,"length": 255,"name": "Код причины постановки (КПП)","shortname": "КПП","searchable": true,"sortable": true,"visible": true + } + ] + ,"actions":[ + {"method":"post", + + "name": "Банковские реквизиты для перечисления денежных средств", + + "destination": "", + + "fields": [ + {"code": "bankIdentificationCode", + "type": 2,"length": 255,"name": "Банковский идентификационный код (БИК)","shortname": "БИК","required": true + } + , + {"code": "bankName", + "type": 2,"length": 255,"name": "Наименование банка","shortname": "Наименование","required": true + } + , + {"code": "correspondentAccount", + "type": 2,"length": 255,"name": "Корреспондентский счет","shortname": "Корр. счет" + } + , + {"code": "correspondentAccountName", + "type": 2,"length": 255,"name": "Наименование корреспондентского счета","shortname": "Наименование корр. счета" + } + , + {"code": "currency", + "type": 12,"name": "Идентификатор валюты","shortname": "Валюта","required": true,"link": "currencyCode" + } + , + {"code": "destination", + "type": 2,"length": 255,"name": "Назначение","shortname": "Назначение","required": true + } + , + {"code": "taxpayerIdentificationNumber", + "type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН" + } + , + {"code": "taxRegistrationReasonCode", + "type": 2,"length": 255,"name": "Код причины постановки (КПП)","shortname": "КПП" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Номер счета","shortname": "Счет","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение банковских реквизитов для перечисления денежных средств", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "bankAccount","linkCode": "id","required": true + } + , + {"code": "bankIdentificationCode", + "type": 2,"length": 255,"name": "Банковский идентификационный код (БИК)","shortname": "БИК" + } + , + {"code": "bankName", + "type": 2,"length": 255,"name": "Наименование банка","shortname": "Наименование" + } + , + {"code": "correspondentAccount", + "type": 2,"length": 255,"name": "Корреспондентский счет","shortname": "Корр. счет" + } + , + {"code": "correspondentAccountName", + "type": 2,"length": 255,"name": "Наименование корреспондентского счета","shortname": "Наименование корр. счета" + } + , + {"code": "currency", + "type": 12,"name": "Идентификатор валюты","shortname": "Валюта","link": "currencyCode" + } + , + {"code": "destination", + "type": 2,"length": 255,"name": "Назначение","shortname": "Назначение" + } + , + {"code": "taxpayerIdentificationNumber", + "type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН" + } + , + {"code": "taxRegistrationReasonCode", + "type": 2,"length": 255,"name": "Код причины постановки (КПП)","shortname": "КПП" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Номер счета","shortname": "Счет" + } + ] + } + , + {"method":"delete", + + "name": "Удаление банковских реквизитов для перечисления денежных средств", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "bankAccount","linkCode": "id","required": true + } + ] + } + ] + } + , + "informationAccount": { + + "name": "Информационные счета", + + "class": "ru.clearing.classes.statics.data.account.InformationAccount", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "Идентификатор счета","searchable": true,"sortable": true,"visible": true,"link": "account","linkCode": "account" + } + , + {"code": "clearingAccountId", + "type": 1,"name": "Идентификатор клирингового счета","shortname": "Клиринговый счет","searchable": true,"sortable": true,"visible": true,"link": "account","linkCode": "account" + } + ] + + } + , + "accountRouting": { + + "name": "Маршрутизация счета", + + "class": "ru.clearing.classes.statics.data.account.AccountRouting", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "destinationId", + "type": 1,"name": "Счет-назначение (зачисления)","shortname": "Зачисления","searchable": true,"sortable": true,"visible": true,"link": "account" + } + , + {"code": "relationId", + "type": 1,"name": "Идентификатор договорных отношений","shortname": "Договор","searchable": true,"sortable": true,"visible": true,"link": "relation" + } + , + {"code": "sourceId", + "type": 1,"name": "Счет-источник (списания)","shortname": "Списания","searchable": true,"sortable": true,"visible": true,"link": "account" + } + ] + + } + , + "security": { + + "name": "Инструменты", + + "class": "ru.clearing.classes.statics.data.security.Security", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "instrumentType", + "type": 12,"name": "Идентификатор типа инструмента","shortname": "Тип инструмента","searchable": true,"sortable": true,"visible": true,"link": "instrumentType" + } + , + {"code": "issuerId", + "type": 1,"name": "Идентификатор эмитента","shortname": "Эмитент","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "shortName", + "type": 2,"name": "Краткое наименование инструмента","shortname": "Краткое наименование","searchable": true,"sortable": true,"length": 255,"visible": true + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование инструмента","shortname": "Наименование","searchable": true,"sortable": true,"length": 255,"visible": true + } + , + {"code": "shortNameEng", + "type": 2,"name": "Краткое наименование инструмента на английском","shortname": "Краткое наименование на английском","searchable": true,"sortable": true,"length": 255,"visible": true + } + , + {"code": "fullNameEng", + "type": 2,"name": "Полное наименование инструмента на английском","shortname": "Наименование на английском","searchable": true,"sortable": true,"length": 255,"visible": true + } + , + {"code": "securitySymbol", + "type": 2,"name": "Код инструмента","shortname": "Код","searchable": true,"sortable": true,"length": 255,"visible": true + } + , + {"code": "workflowStatus", + "type": 12,"name": "Идентификатор статуса","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "workflowStatus" + } + ] + + } + , + "currency": { + + "name": "Инструменты Валюты", + + "class": "ru.clearing.classes.statics.data.misc.Currency", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "countryCode", + "type": 12,"name": "Идентификатор кода страны","shortname": "Страна","searchable": true,"sortable": true,"visible": true,"link": "countryCode" + } + , + {"code": "currencyCode", + "type": 12,"name": "Идентификатор кода валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currencyCode" + } + ] + + } + , + "moneyMarketSecurity": { + + "name": "Инструменты Денежного рынка", + + "class": "ru.clearing.classes.statics.data.misc.MoneyMarketSecurity", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "securityId", + "type": 1,"name": "Идентификатор инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"link": "security" + } + , + {"code": "description", + "type": 2,"length": 255,"name": "Описание","shortname": "Описание","searchable": true,"sortable": false + } + , + {"code": "startDate", + "type": 6,"name": "Дата начала действия","shortname": "Начальная дата","searchable": true,"sortable": true + } + , + {"code": "endDate", + "type": 6,"name": "Дата окончания действия","shortname": "Конечная дата","searchable": true,"sortable": true + } + , + {"code": "nominalValue", + "field": "nominalValue","type": 11,"name": "Номинал","shortname": "Номинал","searchable": true,"sortable": true + } + , + {"code": "nominalCurrency", + "type": 12,"name": "Валюта номинала","shortname": "Валюта номинала","searchable": true,"sortable": true,"link": "currencyCode" + } + , + {"code": "instrumentType", + "type": 12,"name": "Идентификатор типа инструмента","shortname": "Тип инструмента","searchable": true,"sortable": true,"visible": true,"link": "instrumentType","extends": "security" + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование инструмента","shortname": "Наименование","searchable": true,"sortable": true,"length": 255,"visible": true,"extends": "security" + } + , + {"code": "securitySymbol", + "type": 2,"name": "Код инструмента","shortname": "Код","searchable": true,"sortable": true,"length": 255,"visible": true,"extends": "security" + } + , + {"code": "termType", + "type": 12,"name": "Идентификатор вида инструмента","shortname": "Вид инструмента","searchable": true,"sortable": true,"visible": true,"link": "termType" + } + , + {"code": "id", + "type": 11,"name": "Размер лота","shortname": "Размер лота","searchable": true,"sortable": true,"visible": true,"linkKeyCode": "securityId","linkCode": "lotSize","link": "listing" + } + ] + ,"actions":[ + {"method":"post", + + "name": "Добавление инструмента", + + "destination": "", + + "fields": [ + {"code": "startDate", + "type": 6,"name": "Дата начала действия","shortname": "Начальная дата","required": true + } + , + {"code": "endDate", + "type": 6,"name": "Дата окончания действия","shortname": "Конечная дата","required": true + } + , + {"code": "nominalValue", + "field": "nominalValue","type": 11,"name": "Номинал","shortname": "Номинал","required": true + } + , + {"code": "nominalCurrency", + "type": 12,"name": "Валюта номинала","shortname": "Валюта номинала","required": true,"link": "currencyCode" + } + , + {"code": "instrumentType", + "type": 12,"name": "Идентификатор типа инструмента","shortname": "Тип инструмента","required": true,"link": "instrumentType" + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование инструмента","shortname": "Наименование","length": 255,"required": true + } + , + {"code": "securitySymbol", + "type": 2,"name": "Код инструмента","shortname": "Код инструмента","length": 255,"required": true + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Лот","required": true + } + ] + } + , + {"method":"put", + + "name": "Изменение инструмента", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "security","linkCode": "id","required": true + } + , + {"code": "endDate", + "type": 6,"name": "Дата окончания действия","shortname": "Конечная дата" + } + , + {"code": "nominalValue", + "field": "nominalValue","type": 11,"name": "Номинал","shortname": "Номинал" + } + , + {"code": "nominalCurrency", + "type": 12,"name": "Валюта номинала","shortname": "Валюта номинала","link": "currencyCode" + } + , + {"code": "instrumentType", + "type": 12,"name": "Идентификатор типа инструмента","shortname": "Тип инструмента","link": "instrumentType" + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование инструмента","shortname": "Наименование","length": 255 + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Лот" + } + ] + } + , + {"method":"delete", + + "name": "Удаление инструмента", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "security","linkCode": "id","required": true + } + ] + } + ] + } + , + "listing": { + + "name": "Листинг инструментов", + + "class": "ru.clearing.classes.statics.data.misc.Listing", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "securityId", + "type": 1,"name": "Идентификатор инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"link": "security" + } + , + {"code": "lotSize", + "type": 11,"name": "Размер лота","shortname": "Размер лота","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","searchable": true,"sortable": true,"link": "market" + } + , + {"code": "symbolCode", + "type": 2,"length": 255,"name": "Код инструмента на торговой площадке","shortname": "Код инструмента на торговой площадке","searchable": true,"sortable": true + } + , + {"code": "symbolName", + "type": 2,"length": 255,"name": "Название инструмента на торговой площадке","shortname": "Название инструмента на торговой площадке","searchable": true,"sortable": true + } + , + {"code": "tradingCurrency", + "type": 12,"name": "Идентификатор кода валюты расчета","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "workflowStatus", + "type": 12,"name": "Идентификатор статуса листинга в системе","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "workflowStatus" + } + ] + + } + , + "market": { + + "name": "Торговые секции", + + "class": "ru.clearing.classes.statics.data.misc.Market", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "description", + "type": 2,"length": 255,"name": "Описание","shortname": "Описание","searchable": true,"sortable": true + } + , + {"code": "exchangeId", + "type": 1,"name": "Идентификатор площадки","shortname": "Идентификатор площадки","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "name", + "type": 2,"length": 255,"name": "Наименование","shortname": "Наименование","searchable": true,"sortable": true + } + , + {"code": "code", + "type": 12,"name": "Секция","shortname": "Секция","searchable": true,"sortable": true + } + , + {"code": "settlementCurrency", + "type": 12,"name": "Валютный код расчетов","shortname": "Валюта расчёта","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "sector", + "type": 12,"name": "Идентификатор секции","shortname": "Секция","searchable": true,"sortable": true,"visible": true,"link": "sector" + } + ] + + } + , + "accountBalance": { + + "name": "Информация об остатках ден. средств", + + "class": "ru.clearing.classes.statics.data.account.AccountBalance", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор участника","shortname": "Участник","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "accountType", + "type": 12,"name": "Тип счета","shortname": "Тип счета","searchable": true,"sortable": true,"link": "account","linkCode": "accountType" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Счет","shortname": "Счет","searchable": true,"sortable": true + } + , + {"code": "openBalanceAmount", + "type": 10,"name": "Начальная сумма после расчетной организации","shortname": "Начальный баланс","searchable": true,"sortable": true + } + , + {"code": "startBalanceAmount", + "type": 10,"name": "Начальная сумма остатков ден. средств на начало работы","shortname": "Стартовый баланс","searchable": true,"sortable": true + } + , + {"code": "closeBalanceAmount", + "type": 10,"name": "Конечная сумма остатков ден. средств на счете","shortname": "Конечный баланс","searchable": true,"sortable": true + } + , + {"code": "tradeBalanceAmount", + "type": 10,"name": "Регистр «Денежные средства Участника клиринга – блокированные»","shortname": "Регистр блокированные","searchable": true,"sortable": true + } + , + {"code": "freeBalanceAmount", + "type": 10,"name": "Регистр «Денежные средства Участника клиринга – свободные»","shortname": "Регистр свободные","searchable": true,"sortable": true + } + , + {"code": "changeBalanceAmount", + "type": 10,"name": "Сумма изменения остатков ден. средств на счете","shortname": "Баланс изменений","searchable": true,"sortable": true + } + , + {"code": "creditAmount", + "type": 10,"name": "Зачисления","shortname": "Зачисления","searchable": true,"sortable": true + } + , + {"code": "debitAmount", + "type": 10,"name": "Списания","shortname": "Списания","searchable": true,"sortable": true + } + , + {"code": "balanceAmount", + "type": 10,"name": "Денежные средства Участника клиринга, зарезервированные на торги","shortname": "Регистр торги","searchable": true,"sortable": true + } + , + {"code": "balanceAccountType", + "type": 12,"name": "Тип баланса","shortname": "Тип баланса","searchable": true,"sortable": true,"visible": true,"link": "balanceAccountType" + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "currencyCode", + "type": 12,"name": "Код валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "tradingCode", + "type": 2,"name": "Торговый код Участника","shortname": "Торговый код","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "tradingCode" + } + , + {"code": "shortName", + "type": 2,"name": "Короткое наименование Участника","shortname": "Участник","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "shortName" + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование Участника","shortname": "Наименование участника","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "fullName" + } + ] + + } + , + "balanceRegistry": { + + "name": "Реестр остатков денежных средств", + + "table": "balance_registry", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "sDf01Date", + "type": 4,"name": "Дата создания записи в S_DF01","shortname": "Дата создания записи в S_DF01","searchable": true,"sortable": true + } + , + {"code": "currencyCode", + "type": 12,"name": "Код валюты","shortname": "Валюта","link": "currencyCode" + } + , + {"code": "setHouseName", + "type": 2,"length": 255,"name": "Наименование РО","shortname": "Наименование РО","searchable": true,"sortable": true,"visible": true + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Номер торгового/клирингового счета","shortname": "Номер торгового/клирингового счета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "infoAccount", + "type": 2,"length": 50,"name": "Номер счета внутреннего учета СПВБ","shortname": "Номер счета внутреннего учета СПВБ","searchable": true,"sortable": true,"visible": true + } + , + {"code": "remainderSum", + "type": 10,"name": "Остаток денежных средст","shortname": "Остаток","searchable": true,"sortable": true + } + , + {"code": "blockedSum", + "type": 10,"name": "Сумма блокированных денежных средств","shortname": "Блокированные","searchable": true,"sortable": true + } + , + {"code": "unblockedSum", + "type": 10,"name": "Сумма свободных денежных средств","shortname": "Свободные","searchable": true,"sortable": true + } + , + {"code": "inn", + "type": 2,"length": 255,"name": "Идентификационный номер налогоплательщика (ИНН)","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "market", + "type": 1,"name": "Сегмент рынка","shortname": "Сегмент рынка","searchable": true,"sortable": true,"visible": true,"link": "market" + } + , + {"code": "marketName", + "type": 2,"length": 255,"name": "Наименование сегмента рынка","shortname": "Сегмент рынка","searchable": true,"sortable": true,"visible": true + } + , + {"code": "fullName", + "type": 2,"length": 255,"name": "Наименование Участника Клиринга","shortname": "Участник Клиринга","searchable": true,"sortable": true,"visible": true + } + , + {"code": "typeRemains", + "type": 12,"name": "Тип остатка","shortname": "Тип остатка","searchable": true,"sortable": true,"visible": true + } + , + {"code": "docNumber", + "type": 2,"length": 255,"name": "Номер документа","shortname": "Номер","searchable": true,"sortable": true,"visible": true + } + ] + + } + , + "managementJournal": { + + "name": "Журнал монитора и контроля", + + "class": "ru.clearing.classes.statics.data.journal.ManagementJournal", + + "table": "managementJournal", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "companyId", + "type": 1,"name": "Участник","shortname": "Участник","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "userId", + "type": 1,"name": "Автор сообщения","shortname": "Сотрудник","searchable": true,"sortable": true,"visible": true,"link": "userCls" + } + , + {"code": "managementJournalType", + "type": 12,"name": "Тип мониторинга","shortname": "Тип","searchable": true,"sortable": true,"visible": true,"link": "managementJournalType" + } + , + {"code": "managementJournalPurpose", + "type": 12,"name": "Цель мониторинга","shortname": "Цель","searchable": true,"sortable": true,"visible": true,"link": "managementJournalPurpose" + } + , + {"code": "managementJournalStatus", + "type": 12,"name": "Статус","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "managementJournalStatus" + } + , + {"code": "text", + "type": 2,"name": "Сообщение","shortname": "Сообщение","searchable": true,"visible": true,"sortable": true,"length": 4096 + } + , + {"code": "changeAccessSign", + "type": 12,"name": "Признак изменения доступа","shortname": "Признак изменения доступа","searchable": true,"sortable": true,"visible": true,"link": "allowed" + } + , + {"code": "changeDataSign", + "type": 12,"name": "Признак изменения данных","shortname": "Признак изменения данных","searchable": true,"sortable": true,"visible": true,"link": "allowed" + } + , + {"code": "eventDate", + "type": 4,"name": "Дата события ЕГРЮЛ","shortname": "Дата события","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + ] + ,"actions":[ + {"method":"post", + + "name": "Добавление записи в журнал мониторинга и контроля", + + "destination": "", + + "fields": [ + {"code": "companyId", + "type": 1,"name": "Участник","shortname": "Участник","searchable": true,"sortable": true,"visible": true,"link": "company","required": true + } + , + {"code": "managementJournalType", + "type": 12,"name": "Тип мониторинга","shortname": "Тип","searchable": true,"sortable": true,"visible": true,"link": "managementJournalType","required": true + } + , + {"code": "managementJournalPurpose", + "type": 12,"name": "Цель мониторинга","shortname": "Цель","searchable": true,"sortable": true,"visible": true,"link": "managementJournalPurpose","required": true + } + , + {"code": "statusId", + "type": 12,"name": "Статус","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "managementJournalStatus","required": true + } + , + {"code": "text", + "type": 2,"name": "Сообщение","shortname": "Сообщение","searchable": true,"visible": true,"sortable": true,"length": 4096 + } + , + {"code": "changeAccessSign", + "type": 12,"name": "Признак изменения доступа","shortname": "Признак изменения доступа","searchable": true,"sortable": true,"visible": true,"link": "allowed","required": true + } + , + {"code": "changeDataSign", + "type": 12,"name": "Признак изменения данных","shortname": "Признак изменения данных","searchable": true,"sortable": true,"visible": true,"link": "allowed","required": true + } + , + {"code": "eventDate", + "type": 4,"name": "Дата события ЕГРЮЛ","shortname": "Дата события","searchable": true,"sortable": true,"required": true + } + ] + } + ] + } + , + "inDocumentJournal": { + + "name": "Журнал входящих документов", + + "class": "ru.clearing.classes.statics.data.journal.InDocumentJournal", + + "table": "InDocumentJournal", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "№п/п","searchable": true,"sortable": true + } + , + {"code": "registrationDate", + "type": 6,"name": "Дата регистрации","shortname": "Дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "registrationTime", + "type": 5,"name": "Время регистрации","shortname": "Время","searchable": true,"sortable": true,"visible": true + } + , + {"code": "registrationNumber", + "type": 1,"name": "Регистационный номер","shortname": "Регистационный номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "documentName", + "type": 2,"length": 255,"name": "Наименование документа","shortname": "Документ","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sender", + "type": 2,"length": 255,"name": "Полное наименование отправителя","shortname": "Отправителя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "quantity", + "type": 1,"name": "Количествово экземпляров","shortname": "Кол-во экз.","searchable": true,"sortable": true,"visible": true + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код Участника Клиринга","shortname": "Код УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "courierType", + "type": 12,"name": "Способ отправки","shortname": "Способ отправки","searchable": true,"sortable": true,"visible": true,"link": "courierType" + } + , + {"code": "emailDate", + "type": 6,"name": "Дата отправки электронной почтой","shortname": "Дата отправки эл. почтой","searchable": true,"sortable": true,"visible": true + } + , + {"code": "amount", + "type": 11,"name": "Сумма","shortname": "Сумма","searchable": true,"sortable": true,"visible": true + } + , + {"code": "dossierNumber", + "type": 2,"length": 50,"name": "Номер дела","shortname": "Дело №","searchable": true,"sortable": true,"visible": true + } + , + {"code": "comment", + "type": 2,"length": 255,"name": "Комментарий","shortname": "Комментарий","searchable": true,"sortable": true,"visible": true + } + , + {"code": "receiptDate", + "type": 6,"name": "Дата получения оригинала","shortname": "Дата получения","searchable": true,"sortable": true,"visible": true + } + , + {"code": "resultStatus", + "type": 12,"name": "Статус загрузки документа","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "resultStatus" + } + ] + + } + , + "outDocumentJournal": { + + "name": "Журнал исходящих документов", + + "class": "ru.clearing.classes.statics.data.journal.OutDocumentJournal", + + "table": "OutDocumentJournal", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "№п/п","searchable": true,"sortable": true + } + , + {"code": "registrationDate", + "type": 6,"name": "Дата регистрации","shortname": "Дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "registrationTime", + "type": 5,"name": "Время регистрации","shortname": "Время","searchable": true,"sortable": true,"visible": true + } + , + {"code": "registrationNumber", + "type": 1,"name": "Регистационный номер","shortname": "Регистационный номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "documentName", + "type": 2,"length": 255,"name": "Наименование документа","shortname": "Документ","searchable": true,"sortable": true,"visible": true + } + , + {"code": "addressee", + "type": 2,"length": 255,"name": "Полное наименование получателя","shortname": "Получатель","searchable": true,"sortable": true,"visible": true + } + , + {"code": "quantity", + "type": 1,"name": "Количествово экземпляров","shortname": "Кол-во экз.","searchable": true,"sortable": true,"visible": true + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код Участника Клиринга","shortname": "Код УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "courierType", + "type": 12,"name": "Способ отправки","shortname": "Способ отправки","searchable": true,"sortable": true,"visible": true,"link": "courierType" + } + , + {"code": "emailDate", + "type": 6,"name": "Дата отправки электронной почтой","shortname": "Дата отправки эл. почтой","searchable": true,"sortable": true,"visible": true + } + , + {"code": "amount", + "type": 11,"name": "Сумма","shortname": "Сумма","searchable": true,"sortable": true,"visible": true + } + , + {"code": "dossierNumber", + "type": 2,"length": 50,"name": "Номер дела","shortname": "Дело №","searchable": true,"sortable": true,"visible": true + } + , + {"code": "postDate", + "type": 6,"name": "Дата почтового отправления","shortname": "Дата отправления","searchable": true,"sortable": true,"visible": true + } + , + {"code": "resultStatus", + "type": 12,"name": "Статус выгрузки документа","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "resultStatus" + } + ] + + } + , + "executionDeposit": { + + "name": "Сделки", + + "class": "ru.clearing.classes.TransactionData.Execution.DepositExecution", + + "table": "execution_deposit", + + "fields": [ + {"code": "id", + "type": 1,"name": "ID записи","shortname": "ID записи","visible": false,"searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionId", + "type": 1,"name": "Идентификационный номер сделки в Торговой системе","shortname": "Сделка №","visible": true,"searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionTime", + "type": 4,"name": "Время в Торговой системе","shortname": "Время сделки","visible": true,"searchable": true,"sortable": true + } + , + {"code": "createdAt", + "type": 5,"name": "Время регистрации сделки","shortname": "Время сделки","visible": false,"searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "type": 5,"name": "Время изменения сделки","shortname": "Время изменения","visible": false,"searchable": true,"sortable": true + } + , + {"code": "tradingDate", + "type": 6,"name": "Дата торгов","shortname": "Дата торгов","visible": false,"searchable": true,"sortable": true + } + , + {"code": "accountId", + "field": "tradingClearingAccount.id","type": 1,"name": "Торговый счет","shortname": "Счет","visible": true,"searchable": true,"sortable": true,"link": "account","linkCode": "account" + } + , + {"code": "market", + "type": 12,"name": "Секция финансового инструмента","shortname": "Секция","visible": true,"searchable": true,"sortable": true,"link": "market" + } + , + {"code": "price", + "field": "financialProduct.interestRate.value","type": 10,"name": "Ставка по депозиту","shortname": "Ставка, %","visible": true,"searchable": true,"sortable": true + } + , + {"code": "lots", + "type": 11,"name": "Количество лотов","shortname": "Лоты","visible": true,"searchable": true,"sortable": true + } + , + {"code": "quantity", + "type": 11,"name": "Количество штук","shortname": "Штуки","visible": false,"searchable": true,"sortable": true + } + , + {"code": "firstLegAmount", + "type": 11,"name": "Объем сделки","shortname": "Объем","visible": true,"searchable": true,"sortable": true + } + , + {"code": "secondLegAmount", + "type": 11,"name": "Объем возврата","shortname": "Объем возврата","visible": true,"searchable": true,"sortable": true + } + , + {"code": "interestAmount", + "type": 11,"name": "Объем процентов","shortname": "Проценты","visible": false,"searchable": true,"sortable": true + } + , + {"code": "companyId", + "field": "company.id","type": 1,"name": "Название компании","shortname": "Компания","visible": true,"searchable": true,"sortable": true,"link": "company" + } + , + {"code": "duration", + "type": 1,"name": "Срок, дней","shortname": "Срок","visible": true,"searchable": true,"sortable": true + } + , + {"code": "firstLegSettlementDate", + "field": "firstLeg.settlementDate","type": 6,"name": "Дата размещения","shortname": "Дата размещения","visible": true,"searchable": true,"sortable": true + } + , + {"code": "secondLegSettlementDate", + "field": "secondLeg.settlementDate","type": 6,"name": "Дата возврата","shortname": "Дата возврата","visible": true,"searchable": true,"sortable": true + } + , + {"code": "firstLegSettlementCode", + "field": "firstLeg.settlementCode","type": 6,"name": "Код расчетов при размещении","shortname": "Код расчетов при размещении","visible": false,"searchable": true,"sortable": true + } + , + {"code": "secondLegSettlementCode", + "field": "secondLeg.settlementCode","type": 6,"name": "Код расчетов при возврате","shortname": "Код расчетов","visible": true,"searchable": true,"sortable": true + } + , + {"code": "counterPartyId", + "type": 1,"name": "Имя компании-партнера, с которым заключена сделка","shortname": "Партнер","visible": false,"searchable": true,"sortable": true,"link": "company" + } + , + {"code": "sessionId", + "type": 1,"name": "Идентификатор сессии","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "moneyMarketSession" + } + , + {"code": "moneyMarketSecurityId", + "type": 1,"name": "Финансовый инструмент","shortname": "Инструмент","visible": false,"searchable": true,"sortable": true,"link": "moneyMarketSecurity" + } + , + {"code": "securitySymbol", + "type": 2,"length": 255,"name": "Код инструмента в Торговой Системе","shortname": "Код инструмента","visible": true,"searchable": true,"sortable": true + } + , + {"code": "securityFullName", + "type": 2,"length": 255,"name": "Наименование инструмента","shortname": "Инструмент","visible": true,"searchable": true,"sortable": true + } + , + {"code": "side", + "type": 12,"name": "Направление сделки","shortname": "Направление","visible": true,"searchable": true,"sortable": true,"link": "moneyFlowSide" + } + , + {"code": "settlementCurrency", + "type": 12,"name": "Валюта расчетов по инструменту","shortname": "Валюта","visible": true,"searchable": true,"sortable": true,"link": "currencyCode","linkCode": "currencyCode" + } + , + {"code": "coverageStatus", + "type": 12,"name": "Cтатус достаточности обеспечения","shortname": "Обеспеченность","searchable": true,"sortable": true,"link": "allowed" + } + ] + + } + , + "executionDepositRegister": { + + "name": "Реестр сделок", + + "class": "ru.clearing.classes.TransactionData.Execution.DepositExecution", + + "table": "ExecutionDeposit", + + "fields": [ + {"code": "id", + "type": 1,"name": "ID записи","shortname": "ID записи","visible": false,"searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionId", + "type": 3,"name": "Идентификационный номер сделкт в Торговой Системе","shortname": "Сделка №","visible": true,"searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionTime", + "type": 6,"name": "Время в Торговой Системе","shortname": "Время сделки","visible": true,"searchable": true,"sortable": true + } + , + {"code": "createdAt", + "type": 5,"name": "Время регистрации сделки","shortname": "Время сделки","visible": true,"searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "type": 5,"name": "Время изменения сделки","shortname": "Время изменения","visible": false,"searchable": true,"sortable": true + } + , + {"code": "tradingDate", + "type": 6,"name": "Дата торгов","shortname": "Дата торгов","visible": false,"searchable": true,"sortable": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата клиринга","shortname": "Дата клиринга","visible": false,"searchable": true,"sortable": true + } + , + {"code": "accountId", + "field": "tradingClearingAccount.id","type": 1,"name": "Торговый счет","shortname": "Счет","visible": false,"searchable": true,"sortable": true,"link": "account","linkCode": "account" + } + , + {"code": "market", + "type": 12,"name": "Секция финансового инструмента","shortname": "Секция","visible": true,"searchable": true,"sortable": true,"link": "market" + } + , + {"code": "price", + "field": "financialProduct.interestRate.value","type": 10,"name": "Ставка по депозиту","shortname": "Ставка,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "amount", + "field": "financialProduct.amount","type": 3,"name": "Объем сделки","shortname": "Объем сделки","visible": true,"searchable": true,"sortable": true + } + , + {"code": "sideId", + "type": 1,"name": "Направление заявки","shortname": "Направление","visible": true,"searchable": true,"sortable": true,"link": "moneyFlowSide" + } + , + {"code": "settlementCurrencyId", + "type": 1,"name": "Валюта расчетов по инструменту","shortname": "Валюта","visible": true,"searchable": true,"sortable": true,"link": "currencyCode","linkCode": "currencyCode" + } + , + {"code": "companyId", + "field": "company.id","type": 1,"name": "Название компании","shortname": "Участник","visible": false,"searchable": true,"sortable": true,"link": "company" + } + , + {"code": "firstLegSettlementDate", + "field": "firstLeg.settlementDate","type": 6,"name": "Дата размещения","shortname": "Дата размещения","visible": true,"searchable": true,"sortable": true + } + , + {"code": "secondLegSettlementDate", + "field": "secondLeg.settlementDate","type": 6,"name": "Дата возврата","shortname": "Дата возврата","visible": true,"searchable": true,"sortable": true + } + , + {"code": "symbolName", + "type": 2,"length": 50,"name": "Наименование инструмента в Торговой Системе","shortname": "Инструмент","visible": false,"searchable": true,"sortable": true + } + , + {"code": "symbolCode", + "type": 2,"length": 20,"name": "Код инструмента в Торговой Системе","shortname": "Код инструмента","visible": false,"searchable": true,"sortable": true + } + , + {"code": "securitiesDepositId", + "type": 1,"name": "Наименование финансового инструмента","shortname": "Инструмент","visible": true,"searchable": true,"sortable": true,"link": "security","linkCode": "shortname" + } + , + {"code": "counterPartyId", + "type": 1,"name": "Имя фирмы-партнера, с которым заключена сделка","shortname": "Партнер","visible": true,"searchable": true,"sortable": true,"link": "company" + } + , + {"code": "coverageStatusId", + "type": 1,"name": "Cтатус достаточности обеспечения","shortname": "Обеспеченность","searchable": true,"sortable": true,"link": "allowed" + } + , + {"code": "sessionId", + "type": 1,"name": "Сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "moneyMarketSession" + } + , + {"code": "subscription", + "enabled": "true","destination": "executionDeposit.state" + } + ] + + } + , + "admittedDeal": { + + "name": "Реестр сделок, допущенных к клирингу", + + "class": "ru.clearing.classes.statics.data.misc.AdmittedDeal", + + "fields": [ + {"code": "companyFullName", + "type": 2,"length": 255,"name": "Наименование биржи","shortname": "Наименование биржи","searchable": true,"sortable": true,"visible": true + } + , + {"code": "executionDepositRegisterTradingDate", + "type": 4,"name": "Дата заключения сделки","shortname": "Дата сделки","searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionId", + "type": 2,"length": 255,"name": "Номер сделки","shortname": "Номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "exchangeExecutionTime", + "type": 5,"name": "Время заключения сделки","shortname": "Время сделки","searchable": false,"sortable": false,"visible": true + } + , + {"code": "securityId", + "type": 1,"name": "Биржевой код инструмента","shortname": "Инструмент","visible": true,"searchable": true,"sortable": true,"link": "security","linkCode": "shortname" + } + , + {"code": "securityName", + "type": 2,"length": 255,"name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerFullName", + "type": 2,"length": 255,"name": "Наименование продавца","shortname": "Наименование продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerClearingCode", + "type": 2,"length": 255,"name": "Код продавца","shortname": "Код продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerAccount", + "type": 2,"name": "Счет продавца","shortname": "Счет продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerFullName", + "type": 2,"length": 255,"name": "Наименование продавца","shortname": "Наименование продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerClearingCode", + "type": 2,"length": 255,"name": "Код продавца","shortname": "Код продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerAccount", + "type": 2,"name": "Счет продавца","shortname": "Счет продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "executionDepositRegisterAmount", + "type": 10,"name": "Сумма сделки","shortname": "Сумма сделки","searchable": true,"sortable": true + } + ] + + } + , + "dealPassedControl": { + + "name": "Реестр сделок, прошедших процедуру контроля обеспечения", + + "coverageStatus": "ALWD", + + "fields": [ + {"code": "companyFullName", + "type": 2,"length": 255,"name": "Наименование биржи","shortname": "Наименование биржи","searchable": true,"sortable": true,"visible": true + } + , + {"code": "executionDepositRegisterTradingDate", + "type": 4,"name": "Дата заключения сделки","shortname": "Дата сделки","searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionId", + "type": 2,"length": 255,"name": "Номер сделки","shortname": "Номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "exchangeExecutionTime", + "type": 5,"name": "Время заключения сделки","shortname": "Время сделки","searchable": false,"sortable": false,"visible": true + } + , + {"code": "securityId", + "type": 1,"name": "Биржевой код инструмента","shortname": "Инструмент","visible": true,"searchable": true,"sortable": true,"link": "security","linkCode": "shortname" + } + , + {"code": "securityName", + "type": 2,"length": 255,"name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerFullName", + "type": 2,"length": 255,"name": "Наименование продавца","shortname": "Наименование продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerClearingCode", + "type": 2,"length": 255,"name": "Код продавца","shortname": "Код продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerAccount", + "type": 2,"name": "Счет продавца","shortname": "Счет продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerFullName", + "type": 2,"length": 255,"name": "Наименование продавца","shortname": "Наименование продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerClearingCode", + "type": 2,"length": 255,"name": "Код продавца","shortname": "Код продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerAccount", + "type": 2,"name": "Счет продавца","shortname": "Счет продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "executionDepositRegisterAmount", + "type": 10,"name": "Сумма сделки","shortname": "Сумма сделки","searchable": true,"sortable": true + } + ] + + } + , + "dealUnPassedControl": { + + "name": "Реестр сделок, не прошедших процедуру контроля обеспечения", + + "coverageStatus": "DEND", + + "fields": [ + {"code": "companyFullName", + "type": 2,"length": 255,"name": "Наименование биржи","shortname": "Наименование биржи","searchable": true,"sortable": true,"visible": true + } + , + {"code": "executionDepositRegisterTradingDate", + "type": 4,"name": "Дата заключения сделки","shortname": "Дата сделки","searchable": true,"sortable": true + } + , + {"code": "exchangeExecutionId", + "type": 2,"length": 255,"name": "Номер сделки","shortname": "Номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "exchangeExecutionTime", + "type": 5,"name": "Время заключения сделки","shortname": "Время сделки","searchable": false,"sortable": false,"visible": true + } + , + {"code": "securityId", + "type": 1,"name": "Биржевой код инструмента","shortname": "Инструмент","visible": true,"searchable": true,"sortable": true,"link": "security","linkCode": "shortname" + } + , + {"code": "securityName", + "type": 2,"length": 255,"name": "Наименование инструмента","shortname": "Инструмент","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerFullName", + "type": 2,"length": 255,"name": "Наименование продавца","shortname": "Наименование продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerClearingCode", + "type": 2,"length": 255,"name": "Код продавца","shortname": "Код продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sellerAccount", + "type": 2,"name": "Счет продавца","shortname": "Счет продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerFullName", + "type": 2,"length": 255,"name": "Наименование продавца","shortname": "Наименование продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerClearingCode", + "type": 2,"length": 255,"name": "Код продавца","shortname": "Код продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "buyerAccount", + "type": 2,"name": "Счет продавца","shortname": "Счет продавца","searchable": true,"sortable": true,"visible": true + } + , + {"code": "executionDepositRegisterAmount", + "type": 10,"name": "Сумма сделки","shortname": "Сумма сделки","searchable": true,"sortable": true + } + , + {"code": "result", + "type": 2,"length": 3,"name": "Результат клиринга","shortname": "Результат клиринга","searchable": true,"sortable": true + } + ] + + } + , + "reportRegister": { + + "name": "Реестр отчетов", + + "class": "com.moex.platform.classes.TransactionData.Execution.DepositExecution", + + "table": "reportRegister", + + "fields": [ + {"code": "id", + "type": 1,"name": "ID записи","shortname": "ID записи","visible": false,"searchable": true,"sortable": true + } + , + {"code": "createdAt", + "type": 5,"name": "Время регистрации","shortname": "Время","visible": true,"searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "type": 5,"name": "Время изменения","shortname": "Время изменения","visible": false,"searchable": true,"sortable": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата клиринга","shortname": "Дата клиринга","visible": false,"searchable": true,"sortable": true + } + , + {"code": "companyFullName", + "type": 2,"length": 255,"name": "Наименование участника","shortname": "Участник","searchable": true,"sortable": true + } + , + {"code": "clearingCode", + "type": 2,"length": 255,"name": "Код клиринга","shortname": "Код участника","searchable": true,"sortable": true + } + , + {"code": "sessionId", + "type": 1,"name": "Сессия","shortname": "Сессия","visible": true,"searchable": true,"sortable": true,"link": "moneyMarketSession" + } + , + {"code": "comment", + "type": 2,"name": "Комментарий","shortname": "Основание","searchable": true,"sortable": true,"length": 255 + } + , + {"code": "name", + "type": 2,"length": 255,"name": "Наименование","shortname": "Наименование","visible": false,"searchable": true,"sortable": true + } + , + {"code": "quantity", + "type": 1,"name": "Количество записей","shortname": "Количество","visible": false,"searchable": true,"sortable": true + } + ] + + } + , + "contractRegister": { + + "name": "Журнал регистрации договоров", + + "class": "ru.clearing.classes.TransactionData.Execution.DepositExecution", + + "table": "reportRegister", + + "fields": [ + {"code": "id", + "type": 1,"name": "Номер записи","shortname": "ID записи","visible": false,"searchable": true,"sortable": true + } + , + {"code": "createdAt", + "type": 5,"name": "Дата и время регистрации документа","shortname": "Время сделки","visible": true,"searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "type": 5,"name": "Время изменения сделки","shortname": "Время изменения","visible": false,"searchable": true,"sortable": true + } + , + {"code": "name", + "type": 2,"length": 255,"name": "Наименование документа","shortname": "Наименование","searchable": true,"sortable": true,"visible": true + } + , + {"code": "number", + "type": 2,"length": 255,"name": "Номер документа","shortname": "Номер","searchable": true,"sortable": true,"visible": true + } + , + {"code": "issueDate", + "type": 6,"name": "Дата составления","shortname": "Дата выдачи","searchable": true,"sortable": true + } + , + {"code": "companyFullName", + "type": 1,"name": "Наименование лица","shortname": "Компания","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор Компании","shortname": "Идентификатор Компании","searchable": true,"sortable": true,"visible": true,"link": "company" + } + , + {"code": "documentType", + "type": 12,"name": "Идентификатор типа документа","shortname": "Идентификатор типа документа","searchable": true,"sortable": true,"visible": true,"link": "documentType" + } + , + {"code": "issuePlace", + "type": 2,"length": 255,"name": "Место выдачи","shortname": "Место выдачи","searchable": true,"sortable": true,"visible": true + } + , + {"code": "issuer", + "type": 2,"length": 255,"name": "Кем выдан","shortname": "Кем выдан","searchable": true,"sortable": true,"visible": true + } + , + {"code": "issuerCode", + "type": 2,"length": 255,"name": "Код выдавшего органа","shortname": "Код выдавшего органа","searchable": true,"sortable": true,"visible": true + } + , + {"code": "place", + "type": 2,"length": 255,"name": "Место","shortname": "Место","searchable": true,"sortable": true,"visible": true + } + , + {"code": "validFromDate", + "type": 6,"name": "Дата начала срока действия","shortname": "Дата начала срока действия","searchable": true,"sortable": true + } + , + {"code": "validToDate", + "type": 6,"name": "Дата окончания срока действия","shortname": "Дата окончания срока действия","searchable": true,"sortable": true + } + , + {"code": "closeDate", + "type": 6,"name": "Дата расторжения","shortname": "Дата расторжения","searchable": true,"sortable": true + } + , + {"code": "comment", + "type": 2,"length": 255,"name": "Место","shortname": "Место","searchable": true,"sortable": true,"visible": true + } + ] + + } + , + "orderRegistry": { + + "name": "Реестра распоряжений", + + "class": "ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets", + + "table": "transactionStatus", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "creditLegAccount", + "type": 2,"lenght": "50","name": "Счет отправителя","shortname": "Счет отправителя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "creditLegAmount", + "type": 10,"name": "Сумма отправителя","shortname": "Сумма отправителя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "creditLegCurrencyCode", + "type": 12,"name": "Код валюты отправителя","shortname": "Валюта отправителя","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "creditLegDirection", + "type": 1,"name": "Направление отправителя","shortname": "Направление","searchable": true,"sortable": true,"visible": true,"link": "inOutDirection" + } + , + {"code": "debitLegAccount", + "type": 2,"lenght": "50","name": "Счет получателя","shortname": "Счет получателя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sender", + "type": 2,"length": 255,"name": "Отправитель","shortname": "Отправитель","searchable": true,"sortable": true,"visible": true + } + , + {"code": "addressee", + "type": 2,"length": 255,"name": "Получатель","shortname": "Получатель","searchable": true,"sortable": true,"visible": true + } + , + {"code": "documentNumber", + "type": 2,"length": 255,"name": "Номер документа в сторонней системе","shortname": "Номер РО","searchable": true,"sortable": true + } + ] + + } + , + "liabilitiesClaimsMoney": { + + "name": "Требования и обязательства денежных средств", + + "class": "ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsMoney", + + "table": "liabilities_claims_money", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор участника","shortname": "Участник","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "accountType", + "type": 1,"name": "Тип счета","shortname": "Тип счета","searchable": true,"sortable": true,"link": "account","linkCode": "accountType" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Счет","shortname": "Счет","searchable": true,"sortable": true + } + , + {"code": "liabilitiesAmount", + "type": 11,"name": "Регистр «Обязательства по денежным средствам, сформированные по результатам собственных сделок Участника клиринга», исключая проценты","shortname": "Сумма обязательств","searchable": true,"sortable": true + } + , + {"code": "refundInterest", + "type": 11,"name": "Проценты к возврату","shortname": "Проценты к возврату","searchable": true,"sortable": true + } + , + {"code": "accruedInterest", + "type": 11,"name": "Начисленные проценты","shortname": "Начисленные проценты","searchable": true,"sortable": true + } + , + {"code": "claimsAmount", + "type": 11,"name": "Сумма требований, исключая проценты","shortname": "Сумма требований","searchable": true,"sortable": true + } + , + {"code": "settlementDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "tradingDate", + "type": 6,"name": "Дата торгов","shortname": "Дата торгов","searchable": true,"sortable": true,"visible": true + } + , + {"code": "currency", + "type": 12,"name": "Код валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currencyCode" + } + , + {"code": "tradingCode", + "type": 2,"name": "Торговый код Участника","shortname": "Торговый код","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "tradingCode" + } + , + {"code": "shortName", + "type": 2,"name": "Короткое наименование Участника","shortname": "Участник","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "shortName" + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование Участника","shortname": "Наименование участника","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "fullName" + } + ] + + } + , + "liabilitiesClaimsAssets": { + + "name": "Требования и обязательства финансовых активов", + + "class": "ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets", + + "table": "liabilities_claims_assets", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор участника","shortname": "Участник","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "accountType", + "type": 1,"name": "Тип счета","shortname": "Тип счета","searchable": true,"sortable": true,"link": "account","linkCode": "accountType" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Счет","shortname": "Счет","searchable": true,"sortable": true + } + , + {"code": "liabilitiesQuantity", + "type": 10,"name": "Сумма обязательств","shortname": "Сумма обязательств","searchable": true,"sortable": true + } + , + {"code": "claimsQuantity", + "type": 10,"name": "Сумма требований","shortname": "Сумма требований","searchable": true,"sortable": true + } + , + {"code": "currency", + "type": 12,"name": "Код валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currencyCode" + } + , + {"code": "settlementDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "tradingDate", + "type": 6,"name": "Дата торгов","shortname": "Дата торгов","searchable": true,"sortable": true,"visible": true + } + , + {"code": "refundDate", + "type": 6,"name": "Дата возврата","shortname": "Дата возврата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "price", + "type": 10,"name": "Ставка по депозиту","shortname": "Ставка,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "securityId", + "type": 1,"name": "Инструмент","shortname": "Инструмент","searchable": true,"sortable": true,"visible": true,"link": "security" + } + , + {"code": "tradingCode", + "type": 2,"name": "Торговый код Участника","shortname": "Торговый код","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "tradingCode" + } + , + {"code": "clearingCode", + "type": 2,"name": "Клиринговый код Участника","shortname": "Клиринговый код","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "clearingCode" + } + , + {"code": "shortName", + "type": 2,"name": "Короткое наименование Участника","shortname": "Участник","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "shortName" + } + , + {"code": "contract", + "type": 2,"name": "Номер договора","shortname": "Номер договора","searchable": true,"sortable": true,"visible": true,"length": 255 + } + , + {"code": "comment", + "type": 2,"name": "Комментарий","shortname": "Комментарий","searchable": true,"sortable": true,"visible": true,"length": 255 + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование Участника","shortname": "Наименование участника","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "fullName" + } + , + {"code": "parentId", + "type": 1,"name": "Идентификатор записи основного договора без разделения","shortname": "Родительский договор","searchable": true,"sortable": true + } + , + {"code": "liabilitiesClaimsMoneyId", + "type": 1,"name": "Регистры денежных средств","shortname": "Регистры денег","searchable": true,"sortable": true,"link": "liabilitiesClaimsMoney" + } + , + {"code": "interestStatus", + "type": 1,"name": "Статус возврата процентов","shortname": "Возврат процентов","searchable": true,"sortable": true,"link": "interestStatus" + } + , + {"code": "clearingStatus", + "type": 1,"name": "Статус клиринга","shortname": "Статус клиринга","searchable": true,"sortable": true,"link": "clearingStatus" + } + , + {"code": "paymentId", + "type": 1,"name": "Платеж","shortname": "Платеж","searchable": true,"sortable": true + } + , + {"code": "refundPaymentId", + "type": 1,"name": "Обратный платежа","shortname": "Обратный платеж","searchable": true,"sortable": true + } + ] + + } + , + "statement": { + + "name": "Денежные средства от расчетной организации", + + "class": "ru.clearing.classes.statics.data.statement.Statement", + + "table": "statement", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "addresseeId", + "type": 1,"name": "Идентификатор участника получателя","shortname": "Получатель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "senderId", + "type": 1,"name": "Идентификатор участника отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "statementType", + "type": 12,"name": "Тип поступления средств","shortname": "Тип поступления средств","searchable": true,"sortable": true,"link": "statementType" + } + , + {"code": "comment", + "type": 2,"length": 255,"name": "Комментарий","shortname": "Основание","searchable": true,"sortable": true + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Счет","shortname": "Счет","searchable": true,"sortable": true + } + , + {"code": "inOutDirection", + "type": 12,"name": "Направление","shortname": "Направление","searchable": true,"sortable": true,"link": "inOutDirection" + } + , + {"code": "settlementDate", + "type": 6,"name": "Дата расчетов","shortname": "Дата расчетов","searchable": true,"sortable": true + } + , + {"code": "amount", + "type": 11,"name": "Объем","shortname": "Объем","searchable": true,"sortable": true + } + , + {"code": "cashMovementCurrencyCode", + "type": 12,"name": "Код валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "operationStatus", + "type": 12,"name": "Cтатус обработки","shortname": "Статус","searchable": true,"sortable": true,"link": "operationStatus" + } + , + {"code": "errorCode", + "type": 12,"name": "Код ошибки","shortname": "Код ошибки","searchable": true,"sortable": true,"link": "errorCode","linkCode": "code" + } + , + {"code": "errorText", + "type": 12,"name": "Полный текст ошибки","shortname": "Ошибка","searchable": true,"sortable": true,"link": "errorText","linkCode": "text" + } + , + {"code": "inSDfId", + "type": 1,"name": "Идентификатор записи, инициирующей изменения этой таблицы","shortname": "Входящая запись","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "outSDfId", + "type": 1,"name": "Идентификатор записи, формируемой в результате изменения этой таблицы","shortname": "Исходящая запись","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "inOutSDfType", + "type": 12,"name": "Типы входящей и исходящей записей","shortname": "Типы входящей и исходящей записей","searchable": true,"sortable": true,"ignore": true,"link": "inOutSDfType" + } + ] + + } + , + "tradeSettlement": { + + "name": "Проводки на базе сделок торговой системы", + + "class": "ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets", + + "table": "tradeConfirmation", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "addresseeId", + "type": 1,"name": "Идентификатор участника получателя","shortname": "Получатель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "senderId", + "type": 1,"name": "Идентификатор участника отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "amount", + "type": 11,"name": "Объем","shortname": "Объем","searchable": true,"sortable": true + } + , + {"code": "currencyCode", + "type": 12,"name": "Код валюты","shortname": "Валюта","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "inOutDirection", + "type": 1,"name": "Направление","shortname": "Направление","searchable": true,"sortable": true,"link": "inOutDirection" + } + , + {"code": "accountId", + "type": 1,"name": "Идентификатор счета","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "account", + "type": 2,"length": 50,"name": "Счет","shortname": "Счет","searchable": true,"sortable": true + } + , + {"code": "operationStatus", + "type": 12,"name": "Cтатус обработки","shortname": "Статус","searchable": true,"sortable": true,"link": "operationStatus" + } + ] + + } + , + "operation": { + + "name": "Проводки", + + "class": "ru.clearing.classes.TransactionData.Execution.LiabilitiesClaimsAssets", + + "table": "tradeConfirmation", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "addresseeId", + "type": 1,"name": "Идентификатор участника получателя","shortname": "Получатель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "senderId", + "type": 1,"name": "Идентификатор участника отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "operationTypeId", + "type": 1,"name": "Тип проводки","shortname": "Тип","searchable": true,"sortable": true,"link": "operationType" + } + , + {"code": "operationStatus", + "type": 12,"name": "Cтатус обработки","shortname": "Статус","searchable": true,"sortable": true,"link": "operationStatus" + } + ] + + } + , + "paymentInstruction": { + + "name": "Информация о денежных средствах", + + "class": "ru.clearing.classes.statics.data.payment.PaymentInstruction", + + "table": "PaymentInstruction", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "senderId", + "type": 1,"name": "Идентификатор участника отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "addresseeId", + "type": 1,"name": "Идентификатор участника получателя","shortname": "Получатель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "adresseeBIC", + "type": 2,"length": 255,"name": "Банковский идентификационный код (БИК) получателя","shortname": "БИК получателя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "payeeBankName", + "type": 2,"length": 255,"name": "Банк отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"visible": true + } + , + {"code": "payeeBIC", + "type": 2,"length": 255,"name": "Банковский идентификационный код (БИК) отправителя","shortname": "БИК отправителя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "addresseeBankName", + "type": 2,"length": 255,"name": "Банк получателя","shortname": "Получатель","searchable": true,"sortable": true,"visible": true + } + , + {"code": "paymentDate", + "type": 4,"name": "Дата и время платежа","shortname": "Дата и время платежа","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "PaymentPurpose", + "type": 2,"name": "Назначение платежа","shortname": "Назначение","searchable": true,"sortable": true,"visible": true,"length": 255 + } + , + {"code": "settlementDate", + "type": 6,"name": "Дата расчетов","shortname": "Дата расчетов","searchable": true,"sortable": true + } + , + {"code": "creditLeg_amount", + "field": "creditLegAmount","type": 1,"name": "Сумма отправителя","shortname": "Сумма отправителя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "debitLeg_amount", + "field": "debitLegAmount","type": 1,"name": "Сумма получателя","shortname": "Сумма получателя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "creditLeg_accountId", + "field": "creditLegAccountId","type": 1,"name": "Идентификатор счета отправителя","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "credit_csAccount", + "field": "creditCsAccount","type": 2,"length": 255,"name": "Корреспондентский счет отправителя","shortname": "Корр. счет отправителя","searchable": true,"sortable": true,"visible": true + } + , + {"code": "creditLeg_account", + "field": "creditLegAccount","type": 2,"length": 50,"name": "Счет отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"visible": true,"link": "Account" + } + , + {"code": "debitLeg_accountId", + "field": "debitLegAccountId","type": 1,"name": "Идентификатор счета отправителя","shortname": "Идентификатор счета","searchable": true,"sortable": true,"link": "account" + } + , + {"code": "debit_csAccount", + "field": "debitCsAccount","type": 2,"length": 255,"name": "Корреспондентский счет получателя","shortname": "Корреспондентский счет","searchable": true,"sortable": true,"visible": true + } + , + {"code": "debitLeg_account", + "field": "debitLegAccount","type": 2,"length": 50,"name": "Счет получателя","shortname": "Получатель","searchable": true,"sortable": true,"visible": true,"link": "Account" + } + , + {"code": "creditLeg_direction", + "field": "creditLegDirection","type": 1,"name": "Направление отправителя","shortname": "Направление","searchable": true,"sortable": true,"visible": true,"link": "inOutDirection" + } + , + {"code": "debitLeg_direction", + "field": "debitLegDirection","type": 1,"name": "Направление получателя","shortname": "Направление","searchable": true,"sortable": true,"visible": true,"link": "inOutDirection" + } + , + {"code": "creditLeg_currencyCode", + "field": "creditLegCurrencyCode","type": 12,"name": "Код валюты отправителя","shortname": "Валюта отправителя","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "debitLeg_currencyCode", + "field": "debitLegCurrencyCode","type": 12,"name": "Код валюты получателя","shortname": "Валюта получателя","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата расчета","shortname": "Дата расчета","searchable": true,"sortable": true,"visible": true + } + , + {"code": "transactionStatus", + "type": 12,"name": "Cтатус транзакции","shortname": "Статус","searchable": true,"sortable": true,"link": "transactionStatus" + } + , + {"code": "documentNumber", + "type": 2,"length": 255,"name": "Номер документа в сторонней системе","shortname": "Номер РО","searchable": true,"sortable": true + } + ] + + } + , + "marketData": { + + "name": "Итоги торгов", + + "class": "ru.clearing.classes.TransactionData.Execution.MarketData", + + "table": "marketData", + + "fields": [ + {"code": "id", + "type": 1,"name": "ID записи","shortname": "ID записи","visible": false,"searchable": true,"sortable": true + } + , + {"code": "securitiesDepositId", + "type": 1,"name": "Биржевой код инструмента","shortname": "Инструмент","visible": true,"searchable": true,"sortable": true,"link": "security","linkCode": "shortname" + } + , + {"code": "companyName", + "type": 2,"length": 255,"name": "Инициатор торгов","shortname": "Инициатор","visible": false,"searchable": true,"sortable": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","visible": true,"searchable": true,"sortable": true,"link": "market" + } + , + {"code": "counterPartyNum", + "type": 1,"name": "Количество участников, заключивших сделки","shortname": "Участников","visible": true,"searchable": true,"sortable": true + } + , + {"code": "tradesNum", + "type": 1,"name": "Количество сделок","shortname": "Сделок","visible": true,"searchable": true,"sortable": true + } + , + {"code": "amount", + "type": 11,"name": "Объем сделок, руб","shortname": "Объем сделок","visible": true,"searchable": true,"sortable": true + } + , + {"code": "openPrice", + "type": 10,"name": "Откр.","shortname": "Откр.,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "maxPrice", + "type": 10,"name": "Макс.","shortname": "Макс.,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "minPrice", + "type": 10,"name": "Мин.","shortname": "Мин.,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "closePrice", + "type": 10,"name": "Закр.","shortname": "Закр.,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "avgPrice", + "type": 10,"name": "Ср.взв.","shortname": "Ср.взв.,%","visible": true,"searchable": true,"sortable": true + } + , + {"code": "duration", + "type": 3,"name": "Срок, дней","shortname": "Срок","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "type": 5,"name": "Время регистрации сделки","shortname": "Время сделки","visible": true,"searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "type": 5,"name": "Время изменения сделки","shortname": "Время изменения","visible": false,"searchable": true,"sortable": true + } + , + {"code": "tradingDate", + "type": 6,"name": "Дата торгов","shortname": "Дата торгов","visible": false,"searchable": true,"sortable": true + } + ] + + } + , + "chargeTariff": { + + "name": "Тарифы комиссий", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","searchable": true,"sortable": true,"link": "market","visible": true + } + , + {"code": "clearingMemberCategory", + "type": 12,"name": "Категория участника клиринга","shortname": "Категория","searchable": true,"sortable": true,"visible": true,"link": "clearingCategory" + } + , + {"code": "chargeTypeId", + "type": 1,"name": "Тип комиссии","shortname": "Тип комиссии","searchable": true,"sortable": true,"link": "chargeType","visible": true + } + , + {"code": "chargeRate", + "type": 10,"name": "Ставка комиссионного сбора","shortname": "Ставка комиссионного сбора","searchable": true,"sortable": true,"visible": true + } + , + {"code": "currency", + "type": 1,"name": "Валюта начисления комиссии","shortname": "Валюта комиссии","searchable": true,"sortable": true,"link": "currencyCode","visible": true + } + , + {"code": "validFromDate", + "type": 6,"name": "Дата начала срока действия","shortname": "Дата начала срока действия","searchable": true,"sortable": true + } + , + {"code": "validToDate", + "type": 6,"name": "Дата окончания срока действия","shortname": "Дата окончания срока действия","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + ] + + } + , + "individualChargeTariff": { + + "name": "Индивидуальные тарифы комиссий для Участника", + + "logUpdates": "true", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "companyId", + "type": 1,"name": "Участник","shortname": "Участник","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","searchable": true,"sortable": true,"link": "market","visible": true + } + , + {"code": "clearingMemberCategory", + "type": 12,"name": "Категория участника клиринга","shortname": "Категория","searchable": true,"sortable": true,"visible": true,"link": "clearingCategory" + } + , + {"code": "chargeTypeId", + "type": 1,"name": "Тип комиссии","shortname": "Тип комиссии","searchable": true,"sortable": true,"link": "chargeType","visible": true + } + , + {"code": "chargeRate", + "type": 10,"name": "Ставка комиссионного сбора","shortname": "Ставка комиссионного сбора","searchable": true,"sortable": true,"visible": true + } + , + {"code": "currency", + "type": 1,"name": "Валюта начисления комиссии","shortname": "Валюта комиссии","searchable": true,"sortable": true,"link": "currencyCode","visible": true + } + , + {"code": "validFromDate", + "type": 6,"name": "Дата начала срока действия","shortname": "Дата начала срока действия","searchable": true,"sortable": true + } + , + {"code": "validToDate", + "type": 6,"name": "Дата окончания срока действия","shortname": "Дата окончания срока действия","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + ] + + } + , + "companyTariff": { + + "name": "Тарифы комиссий в разрезе Участника", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "market", + "type": 12,"name": "Секция","shortname": "Секция","searchable": true,"sortable": true,"link": "market","visible": true + } + , + {"code": "clearingMemberCategory", + "type": 12,"name": "Категория участника клиринга","shortname": "Категория","searchable": true,"sortable": true,"visible": true,"link": "clearingCategory" + } + , + {"code": "fullName", + "type": 2,"name": "Полное наименование Участника","shortname": "Наименование участника","searchable": true,"sortable": true,"visible": true,"length": 255,"link": "company","linkCode": "fullName" + } + , + {"code": "contract", + "type": 2,"name": "Номер договора","shortname": "Номер договора","searchable": true,"sortable": true,"visible": true,"length": 255 + } + , + {"code": "chargeTypeId", + "type": 1,"name": "Тип комиссии","shortname": "Тип комиссии","searchable": true,"sortable": true,"link": "chargeType","visible": true + } + , + {"code": "chargeRate", + "type": 10,"name": "Ставка комиссионного сбора","shortname": "Ставка комиссионного сбора","searchable": true,"sortable": true,"visible": true + } + , + {"code": "currency", + "type": 1,"name": "Валюта начисления комиссии","shortname": "Валюта комиссии","searchable": true,"sortable": true,"link": "currencyCode","visible": true + } + , + {"code": "validFromDate", + "type": 6,"name": "Дата начала срока действия","shortname": "Дата начала срока действия","searchable": true,"sortable": true + } + , + {"code": "validToDate", + "type": 6,"name": "Дата окончания срока действия","shortname": "Дата окончания срока действия","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Создано","shortname": "Создано","searchable": true,"sortable": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Изменено","shortname": "Изменено","searchable": true,"sortable": true + } + , + {"code": "companyId", + "type": 1,"name": "Участник","shortname": "Участник","searchable": true,"sortable": true,"link": "company" + } + ] + + } + , + "errorText": { + + "name": "Полные тексты ошибок", + + "class": "ru.clearing.classes.statics.data.messages.ErrorText", + + "table": "errorText", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор","shortname": "ID","searchable": true,"sortable": true,"visible": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "errorCode", + "type": 12,"name": "Код ошибки","shortname": "Код","searchable": true,"sortable": true,"visible": true,"link": "errorCode" + } + , + {"code": "text", + "type": 2,"length": 255,"name": "Полный текст ошибки","shortname": "Ошибка","searchable": true,"sortable": true,"visible": true + } + , + {"code": "userId", + "type": 1,"name": "Автор сообщения","shortname": "Сотрудник","searchable": true,"sortable": true,"visible": true,"link": "userCls","ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Текущая дата","shortname": "Дата","visible": false,"searchable": true,"sortable": true,"ignore": true + } + ] + + } + , + "sDf01": { + + "name": "ДФ-01 Информация о денежных средствах, находящихся на торговых банковских счетах Участников клиринга", + + "class": "ru.clearing.classes.statics.data.sdf.SDf01", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "curr_code", + "type": 2,"length": 12,"name": "Код валюты","shortname": "Код валюты","searchable": true,"sortable": true,"visible": true + } + , + {"code": "account", + "type": 2,"length": 35,"name": "Код счета участника клиринга","shortname": "Счет УК","searchable": true,"sortable": true + } + , + {"code": "remainder", + "type": 2,"length": 22,"name": "Остаток денежных средств","shortname": "Остаток денежных средств","searchable": true,"sortable": true + } + , + {"code": "deal", + "type": 2,"length": 10,"name": "Биржевой код участника клиринга","shortname": "Биржевой код УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "acc_code", + "type": 2,"length": 5,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "dat", + "type": 2,"length": 8,"name": "Дата расчетов","shortname": "Дата расчетов","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 2,"length": 1,"name": "Биржевая секция","shortname": "Биржевая секция","searchable": true,"sortable": true + } + , + {"code": "acc_name", + "type": 2,"length": 30,"name": "Наименование участника клиринга","shortname": "Наименование УК","searchable": true,"sortable": true + } + , + {"code": "acc_type", + "type": 2,"length": 2,"name": "Признак счета","shortname": "Признак счета","searchable": true,"sortable": true + } + , + {"code": "sumengage", + "type": 2,"length": 22,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "sumunblock", + "type": 2,"length": 22,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "file_type", + "type": 2,"length": 1,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "fileName", + "type": 2,"length": 255,"name": "Наименование входящего файла","shortname": "Наименование файла","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время обработки файла","shortname": "Дата и время обработки","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf02": { + + "name": "ДФ-02 Уведомление об исполнении операции загрузки денежных средств или уведомление об ошибке", + + "class": "ru.clearing.classes.statics.data.sdf.SDf02", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "curr_code", + "type": 2,"length": 12,"name": "Код валюты","shortname": "Код валюты","searchable": true,"sortable": true,"visible": true + } + , + {"code": "account", + "type": 2,"length": 35,"name": "Код счета участника клиринга","shortname": "Счет УК","searchable": true,"sortable": true + } + , + {"code": "remainder", + "type": 2,"length": 22,"name": "Остаток денежных средств","shortname": "Остаток денежных средств","searchable": true,"sortable": true + } + , + {"code": "deal", + "type": 2,"length": 10,"name": "Биржевой код участника клиринга","shortname": "Биржевой код УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "acc_code", + "type": 2,"length": 5,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "dat", + "type": 2,"length": 8,"name": "Дата расчетов","shortname": "Дата расчетов","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 2,"length": 1,"name": "Биржевая секция","shortname": "Биржевая секция","searchable": true,"sortable": true + } + , + {"code": "acc_name", + "type": 2,"length": 30,"name": "Наименование участника клиринга","shortname": "Наименование УК","searchable": true,"sortable": true + } + , + {"code": "acc_type", + "type": 2,"length": 2,"name": "Признак счета","shortname": "Признак счета","searchable": true,"sortable": true + } + , + {"code": "sumengage", + "type": 2,"length": 22,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "sumunblock", + "type": 2,"length": 22,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "file_type", + "type": 2,"length": 1,"name": "Не используется в Системе","shortname": "Не используется","searchable": true,"sortable": true + } + , + {"code": "result", + "type": 2,"length": 3,"name": "Результат обработки каждой записи исходного файла ДФ-01","shortname": "Результат обработки ДФ-01","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + , + {"code": "inSDf01Id", + "type": 1,"name": "Идентификатор соответствующей записи из таблицы-источника","shortname": "Входящая запись","searchable": true,"sortable": true + } + ] + + } + , + "sDf03": { + + "name": "ДФ-03 Сводное платежное поручение", + + "class": "ru.clearing.classes.statics.data.sdf.SDf03", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "seg_type", + "type": 2,"length": 1,"name": "Код инициатора в КС","shortname": "Инициатор в КС","searchable": true,"sortable": true + } + , + {"code": "doc_type", + "type": 2,"lenght": "4","name": "Тип документа","shortname": "Тип документа","searchable": true,"sortable": true + } + , + {"code": "docnm_ref", + "type": 2,"length": 16,"name": "Ссылочный номер документа у отправителя","shortname": "Номер документа у отправителя","searchable": true,"sortable": true + } + , + {"code": "docnmprev", + "type": 2,"length": 16,"name": "Ссылка на предшестввующий документ","shortname": "Предшествующий документ","searchable": true,"sortable": true + } + , + {"code": "priority", + "type": 2,"length": 1,"name": "Приоритет скорости отправления сообщения","shortname": "Приоритет отправки","searchable": true,"sortable": true + } + , + {"code": "sbankcode", + "type": 2,"length": 12,"name": "Код банка-плательщика","shortname": "Банк-плательщик","searchable": true,"sortable": true + } + , + {"code": "c_acc_deb", + "type": 2,"length": 35,"name": "Счет по дебету","shortname": "Счет по дебету","searchable": true,"sortable": true + } + , + {"code": "sbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-плательщика","shortname": "Наименование банка-плательщика","searchable": true,"sortable": true + } + , + {"code": "sbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbankcode", + "type": 2,"length": 12,"name": "Код банка-получателя","shortname": "Код банка-получателя","searchable": true,"sortable": true + } + , + {"code": "c_acc_cred", + "type": 2,"length": 35,"name": "Счет по кредиту","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-получателя","shortname": "Наименование банка-получателя","searchable": true,"sortable": true + } + , + {"code": "rbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "pay_date", + "type": 2,"lenght": "8","name": "Платеж-дата","shortname": "Платеж-дата","searchable": true,"sortable": true + } + , + {"code": "ext_date", + "type": 2,"lenght": "8","name": "Дата по выписке","shortname": "Дата по выписке","searchable": true,"sortable": true + } + , + {"code": "pay_val", + "type": 2,"length": 12,"name": "Валюта платежа","shortname": "Валюта","searchable": true,"sortable": true + } + , + {"code": "sum_deb", + "type": 2,"lenght": "22","name": "Сумма дебет ","shortname": "Сумма дебет","searchable": true,"sortable": true + } + , + {"code": "sclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-плательщика","shortname": "Наименование клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "sclientn2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sclientn3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sc_code", + "type": 2,"length": 12,"name": "Код клиента-плательщика","shortname": "Код клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "acc_deb", + "type": 2,"length": 35,"name": "Счет клиента-плательщика(дебет)","shortname": "Счет клиента-плательщика(дебет)","searchable": true,"sortable": true + } + , + {"code": "rclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-получателя","shortname": "Наименование клиента-получателя","searchable": true,"sortable": true + } + , + {"code": "rclientn2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rclientn3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "acc_kr_1", + "type": 2,"length": 35,"name": "Счет кредит","shortname": "Счет кредит","searchable": true,"sortable": true + } + , + {"code": "acc_kr_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sp_code", + "type": 2,"length": 2,"name": "Код назначения платежа","shortname": "Код назначения платежа","searchable": true,"sortable": true + } + , + {"code": "specif_1", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_6", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "send_type", + "type": 2,"length": 10,"name": "Тип отправления плат. поручения","shortname": "Тип отправления плат. поручения","searchable": true,"sortable": true + } + , + {"code": "servdate", + "type": 2,"length": 8,"name": "Дата получения товара, оказания услуг в плат. поручении","shortname": "Дата получения товара","searchable": true,"sortable": true + } + , + {"code": "doc_result", + "type": 2,"length": 2,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "imp_result", + "type": 2,"length": 3,"name": "Результат приема","shortname": "Результат приема","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf04": { + + "name": "ДФ-04 Подтверждение переводов из Расчетной организации для СПВБ", + + "class": "ru.clearing.classes.statics.data.sdf.SDf04", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "seg_type", + "type": 2,"length": 1,"name": "Код инициатора в КС","shortname": "Инициатор в КС","searchable": true,"sortable": true + } + , + {"code": "doc_type", + "type": 2,"lenght": "4","name": "Тип документа","shortname": "Тип документа","searchable": true,"sortable": true + } + , + {"code": "docnm_ref", + "type": 2,"length": 16,"name": "Ссылочный номер документа у отправителя","shortname": "Номер документа у отправителя","searchable": true,"sortable": true + } + , + {"code": "docnmprev", + "type": 2,"length": 16,"name": "Ссылка на предшестввующий документ","shortname": "Предшествующий документ","searchable": true,"sortable": true + } + , + {"code": "priority", + "type": 2,"length": 1,"name": "Приоритет скорости отправления сообщения","shortname": "Приоритет отправки","searchable": true,"sortable": true + } + , + {"code": "sbankcode", + "type": 2,"length": 12,"name": "Код банка-плательщика","shortname": "Банк-плательщик","searchable": true,"sortable": true + } + , + {"code": "c_acc_deb", + "type": 2,"length": 35,"name": "Счет по дебету","shortname": "Счет по дебету","searchable": true,"sortable": true + } + , + {"code": "sbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-плательщика","shortname": "Наименование банка-плательщика","searchable": true,"sortable": true + } + , + {"code": "sbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbankcode", + "type": 2,"length": 12,"name": "Код банка-получателя","shortname": "Код банка-получателя","searchable": true,"sortable": true + } + , + {"code": "c_acc_cred", + "type": 2,"length": 35,"name": "Счет по кредиту","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-получателя","shortname": "Наименование банка-получателя","searchable": true,"sortable": true + } + , + {"code": "rbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "pay_date", + "type": 2,"lenght": "8","name": "Платеж-дата","shortname": "Платеж-дата","searchable": true,"sortable": true + } + , + {"code": "ext_date", + "type": 2,"lenght": "8","name": "Дата по выписке","shortname": "Дата по выписке","searchable": true,"sortable": true + } + , + {"code": "pay_val", + "type": 2,"length": 12,"name": "Валюта платежа","shortname": "Валюта","searchable": true,"sortable": true + } + , + {"code": "sum_deb", + "type": 2,"lenght": "22","name": "Сумма дебет ","shortname": "Сумма дебет","searchable": true,"sortable": true + } + , + {"code": "sclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-плательщика","shortname": "Наименование клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "sclientn2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sclientn3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sc_code", + "type": 2,"length": 12,"name": "Код клиента-плательщика","shortname": "Код клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "acc_deb", + "type": 2,"length": 35,"name": "Счет клиента-плательщика(дебет)","shortname": "Счет клиента-плательщика(дебет)","searchable": true,"sortable": true + } + , + {"code": "rclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-получателя","shortname": "Наименование клиента-получателя","searchable": true,"sortable": true + } + , + {"code": "rclientn2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rclientn3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "acc_kr_1", + "type": 2,"length": 35,"name": "Счет кредит","shortname": "Счет кредит","searchable": true,"sortable": true + } + , + {"code": "acc_kr_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sp_code", + "type": 2,"length": 2,"name": "Код назначения платежа","shortname": "Код назначения платежа","searchable": true,"sortable": true + } + , + {"code": "specif_1", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_6", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "send_type", + "type": 2,"length": 10,"name": "Тип отправления плат. поручения","shortname": "Тип отправления плат. поручения","searchable": true,"sortable": true + } + , + {"code": "servdate", + "type": 2,"length": 8,"name": "Дата получения товара, оказания услуг в плат. поручении","shortname": "Дата получения товара","searchable": true,"sortable": true + } + , + {"code": "doc_result", + "type": 2,"length": 2,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "imp_result", + "type": 2,"length": 3,"name": "Результат приема","shortname": "Результат приема","searchable": true,"sortable": true + } + , + {"code": "fileName", + "field": "file_name","type": 2,"length": 255,"name": "Наименование входящего файла","shortname": "Наименование файла","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время обработки файла","shortname": "Дата и время обработки","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf05": { + + "name": "ДФ-05 Уведомление о завершении расчетов в ПРЦ", + + "class": "ru.clearing.classes.statics.data.sdf.SDf05", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "tp", + "type": 10,"name": "Тип документа","shortname": "Тип документа","searchable": true,"sortable": true + } + , + {"code": "dt", + "type": 6,"name": "Дата завершения расчетов","shortname": "Дата завершения расчетов","searchable": true,"sortable": true + } + , + {"code": "tm", + "type": 5,"name": "Время завершения расчетов","shortname": "Время завершения расчетов","searchable": true,"sortable": true + } + , + {"code": "pr", + "type": 2,"length": 1,"name": "Результат обработки запроса","shortname": "Результат обработки запроса","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf08": { + + "name": "ДФ-08 Запрос остатков по всем счетам", + + "class": "ru.clearing.classes.statics.data.sdf.SDf08", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "number", + "type": 10,"name": "Номер запроса остатков по счетам","shortname": "Номер запроса","searchable": true,"sortable": true,"visible": true,"link": "currency" + } + , + {"code": "datetime", + "type": 4,"name": "Дата и время сообщения","shortname": "Дата и время сообщения","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf09": { + + "name": "ДФ-09 Уведомление о поступлении средств на клиринговый счет", + + "class": "ru.clearing.classes.statics.data.sdf.SDf09", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 20,"name": "Номер счета участника торгов","shortname": "Номер счета участника торгов","searchable": true,"sortable": true + } + , + {"code": "sum", + "type": 10,"name": "Сумма платежного документа (операции)","shortname": "Сумма платежного документа","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 2,"length": 1,"name": "Код сегмента рынка","shortname": "Код сегмента рынка","searchable": true,"sortable": true + } + , + {"code": "type", + "type": 2,"length": 1,"name": "Код типа платежного документа (операции)","shortname": "Код типа платежного документа","searchable": true,"sortable": true + } + , + {"code": "number", + "type": 10,"name": "Номер платежного документа (операции)","shortname": "Номер запроса","searchable": true,"sortable": true + } + , + {"code": "INN", + "field": "inn","type": 10,"name": "ИНН","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "fileName", + "type": 2,"length": 255,"name": "Наименование входящего файла","shortname": "Наименование файла","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время обработки файла","shortname": "Дата и время обработки","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf10": { + + "name": "ДФ-10 Подтверждение о загрузке по поступлению на клиринговый счет", + + "class": "ru.clearing.classes.statics.data.sdf.SDf10", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 20,"name": "Номер счета участника торгов","shortname": "Номер счета участника торгов","searchable": true,"sortable": true + } + , + {"code": "sum", + "type": 10,"name": "Сумма платежного документа (операции)","shortname": "Сумма платежного документа","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 2,"length": 1,"name": "Код сегмента рынка","shortname": "Код сегмента рынка","searchable": true,"sortable": true + } + , + {"code": "type", + "type": 2,"length": 1,"name": "Код типа платежного документа (операции)","shortname": "Код типа платежного документа","searchable": true,"sortable": true + } + , + {"code": "number", + "type": 10,"name": "Номер платежного документа (операции)","shortname": "Номер запроса","searchable": true,"sortable": true + } + , + {"code": "INN", + "type": 10,"name": "ИНН","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "result", + "type": 2,"length": 3,"name": "Результат приема","shortname": "Результат приема","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + , + {"code": "inSDf09Id", + "type": 1,"name": "Идентификатор соответствующей записи из таблицы-источника","shortname": "Входящая запись","searchable": true,"sortable": true + } + ] + + } + , + "sDf11": { + + "name": "ДФ-11 Из КС в ПРЦ Платежное распоряжение на перевод средств с ТБС Участника на КС Инициатора", + + "class": "ru.clearing.classes.statics.data.sdf.SDf11", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "seg_type", + "type": 2,"length": 1,"name": "Код инициатора в КС","shortname": "Инициатор в КС","searchable": true,"sortable": true + } + , + {"code": "doc_type", + "type": 2,"lenght": "4","name": "Тип документа","shortname": "Тип документа","searchable": true,"sortable": true + } + , + {"code": "docnm_ref", + "type": 2,"length": 16,"name": "Ссылочный номер документа у отправителя","shortname": "Номер документа у отправителя","searchable": true,"sortable": true + } + , + {"code": "docnmprev", + "type": 2,"length": 16,"name": "Ссылка на предшестввующий документ","shortname": "Предшествующий документ","searchable": true,"sortable": true + } + , + {"code": "priority", + "type": 2,"length": 1,"name": "Приоритет скорости отправления сообщения","shortname": "Приоритет отправки","searchable": true,"sortable": true + } + , + {"code": "sbankcode", + "type": 2,"length": 12,"name": "Код банка-плательщика","shortname": "Банк-плательщик","searchable": true,"sortable": true + } + , + {"code": "c_acc_deb", + "type": 2,"length": 35,"name": "Счет по дебету","shortname": "Счет по дебету","searchable": true,"sortable": true + } + , + {"code": "sbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-плательщика","shortname": "Наименование банка-плательщика","searchable": true,"sortable": true + } + , + {"code": "sbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbankcode", + "type": 2,"length": 12,"name": "Код банка-получателя","shortname": "Код банка-получателя","searchable": true,"sortable": true + } + , + {"code": "c_acc_cred", + "type": 2,"length": 35,"name": "Счет по кредиту","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-получателя","shortname": "Наименование банка-получателя","searchable": true,"sortable": true + } + , + {"code": "rbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "pay_date", + "type": 2,"lenght": "8","name": "Платеж-дата","shortname": "Платеж-дата","searchable": true,"sortable": true + } + , + {"code": "ext_date", + "type": 2,"lenght": "8","name": "Дата по выписке","shortname": "Дата по выписке","searchable": true,"sortable": true + } + , + {"code": "pay_val", + "type": 2,"length": 12,"name": "Валюта платежа","shortname": "Валюта","searchable": true,"sortable": true + } + , + {"code": "sum_deb", + "type": 2,"lenght": "22","name": "Сумма дебет ","shortname": "Сумма дебет","searchable": true,"sortable": true + } + , + {"code": "sclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-плательщика","shortname": "Наименование клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "sclientn2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sclientn3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sc_code", + "type": 2,"length": 12,"name": "Код клиента-плательщика","shortname": "Код клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "acc_deb", + "type": 2,"length": 35,"name": "Счет клиента-плательщика(дебет)","shortname": "Счет клиента-плательщика(дебет)","searchable": true,"sortable": true + } + , + {"code": "rclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-получателя","shortname": "Наименование клиента-получателя","searchable": true,"sortable": true + } + , + {"code": "rclientn2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rclientn3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "acc_kr_1", + "type": 2,"length": 35,"name": "Счет кредит","shortname": "Счет кредит","searchable": true,"sortable": true + } + , + {"code": "acc_kr_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sp_code", + "type": 2,"length": 2,"name": "Код назначения платежа","shortname": "Код назначения платежа","searchable": true,"sortable": true + } + , + {"code": "specif_1", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "specif_6", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "send_type", + "type": 2,"length": 10,"name": "Тип отправления плат. поручения","shortname": "Тип отправления плат. поручения","searchable": true,"sortable": true + } + , + {"code": "servdate", + "type": 2,"length": 8,"name": "Дата получения товара, оказания услуг в плат. поручении","shortname": "Дата получения товара","searchable": true,"sortable": true + } + , + {"code": "doc_result", + "type": 2,"length": 2,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf12": { + + "name": "ДФ-12 Из ПРЦ в КС Информация о блокировке/разблокировке/закрытии ТБС УК", + + "class": "ru.clearing.classes.statics.data.sdf.SDf12", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 25,"name": "Код счета участника клиринга","shortname": "Код счета УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "deal", + "type": 2,"length": 4,"name": "Биржевой код участника клиринга","shortname": "Биржевой код УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "status", + "type": 3,"name": "Статус счета","shortname": "Статус","searchable": true,"sortable": true,"visible": true + } + , + {"code": "fileName", + "type": 2,"length": 255,"name": "Наименование входящего файла","shortname": "Наименование файла","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время обработки файла","shortname": "Дата и время обработки","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf13": { + + "name": "ДФ-13 Вывод свободных средств для инициаторов категории В с клирингового счета 30414/7 - платежное поручение АО СПВБ на вывод средств из РО", + + "class": "ru.clearing.classes.statics.data.sdf.SDf13", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "seg_type", + "type": 2,"length": 1,"name": "Код инициатора в КС","shortname": "Инициатор в КС","searchable": true,"sortable": true + } + , + {"code": "doc_type", + "type": 2,"lenght": "4","name": "Тип документа","shortname": "Тип документа","searchable": true,"sortable": true + } + , + {"code": "docnm_ref", + "type": 2,"length": 16,"name": "Ссылочный номер документа у отправителя","shortname": "Номер документа у отправителя","searchable": true,"sortable": true + } + , + {"code": "docnmprev", + "type": 2,"length": 16,"name": "Ссылка на предшестввующий документ","shortname": "Предшествующий документ","searchable": true,"sortable": true + } + , + {"code": "priority", + "type": 2,"length": 1,"name": "Приоритет скорости отправления сообщения","shortname": "Приоритет отправки","searchable": true,"sortable": true + } + , + {"code": "sbankcode", + "type": 2,"length": 12,"name": "Код банка-плательщика","shortname": "Банк-плательщик","searchable": true,"sortable": true + } + , + {"code": "c_acc_deb", + "type": 2,"length": 35,"name": "Кор счет банка - плательщика в системе - акт.","shortname": "Кор счет банка - плательщика","searchable": true,"sortable": true + } + , + {"code": "sbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-плательщика","shortname": "Наименование банка-плательщика","searchable": true,"sortable": true + } + , + {"code": "sbanknam2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam3", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbankcode", + "type": 2,"length": 12,"name": "Код банка-получателя","shortname": "Код банка-получателя","searchable": true,"sortable": true + } + , + {"code": "c_acc_cred", + "type": 2,"length": 35,"name": "Кор счет банка - получателя в системе - акт. ","shortname": "Кор счет банка - получателя","searchable": true,"sortable": true + } + , + {"code": "rbanknam1", + "type": 2,"length": 35,"name": "Наименование банка-получателя","shortname": "Наименование банка-получателя","searchable": true,"sortable": true + } + , + {"code": "op_type", + "type": 2,"length": 2,"name": "Вид операции","shortname": "Вид операции","searchable": true,"sortable": true + } + , + {"code": "op_order", + "type": 2,"length": 1,"name": "Очередность платежа","shortname": "Очередность платежа","searchable": true,"sortable": true + } + , + {"code": "rbanknam4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "rbanknam5", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "pay_date", + "type": 2,"lenght": "8","name": "Платеж-дата","shortname": "Платеж-дата","searchable": true,"sortable": true + } + , + {"code": "ext_date", + "type": 2,"lenght": "8","name": "Дата по выписке","shortname": "Дата по выписке","searchable": true,"sortable": true + } + , + {"code": "pay_val", + "type": 2,"length": 12,"name": "Валюта платежа","shortname": "Валюта","searchable": true,"sortable": true + } + , + {"code": "sum_deb", + "type": 2,"lenght": "22","name": "Сумма дебет ","shortname": "Сумма дебет","searchable": true,"sortable": true + } + , + {"code": "sclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-плательщика","shortname": "Наименование клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "inn_deb", + "type": 2,"length": 12,"name": "ИНН клиента-плательщика","shortname": "ИНН клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "kpp_deb", + "type": 2,"length": 9,"name": "КПП клиента-плательщика","shortname": "КПП клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "sclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sc_code", + "type": 2,"length": 12,"name": "Код клиента-плательщика","shortname": "Код клиента-плательщика","searchable": true,"sortable": true + } + , + {"code": "acc_deb", + "type": 2,"length": 35,"name": "Счет клиента-плательщика(дебет)","shortname": "Счет клиента-плательщика(дебет)","searchable": true,"sortable": true + } + , + {"code": "rclientn1", + "type": 2,"length": 35,"name": "Наименование клиента-получателя","shortname": "Наименование клиента-получателя","searchable": true,"sortable": true + } + , + {"code": "inn_cred", + "type": 2,"length": 12,"name": "ИНН клиента-получателя","shortname": "ИНН клиента-получателя","searchable": true,"sortable": true + } + , + {"code": "kpp_cred", + "type": 2,"length": 9,"name": "КПП клиента-получателя","shortname": "КПП клиента-получателя","searchable": true,"sortable": true + } + , + {"code": "rclientn4", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "acc_kr_1", + "type": 2,"length": 35,"name": "Счет получателя","shortname": "Счет получателя","searchable": true,"sortable": true + } + , + {"code": "acc_kr_2", + "type": 2,"length": 35,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "sp_code", + "type": 2,"length": 2,"name": "Код назначения платежа","shortname": "Код назначения платежа","searchable": true,"sortable": true + } + , + {"code": "specif_1", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_2", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_3", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_4", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_5", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "specif_6", + "type": 2,"length": 35,"name": "Назначение платежа","shortname": "Назначение платежа","searchable": true,"sortable": true + } + , + {"code": "send_type", + "type": 2,"length": 10,"name": "Вид платежа","shortname": "Вид платежа","searchable": true,"sortable": true + } + , + {"code": "servdate", + "type": 2,"length": 8,"name": "Дата получения товара, оказания услуг в плат. поручении","shortname": "Дата получения товара","searchable": true,"sortable": true + } + , + {"code": "doc_result", + "type": 2,"length": 2,"name": "","shortname": "","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf16": { + + "name": "ДФ-16 Формат запроса по возврату депозита или дозачисление/списание денежных средств", + + "class": "ru.clearing.classes.statics.data.sdf.SDf16", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 20,"name": "Номер счета участника торгов","shortname": "Номер счета участника торгов","searchable": true,"sortable": true + } + , + {"code": "sum", + "type": 10,"name": "Сумма платежного документа (операции)","shortname": "Сумма платежного документа","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 2,"length": 1,"name": "Код сегмента рынка","shortname": "Код сегмента рынка","searchable": true,"sortable": true + } + , + {"code": "type", + "type": 2,"length": 1,"name": "Код типа платежного документа (операции)","shortname": "Код типа платежного документа","searchable": true,"sortable": true + } + , + {"code": "INN", + "field": "inn","type": 10,"name": "ИНН","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "BIC", + "field": "bic","type": 10,"name": "БИК","shortname": "БИК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "SPEC", + "field": "spec","type": 2,"length": 255,"name": "Назначение","shortname": "Назначение","searchable": true,"sortable": true + } + , + {"code": "number", + "type": 10,"name": "Номер платежного документа (операции)","shortname": "Номер платежного документа","searchable": true,"sortable": true + } + , + {"code": "fileName", + "type": 2,"length": 255,"name": "Наименование входящего файла","shortname": "Наименование файла","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время обработки файла","shortname": "Дата и время обработки","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + ] + + } + , + "sDf17": { + + "name": "ДФ-17 Формат ответа на запрос по возврату депозита или дозачисление/списание денежных средств", + + "class": "ru.clearing.classes.statics.data.sdf.SDf17", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 20,"name": "Номер счета участника торгов","shortname": "Номер счета участника торгов","searchable": true,"sortable": true + } + , + {"code": "sum", + "type": 10,"name": "Сумма платежного документа (операции)","shortname": "Сумма платежного документа","searchable": true,"sortable": true + } + , + {"code": "market", + "type": 2,"length": 1,"name": "Код сегмента рынка","shortname": "Код сегмента рынка","searchable": true,"sortable": true + } + , + {"code": "type", + "type": 2,"length": 1,"name": "Код типа платежного документа (операции)","shortname": "Код типа платежного документа","searchable": true,"sortable": true + } + , + {"code": "INN", + "type": 10,"name": "ИНН","shortname": "ИНН","searchable": true,"sortable": true,"visible": true + } + , + {"code": "BIC", + "type": 10,"name": "БИК","shortname": "БИК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "SPEC", + "type": 2,"length": 255,"name": "Назначение","shortname": "Назначение","searchable": true,"sortable": true + } + , + {"code": "number", + "type": 10,"name": "Номер платежного документа (операции)","shortname": "Номер платежного документа","searchable": true,"sortable": true + } + , + {"code": "result", + "type": 10,"name": "Код завершения операции","shortname": "Код завершения операции","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + , + {"code": "inSDf16Id", + "type": 1,"name": "Идентификатор соответствующей записи из таблицы-источника","shortname": "Входящая запись","searchable": true,"sortable": true + } + ] + + } + , + "sDf18": { + + "name": "ДФ-18 Из КС в ПРЦ Квитанция о получении информации о состоянии счета (блокировка/разблокировка/закрытие)", + + "class": "ru.clearing.classes.statics.data.sdf.SDf18", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "account", + "type": 2,"length": 25,"name": "Код счета участника клиринга","shortname": "Код счета УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "deal", + "type": 2,"length": 4,"name": "Биржевой код участника клиринга","shortname": "Биржевой код УК","searchable": true,"sortable": true,"visible": true + } + , + {"code": "status", + "type": 3,"name": "Статус счета","shortname": "Статус","searchable": true,"sortable": true,"visible": true + } + , + {"code": "result", + "type": 10,"name": "Код завершения операции","shortname": "Код завершения операции","searchable": true,"sortable": true + } + , + {"code": "generationTime", + "type": 4,"name": "Дата и время создания записи","shortname": "Дата и время создания","searchable": true,"sortable": true + } + , + {"code": "generationId", + "type": 1,"name": "Идентификатор взаимодействия","shortname": "ID взаимодействия","searchable": true,"sortable": true + } + , + {"code": "inSDf12Id", + "type": 1,"name": "Идентификатор соответствующей записи из таблицы-источника","shortname": "Входящая запись","searchable": true,"sortable": true + } + ] + + } + , + "s_trade": { + + "name": "Сделки из Торговой системы", + + "class": "com.spicex.Static.", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "trade_num", + "type": 1,"name": "Номер сделки","shortname": "Номер сделки","searchable": true,"sortable": true + } + , + {"code": "sec_code", + "type": 2,"length": 255,"name": "Код ценной бумаги","shortname": "Код ценной бумаги","searchable": true,"sortable": true + } + , + {"code": "trade_date_time", + "type": 4,"name": "Дата-время сделки","shortname": "Дата-время сделки","searchable": true,"sortable": true + } + , + {"code": "settle_date", + "type": 6,"name": "Плановая дата исполнения сделки","shortname": "Плановая дата исполнения сделки","searchable": true,"sortable": true + } + , + {"code": "price", + "type": 10,"name": "Цена сделки","shortname": "Цена сделки","searchable": true,"sortable": true + } + , + {"code": "value", + "type": 11,"name": "Сумма сделки","shortname": "Сумма сделки","searchable": true,"sortable": true + } + , + {"code": "qty", + "type": 11,"name": "Количество лотов по сделке","shortname": "Количество лотов по сделке","searchable": true,"sortable": true + } + , + {"code": "accruedint", + "type": 10,"name": "НКД за 1 ценную бумагу","shortname": "НКД за 1 ценную бумагу","searchable": true,"sortable": true + } + , + {"code": "firm_id", + "type": 2,"length": 255,"name": "ID клиента в КС","shortname": "ID клиента в КС","searchable": true,"sortable": true + } + , + {"code": "client_code", + "type": 2,"length": 255,"name": "Код участника торгов = Код участника клиринга = Код участника расчетов","shortname": "Участник","searchable": true,"sortable": true + } + , + {"code": "exchange_commission", + "type": 11,"name": "Комиссия по сделке","shortname": "Комиссия","searchable": true,"sortable": true + } + , + {"code": "class_code", + "type": 2,"length": 255,"name": "Код класса сделки из новой ТС","shortname": "Код класса сделки","searchable": true,"sortable": true + } + , + {"code": "operation", + "type": 2,"length": 255,"name": "Тип плеча (Купля/Продажа)","shortname": "Тип плеча","searchable": true,"sortable": true + } + , + {"code": "issue_account", + "type": 2,"length": 50,"name": "Счет для учета ценной бумаги","shortname": "Счет для учета ценной бумаги","searchable": true,"sortable": true + } + , + {"code": "money_account", + "type": 2,"length": 50,"name": "Счет для учета денежных средств","shortname": "Счет для учета денежных средств","searchable": true,"sortable": true + } + , + {"code": "trade_type", + "type": 2,"length": 50,"name": "Первичное размещение/торги","shortname": "Первичное размещение/торги","searchable": true,"sortable": true + } + , + {"code": "days_to_mat_date", + "type": 1,"name": "Количество дней до погашения","shortname": "Количество дней до погашения","searchable": true,"sortable": true + } + , + {"code": "collateral", + "type": 2,"length": 50,"name": "Признак залога (не используется)","shortname": "Признак залога (не используется)","searchable": true,"sortable": true + } + , + {"code": "settle_code", + "type": 2,"length": 50,"name": "Код периода сделки из новой ТС","shortname": "Код периода сделки из новой ТС","searchable": true,"sortable": true + } + ] + + } + , + "notification": { + + "name": "Сообщения", + + "class": "ru.clearing.classes.statics.data.misc.Notification", + + "logUpdates": "true", + + "table": "Notification", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "senderId", + "type": 1,"name": "Идентификатор участника отправителя","shortname": "Отправитель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "addresseeId", + "type": 1,"name": "Идентификатор участника получателя","shortname": "Получатель","searchable": true,"sortable": true,"link": "company" + } + , + {"code": "objectType", + "type": 12,"name": "Тип объекта","shortname": "Объект","searchable": true,"sortable": true,"link": "objectType" + } + , + {"code": "objectId", + "type": 4,"name": "Идентификатор объекта","shortname": "ID объекта","searchable": true,"sortable": true + } + , + {"code": "notificationStatus", + "type": 12,"name": "Статус сообщения","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "notificationStatus" + } + ] + ,"actions":[ + {"method":"put", + + "name": "Подтверждение/Отклонение операции дозачисления/списания", + + "destination": "", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","link": "company","linkCode": "id","required": true + } + , + {"code": "notificationStatus", + "type": 12,"name": "Статус сообщения","shortname": "Статус","link": "notificationStatus","required": true + } + ] + } + ] + } + , + "session": { + + "name": "Клиринговая сессия", + + "class": "ru.clearing.classes.statics.data.misc.Session", + + "logUpdates": "true", + + "table": "Session", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "createdAt", + "field": "created","type": 4,"name": "Дата и время создания записи","shortname": "Создано","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "updatedAt", + "field": "updated","type": 4,"name": "Дата и время изменения записи","shortname": "Изменено","searchable": true,"sortable": true,"ignore": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": true,"sortable": true,"visible": true + } + , + {"code": "sessionStatus", + "type": 12,"name": "Статус клиринговой сессии","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "sessionStatus" + } + ] + + } + , + "moneyMarketSession": { + + "name": "Сессия денежного рынка", + + "class": "com.spicex.TransactionData.Session", + + "logUpdates": "true", + + "table": "Session", + + "fields": [ + {"code": "id", + "type": 1,"name": "Идентификатор записи","shortname": "ID","searchable": true,"sortable": true + } + , + {"code": "clearingDate", + "type": 6,"name": "Дата","shortname": "Дата","searchable": true,"sortable": true,"visible": true,"extends": "session" + } + , + {"code": "sessionStatus", + "type": 12,"name": "Статус клиринговой сессии","shortname": "Статус","searchable": true,"sortable": true,"visible": true,"link": "sessionStatus","extends": "session" + } + , + {"code": "companyId", + "type": 1,"name": "Идентификатор инициатора торгов","shortname": "Инициатор","visible": false,"searchable": true,"sortable": true,"link": "company" + } + , + {"code": "securityId", + "type": 1,"name": "Идентификатор инструмента","shortname": "Инструмент","searchable": false,"sortable": true,"visible": true,"link": "security" + } + , + {"code": "userId", + "type": 1,"name": "Идентификатор пользователя","shortname": "Пользователь","searchable": true,"sortable": true,"visible": true,"link": "userCls" + } + ] + + } + + } + + ,"views": { + + } + + ,"types": [ + + { + "code": "identity", + + "id": "1" + , + "name": "Идентификатор" + , + "type": "bigint" + , + "javatype": "Long" + + } + , + { + "code": "string", + + "id": "2" + , + "name": "Строка" + , + "type": "varchar" + , + "javatype": "String" + + } + , + { + "code": "long", + + "id": "3" + , + "name": "Целый" + , + "type": "bigint" + , + "javatype": "Long" + + } + , + { + "code": "dateTime", + + "id": "4" + , + "name": "Дата и время" + , + "type": "timestamp" + , + "javatype": "Instant" + + } + , + { + "code": "time", + + "id": "5" + , + "name": "Время" + , + "type": "time" + , + "javatype": "Instant" + + } + , + { + "code": "date", + + "id": "6" + , + "name": "Дата" + , + "type": "date" + , + "javatype": "Instant" + + } + , + { + "code": "array", + + "id": "7" + , + "name": "Массив" + , + "type": "json" + , + "javatype": "String" + + } + , + { + "code": "object", + + "id": "8" + , + "name": "Объект" + , + "type": "jsonb" + , + "javatype": "String" + + } + , + { + "code": "boolean", + + "id": "9" + , + "name": "Булевый" + , + "type": "boolean" + , + "javatype": "Boolean" + + } + , + { + "code": "double", + + "id": "10" + , + "name": "Число с точкой" + , + "type": "numeric(72,18)" + , + "javatype": "BigDecimal" + + } + , + { + "code": "amount", + + "id": "11" + , + "name": "Объем из числа с точкой" + , + "type": "numeric(72,2)" + , + "javatype": "BigDecimal" + + } + , + { + "code": "code", + + "id": "12" + , + "name": "Код 4 символа" + , + "type": "char(4)" + , + "javatype": "String" + + } + + ] + + } + \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java deleted file mode 100644 index 4b941266d..000000000 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package ru.spcex.clearing.backendapi.controller.queue; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.ResultActions; -import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.filter.CharacterEncodingFilter; -import ru.spcex.clearing.backendapi.config.WebConfig; -import ru.spcex.clearing.backendapi.controller.queue.company.DeleteCompanyController; -import ru.spcex.clearing.backendapi.controller.queue.config.*; - -import javax.annotation.PostConstruct; -import java.util.concurrent.atomic.AtomicLong; - - -@SpringJUnitWebConfig(classes = { - WebConfig.class, - IOperator.class, - StateLoaderImplConfig.class, - DeleteCompanyController.class, - BankAccountControllerConfig.class, - KafkaConfig.class, - HazelcastServiceTestConfiguration.class, - Jackson2HttpConverterConfig.class}) -public abstract class AbstractControllerTest { - protected static final AtomicLong currentId = new AtomicLong(); - private static final CharacterEncodingFilter CHARACTER_ENCODING_FILTER = new CharacterEncodingFilter(); - - static { - CHARACTER_ENCODING_FILTER.setEncoding("UTF-8"); - CHARACTER_ENCODING_FILTER.setForceEncoding(true); - } - - private MockMvc mockMvc; - - @Autowired - private WebApplicationContext webApplicationContext; - - @PostConstruct - private void postConstruct() { - mockMvc = MockMvcBuilders - .webAppContextSetup(webApplicationContext) - .addFilter(CHARACTER_ENCODING_FILTER) -// .apply(springSecurity()) - .build(); - } - - protected ResultActions perform(MockHttpServletRequestBuilder builder) throws Exception { - return mockMvc.perform(builder); - } -} diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java deleted file mode 100644 index 1673abc9d..000000000 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java +++ /dev/null @@ -1,40 +0,0 @@ -package ru.spcex.clearing.backendapi.controller.queue.company; - -import org.junit.jupiter.api.Test; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; -import ru.spcex.clearing.backendapi.controller.queue.AbstractControllerTest; -import ru.spcex.clearing.backendapi.controller.response.cud.CudResponse; -import ru.spcex.clearing.backendapi.controller.response.cud.QueueSuccessResponse; -import ru.spcex.clearing.platform.messaging.domain.ActionType; - -import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; -import static ru.spcex.clearing.backendapi.controller.queue.utils.JsonUtil.writeValue; - -class DeleteCompanyControllerTest extends AbstractControllerTest { - private static final String REST_URL = "/companies/"; - - /** - * {@link DeleteCompanyController#delete(Long)}
- * Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.
- * Входной запрос {@link Long}: - 0L
- */ - @Test - void delete() throws Exception { - //ARRANGE - CudResponse extended = new CudResponse(); - extended.setCode(0L); - extended.setMessage("success"); - extended.setPayload(new QueueSuccessResponse(ActionType.DELETE, currentId.getAndIncrement())); - //ACT - perform(MockMvcRequestBuilders.delete(REST_URL + "0") - .contentType(MediaType.APPLICATION_JSON)) - .andDo(print())//output to the log request and response -// ASSERT - .andExpect(status().isOk()) - .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().json(writeValue(extended))); - } -} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java deleted file mode 100644 index 02d79864d..000000000 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import ru.spcex.clearing.backendapi.controller.queue.account.BankAccountController; -import ru.spcex.clearing.backendapi.service.IOperator; -import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; - - -@Configuration -public class BankAccountControllerConfig { - - @Autowired - - @Qualifier("iOperator") - private IOperator operator; - - @Autowired - @Qualifier("stateLoaderImpl") - private StateLoaderImpl stateLoader; - - @Bean - public BankAccountController createBankAccountController() { - return new BankAccountController(operator, stateLoader); - } -} diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java deleted file mode 100644 index 5a5aab4c0..000000000 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import ru.spcex.clearing.backendapi.controller.queue.company.DeleteCompanyController; -import ru.spcex.clearing.backendapi.service.IOperator; -import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; - -@Configuration -public class DeleteCompanyControllerConfig { - @Autowired - @Qualifier("iOperator") - private IOperator operator; - - @Autowired - @Qualifier("stateLoaderImpl") - private StateLoaderImpl stateLoader; - - @Bean - public DeleteCompanyController createDeleteCompanyController() { - return new DeleteCompanyController(operator, stateLoader); - } -} diff --git a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java deleted file mode 100644 index b566a6bbc..000000000 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java +++ /dev/null @@ -1,22 +0,0 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; -import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; - -@Configuration -public class StateLoaderImplConfig { - - @Autowired - @Qualifier("hazelcastServiceTest") - private HazelcastService hazelcastServiceTest; - - - @Bean(name = "stateLoaderImpl") - public StateLoaderImpl createIOperator() { - return new StateLoaderImpl(hazelcastServiceTest); - } -} diff --git a/clearing-parent/balance-service/pom.xml b/clearing-parent/balance-service/pom.xml index d49af4c57..f4d1145bb 100644 --- a/clearing-parent/balance-service/pom.xml +++ b/clearing-parent/balance-service/pom.xml @@ -56,6 +56,16 @@ assertj-core test + + org.springframework.boot + spring-boot-test + test + + + org.mockito + mockito-core + test + diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/BalanceImdgTestConfig.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/ImdgTestConfig.java similarity index 96% rename from clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/BalanceImdgTestConfig.java rename to clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/ImdgTestConfig.java index 6b8a4e34c..c629b65d7 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/BalanceImdgTestConfig.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/ImdgTestConfig.java @@ -17,7 +17,7 @@ import java.util.List; import java.util.Random; @Configuration -public class BalanceImdgTestConfig { +public class ImdgTestConfig { private HazelcastInstance hazelcastInstance; @@ -57,7 +57,7 @@ public class BalanceImdgTestConfig { joinConfig.setTcpIpConfig(new TcpIpConfig().setEnabled(true).setMembers(List.of("127.0.0.1"))); networkConfig.setJoin(joinConfig); cfg.setNetworkConfig(networkConfig); - hazelcastInstance = Hazelcast.newHazelcastInstance(cfg); + hazelcastInstance = Hazelcast.getOrCreateHazelcastInstance(cfg); HazelcastHelper.otcSystem_setStorageState(true, hazelcastInstance); return new HazelcastService(taskExecutorHazelcastClientInitializer, taskExecutorIdGeneratorAwaiter, params); } diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/KafkaTestConfig.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/KafkaTestConfig.java index 962b45615..fd239bc0a 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/KafkaTestConfig.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/config/KafkaTestConfig.java @@ -2,14 +2,13 @@ package ru.spcex.clearing.balance.config; import org.apache.kafka.clients.consumer.MockConsumer; import org.apache.kafka.clients.consumer.OffsetResetStrategy; -import org.apache.kafka.clients.producer.MockProducer; import org.apache.kafka.clients.producer.Producer; -import org.apache.kafka.common.serialization.StringSerializer; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Scope; import ru.spcex.clearing.imdg.IMDGDistributedNames; -import ru.spcex.clearing.platform.messaging.serialization.JsonSerializer; import ru.spcex.clearing.platform.messaging.service.RequestInfo; import ru.spcex.clearing.platform.messaging.service.sender.KafkaSender; import ru.spcex.platform.imdg.api.Imdg; @@ -19,20 +18,10 @@ import ru.spcex.platform.imdg.api.ImdgProvider; @Configuration public class KafkaTestConfig { - @Bean - public MockConsumer createTestConsumer() { - return new MockConsumer<>(OffsetResetStrategy.EARLIEST); - } - - @Bean - public Producer createTestProducer() { - return new MockProducer<>(true, new StringSerializer(), new JsonSerializer()); - } - - @Autowired @Bean - public KafkaSender kafkaSender(Producer kafkaProducer, ImdgProvider imdgProvider) { + public KafkaSender kafkaSender(Producer kafkaProducer, + ImdgProvider imdgProvider) { ImdgId imdgIdGenerator = imdgProvider.getImdgIdGenerator(); return KafkaSender .setup() @@ -44,4 +33,10 @@ public class KafkaTestConfig { }) .build(); } + + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) + @Bean + public MockConsumer createTestConsumer() { + return new MockConsumer<>(OffsetResetStrategy.EARLIEST); + } } diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AbstractServiceTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AbstractServiceTest.java index 06739ae92..86698c4e5 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AbstractServiceTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AbstractServiceTest.java @@ -10,10 +10,7 @@ import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.AccountBalance; import ru.clearing.classes.statics.data.company.Company; import ru.clearing.classes.statics.data.company.CompanySymbols; -import ru.clearing.classes.statics.data.sdf.SDf02; -import ru.clearing.classes.statics.data.sdf.SDf08; -import ru.clearing.classes.statics.data.sdf.SDf10; -import ru.clearing.classes.statics.data.sdf.SDf17; +import ru.clearing.classes.statics.data.sdf.*; import ru.clearing.classes.statics.data.statement.Statement; import ru.spcex.clearing.balance.config.*; import ru.spcex.clearing.balance.utils.MatcherFactory; @@ -25,8 +22,11 @@ import ru.spcex.platform.imdg.iml.hazelcast.adapter.ImdgHazelcast; import java.math.BigDecimal; import java.math.RoundingMode; +import java.time.LocalDate; import java.util.concurrent.atomic.AtomicLong; +import static ru.spcex.clearing.balance.service.Sdf01ExecutorTest.acc; +import static ru.spcex.clearing.balance.service.Sdf01ExecutorTest.datFormatter; import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator; @ExtendWith(SpringExtension.class) @@ -41,12 +41,27 @@ import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFields MessagesConfig.class, ValidationConfig.class, SdfExecutorsConfig.class, - BalanceImdgTestConfig.class, + ImdgTestConfig.class, + ImdgTestConfig.class, KafkaTestConfig.class}) public abstract class AbstractServiceTest { protected static final MatcherFactory.Matcher ACCOUNT_BALANCE_MATCHER = usingIgnoringFieldsComparator("created", "updated", "clearingDate", "id"); protected static final MatcherFactory.Matcher RESULT_MATCHER = usingIgnoringFieldsComparator("account.created", "account.updated", "account.clearingDate", "generationId"); protected static final MatcherFactory.Matcher STATEMENT_MATCHER = usingIgnoringFieldsComparator("created", "comment", "outSDfId", "updated", "id"); + protected static AtomicLong currentId = new AtomicLong(0L); + protected static IMap companyMap; + protected static IMap companySymbolsMap; + protected static IMap accountMap; + protected static ImdgHazelcast statementImdg; + protected static ImdgHazelcast requestInfoImdg; + protected static ImdgHazelcast sdf02Imdg; + protected static ImdgHazelcast sdf01Imdg; + protected static ImdgHazelcast sdf08Imdg; + protected static ImdgHazelcast sdf10Imdg; + protected static ImdgHazelcast sdf17Imdg; + protected static ImdgHazelcast accountBalanceImdg; + protected static ImdgHazelcast companyImdg; + protected static ImdgHazelcast accountImdg; protected final Long accountIdNew = 10L; protected final Long addresseeIdNew = 2L; protected final String deal = "111111111"; @@ -54,28 +69,18 @@ public abstract class AbstractServiceTest { protected final BigDecimal amountNew = new BigDecimal(1000); protected final String cashMovementCurrencyCode = CurrencyCode.RUB.getKey(); - protected AtomicLong currentId = new AtomicLong(0L); - protected IMap companyMap; - protected IMap companySymbolsMap; - protected IMap accountMap; - protected ImdgHazelcast statementImdg; - protected ImdgHazelcast requestInfoImdg; - protected ImdgHazelcast sdf02Imdg; - protected ImdgHazelcast sdf08Imdg; - protected ImdgHazelcast sdf10Imdg; - protected ImdgHazelcast sdf17Imdg; - protected ImdgHazelcast accountBalanceImdg; @Autowired @Qualifier("hazelcastServiceTest") private ImdgProvider hazelcast; void init() { hazelcast.waitAvailable(); - ImdgHazelcast companyImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_Company, Company.class); + companyImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_Company, Company.class); ImdgHazelcast companySymbolsImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_CompanySymbols, CompanySymbols.class); - ImdgHazelcast accountImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_Account, Account.class); + accountImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_Account, Account.class); requestInfoImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_RequestInfo, RequestInfo.class); statementImdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_Statement, Statement.class); + sdf01Imdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_SDf01, SDf01.class); sdf02Imdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_SDf02, SDf02.class); sdf08Imdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_SDf08, SDf08.class); sdf10Imdg = (ImdgHazelcast) hazelcast.getImdg(IMDGDistributedNames.Map_SDf10, SDf10.class); @@ -135,4 +140,19 @@ public abstract class AbstractServiceTest { accountBalance.setFullName(company.getFullName()); return accountBalance; } + + protected SDf01 getTestSdf01(long id, long generationId) { + LocalDate date = LocalDate.now(); + SDf01 sdf01 = new SDf01(); + sdf01.setId(id); + sdf01.setGenerationId(generationId); + sdf01.setMarket("U"); + sdf01.setDeal(deal); + sdf01.setAccount(acc); + sdf01.setCurr_code("RUR"); + sdf01.setDat(date.format(datFormatter)); + sdf01.setAcc_type("A"); + sdf01.setRemainder(amountNew.toString()); + return sdf01; + } } diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AccountBalanceServiceTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AccountBalanceServiceTest.java index 2ae63f1bf..c5569893c 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AccountBalanceServiceTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/AccountBalanceServiceTest.java @@ -1,7 +1,9 @@ package ru.spcex.clearing.balance.service; +import org.apache.kafka.clients.producer.MockProducer; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.SpyBean; import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.AccountBalance; import ru.clearing.classes.statics.data.company.Company; @@ -30,11 +32,14 @@ class AccountBalanceServiceTest extends AbstractServiceTest { @Autowired AccountBalanceService accountBalanceService; + @SpyBean + private MockProducer producer; + @PostConstruct void init() { super.init(); } - + /** * {@link AccountBalanceService#createAccountBalance(Long addresseeId, Long accountId, BigDecimal amount, String cashMovementCurrencyCode)}
* Тест проверяет генерацию сущности {@link AccountResult}
@@ -47,9 +52,9 @@ class AccountBalanceServiceTest extends AbstractServiceTest { @Test void createAccountBalance() { Company company = getTestCompany(); - companyMap.put(addresseeIdNew, company); + companyImdg.insert(company); Account account = getTestAccount(accountIdNew, acc); - accountMap.put(accountIdNew, account); + accountImdg.insert(account); AccountResult predictableNewResult = getTestAccountResult(accountIdNew, account, company); AccountResult resultNew = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode); @@ -91,7 +96,8 @@ class AccountBalanceServiceTest extends AbstractServiceTest { //CompanyNotFound AccountResult predictableResult; predictableResult = new AccountResult(new EnumMessage(BalanceError.CompanyNotFound)); - companyMap.delete(addresseeIdNew); + Company company = getTestCompany(); + companyImdg.delete(company); AccountResult result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode); ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult); @@ -100,11 +106,11 @@ class AccountBalanceServiceTest extends AbstractServiceTest { ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult); //AccountNotPresent accountType=null - companyMap.put(addresseeIdNew, getTestCompany()); + companyImdg.insert(company); Account account = new Account(); account.setId(accountIdNew); account.setAccountStatus(Status.Active.getKey()); - accountMap.put(accountIdNew, account); + accountImdg.insert(account); predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent)); result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode); @@ -114,7 +120,7 @@ class AccountBalanceServiceTest extends AbstractServiceTest { account.setId(null); account.setAccountType(AccountType.Clrn.getKey()); account.setAccountStatus(Status.Active.getKey()); - accountMap.put(accountIdNew, account); + accountImdg.insert(account); predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent)); result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode); @@ -124,14 +130,14 @@ class AccountBalanceServiceTest extends AbstractServiceTest { account.setId(accountIdNew); account.setAccountType(AccountType.Clrn.getKey()); account.setAccountStatus(null); - accountMap.put(accountIdNew, account); + accountImdg.insert(account); predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotActive, account.getId())); result = accountBalanceService.createAccountBalance(addresseeIdNew, accountIdNew, amountNew, cashMovementCurrencyCode); ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult); account.setAccountStatus(Status.Active.getKey()); - accountMap.put(accountIdNew, account); + accountImdg.insert(account); result = accountBalanceService.createAccountBalance(addresseeIdNew, null, amountNew, cashMovementCurrencyCode); predictableResult = new AccountResult(new EnumMessage(BalanceError.AccountNotPresent)); ACCOUNT_BALANCE_MATCHER.assertMatch(result, predictableResult); diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf01ExecutorTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf01ExecutorTest.java index 4aa813da4..dfd5b6b90 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf01ExecutorTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf01ExecutorTest.java @@ -1,7 +1,9 @@ package ru.spcex.clearing.balance.service; +import org.apache.kafka.clients.producer.MockProducer; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.SpyBean; import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.AccountBalance; import ru.clearing.classes.statics.data.company.Company; @@ -27,13 +29,15 @@ import java.util.Map; import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator; class Sdf01ExecutorTest extends AbstractServiceTest { - final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy"); + public final static DateTimeFormatter datFormatter = DateTimeFormatter.ofPattern("dd.MM.yy"); + public final static String acc = "123456789"; private static final MatcherFactory.Matcher SDF_02_MATCHER = usingIgnoringFieldsComparator("created", "comment", "outSDfId", "generationTime", "generationId", "id"); - private final String acc = "123456789"; private final Long ID = 1L; @Autowired Sdf01Executor sdf01Executor; private StatementRequest statementRequest; + @SpyBean + private MockProducer producer; @PostConstruct void init() { @@ -59,7 +63,7 @@ class Sdf01ExecutorTest extends AbstractServiceTest { @Test void execute() { //check create statement, SDf02 and AccountBalance - SDf01 sdf01 = getTestSdf01(); + SDf01 sdf01 = getTestSdf01(ID, 1L); Company company = getTestCompany(); companyMap.put(addresseeIdNew, company); @@ -103,7 +107,7 @@ class Sdf01ExecutorTest extends AbstractServiceTest { @Test void validatedExecute() { //CompanyNotFound - SDf01 sdf01 = getTestSdf01(); + SDf01 sdf01 = getTestSdf01(ID, 1L); companyMap.delete(addresseeIdNew); checkError(new EnumMessage(BalanceError.CompanyNotFound), sdf01); @@ -206,20 +210,6 @@ class Sdf01ExecutorTest extends AbstractServiceTest { return sDf02; } - private SDf01 getTestSdf01() { - LocalDate date = LocalDate.now(); - SDf01 sdf01 = new SDf01(); - sdf01.setId(ID); - sdf01.setMarket("U"); - sdf01.setDeal(deal); - sdf01.setAccount(acc); - sdf01.setCurr_code("RUR"); - sdf01.setDat(date.format(datFormatter)); - sdf01.setAcc_type("A"); - sdf01.setRemainder(amountNew.toString()); - return sdf01; - } - private Statement getTestStatement(Long id, Company company, Account account, SDf01 sdf01) { Statement statement = new Statement(); statement.setId(id); diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf08ServiceTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf08ServiceTest.java index afb4fd05d..f78043233 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf08ServiceTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf08ServiceTest.java @@ -2,43 +2,46 @@ package ru.spcex.clearing.balance.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.hazelcast.core.IMap; -import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; -import org.apache.kafka.common.TopicPartition; +import org.apache.kafka.clients.producer.MockProducer; +import org.apache.kafka.clients.producer.ProducerRecord; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.SpyBean; import ru.clearing.classes.statics.data.sdf.SDf08; -import ru.spcex.clearing.balance.utils.ImapEvent; import ru.spcex.clearing.platform.messaging.domain.ActionType; import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.clearing.platform.messaging.domain.Consts; +import ru.spcex.clearing.platform.messaging.domain.cud.balance.ExportToFileRequest; import ru.spcex.clearing.platform.messaging.service.RequestInfo; -import ru.spcex.clearing.platform.messaging.service.Status; import ru.spcex.platform.enumeration.Task; import javax.annotation.PostConstruct; -import java.time.Instant; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static ru.spcex.clearing.balance.utils.MockKafkaUtils.addRecordToKafka; class Sdf08ServiceTest extends AbstractServiceTest { // private static final MatcherFactory.Matcher SDF_08_MATCHER = usingIgnoringFieldsComparator("created", "comment", "outSDfId", "generationTime", "generationId", "id"); private static final String TOPIC = Task.getAllBalance.topic(); private static final int PARTITION = 1; - private static final Long limit = 300L; @Autowired Sdf08Service sdf08Service; - @Autowired + @Captor + ArgumentCaptor producerRecord; private MockConsumer mockConsumer; + @SpyBean + private MockProducer producer; @PostConstruct void init() { super.init(); + mockConsumer = (MockConsumer) sdf08Service.getConsumer(); } /** @@ -60,30 +63,21 @@ class Sdf08ServiceTest extends AbstractServiceTest { throw new RuntimeException(e); } - IMap sdf08Map = sdf08Imdg.getMap(); - IMap resultsRequestMap = requestInfoImdg.getMap(); - ImapEvent imapEvent = new ImapEvent(resultsRequestMap); - int count = sdf08Map.size(); - long timeNow = Instant.now().toEpochMilli(); - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC, PARTITION, 0, "key", jsonBaseNewRequest)); - }); + addRecordToKafka(mockConsumer, TOPIC, PARTITION, 0, jsonBaseNewRequest); - HashMap startOffsets = new HashMap<>(); - TopicPartition tp = new TopicPartition(TOPIC, PARTITION); - startOffsets.put(tp, 0L); - mockConsumer.updateBeginningOffsets(startOffsets); + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); - //waiting for hazelcast map item updates - imapEvent.waitWhenHappened(); + assertEquals(Consts.EXPORT_PROCESS, producerRecord.getValue().topic()); + BaseRequest baseRequest = (BaseRequest) producerRecord.getValue().value(); - Collection resultsRequestInfo = requestInfoImdg.getCollectionObjectsByFieldValues(Map.of("status", Status.Processing)); - RequestInfo requestInfo = resultsRequestInfo.stream().max((entry1, entry2) -> entry1.getId() > entry2.getId() ? 1 : -1).get(); - Long diffRequestInfo = requestInfo.getCreated().toEpochMilli() - timeNow; + ExportToFileRequest exportToFileRequest = (ExportToFileRequest) baseRequest.getRequestPayload(); + SDf08 resultsSDf08 = sdf08Imdg.getSingleObjectBySQL(String.format("generationId = %s and id != null", exportToFileRequest.getSdfGroupId())); + RequestInfo resultRequestInfo = requestInfoImdg.getSingleObjectByID(baseRequest.getId()); - assertEquals(1, sdf08Map.size() - count); - assertTrue(limit.compareTo(diffRequestInfo) > 0); + assertNotNull(baseRequest); + assertNotNull(resultsSDf08); + assertNotNull(resultRequestInfo); } } \ No newline at end of file diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf09ExecutorTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf09ExecutorTest.java index db4a23ebd..8cd52bfa0 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf09ExecutorTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf09ExecutorTest.java @@ -1,7 +1,9 @@ package ru.spcex.clearing.balance.service; +import org.apache.kafka.clients.producer.MockProducer; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.SpyBean; import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.AccountBalance; import ru.clearing.classes.statics.data.company.Company; @@ -34,6 +36,8 @@ class Sdf09ExecutorTest extends AbstractServiceTest { Sdf09Executor sdf09Executor; private SDf09 sdf09; private StatementRequest statementRequest; + @SpyBean + private MockProducer producer; @PostConstruct void init() { diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf16ExecutorTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf16ExecutorTest.java index c475d007d..6761fdd92 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf16ExecutorTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/Sdf16ExecutorTest.java @@ -1,7 +1,12 @@ package ru.spcex.clearing.balance.service; +import org.apache.kafka.clients.producer.MockProducer; +import org.apache.kafka.clients.producer.ProducerRecord; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; import ru.clearing.classes.statics.data.account.Account; import ru.clearing.classes.statics.data.account.AccountBalance; import ru.clearing.classes.statics.data.company.Company; @@ -11,8 +16,12 @@ import ru.clearing.classes.statics.data.sdf.SDf17; import ru.clearing.classes.statics.data.statement.Statement; import ru.spcex.clearing.balance.errors.BalanceError; import ru.spcex.clearing.balance.utils.MatcherFactory; +import ru.spcex.clearing.balance.utils.MockKafkaUtils; +import ru.spcex.clearing.platform.messaging.domain.BaseRequest; +import ru.spcex.clearing.platform.messaging.domain.Consts; import ru.spcex.clearing.platform.messaging.domain.cud.account.sdf01.AccountSdfRequestPart; import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest; +import ru.spcex.clearing.platform.messaging.domain.cud.utilities.NotificationNewRequest; import ru.spcex.platform.enumeration.*; import ru.spcex.platform.utils.enumeration.EnumMessage; @@ -24,6 +33,9 @@ import java.util.Collection; import java.util.Collections; import java.util.Map; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.spy; import static ru.spcex.clearing.balance.utils.MatcherFactory.usingIgnoringFieldsComparator; class Sdf16ExecutorTest extends AbstractServiceTest { @@ -32,9 +44,14 @@ class Sdf16ExecutorTest extends AbstractServiceTest { private final String acc = "323456789"; @Autowired Sdf16Executor sdf16Executor; + @Captor + ArgumentCaptor producerRecord; private SDf16 sdf16; private StatementRequest statementRequest; + @MockBean + private MockProducer producer; + @PostConstruct void init() { super.init(); @@ -78,11 +95,18 @@ class Sdf16ExecutorTest extends AbstractServiceTest { predictableStatement.setOutSDfId(predictableSdf17.getId()); AccountResult predictableNewResult = getTestAccountResult(currentId.getAndIncrement(), account, company); + MockKafkaUtils.FutureRecordMetadata future = spy(MockKafkaUtils.FutureRecordMetadata.class); + doReturn(future).when(producer).send(producerRecord.capture()); Result result = sdf16Executor.execute(Collections.singletonList(sdf16), statementRequest); + + BaseRequest baseRequest = (BaseRequest) producerRecord.getValue().value(); + NotificationNewRequest notificationNewRequest = (NotificationNewRequest) baseRequest.getRequestPayload(); Statement resultStatement = statementImdg.getSingleObjectByFieldValues(Map.of("account", acc)); SDf17 resultSdf17 = sdf17Imdg.getSingleObjectByFieldValues(Map.of("account", acc)); AccountBalance resultAccountBalance = accountBalanceImdg.getSingleObjectByFieldValues(Map.of("account", acc)); + assertEquals(Consts.NOTIFICATION_NEW, producerRecord.getValue().topic()); + assertEquals(notificationNewRequest.getObjectId(), resultStatement.getId()); RESULT_MATCHER.assertMatch(result, predictableResult); STATEMENT_MATCHER.assertMatch(resultStatement, predictableStatement); SDF_17_MATCHER.assertMatch(resultSdf17, predictableSdf17); diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/StatementServiceServiceTest.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/StatementServiceServiceTest.java index a9924be94..5d39a8926 100644 --- a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/StatementServiceServiceTest.java +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/service/StatementServiceServiceTest.java @@ -2,44 +2,54 @@ package ru.spcex.clearing.balance.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import com.hazelcast.core.IMap; -import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; -import org.apache.kafka.common.TopicPartition; +import org.apache.kafka.clients.producer.MockProducer; +import org.apache.kafka.clients.producer.ProducerRecord; import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; import org.springframework.beans.factory.annotation.Autowired; -import ru.spcex.clearing.balance.utils.ImapEvent; +import org.springframework.boot.test.mock.mockito.SpyBean; +import ru.clearing.classes.statics.data.company.Company; +import ru.clearing.classes.statics.data.sdf.SDf01; import ru.spcex.clearing.platform.messaging.domain.ActionType; import ru.spcex.clearing.platform.messaging.domain.BaseRequest; import ru.spcex.clearing.platform.messaging.domain.Consts; import ru.spcex.clearing.platform.messaging.domain.cud.balance.StatementRequest; import ru.spcex.clearing.platform.messaging.service.RequestInfo; -import ru.spcex.clearing.platform.messaging.service.Status; import javax.annotation.PostConstruct; -import java.time.Instant; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; +import java.util.concurrent.atomic.AtomicLong; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.mockito.Mockito.timeout; +import static org.mockito.Mockito.verify; +import static ru.spcex.clearing.balance.utils.MockKafkaUtils.addRecordToKafka; import static ru.spcex.platform.enumeration.SdfTable.SDF_01; class StatementServiceServiceTest extends AbstractServiceTest { - // private static final MatcherFactory.Matcher SDF_08_MATCHER = usingIgnoringFieldsComparator("created", "comment", "outSDfId", "generationTime", "generationId", "id"); private static final String TOPIC = Consts.STATEMENT_PROCESS; private static final int PARTITION = 1; private static final Long groupId = 111L; - private static final Long limit = 300L; + private final static AtomicLong cuurentOffset = new AtomicLong(1L); + private final Long ID = 11L; @Autowired StatementService statementService; - @Autowired + @Captor + ArgumentCaptor producerRecord; private MockConsumer mockConsumer; + private SDf01 sDf01; + private Company company; + @SpyBean + private MockProducer producer; @PostConstruct void init() { super.init(); + mockConsumer = (MockConsumer) statementService.getConsumer(); + sDf01 = getTestSdf01(ID, groupId); + company = getTestCompany(); } /** @@ -50,43 +60,78 @@ class StatementServiceServiceTest extends AbstractServiceTest { * {@link StatementRequest#table} - SDF_01
*/ @Test - void process() throws InterruptedException { + void processEXPORT_PROCESS() { + sdf01Imdg.delete(sDf01); + companyImdg.delete(company); + + companyImdg.delete(company); StatementRequest statementRequest = new StatementRequest(); statementRequest.setGroupId(groupId); statementRequest.setTable(SDF_01); - BaseRequest baseRequest = new BaseRequest<>(); - baseRequest.setRequestPayload(statementRequest); - baseRequest.setId(currentId.getAndIncrement()); - baseRequest.setActionType(ActionType.NEW); + BaseRequest baseNewRequest = new BaseRequest<>(); + baseNewRequest.setRequestPayload(statementRequest); + baseNewRequest.setId(currentId.getAndIncrement()); + baseNewRequest.setActionType(ActionType.NEW); String jsonBaseNewRequest; ObjectMapper objectMapper = new ObjectMapper(); try { - jsonBaseNewRequest = objectMapper.writeValueAsString(baseRequest); + jsonBaseNewRequest = objectMapper.writeValueAsString(baseNewRequest); } catch (JsonProcessingException e) { throw new RuntimeException(e); } - IMap resultsRequestMap = requestInfoImdg.getMap(); - ImapEvent imapEvent = new ImapEvent(resultsRequestMap); - long timeNow = Instant.now().toEpochMilli(); - //KAFKA - mockConsumer.schedulePollTask(() -> { - mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC, PARTITION))); - mockConsumer.addRecord(new ConsumerRecord<>(TOPIC, PARTITION, 0, "key", jsonBaseNewRequest)); - }); + addRecordToKafka(mockConsumer, TOPIC, PARTITION, cuurentOffset.getAndIncrement(), jsonBaseNewRequest); - HashMap startOffsets = new HashMap<>(); - TopicPartition tp = new TopicPartition(TOPIC, PARTITION); - startOffsets.put(tp, 0L); - mockConsumer.updateBeginningOffsets(startOffsets); + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); - //waiting for hazelcast map item updates - imapEvent.waitWhenHappened(); + BaseRequest baseRequest = (BaseRequest) producerRecord.getValue().value(); + RequestInfo resultRequestInfo = requestInfoImdg.getSingleObjectByID(baseRequest.getId()); - Collection resultsRequestInfo = requestInfoImdg.getCollectionObjectsByFieldValues(Map.of("status", Status.Processing)); - RequestInfo requestInfo = resultsRequestInfo.stream().max((entry1, entry2) -> entry1.getId() > entry2.getId() ? 1 : -1).get(); - Long diffRequestInfo = requestInfo.getCreated().toEpochMilli() - timeNow; + assertEquals(Consts.EXPORT_PROCESS, producerRecord.getValue().topic()); + assertNotNull(baseRequest); + assertNotNull(resultRequestInfo); + } - assertTrue(limit.compareTo(diffRequestInfo) > 0); + /** + * {@link StatementService}
+ * Тест проверяет генерацию сущностей {@link RequestInfo}
+ * Входные параметры:
+ * {@link StatementRequest}: new StatementRequest()
+ * {@link StatementRequest#table} - SDF_01
+ */ + @Test + void processACCOUNT_NEW() { + sdf01Imdg.insert(sDf01); + companyImdg.insert(company); + + StatementRequest statementRequest = new StatementRequest(); + statementRequest.setGroupId(groupId); + statementRequest.setTable(SDF_01); + BaseRequest baseNewRequest = new BaseRequest<>(); + baseNewRequest.setRequestPayload(statementRequest); + baseNewRequest.setId(currentId.getAndIncrement()); + baseNewRequest.setActionType(ActionType.NEW); + String jsonBaseNewRequest; + ObjectMapper objectMapper = new ObjectMapper(); + try { + jsonBaseNewRequest = objectMapper.writeValueAsString(baseNewRequest); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + + addRecordToKafka(mockConsumer, TOPIC, PARTITION, cuurentOffset.getAndIncrement(), jsonBaseNewRequest); + + //waiting for kafka producer send message (finale event) + verify(producer, timeout(30_000L).times(1)) + .send(producerRecord.capture()); + + BaseRequest baseRequest = (BaseRequest) producerRecord.getValue().value(); + RequestInfo resultRequestInfo = requestInfoImdg.getSingleObjectByID(baseRequest.getId()); + + assertEquals(Consts.ACCOUNT_NEW, producerRecord.getValue().topic()); + assertNotNull(baseRequest); + assertNotNull(resultRequestInfo); } } \ No newline at end of file diff --git a/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/utils/MockKafkaUtils.java b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/utils/MockKafkaUtils.java new file mode 100644 index 000000000..2ec78cd34 --- /dev/null +++ b/clearing-parent/balance-service/src/test/java/ru/spcex/clearing/balance/utils/MockKafkaUtils.java @@ -0,0 +1,54 @@ +package ru.spcex.clearing.balance.utils; + +import org.apache.kafka.clients.consumer.ConsumerRecord; +import org.apache.kafka.clients.consumer.MockConsumer; +import org.apache.kafka.clients.producer.RecordMetadata; +import org.apache.kafka.common.TopicPartition; + +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class MockKafkaUtils { + public static void addRecordToKafka(MockConsumer mockConsumer, String topic, int partition, long offset, String jsonValue) { + mockConsumer.schedulePollTask(() -> { + mockConsumer.rebalance(Collections.singletonList(new TopicPartition(topic, partition))); + mockConsumer.addRecord(new ConsumerRecord<>(topic, partition, offset, "key", jsonValue)); + }); + + HashMap startOffsets = new HashMap<>(); + TopicPartition tp = new TopicPartition(topic, partition); + startOffsets.put(tp, 0L); + mockConsumer.updateBeginningOffsets(startOffsets); + } + + public static class FutureRecordMetadata implements Future { + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + return false; + } + + @Override + public boolean isCancelled() { + return false; + } + + @Override + public boolean isDone() { + return false; + } + + @Override + public RecordMetadata get() throws InterruptedException, ExecutionException { + return null; + } + + @Override + public RecordMetadata get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { + return null; + } + } +} diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/config/HazelcastServiceTestConfiguration.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/config/HazelcastServiceTestConfiguration.java index 0c7ca4069..f7c808768 100644 --- a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/config/HazelcastServiceTestConfiguration.java +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/config/HazelcastServiceTestConfiguration.java @@ -13,9 +13,12 @@ import ru.spcex.platform.imdg.iml.hazelcast.util.HazelcastHelper; import java.util.List; import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; @Configuration public class HazelcastServiceTestConfiguration { + + public static final AtomicLong currentID = new AtomicLong(0L); private HazelcastInstance hazelcastInstance; private static ThreadPoolTaskExecutor createThreadPoolTaskExecutor(int maxPoolSz, boolean waitForCompletion) { diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ClearingMemberCategoryServiceTest.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ClearingMemberCategoryServiceTest.java index 97ee984ff..6d73e05a5 100644 --- a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ClearingMemberCategoryServiceTest.java +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ClearingMemberCategoryServiceTest.java @@ -3,8 +3,6 @@ package ru.spcex.clearing.company.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.hazelcast.core.IMap; -import com.hazelcast.map.listener.EntryRemovedListener; -import com.hazelcast.map.listener.EntryUpdatedListener; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; import org.apache.kafka.clients.consumer.OffsetResetStrategy; @@ -19,20 +17,22 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.generated.ClearingMemberCategory; -import ru.clearing.classes.statics.data.profile.Contact; import ru.spcex.clearing.company.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.company.utils.ImapEvent; import ru.spcex.clearing.company.utils.MatcherFactory.Matcher; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; import ru.spcex.clearing.platform.messaging.domain.BaseRequest; import ru.spcex.clearing.platform.messaging.domain.Consts; import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest; +import ru.spcex.clearing.platform.messaging.domain.cud.company.ClearingMemberCategoryNewRequest; import ru.spcex.clearing.platform.messaging.domain.cud.company.ClearingMemberCategoryUpdateRequest; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; import java.util.Collections; import java.util.HashMap; +import static ru.spcex.clearing.company.config.HazelcastServiceTestConfiguration.currentID; import static ru.spcex.clearing.company.utils.MatcherFactory.usingIgnoringFieldsComparator; @ExtendWith(SpringExtension.class) @@ -42,9 +42,10 @@ class ClearingMemberCategoryServiceTest { public static final Matcher MEMBER_CATEGORY_MATCHER = usingIgnoringFieldsComparator(); private static final int PARTITION = 0; + private static final String TOPIC_MEMBER_CATEGORY_NEW = Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_NEW; private static final String TOPIC_MEMBER_CATEGORY_UPDATE = Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_UPDATE; private static final String TOPIC_MEMBER_CATEGORY_DELETE = Consts.DESTINATION_CLEARING_MEMBER_CATEGORY_DELETE; - private static final Long ID = 0L; + private static final Long ID = currentID.getAndIncrement(); @Autowired @Qualifier("hazelcastServiceTest") @@ -58,6 +59,56 @@ class ClearingMemberCategoryServiceTest { mockProducer = new MockProducer<>(); } + @Test + void clearingMemberCategoryNew() throws InterruptedException { + //ARRANGE + + ClearingMemberCategoryNewRequest memberCategoryNewRequest = new ClearingMemberCategoryNewRequest(); + memberCategoryNewRequest.setClearingMemberCategory("1234"); + BaseRequest baseUpdateRequest = new BaseRequest<>(); + baseUpdateRequest.setRequestPayload(memberCategoryNewRequest); + baseUpdateRequest.setId(ID); + baseUpdateRequest.setActionType(ActionType.NEW); + String jsonBaseForNewRequest; + ObjectMapper objectMapper = new ObjectMapper(); + try { + jsonBaseForNewRequest = objectMapper.writeValueAsString(baseUpdateRequest); + } catch (JsonProcessingException e) { + throw new RuntimeException(e); + } + + ClearingMemberCategory predictableClearingMemberCategory = new ClearingMemberCategory(); + predictableClearingMemberCategory.setId(ID); + predictableClearingMemberCategory.setClearingMemberCategory("1234"); + + //ACT + //service set up + ClearingMemberCategoryService clearingMemberCategoryService = new ClearingMemberCategoryService(mockConsumer, mockProducer, hazelcastServiceTest); + + //callbacks set up + clearingMemberCategoryService.afterPropertiesSet(); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); + ImapEvent imapEvent = new ImapEvent(iMap); + + //KAFKA + mockConsumer.schedulePollTask(() -> { + mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_MEMBER_CATEGORY_NEW, PARTITION))); + mockConsumer.addRecord(new ConsumerRecord<>(TOPIC_MEMBER_CATEGORY_NEW, PARTITION, 0, "key", jsonBaseForNewRequest)); + }); + HashMap startOffsetsUpdating = new HashMap<>(); + TopicPartition tpUpdating = new TopicPartition(TOPIC_MEMBER_CATEGORY_NEW, PARTITION); + startOffsetsUpdating.put(tpUpdating, 0L); + mockConsumer.updateBeginningOffsets(startOffsetsUpdating); + + //waiting for hazelcast map item updates + imapEvent.waitWhenHappened(); + + //ASSERT + ClearingMemberCategory resultUpdating = iMap.get(ID); + MEMBER_CATEGORY_MATCHER.assertMatch(resultUpdating, predictableClearingMemberCategory); + } + /** * {@link ClearingMemberCategoryService#clearingMemberCategoryUpdate(BaseRequest)}
* Тест проверяет обновление сущности {@link ClearingMemberCategory} в Hazelcast при передаче из Apache Kafka.
@@ -100,6 +151,7 @@ class ClearingMemberCategoryServiceTest { IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); iMap.put(ID, existsСlearingMemberCategory); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -112,30 +164,11 @@ class ClearingMemberCategoryServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map item updates - Object waiter = new Object(); - String listenerID = iMap.addEntryListener((EntryUpdatedListener) entryEvent -> { - System.out.println("Checking If removed.."); - - synchronized (waiter) { - try { - waiter.wait(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - waiter.notify(); - } - }, false); - - synchronized (waiter) { - waiter.wait(100); - } + imapEvent.waitWhenHappened(); //ASSERT ClearingMemberCategory resultUpdating = iMap.get(ID); MEMBER_CATEGORY_MATCHER.assertMatch(resultUpdating, predictableClearingMemberCategory); - - //preparing hazelcastImdgProvider for next test - iMap.removeEntryListener(listenerID); } /** @@ -175,6 +208,7 @@ class ClearingMemberCategoryServiceTest { IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); iMap.put(ID, existsСlearingMemberCategory); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -187,28 +221,9 @@ class ClearingMemberCategoryServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map item removes - Object waiter = new Object(); - String listenerID = iMap.addEntryListener((EntryRemovedListener) entryEvent -> { - System.out.println("Checking If removed.."); - - try { - waiter.wait(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - synchronized (waiter) { - waiter.notify(); - } - }, false); - - synchronized (waiter) { - waiter.wait(100); - } + imapEvent.waitWhenHappened(); //ASSERT Assertions.assertEquals(0, iMap.size()); - - //preparing hazelcastImdgProvider for next test - iMap.removeEntryListener(listenerID); } } \ No newline at end of file diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyInfoServiceTest.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyInfoServiceTest.java index c383a4ec7..cc380908b 100644 --- a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyInfoServiceTest.java +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyInfoServiceTest.java @@ -3,7 +3,6 @@ package ru.spcex.clearing.company.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.hazelcast.core.IMap; -import com.hazelcast.map.listener.EntryUpdatedListener; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; import org.apache.kafka.clients.consumer.OffsetResetStrategy; @@ -16,9 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; +import ru.clearing.classes.statics.data.company.Company; import ru.clearing.classes.statics.data.profile.CompanyInfo; -import ru.clearing.classes.statics.data.profile.Contact; import ru.spcex.clearing.company.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.company.utils.ImapEvent; import ru.spcex.clearing.company.utils.MatcherFactory; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -88,6 +88,9 @@ class CompanyInfoServiceTest { existsCompanyInfo.setFullNameEng("exists fullNameEng"); existsCompanyInfo.setShortName("exists shortName"); existsCompanyInfo.setFullName("exists fullName"); + Company existsCompany = new Company(); + existsCompany.setId(ID); + existsCompany.setProfile(existsCompanyInfo); CompanyInfoUpdateRequest companyInfoUpdateRequest = new CompanyInfoUpdateRequest(); companyInfoUpdateRequest.setId(ID); @@ -137,8 +140,9 @@ class CompanyInfoServiceTest { //callbacks set up clearingMemberCategoryService.afterPropertiesSet(); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Company); - iMap.put(ID, existsCompanyInfo); + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Company); + iMap.put(ID, existsCompany); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -151,29 +155,10 @@ class CompanyInfoServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map updates - Object waiter = new Object(); - String listenerID = iMap.addEntryListener((EntryUpdatedListener) entryEvent -> { - System.out.println("Checking If removed.."); - - try { - waiter.wait(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - synchronized (waiter) { - waiter.notify(); - } - }, false); - - synchronized (waiter) { - waiter.wait(100); - } + imapEvent.waitWhenHappened(); //ASSERT - CompanyInfo resultUpdating = iMap.get(ID); - COMPANY_INFO_MATCHER.assertMatch(resultUpdating, predictableCompanyInfo); - - //preparing hazelcastImdgProvider for next test - iMap.removeEntryListener(listenerID); + Company resultUpdating = iMap.get(ID); + COMPANY_INFO_MATCHER.assertMatch(resultUpdating.getProfile(), predictableCompanyInfo); } } \ No newline at end of file diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyServiceTest.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyServiceTest.java index 7df5c8164..2d68b438a 100644 --- a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyServiceTest.java +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanyServiceTest.java @@ -3,7 +3,6 @@ package ru.spcex.clearing.company.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.hazelcast.core.IMap; -import com.hazelcast.map.listener.EntryRemovedListener; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; import org.apache.kafka.clients.consumer.OffsetResetStrategy; @@ -19,8 +18,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.company.Company; import ru.clearing.classes.statics.data.generated.ClearingMemberCategory; -import ru.clearing.classes.statics.data.profile.Contact; import ru.spcex.clearing.company.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.company.utils.ImapEvent; import ru.spcex.clearing.company.utils.MatcherFactory; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -92,6 +91,7 @@ class CompanyServiceTest { IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Company); iMap.put(ID, existsCompany); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -104,28 +104,9 @@ class CompanyServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map item removes - Object waiter = new Object(); - String listenerID = iMap.addEntryListener((EntryRemovedListener) entryEvent -> { - System.out.println("Checking If removed.."); - - try { - waiter.wait(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - synchronized (waiter) { - waiter.notify(); - } - }, false); - - synchronized (waiter) { - waiter.wait(100); - } + imapEvent.waitWhenHappened(); //ASSERT Assertions.assertEquals(0, iMap.size()); - - //preparing hazelcastImdgProvider for next test - iMap.removeEntryListener(listenerID); } } \ No newline at end of file diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanySymbolServiceTest.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanySymbolServiceTest.java index 13530012d..e381cacd3 100644 --- a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanySymbolServiceTest.java +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/CompanySymbolServiceTest.java @@ -3,7 +3,6 @@ package ru.spcex.clearing.company.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.hazelcast.core.IMap; -import com.hazelcast.map.listener.EntryUpdatedListener; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; import org.apache.kafka.clients.consumer.OffsetResetStrategy; @@ -17,8 +16,8 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.company.CompanySymbols; -import ru.clearing.classes.statics.data.profile.Contact; import ru.spcex.clearing.company.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.company.utils.ImapEvent; import ru.spcex.clearing.company.utils.MatcherFactory; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -105,6 +104,7 @@ class CompanySymbolServiceTest { IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_CompanySymbols); iMap.put(ID, existsCompanySymbols); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -117,29 +117,10 @@ class CompanySymbolServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map item updates - Object waiter = new Object(); - String listenerID = iMap.addEntryListener((EntryUpdatedListener) entryEvent -> { - System.out.println("Checking If removed.."); - - try { - waiter.wait(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - synchronized (waiter) { - waiter.notify(); - } - }, false); - - synchronized (waiter) { - waiter.wait(100); - } + imapEvent.waitWhenHappened(); //ASSERT CompanySymbols resultUpdating = iMap.get(ID); COMPANY_SYMBOL_MATCHER.assertMatch(resultUpdating, predictableCompanySymbols); - - //preparing hazelcastImdgProvider for next test - iMap.removeEntryListener(listenerID); } } \ No newline at end of file diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ContactServiceTest.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ContactServiceTest.java index b7974643c..368715f70 100644 --- a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ContactServiceTest.java +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/service/ContactServiceTest.java @@ -3,7 +3,6 @@ package ru.spcex.clearing.company.service; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.hazelcast.core.IMap; -import com.hazelcast.map.listener.EntryUpdatedListener; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.MockConsumer; import org.apache.kafka.clients.consumer.OffsetResetStrategy; @@ -18,6 +17,7 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.profile.Contact; import ru.spcex.clearing.company.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.company.utils.ImapEvent; import ru.spcex.clearing.company.utils.MatcherFactory; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -103,6 +103,7 @@ class ContactServiceTest { //callbacks set up IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Contact); iMap.put(ID, existsContact); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -115,29 +116,10 @@ class ContactServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map updates - Object waiter = new Object(); - String listenerID = iMap.addEntryListener((EntryUpdatedListener) entryEvent -> { - System.out.println("Checking If removed.."); - - try { - waiter.wait(100); - } catch (InterruptedException e) { - throw new RuntimeException(e); - } - synchronized (waiter) { - waiter.notify(); - } - }, false); - - synchronized (waiter) { - waiter.wait(100); - } + imapEvent.waitWhenHappened(); //ASSERT Contact resultUpdating = iMap.get(ID); CONTACT_MATCHER.assertMatch(resultUpdating, predictableContact); - - //preparing hazelcastImdgProvider for next test - iMap.removeEntryListener(listenerID); } } \ No newline at end of file diff --git a/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/utils/ImapEvent.java b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/utils/ImapEvent.java new file mode 100644 index 000000000..44a613cd0 --- /dev/null +++ b/clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/utils/ImapEvent.java @@ -0,0 +1,63 @@ +package ru.spcex.clearing.company.utils; + +import com.hazelcast.core.IMap; +import com.hazelcast.map.listener.EntryAddedListener; +import com.hazelcast.map.listener.EntryRemovedListener; +import com.hazelcast.map.listener.EntryUpdatedListener; + +import java.util.Timer; +import java.util.TimerTask; +import java.util.concurrent.atomic.AtomicBoolean; + +public class ImapEvent { + private final IMap iMap; + private final String listenerAdding; + private final String listenerUpdating; + private final String listenerRemoving; + private final AtomicBoolean checkEventHappened = new AtomicBoolean(false); + + public ImapEvent(IMap iMap) { + this.iMap = iMap; + listenerAdding = iMap.addEntryListener((EntryAddedListener) entryEvent -> { + synchronized (checkEventHappened) { + checkEventHappened.set(true); + checkEventHappened.notify(); + } + }, false); + listenerUpdating = iMap.addEntryListener((EntryUpdatedListener) entryEvent -> { + synchronized (checkEventHappened) { + checkEventHappened.set(true); + checkEventHappened.notify(); + } + }, false); + listenerRemoving = iMap.addEntryListener((EntryRemovedListener) entryEvent -> { + synchronized (checkEventHappened) { + checkEventHappened.set(true); + checkEventHappened.notify(); + } + }, false); + } + + public void waitWhenHappened() throws InterruptedException { + //running timer task as daemon thread + Timer timer = new Timer(true); + timer.scheduleAtFixedRate(new TimerTask() { + boolean secondRan; + + @Override + public void run() { + checkEventHappened.set(secondRan);//если что-то пойдет не так не тормозить основной поток + secondRan = true; + } + }, 0, 30 * 1000); + synchronized (checkEventHappened) { + while (!checkEventHappened.get()) { + checkEventHappened.wait(100); + } + } + //preparing hazelcastImdgProvider for next test + iMap.removeEntryListener(listenerAdding); + iMap.removeEntryListener(listenerUpdating); + iMap.removeEntryListener(listenerRemoving); + } +} diff --git a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java index dcb73fd07..ad10ca627 100644 --- a/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java +++ b/platform-parent/platform-messaging/src/main/java/ru/spcex/clearing/platform/messaging/service/QueueConsumer.java @@ -36,15 +36,15 @@ import java.util.function.Function; * утилитный класс для обработки сообщений из очереди */ public class QueueConsumer implements AutoCloseable { + protected final Map> callbacks; private final Logger log = LoggerFactory.getLogger(getClass()); private final AtomicBoolean closed = new AtomicBoolean(false); private final Consumer consumer; - private Producer producer; private final ExecutorService inputExecutor; private final ExecutorService outputExecutor; - protected final Map> callbacks; private final ObjectMapper json; protected boolean supportStartOffsetTimeWindow; + private Producer producer; public QueueConsumer(Consumer kafkaQueue) { this.consumer = kafkaQueue; @@ -58,6 +58,7 @@ public class QueueConsumer implements AutoCloseable { /** * используем этот конструктор, если хотим класть * в кафку "ответ" - информацию о статусе обработки команд + * * @param kafkaQueue * @param kafkaResponseQueue */ @@ -96,7 +97,7 @@ public class QueueConsumer implements AutoCloseable { } } catch (Throwable e) { log.error(ExceptionUtils.getStackTrace(e)); - if (producer != null) { + if (producer != null && o != null) { sendErrorResponse((BaseRequest) o); } } @@ -166,12 +167,13 @@ public class QueueConsumer implements AutoCloseable { /** * Валидация запроса + * * @param Класс проверяемого запроса * @return null если ошибок нет */ public RequestInfoUpdate validate(BaseRequest userRequest, - Function validatorBuilder, - IMessageResolver messageResolver) { + Function validatorBuilder, + IMessageResolver messageResolver) { if (validatorBuilder != null) { R req = userRequest.getRequestPayload(); IValidator validator = validatorBuilder.apply(req); @@ -197,5 +199,8 @@ public class QueueConsumer implements AutoCloseable { outputExecutor.shutdown(); } - + // нужен для тестов поскольку у каждого сервиса свой consumer + public Consumer getConsumer() { + return consumer; + } }