View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.ibeans;
8   
9   import org.mule.tck.junit4.AbstractMuleContextTestCase;
10  
11  import org.ibeans.annotation.IntegrationBean;
12  import org.junit.Test;
13  
14  import static org.junit.Assert.assertNotNull;
15  import static org.junit.Assert.assertTrue;
16  
17  public class IntegrationBeanAnnotationTestCase extends AbstractMuleContextTestCase
18  {
19      public IntegrationBeanAnnotationTestCase()
20      {
21          setStartContext(true);
22      }
23  
24      @IntegrationBean
25      private HostIpIBean hostip;
26  
27      @Override
28      protected void doSetUp() throws Exception
29      {
30          muleContext.getRegistry().registerObject("test", this);
31      }
32  
33      @Test
34      public void testIBeanInjection() throws Exception
35      {
36          assertNotNull(hostip);
37          String result = hostip.getHostInfo("192.215.42.198");
38          assertNotNull(result);
39  //        System.out.println(result);
40  //        System.out.println(hostip.getHostInfoName("192.215.42.198"));
41          assertTrue("has ip", hostip.hasIp("192.215.42.198"));
42      }
43  }