From b39c3ee18dc81fa03210b17d2a7f082ea06d95d0 Mon Sep 17 00:00:00 2001 From: Anatoly Cherkasov Date: Thu, 7 May 2020 13:05:35 +0300 Subject: [PATCH] PROX-413: bump libs (#4) * PROX-413: bump libs --- build_utils | 2 +- pom.xml | 24 +++++----- ...ation.java => CashregAtolApplication.java} | 4 +- .../configuration/HandlerConfiguration.java | 8 ++-- .../RestTemplateConfiguration.java | 1 - .../EntryStateToCommonRequestConverter.java | 6 +-- .../entry/CtxToEntryModelConverter.java | 20 ++++---- .../exit/ExitModelToProxyResultConverter.java | 26 +++++----- .../atol/handler/AtolServerHandler.java | 16 +++---- .../atol/processor/SuccessProcessor.java | 20 ++++---- ...dapterCashReg.java => AdapterCashreg.java} | 2 +- .../adapter/atol/service/atol/AtolClient.java | 2 +- .../adapter/atol/servlet/AdapterServlet.java | 6 +-- ...ator.java => CashregContextValidator.java} | 6 +-- src/main/resources/fixture/errors.json | 8 ++++ .../adapter/atol/IntegrationTest.java | 47 +++++++++---------- .../atol/handler/AtolServerHandlerTest.java | 18 ++++--- 17 files changed, 111 insertions(+), 105 deletions(-) rename src/main/java/com/rbkmoney/adapter/atol/{CashRegAtolApplication.java => CashregAtolApplication.java} (71%) rename src/main/java/com/rbkmoney/adapter/atol/service/atol/{AdapterCashReg.java => AdapterCashreg.java} (94%) rename src/main/java/com/rbkmoney/adapter/atol/validator/{CashRegContextValidator.java => CashregContextValidator.java} (88%) create mode 100644 src/main/resources/fixture/errors.json diff --git a/build_utils b/build_utils index 4a09386..cf6578d 160000 --- a/build_utils +++ b/build_utils @@ -1 +1 @@ -Subproject commit 4a09386542ab4b98317a787fd6e06e0d3a1e38d6 +Subproject commit cf6578dac794859b0495c812761ce5b94c11bbaf diff --git a/pom.xml b/pom.xml index 7fee3c9..387a50d 100644 --- a/pom.xml +++ b/pom.xml @@ -30,10 +30,11 @@ dr2.rbkmoney.com 0.3.6 5.2 - 1.0.1 0.6.9 1.18.4 - 0.0.8 + 1.0.5 + 1.14-25a9f63 + 0.0.23 1.10.2 UTF-8 UTF-8 @@ -44,12 +45,12 @@ com.rbkmoney adapter-cashreg-spring-boot-starter - 1.0.0 + 1.0.1 com.rbkmoney cashreg-proto - 1.9-9c79023 + ${cashreg-proto.version} @@ -59,7 +60,7 @@ com.rbkmoney error-mapping-java - 1.0.0 + ${error-mapping.version} org.springframework.boot @@ -99,12 +100,7 @@ com.rbkmoney.woody woody-thrift - 1.1.15 - - - com.rbkmoney.logback - nop-rolling - ${nop-rolling.version} + 1.1.16 com.rbkmoney @@ -115,6 +111,12 @@ com.rbkmoney adapter-common-lib ${adapter-common-lib.version} + + + com.rbkmoney + error-mapping-java + + com.rbkmoney diff --git a/src/main/java/com/rbkmoney/adapter/atol/CashRegAtolApplication.java b/src/main/java/com/rbkmoney/adapter/atol/CashregAtolApplication.java similarity index 71% rename from src/main/java/com/rbkmoney/adapter/atol/CashRegAtolApplication.java rename to src/main/java/com/rbkmoney/adapter/atol/CashregAtolApplication.java index a4106a8..7690a47 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/CashRegAtolApplication.java +++ b/src/main/java/com/rbkmoney/adapter/atol/CashregAtolApplication.java @@ -6,8 +6,8 @@ import org.springframework.boot.web.servlet.ServletComponentScan; @ServletComponentScan @SpringBootApplication -public class CashRegAtolApplication extends SpringApplication { +public class CashregAtolApplication extends SpringApplication { public static void main(String[] args) { - SpringApplication.run(CashRegAtolApplication.class, args); + SpringApplication.run(CashregAtolApplication.class, args); } } diff --git a/src/main/java/com/rbkmoney/adapter/atol/configuration/HandlerConfiguration.java b/src/main/java/com/rbkmoney/adapter/atol/configuration/HandlerConfiguration.java index 504ca37..4f8f10d 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/configuration/HandlerConfiguration.java +++ b/src/main/java/com/rbkmoney/adapter/atol/configuration/HandlerConfiguration.java @@ -1,8 +1,8 @@ package com.rbkmoney.adapter.atol.configuration; import com.rbkmoney.adapter.atol.handler.AtolServerHandler; -import com.rbkmoney.adapter.cashreg.spring.boot.starter.converter.CashRegAdapterServiceLogDecorator; -import com.rbkmoney.damsel.cashreg.provider.CashRegProviderSrv; +import com.rbkmoney.adapter.cashreg.spring.boot.starter.converter.CashregAdapterServiceLogDecorator; +import com.rbkmoney.damsel.cashreg.adapter.CashregAdapterSrv; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -12,8 +12,8 @@ public class HandlerConfiguration { @Bean @Autowired - public CashRegProviderSrv.Iface serverHandlerLogDecorator(AtolServerHandler atolServerHandler) { - return new CashRegAdapterServiceLogDecorator(atolServerHandler); + public CashregAdapterSrv.Iface serverHandlerLogDecorator(AtolServerHandler atolServerHandler) { + return new CashregAdapterServiceLogDecorator(atolServerHandler); } } diff --git a/src/main/java/com/rbkmoney/adapter/atol/configuration/RestTemplateConfiguration.java b/src/main/java/com/rbkmoney/adapter/atol/configuration/RestTemplateConfiguration.java index b7562f5..de2e806 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/configuration/RestTemplateConfiguration.java +++ b/src/main/java/com/rbkmoney/adapter/atol/configuration/RestTemplateConfiguration.java @@ -25,7 +25,6 @@ import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.time.Duration; - @Configuration public class RestTemplateConfiguration { diff --git a/src/main/java/com/rbkmoney/adapter/atol/converter/EntryStateToCommonRequestConverter.java b/src/main/java/com/rbkmoney/adapter/atol/converter/EntryStateToCommonRequestConverter.java index 1c89cc7..2a0f083 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/converter/EntryStateToCommonRequestConverter.java +++ b/src/main/java/com/rbkmoney/adapter/atol/converter/EntryStateToCommonRequestConverter.java @@ -10,7 +10,7 @@ import com.rbkmoney.adapter.atol.service.atol.model.Receipt; import com.rbkmoney.adapter.atol.service.atol.model.Service; import com.rbkmoney.adapter.atol.service.atol.model.request.CommonRequest; import com.rbkmoney.adapter.atol.service.atol.model.request.RequestWrapper; -import com.rbkmoney.adapter.cashreg.spring.boot.starter.config.properties.AdapterCashRegProperties; +import com.rbkmoney.adapter.cashreg.spring.boot.starter.config.properties.AdapterCashregProperties; import com.rbkmoney.adapter.cashreg.spring.boot.starter.constant.OptionalField; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.EntryStateModel; import lombok.RequiredArgsConstructor; @@ -27,7 +27,7 @@ public class EntryStateToCommonRequestConverter implements Converter convert(EntryStateModel entryStateModel) { @@ -64,7 +64,7 @@ public class EntryStateToCommonRequestConverter implements Converter( commonRequest, - entryStateModel.getOptions().getOrDefault(OptionalField.URL.getField(), adapterCashRegProperties.getUrl()), + entryStateModel.getOptions().getOrDefault(OptionalField.URL.getField(), adapterCashregProperties.getUrl()), entryStateModel.getOptions().get(OptionalField.GROUP.getField()), entryStateModel.getOptions().get(OptionalField.COMPANY_NAME.getField()), entryStateModel.getOptions().get(OptionalField.COMPANY_ADDRESS.getField()), diff --git a/src/main/java/com/rbkmoney/adapter/atol/converter/entry/CtxToEntryModelConverter.java b/src/main/java/com/rbkmoney/adapter/atol/converter/entry/CtxToEntryModelConverter.java index 6d7dec4..8fd0960 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/converter/entry/CtxToEntryModelConverter.java +++ b/src/main/java/com/rbkmoney/adapter/atol/converter/entry/CtxToEntryModelConverter.java @@ -4,15 +4,15 @@ package com.rbkmoney.adapter.atol.converter.entry; import com.rbkmoney.adapter.atol.service.atol.constant.PaymentType; import com.rbkmoney.adapter.cashreg.spring.boot.starter.constant.OptionalField; import com.rbkmoney.adapter.cashreg.spring.boot.starter.constant.TargetType; -import com.rbkmoney.adapter.cashreg.spring.boot.starter.converter.CashRegAdapterContextConverter; +import com.rbkmoney.adapter.cashreg.spring.boot.starter.converter.CashregAdapterContextConverter; import com.rbkmoney.adapter.cashreg.spring.boot.starter.flow.TargetTypeResolver; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.*; -import com.rbkmoney.damsel.cashreg.Cart; -import com.rbkmoney.damsel.cashreg.ItemsLine; -import com.rbkmoney.damsel.cashreg.provider.CashRegContext; -import com.rbkmoney.damsel.cashreg_domain.PaymentInfo; -import com.rbkmoney.damsel.cashreg_domain.RussianLegalEntity; -import com.rbkmoney.damsel.cashreg_domain.TaxMode; +import com.rbkmoney.damsel.cashreg.adapter.CashregContext; +import com.rbkmoney.damsel.cashreg.domain.PaymentInfo; +import com.rbkmoney.damsel.cashreg.domain.RussianLegalEntity; +import com.rbkmoney.damsel.cashreg.domain.TaxMode; +import com.rbkmoney.damsel.cashreg.receipt.Cart; +import com.rbkmoney.damsel.cashreg.receipt.ItemsLine; import lombok.RequiredArgsConstructor; import org.springframework.core.convert.converter.Converter; import org.springframework.stereotype.Component; @@ -25,12 +25,12 @@ import java.util.stream.Collectors; @Component @RequiredArgsConstructor -public class CtxToEntryModelConverter implements Converter { +public class CtxToEntryModelConverter implements Converter { - private final CashRegAdapterContextConverter cashRegAdapterContextConveter; + private final CashregAdapterContextConverter cashRegAdapterContextConveter; @Override - public EntryStateModel convert(CashRegContext context) { + public EntryStateModel convert(CashregContext context) { AdapterState adapterState = cashRegAdapterContextConveter.convert(context); Map options = context.getOptions(); diff --git a/src/main/java/com/rbkmoney/adapter/atol/converter/exit/ExitModelToProxyResultConverter.java b/src/main/java/com/rbkmoney/adapter/atol/converter/exit/ExitModelToProxyResultConverter.java index 6ec5dfa..63821e4 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/converter/exit/ExitModelToProxyResultConverter.java +++ b/src/main/java/com/rbkmoney/adapter/atol/converter/exit/ExitModelToProxyResultConverter.java @@ -7,9 +7,9 @@ import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.EntryStateModel; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.ExitStateModel; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.Step; import com.rbkmoney.adapter.cashreg.spring.boot.starter.state.serializer.AdapterSerializer; -import com.rbkmoney.adapter.cashreg.spring.boot.starter.utils.creators.CashRegProviderCreators; -import com.rbkmoney.damsel.cashreg.provider.CashRegResult; -import com.rbkmoney.damsel.cashreg.provider.Intent; +import com.rbkmoney.adapter.cashreg.spring.boot.starter.utils.creators.CashregAdapterCreators; +import com.rbkmoney.damsel.cashreg.adapter.CashregResult; +import com.rbkmoney.damsel.cashreg.adapter.Intent; import com.rbkmoney.damsel.domain.Failure; import com.rbkmoney.error.mapping.ErrorMapping; import lombok.RequiredArgsConstructor; @@ -25,14 +25,14 @@ import static java.time.temporal.ChronoUnit.MINUTES; @Component @RequiredArgsConstructor -public class ExitModelToProxyResultConverter implements Converter { +public class ExitModelToProxyResultConverter implements Converter { private final ErrorMapping errorMapping; private final TimerProperties timerProperties; private final AdapterSerializer serializer; @Override - public CashRegResult convert(ExitStateModel exitStateModel) { + public CashregResult convert(ExitStateModel exitStateModel) { EntryStateModel entryStateModel = exitStateModel.getEntryStateModel(); AdapterState adapterState = entryStateModel.getState().getAdapterContext(); if (adapterState.getMaxDateTimePolling() == null) { @@ -41,31 +41,31 @@ public class ExitModelToProxyResultConverter implements Converter options = entryStateModel.getOptions(); - intent = CashRegProviderCreators.createIntentWithSleepIntent(extractPollingDelay(options, timerProperties.getPollingDelay())); + intent = CashregAdapterCreators.createIntentWithSleepIntent(extractPollingDelay(options, timerProperties.getPollingDelay())); } if (Step.CREATE == adapterState.getNextStep()) { adapterState.setNextStep(Step.CHECK_STATUS); } - CashRegResult cashRegResult = new CashRegResult() + CashregResult cashRegResult = new CashregResult() .setIntent(intent) .setState(serializer.writeByte(adapterState)); - if (exitStateModel.getCashRegInfo() != null) { + if (exitStateModel.getInfo() != null) { entryStateModel.getState().getAdapterContext().setNextStep(Step.CHECK_STATUS); - cashRegResult.setCashregInfo(exitStateModel.getCashRegInfo()); + cashRegResult.setInfo(exitStateModel.getInfo()); } return cashRegResult; diff --git a/src/main/java/com/rbkmoney/adapter/atol/handler/AtolServerHandler.java b/src/main/java/com/rbkmoney/adapter/atol/handler/AtolServerHandler.java index 9153457..70c7b6c 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/handler/AtolServerHandler.java +++ b/src/main/java/com/rbkmoney/adapter/atol/handler/AtolServerHandler.java @@ -4,16 +4,16 @@ package com.rbkmoney.adapter.atol.handler; import com.rbkmoney.adapter.atol.converter.entry.CtxToEntryModelConverter; import com.rbkmoney.adapter.atol.converter.exit.ExitModelToProxyResultConverter; import com.rbkmoney.adapter.atol.service.atol.model.response.CommonResponse; -import com.rbkmoney.adapter.atol.validator.CashRegContextValidator; +import com.rbkmoney.adapter.atol.validator.CashregContextValidator; import com.rbkmoney.adapter.cashreg.spring.boot.starter.exception.UnsupportedMethodException; import com.rbkmoney.adapter.cashreg.spring.boot.starter.flow.StepResolver; import com.rbkmoney.adapter.cashreg.spring.boot.starter.handler.CommonHandler; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.EntryStateModel; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.ExitStateModel; import com.rbkmoney.adapter.common.Validator; -import com.rbkmoney.damsel.cashreg.provider.CashRegContext; -import com.rbkmoney.damsel.cashreg.provider.CashRegProviderSrv; -import com.rbkmoney.damsel.cashreg.provider.CashRegResult; +import com.rbkmoney.damsel.cashreg.adapter.CashregAdapterSrv; +import com.rbkmoney.damsel.cashreg.adapter.CashregContext; +import com.rbkmoney.damsel.cashreg.adapter.CashregResult; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.thrift.TException; @@ -28,18 +28,18 @@ import java.util.List; @Primary @Component @RequiredArgsConstructor -public class AtolServerHandler implements CashRegProviderSrv.Iface { +public class AtolServerHandler implements CashregAdapterSrv.Iface { private final CtxToEntryModelConverter ctxToEntryModelConverter; private final ExitModelToProxyResultConverter exitModelToProxyResultConverter; private final StepResolver stepResolver; - private final CashRegContextValidator cashRegContextValidator; + private final CashregContextValidator cashregContextValidator; private final List> handlers; @Override - public CashRegResult register(CashRegContext context) throws TException { + public CashregResult register(CashregContext context) throws TException { return handle( - cashRegContextValidator, + cashregContextValidator, ctxToEntryModelConverter, exitModelToProxyResultConverter, context diff --git a/src/main/java/com/rbkmoney/adapter/atol/processor/SuccessProcessor.java b/src/main/java/com/rbkmoney/adapter/atol/processor/SuccessProcessor.java index 310bd4b..2d50a14 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/processor/SuccessProcessor.java +++ b/src/main/java/com/rbkmoney/adapter/atol/processor/SuccessProcessor.java @@ -9,7 +9,7 @@ import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.EntryStateModel; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.ExitStateModel; import com.rbkmoney.adapter.cashreg.spring.boot.starter.model.Step; import com.rbkmoney.adapter.cashreg.spring.boot.starter.processor.Processor; -import com.rbkmoney.damsel.cashreg.CashRegInfo; +import com.rbkmoney.damsel.cashreg.receipt.ReceiptInfo; import lombok.RequiredArgsConstructor; @RequiredArgsConstructor @@ -25,18 +25,18 @@ public class SuccessProcessor implements Processor request); diff --git a/src/main/java/com/rbkmoney/adapter/atol/service/atol/AtolClient.java b/src/main/java/com/rbkmoney/adapter/atol/service/atol/AtolClient.java index ed3d1b3..7b338d4 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/service/atol/AtolClient.java +++ b/src/main/java/com/rbkmoney/adapter/atol/service/atol/AtolClient.java @@ -13,7 +13,7 @@ import org.springframework.http.ResponseEntity; @Getter @Setter @RequiredArgsConstructor -public class AtolClient implements AdapterCashReg { +public class AtolClient implements AdapterCashreg { private final AtolApi api; diff --git a/src/main/java/com/rbkmoney/adapter/atol/servlet/AdapterServlet.java b/src/main/java/com/rbkmoney/adapter/atol/servlet/AdapterServlet.java index 0484359..da0cc13 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/servlet/AdapterServlet.java +++ b/src/main/java/com/rbkmoney/adapter/atol/servlet/AdapterServlet.java @@ -1,6 +1,6 @@ package com.rbkmoney.adapter.atol.servlet; -import com.rbkmoney.damsel.cashreg.provider.CashRegProviderSrv; +import com.rbkmoney.damsel.cashreg.adapter.CashregAdapterSrv; import com.rbkmoney.woody.thrift.impl.http.THServiceBuilder; import lombok.RequiredArgsConstructor; @@ -12,14 +12,14 @@ import java.io.IOException; @WebServlet("/adapter/cashreg/atol") public class AdapterServlet extends GenericServlet { - private final CashRegProviderSrv.Iface handler; + private final CashregAdapterSrv.Iface handler; private Servlet servlet; @Override public void init(ServletConfig config) throws ServletException { super.init(config); - servlet = new THServiceBuilder().build(CashRegProviderSrv.Iface.class, handler); + servlet = new THServiceBuilder().build(CashregAdapterSrv.Iface.class, handler); } @Override diff --git a/src/main/java/com/rbkmoney/adapter/atol/validator/CashRegContextValidator.java b/src/main/java/com/rbkmoney/adapter/atol/validator/CashregContextValidator.java similarity index 88% rename from src/main/java/com/rbkmoney/adapter/atol/validator/CashRegContextValidator.java rename to src/main/java/com/rbkmoney/adapter/atol/validator/CashregContextValidator.java index 356e835..2d58e7b 100644 --- a/src/main/java/com/rbkmoney/adapter/atol/validator/CashRegContextValidator.java +++ b/src/main/java/com/rbkmoney/adapter/atol/validator/CashregContextValidator.java @@ -2,7 +2,7 @@ package com.rbkmoney.adapter.atol.validator; import com.rbkmoney.adapter.cashreg.spring.boot.starter.constant.OptionalField; import com.rbkmoney.adapter.common.Validator; -import com.rbkmoney.damsel.cashreg.provider.CashRegContext; +import com.rbkmoney.damsel.cashreg.adapter.CashregContext; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -11,10 +11,10 @@ import java.util.Objects; @Component @RequiredArgsConstructor -public class CashRegContextValidator implements Validator { +public class CashregContextValidator implements Validator { @Override - public void validate(CashRegContext context) { + public void validate(CashregContext context) { Map options = context.getOptions(); validateRequredFields(options); } diff --git a/src/main/resources/fixture/errors.json b/src/main/resources/fixture/errors.json new file mode 100644 index 0000000..ce674bf --- /dev/null +++ b/src/main/resources/fixture/errors.json @@ -0,0 +1,8 @@ +[ + { + "codeRegex": "003", + "descriptionRegex": "Invalid cardholder", + "mapping": "authorization_failed:operation_blocked", + "state": "payment" + } +] diff --git a/src/test/java/com/rbkmoney/adapter/atol/IntegrationTest.java b/src/test/java/com/rbkmoney/adapter/atol/IntegrationTest.java index b621f9e..9eab449 100644 --- a/src/test/java/com/rbkmoney/adapter/atol/IntegrationTest.java +++ b/src/test/java/com/rbkmoney/adapter/atol/IntegrationTest.java @@ -1,17 +1,17 @@ package com.rbkmoney.adapter.atol; import com.rbkmoney.adapter.cashreg.spring.boot.starter.constant.OptionalField; -import com.rbkmoney.damsel.cashreg.Cart; -import com.rbkmoney.damsel.cashreg.ItemsLine; -import com.rbkmoney.damsel.cashreg.provider.CashRegContext; -import com.rbkmoney.damsel.cashreg.provider.CashRegProviderSrv; -import com.rbkmoney.damsel.cashreg.provider.Session; -import com.rbkmoney.damsel.cashreg.provider.SourceCreation; -import com.rbkmoney.damsel.cashreg.type.Debit; -import com.rbkmoney.damsel.cashreg.type.Type; -import com.rbkmoney.damsel.cashreg_domain.AccountInfo; -import com.rbkmoney.damsel.cashreg_domain.PaymentInfo; -import com.rbkmoney.damsel.cashreg_domain.TaxMode; +import com.rbkmoney.damsel.cashreg.adapter.CashregAdapterSrv; +import com.rbkmoney.damsel.cashreg.adapter.CashregContext; +import com.rbkmoney.damsel.cashreg.adapter.Session; +import com.rbkmoney.damsel.cashreg.adapter.SourceCreation; +import com.rbkmoney.damsel.cashreg.domain.AccountInfo; +import com.rbkmoney.damsel.cashreg.domain.PaymentInfo; +import com.rbkmoney.damsel.cashreg.domain.TaxMode; +import com.rbkmoney.damsel.cashreg.receipt.Cart; +import com.rbkmoney.damsel.cashreg.receipt.ItemsLine; +import com.rbkmoney.damsel.cashreg.receipt.type.Debit; +import com.rbkmoney.damsel.cashreg.receipt.type.Type; import com.rbkmoney.damsel.domain.Cash; import com.rbkmoney.damsel.domain.CurrencyRef; import lombok.extern.slf4j.Slf4j; @@ -32,20 +32,20 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen @Slf4j @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment = DEFINED_PORT) -@ContextConfiguration(classes = CashRegAtolApplication.class) +@ContextConfiguration(classes = CashregAtolApplication.class) @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_CLASS) public abstract class IntegrationTest { @Autowired - protected CashRegProviderSrv.Iface handler; + protected CashregAdapterSrv.Iface handler; - public CashRegContext makeCashRegContext() { - CashRegContext context = new CashRegContext(); - context.setCashregId(TestData.CASHREG_ID); - context.setSourceCreation(createSourceCreation()); - context.setAccountInfo(createAccountInfo()); - context.setOptions(createAdapterOptions()); - context.setSession(new Session().setType(Type.debit(new Debit()))); + public CashregContext makeCashRegContext() { + CashregContext context = new CashregContext() + .setCashregId(TestData.CASHREG_ID) + .setSourceCreation(createSourceCreation()) + .setAccountInfo(createAccountInfo()) + .setOptions(createAdapterOptions()) + .setSession(new Session().setType(Type.debit(new Debit()))); return context; } @@ -69,8 +69,8 @@ public abstract class IntegrationTest { protected AccountInfo createAccountInfo() { - com.rbkmoney.damsel.cashreg_domain.LegalEntity legalEntity = new com.rbkmoney.damsel.cashreg_domain.LegalEntity(); - com.rbkmoney.damsel.cashreg_domain.RussianLegalEntity russianLegalEntity = new com.rbkmoney.damsel.cashreg_domain.RussianLegalEntity(); + com.rbkmoney.damsel.cashreg.domain.LegalEntity legalEntity = new com.rbkmoney.damsel.cashreg.domain.LegalEntity(); + com.rbkmoney.damsel.cashreg.domain.RussianLegalEntity russianLegalEntity = new com.rbkmoney.damsel.cashreg.domain.RussianLegalEntity(); russianLegalEntity.setActualAddress("ActualAddress"); russianLegalEntity.setInn("INN"); @@ -81,7 +81,7 @@ public abstract class IntegrationTest { russianLegalEntity.setRepresentativePosition("RepresentativePosition"); russianLegalEntity.setRegisteredNumber("RegisteredNumber"); - com.rbkmoney.damsel.cashreg_domain.RussianBankAccount russianBankAccount = new com.rbkmoney.damsel.cashreg_domain.RussianBankAccount(); + com.rbkmoney.damsel.cashreg.domain.RussianBankAccount russianBankAccount = new com.rbkmoney.damsel.cashreg.domain.RussianBankAccount(); russianBankAccount.setAccount("Account"); russianBankAccount.setBankName("BankName"); russianBankAccount.setBankPostAccount("BankPostAccount"); @@ -113,5 +113,4 @@ public abstract class IntegrationTest { return paymentInfo; } - } diff --git a/src/test/java/com/rbkmoney/adapter/atol/handler/AtolServerHandlerTest.java b/src/test/java/com/rbkmoney/adapter/atol/handler/AtolServerHandlerTest.java index d1febec..f3d0ac8 100644 --- a/src/test/java/com/rbkmoney/adapter/atol/handler/AtolServerHandlerTest.java +++ b/src/test/java/com/rbkmoney/adapter/atol/handler/AtolServerHandlerTest.java @@ -3,17 +3,15 @@ package com.rbkmoney.adapter.atol.handler; import com.rbkmoney.adapter.atol.IntegrationTest; import com.rbkmoney.adapter.atol.MockUtils; import com.rbkmoney.adapter.atol.service.atol.AtolClient; -import com.rbkmoney.damsel.cashreg.provider.CashRegContext; -import com.rbkmoney.damsel.cashreg.provider.CashRegResult; +import com.rbkmoney.damsel.cashreg.adapter.CashregContext; +import com.rbkmoney.damsel.cashreg.adapter.CashregResult; import org.apache.thrift.TException; import org.junit.Before; import org.junit.Test; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.mock.mockito.MockBean; -import java.net.URISyntaxException; - -import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertTrue; public class AtolServerHandlerTest extends IntegrationTest { @@ -21,20 +19,20 @@ public class AtolServerHandlerTest extends IntegrationTest { public AtolClient client; @Before - public void setup() throws URISyntaxException, TException { + public void setup() { MockitoAnnotations.initMocks(this); MockUtils.mockAtolClient(client); } @Test public void testMe() throws TException { - CashRegContext cashRegContext = makeCashRegContext(); - CashRegResult result = handler.register(cashRegContext); + CashregContext context = makeCashRegContext(); + CashregResult result = handler.register(context); assertTrue(result.getIntent().isSetSleep()); - cashRegContext.getSession().setState(result.getState()); + context.getSession().setState(result.getState()); - result = handler.register(cashRegContext); + result = handler.register(context); assertTrue(result.getIntent().isSetFinish()); }