I have a test client of an EJB service
Properties jndiProperties = new Properties();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "my_user");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "my_secret");
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put("TEST_STRING", "ABC");
Context jndi = new InitialContext(jndiProperties);
...
productService = (ServiceRemote) jndi.lookup(moduleName + "/" + beanName + "!" + className);
I can successfully test the methods of productService class via this command line test class.
The problem I am trying to solve is to pass TEST_STRING in the context and read it on EJB side in order to inject different Dao for testing purposes only (qualifier).
I don't know how to access context parameters from EJB class.
Or if there is another way to "suggest" which Qualifier to use ... I am all ears :)
Thank you