Pages

Saturday, March 19, 2011

Test your services with AIA CAVS

Composite Application Validation System (CAVS) is part of the Application Integration Architecture Foundation Pack and with CAVS you can test your SOA Composites like SOAPUI or the SOA Test Suite. SOAPUI can test your composite services and it can mock an other service but you need to redeploy some composites to override the endpoints ( so it uses the mocked services endpoints ). The SOA Test Suite is also Ok but is focused to 1 composite. An AIA Process usually contains many composites. So for AIA you need a Test framework who can send a request and can simulate some Composite adapter references services and without redeploying any composites. CAVS can do this for you.
In every Application Business Connector Service (ABCS) of your AIA Process you can do a redirect to a simulator. In this blogpost I will show you how this works. I start with a simple test of a service, grouping some tests together, simulate a service and combine tests and simulators with CAVS routing.

First we start with a simple Test of a SOA Composite Service.
Go the AIA Homepage and press the go button in the Composite Application Validation System window.


Test definition

 In the definitions tab you can see your already defined tests and simulators. Press the Create Test button.
Provide the details. Add the endpoint of the Service you want to test. With Get Operations you can select an operation. To generate a test message press Get Messages.

Add a request between the cavs:CAVSRequestInput_1 element, you can add more then one request. Add a  cavs:CAVSRequestInput_2 element etc.
Provide the matching Response messages in the matching cavs:CAVSResponseOutput_X element.
Important press Generate Xpath so it will generate the validation rules for this test.
 Provide all the namespaces you use in this test.
When you pressed Generate Xpath on the response window you can see all the validations rules ( these based on the response message)  You can add your own.
 You are ready to test your service. Select your test and press Execute.
 In the instance tab you can see the result.

Group Definition
With a Group Definition you can combine test definitions to one group test
Assign some test defintions to this group definition.

You can execute the group definition and look at the instances tab for the results.

Simulation Definition
With a simulation you can for example emulate an reference adapter service of a Provider ABCS. To make an simulator go to the definition tab and press the create simulator button. Provide the values
Add the expected request messages you can receive in this simulator, start with cavs:CAVSRequestInput_1, you can add more expected messages use the right cavs:CAVSRequestInput_X element. Press Generate Xpath for the validation entries.
 Provide the response messages of this simulator.
 Provide the namespaces.
When you pressed Generate Xpath on the request messages then you will find some Xpath validation entries. Very important to provide the node key on every request message so CAVS can detect the right request message and give back the matching response. In my case 122 is the unique identifier.

The simulator part is finished, now you can assign this simulator to a ABCS.

When you create an ABCS with the JDeveloper AIA service constructor, it will create a AIAServiceConfigurationProperties.xml file. This file contains the endpoint url's and if it needs to route the reference to a CAVS simulator.

The AIA deployment framework will add this AIAServiceConfigurationProperties to the AIAConfigurationProperties.xml file  ( located in AIA_Home\aia_instances\AIA_Instance\AIAMetaData\config )

and also located in the MDS in the config folder

To route every request to a simulator you need to go the AIA homepage and press the Go button of the setup  window. Go the AIA Configuration Tab.
 Press add on the ABCS you want to add a simulator to it and select a simulator
 Enable the Route To CAVS option
When you open the AIAConfigurationProperties.xml you can see that the ABCS properties are changed

The changed ABCS entry.


The last part is to combine Testing and Simulation by making an Routing Setup.


Routing Setup
In a Routing Setup you can add particular simulation to one or  more ABCS and use this in a test definition.
Create a Routing Setup
 Add a simulator to the ABCS.
 And open the Test definition and lookup the Routing Setup

This will set the simulator on the ABCS's before the test is executed.

That's all and hope this gives you a quickstart in the AIA CAVS tool.

14 comments:

  1. Hi,
    thank you for the tutorial. I've got a little problem with CAVS Simulator. I can't get to work the "Not Equal To" condition. The use case is following.
    I want to return one specific response message when the ID in request message is "1" and other response message when the ID is not equal to one (so all ids except 1). Is this possible with CAVS Simulator? It seems like the "Not Equal To" condition doesn't work at all.

    ReplyDelete
  2. Hello ,

    Can anyone tell me If I have a ABCProvider that calls some dbAdapter. Can we simulate DbAdapter and Test our ABCProvider accordingly?? How can we configure AIAConfiguration

    File? Follwing is my entry


    default
    true
    http://......./AIAValidationSystemServlet/syncresponsesimulator?simid=1015
    ??? Which URL Do i need to provide ? dbAdapter or ABCProvider .. While dbAdapter don't have soap request response

    message. Its just have wsdl that we can't test in SOAPUI

    ReplyDelete
  3. Hi,

    What I always do, is to make an adapter service with my own wsdl / xsd which call a mediator which calls the dbadapter.

    And this composite is called from the abcs.and can be easily simulated by cavs.

    thanks

    ReplyDelete
  4. Thanks Edwin.

    Actually I am using the dbAdapter in the same ABCSProvider BPEL process. DO you have some useful material or link on that? I have stuck on it around 2 or 3 days with no result. Might be there is some mistake in AIAConfiguration file.

    ReplyDelete
  5. Hi,

    when you use the abcs wizard it generates this file AIAConfiguration in your composite folder.

    it should contain the reference and after deployment it should be also located in the global configuration ( look at the mds )

    I know there was a bug in the aia configuration located in the composite which didnt have the right root element so the deployment tool cant find the configuration never update the global aia configuration file.

    please check this.

    thanks

    ReplyDelete
  6. Thanks Edwin.

    Well I am using Oracle SOA 10g with AIA 2.3. So where can i find the composite folder? And where is the global Configuration file ?

    ReplyDelete
  7. With AIA2.3, is a older version and has no concept of composite.....coming back to you question of simulating a db.

    1. Go to AIAConfigurationProperties.xml file and add a new tag
    < ServiceConfiguration serviceName="{<NameSpace of ur service >}<YourServiceName>">
    <Property name="Default.SystemID">YOURID</Property>
    <Property name="Routing.<PartnerLinkName&rt;.YOURID.EndpointURI"&rt;http://host:port/AIAValidationSystemServlet/syncresponsesimulator </Property>
    </ServiceConfiguration>

    2. Reload your configuration file(AIA Console-->Setup --> Configuration --> Hit reload button)

    It should work now

    ReplyDelete
  8. hi biemond ,i am getting error..

    unable to find the wsdl with some namespace.. and it says.. correct the binding and check proxy setting.. can you please guide me.. on this..

    ReplyDelete
    Replies
    1. Hi,

      what were you doing and are other things working or only cavs not.

      thanks

      Delete
  9. Hi Edwin Biemond,

    Thanks for the article .

    I am trying to do unit testing using AIA CAVS .

    I have created test case and simulator in AIA console and when i try to execute test case , am not able to see any simulator instance under the

    section Linked Simulator Instance Selection

    Have Included the CAVS and service endpoint uri in AIAConfigurationProperties.xml and have enabled the option "route to cavs" to true in "AIA configuration set up" and reloaded the process and the properties in AIAConfigurationProperties.xml got updated but still am not able to see the simulator instance when i execute the test case .

    I would be thankful, if youo can assist me to proceed further .

    ReplyDelete
    Replies
    1. Hi,

      do you see the cavs endpoint with the cavs simulator id like in this pic.
      http://biemond.blogspot.com/2011/03/test-your-services-with-aia-cavs.html

      Thanks

      Delete
  10. Hi Edwin,


    I have created test case and simulator in AIA console and when i try to execute test case , am not able to see any simulator instance under the
    section Linked Simulator Instance Selection

    Have Included the CAVS and service endpoint uri in AIAConfigurationProperties.xml and have enabled the option "route to cavs" to true in "AIA configuration set up" and reloaded the process and the properties in AIAConfigurationProperties.xml got updated but still am not able to see the simulator instance when i execute the test case .

    Please assist.

    ReplyDelete
    Replies
    1. Hi,

      And can you see in the AIAConfigurationProperties.xml file the CAVS endpoint url and this should contain the simulator id as a HTTP parameter

      Thanks

      Delete
  11. Hi, I am new to AIA. I understand that checking RouteToCAVS property to true will update the AIAConfigurationProperties file..My confusion is how SOA composite at run time decides whether to call Simulator or actual web service...is there an implementation in ABCS composite which checks this property from MDS and route the request to appropriate endpoint or AIA framework takes care of every request coming to ABCS and checks for this property.

    ReplyDelete