用于集成测试的VDM [英] VDM for Integration Tests

查看:113
本文介绍了用于集成测试的VDM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾使用VDM来消费外部ODATA服务.运行良好.现在,我正在尝试使用VDM进行集成测试,以便使用CAP模型测试创建的ODATA服务.

I had used VDM in order to consumer external ODATA service. It is working well. Now I am trying to use the VDM for Integration Testing in order to test the created ODATA service using CAP Model.

我在集成测试中使用restTemplate.exchange()测试ODATA服务.运行良好.现在,我决定采用SDK VDM方法. VDM文件已成功生成.但是,在尝试运行集成测试时,它会失败并出现异常

I was using restTemplate.exchange() in the Integration Testing to test the ODATA service. It was working well. Now I had decided to go with SDK VDM approach. The VDM files were generated successfully. But while trying to run the Integration Tests, it fails with an exception

com.sap.cloud.sdk.cloudplatform.exception.ShouldNotHappenException:java.lang.NullPointerException:尝试调用已加载空对象的com.google.gson.JsonObject.get(java.lang.String)方法时来自本地变量"xsuaaServiceCredentials"

com.sap.cloud.sdk.cloudplatform.exception.ShouldNotHappenException: java.lang.NullPointerException: while trying to invoke the method com.google.gson.JsonObject.get(java.lang.String) of a null object loaded from local variable 'xsuaaServiceCredentials'

我确实通过了本地JWT令牌&还要在环境变量中设置VCAP_SERVICES.

I do pass the local JWT token & also VCAP_SERVICES set in the environment variable.

package com.sap.crun.landscape;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.context.WebApplicationContext;

import com.sap.cloud.sdk.odatav2.connectivity.ODataException;
import com.sap.cloud.sdk.s4hana.connectivity.ErpConfigContext;
import com.sap.cloud.sdk.testutil.MockUtil;

import com.sap.crun.landscape.vdm.odatalandscapeservice.namespaces.odatalandscapeservice.LandscapeObjects;
import com.sap.crun.landscape.vdm.odatalandscapeservice.namespaces.odatalandscapeservice.LandscapeObjectsCreateFluentHelper;
import com.sap.crun.landscape.vdm.odatalandscapeservice.namespaces.odatalandscapeservice.LandscapeObjectsFluentHelper;
import com.sap.crun.landscape.vdm.odatalandscapeservice.namespaces.odatalandscapeservice.Properties;
import com.sap.crun.landscape.vdm.odatalandscapeservice.services.DefaultOdataLandscapeserviceService;


@RunWith(SpringRunner.class)
@SpringBootTest(classes = { TestApplication.class }, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestPropertySource(locations = "classpath:LmsTest.properties")
public class BusinessServiceIT {

    private static final Logger LOG = CloudLoggerFactory.getLogger(LisImporter.class);
    private static final MockUtil mockUtil = new MockUtil();
    private static final DefaultOdataLandscapeserviceService lmsService = new DefaultOdataLandscapeserviceService()
            .withServicePath("/odata/v2/LandscapeService");
    private ErpConfigContext erpConfCtx;
    private static final String jwToken = new JwtGenerator()
            .getTokenForAuthorizationHeader(LocalSecurityConfig.XSAPPNAME + ".d", LocalSecurityConfig.XSAPPNAME + ".r", LocalSecurityConfig.XSAPPNAME + ".a");
    private static final LandscapeObjectsFluentHelper lsoCreateHelper = lmsService.getAllLandscapeObjects();

    @Autowired
    private WebApplicationContext context;

    @LocalServerPort
    int randomServerPort;


    @BeforeClass
    public static void beforeClass() {
        mockUtil.mockDefaults();
        mockUtil.mockAuditLog();

        lsoCreateHelper
        .withCustomHttpHeader("Authorization", new JwtGenerator().getTokenForAuthorizationHeader(
                LocalSecurityConfig.XSAPPNAME + ".d", LocalSecurityConfig.XSAPPNAME + ".a", LocalSecurityConfig.XSAPPNAME + ".r"))
        .onRequestAndImplicitRequests();

    }

    @Before
    public void beforeEach() throws URISyntaxException {
        mockUtil.mockDestination("localhorst", new URI("http://localhost:" + randomServerPort));
        erpConfCtx = new ErpConfigContext("localhorst");
    }

    @Test
    public void parseVcapServices() {
        final SAPPropertyPlaceholderConfigurer propertyHolder = new SAPPropertyPlaceholderConfigurer();
        final String xsappname = propertyHolder.readVcapServices(SAPPropertyPlaceholderConfigurer.propertyXsAppname,
                "application");
        assertEquals(LocalSecurityConfig.XSAPPNAME, xsappname);
    }

    @Test
    public void createBusinessService() {


        Properties properties = new Properties();
        List<Properties> propertySet = new ArrayList<>();
        properties.setName("useCase");
        properties.setValue("XX");
        properties.setSource("XXX");
        propertySet.add(properties);

        LandscapeObjects landscapeObjects = new LandscapeObjects(null, null, null, null, null, "benufromit", "benufromit_test", BusinessService.name(), "123", "LMS", null, null, propertySet);
        LOG.info("benu-business1");

        final LandscapeObjectsCreateFluentHelper lsoCreateHelper = lmsService.createLandscapeObjects(landscapeObjects)
                .withCustomHttpHeader("Authorization", new JwtGenerator().getTokenForAuthorizationHeader(
                        LocalSecurityConfig.XSAPPNAME + ".d", LocalSecurityConfig.XSAPPNAME + ".a")).onRequestAndImplicitRequests();

        try {
            lsoCreateHelper.execute(erpConfCtx); //It fails here
            LOG.info("benu-business3 {}", landscapeObjects.getId());
        } catch (ODataException e) {
            e.printStackTrace();
        }

    }
}

堆栈跟踪

 com.sap.cloud.sdk.cloudplatform.exception.ShouldNotHappenException: java.lang.NullPointerException: while trying to invoke the method com.google.gson.JsonObject.get(java.lang.String) of a null object loaded from local variable 'xsuaaServiceCredentials'
                   at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter.doFilter(RequestContextServletFilter.java:216) ~[servlet-2.15.0.jar:na]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) ~[spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:176) ~[spring-security-oauth2-2.0.16.RELEASE.jar:na]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.1.2.RELEASE.jar:5.1.2.RELEASE]
                   at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:117) ~[spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
                   at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:106) ~[spring-boot-actuator-2.1.1.RELEASE.jar:2.1.1.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
                   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) ~[tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:685) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:791) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1417) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_202]
                   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_202]
                   at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.13.jar:9.0.13]
                   at java.lang.Thread.run(Thread.java:836) [na:1.8.0_202] Caused by: java.lang.NullPointerException: while trying to invoke the method com.google.gson.JsonObject.get(java.lang.String) of a null object loaded from local variable 'xsuaaServiceCredentials'
                   at com.sap.cloud.sdk.cloudplatform.security.AuthTokenDecoder.getVerificationPublicKey(AuthTokenDecoder.java:86) ~[security-scp-cf-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.security.AuthTokenDecoder.decode(AuthTokenDecoder.java:146) ~[security-scp-cf-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.security.AuthTokenDecoder.decode(AuthTokenDecoder.java:195) ~[security-scp-cf-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.security.AuthTokenRequestContextListener.getProperties(AuthTokenRequestContextListener.java:49) ~[security-scp-cf-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.servlet.AbstractRequestContextListener.requestContextInitialized(AbstractRequestContextListener.java:40) ~[servlet-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextCallable.notifyContextInitialized(RequestContextCallable.java:68) ~[servlet-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextCallable.call(RequestContextCallable.java:129) ~[servlet-2.15.0.jar:na]
                   at com.sap.cloud.sdk.cloudplatform.servlet.RequestContextServletFilter.doFilter(RequestContextServletFilter.java:209) ~[servlet-2.15.0.jar:na]
                   ... 76 common frames omitted

推荐答案

更新后的答案:

Updated answer:

调用后,我们得出结论,在测试运行时未正确模拟方法.

After a call we concluded a method was not correctly mocked at test runtime.

请使用@Before批注将以下代码行添加到集成测试中:

Please add the following lines of code to your integration test with @Before annotation:

final String publicKey = "...";
final Map<String,String> verificationkey = ImmutableMap.of("verificationkey", publicKey);
final JsonObject xsuaaServiceCredentials = new Gson().toJsonTree(verificationkey).getAsJsonObject();
Mockito.when(((ScpCfCloudPlatform) CloudPlatformAccessor.getCloudPlatform()).getXsuaaServiceCredentials(ArgumentMatchers.any(DecodedJWT.class))).thenReturn(xsuaaServiceCredentials);

这将确保测试的应用程序可以使用准备好的公钥正确验证提供的身份验证令牌.

This will make sure the tested application can correctly validate the provided auth token with a prepared public key.

我将此情况转发给了我们的开发人员团队,以考虑解决此潜在功能差距的问题.

I forwarded this scenario to our developer team, to consider a fix to this potential feature gap.

已弃用的响应:

Deprecated response:

一些开放点可以进行问题分析:

Some open points to progress the problem analysis:

  1. 您仅将Cloud SDK用于测试还是在应用程序后端中使用?

  1. Do you use Cloud SDK only for testing or also in the application backend?

仅作为提示;我会避免在测试代码中放入try-catch.

Meant as a hint; I would avoid putting try-catch in test code.

建议为每个测试用例实例化专用的 ErpConfigContext .另外,请使用 RequestContextExecutor :

It's recommended to instantiate a dedicated ErpConfigContext for each test case. Also please use the RequestContextExecutor:

import com.sap.cloud.sdk.cloudplatform.servlet.RequestContextExecutor;

使用

@Test
public void createBusinessService() {
  new RequestContextExecutor().execute(() -> {
    ...
    lsoCreateHelper.execute(new ErpConfigContext("localhorst"));
    ...
  });
}

这是行之有效的还是给您其他消息?

Does this work or give you any other message?

这篇关于用于集成测试的VDM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆