----- Original Message ----- From: <[EMAIL PROTECTED]> To: "Vincent Massol" <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 10:19 AM Subject: Re: testing EJB
> > Yes, I read the tutorial and I don't understand your answer very well (my > english is not as good as I wish) > > I create the context using the following lines > Hashtable env = new Hashtable(); > env.put(Context.PROVIDER_URL, "t3://localhost:7001"); > env.put(Context.INITIAL_CONTEXT_FACTORY, > "weblogic.jndi.WLInitialContextFactory"); > InitialContext ctx = new InitialContext(env); > > How should I add the user to this initialcontext? (I have the principal, > the credentials, even the subject authenticated, what should I use and > where should I put it?) > Ok, let me put it differently. EJB unit testing is independent from Cactus. You use a Cactus XXXTestCase as a client to your EJB in the same way you would write any EJB client. Your question is thus actually a WebLogic question. I've done a search in the WL 5.1 documentation and found this article which explains it all : http://www.weblogic.com/docs51/classdocs/API_client.html [Read especially the part on "Getting the InitialContext"]. Hope it helps, Thanks -Vincent > Thanks, > Marc > > Vincent Massol writes: > > > Hi Marc, > > > > I'm sure you've read the EJB tutorial on the Cactus web > > site(http://jakarta.apache.org/cactus/howto_ejb.html). If your EJB is > > protected I think you simply need to pass some credentials in the JNDI > > connection. Instead of writing : InitialContext context = new > > InitialContext(), create a Properties object and put into it the correct > > credentials (see your EJB server documentation as I'm not sure this is > > standardized), then call "InitialContext context = new > > InitialContext(properties)". > > > > Hope it helps > > -Vincent > > > > ----- Original Message ----- > > From: <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, October 02, 2001 8:33 AM > > Subject: testing EJB > > > > > > > > > > How can I test with Cactus a protected EJB? I need to protect it and I > > > need to use ctx.getCallerPrincipal() in the bean code to know who called > > > me. > > > > > > Any help would be appreciate. > > > > > > Thanks, > > > Marc > > > > > >
