...
- Right-click the project from the previous exercises, then choose Add New> Test (.tst) File from the shortcut menu.
- Enter a name for the file (e.g.,
Policy Enforcement
), then click Next. - Select SOA> WSDL, and click Next to advance to the WSDL dialog.
- Select
http://localhost:8080/parabank/services/store-01?wsdl
from the WSDL URL field. - Check the Create tests Tests to validate Validate and enforce policies Enforce Policies on the WSDL check box and make sure the Create Functional Tests from the WSDL check box is also checked.
- Click Next until you advance to the Policy Enforcement dialog.
- Select the Apply Policy Configuration check box. This will create WSDL and functional tests that will enforce the assertions defined in the specified policy configuration.
The default policy configuration,defaultsoa.soapolicypolicy
, is a collection of industry-wide best practices. To use a custom policy configuration, you can either use the Browse button to select a policy configuration or the policy configuration's path can be entered in the text field. For details on policy enforcement, see SOA Policy Enforcement: Overview.
- Select the Apply Policy Configuration check box. This will create WSDL and functional tests that will enforce the assertions defined in the specified policy configuration.
- Click the Finish button.
- Double-click the new Test Suite: Test Suite node added to the test case tree, enter
Policy Configuration
in the Name field in the test configuration panel, and click the Save toolbar button. - Expand Test Suite: Policy Configuration then Test Suite: WSDL Tests. Notice that Test 4: Policy Enforcement has been added to Test Suite: WSDL Tests.
- Expand the Test 4: Policy Enforcement test to view its chained tools. You will see two Coding Standards tools, one for enforcing rules on the WSDLs and one for enforcing rules on the schemas
- The first tool, WSDL> WSDL Policy Enforcer, is chained to the WSDL Output of the Test 4: Policy Enforcement test and thus is passed the base WSDL and all imported WSDLs for rule enforcement.
- The second Coding Standards tool titled Schema> Schema Policy Enforcer is chained to Test 4: Policy Enforcement's Schema Output and thus is passed all schema files referenced in the WSDL for rule enforcement.
- Expand one of the tests in the Test Suite: CartServicePort node and notice that a referenced Coding Standards tool titled Response SOAP Envelope> SOAP Policy Enforcer has been chained to the Test.
This tool will apply its contained policy configuration on the messages received by this test client. The tool is a reference to a Global Tool in the Tools Test Suite under the root Test Suite.
For more information on Global Tools see Global Tools. - Select the Test 4: Policy Enforcement Test and click the Test toolbar button. This will run policy enforcement tests on the WSDL and schema files. If any errors occur, they will be reported in the Quality Tasks view.
...