Running and Testing the Application

 



 

Introduction

 

This section of the tutorial deals with Starting the Agent and the Shopping Cart Application and testing the Agent using the Manager tools bundled with Agent Toolkit.

 

Starting the Agent and Application

 

Please follow the steps given below to run the Agent.  This will also start the Shopping Cart Application.

Testing the Agent

 

The Multi-Protocol agent is now running at the port numbers specified above.  The Shopping cart application is started and you can find the UI of the Shopping Cart Application displayed, as shown below:

 

As seen in the above image, you will find the Item count which refers to the Total number of items ordered and the Total Price which refers to the total price of the items ordered. The UI will have all the details about the items sold and the rice of each item items.  To order an item, click on the Add button which displays a Pop Up window with a Combo Box listing the Pets that are available in the shop. Specifying the Pet and the Quantity required , a row can be added. On adding a Item, the Item count and Total Price columns will get updated.

The entry gets added as below in the UI.

 

 

Now in the Agent side, if you are going to do a query for the ShoppingCartTable in the ShoppingCartMib at any point of time, the value that is available in the Application will be received from the Agent.  As this is a Multiprotocol Agent you can access the Agent or the Application which are coupled, by means of the supported protocols (SNMP, HTTP, RMI, CORBA, HTML).    

 

SNMP Testing

 

The Shopping Cart Agent can be managed through SNMP Manager using the MIB Browser tool. This application creates a Manager environment.


     

On Updating a row (Modifying the Quantity of a Pet that is required) or adding a row (ordering one more Pet that is available in the Shop) or deleting a Pet requirement, through the Agent, you will find that the Application gets updated with the requests.

 

Thus, the Agent can be coupled easily with any of the Application data  which in turn can be remotely accessed and managed. To know more about the UserStorageModel instrumentation part have a look at the Instrumenting Tables section. This will give you a clear idea about how to couple your Application and the Generated Agent.

 

To know more on Testing the Agent using MIB Browser, please refer to Testing the Agent section in Building SNMP Agents of Product Help documentation.

 

RMI/CORBA/HTTP Testing

 

The Shopping Cart application can be managed through the RMI /CORBA/HTTP using MBean Browser.

The following operations can be performed :

 

GET/SET Scalar Attributes

 

You can GET and SET scalar attribute values if the attribute is of type read-write.  For read only attributes, you can only get the values. In the Shopping Cart application, the scalar attributes TotalItemcount and TotalPrice are read only attributes and hence their values cannot be modified.   To access the Scalar attributes of the application,

GET Table values

 

Now, let us assume that we have ordered one quantity of each item using the Shopping Cart Application UI.  On the Agent side, if you are going to do a query for the ShoppingCartTable at any point of time, the value that is available in the Application will be received from the Agent.

Add / Modify / Delete Row

 

The customer can also place an order through the Manager application (MBean Browser) by adding an entry using the Add Row option . The Modify Row option can be used to modify an existing entry.  The Delete Row option can be used to delete an existing item added by the user. These changes will get reflected in the ShoppingCartTable.

 

Similarly you can access the value available in the application and add entries by selecting CORBA/HTTP client from the Client Menu. For example, access the scalar attribute values TotalItemCount and TotalPrice using HTTP client. You will find the values displayed as shown in the screen-shot below:

 

 

HTML Testing

 

The Shopping Cart application can be tested through the HTML Adaptor using  any Web Browser  for example Netscape, IE etc.

The following operations can be performed :

 

Modify Row/Add Row/Delete Row :

 

To modify a row, select the check box of the corresponding row and modify the value. For example, in the ShoppingCartTable, modify the quantity of Parrot purchased from 1 to 2 and select the Save button. The new values will be saved as shown in the screen-shot below: 

 

 

New rows can be added using the New Row button at the bottom of the page. The Delete button can be used to delete a row from the table.

 

Get Scalar Values

 

The attributes of the selected scalar MBeans ShoppingCartSummaryInstrument are listed in table format with the following information: Attribute name, Attribute type, Attribute access, Attribute value,  and Attribute Description. Values of Read-Write attributes are presented in editable text field.

 

 

The JavaServer pages also allow you to perform operations on MBeans. If operations can be performed on an MBean, then the Operations button is displayed at the right-top corner of the the MBean attribute page. Clicking this button presents a page with the list of operations. Selecting an operations hyperlink displays the following information pertaining to the MBean operation:

Apart from these, SET operations are provided with text fields to specify the attribute values.  Further chapters will discuss the implementation details of Scalar group and Tabular group.  

 



Copyright © 2013, ZOHO Corp. All Rights Reserved.