How to access Backoffice in Junit Tenant

南笙酒味 提交于 2020-01-05 07:34:29

问题


We can access HMC in JUnit tenant by hitting the below URL

https://localhost:9002/hmc_junit/hybris

which is defined in tenant_junit.properties like this hmc.webroot=/hmc_junit

But I havn't seen anywhere URL to access Backoffice in JUnit Tenant.

Can anybody help me please to access Backoffice in JUnit Tenant ?


回答1:


I was looking for it everywhere as well, couldn't find any documentation in the wiki... It doesn't seem to be officially supported but here is what I found.

Under Hybris 6.3 there is no junit context path for the backoffice application. Here is how you could add one :

  • Create a file named : local_tenant_junit.properties under your configuration folder, it should contain :

    backoffice.webroot=/backoffice_junit

  • Create a file for customization inside your config folder customize/ext-backoffice/backoffice/web/webroot/WEB-INF/backoffice-spring-filter.xml. Copy the content of the original file and update the backofficeFilterChain bean. We want to use the dynamicTenantActivationFilter instead of the tenantActivationFilter) :

    <bean id="backofficeFilterChain" class="de.hybris.platform.servicelayer.web.PlatformFilterChain">
    <constructor-arg>
        <list>
            <ref bean="log4jFilter"/>
            <ref bean="dynamicTenantActivationFilter"/>
            <ref bean="backofficeRedirectFilter"/>
            <ref bean="sessionFilter"/>
            <ref bean="backofficeDataSourceSwitchingFilter"/>
            <ref bean="backofficeCatalogVersionActivationFilter"/>
            <ref bean="backofficeContextClassloaderFilter"/>
            <ref bean="backofficeSecureMediaFilter" />
        </list>
    </constructor-arg>
    

  • Execute ant clean all customize

  • Check that in bin/platform/tomcat/conf/server.xml you now have a new context backoffice_junit

  • Start your server, you can now access the backoffice application for master and junit tenant




回答2:


For Hybris 6.7, to me the following steps were sufficient:

  • in config/local_tenant_junit.properties , add

    backoffice.webroot=/backoffice_junit
    
  • ant server

    this puts the endpoint into ${tomcat.webapps} in server.xml template resulting in:

    <Context path="/backoffice_junit"...
    

    being added to your bin/platform/tomcat/conf/server.xml

Then when you open https://localhost:9002/backoffice_junit , the DataSourceSwitchingFilter gets current tenant from a ThreadLocal and activates its dataSource.



来源:https://stackoverflow.com/questions/44630298/how-to-access-backoffice-in-junit-tenant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!