Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
CosmosDataReportingComponent10 Testing Guide
Back to Data Reporting Design
Contents
Overview
This document provides the UI infrastructure code based on 209226 UI Visualization infrastructure design document.
The reader should be aware that the modules for the User Interface follow a team sharing structure. The team structure strategies outlined in "Eclipse Web Tools Platform: Developing Java Web Applications" technical document were used. Chapter 6 covers these stategies: Organize your Web Tools platform (WTP) development project.
One can view chapter 6 online at http://whitepapers.zdnet.com/abstract.aspx?docid=307008
Installing
- Download and Install WTP
- WTP - http://www.eclipse.org/downloads/download.php?file=/webtools/downloads/drops/R3.0/S-3.0M3-20071114232332/wtp-S-3.0M3-20071114232332.zip
- Eclipse - http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/S-3.4M3-200711012000/eclipse-SDK-3.4M3-win32.zip
- EMF - http://www.eclipse.org/downloads/download.php?file=/modeling/emf/emf/downloads/drops/2.4.0/S200711062140/emf-sdo-xsd-SDK-2.4.0M3.zip
- GEF - http://www.eclipse.org/downloads/download.php?file=/tools/gef/downloads/drops/S-3.4M3-200711051144//GEF-SDK-3.4M3.zip
- Download and unzip the following project set file in a temporary directory. COSMOS I8 project set file
- Start up Eclipse
- Import the project set file by going to File>Import...
- Select Team>Team Project Set and click Next.
- In the "Team Project Set" page specify the project set file you saved to the temporary directory and click "Finish".
- Download dojo 1.0.0 and save it to a temporary directory. http://download.dojotoolkit.org/release-1.0.0/dojo-release-1.0.0.zip
- In your workspace right click the "org.eclipse.cosmos.dr.dojotoolkit\WebContent" folder and import the contents of the dojo zip file.
- You now need to define a Tomcat Server Runtime. Go to Windows>Preferences..
- Select the "Server>Installed Runtimes" node and click the "Add.." button.
- Specify Apache Tomcat 5.5 runtime and click Next.
- Enter the location of the tomcat directory and click Finish. Then click OK.
- Now you need to set up the org.eclipse.cosmos.examples.e2e.web.ui directory. Note that the WebContent directories under the org.eclipse.cosmos.examples.e2e.web.ui use linked folders. This step is needed since eclipse does not use relative paths to link folders.
- Right click the org.eclipse.cosmos.examples.e2e.web.ui project and create a new Folder by selecting New>Folder from the popup menu. Click the "<<Advance Button" and click the "Link to folder in the file system" check box
- Click the "Variables..." button. This should bring up a dialog box.
- Then click the "New..." button. This should bring up dialog box where you can enter a variable name. The linked folders use a variable named "WORKSPACE" to resolve the workspace directory. Therefore we need to define this variable as follows:
- Click OK, Click OK again and then Cancel. Note that we don't want to create a directory we just needed to add a variable name since the directories are already created.
- Right click the org.eclipse.cosmos.examples.e2e.web.ui project and select "Refresh".
- Right click the org.eclipse.cosmos.dr.tests.web.ui and select "Refresh".
- At this point the workspace is setup to run. Right click the org.eclipse.cosmos.examples.e2e.web.ui project and select "Run As>Run on Server".
- Select Tomcat v5.5 Server and click Next
- Make sure that org.eclipse.cosmos.dr.tests.web.ui and org.eclipse.cosmos.examples.e2e.web.ui projects are selected and click Finish. The server will start.
Running UI Test Page
- Now open FireFox 2.0 or IE 6+ and type http://localhost:8080/COSMOSUITests/?page=tests. You should see the COSMOS UI Test Page. This page provides several configured test pages that tests widgest and various data visualization components.
- The following shows the test page to test the COSMOS tree widget. As you can see that the page presents three configuration of the tree. The tester would normally view this page and make sure that the widget is rendered and operates properly.
- An additional page is provided that provides unit tests that uses the dojo test harness(http://dojotoolkit.org/book/dojo-book-0-9/part-4-meta-dojo/d-o-h-unit-testing). You can execute the unit tests by opening up http://localhost:8080/COSMOSUITests/?page=unitTests . These junit tests sends request to the server side component and executes a particular outputter and compares the output to an expected json structure.
Creating Outputter Testcases
- It is very easy to create unit tests cases for an outputter. First be aware that an outputter tests is basically sending an input request to the outputter and recieving a output stream. A basic test would be compose of sending an input to an outputter and comparing the output produced with an expected output. The COSMOS UI Outputter Test requires the following files:
- An input file that contains the parameters for the outputter
- An output file that contains the expected generated output based on the input parameters
- The following diagram shows where to deploy the input and output file in the COSMOS UI test environtment:
- Note that the directory of the input and output file indicates the outputter id to test against. For example, saving a input and output file under tests\handler\org\eclipse\cosmos\examples\dr\drs\service\outputter\CBEDataManager\ indicates that the test harness should make the following url request:
http://localhost:8080/COSMOSUI/json?service=org/eclipse/cosmos/examples/dr/drs/service/outputter/CBEDataManager
- The following shows a sample input file:
select=getAllMDRs
- Note that the input file is similar to a properties file that has name value pairs. The about input file indicates an input parameter with a value of 'getAllMDRs'. These parameters will be sent when a request is made to the outputter.
- The following is a sample output file:
{ identifier: "object", label: "title", items:[{nodeClass:"mdrstat",expandQuery:"statQuery",title:"Statistical Data",object:"119499171",epr:"http://blackbear.torolab.ibm.com:8081/cosmos/services/org.eclipse.cosmos.rm.dataManager.stat.impl.StatisticalDataManager", store:"[{name:'EPR', properties:[{name:'EPR', value:'http://blackbear.torolab.ibm.com:8081/cosmos/services/org.eclipse.cosmos.rm.dataManager.stat.impl.StatisticalDataManager'},{name:'classification', value:'statistical'}]}]"},{nodeClass:"mdrcbe",title:"Monitoring Data",object:"119458269916711",epr:"http://blackbear.torolab.ibm.com:8081/cosmos/services/org.eclipse.cosmos.rm.dataManager.cbe.impl.CBEDataManager", expandQuery:"cbeQuery",store:"[{name:'EPR', value:'http://blackbear.torolab.ibm.com:8081/cosmos/services/org.eclipse.cosmos.rm.dataManager.cbe.impl.CBEDataManager'},{name:'classification', value:'cbef'}]"},{nodeClass:"mdr",title:"Asset Repository",object:"0",epr:"http://cantata:8081/cosmos/services/org.eclipse.cosmos.rm.dataManager.sml.impl.SmlRepositoryDataManager", store:"[{name:'EPR', value:'http://cantata:8081/cosmos/services/org.eclipse.cosmos.rm.dataManager.sml.impl.SmlRepositoryDataManager'},{name:'muse-wsa:ResourceId', value:'Asset Repository'}]"}]}
- Note the above content shows the json structure that will be produced by the outtputer. The test will compare the above content with the response it gets back from the outputter. If the content and the response matches the test is successful otherwise the test fails.
Testing COSMOS Reports
COSMOS Reporting System is a separate component from the COSMOS UI. This system can be tested independantly from the UI. The following illustrates the architecture of the reporting system.
A report test consists of sending report parameters to a report and making sure the report is rendered correctly. Currently the report tests consists of links to the reporting system that will render the Log report and Statistical report. These links are as follows:
- http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cosmos/tests/data-reporting/org.eclipse.cosmos.dr.tests/WebContent/org/eclipse/cosmos/dr/gvs/report/viewer/LogReport.html?root=Technology_Project&view=co
- http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cosmos/tests/data-reporting/org.eclipse.cosmos.dr.tests/WebContent/org/eclipse/cosmos/dr/gvs/report/viewer/StatReport.html?root=Technology_Project&view=co
Note that these links point to configuration pages that the user can use to specify the report parameters. The user can use the default parameters and render the report.