1   /*
2    * $Id: NoArgsCallComponentTestCase.java 10789 2008-02-12 20:04:43Z dfeist $
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  package org.mule.test.integration.components;
11  
12  import org.mule.api.MuleMessage;
13  import org.mule.module.client.MuleClient;
14  import org.mule.tck.FunctionalTestCase;
15  
16  /**
17   * This test re-written to use entry point resolvers.  As a consequence, some tests, which verified
18   * implementation details rather than functionality, were dropped.
19   */
20  public class NoArgsCallComponentTestCase extends FunctionalTestCase
21  {
22  
23      public static final String INPUT_DC_QUEUE_NAME = "vm://in";
24      public static final String OUTPUT_DC_QUEUE_NAME = "vm://out";
25      public static final String INPUT_DI_QUEUE_NAME = "vm://invokeWithInjected";
26      public static final String OUTPUT_DI_QUEUE_NAME = "vm://outWithInjected";
27  
28      public static final String DEFAULT_INPUT_MESSAGE = "test";
29      public static final String DEFUALT_OUTPUT_MESSAGE = "Just an apple.";
30  
31      public static final String SERVICE_DC_NAME="WORMS";
32      public static final String SERVICE_DI_NAME="TIRANA";
33  
34      public static final String DELEGATE_DC_METHOD_NAME="toString";
35      public static final String DELEGATE_DI_METHOD_NAME="wash";
36  
37      public static final int TIMEOUT = 5000;
38  
39      protected String getConfigResources()
40      {
41          return "org/mule/test/integration/components/no-args-call-component-functional-test.xml";
42      }
43  
44      public void testDelegateClass() throws Exception
45      {
46          MuleClient client = new MuleClient();
47          client.dispatch(INPUT_DC_QUEUE_NAME, "test", null);
48          MuleMessage message = client.request(OUTPUT_DC_QUEUE_NAME, TIMEOUT);
49          assertNotNull(message);
50          assertEquals(message.getPayload(), DEFUALT_OUTPUT_MESSAGE);
51          client.dispose();
52  
53      }
54  
55      public void testWithInjectedDelegate() throws Exception
56      {
57          MuleClient client = new MuleClient();
58          client.dispatch(INPUT_DI_QUEUE_NAME, DEFAULT_INPUT_MESSAGE, null);
59          MuleMessage reply = client.request(OUTPUT_DI_QUEUE_NAME, TIMEOUT);
60          assertNotNull(reply);
61          assertNull(reply.getExceptionPayload());
62          // same as original input
63          assertEquals(DEFAULT_INPUT_MESSAGE, reply.getPayload());
64      }
65  
66  
67  
68  }