Skip to Content
Technical Articles

SAP Cloud Platform, Kyma runtime: Mock Applications

This blog will take a look at how to setup a mock application that can be used for developing and evaluating scenarios within the Kyma runtime.  If you do not already have a Kyma runtime provisioned see this blog.

The mocking applications can be found at

https://github.com/SAP-samples/xf-application-mocks

Within the repo you will find each of the mock applications and their deployment files within the respective folder.  The process outlined in the blog will be the same for each, but will focus on configuring the commerce mock.

Applying the Commerce Mocks Resources

Within the Kyma runtime, start by creating a new namespace named mocks by choosing Add new namespace, providing the Name mocks and choosing Create.

If using kubectl you can apply the deployments after setting your kubeconfig, available under Settings -> General Settings, by running the commands in the CLI

export KUBECONFIG=<path to dowloaded file>

kubectl apply -n mocks -f https://raw.githubusercontent.com/SAP-samples/xf-application-mocks/master/commerce-mock/deployment/k8s.yaml

kubectl apply -n mocks -f https://raw.githubusercontent.com/SAP-samples/xf-application-mocks/master/commerce-mock/deployment/xf.yaml

otherwise download the two yaml files found in the folder /commerce-mock/deployment of the xf-application-mocks project either directly or by cloning the project.  Open the mocks namespace and choose the option Deploy new resource and apply the k8s.yaml and then the xf.yaml.

Opening the Commerce Mock Application

The deployment of the mock application will take a few minutes to complete.  With this in mind, in the mocks namespace choose Configuration -> API Rules

Choose the commerce-mock api rule to open it and then choose the link for the Host value to open the mock application.  If an error is returned, wait a minute and try again.

Creating/Connecting a system

To pair the mock application with the Kyma runtime, open your global SAP Cloud Platform account and choose the menu option System Landscape -> Systems

Click on the button Register System, provide the name commerce-mock, set the type to SAP Commerce Cloud and choose the Register option.

Copy the Token value and close the window.

 

Navigate back to the mock application and click on the Connect button.  Paste the copied value in the token text area and then choose Connect

Next choose the Register All button to register the APIs and Events from the mock application.

Creating the Formation

Within your global SAP Cloud Platform account, choose the menu option System Landscape -> Formations. Click on the button Create Formation

Provide a Name, choose your Subaccount where the Kyma runtime is enabled, choose the commerce-mock system and finally choose Create.

 

Verifying the Setup

In the Kyma home workspace choose Integration -> Applications.  Within the list you should for the the mp-commerce-mock application.  After choosing the system you should now see a listing of the APIs and Events the mock is exposing.

Check out this blog to learn how to trigger a function with an event and call an API.

Be the first to leave a comment
You must be Logged on to comment or reply to a post.