Search code examples
sap-commerce-cloudbackoffice

How to access Backoffice in Junit Tenant


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 ?


Solution

  • 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