View Javadoc

1   /*
2    * $Id: CallableEntryPointDiscoveryTestCase.java 22377 2011-07-11 12:41:42Z dirk.olmes $
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.junit4.AbstractMuleContextTestCase;
16  import org.mule.tck.testmodels.fruit.Apple;
17  import org.mule.tck.testmodels.fruit.WaterMelon;
18  
19  import org.junit.Test;
20  
21  import static org.junit.Assert.assertEquals;
22  
23  public class CallableEntryPointDiscoveryTestCase extends AbstractMuleContextTestCase
24  {
25  
26      @Test
27      public void testBadMatch() throws Exception
28      {
29          CallableEntryPointResolver resolver = new CallableEntryPointResolver();
30          InvocationResult result = resolver.invoke(new WaterMelon(), getTestEventContext(new StringBuffer("foo")));
31          assertEquals("Service doesn't implement Callable", result.getState(), InvocationResult.State.NOT_SUPPORTED);
32      }
33  
34      @Test
35      public void testGoodMatch() throws Exception
36      {
37          CallableEntryPointResolver resolver = new CallableEntryPointResolver();
38          InvocationResult result = resolver.invoke(new Apple(), getTestEventContext("blah"));
39          assertEquals(result.getState(), InvocationResult.State.SUCCESSFUL);
40      }
41  }