View Javadoc

1   /*
2    * $Id: IntegrationBeanAnnotationTestCase.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  package org.mule.module.ibeans;
11  
12  import org.mule.tck.junit4.AbstractMuleContextTestCase;
13  
14  import org.ibeans.annotation.IntegrationBean;
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertNotNull;
18  import static org.junit.Assert.assertTrue;
19  
20  public class IntegrationBeanAnnotationTestCase extends AbstractMuleContextTestCase
21  {
22      public IntegrationBeanAnnotationTestCase()
23      {
24          setStartContext(true);
25      }
26  
27      @IntegrationBean
28      private HostIpIBean hostip;
29  
30      @Override
31      protected void doSetUp() throws Exception
32      {
33          muleContext.getRegistry().registerObject("test", this);
34      }
35  
36      @Test
37      public void testIBeanInjection() throws Exception
38      {
39          assertNotNull(hostip);
40          String result = hostip.getHostInfo("192.215.42.198");
41          assertNotNull(result);
42  //        System.out.println(result);
43  //        System.out.println(hostip.getHostInfoName("192.215.42.198"));
44          assertTrue("has ip", hostip.hasIp("192.215.42.198"));
45      }
46  }