Pessoal,
não consigo rodar meus testes utilizando JUnit com EJB3. Ocorre uma exceção assim que o método “lookup” é executado, e o erro que ocorre é o seguinte:
javax.naming.NameNotFoundException: br.org.bolsaTrabalho.controller.CurriculoControllerLocal not bound
Já olhei no JBoss no endereço http://localhost:8080/jmx-console/ e acredito que esteja tudo ok (vi isso em um artigo)
O meu código é o seguinte:
public class CurriculoTeste extends TestCase {
protected CurriculoControllerLocal curriculoControllerLocal;
public void setUp() throws Exception {
try {
Properties properties = new Properties();
properties.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url", "jnp://localhost:1099");
properties.put("jnp.parsedName", "false");
Context context = new InitialContext(properties);
Object finderRef = context.lookup(CurriculoControllerLocal.class.getName());
curriculoControllerLocal = (CurriculoControllerLocal) PortableRemoteObject
.narrow(finderRef, CurriculoControllerLocal.class);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
junit.textui.TestRunner.run(suite());
}
public static TestSuite suite() {
return new TestSuite(CurriculoTeste.class);
}
public void testListagem() throws Exception {
ProfissionalBolsa prof = new ProfissionalBolsa();
prof.setIdProfissionalBolsa(1);
assertEquals(new ArrayList<Curriculo>(), curriculoControllerLocal.listarCurriculosByProfissional(prof));
}
}
