Scenario 4 - Developer tests and debugs web or native code on an external server

This scenario is similar to 'Scenario 2 - Developer tests and debugs web or native code using the native emulator,' except that the built-in IBM® Worklight server cannot meet the testing needs. Examples include testing security authentication, or testing a CastIron adapter which requires CastIron to be installed, which is not possible with the built-in server. Deployment in this scenario is complex, and manual steps are required, although they can be automated with the Ant tasks.

First, the application code needs to be adapted in order to communicate with the external IBM Worklight server. Refer to the IBM Worklight Developer's Reference Guide on Transporting Apps and Adapters to Test and Production Environments for the necessary code changes to transfer apps and adapters to a test or production environment.

Follow the guide to deploy the apps and adapters to the external IBM Worklight server using the IBM Worklight Console. After they are successfully installed, you can use a device emulator to test.
Note: The external server install does NOT include the Mobile Browser Simulator, so you must perform the testing with a native emulator or a physical device.

As you make more changes to the application code, you will need to rebuild the changes locally and republish to the external server. To rebuild the changes locally, use 'Run As -> Build Environment and Deploy' or 'Run As -> Build All and Deploy.' You may notice errors in the Eclipse console view during the deployment step. These are a result of the fact that IBM Worklight Studio continues to deploy to the built-in server, which may not be able to handle the modified code targeted at the external server. These errors can be ignored.

The newly rebuilt binaries that need to be republished to the external server are contained inside the various .wlapp and .adapter files in the "bin" folder of the IBM Worklight Studio project. Use the procedure in the IBM Worklight Developer's Reference Guide (mentioned above) to deploy the appropriate archive to the external server to test the code changes.

These build and deployment steps can be automated using the Ant tasks provided by IBM Worklight. Refer to the IBM Worklight Developer's Reference Guide on "Ant Tasks for Building and Deploying." To execute the Ant tasks, you can use the command line or launch them from inside IBM Worklight Studio by using Eclipse's Ant support. This can greatly improve the speed of the change-code-and-test cycle.

On the native emulator side, if the code changes are only made to the web resources html/css/javascript, you can reload the code with the direct update feature of IBM Worklight Server. To do so, relaunch the application inside the emulator, and you'll get a prompt for applying the update discovered on the server. On the other hand, if there are native code changes, then you must use the native SDK to rebuild the device binary and reinstall into the emulator.
Note: The direct update feature relies on the 'connectOnStartup' property for the IBM Worklight client-side initialization procedure to be set to 'true.' In IBM Worklight 5.0.5 the default value for this property is 'false.' Open the file common/js/initOptions.js in the application folder to set this property.

Feedback