View Javadoc

1   /*
2    * $Id: CallableEntryPointDiscoveryTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.mule.model;
12  
13  import org.mule.api.model.InvocationResult;
14  import org.mule.model.resolvers.CallableEntryPointResolver;
15  import org.mule.tck.AbstractMuleTestCase;
16  import org.mule.tck.testmodels.fruit.Apple;
17  import org.mule.tck.testmodels.fruit.WaterMelon;
18  
19  public class CallableEntryPointDiscoveryTestCase extends AbstractMuleTestCase
20  {
21      public void testBadMatch() throws Exception
22      {
23          CallableEntryPointResolver resolver = new CallableEntryPointResolver();
24          InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext(new StringBuffer("foo")));
25          assertEquals("Service doesn't implement Callable", result.getState(), InvocationResult.State.NOT_SUPPORTED);
26      }
27  
28      public void testGoodMatch() throws Exception
29      {
30          CallableEntryPointResolver resolver = new CallableEntryPointResolver();
31          InvocationResult result = resolver.invoke(new Apple(), getTestEventContext("blah"));
32          assertEquals(result.getState(), InvocationResult.State.SUCCESSFUL);
33      }
34  }