From 5aca0cd99a2176282f54877123aa823dcfaeb979 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 3 Oct 2022 13:03:28 +0300 Subject: [PATCH 01/15] fixing bug --- .../account/BankAccountControllerTest.java | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) 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/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java index e0705f548..792d57ff6 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java +++ b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java @@ -1,15 +1,19 @@ package ru.spcex.clearing.backendapi.controller.queue.account; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.core.NestedExceptionUtils; import org.springframework.http.MediaType; -import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; 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.clearing.classes.statics.data.account.BankAccount; import ru.spcex.clearing.backendapi.config.WebConfig; import ru.spcex.clearing.backendapi.controller.queue.config.*; import ru.spcex.clearing.backendapi.controller.queue.utils.MatcherFactory; @@ -17,8 +21,10 @@ import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNe 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.account.BankAccountBackendGetById; import ru.spcex.clearing.backendapi.domain.actions.IAction; import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; import ru.spcex.clearing.platform.messaging.domain.ActionType; import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; @@ -31,13 +37,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static ru.spcex.clearing.backendapi.controller.queue.utils.JsonUtil.writeValue; -@SpringJUnitWebConfig(classes = { +@ContextConfiguration(classes = { WebConfig.class, IOperator.class, BankAccountControllerConfig.class, KafkaConfig.class, HazelcastServiceTestConfiguration.class, + StateLoaderImplConfig.class, Jackson2HttpConverterConfig.class}) +@ExtendWith(SpringExtension.class) class BankAccountControllerTest { public static final MatcherFactory.Matcher CUD_RESPONSE_MATCHER = MatcherFactory.usingIgnoringFieldsComparator(CudResponse.class); @@ -52,6 +60,10 @@ class BankAccountControllerTest { private MockMvc mockMvc; + @Autowired + @Qualifier("stateLoaderImpl") + private StateLoaderImpl stateLoader; + @Autowired private WebApplicationContext webApplicationContext; @@ -200,6 +212,40 @@ class BankAccountControllerTest { .andExpect(content().json(writeValue(extended))); } + @Test + void getById() throws Exception { + //ARRANGE + 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.setAccount("123456789123"); + predictableResult.setId(currentId.getAndIncrement()); + +// IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); +// iMap.put(ID, existsСlearingMemberCategory); + + BankAccountBackendGetById extended = new BankAccountBackendGetById(); + + //ACT + mockMvc.perform(MockMvcRequestBuilders.get(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))); + } + + @Test + void getAll() { + } + private void assertThrowsFor(IAction iAction) { assertThrows(ActionValidationException.class, () -> { try { From aef9556b56cf96ac6097b9c0c540a59388179dd7 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 14 Nov 2022 13:07:01 +0300 Subject: [PATCH 02/15] add AccountServiceTast --- .../HazelcastServiceTestConfiguration.java | 2 + .../account/config/KafkaConfigTest.java | 48 +++++ .../account/service/AccountServiceTest.java | 140 ++++++++++++++ .../service/BankAccountServiceTest.java | 178 ++++++++---------- .../clearing/account/utils/ImapEvent.java | 50 +++++ .../queue/AbstractControllerTest.java | 0 .../account/BankAccountControllerTest.java | 0 .../company/DeleteCompanyControllerTest.java | 0 .../config/BankAccountControllerConfig.java | 2 +- .../config/DeleteCompanyControllerConfig.java | 2 +- .../HazelcastServiceTestConfiguration.java | 0 .../controller/queue/config/IOperator.java | 5 +- .../config/Jackson2HttpConverterConfig.java | 0 .../controller/queue/config/KafkaConfig.java | 0 .../queue/config/StateLoaderImplConfig.java | 0 .../controller/queue/utils/JsonUtil.java | 0 .../queue/utils/MatcherFactory.java | 0 17 files changed, 322 insertions(+), 105 deletions(-) create mode 100644 clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java create mode 100644 clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java create mode 100644 clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java (96%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java (96%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/HazelcastServiceTestConfiguration.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java (76%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/utils/MatcherFactory.java (100%) 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..826001db9 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) { 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..78c210602 --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java @@ -0,0 +1,48 @@ +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.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.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +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; +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(@Qualifier("mockProducerTest") 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(); + } + + @Bean(name = "mockConsumerTest") + public MockConsumer createConsumer() { + return new MockConsumer<>(OffsetResetStrategy.EARLIEST); + } + + @Bean(name = "mockProducerTest") + public MockProducer createProducer() { + return new MockProducer<>(true, new StringSerializer(), new JsonSerializer()); + } +} 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..bfb3eb9f3 --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java @@ -0,0 +1,140 @@ +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.common.TopicPartition; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +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.account.Account; +import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.KafkaConfigTest; +import ru.spcex.clearing.account.utils.ImapEvent; +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.clearing.platform.messaging.service.sender.KafkaSender; +import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import static ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration.currentID; +import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = { + 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; + + @Autowired + @Qualifier("hazelcastServiceTest") + private HazelcastService hazelcastServiceTest; + + @Autowired + @Qualifier("kafkaSenderTest") + private KafkaSender kafkaSender; + + @Autowired + @Qualifier("mockConsumerTest") + private MockConsumer mockConsumer; + + @Test + void accountNew() throws InterruptedException { + //arrange + Long firstID = currentID.getAndIncrement(); + Long secondID = currentID.getAndIncrement(); + AccountSdfRequestPart accountSdfRequestPart = new AccountSdfRequestPart(); + accountSdfRequestPart.setSdfId(firstID); + accountSdfRequestPart.setAccount("123456789123"); + 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("123456789123"); + predictableAccount.setId(firstID); + + RequestInfo predictableRequestInfo = new RequestInfo(); + predictableRequestInfo.setId(secondID); + predictableRequestInfo.setStatus(Status.Processing); + + + //ACT + + hazelcastServiceTest.waitTillReadyState(); + //service set up + AccountService accountService = new AccountService(mockConsumer, hazelcastServiceTest, kafkaSender); + //callbacks set up + accountService.afterPropertiesSet(); + + //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); + + IMap accountIMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Account); + IMap requestInfoIMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_RequestInfo); + + ImapEvent imapEvent = new ImapEvent(requestInfoIMap); + imapEvent.waitHappened(); + //ASSERT + Account accountResult = accountIMap.get(firstID); + RequestInfo requestInfoResult = requestInfoIMap.get(secondID); + + 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 14077bfac..59e2a1304 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 @@ -18,6 +18,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.account.BankAccount; import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.KafkaConfigTest; +import ru.spcex.clearing.account.utils.ImapEvent; import ru.spcex.clearing.account.utils.MatcherFactory.Matcher; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -31,29 +33,36 @@ import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; import java.util.Collections; import java.util.HashMap; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration.currentID; import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = { - HazelcastServiceTestConfiguration.class}) + HazelcastServiceTestConfiguration.class, + KafkaConfigTest.class}) public class BankAccountServiceTest { public static final Matcher BANK_ACCOUNT_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 = currentID.getAndIncrement(); @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; + private MockConsumer mockConsumer; + + @Autowired + @Qualifier("mockProducerTest") private MockProducer mockProducer; + @BeforeEach void setUp() { mockConsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST); - mockProducer = new MockProducer<>(); } /** @@ -86,7 +95,7 @@ public class BankAccountServiceTest { BaseRequest baseNewRequest = new BaseRequest<>(); baseNewRequest.setRequestPayload(bankAccountNewRequest); - baseNewRequest.setId(currentId); + baseNewRequest.setId(ID); baseNewRequest.setActionType(ActionType.NEW); String jsonBaseNewRequest; ObjectMapper objectMapper = new ObjectMapper(); @@ -105,7 +114,15 @@ public class BankAccountServiceTest { predictableResult.setTaxpayerIdentificationNumber("848484848484"); predictableResult.setTaxRegistrationReasonCode("886886"); predictableResult.setAccount("123456789123"); - predictableResult.setId(currentId); + predictableResult.setId(ID); + + //ACT + hazelcastServiceTest.waitTillReadyState(); + //service set up + BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); + //callbacks set up + bankAccountService.afterPropertiesSet(); + //KAFKA mockConsumer.schedulePollTask(() -> { mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION))); @@ -118,24 +135,17 @@ public class BankAccountServiceTest { startOffsets.put(tp, 0L); mockConsumer.updateBeginningOffsets(startOffsets); - //ACT + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); - Thread.sleep(10000); - //callbacks set up - bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + //waiting for hazelcast map item updates + ImapEvent imapEvent = new ImapEvent(iMap); + imapEvent.waitHappened(); //ASSERT - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - BankAccount result = iMap.get(currentId); + BankAccount result = iMap.get(ID); BANK_ACCOUNT_MATCHER.assertMatch(result, predictableResult); - - //reset hazelcastService for next test - iMap.clear(); - currentId++; + assertTrue(mockProducer.history().get(0).topic().equalsIgnoreCase(Consts.REQUEST_INFO_UPDATE)); } /** @@ -155,30 +165,20 @@ public class BankAccountServiceTest { @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"); + BankAccount bankAccountExists = new BankAccount(); + bankAccountExists.setId(ID); + bankAccountExists.setBankName("ooo tinkoff"); + bankAccountExists.setBankIdentificationCode("99999"); + bankAccountExists.setCorrespondentAccount("9294189285498598598"); + bankAccountExists.setCorrespondentAccountName("BIK OF TINKOFF"); + bankAccountExists.setCurrency("RUB"); + bankAccountExists.setDestination("OOO ROGA I KOPITA"); + bankAccountExists.setTaxpayerIdentificationNumber("848484848484"); + bankAccountExists.setTaxRegistrationReasonCode("886886"); + bankAccountExists.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); - } BankAccountUpdateRequest bankAccountUpdateRequest = new BankAccountUpdateRequest(); - bankAccountUpdateRequest.setId(currentId); + bankAccountUpdateRequest.setId(ID); bankAccountUpdateRequest.setBankName("NEW BUNK NAME"); bankAccountUpdateRequest.setBankIdentificationCode("88888"); bankAccountUpdateRequest.setCorrespondentAccount("894984646541316"); @@ -191,9 +191,10 @@ public class BankAccountServiceTest { BaseRequest baseUpdateRequest = new BaseRequest<>(); baseUpdateRequest.setRequestPayload(bankAccountUpdateRequest); - baseUpdateRequest.setId(currentId); + baseUpdateRequest.setId(ID); baseUpdateRequest.setActionType(ActionType.UPDATE); String jsonBaseUpdateRequest; + ObjectMapper objectMapper = new ObjectMapper(); try { jsonBaseUpdateRequest = objectMapper.writeValueAsString(baseUpdateRequest); } catch (JsonProcessingException e) { @@ -209,25 +210,19 @@ public class BankAccountServiceTest { predictableUpdateResult.setTaxpayerIdentificationNumber("65468461321"); predictableUpdateResult.setTaxRegistrationReasonCode("532137"); predictableUpdateResult.setAccount("326984656514"); - 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); + predictableUpdateResult.setId(ID); //ACT + + hazelcastServiceTest.waitTillReadyState(); //service set up BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); - Thread.sleep(10000); //callbacks set up bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); + iMap.put(ID, bankAccountExists); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -239,16 +234,14 @@ public class BankAccountServiceTest { startOffsetsUpdating.put(tpUpdating, 0L); mockConsumer.updateBeginningOffsets(startOffsetsUpdating); - //ASSERT - Thread.sleep(10000); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - BankAccount resultUpdating = iMap.get(currentId); + //waiting for hazelcast map item updates + imapEvent.waitHappened(); + //ASSERT + BankAccount resultUpdating = iMap.get(ID); BANK_ACCOUNT_MATCHER.assertMatch(resultUpdating, predictableUpdateResult); - //reset hazelcastService for next test - iMap.clear(); - currentId++; + assertTrue(mockProducer.history().get(0).topic().equalsIgnoreCase(Consts.REQUEST_INFO_UPDATE)); } /** @@ -260,58 +253,42 @@ public class BankAccountServiceTest { @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); - } + BankAccount bankAccountExists = new BankAccount(); + bankAccountExists.setId(ID); + bankAccountExists.setBankName("ooo tinkoff"); + bankAccountExists.setBankIdentificationCode("99999"); + bankAccountExists.setCorrespondentAccount("9294189285498598598"); + bankAccountExists.setCorrespondentAccountName("BIK OF TINKOFF"); + bankAccountExists.setCurrency("RUB"); + bankAccountExists.setDestination("OOO ROGA I KOPITA"); + bankAccountExists.setTaxpayerIdentificationNumber("848484848484"); + bankAccountExists.setTaxRegistrationReasonCode("886886"); + bankAccountExists.setAccount("123456789123"); CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest(); - commonDeleteRequest.setId(currentId); + commonDeleteRequest.setId(ID); BaseRequest baseDeleteRequest = new BaseRequest<>(); baseDeleteRequest.setRequestPayload(commonDeleteRequest); - baseDeleteRequest.setId(currentId); + baseDeleteRequest.setId(ID); baseDeleteRequest.setActionType(ActionType.DELETE); + ObjectMapper objectMapper = new ObjectMapper(); 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); //ACT //service set up + hazelcastServiceTest.waitTillReadyState(); BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); - Thread.sleep(10000); //callbacks set up bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); + iMap.put(ID, bankAccountExists); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -323,13 +300,12 @@ public class BankAccountServiceTest { startOffsetsDeleting.put(tpDeleting, 0L); mockConsumer.updateBeginningOffsets(startOffsetsDeleting); + //waiting for hazelcast map item updates + imapEvent.waitHappened(); + //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++; + assertTrue(mockProducer.history().get(0).topic().equalsIgnoreCase(Consts.REQUEST_INFO_UPDATE)); } } \ 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..a59e6d06b --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java @@ -0,0 +1,50 @@ +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.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 waitHappened() throws InterruptedException { + 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/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java similarity index 100% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java 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 100% 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 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/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java similarity index 100% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java 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/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java similarity index 96% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java index 02d79864d..93b262279 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java @@ -14,7 +14,7 @@ public class BankAccountControllerConfig { @Autowired - @Qualifier("iOperator") + @Qualifier("iOperatorTest") private IOperator operator; @Autowired 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/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java similarity index 96% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java index 5a5aab4c0..791fad885 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java @@ -11,7 +11,7 @@ import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; @Configuration public class DeleteCompanyControllerConfig { @Autowired - @Qualifier("iOperator") + @Qualifier("iOperatorTest") private IOperator operator; @Autowired 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/queue/config/HazelcastServiceTestConfiguration.java similarity index 100% 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/queue/config/HazelcastServiceTestConfiguration.java 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/queue/config/IOperator.java similarity index 76% 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/queue/config/IOperator.java index 065785269..9c72ff30c 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/queue/config/IOperator.java @@ -6,6 +6,7 @@ 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.OperatorImpl; +import ru.spcex.clearing.backendapi.service.validation.ActionValidationProvider; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; @Configuration @@ -16,9 +17,9 @@ public class IOperator { private HazelcastService hazelcastServiceTest; @Autowired - @Bean + @Bean(name = "iOperatorTest") public OperatorImpl createIOperator(Producer kafka) { - return new OperatorImpl(kafka, hazelcastServiceTest); + return new OperatorImpl(kafka, hazelcastServiceTest, new ActionValidationProvider(hazelcastServiceTest)); } } 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/queue/config/Jackson2HttpConverterConfig.java similarity index 100% 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/queue/config/Jackson2HttpConverterConfig.java 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/queue/config/KafkaConfig.java similarity index 100% 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/queue/config/KafkaConfig.java 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/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java similarity index 100% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java 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/queue/utils/JsonUtil.java similarity index 100% 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/queue/utils/JsonUtil.java 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/queue/utils/MatcherFactory.java similarity index 100% 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/queue/utils/MatcherFactory.java From 614b78534425dc7ffa9c5406b3b7bf6a9ec67e8c Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 14 Nov 2022 14:01:39 +0300 Subject: [PATCH 03/15] fixing bug wit waiter imap --- .../ru/spcex/clearing/account/utils/ImapEvent.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 index a59e6d06b..095e18a2b 100644 --- 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 @@ -5,6 +5,8 @@ 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 { @@ -37,6 +39,14 @@ public class ImapEvent { } public void waitHappened() throws InterruptedException { + //running timer task as daemon thread + Timer timer = new Timer(true); + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + checkEventHappened.set(true);//если что-то пойдет не так не тормозить основной поток + } + }, 0, 60 * 1000); synchronized (checkEventHappened) { while (!checkEventHappened.get()) { checkEventHappened.wait(100); From 4fc3b9b4f56fbc1abe5e8d0f74d6d92ecebbd88b Mon Sep 17 00:00:00 2001 From: psemenkov Date: Wed, 23 Nov 2022 10:38:15 +0300 Subject: [PATCH 04/15] Correction of the error in the service-account and the service-company has been completed. Both service are successfully launched in maven. --- .../account/service/AccountServiceTest.java | 12 +- .../service/BankAccountServiceTest.java | 6 +- .../clearing/account/utils/ImapEvent.java | 7 +- .../HazelcastServiceTestConfiguration.java | 3 + .../ClearingMemberCategoryServiceTest.java | 103 ++++++++++-------- .../service/CompanyInfoServiceTest.java | 37 ++----- .../company/service/CompanyServiceTest.java | 25 +---- .../service/CompanySymbolServiceTest.java | 25 +---- .../company/service/ContactServiceTest.java | 24 +--- .../clearing/company/utils/ImapEvent.java | 63 +++++++++++ 10 files changed, 164 insertions(+), 141 deletions(-) create mode 100644 clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/utils/ImapEvent.java 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 index bfb3eb9f3..3cd2088b4 100644 --- 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 @@ -59,6 +59,16 @@ class AccountServiceTest { @Qualifier("mockConsumerTest") private MockConsumer mockConsumer; + /** + * {@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 @@ -129,7 +139,7 @@ class AccountServiceTest { IMap requestInfoIMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_RequestInfo); ImapEvent imapEvent = new ImapEvent(requestInfoIMap); - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT Account accountResult = accountIMap.get(firstID); RequestInfo requestInfoResult = requestInfoIMap.get(secondID); 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 59e2a1304..cccf8e390 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 @@ -139,7 +139,7 @@ public class BankAccountServiceTest { //waiting for hazelcast map item updates ImapEvent imapEvent = new ImapEvent(iMap); - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT BankAccount result = iMap.get(ID); @@ -235,7 +235,7 @@ public class BankAccountServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map item updates - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT BankAccount resultUpdating = iMap.get(ID); @@ -301,7 +301,7 @@ public class BankAccountServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsDeleting); //waiting for hazelcast map item updates - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT Assertions.assertEquals(0, iMap.size()); 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 index 095e18a2b..84c4f798c 100644 --- 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 @@ -38,13 +38,16 @@ public class ImapEvent { }, false); } - public void waitHappened() throws InterruptedException { + 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(true);//если что-то пойдет не так не тормозить основной поток + checkEventHappened.set(secondRan);//если что-то пойдет не так не тормозить основной поток + secondRan = true; } }, 0, 60 * 1000); synchronized (checkEventHappened) { 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); + } +} From 1ed81aec573306c4b63ada9525888e47886e0dd8 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 3 Oct 2022 13:03:28 +0300 Subject: [PATCH 05/15] fixing bug --- .../account/BankAccountControllerTest.java | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) 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/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java index e0705f548..792d57ff6 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java +++ b/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java @@ -1,15 +1,19 @@ package ru.spcex.clearing.backendapi.controller.queue.account; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.core.NestedExceptionUtils; import org.springframework.http.MediaType; -import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit.jupiter.SpringExtension; 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.clearing.classes.statics.data.account.BankAccount; import ru.spcex.clearing.backendapi.config.WebConfig; import ru.spcex.clearing.backendapi.controller.queue.config.*; import ru.spcex.clearing.backendapi.controller.queue.utils.MatcherFactory; @@ -17,8 +21,10 @@ import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNe 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.account.BankAccountBackendGetById; import ru.spcex.clearing.backendapi.domain.actions.IAction; import ru.spcex.clearing.backendapi.errors.ActionValidationException; +import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; import ru.spcex.clearing.platform.messaging.domain.ActionType; import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewRequest; @@ -31,13 +37,15 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static ru.spcex.clearing.backendapi.controller.queue.utils.JsonUtil.writeValue; -@SpringJUnitWebConfig(classes = { +@ContextConfiguration(classes = { WebConfig.class, IOperator.class, BankAccountControllerConfig.class, KafkaConfig.class, HazelcastServiceTestConfiguration.class, + StateLoaderImplConfig.class, Jackson2HttpConverterConfig.class}) +@ExtendWith(SpringExtension.class) class BankAccountControllerTest { public static final MatcherFactory.Matcher CUD_RESPONSE_MATCHER = MatcherFactory.usingIgnoringFieldsComparator(CudResponse.class); @@ -52,6 +60,10 @@ class BankAccountControllerTest { private MockMvc mockMvc; + @Autowired + @Qualifier("stateLoaderImpl") + private StateLoaderImpl stateLoader; + @Autowired private WebApplicationContext webApplicationContext; @@ -200,6 +212,40 @@ class BankAccountControllerTest { .andExpect(content().json(writeValue(extended))); } + @Test + void getById() throws Exception { + //ARRANGE + 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.setAccount("123456789123"); + predictableResult.setId(currentId.getAndIncrement()); + +// IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); +// iMap.put(ID, existsСlearingMemberCategory); + + BankAccountBackendGetById extended = new BankAccountBackendGetById(); + + //ACT + mockMvc.perform(MockMvcRequestBuilders.get(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))); + } + + @Test + void getAll() { + } + private void assertThrowsFor(IAction iAction) { assertThrows(ActionValidationException.class, () -> { try { From aa103cbf5f3afca34b6878e348f12eccf5484b01 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 14 Nov 2022 13:07:01 +0300 Subject: [PATCH 06/15] add AccountServiceTast --- .../HazelcastServiceTestConfiguration.java | 2 + .../account/config/KafkaConfigTest.java | 48 +++++ .../account/service/AccountServiceTest.java | 140 ++++++++++++++ .../service/BankAccountServiceTest.java | 178 ++++++++---------- .../clearing/account/utils/ImapEvent.java | 50 +++++ .../queue/AbstractControllerTest.java | 0 .../account/BankAccountControllerTest.java | 0 .../company/DeleteCompanyControllerTest.java | 0 .../config/BankAccountControllerConfig.java | 2 +- .../config/DeleteCompanyControllerConfig.java | 2 +- .../HazelcastServiceTestConfiguration.java | 0 .../controller/queue/config/IOperator.java | 0 .../config/Jackson2HttpConverterConfig.java | 0 .../controller/queue/config/KafkaConfig.java | 0 .../queue/config/StateLoaderImplConfig.java | 0 .../controller/queue/utils/JsonUtil.java | 0 .../queue/utils/MatcherFactory.java | 0 17 files changed, 319 insertions(+), 103 deletions(-) create mode 100644 clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java create mode 100644 clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java create mode 100644 clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/account/BankAccountControllerTest.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java (96%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java (96%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/HazelcastServiceTestConfiguration.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java (100%) rename clearing-parent/backend-api/src/test/{ => java}/ru/spcex/clearing/backendapi/controller/queue/utils/MatcherFactory.java (100%) 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..826001db9 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) { 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..78c210602 --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/config/KafkaConfigTest.java @@ -0,0 +1,48 @@ +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.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.annotation.Qualifier; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +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; +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(@Qualifier("mockProducerTest") 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(); + } + + @Bean(name = "mockConsumerTest") + public MockConsumer createConsumer() { + return new MockConsumer<>(OffsetResetStrategy.EARLIEST); + } + + @Bean(name = "mockProducerTest") + public MockProducer createProducer() { + return new MockProducer<>(true, new StringSerializer(), new JsonSerializer()); + } +} 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..bfb3eb9f3 --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/service/AccountServiceTest.java @@ -0,0 +1,140 @@ +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.common.TopicPartition; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +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.account.Account; +import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.KafkaConfigTest; +import ru.spcex.clearing.account.utils.ImapEvent; +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.clearing.platform.messaging.service.sender.KafkaSender; +import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import static ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration.currentID; +import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; + +@ExtendWith(SpringExtension.class) +@ContextConfiguration(classes = { + 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; + + @Autowired + @Qualifier("hazelcastServiceTest") + private HazelcastService hazelcastServiceTest; + + @Autowired + @Qualifier("kafkaSenderTest") + private KafkaSender kafkaSender; + + @Autowired + @Qualifier("mockConsumerTest") + private MockConsumer mockConsumer; + + @Test + void accountNew() throws InterruptedException { + //arrange + Long firstID = currentID.getAndIncrement(); + Long secondID = currentID.getAndIncrement(); + AccountSdfRequestPart accountSdfRequestPart = new AccountSdfRequestPart(); + accountSdfRequestPart.setSdfId(firstID); + accountSdfRequestPart.setAccount("123456789123"); + 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("123456789123"); + predictableAccount.setId(firstID); + + RequestInfo predictableRequestInfo = new RequestInfo(); + predictableRequestInfo.setId(secondID); + predictableRequestInfo.setStatus(Status.Processing); + + + //ACT + + hazelcastServiceTest.waitTillReadyState(); + //service set up + AccountService accountService = new AccountService(mockConsumer, hazelcastServiceTest, kafkaSender); + //callbacks set up + accountService.afterPropertiesSet(); + + //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); + + IMap accountIMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Account); + IMap requestInfoIMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_RequestInfo); + + ImapEvent imapEvent = new ImapEvent(requestInfoIMap); + imapEvent.waitHappened(); + //ASSERT + Account accountResult = accountIMap.get(firstID); + RequestInfo requestInfoResult = requestInfoIMap.get(secondID); + + 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 14077bfac..59e2a1304 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 @@ -18,6 +18,8 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit.jupiter.SpringExtension; import ru.clearing.classes.statics.data.account.BankAccount; import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.KafkaConfigTest; +import ru.spcex.clearing.account.utils.ImapEvent; import ru.spcex.clearing.account.utils.MatcherFactory.Matcher; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -31,29 +33,36 @@ import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; import java.util.Collections; import java.util.HashMap; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration.currentID; import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = { - HazelcastServiceTestConfiguration.class}) + HazelcastServiceTestConfiguration.class, + KafkaConfigTest.class}) public class BankAccountServiceTest { public static final Matcher BANK_ACCOUNT_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 = currentID.getAndIncrement(); @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; + private MockConsumer mockConsumer; + + @Autowired + @Qualifier("mockProducerTest") private MockProducer mockProducer; + @BeforeEach void setUp() { mockConsumer = new MockConsumer<>(OffsetResetStrategy.EARLIEST); - mockProducer = new MockProducer<>(); } /** @@ -86,7 +95,7 @@ public class BankAccountServiceTest { BaseRequest baseNewRequest = new BaseRequest<>(); baseNewRequest.setRequestPayload(bankAccountNewRequest); - baseNewRequest.setId(currentId); + baseNewRequest.setId(ID); baseNewRequest.setActionType(ActionType.NEW); String jsonBaseNewRequest; ObjectMapper objectMapper = new ObjectMapper(); @@ -105,7 +114,15 @@ public class BankAccountServiceTest { predictableResult.setTaxpayerIdentificationNumber("848484848484"); predictableResult.setTaxRegistrationReasonCode("886886"); predictableResult.setAccount("123456789123"); - predictableResult.setId(currentId); + predictableResult.setId(ID); + + //ACT + hazelcastServiceTest.waitTillReadyState(); + //service set up + BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); + //callbacks set up + bankAccountService.afterPropertiesSet(); + //KAFKA mockConsumer.schedulePollTask(() -> { mockConsumer.rebalance(Collections.singletonList(new TopicPartition(TOPIC_ACCOUNT_NEW, PARTITION))); @@ -118,24 +135,17 @@ public class BankAccountServiceTest { startOffsets.put(tp, 0L); mockConsumer.updateBeginningOffsets(startOffsets); - //ACT + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); - Thread.sleep(10000); - //callbacks set up - bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + //waiting for hazelcast map item updates + ImapEvent imapEvent = new ImapEvent(iMap); + imapEvent.waitHappened(); //ASSERT - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - BankAccount result = iMap.get(currentId); + BankAccount result = iMap.get(ID); BANK_ACCOUNT_MATCHER.assertMatch(result, predictableResult); - - //reset hazelcastService for next test - iMap.clear(); - currentId++; + assertTrue(mockProducer.history().get(0).topic().equalsIgnoreCase(Consts.REQUEST_INFO_UPDATE)); } /** @@ -155,30 +165,20 @@ public class BankAccountServiceTest { @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"); + BankAccount bankAccountExists = new BankAccount(); + bankAccountExists.setId(ID); + bankAccountExists.setBankName("ooo tinkoff"); + bankAccountExists.setBankIdentificationCode("99999"); + bankAccountExists.setCorrespondentAccount("9294189285498598598"); + bankAccountExists.setCorrespondentAccountName("BIK OF TINKOFF"); + bankAccountExists.setCurrency("RUB"); + bankAccountExists.setDestination("OOO ROGA I KOPITA"); + bankAccountExists.setTaxpayerIdentificationNumber("848484848484"); + bankAccountExists.setTaxRegistrationReasonCode("886886"); + bankAccountExists.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); - } BankAccountUpdateRequest bankAccountUpdateRequest = new BankAccountUpdateRequest(); - bankAccountUpdateRequest.setId(currentId); + bankAccountUpdateRequest.setId(ID); bankAccountUpdateRequest.setBankName("NEW BUNK NAME"); bankAccountUpdateRequest.setBankIdentificationCode("88888"); bankAccountUpdateRequest.setCorrespondentAccount("894984646541316"); @@ -191,9 +191,10 @@ public class BankAccountServiceTest { BaseRequest baseUpdateRequest = new BaseRequest<>(); baseUpdateRequest.setRequestPayload(bankAccountUpdateRequest); - baseUpdateRequest.setId(currentId); + baseUpdateRequest.setId(ID); baseUpdateRequest.setActionType(ActionType.UPDATE); String jsonBaseUpdateRequest; + ObjectMapper objectMapper = new ObjectMapper(); try { jsonBaseUpdateRequest = objectMapper.writeValueAsString(baseUpdateRequest); } catch (JsonProcessingException e) { @@ -209,25 +210,19 @@ public class BankAccountServiceTest { predictableUpdateResult.setTaxpayerIdentificationNumber("65468461321"); predictableUpdateResult.setTaxRegistrationReasonCode("532137"); predictableUpdateResult.setAccount("326984656514"); - 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); + predictableUpdateResult.setId(ID); //ACT + + hazelcastServiceTest.waitTillReadyState(); //service set up BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); - Thread.sleep(10000); //callbacks set up bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); + iMap.put(ID, bankAccountExists); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -239,16 +234,14 @@ public class BankAccountServiceTest { startOffsetsUpdating.put(tpUpdating, 0L); mockConsumer.updateBeginningOffsets(startOffsetsUpdating); - //ASSERT - Thread.sleep(10000); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); - BankAccount resultUpdating = iMap.get(currentId); + //waiting for hazelcast map item updates + imapEvent.waitHappened(); + //ASSERT + BankAccount resultUpdating = iMap.get(ID); BANK_ACCOUNT_MATCHER.assertMatch(resultUpdating, predictableUpdateResult); - //reset hazelcastService for next test - iMap.clear(); - currentId++; + assertTrue(mockProducer.history().get(0).topic().equalsIgnoreCase(Consts.REQUEST_INFO_UPDATE)); } /** @@ -260,58 +253,42 @@ public class BankAccountServiceTest { @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); - } + BankAccount bankAccountExists = new BankAccount(); + bankAccountExists.setId(ID); + bankAccountExists.setBankName("ooo tinkoff"); + bankAccountExists.setBankIdentificationCode("99999"); + bankAccountExists.setCorrespondentAccount("9294189285498598598"); + bankAccountExists.setCorrespondentAccountName("BIK OF TINKOFF"); + bankAccountExists.setCurrency("RUB"); + bankAccountExists.setDestination("OOO ROGA I KOPITA"); + bankAccountExists.setTaxpayerIdentificationNumber("848484848484"); + bankAccountExists.setTaxRegistrationReasonCode("886886"); + bankAccountExists.setAccount("123456789123"); CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest(); - commonDeleteRequest.setId(currentId); + commonDeleteRequest.setId(ID); BaseRequest baseDeleteRequest = new BaseRequest<>(); baseDeleteRequest.setRequestPayload(commonDeleteRequest); - baseDeleteRequest.setId(currentId); + baseDeleteRequest.setId(ID); baseDeleteRequest.setActionType(ActionType.DELETE); + ObjectMapper objectMapper = new ObjectMapper(); 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); //ACT //service set up + hazelcastServiceTest.waitTillReadyState(); BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); - Thread.sleep(10000); //callbacks set up bankAccountService.afterPropertiesSet(); - Thread.sleep(10000); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); + iMap.put(ID, bankAccountExists); + ImapEvent imapEvent = new ImapEvent(iMap); //KAFKA mockConsumer.schedulePollTask(() -> { @@ -323,13 +300,12 @@ public class BankAccountServiceTest { startOffsetsDeleting.put(tpDeleting, 0L); mockConsumer.updateBeginningOffsets(startOffsetsDeleting); + //waiting for hazelcast map item updates + imapEvent.waitHappened(); + //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++; + assertTrue(mockProducer.history().get(0).topic().equalsIgnoreCase(Consts.REQUEST_INFO_UPDATE)); } } \ 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..a59e6d06b --- /dev/null +++ b/clearing-parent/account-service/src/test/java/ru/spcex/clearing/account/utils/ImapEvent.java @@ -0,0 +1,50 @@ +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.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 waitHappened() throws InterruptedException { + 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/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java similarity index 100% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java 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 100% 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 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/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java similarity index 100% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/DeleteCompanyControllerTest.java 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/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java similarity index 96% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java index 02d79864d..93b262279 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java @@ -14,7 +14,7 @@ public class BankAccountControllerConfig { @Autowired - @Qualifier("iOperator") + @Qualifier("iOperatorTest") private IOperator operator; @Autowired 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/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java similarity index 96% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java index 5a5aab4c0..791fad885 100644 --- a/clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java @@ -11,7 +11,7 @@ import ru.spcex.clearing.backendapi.service.impl.StateLoaderImpl; @Configuration public class DeleteCompanyControllerConfig { @Autowired - @Qualifier("iOperator") + @Qualifier("iOperatorTest") private IOperator operator; @Autowired 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/queue/config/HazelcastServiceTestConfiguration.java similarity index 100% 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/queue/config/HazelcastServiceTestConfiguration.java 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/queue/config/IOperator.java similarity index 100% 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/queue/config/IOperator.java 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/queue/config/Jackson2HttpConverterConfig.java similarity index 100% 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/queue/config/Jackson2HttpConverterConfig.java 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/queue/config/KafkaConfig.java similarity index 100% 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/queue/config/KafkaConfig.java 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/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java similarity index 100% rename from clearing-parent/backend-api/src/test/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java 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/queue/utils/JsonUtil.java similarity index 100% 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/queue/utils/JsonUtil.java 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/queue/utils/MatcherFactory.java similarity index 100% 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/queue/utils/MatcherFactory.java From badbe47bc48ab31ae2f9ee365e245ff3c6e640e1 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 14 Nov 2022 14:01:39 +0300 Subject: [PATCH 07/15] fixing bug wit waiter imap --- .../ru/spcex/clearing/account/utils/ImapEvent.java | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 index a59e6d06b..095e18a2b 100644 --- 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 @@ -5,6 +5,8 @@ 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 { @@ -37,6 +39,14 @@ public class ImapEvent { } public void waitHappened() throws InterruptedException { + //running timer task as daemon thread + Timer timer = new Timer(true); + timer.scheduleAtFixedRate(new TimerTask() { + @Override + public void run() { + checkEventHappened.set(true);//если что-то пойдет не так не тормозить основной поток + } + }, 0, 60 * 1000); synchronized (checkEventHappened) { while (!checkEventHappened.get()) { checkEventHappened.wait(100); From a9fd8d86cabee3a397f82c9c46f535ebd40d0af8 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Wed, 23 Nov 2022 10:38:15 +0300 Subject: [PATCH 08/15] Correction of the error in the service-account and the service-company has been completed. Both service are successfully launched in maven. --- .../account/service/AccountServiceTest.java | 12 +- .../service/BankAccountServiceTest.java | 6 +- .../clearing/account/utils/ImapEvent.java | 7 +- .../HazelcastServiceTestConfiguration.java | 3 + .../ClearingMemberCategoryServiceTest.java | 103 ++++++++++-------- .../service/CompanyInfoServiceTest.java | 37 ++----- .../company/service/CompanyServiceTest.java | 25 +---- .../service/CompanySymbolServiceTest.java | 25 +---- .../company/service/ContactServiceTest.java | 24 +--- .../clearing/company/utils/ImapEvent.java | 63 +++++++++++ 10 files changed, 164 insertions(+), 141 deletions(-) create mode 100644 clearing-parent/company-service/src/test/java/ru/spcex/clearing/company/utils/ImapEvent.java 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 index bfb3eb9f3..3cd2088b4 100644 --- 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 @@ -59,6 +59,16 @@ class AccountServiceTest { @Qualifier("mockConsumerTest") private MockConsumer mockConsumer; + /** + * {@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 @@ -129,7 +139,7 @@ class AccountServiceTest { IMap requestInfoIMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_RequestInfo); ImapEvent imapEvent = new ImapEvent(requestInfoIMap); - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT Account accountResult = accountIMap.get(firstID); RequestInfo requestInfoResult = requestInfoIMap.get(secondID); 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 59e2a1304..cccf8e390 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 @@ -139,7 +139,7 @@ public class BankAccountServiceTest { //waiting for hazelcast map item updates ImapEvent imapEvent = new ImapEvent(iMap); - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT BankAccount result = iMap.get(ID); @@ -235,7 +235,7 @@ public class BankAccountServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsUpdating); //waiting for hazelcast map item updates - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT BankAccount resultUpdating = iMap.get(ID); @@ -301,7 +301,7 @@ public class BankAccountServiceTest { mockConsumer.updateBeginningOffsets(startOffsetsDeleting); //waiting for hazelcast map item updates - imapEvent.waitHappened(); + imapEvent.waitWhenHappened(); //ASSERT Assertions.assertEquals(0, iMap.size()); 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 index 095e18a2b..84c4f798c 100644 --- 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 @@ -38,13 +38,16 @@ public class ImapEvent { }, false); } - public void waitHappened() throws InterruptedException { + 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(true);//если что-то пойдет не так не тормозить основной поток + checkEventHappened.set(secondRan);//если что-то пойдет не так не тормозить основной поток + secondRan = true; } }, 0, 60 * 1000); synchronized (checkEventHappened) { 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); + } +} From 42529a8eed27c1c1cf957b5fd2ad67d045e67b20 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Thu, 1 Dec 2022 14:16:39 +0300 Subject: [PATCH 09/15] fixing bug --- clearing-parent/backend-api/pom.xml | 5 + .../queue/AbstractControllerTest.java | 7 +- .../account/BankAccountControllerTest.java | 97 +- .../controller/queue/config/IOperator.java | 2 +- ...a => Jackson2HttpConverterTestConfig.java} | 2 +- ...{KafkaConfig.java => KafkaTestConfig.java} | 2 +- .../queue/config/StateLoaderImplConfig.java | 14 +- .../queue/config/WebTestConfig.java | 34 + .../controller/queue/utils/JsonUtil.java | 2 +- .../GetResponseFactoryTestConfiguration.java | 5 +- .../src/test/resources/application.properties | 51 + .../backend-api/src/test/resources/meta.json | 6698 +++++++++++++++++ 12 files changed, 6867 insertions(+), 52 deletions(-) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/{Jackson2HttpConverterConfig.java => Jackson2HttpConverterTestConfig.java} (97%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/{KafkaConfig.java => KafkaTestConfig.java} (95%) create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/WebTestConfig.java create mode 100644 clearing-parent/backend-api/src/test/resources/application.properties create mode 100644 clearing-parent/backend-api/src/test/resources/meta.json diff --git a/clearing-parent/backend-api/pom.xml b/clearing-parent/backend-api/pom.xml index 974f8f46f..fe6637ee3 100644 --- a/clearing-parent/backend-api/pom.xml +++ b/clearing-parent/backend-api/pom.xml @@ -87,6 +87,11 @@ reflections 0.9.11 + + org.springframework.boot + spring-boot-test-autoconfigure + test + 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 index 4b941266d..fbee7a052 100644 --- 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 @@ -8,7 +8,6 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilde 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.*; @@ -17,14 +16,14 @@ import java.util.concurrent.atomic.AtomicLong; @SpringJUnitWebConfig(classes = { - WebConfig.class, + WebTestConfig.class, IOperator.class, StateLoaderImplConfig.class, DeleteCompanyController.class, BankAccountControllerConfig.class, - KafkaConfig.class, + KafkaTestConfig.class, HazelcastServiceTestConfiguration.class, - Jackson2HttpConverterConfig.class}) + Jackson2HttpConverterTestConfig.class}) public abstract class AbstractControllerTest { protected static final AtomicLong currentId = new AtomicLong(); private static final CharacterEncodingFilter CHARACTER_ENCODING_FILTER = new CharacterEncodingFilter(); diff --git a/clearing-parent/backend-api/src/test/java/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 index 792d57ff6..22db40cd9 100644 --- a/clearing-parent/backend-api/src/test/java/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,12 +1,15 @@ package ru.spcex.clearing.backendapi.controller.queue.account; +import com.hazelcast.core.IMap; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; 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.core.NestedExceptionUtils; import org.springframework.http.MediaType; 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.request.MockMvcRequestBuilders; @@ -14,7 +17,6 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.filter.CharacterEncodingFilter; import ru.clearing.classes.statics.data.account.BankAccount; -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.spcex.clearing.backendapi.controller.request.cud.account.BankAccountNewAction; @@ -22,11 +24,13 @@ import ru.spcex.clearing.backendapi.controller.request.cud.account.BankAccountUp 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.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.backendapi.service.impl.StateLoaderImpl; +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 ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; import javax.annotation.PostConstruct; import java.util.concurrent.atomic.AtomicLong; @@ -38,14 +42,16 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static ru.spcex.clearing.backendapi.controller.queue.utils.JsonUtil.writeValue; @ContextConfiguration(classes = { - WebConfig.class, + WebTestConfig.class, IOperator.class, BankAccountControllerConfig.class, - KafkaConfig.class, + KafkaTestConfig.class, HazelcastServiceTestConfiguration.class, StateLoaderImplConfig.class, - Jackson2HttpConverterConfig.class}) + Jackson2HttpConverterTestConfig.class}) @ExtendWith(SpringExtension.class) +@WebMvcTest(controllers = BankAccountController.class) +@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/") class BankAccountControllerTest { public static final MatcherFactory.Matcher CUD_RESPONSE_MATCHER = MatcherFactory.usingIgnoringFieldsComparator(CudResponse.class); @@ -61,8 +67,8 @@ class BankAccountControllerTest { private MockMvc mockMvc; @Autowired - @Qualifier("stateLoaderImpl") - private StateLoaderImpl stateLoader; + @Qualifier("hazelcastServiceTest") + private HazelcastService hazelcastServiceTest; @Autowired private WebApplicationContext webApplicationContext; @@ -104,19 +110,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))) .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))); } /** @@ -174,10 +180,10 @@ 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) @@ -186,7 +192,7 @@ class BankAccountControllerTest { // ASSERT .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().json(writeValue(extended))); + .andExpect(content().json(writeValue(expected))); } @@ -198,10 +204,10 @@ class BankAccountControllerTest { @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)) @@ -209,37 +215,48 @@ class BankAccountControllerTest { // ASSERT .andExpect(status().isOk()) .andExpect(content().contentTypeCompatibleWith(MediaType.APPLICATION_JSON)) - .andExpect(content().json(writeValue(extended))); + .andExpect(content().json(writeValue(expected))); } @Test void getById() throws Exception { //ARRANGE - 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.setAccount("123456789123"); - predictableResult.setId(currentId.getAndIncrement()); + 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.setAccount("123456789123"); + existBankAccount.setId(currentId.get()); -// IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_ClearingMemberCategory); -// iMap.put(ID, existsСlearingMemberCategory); - - BankAccountBackendGetById extended = new BankAccountBackendGetById(); + 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.setAccount("123456789123"); + payload.setId(existBankAccount.getId()); + expected.setPayload(payload); //ACT - mockMvc.perform(MockMvcRequestBuilders.get(REST_URL + "0") + mockMvc.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))); } @Test diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java index 9b6d845e9..a0de9423c 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/IOperator.java @@ -17,7 +17,7 @@ public class IOperator { 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/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterTestConfig.java similarity index 97% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterTestConfig.java index a1f8c5bea..3be434c96 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterTestConfig.java @@ -9,7 +9,7 @@ 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()); diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaTestConfig.java similarity index 95% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaTestConfig.java index e8c020252..94d776bca 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaTestConfig.java @@ -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/queue/config/StateLoaderImplConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java index b566a6bbc..6c91b40f0 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java @@ -4,19 +4,29 @@ 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 StateLoaderImplConfig { @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; + @Autowired + @Bean(name = "responseFactoryTest") + public GetResponseFactory createStateLoaderImpl(@Qualifier("metaJsonTest") MetaServer meta) { + return new GetResponseFactory(meta); + } @Bean(name = "stateLoaderImpl") - public StateLoaderImpl createIOperator() { - return new StateLoaderImpl(hazelcastServiceTest); + 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/queue/config/WebTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/WebTestConfig.java new file mode 100644 index 000000000..daae28acf --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/WebTestConfig.java @@ -0,0 +1,34 @@ +package ru.spcex.clearing.backendapi.controller.queue.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/utils/JsonUtil.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java index 2780f9465..805a7df9f 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/utils/JsonUtil.java @@ -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.queue.config.Jackson2HttpConverterTestConfig.JacksonObjectMapper.getMapper; public class JsonUtil { 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 From 40c716d159721c36a715984aaa9a22576d8d2444 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Thu, 1 Dec 2022 17:57:43 +0300 Subject: [PATCH 10/15] fixing bug in test --- .../queue/AbstractControllerTest.java | 27 +++- .../account/BankAccountControllerTest.java | 129 ++++++++---------- .../company/DeleteCompanyControllerTest.java | 44 +++++- 3 files changed, 122 insertions(+), 78 deletions(-) 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 index fbee7a052..38849e942 100644 --- 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 @@ -1,7 +1,12 @@ package ru.spcex.clearing.backendapi.controller.queue; +import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; +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; @@ -10,20 +15,25 @@ import org.springframework.web.context.WebApplicationContext; import org.springframework.web.filter.CharacterEncodingFilter; import ru.spcex.clearing.backendapi.controller.queue.company.DeleteCompanyController; import ru.spcex.clearing.backendapi.controller.queue.config.*; +import ru.spcex.clearing.backendapi.meta.GetResponseFactory; +import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; import javax.annotation.PostConstruct; import java.util.concurrent.atomic.AtomicLong; -@SpringJUnitWebConfig(classes = { +@ContextConfiguration(classes = { + BankAccountControllerConfig.class, + DeleteCompanyController.class, WebTestConfig.class, IOperator.class, - StateLoaderImplConfig.class, - DeleteCompanyController.class, - BankAccountControllerConfig.class, KafkaTestConfig.class, HazelcastServiceTestConfiguration.class, + StateLoaderImplConfig.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 { protected static final AtomicLong currentId = new AtomicLong(); private static final CharacterEncodingFilter CHARACTER_ENCODING_FILTER = new CharacterEncodingFilter(); @@ -33,8 +43,13 @@ public abstract class AbstractControllerTest { CHARACTER_ENCODING_FILTER.setForceEncoding(true); } + @Autowired + @Qualifier("hazelcastServiceTest") + protected HazelcastService hazelcastServiceTest; + @Autowired + @Qualifier("responseFactoryTest") + protected GetResponseFactory responseFactory; private MockMvc mockMvc; - @Autowired private WebApplicationContext webApplicationContext; diff --git a/clearing-parent/backend-api/src/test/java/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 index 22db40cd9..0d237031f 100644 --- a/clearing-parent/backend-api/src/test/java/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 @@ -2,27 +2,16 @@ package ru.spcex.clearing.backendapi.controller.queue.account; import com.hazelcast.core.IMap; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.ExtendWith; -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.core.NestedExceptionUtils; import org.springframework.http.MediaType; -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.request.MockMvcRequestBuilders; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.filter.CharacterEncodingFilter; import ru.clearing.classes.statics.data.account.BankAccount; -import ru.spcex.clearing.backendapi.controller.queue.config.*; -import ru.spcex.clearing.backendapi.controller.queue.utils.MatcherFactory; +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; @@ -30,10 +19,9 @@ 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 ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; -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; @@ -41,46 +29,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static ru.spcex.clearing.backendapi.controller.queue.utils.JsonUtil.writeValue; -@ContextConfiguration(classes = { - WebTestConfig.class, - IOperator.class, - BankAccountControllerConfig.class, - KafkaTestConfig.class, - HazelcastServiceTestConfiguration.class, - StateLoaderImplConfig.class, - Jackson2HttpConverterTestConfig.class}) -@ExtendWith(SpringExtension.class) -@WebMvcTest(controllers = BankAccountController.class) -@TestPropertySource(properties = "spring.config.location=D:/repo/mfd/clearing/clearing-parent/backend-api/src/main/resources/") -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 - @Qualifier("hazelcastServiceTest") - private HazelcastService hazelcastServiceTest; - - @Autowired - private WebApplicationContext webApplicationContext; - - @PostConstruct - private void postConstruct() { - mockMvc = MockMvcBuilders - .webAppContextSetup(webApplicationContext) - .addFilter(CHARACTER_ENCODING_FILTER) -// .apply(springSecurity()) - .build(); - } /** * {@link BankAccountController#add(BankAccountNewAction)}
@@ -115,9 +65,9 @@ class BankAccountControllerTest { 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 .andExpect(status().isOk()) @@ -185,9 +135,9 @@ class BankAccountControllerTest { 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 .andExpect(status().isOk()) @@ -195,11 +145,10 @@ class BankAccountControllerTest { .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 { @@ -209,15 +158,21 @@ class BankAccountControllerTest { 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 + //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 @@ -250,8 +205,8 @@ class BankAccountControllerTest { payload.setId(existBankAccount.getId()); expected.setPayload(payload); //ACT - mockMvc.perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId()) - .contentType(MediaType.APPLICATION_JSON)) + perform(MockMvcRequestBuilders.get(REST_URL + existBankAccount.getId()) + .contentType(MediaType.APPLICATION_JSON)) .andDo(print())//output to the log request and response // ASSERT .andExpect(status().isOk()) @@ -259,14 +214,48 @@ class BankAccountControllerTest { .andExpect(content().json(writeValue(expected))); } + /** + * {@link BankAccountController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Входной запрос /securities/bank-accounts/
+ * Ответ CommonGetAllResponse
+ */ @Test - void getAll() { + 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.setAccount("123456789123"); + 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; 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 index 1673abc9d..ea9c096bc 100644 --- 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 @@ -1,13 +1,20 @@ 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; @@ -19,7 +26,7 @@ class DeleteCompanyControllerTest extends AbstractControllerTest { /** * {@link DeleteCompanyController#delete(Long)}
* Тест проверяет получение id сущности {@link Long} по REST API и отправку в Apache Kafka.
- * Входной запрос {@link Long}: - 0L
+ * Входной запрос /companies/{@link Long}: - 0L
*/ @Test void delete() throws Exception { @@ -32,9 +39,42 @@ class DeleteCompanyControllerTest extends AbstractControllerTest { perform(MockMvcRequestBuilders.delete(REST_URL + "0") .contentType(MediaType.APPLICATION_JSON)) .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))); } + + /** + * {@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 From d661fa166fbe940b78efc9e1794de23b45c28b6e Mon Sep 17 00:00:00 2001 From: psemenkov Date: Fri, 2 Dec 2022 18:55:30 +0300 Subject: [PATCH 11/15] added new test --- .../HazelcastServiceTestConfiguration.java | 2 +- .../IOperatorTest.java} | 4 +- .../Jackson2HttpConverterTestConfig.java | 2 +- .../{queue => }/config/KafkaTestConfig.java | 2 +- .../config/StateLoaderImplConfig.java | 2 +- .../{queue => }/config/WebTestConfig.java | 2 +- .../queue/AbstractControllerTest.java | 22 ++- .../queue/account/AccountControllerTest.java | 53 ++++++ .../account/BankAccountControllerTest.java | 2 +- .../company/DeleteCompanyControllerTest.java | 2 +- ...tClearingMemberCategoryControllerTest.java | 173 ++++++++++++++++++ .../EditCompanyInfoControllerTest.java | 126 +++++++++++++ .../EditCompanySymbolControllerTest.java | 129 +++++++++++++ .../company/EditContactControllerTest.java | 130 +++++++++++++ .../ProfileDocumentControllerTest.java | 64 +++++++ .../config/BankAccountControllerConfig.java | 28 --- .../config/DeleteCompanyControllerConfig.java | 25 --- .../misc/NotificationControllerTest.java | 59 ++++++ .../{queue => }/utils/JsonUtil.java | 4 +- .../{queue => }/utils/MatcherFactory.java | 2 +- 20 files changed, 764 insertions(+), 69 deletions(-) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/config/HazelcastServiceTestConfiguration.java (98%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue/config/IOperator.java => config/IOperatorTest.java} (92%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/config/Jackson2HttpConverterTestConfig.java (97%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/config/KafkaTestConfig.java (90%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/config/StateLoaderImplConfig.java (95%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/config/WebTestConfig.java (95%) create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/account/AccountControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditClearingMemberCategoryControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanyInfoControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditCompanySymbolControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/EditContactControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/company/ProfileDocumentControllerTest.java delete mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java delete mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/NotificationControllerTest.java rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/utils/JsonUtil.java (88%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/{queue => }/utils/MatcherFactory.java (98%) diff --git a/clearing-parent/backend-api/src/test/java/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/java/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/java/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/java/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 92% rename from clearing-parent/backend-api/src/test/java/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 a0de9423c..e82944594 100644 --- a/clearing-parent/backend-api/src/test/java/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,7 +10,7 @@ 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") diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java similarity index 97% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterTestConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java index 3be434c96..d18cf9257 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/Jackson2HttpConverterTestConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java @@ -1,4 +1,4 @@ -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; diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/KafkaTestConfig.java similarity index 90% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaTestConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/KafkaTestConfig.java index 94d776bca..6d9e85277 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/KafkaTestConfig.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; diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplConfig.java similarity index 95% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplConfig.java index 6c91b40f0..77afaa372 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/StateLoaderImplConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplConfig.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; +package ru.spcex.clearing.backendapi.controller.config; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/WebTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebTestConfig.java similarity index 95% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/WebTestConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebTestConfig.java index daae28acf..b29a3b35b 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/WebTestConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebTestConfig.java @@ -1,4 +1,4 @@ -package ru.spcex.clearing.backendapi.controller.queue.config; +package ru.spcex.clearing.backendapi.controller.config; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.context.annotation.Bean; 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 index 38849e942..bc40b6491 100644 --- 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 @@ -13,8 +13,11 @@ import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilde 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.queue.company.DeleteCompanyController; -import ru.spcex.clearing.backendapi.controller.queue.config.*; +import ru.spcex.clearing.backendapi.controller.config.*; +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.meta.GetResponseFactory; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; @@ -23,10 +26,21 @@ import java.util.concurrent.atomic.AtomicLong; @ContextConfiguration(classes = { - BankAccountControllerConfig.class, + //account + AccountController.class, + BankAccountController.class, + //company DeleteCompanyController.class, + EditClearingMemberCategoryController.class, + EditCompanyInfoController.class, + EditCompanySymbolController.class, + EditContactController.class, + ProfileDocumentController.class, + //misc + NotificationController.class, + //***************************** WebTestConfig.class, - IOperator.class, + IOperatorTest.class, KafkaTestConfig.class, HazelcastServiceTestConfiguration.class, StateLoaderImplConfig.class, 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..55466ec24 --- /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 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.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 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()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Account); + 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))); + } +} \ No newline at end of file diff --git a/clearing-parent/backend-api/src/test/java/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 index 0d237031f..3c415c743 100644 --- a/clearing-parent/backend-api/src/test/java/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 @@ -27,7 +27,7 @@ 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; class BankAccountControllerTest extends AbstractControllerTest { private static final String REST_URL = "/securities/bank-accounts/"; 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 index ea9c096bc..e2c9251b8 100644 --- 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 @@ -18,7 +18,7 @@ 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.queue.utils.JsonUtil.writeValue; +import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; class DeleteCompanyControllerTest extends AbstractControllerTest { private static final String REST_URL = "/companies/"; 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..35c9237fc --- /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_BankAccount.
+ * Входной запрос /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..070d89804 --- /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_BankAccount.
+ * Входной запрос /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..4ff457db8 --- /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_BankAccount.
+ * Входной запрос /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..1edb4516b --- /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_BankAccount.
+ * Входной запрос /contacts/
+ * Ответ 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/config/BankAccountControllerConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/BankAccountControllerConfig.java deleted file mode 100644 index 93b262279..000000000 --- a/clearing-parent/backend-api/src/test/java/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("iOperatorTest") - 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/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/config/DeleteCompanyControllerConfig.java deleted file mode 100644 index 791fad885..000000000 --- a/clearing-parent/backend-api/src/test/java/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("iOperatorTest") - 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/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..e75f09dac --- /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_BankAccount.
+ * Входной запрос /contacts/
+ * Ответ 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/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/java/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 805a7df9f..cfbac9b79 100644 --- a/clearing-parent/backend-api/src/test/java/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.Jackson2HttpConverterTestConfig.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/java/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/java/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/java/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; From 673fc05e43af40233079be26ec42627c1471fda2 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Tue, 6 Dec 2022 12:31:39 +0300 Subject: [PATCH 12/15] added new test payment, scheduler --- clearing-parent/backend-api/pom.xml | 32 ++-- .../Jackson2HttpConverterTestConfig.java | 15 +- .../controller/config/MessagesTestConfig.java | 28 +++ ...ig.java => StateLoaderImplTestConfig.java} | 4 +- .../config/WebSecurityTestConfigurer.java | 41 +++++ .../queue/AbstractControllerTest.java | 18 +- ...tClearingMemberCategoryControllerTest.java | 2 +- .../EditCompanySymbolControllerTest.java | 2 +- .../company/EditContactControllerTest.java | 2 +- .../ProfileDocumentControllerTest.java | 4 +- .../misc/NotificationControllerTest.java | 4 +- .../queue/misc/SessionControllerTest.java | 54 ++++++ .../PaymentInstructionControllerTest.java | 77 ++++++++ .../SchedulerAllTodayControllerTest.java | 61 +++++++ .../scheduler/SchedulerControllerTest.java | 59 ++++++ .../scheduler/TaskRunnerControllerTest.java | 169 ++++++++++++++++++ .../meta/GetResponseFactoryTest.java | 1 - 17 files changed, 539 insertions(+), 34 deletions(-) create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/MessagesTestConfig.java rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/{StateLoaderImplConfig.java => StateLoaderImplTestConfig.java} (93%) create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/WebSecurityTestConfigurer.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/misc/SessionControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/payment/PaymentInstructionControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerAllTodayControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerControllerTest.java create mode 100644 clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/TaskRunnerControllerTest.java diff --git a/clearing-parent/backend-api/pom.xml b/clearing-parent/backend-api/pom.xml index fe6637ee3..b65c78a6c 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 @@ -92,17 +92,21 @@ 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/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java index d18cf9257..8abb52f95 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/Jackson2HttpConverterTestConfig.java @@ -4,6 +4,8 @@ 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; @@ -21,16 +23,13 @@ public class Jackson2HttpConverterTestConfig { 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/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/StateLoaderImplConfig.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplTestConfig.java similarity index 93% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplConfig.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplTestConfig.java index 77afaa372..8e4828f3c 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplConfig.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/config/StateLoaderImplTestConfig.java @@ -13,7 +13,7 @@ import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; @Configuration @Import({GetResponseFactoryTestConfiguration.class}) -public class StateLoaderImplConfig { +public class StateLoaderImplTestConfig { @Autowired @Qualifier("hazelcastServiceTest") @@ -25,7 +25,7 @@ public class StateLoaderImplConfig { return new GetResponseFactory(meta); } - @Bean(name = "stateLoaderImpl") + @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/queue/AbstractControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/AbstractControllerTest.java index bc40b6491..4ef207ea7 100644 --- 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 @@ -18,6 +18,11 @@ 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.SchedulerAllTodayController; +import ru.spcex.clearing.backendapi.controller.queue.scheduler.SchedulerController; +import ru.spcex.clearing.backendapi.controller.queue.scheduler.TaskRunnerController; import ru.spcex.clearing.backendapi.meta.GetResponseFactory; import ru.spcex.platform.imdg.iml.hazelcast.service.HazelcastService; @@ -38,12 +43,21 @@ import java.util.concurrent.atomic.AtomicLong; ProfileDocumentController.class, //misc NotificationController.class, - //***************************** + SessionController.class, + //payment + PaymentInstructionController.class, + //scheduler + SchedulerAllTodayController.class, + SchedulerController.class, + TaskRunnerController.class, + //******* common configs ******* WebTestConfig.class, IOperatorTest.class, KafkaTestConfig.class, HazelcastServiceTestConfiguration.class, - StateLoaderImplConfig.class, + StateLoaderImplTestConfig.class, + WebSecurityTestConfigurer.class, + MessagesTestConfig.class, Jackson2HttpConverterTestConfig.class}) @ExtendWith(SpringExtension.class) @WebMvcTest//(controllers = DeleteCompanyController.class) 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 index 35c9237fc..8b23a131d 100644 --- 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 @@ -124,7 +124,7 @@ class EditClearingMemberCategoryControllerTest extends AbstractControllerTest { /** * {@link EditClearingMemberCategoryController#getAll()}
- * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ClearingMemberCategory.
* Входной запрос /clearing-member-categories/
* Ответ CommonGetAllResponse
*/ 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 index 070d89804..157d217f5 100644 --- 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 @@ -79,7 +79,7 @@ class EditCompanySymbolControllerTest extends AbstractControllerTest { /** * {@link EditCompanySymbolController#getAll()}
- * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_CompanySymbols.
* Входной запрос /clearing-member-categories/
* Ответ CommonGetAllResponse
*/ 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 index 4ff457db8..bcd732ff7 100644 --- 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 @@ -80,7 +80,7 @@ class EditContactControllerTest extends AbstractControllerTest { /** * {@link EditContactController#getAll()}
- * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Contact.
* Входной запрос /contacts/
* Ответ CommonGetAllResponse
*/ 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 index 1edb4516b..95b798af2 100644 --- 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 @@ -23,8 +23,8 @@ class ProfileDocumentControllerTest extends AbstractControllerTest { /** * {@link ProfileDocumentController#getAll()}
- * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
- * Входной запрос /contacts/
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_ProfileDocument.
+ * Входной запрос /profile-documents/
* Ответ CommonGetAllResponse
*/ @Test 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 index e75f09dac..708cb12c3 100644 --- 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 @@ -24,8 +24,8 @@ class NotificationControllerTest extends AbstractControllerTest { /** * {@link NotificationController#getAll()}
- * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_BankAccount.
- * Входной запрос /contacts/
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Notification.
+ * Входной запрос /notifications/
* Ответ CommonGetAllResponse
*/ @Test 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..3fba79694 --- /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/SchedulerAllTodayControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerAllTodayControllerTest.java new file mode 100644 index 000000000..74d861c93 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerAllTodayControllerTest.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.SchedulerAllToday; +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 SchedulerAllTodayControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/schedule/schedulers-all-today/"; + + /** + * {@link SchedulerAllTodayController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_SchedulerAllToday.
+ * Входной запрос /schedule/schedulers-all-today/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + SchedulerAllToday schedulerAllToday = new SchedulerAllToday(); + schedulerAllToday.setTask("Task"); + schedulerAllToday.setTaskTime(LocalTime.now()); + schedulerAllToday.setClearingDate(LocalDate.now()); + schedulerAllToday.setMarket("Market"); + schedulerAllToday.setTaskStatus("Ok"); + schedulerAllToday.setSecurityId(10210L); + schedulerAllToday.setSource("Source"); + schedulerAllToday.setOrigId(1010L); + schedulerAllToday.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_SchedulerAllToday); + 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/SchedulerControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerControllerTest.java new file mode 100644 index 000000000..8169d1099 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerControllerTest.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.Scheduler; +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 SchedulerControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/schedule/schedulers/"; + + /** + * {@link SchedulerController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Scheduler.
+ * Входной запрос /schedule/schedulers/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + Scheduler scheduler = new Scheduler(); + 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_Scheduler); + 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/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/TaskRunnerControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/TaskRunnerControllerTest.java new file mode 100644 index 000000000..f224e2809 --- /dev/null +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/TaskRunnerControllerTest.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.TaskRunner; +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 TaskRunnerControllerTest extends AbstractControllerTest { + private static final String REST_URL = "/task-runners/"; + + /** + * {@link TaskRunnerController#getAll()}
+ * Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_TaskRunner.
+ * Входной запрос /task-runners/
+ * Ответ CommonGetAllResponse
+ */ + @Test + void getAll() throws Exception { + //ARRANGE + TaskRunner taskRunner = new TaskRunner(); + taskRunner.setTask("Task"); + taskRunner.setSenderId(10210L); + taskRunner.setId(currentId.get()); + + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_TaskRunner); + 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/meta/GetResponseFactoryTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java index a408322a5..3aea4aa28 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java @@ -1,7 +1,6 @@ package ru.spcex.clearing.backendapi.meta; import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; From 3f5c5fb98bb516e1ad74ae4201f8989f8d1269f8 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Tue, 6 Dec 2022 12:34:41 +0300 Subject: [PATCH 13/15] merged --- .../spcex/clearing/backendapi/meta/GetResponseFactoryTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java index 3aea4aa28..a408322a5 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/meta/GetResponseFactoryTest.java @@ -1,6 +1,7 @@ package ru.spcex.clearing.backendapi.meta; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; From e6e485d49033f78d735827cfa4c55e1aae917372 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Wed, 7 Dec 2022 17:21:52 +0300 Subject: [PATCH 14/15] fixing different for marge --- .../account/service/BankAccountServiceTest.java | 4 ---- .../queue/account/BankAccountControllerTest.java | 6 ------ ...llerTest.java => LauncherControllerTest.java} | 12 ++++++------ ...t.java => PlannerAllTodayControllerTest.java} | 16 ++++++++-------- ...ollerTest.java => PlannerControllerTest.java} | 12 ++++++------ 5 files changed, 20 insertions(+), 30 deletions(-) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/{TaskRunnerControllerTest.java => LauncherControllerTest.java} (95%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/{SchedulerAllTodayControllerTest.java => PlannerAllTodayControllerTest.java} (81%) rename clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/{SchedulerControllerTest.java => PlannerControllerTest.java} (85%) 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 cccf8e390..561f63469 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 @@ -113,7 +113,6 @@ public class BankAccountServiceTest { predictableResult.setDestination("OOO ROGA I KOPITA"); predictableResult.setTaxpayerIdentificationNumber("848484848484"); predictableResult.setTaxRegistrationReasonCode("886886"); - predictableResult.setAccount("123456789123"); predictableResult.setId(ID); //ACT @@ -175,7 +174,6 @@ public class BankAccountServiceTest { bankAccountExists.setDestination("OOO ROGA I KOPITA"); bankAccountExists.setTaxpayerIdentificationNumber("848484848484"); bankAccountExists.setTaxRegistrationReasonCode("886886"); - bankAccountExists.setAccount("123456789123"); BankAccountUpdateRequest bankAccountUpdateRequest = new BankAccountUpdateRequest(); bankAccountUpdateRequest.setId(ID); @@ -209,7 +207,6 @@ public class BankAccountServiceTest { predictableUpdateResult.setDestination("OOO NEW BUNK"); predictableUpdateResult.setTaxpayerIdentificationNumber("65468461321"); predictableUpdateResult.setTaxRegistrationReasonCode("532137"); - predictableUpdateResult.setAccount("326984656514"); predictableUpdateResult.setId(ID); //ACT @@ -263,7 +260,6 @@ public class BankAccountServiceTest { bankAccountExists.setDestination("OOO ROGA I KOPITA"); bankAccountExists.setTaxpayerIdentificationNumber("848484848484"); bankAccountExists.setTaxRegistrationReasonCode("886886"); - bankAccountExists.setAccount("123456789123"); CommonDeleteRequest commonDeleteRequest = new CommonDeleteRequest(); commonDeleteRequest.setId(ID); diff --git a/clearing-parent/backend-api/src/test/java/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 index 3c415c743..815b6c95c 100644 --- a/clearing-parent/backend-api/src/test/java/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 @@ -114,7 +114,6 @@ class BankAccountControllerTest extends AbstractControllerTest { * {@link BankAccountUpdateAction#destination} - destination
* {@link BankAccountUpdateAction#taxpayerIdentificationNumber} - 3664011397
* {@link BankAccountUpdateAction#taxRegistrationReasonCode} - 01
- * {@link BankAccountUpdateAction#account} - 11111222223333344444
*/ @Test void update() throws Exception { @@ -185,7 +184,6 @@ class BankAccountControllerTest extends AbstractControllerTest { existBankAccount.setDestination("OOO ROGA I KOPITA"); existBankAccount.setTaxpayerIdentificationNumber("848484848484"); existBankAccount.setTaxRegistrationReasonCode("886886"); - existBankAccount.setAccount("123456789123"); existBankAccount.setId(currentId.get()); IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); @@ -201,7 +199,6 @@ class BankAccountControllerTest extends AbstractControllerTest { payload.setDestination("OOO ROGA I KOPITA"); payload.setTaxpayerIdentificationNumber("848484848484"); payload.setTaxRegistrationReasonCode("886886"); - payload.setAccount("123456789123"); payload.setId(existBankAccount.getId()); expected.setPayload(payload); //ACT @@ -232,7 +229,6 @@ class BankAccountControllerTest extends AbstractControllerTest { existBankAccount.setDestination("OOO ROGA I KOPITA"); existBankAccount.setTaxpayerIdentificationNumber("848484848484"); existBankAccount.setTaxRegistrationReasonCode("886886"); - existBankAccount.setAccount("123456789123"); existBankAccount.setId(currentId.get()); IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_BankAccount); @@ -275,7 +271,6 @@ class BankAccountControllerTest extends AbstractControllerTest { bankAccountNewAction.setDestination(Destination); bankAccountNewAction.setTaxpayerIdentificationNumber(TaxpayerIdentificationNumber); bankAccountNewAction.setTaxRegistrationReasonCode(TaxRegistrationReasonCode); - bankAccountNewAction.setAccount(Account); return bankAccountNewAction; } @@ -291,7 +286,6 @@ class BankAccountControllerTest extends AbstractControllerTest { 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/scheduler/TaskRunnerControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/LauncherControllerTest.java similarity index 95% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/TaskRunnerControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/LauncherControllerTest.java index f224e2809..b8b55a42b 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/TaskRunnerControllerTest.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/LauncherControllerTest.java @@ -11,7 +11,7 @@ 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.TaskRunner; +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; @@ -37,11 +37,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; -class TaskRunnerControllerTest extends AbstractControllerTest { +class LauncherControllerTest extends AbstractControllerTest { private static final String REST_URL = "/task-runners/"; /** - * {@link TaskRunnerController#getAll()}
+ * {@link LauncherController#getAll()}
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_TaskRunner.
* Входной запрос /task-runners/
* Ответ CommonGetAllResponse
@@ -49,15 +49,15 @@ class TaskRunnerControllerTest extends AbstractControllerTest { @Test void getAll() throws Exception { //ARRANGE - TaskRunner taskRunner = new TaskRunner(); + Launcher taskRunner = new Launcher(); taskRunner.setTask("Task"); taskRunner.setSenderId(10210L); taskRunner.setId(currentId.get()); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_TaskRunner); + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Launcher); iMap.put(taskRunner.getId(), taskRunner); - Collection values = iMap.values(); + Collection values = iMap.values(); Collection> all = responseFactory.responseFromObjectCollection(values); CommonGetAllResponse expected = new CommonGetAllResponse(); expected.fromEntity(all); diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerAllTodayControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerAllTodayControllerTest.java similarity index 81% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerAllTodayControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerAllTodayControllerTest.java index 74d861c93..1133c7a05 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerAllTodayControllerTest.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerAllTodayControllerTest.java @@ -4,7 +4,7 @@ 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.SchedulerAllToday; +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; @@ -19,11 +19,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; -class SchedulerAllTodayControllerTest extends AbstractControllerTest { +class PlannerAllTodayControllerTest extends AbstractControllerTest { private static final String REST_URL = "/schedule/schedulers-all-today/"; /** - * {@link SchedulerAllTodayController#getAll()}
+ * {@link PlannerAllTodayController#getAll()}
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_SchedulerAllToday.
* Входной запрос /schedule/schedulers-all-today/
* Ответ CommonGetAllResponse
@@ -31,21 +31,21 @@ class SchedulerAllTodayControllerTest extends AbstractControllerTest { @Test void getAll() throws Exception { //ARRANGE - SchedulerAllToday schedulerAllToday = new SchedulerAllToday(); + 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.setSource("Source"); - schedulerAllToday.setOrigId(1010L); + schedulerAllToday.setParent("Source"); + schedulerAllToday.setParentId(1010L); schedulerAllToday.setId(currentId.get()); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_SchedulerAllToday); + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_PlannerAllToday); iMap.put(schedulerAllToday.getId(), schedulerAllToday); - Collection values = iMap.values(); + Collection values = iMap.values(); Collection> all = responseFactory.responseFromObjectCollection(values); CommonGetAllResponse expected = new CommonGetAllResponse(); expected.fromEntity(all); diff --git a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerControllerTest.java b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerControllerTest.java similarity index 85% rename from clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerControllerTest.java rename to clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerControllerTest.java index 8169d1099..744fc355e 100644 --- a/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/SchedulerControllerTest.java +++ b/clearing-parent/backend-api/src/test/java/ru/spcex/clearing/backendapi/controller/queue/scheduler/PlannerControllerTest.java @@ -4,7 +4,7 @@ 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.Scheduler; +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; @@ -19,11 +19,11 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import static ru.spcex.clearing.backendapi.controller.utils.JsonUtil.writeValue; -class SchedulerControllerTest extends AbstractControllerTest { +class PlannerControllerTest extends AbstractControllerTest { private static final String REST_URL = "/schedule/schedulers/"; /** - * {@link SchedulerController#getAll()}
+ * {@link PlannerController#getAll()}
* Тест проверяет получение запроса по REST API и отправку всех записей из таблицы hazelcast Map_Scheduler.
* Входной запрос /schedule/schedulers/
* Ответ CommonGetAllResponse
@@ -31,7 +31,7 @@ class SchedulerControllerTest extends AbstractControllerTest { @Test void getAll() throws Exception { //ARRANGE - Scheduler scheduler = new Scheduler(); + Planner scheduler = new Planner(); scheduler.setTask("Task"); scheduler.setTaskTime(LocalTime.now()); scheduler.setClearingDate(LocalDate.now()); @@ -40,10 +40,10 @@ class SchedulerControllerTest extends AbstractControllerTest { scheduler.setSecurityId(10210L); scheduler.setId(currentId.get()); - IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Scheduler); + IMap iMap = hazelcastServiceTest.getHazelcast().getMap(IMDGDistributedNames.Map_Planner); iMap.put(scheduler.getId(), scheduler); - Collection values = iMap.values(); + Collection values = iMap.values(); Collection> all = responseFactory.responseFromObjectCollection(values); CommonGetAllResponse expected = new CommonGetAllResponse(); expected.fromEntity(all); From 98c01a0c07534d6021347581168d3f74ce174e79 Mon Sep 17 00:00:00 2001 From: psemenkov Date: Mon, 30 Jan 2023 17:00:41 +0300 Subject: [PATCH 15/15] fixing bug. --- .../service/BankAccountServiceTest.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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 10cc195e0..c1620229c 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 @@ -17,7 +17,10 @@ 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.account.BankAccount; +import ru.spcex.clearing.account.config.ErrorResolverConfig; import ru.spcex.clearing.account.config.HazelcastServiceTestConfiguration; +import ru.spcex.clearing.account.config.ValidationConfig; +import ru.spcex.clearing.account.utils.ImapEvent; import ru.spcex.clearing.account.utils.MatcherFactory.Matcher; import ru.spcex.clearing.imdg.IMDGDistributedNames; import ru.spcex.clearing.platform.messaging.domain.ActionType; @@ -27,10 +30,14 @@ import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountNewReq import ru.spcex.clearing.platform.messaging.domain.cud.account.BankAccountUpdateRequest; import ru.spcex.clearing.platform.messaging.domain.cud.common.CommonDeleteRequest; 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 static org.junit.jupiter.api.Assertions.assertTrue; import static ru.spcex.clearing.account.utils.MatcherFactory.usingIgnoringFieldsComparator; @ExtendWith(SpringExtension.class) @@ -48,6 +55,13 @@ public class BankAccountServiceTest { @Autowired @Qualifier("hazelcastServiceTest") private HazelcastService hazelcastServiceTest; + + @Autowired + private IMessageResolver messageResolver; + + @Autowired + private Function bankAccountNewRequestValidator; + private MockConsumer mockConsumer; private MockProducer mockProducer; @@ -110,7 +124,7 @@ public class BankAccountServiceTest { //ACT hazelcastServiceTest.waitTillReadyState(); //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); + BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest, messageResolver, bankAccountNewRequestValidator); //callbacks set up bankAccountService.afterPropertiesSet(); @@ -205,7 +219,7 @@ public class BankAccountServiceTest { hazelcastServiceTest.waitTillReadyState(); //service set up - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); + BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest, messageResolver, bankAccountNewRequestValidator); //callbacks set up bankAccountService.afterPropertiesSet(); @@ -270,7 +284,7 @@ public class BankAccountServiceTest { //ACT //service set up hazelcastServiceTest.waitTillReadyState(); - BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest); + BankAccountService bankAccountService = new BankAccountService(mockConsumer, mockProducer, hazelcastServiceTest, messageResolver, bankAccountNewRequestValidator); //callbacks set up bankAccountService.afterPropertiesSet();