1   /*
2    * $Id: AbstractStockQuoteFunctionalTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.examples.stockquote;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.tck.FunctionalTestCase;
15  import org.mule.umo.UMOMessage;
16  import org.mule.util.StringUtils;
17  
18  public abstract class AbstractStockQuoteFunctionalTestCase extends FunctionalTestCase
19  {
20      public void testStockQuoteExample() throws Exception
21      {
22          MuleClient client = new MuleClient();
23          UMOMessage response = client.send("vm://stockquote", "HRB", null);
24      
25          if(response != null) 
26          { 
27              if (response.getExceptionPayload() == null) 
28              {            
29                  assertTrue("Stock quote should contain \"BLOCK\": " + response.getPayload(), 
30                              StringUtils.contains(response.getPayloadAsString(), "BLOCK"));
31              }
32              else
33              {
34                  fail("Exception occurred: " + response.getExceptionPayload());
35              }
36          }
37          else
38          {
39              fail("No response message.");
40          }
41       }
42  }