Have you read Martin’s recent blog on the new features of HANA Cloud Platform mobile services? In that list Staging is one of the notable feature. Staging helps the developers to give their application to the users for testing, after the completion of the tests it could be moved immediately to the end users from admin cockpit itself.

In this blog I am explaining how to put your application in a test state and then move it to the production.

Configure Application in Cockpit

  • Open HCPms admin cockpit, then click on Applications.
  • Click on Configure and provide below details.

    /wp-content/uploads/2015/05/stage1_1_724467.png

stage2 (1).png

 

    Note: Backend URL – http://services.odata.org/V2/OData/OData.svc

  • Click on Save.

Create a Kapsel Application

The following steps will create a simple Kapsel app with an AppUpdate plugin.

  • Cordova command to create project
      cordova -d create C:\Kapsel_Projects\StagingDemo com.sap.staging StagingDemo "{\"plugin_search_path\":\"C:/SAP/MobileSDK3/KapselSDK/plugins/\"}"
      cd C:\Kapsel_Projects\StagingDemo
      cordova -d platform add android
              
      cordova -d create ~/Documents/Kapsel_Projects/StagingDemo com.sap.staging StagingDemo "{\"plugin_search_path\":\"/Users/i12345/SAP/MobileSDK3/KapselSDK/plugins/\"}"
      cd ~/Documents/Kapsel_Projects/StagingDemo
      cordova -d platform add ios

   

  • Replace index.html (C:\Kapsel_Projects\StageDemo\www\index.html) with this sample code. This is an extended code from these kapsel guides.
  • Add AppUpdate plugin and logon plugin
      cordova -d plugin add com.sap.mp.cordova.plugins.appupdate
      cordova -d plugin add com.sap.mp.cordova.plugins.logon
  • Run the following command to build project.
      cordova build
  • Run app in emulator using the below command.
      cordova emulate android

      cordova emulate ios
  • Login to the application. The credentials doesn’t matter since we configured the app with No Authentication. The application will show a list of products.

    stage0 (1).png

  • From HCPms Admin Home page click on Registrations and Users > Turn on “Is Tester” button. Hence this user gets the applications which are under stage state.

    stage3 (1).png

Enable Staging

In this step we are going to upload a new version of the Kapsel application to HCPms for testing (Stage state).

  • When we run the app for the second time to identify the a change, update index.html file as given below. This will get the list of Suppliers instead of Products.

stage9 (1).png

  • Build the app
      cordova build

  • The Kapsel command line provides a way to create a zip file that could to uploaded to HCPms. Open a command prompt and change path to
      C:\SAP\MobileSDK3\KapselSDK\cli

      ~/SAP/MobileSDK3/KapselSDK/cli

  • Run command
      npm install -g

        For Mac:

      sudo npm -g install

  • Open command prompt and change the path to your Kapsel project (C:\Kapsel_Projects\StagingDemo) and execute the command
      kapsel package

    /wp-content/uploads/2015/05/stage52_724493.png

    Now you could find a zipped file created inside your project folder.

    stage10 (1).png

  • Next step is to upload the zipped file to HCPms. To upload the file open HCPms home page then click on Applications > Choose your application > Configure > App specific settings. Then click on Upload Kapsel and browse the zipped file.

    stage6 (1).png

  • Choose the application uploaded, then click on Stage. It moves the application to stage state. Which will be accessible to the users who are testers.

    stage11 (1).png

Test App on Emulator or Device

Now, when we close and reopen the app the AppUpdate plugin identifies that there is an updated app in the server. It gives a pop up for relaunching the app to download the changed files from server.

  • Choose Relaunch Now. You could see that the list is changed from Products to Suppliers.

    stage7 (1).pngstage12 (1).png

After testing the application, from admin cockpit choose the application under Stage state, then click on Deploy, which will make the application available for users in production.

Regards,Midhun

SAP Technology RIG

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply