{"id":2598,"date":"2011-07-18T10:20:09","date_gmt":"2011-07-18T15:20:09","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=2598"},"modified":"2015-04-17T13:53:06","modified_gmt":"2015-04-17T18:53:06","slug":"soa-11g-tutorial-unit-testing-composite-app","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=2598","title":{"rendered":"SOA 11g Tutorial: Unit Testing Composite App"},"content":{"rendered":"<p>This is part of the <a href=\"?p=1924\">Oracle SOA11g hands on tutorials<\/a>.<\/p>\n<span id=\"Overview\"><h2>Overview<\/h2><\/span>\n<span id=\"Testing_Steps\"><h3>Testing Steps<\/h3><\/span>\n<p>* Use JDev to define<br \/>\n&#8211; Tests<br \/>\n&#8211; Assertions<br \/>\n&#8211; Emulations<br \/>\n* Use EM console or Ant to<br \/>\n&#8211; Run tests<br \/>\n* Use EM console or JUnit report to<br \/>\n&#8211; Review test results<\/p>\n<span id=\"Test_Case_Components\"><h3>Test Case Components<\/h3><\/span>\n<p>* Initiation defines:<br \/>\n&#8211; Test service<br \/>\n&#8211; Test operation<br \/>\n&#8211; Test data<br \/>\n* Emulation defines:<br \/>\n&#8211; Response message<br \/>\n&#8211; Fault message<br \/>\n* Assertion<br \/>\n&#8211; Compare response message with expected message<\/p>\n<span id=\"Creating_Unit_Test\"><h3>Creating Unit Test<\/h3><\/span>\n<p>* Open POProcessing project in JDev<br \/>\n* Right click testsuite folder under SOA Content<br \/>\n&#8211; Select Create Test Suite<br \/>\n* On the pop up dialog, enter<br \/>\n&#8211; Name: test1<br \/>\n&#8211; Click OK<br \/>\n* On Create Composite Test dialog, enter<br \/>\n&#8211; Name: TestDelivery<br \/>\n&#8211; Click OK<\/p>\n<span id=\"Setting_Inbound_Message\"><h3>Setting Inbound Message<\/h3><\/span>\n<p>* Open TestDelivery.xml file<br \/>\n* Right click receivePO component and select Create Initiate Messages<br \/>\n* In the Initiate Messages dialog, paste the following message into the Value panel<\/p>\n<pre lang=\"xml\">\r\n<PurchaseOrder xmlns=\"http:\/\/xmlns.oracle.com\/ns\/order\">\r\n  <CustID>1111<\/CustID>\r\n  <ID>1112<\/ID>\r\n  <productName>TV-LCD<\/productName>\r\n  <itemType>Electronics<\/itemType>\r\n  <price>1260<\/price>\r\n  <quantity>1<\/quantity>\r\n  <status>Initial<\/status>\r\n  <ccType>Mastercard<\/ccType>\r\n  <ccNumber>8765-8765-8765-8765<\/ccNumber>\r\n<\/PurchaseOrder>\r\n<\/pre>\n<p>* Click OK<\/p>\n<span id=\"Setting_Simulated_Message\"><h3>Setting Simulated Message<\/h3><\/span>\n<p>* Open TestDelivery.xml file.<br \/>\n* Double click the wire between approvelargeOrder BPEL process and getCreditCardStatus web service to bring up the Wire Actions dialog.<br \/>\n&#8211; Click Emulates tab.<br \/>\n&#8211; Click green plus sign to bring up the Create Emulate dialog.<br \/>\n~ Click Generate Sample button to auto generate a sample response.<br \/>\n~ Change response value to VALID to simulate valid credit card.<\/p>\n<pre lang=\"xml\">\r\n<creditcardStatus xmlns=\"http:\/\/www.globalcompany.com\/ns\/CCAuthorizationService\">VALID<\/creditcardStatus>\r\n<\/pre>\n<p>~ Click OK on Create Emulate dialog.<br \/>\n&#8211; Click OK on Wire Actions dialog.<br \/>\n* Notice that<br \/>\n&#8211; Wire has changed to a dashed line<br \/>\n&#8211; A message arrow indicating service return value<br \/>\n* Save all<\/p>\n<span id=\"Setting_the_Assertion_for_Success\"><h3>Setting the Assertion for Success<\/h3><\/span>\n<p>* Double click the wire between routePO and WriteApprovalResults to bring up the Wire Actions dialog.<br \/>\n* On Asserts tab, click green plus sign to add an new assertion.<br \/>\n&#8211; Click Browse button to the right of Assert Target. We want to assert only one field.<br \/>\n~ On Select Assert Target dialog, select imp1:status and click OK button.<br \/>\n&#8211; Back on Create Assert dialog, enter <strong>approved<\/strong> in the Assert Value field.<br \/>\n&#8211; Click OK buttons on both dialogs.<br \/>\n* Notice that<br \/>\n&#8211; Wire has changed to a dashed line<br \/>\n&#8211; A message arrow indicating service assertion<br \/>\n* Save all<\/p>\n<span id=\"Setting_the_Assertion_for_Failure\"><h3>Setting the Assertion for Failure<\/h3><\/span>\n<p>* Double click the wire between approveLargeOrder and FulfillmentProcess to bring up the Wire Actions dialog.<br \/>\n* On Asserts tab, click green plus sign to add an new assertion.<br \/>\n&#8211; Click Browse button to the right of Assert Target. We want to assert only one field.<br \/>\n~ On Select Assert Target dialog, select ns1:customerId and click OK button.<br \/>\n&#8211; Back on Create Assert dialog, enter <strong>9999<\/strong> in the Assert Value field.<br \/>\n&#8211; Click OK buttons on both dialogs.<br \/>\n* Notice that<br \/>\n&#8211; Wire has changed to a dashed line<br \/>\n&#8211; A message arrow indicating service assertion<br \/>\n* Save all<\/p>\n<span id=\"Test\"><h2>Test<\/h2><\/span>\n<span id=\"Redeploy_POProcessing_Application\"><h3>Redeploy POProcessing Application<\/h3><\/span>\n<p>* Redeploy POProcessing application as usual.<\/p>\n<span id=\"Test_TestDelivery.xml\"><h3>Test TestDelivery.xml<\/h3><\/span>\n<p>* Login EM<br \/>\n* Click on POProcessing application<br \/>\n* Click Unit Test tab<br \/>\n* Select checkbox for TestDelivery.xml and click Execute button.<br \/>\n* On Details of test run dialog, enter:<br \/>\n&#8211; Test Run Name: Run1<br \/>\n&#8211; Click OK<\/p>\n<span id=\"View_Test_Result\"><h3>View Test Result<\/h3><\/span>\n<p>* Wait until test run is completed.<br \/>\n* On Test Runs tab, click Search button if Run1 is not shown.<br \/>\n* Check that<br \/>\n&#8211; Run1 has a overall status of Failed.<br \/>\n&#8211; approveLargeOrder\/Ful has a status of False<br \/>\n&#8211; routePO\/WriteApprovalResults has status of True<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is part of the Oracle SOA11g hands on tutorials. Overview Testing Steps * Use JDev to define &#8211; Tests &#8211; Assertions &#8211; Emulations * Use EM console or Ant to &#8211; Run tests * Use EM console or JUnit &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=2598\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[100],"tags":[],"class_list":["post-2598","post","type-post","status-publish","format-standard","hentry","category-soa11g"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-FU","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/2598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2598"}],"version-history":[{"count":10,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/2598\/revisions"}],"predecessor-version":[{"id":10643,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/2598\/revisions\/10643"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}