View Javadoc
1   package org.myorg.encconfig.auditor.ejb.it;
2   
3   import javax.naming.Context;
4   import javax.naming.InitialContext;
5   import javax.naming.NamingException;
6   
7   import static org.junit.Assert.*;
8   
9   import org.junit.Before;
10  import org.junit.Ignore;
11  import org.junit.Test;
12  import org.myorg.encconfig.ejb.ConfigBeanRemote;
13  import org.slf4j.Logger;
14  import org.slf4j.LoggerFactory;
15  
16  /**
17   * This class performs an IT test of an EJB having EJB dependencies injected into it.
18   */
19  //TODO: enc-config 29
20  @Ignore
21  public class ConfigBeanIT {
22  	private static final Logger log = LoggerFactory.getLogger(ConfigBeanIT.class);
23      private static final String jndiName = System.getProperty("lookup.name",
24              "ejb:/encconfig-labex-ejb/ConfigBeanEJB!" + ConfigBeanRemote.class.getName());
25  
26  	private Context jndi;
27  	
28  	@Before
29  	public void setUp() {
30  		log.info("using {}", jndiName);
31  	}
32  	
33  	private ConfigBeanRemote getConfigBean() throws NamingException {
34  		if (jndi==null) {
35  			jndi=new InitialContext();
36  		}
37  		return (ConfigBeanRemote)jndi.lookup(jndiName);
38  	}
39  	
40  	@Test
41  	public void testNoIface() throws NamingException {
42  		log.info("*** testNoIface() ***");
43  		assertTrue("no interface EJB not injected", 
44  				getConfigBean().haveNoIfaceEJB());
45  	}
46  
47  	@Test
48  	public void testLocalIface() throws NamingException {
49  		log.info("*** testLocalIface() ***");
50  		assertTrue("no local interface EJB injected", 
51  				getConfigBean().haveLocalEJB());
52  	}
53  
54  	@Test
55  	public void testRemoteIface() throws NamingException {
56  		log.info("*** testRemoteIface() ***");
57  		assertTrue("no remote interface injected", 
58  		        getConfigBean().haveRemoteEJB());
59  	}
60  }