jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: running EJB tests on WLS
Date Sat, 22 Feb 2003 11:25:08 GMT
Hi Eric,

> -----Original Message-----
> From: Chiu, Eric T [mailto:Eric.Chiu@CIBC.ca]
> Sent: 12 February 2003 01:09
> To: 'Cactus Users List'
> Subject: RE: running EJB tests on WLS
> 
> Got it to compile with my new ConverterTest.java, but still getting
this
> on
> "ant test.weblogic.70"? I have the web.xml in my ejb dir? Packaging
help?
> 
> BUILD FAILED
> C:\cactus\jakarta-cactus-13-1.4\sample-servlet\build\build.xml:145:
webxml
> attribute is required

It means your <war> task does not have a webxml attribute. See the Ant
manual documentation for the war task.

Thanks
-Vincent

> 
> modified ConverterTest.java (compiles)----------------
> package org.apache.cactus.sample.ejb;
> 
> import javax.naming.*;
> import javax.rmi.*;
> import junit.framework.*;
> import org.apache.cactus.*;
> 
> //added
> import java.util.Properties;
> import javax.ejb.*;
> 
> 
> public class ConverterTest extends ServletTestCase
> {
> 	private static final String JNDI_NAME = "ConverterHome";
> 	private String url;
> 	private Converter converter;
> 	private ConverterHome home;
> 
>     public ConverterTest(String name)
>     {
>         super(name);
>     }
> 
>     public static Test suite()
>     {
>         return new TestSuite(ConverterTest.class);
>     }
> 
> 
>     public void setUp() throws NamingException
>     {
> 	String url       = "t3://localhost:7001";
>     // Lookup the beans home using JNDI
>     try
>     	{
>     	home = lookupHome();
> 		}
>     catch (NamingException ne)
>     	{
> 	  throw ne;
> 	}
>     }
> /*
>     public void setUp() throws NamingException
>     {
> 	String url       = "t3://localhost:7001";
>     // Lookup the beans home using JNDI
>     	Context ctx = getInitialContext();
>     try
>     	{
> 	    Object home = ctx.lookup(JNDI_NAME);
> 	    return (ConverterHome) narrow(home, ConverterHome.class);
> 
> 	}
>     catch (NamingException ne)
>     	{
> 	    log("The client was unable to lookup the EJBHome.  Please
make
> sure ");
> 	    log("that you have deployed the ejb with the JNDI name
> "+JNDI_NAME+" on the WebLogic server at "+url);
> 	    throw ne;
> 	}
>     }
> */
> 
>   private ConverterHome lookupHome()
>     throws NamingException
>   {
>     // Lookup the beans home using JNDI
>     Context ctx = getInitialContext();
> 
>     try {
>       Object home = ctx.lookup(JNDI_NAME);
>       return (ConverterHome) narrow(home, ConverterHome.class);
>     } catch (NamingException ne) {
>       log("The client was unable to lookup the EJBHome.  Please make
sure
> ");
>       log("that you have deployed the ejb with the JNDI name
"+JNDI_NAME+"
> on the WebLogic server at "+url);
>       throw ne;
>     }
>   }
> 
> //added
>    private Context getInitialContext() throws NamingException
>    {
> 
>     try {
>       // Get an InitialContext
>       Properties h = new Properties();
>       h.put(Context.INITIAL_CONTEXT_FACTORY,
>         "weblogic.jndi.WLInitialContextFactory");
>       h.put(Context.PROVIDER_URL, url);
>       return new InitialContext(h);
>     } catch (NamingException ne) {
>       log("We were unable to get a connection to the WebLogic server
at
> "+url);
>       log("Please make sure that the server is running.");
>       throw ne;
>     }
>   }
> 
>     public void testConvert() throws Exception
>     {
>         double dollar = this.converter.convertYenToDollar(100.0);
>         assertEquals("dollar", 1.0, dollar, 0.01);
>     }
> 
>     //added
>     private static void log(String s) {
> 	    System.out.println(s);
>     }
> 
>     //added
>     private Object narrow(Object ref, Class c) {
> 	    return PortableRemoteObject.narrow(ref, c);
>     }
> 
> }
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



Mime
View raw message