Top Banner
IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught
42

IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

Jan 04, 2016

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation

WSRP Conformance Test KitTutorial

Julie MacNaught

Page 2: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation2

Topics

WSRP Conformance Test Kit Architecture

WS-I Components

WSRPTK Demo

Developing Test Assertions

Specialized Portlet

Portlet Demo

WSRPTK Project Organization

Contributing to the WSRPTK Project

Project TODOs

Page 3: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation3

Test Kit Requirements

Verify WSRP implementation against WSRP specification

– Verify conformance of any WSRP Producer

– Verify conformance of any WSRP Consumer

Be non-invasive

Examine message content for a running web service

Validate WSDL

Page 4: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation4

WS-I Test Tools

Developed by WS-I (Web Services Interoperability) consortium

Interoperability guidelines limit implementation choices to improve interoperability: Basic Profile

Testing Tools + Basic Profile measure likelihood of interoperability of a Web Service

Examines WSDL, UDDI and Message Flow at Runtime

Page 5: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation5

WSRP Conformance Test Kit Architecture

Browser Consumer ProducerMonitor

MessageLog

Analyzer

ReportProfile

Runtime

SpecializedPortlet

Page 6: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation6

WSRP Profile

Conformance statements gleaned from WSRP Specification

Conformance statements on OASIS: http://www.oasis-open.org/apps/org/workgroup/wsrp/wsrp-conformance/document.php?document_id=12625

Conformance statements boiled down into Test Assertions

WSRPProfileTestAssertions.xml

Page 7: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation7

Running Everything End to End

Start the Producer (e.g. WSRP4J on Tomcat)

Start the Monitor (bin/Monitor.bat)

Start the Consumer (e.g. WSRP4J Swing Consumer)

Exercise the User Interface

Exit the Consumer

Stop the Monitor (type “exit”)

View the Report (logs/AnalyzerLog.xml)

Page 8: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation8

WS-I Components

Topics

– Monitor

– Profile

– Analyzer

Page 9: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation9

Monitor

Monitor Function Specification here: http://www.ws-i.org/Testing/Specs/MonitorFunctionalSpecification_Final_1.1.pdf

Path to config file passed as argument at runtime

Config file specifies input parameters

. . . <wsi-monConfig:logFile replace="true" location="../logs/MonitorLog.xml"><wsi-common:addStyleSheet href="../xsl/log.xsl" type="text/xsl"/></wsi-monConfig:logFile>. . .<wsi-monConfig:manInTheMiddle><wsi-monConfig:redirect><wsi-monConfig:listenPort>8081</wsi-monConfig:listenPort><wsi-monConfig:schemeAndHostPort>http://localhost:8080</wsi-monConfig:schemeAndHostPort><wsi-monConfig:maxConnections>1000</wsi-monConfig:maxConnections><wsi-monConfig:readTimeoutSeconds>15</wsi-monConfig:readTimeoutSeconds></wsi-monConfig:redirect></wsi-monConfig:manInTheMiddle>. . .

Page 10: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation10

Analyzer

Analyzer Functional Specification here:http://www.ws-i.org/Testing/Specs/AnalyzerFunctionalSpecification_Final_1.1.pdf

Reads the Log file and the Profile

Generates a Report file in XML

Page 11: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation11

Analyzer Configuration File

<wsi-analyzerConfig:configuration name="Sample WSRP Profile Analyzer Configuration" xmlns:wsi-analyzerConfig="http://www.ws-i.org/testing/2003/03/analyzerConfig/">. . . .<wsi-analyzerConfig:reportFile replace="true" location="../logs/AnalyzerLog.xml"><wsi-analyzerConfig:addStyleSheet href="../xsl/report.xsl" type="text/xsl"/></wsi-analyzerConfig:reportFile><wsi-analyzerConfig:testAssertionsFile>../profiles/WSRPProfileTestAssertions.xml</wsi-analyzerConfig:testAssertionsFile> <wsi-analyzerConfig:logFile correlationType="endpoint">../logs/MonitorLog.xml</wsi-analyzerConfig:logFile> . . . .</wsi-analyzerConfig:configuration>

Path to config file is passed to Analyzer at runtime.

Config file specifies all the input arguments

Page 12: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation12

Profile Details

Types of Test Assertions

– Discovery – Verifies UDDI entries.

• WSRP Profile has no UDDI assertions

– Description – Verifies WSDL entries.

• WSRP Profile has some WSDL assertions.

– Message – Verifies message content in the log file.

• WSRP Profile has many message assertions.• Primary focus of test kit.

Page 13: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation13

Sample Test Assertion<testAssertion id="RP0070" entryType="responseMessage" type="required“ enabled="false"> <context>getServiceDescriptionResponse</context> <assertionDescription>If the Consumer uses a Producer who has set requiresInitCookie to a value other than "none", it shall: 1. Invoke initCookie for each portlet from such a Producer for each new end-user; 2. Return the set cookie(s) only for this end-user (see AS006, AS023 and AS024).</assertionDescription> <failureMessage>When a Producer sets ServiceDescription.requiresInitCookie to a value other than "none", the Consumer has to invoke initCookie()</failureMessage> <failureDetailDescription>{SOAP message}{any XML parser error messages}</failureDetailDescription> <additionalEntryTypeList> <messageInput>none</messageInput> <wsdlInput>none</wsdlInput> <uddiInput>none</uddiInput> </additionalEntryTypeList> <prereqList/> <referenceList> <reference profileID="WSRP1"/> </referenceList> <comments/></testAssertion>

Page 14: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation14

Test Assertion Implementation

Topics

– WSRP-specific factory

– WS-I Base Classes

– Constructor magic

– Extension points

– Utility classes

Page 15: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation15

WSRPValidatorFactoryImpl

wsi.properties file# ------------------------------------# Profile validation factory.# ------------------------------------wsi.profile.validator.factory= org.oasis.wsrp.test.impl.WSRPValidatorFactoryImpl

public MessageValidator newMessageValidator() throws WSIException { // Create new message validator MessageValidator messageValidator = new WSRPMessageValidatorImpl();

// Return validator return messageValidator;}

WSRPValidatorFactoryImpl.java

Page 16: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation16

WS-I Base Classes

WSRP Factory Creates

– WSRPDescriptionValidatorImpl

– WSRPMessageValidatorImpl

BaseValidatorImpl does the high level assertion processing

– creates AssertionProcess for each testAssertion in the Profile• Class assertionClass =

Class.forName(classPrefix + testAssertion.getId());

– Handles prerequisite processing

– invokes validate()

Page 17: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation17

Assertion Constructor Magic

WSRPBaseAssertionProcess implements convenience methods: pass(), fail(), etc

WSRPMessageValidatorImpl saves state between messages and between assertions

WSRPMessageAssertionProcess downcasts the contructor argument BaseValidatorImpl to WSRPMessageValidatorImpl

Page 18: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation18

Using WSRPMessageValidatorImpl for State

. . .regHandle = validator.findRegistrationHandle((Node) doc.getDocumentElement());portletHandle = validator.checkForClonedPortlet(portletHandle, regHandle);offeredPortlet = validator.findOfferedPortlet(portletHandle);if (offeredPortlet == null) { // this means the portlet was not found in the serviceDescriptionResponse fail("Cannot find portlet with handle: " + portletHandle + " in serviceDescriptionResponse"); done = true;}. . .

RP0510 The value supplied in MarkupParams.windowState shall be either "wsrp:view" or one of the values from the PortletDescription.markupTypes[].windowStates for a matching mime type, which has to have a value

Page 19: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation19

Extending Base Classes

WSRPMessageAssertionProcess

BaseRP

CustomItemChecker

Another Test Assertion

Page 20: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation20

Test Assertion Example

RP0090 Every time an extension element appears in a WSRP message, it's child element shall use the xsi:type attribute to declare its type.

. . .package org.oasis.wsrp.test.impl.message;

. . . .imports . . .

public class RP0090 extends WSRPMessageAssertionProcess {

public RP0090(BaseMessageValidator impl) { super(impl); }. . .

Page 21: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation21

. . .public AssertionResult validate(TestAssertion testAssertion, EntryContext entryContext) throws WSIException { if (validator.isOneWayResponse(entryContext)) { na(); } else { try { // parse the request message Document reqDoc = entryContext.getRequestDocument(); // get all the extension elements included in the request NodeList extNodes = NodeUtils.getNodes(reqDoc, "extension"); int extNodeCount = extNodes.getLength(); if (extNodeCount < 1) { na(); } else { Node extNode, childNode; NamedNodeMap attribs; for (int ii = 0; ii < extNodeCount; ii++) { extNode = extNodes.item(ii); childNode = extNode.getFirstChild(); if (childNode != null) { attribs = childNode.getAttributes(); if (attribs.getNamedItem("xsi:type") != null) { pass(); } else { fail("If an extension element is present, its child has to have the 'xsi:type' attribute defined"); } } else { warn("Extension element has no children"); . . . } catch (TransformerException te) { te.printStackTrace(); fail(te.getMessage()); } } return createAssertionResult(testAssertion, result, failureDetailMessage);}. . .

Page 22: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation22

NodeUtils

Convenience methods for XPATH and XML

Page 23: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation23

Specialized Portlet

Writes instrumented markup so that Analyzer can find it

Used for Test Assertions that evaluate Consumer<->User behavior

Uses XML script for control

Uses JSP for markup

Page 24: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation24

XML Script File

<flow> <case id="134"> <pass repeatCount="2"> <jspInclude name="test_case_1340_1.jsp" /> </pass> </case></flow>

flow_script.xml

– actual runtime file

flow_script_master.xml

– contains all completed Test Assertions

Page 25: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation25

Specialized Portlet Example

RP1340 When an activated portlet URL has specified the wsrp-navigationalState portlet URL parameter, the Consumer shall supply its value unchanged in the MarkupParams.navigationalState field.

. . .<form name="wsrp_test_submit_form" method="post" action="wsrp_rewrite? wsrp-urlType=blockingAction& wsrp-mode=wsrp:view& wsrp-windowState=wsrp:normal& wsrp-secureURL=false& wsrpnavigationalState=wsrp_test_navigationalState /wsrp_rewrite &wsrp_test_expectedNavigationalState=wsrp_test_navigationalState">Test case #134.<br>. . . <input type="submit" value="Submit"></input></form>

*Lines split for readability

Page 26: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation26

Test Assertion Example

Extends BaseRP

– implements processPerformBlockingInteraction()

– instead of validate()

Compares navigationalState in markupParams to the value passed via interactionParams

Page 27: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation27

protected void processPerformBlockingInteractionRequest(Document reqDoc) throws WSIException, TransformerException { Node iaParamsNode = NodeUtils.getNode(reqDoc, "interactionParams"); if (iaParamsNode != null) { NodeList formParamNodes = NodeUtils.getNodes(iaParamsNode, "formParameters"); int formParamCount = formParamNodes.getLength(); Node formParamNode; String formParamName, expectedNavStateValue = null; // go through the form parameters until we find the one that interests us (if any) for (int ii = 0; ii < formParamCount; ii++) { formParamNode = formParamNodes.item(ii); formParamName = NodeUtils.getAttributeValue(formParamNode, "name"); if (PARAM_NAME_EXPECTED_NAVIGATIONAL_STATE.equals(formParamName)) { // find the value subnode Node valueNode = NodeUtils.getTextNode(formParamNode, "value"); expectedNavStateValue = NodeUtils.getSafeTextNodeValue(valueNode); break; } } if (expectedNavStateValue != null) { // compare the expected navigational state value to the one actaully supplied // find the markupParams node Node markupParamsNode = NodeUtils.getNode(reqDoc, "markupParams"); if (markupParamsNode != null) { // find the navigational state subnode Node navStateNode = NodeUtils.getTextNode(markupParamsNode, "navigationalState"); String navState = NodeUtils.getSafeTextNodeValue(navStateNode); if (expectedNavStateValue.equals(navState)) { pass(); } else { fail("Expected navigational state: " + expectedNavStateValue + "; supplied navigational state: " + navState); } } else { fail("Missing markupParams node"); } } } }

Page 28: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation28

Running the Specialized Portlet Configure the Producer to host the Specialized Portlet.

Start the Producer.

Configure the Consumer to put the Specialized Portlet onto a page.

Start the Consumer.

Start the Monitor (bin/Monitor.bat).

Start a browser, such as Firefox.

Open the URL for the Consumer.

The Specialized Portlet will render a small form and then run by itself.

Stop the Monitor by typing “exit” in the window.

Start the Analyzer (bin/Analyzer.bat).

View the report (logs/AnalyzerLog.xml) in a browser.

Page 29: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation29

WSRPTK Source Forge Project

Project Web Site: http://sourceforge.net/projects/wsrptk

Project Home Page: http://wsrptk.sourceforge.net/

CVS Anonymous CheckOut:

cvs -d:pserver:[email protected]:/cvsroot/wsrptk login

Page 30: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation30

WSRPTK Directory Organization

bin Batch files for running command line programs

config Configuration files for the Monitor and Analyzer

lib Jar files

logs Generated message logs and reports

profiles Profile assertions document

schemas Schema files for WS-I tools as well as WSRP

wsdl WSDL files for WSRP

xsl Stylesheets for viewing logs and reports in HTML

src Java source for WSRPTK

site Source and intermediate build results for the WSRPTK web site

classes Intermediate build results for WSRPTK

doc This tutorial

javadoc Generated javadoc for WSRPTK

Page 31: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation31

Prerequisites

WSI Testing Tools

– Download the WS-I Testing Tools from:http://www.ws-i.org/Testing/Tools/2005/06/WSI_Test_Java_Final_1.1.zip

– Unpack Zip file

– Copy from: wsi-test-tools/common/xsl/*.* to: wsrptk/xsl

– Copy from: wsi-test-tools/common/schemas/*.*to: wsrptk/schemas

Page 32: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation32

Prerequisites, cont’d

XSL Stylesheet Issues

– The namespace definitions in the XSL stylesheets obtained from WS-I are out of date with respect to the jar files from Eclipse.

– The embedded style directives use ALL CAPS for HTML tag names, and they have to be lower case to get proper formatting.

– The WSRPTK project has patch files that can be applied to make these corrections.

Page 33: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation33

Prerequisites, cont’d Eclipse.org

– Download Web Tools 1.0.1 from:http://www.eclipse.org/downloads/download.php?file=/webtools/downloads/drops/R-1.0.1-200602171228/wtp-all-in-one-sdk-R-1.0.1-200602171228-win32.zip

– Unpack Zip File

– Copyfrom:

eclipse/plugins/org.eclipse.wst.wsi_1.0.1.v200602030355.jarto: wsrptk/lib

– Note: the name of this jar file has changed over time. You may have wsi-core.jar and wsi-validate.jar already on your system if you have previously installed Web Tools. These jars *should* work also.

Page 34: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation34

Contributing to the WSRPTK Project

Topics

– SourceForge User Types

– Becoming a Developer

– Project Administration

– Release Process

– Handling 3rd Party Contributions

Page 35: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation35

Source Forge User Types Unauthenticated Users -- General public

Authenticated Users

– Has a SourceForge Account (signed COO)

Developers

– Authenticated User with commit access to a SourceForge project

Release Technician

– Can use the File Release System for publishing releases

Project Administrators

– Has priveleges to annoint Developers

– Can also annoint other Project Administrators

Page 36: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation36

Becoming a Developer Obtain a SourceForge account to become an

Authenticated User & Sign the T&Cs

Authenticated Users can request Developer priveleges, which the Conformance Sub Committee votes to grant.

– Developers must be employees the OASIS TC member companies

• i.e. random folks from the general public will not be approved

Some Developers will also be granted Release Technician priveleges, at the behest of the Conformance Sub Committee

Page 37: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation37

Project Administration

Chair of the Conformance Sub Committee will be granted Project Administrator priveleges

The Conformance Sub Committee may vote to grant Project Administrator priveleges to one or more Developers

As project creator, Julie MacNaught, has Project Administrator priveleges. Upon transition of project control to the Conformance Sub Committee, she will resign from this role no later than June 1, 2006.

Page 38: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation38

Release Process

Conformance Sub Committee will vote to release each version of the Test Kit

Conformance Sub Committee will designate a Developer (i.e. Release Technician) to publish the release to the File Release System

Page 39: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation39

Handling 3rd Party Contributions

If a person who is not a Developer wishes to contribute code to the project :

– The Conformance Sub Committee shall review the code contribution

• Due diligence should be performed to verify origin of the code and that it can be released under the CPL.

– Vote to accept it

– A Developer will then commit the code to the project

Page 40: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation40

Project TODOs

Finish V1 Test Cases (56 remain)

Generate Content for WSRPTK home page

Consider migrating to Maven 2 for build

Version 2 Conformance

– Identify Conformance Statements (46+)

– Develop V2 Profile Test Assertions

– Write Test Assertions

Page 41: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation41

Backup Slides

Page 42: IBM Research © 2003 IBM Corporation WSRP Conformance Test Kit Tutorial Julie MacNaught.

IBM Research

© 2003 IBM Corporation42

Overview of WSRP

Web Service for UI

Browser Consumer Producer