[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: kimptoc Date: 01/09/07 03:26:44 Modified:src/main/org/jboss/test/testbean/test Main.java Log: fixed deprecation warnings Revision ChangesPath 1.11 +49 -49jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Main.java 2001/08/01 01:59:18 1.10 +++ Main.java 2001/09/07 10:26:44 1.11 @@ -55,7 +55,7 @@ * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.10 2001/08/01 01:59:18 starksm Exp $ +* @version $Id: Main.java,v 1.11 2001/09/07 10:26:44 kimptoc Exp $ */ public class Main extends junit.framework.TestCase @@ -173,7 +173,7 @@ { System.out.println(++test+- trying to find an not existing bean); b1 = home.findByPrimaryKey (new Integer (0)); - assert(findByPrimaryKey(0) should fail, b1 == null); + assertTrue(findByPrimaryKey(0) should fail, b1 == null); } catch (Exception _e) { @@ -184,7 +184,7 @@ b1 = home.findByPrimaryKey (new Integer (1)); System.out.println (name old: + b1.getName ()); b1.setName (Maria); - assert(getName == Maria, Maria.equals(b1.getName ())); + assertTrue(getName == Maria, Maria.equals(b1.getName ())); System.out.println(++test+- find all beans:); Iterator it = home.findAll ().iterator (); @@ -228,11 +228,11 @@ System.out.print(++test+- +Calling create on StatelessSessionHome...); StatelessSession statelessSession = statelessSessionHome.create(); -assert(statelessSessionHome.create() != null, statelessSession != null); +assertTrue(statelessSessionHome.create() != null, statelessSession != null); System.out.println(ok); System.out.print(++test+- +Calling getEJBHome() on StatelessSession...); -assert(statelessSession.getEJBHome() != null, statelessSession.getEJBHome() != null); +assertTrue(statelessSession.getEJBHome() != null, statelessSession.getEJBHome() != null); System.out.println(ok); System.out.print(++test+- +Calling Business Method A on StatelessSession... ); @@ -275,13 +275,13 @@ System.out.println(statelessSession.getPrimaryKey()); System.out.print(++test+- +Get Handle ... ); Handle statelessHandle = statelessSession.getHandle(); -assert(statelessHandle != null, statelessHandle != null); +assertTrue(statelessHandle != null, statelessHandle != null); System.out.println(OK); System.out.print(++test+- +Serialize handle and deserialize..); MarshalledObject mo = new MarshalledObject(statelessHandle); Handle handle2 = (Handle) mo.get(); StatelessSession statelessSession2 = (StatelessSession) handle2.getEJBObject(); -assert(statelessSession2 != null, statelessSession2 != null); +assertTrue(statelessSession2 != null, statelessSession2 != null); System.out.println(OK); System.out.println(++test+- +Calling businessMethodB on it...); System.out.println(statelessSession2.callBusinessMethodB()); @@ -289,7 +289,7 @@ System.out.println(***Testing the various local EJBHome class calls); System.out.print(++test+- +Getting the metaData...); EJBMetaData statelessMetaData = statelessSessionHome.getEJBMetaData(); -assert(statelessMetaData != null, statelessMetaData != null); +assertTrue(statelessMetaData != null, statelessMetaData != null); System.out.println(OK); System.out.println(++test+- +Is stateless Session? +statelessMetaData.isStatelessSession()); System.out.println(++test+- +The remote class is +statelessMetaData.getRemoteInterfaceClass()); @@ -312,15 +312,15 @@ System.out.print(++test+- +Looking up the home nextgen.StatefulSession...); StatefulSessionHome statefulSessionHome = (StatefulSessionHome) ctx.lookup(nextgen.StatefulSession); -assert(statefulSessionHome!= null, statefulSessionHome!= null); +assertTrue(statefulSessionHome!= null, statefulSessionHome!= null); System.out.println(ok); System.out.print(++test+- +Calling create on StatefulSessionHome with name Marc...); StatefulSession statefulSession = statefulSessionHome.create(Marc); -assert(statefulSession != null, statefulSession != null); +assertTrue(statefulSession != null, statefulSession != null); System.out.println(ok);
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: starksm Date: 01/07/31 18:59:18 Modified:src/main/org/jboss/test/testbean/test Main.java Log: Update to use assert and fail rather than System.out Revision ChangesPath 1.10 +146 -169 jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- Main.java 2001/07/10 02:34:05 1.9 +++ Main.java 2001/08/01 01:59:18 1.10 @@ -55,7 +55,7 @@ * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.9 2001/07/10 02:34:05 user57 Exp $ +* @version $Id: Main.java,v 1.10 2001/08/01 01:59:18 starksm Exp $ */ public class Main extends junit.framework.TestCase @@ -154,44 +154,38 @@ { System.out.println(++test+- trying to create one with same primkey: 1, Patrick); b1 = home.create (1, Patrick); + fail(Was able to create duplicate SimpleBMP); } catch (Exception _e) { System.out.println (_e.toString ()); } - + System.out.println(++test+- create some more dummys:); for (int i = 0; i 50; ++i) home.create (i + 3, (Dummy +i)); - - try - { - System.out.println(++test+- trying to find Robert again); - b1 = home.findByPrimaryKey (new Integer (2)); - System.out.println (getName (): +b1.getName ()); - } - catch (Exception _e) - { - System.out.println (_e.toString ()); - } - + + System.out.println(++test+- trying to find Robert again); + b1 = home.findByPrimaryKey (new Integer (2)); + System.out.println (getName (): +b1.getName ()); + try { System.out.println(++test+- trying to find an not existing bean); b1 = home.findByPrimaryKey (new Integer (0)); - System.out.println (getName (): +b1.getName ()); + assert(findByPrimaryKey(0) should fail, b1 == null); } catch (Exception _e) { System.out.println (_e.toString ()); } - + System.out.println(++test+- rename Daniel to Maria: 1, Daniel); b1 = home.findByPrimaryKey (new Integer (1)); System.out.println (name old: + b1.getName ()); b1.setName (Maria); - System.out.println (name new: + b1.getName ()); - + assert(getName == Maria, Maria.equals(b1.getName ())); + System.out.println(++test+- find all beans:); Iterator it = home.findAll ().iterator (); while (it.hasNext ()) @@ -234,11 +228,12 @@ System.out.print(++test+- +Calling create on StatelessSessionHome...); StatelessSession statelessSession = statelessSessionHome.create(); -if (statelessSession != null) System.out.println(ok); - +assert(statelessSessionHome.create() != null, statelessSession != null); +System.out.println(ok); + System.out.print(++test+- +Calling getEJBHome() on StatelessSession...); -if (statelessSession.getEJBHome() != null) System.out.println(ok); -else throw new Exception (Null home not OK); +assert(statelessSession.getEJBHome() != null, statelessSession.getEJBHome() != null); +System.out.println(ok); System.out.print(++test+- +Calling Business Method A on StatelessSession... ); statelessSession.callBusinessMethodA(); @@ -250,31 +245,22 @@ System.out.println(++test+- +Calling Business Method C on StatelessSession... ); System.out.println(statelessSession.callBusinessMethodC()); System.out.println(++test+- +Calling Business Method D on StatelessSession... ); -try { -statelessSession.callBusinessMethodD(); -System.out.println(ERROR, no exception was thrown); -} -catch (BusinessMethodException e) { -System.out.println(Caught BusinessMethodException OK); +try +{ + statelessSession.callBusinessMethodD(); + fail(callBusinessMethodD, no exception was thrown); +} +catch (BusinessMethodException e) +{ + System.out.println(Caught BusinessMethodException OK); } -catch (Exception e) { -System.out.println(ERROR, type +e.getClass()); -} System.out.print(++test+- +Calling Business Method E (getEJBObject) on StatelessSession... ); System.out.println(statelessSession.callBusinessMethodE()); - + System.out.print(++test+- +Calling
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: user57 Date: 01/07/31 22:17:38 Modified:src/main/org/jboss/test/testbean/test Tag: jboss_buildmagic Main.java Log: o updated from HEAD Revision ChangesPath No revision No revision 1.9.2.1 +146 -169 jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.9 retrieving revision 1.9.2.1 diff -u -r1.9 -r1.9.2.1 --- Main.java 2001/07/10 02:34:05 1.9 +++ Main.java 2001/08/01 05:17:38 1.9.2.1 @@ -154,44 +154,38 @@ { System.out.println(++test+- trying to create one with same primkey: 1, Patrick); b1 = home.create (1, Patrick); + fail(Was able to create duplicate SimpleBMP); } catch (Exception _e) { System.out.println (_e.toString ()); } - + System.out.println(++test+- create some more dummys:); for (int i = 0; i 50; ++i) home.create (i + 3, (Dummy +i)); - - try - { - System.out.println(++test+- trying to find Robert again); - b1 = home.findByPrimaryKey (new Integer (2)); - System.out.println (getName (): +b1.getName ()); - } - catch (Exception _e) - { - System.out.println (_e.toString ()); - } - + + System.out.println(++test+- trying to find Robert again); + b1 = home.findByPrimaryKey (new Integer (2)); + System.out.println (getName (): +b1.getName ()); + try { System.out.println(++test+- trying to find an not existing bean); b1 = home.findByPrimaryKey (new Integer (0)); - System.out.println (getName (): +b1.getName ()); + assert(findByPrimaryKey(0) should fail, b1 == null); } catch (Exception _e) { System.out.println (_e.toString ()); } - + System.out.println(++test+- rename Daniel to Maria: 1, Daniel); b1 = home.findByPrimaryKey (new Integer (1)); System.out.println (name old: + b1.getName ()); b1.setName (Maria); - System.out.println (name new: + b1.getName ()); - + assert(getName == Maria, Maria.equals(b1.getName ())); + System.out.println(++test+- find all beans:); Iterator it = home.findAll ().iterator (); while (it.hasNext ()) @@ -234,11 +228,12 @@ System.out.print(++test+- +Calling create on StatelessSessionHome...); StatelessSession statelessSession = statelessSessionHome.create(); -if (statelessSession != null) System.out.println(ok); - +assert(statelessSessionHome.create() != null, statelessSession != null); +System.out.println(ok); + System.out.print(++test+- +Calling getEJBHome() on StatelessSession...); -if (statelessSession.getEJBHome() != null) System.out.println(ok); -else throw new Exception (Null home not OK); +assert(statelessSession.getEJBHome() != null, statelessSession.getEJBHome() != null); +System.out.println(ok); System.out.print(++test+- +Calling Business Method A on StatelessSession... ); statelessSession.callBusinessMethodA(); @@ -250,31 +245,22 @@ System.out.println(++test+- +Calling Business Method C on StatelessSession... ); System.out.println(statelessSession.callBusinessMethodC()); System.out.println(++test+- +Calling Business Method D on StatelessSession... ); -try { -statelessSession.callBusinessMethodD(); -System.out.println(ERROR, no exception was thrown); -} -catch (BusinessMethodException e) { -System.out.println(Caught BusinessMethodException OK); -} -catch (Exception e) { -System.out.println(ERROR, type +e.getClass()); +try +{ + statelessSession.callBusinessMethodD(); + fail(callBusinessMethodD, no exception was thrown); +} +catch (BusinessMethodException e) +{ + System.out.println(Caught BusinessMethodException OK); } System.out.print(++test+- +Calling Business Method E (getEJBObject) on StatelessSession... ); System.out.println(statelessSession.callBusinessMethodE()); - + System.out.print(++test+- +Calling testClassLoading on StatelessSession... ); -try { statelessSession.testClassLoading(); System.out.println(OK); -} -catch (BusinessMethodException e) { -System.out.println(Failed); -} -
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: user57 Date: 01/07/09 19:34:05 Modified:src/main/org/jboss/test/testbean/test Main.java Log: o changed all deploy tests to deploy as a test and to not call System.exit(). this should allow reports to be generated for tests that fail to deploy. o modified run_tests.xml basic-security-tests to not-halt on error, so that test-and-report will produce reports even if the security tests fail. Revision ChangesPath 1.9 +18 -25jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- Main.java 2001/07/06 02:29:21 1.8 +++ Main.java 2001/07/10 02:34:05 1.9 @@ -55,7 +55,7 @@ * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.8 2001/07/06 02:29:21 user57 Exp $ +* @version $Id: Main.java,v 1.9 2001/07/10 02:34:05 user57 Exp $ */ public class Main extends junit.framework.TestCase @@ -1094,32 +1094,25 @@ restoreValidNamingProperties(); } + /** +* Setup the test suite. +*/ public static Test suite() { - TestSuite suite = new TestSuite(); - - try { - String[] filenames = { - bmp.jar, - testbean.jar, - testbean2.jar - }; - - System.out.println(Deploying...); - for (int i=0; ifilenames.length; i++) { - Deploy.deploy(filenames[i]); - } + TestSuite suite = new TestSuite(); + + // add a test case to deploy our support applications + String[] filenames = { + bmp.jar, + testbean.jar, + testbean2.jar + }; + suite.addTest(new Deploy.Deployer(filenames)); - suite.addTest(new TestSuite(Main.class)); + suite.addTest(new TestSuite(Main.class)); - // add a test cases to undeploy our support applications - for (int i=0; ifilenames.length; i++) { - suite.addTest(new Deploy.Undeployer(filenames[i])); - } - } - catch (Throwable t) { - t.printStackTrace(); - System.exit(0); - } - return suite; + // add a test case to undeploy our support applications + suite.addTest(new Deploy.Undeployer(filenames)); + + return suite; } } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: starksm Date: 01/07/08 18:06:06 Modified:src/main/org/jboss/test/testbean/test Tag: Branch_2_4 Main.java Log: Merge latest changes from main to the 2.4 branch Revision ChangesPath No revision No revision 1.7.2.1 +37 -2 jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -u -r1.7 -r1.7.2.1 --- Main.java 2001/05/03 22:36:25 1.7 +++ Main.java 2001/07/09 01:06:06 1.7.2.1 @@ -17,6 +17,10 @@ import java.util.Iterator; import java.util.Enumeration; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + import org.jboss.test.testbean.interfaces.StatelessSessionHome; import org.jboss.test.testbean.interfaces.StatelessSession; import org.jboss.test.testbean.interfaces.StatefulSessionHome; @@ -43,15 +47,15 @@ import org.jboss.test.bmp.interfaces.BMPHelperSessionHome; import org.jboss.test.bmp.interfaces.SimpleBMP; import org.jboss.test.bmp.interfaces.SimpleBMPHome; - +import org.jboss.test.util.Deploy; /** * Sample client for the jboss container. * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.7 2001/05/03 22:36:25 user57 Exp $ +* @version $Id: Main.java,v 1.7.2.1 2001/07/09 01:06:06 starksm Exp $ */ public class Main extends junit.framework.TestCase @@ -1064,6 +1068,7 @@ protected void setUp() throws Exception { + /* if (deployed) return; System.out.println(_); @@ -1082,9 +1087,39 @@ new org.jboss.jmx.client.Deployer().deploy(../deploy/testbean2.jar); deployed = true; System.out.println(done!); + */ } protected void tearDown() throws Exception { restoreValidNamingProperties(); + } + + public static Test suite() { + TestSuite suite = new TestSuite(); + + try { + String[] filenames = { + bmp.jar, + testbean.jar, + testbean2.jar + }; + + System.out.println(Deploying...); + for (int i=0; ifilenames.length; i++) { + Deploy.deploy(filenames[i]); + } + + suite.addTest(new TestSuite(Main.class)); + + // add a test cases to undeploy our support applications + for (int i=0; ifilenames.length; i++) { + suite.addTest(new Deploy.Undeployer(filenames[i])); + } + } + catch (Throwable t) { + t.printStackTrace(); + System.exit(0); + } + return suite; } } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: user57 Date: 01/07/05 19:29:21 Modified:src/main/org/jboss/test/testbean/test Main.java Log: o Changed all tests which deploy one or more jars to undeploy after testing. Revision ChangesPath 1.8 +37 -2 jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Main.java 2001/05/03 22:36:25 1.7 +++ Main.java 2001/07/06 02:29:21 1.8 @@ -17,6 +17,10 @@ import java.util.Iterator; import java.util.Enumeration; +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + import org.jboss.test.testbean.interfaces.StatelessSessionHome; import org.jboss.test.testbean.interfaces.StatelessSession; import org.jboss.test.testbean.interfaces.StatefulSessionHome; @@ -43,15 +47,15 @@ import org.jboss.test.bmp.interfaces.BMPHelperSessionHome; import org.jboss.test.bmp.interfaces.SimpleBMP; import org.jboss.test.bmp.interfaces.SimpleBMPHome; - +import org.jboss.test.util.Deploy; /** * Sample client for the jboss container. * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.7 2001/05/03 22:36:25 user57 Exp $ +* @version $Id: Main.java,v 1.8 2001/07/06 02:29:21 user57 Exp $ */ public class Main extends junit.framework.TestCase @@ -1064,6 +1068,7 @@ protected void setUp() throws Exception { + /* if (deployed) return; System.out.println(_); @@ -1082,9 +1087,39 @@ new org.jboss.jmx.client.Deployer().deploy(../deploy/testbean2.jar); deployed = true; System.out.println(done!); + */ } protected void tearDown() throws Exception { restoreValidNamingProperties(); + } + + public static Test suite() { + TestSuite suite = new TestSuite(); + + try { + String[] filenames = { + bmp.jar, + testbean.jar, + testbean2.jar + }; + + System.out.println(Deploying...); + for (int i=0; ifilenames.length; i++) { + Deploy.deploy(filenames[i]); + } + + suite.addTest(new TestSuite(Main.class)); + + // add a test cases to undeploy our support applications + for (int i=0; ifilenames.length; i++) { + suite.addTest(new Deploy.Undeployer(filenames[i])); + } + } + catch (Throwable t) { + t.printStackTrace(); + System.exit(0); + } + return suite; } } ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: user57 Date: 01/05/03 15:36:25 Modified:src/main/org/jboss/test/testbean/test Main.java Log: o Changed namingFactory providerURL fields to final. Revision ChangesPath 1.7 +6 -10 jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Main.java 2001/05/02 03:07:18 1.6 +++ Main.java 2001/05/03 22:36:25 1.7 @@ -51,7 +51,7 @@ * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.6 2001/05/02 03:07:18 user57 Exp $ +* @version $Id: Main.java,v 1.7 2001/05/03 22:36:25 user57 Exp $ */ public class Main extends junit.framework.TestCase @@ -60,9 +60,12 @@ static int test = 0; static Date startDate = new Date(); -protected String namingFactory; -protected String providerURL; +protected final String namingFactory = +System.getProperty(Context.INITIAL_CONTEXT_FACTORY); +protected final String providerURL = +System.getProperty(Context.PROVIDER_URL); + public Main(String name) { super(name); } @@ -997,9 +1000,7 @@ } catch (RemoteException e) { System.out.println( ... OK, exception message: + e.getMessage()); } - - //*/ System.out.println(); System.out.println(); @@ -1081,11 +1082,6 @@ new org.jboss.jmx.client.Deployer().deploy(../deploy/testbean2.jar); deployed = true; System.out.println(done!); - - // save the basics to connect to the naming server so we can - // test that the handle impls return when new InitialContext() fails - namingFactory = System.getProperty(Context.INITIAL_CONTEXT_FACTORY); - providerURL = System.getProperty(Context.PROVIDER_URL); } protected void tearDown() throws Exception { ___ Jboss-development mailing list [EMAIL PROTECTED] http://lists.sourceforge.net/lists/listinfo/jboss-development
[JBoss-dev] CVS update: jbosstest/src/main/org/jboss/test/testbean/test Main.java
User: user57 Date: 01/05/01 20:07:18 Modified:src/main/org/jboss/test/testbean/test Main.java Log: o Updated testbeantest.sh to use the correct classpath. o Updated jboss-client.jar so that testbeantest.sh would run correctly and not complain about serial version problems. o Updated testbean/test/Main to HomeHandles and getting the EJBHome from them. o Added installInvalidNamingProperties() and restoreValidNamingProperties() to validate that the bean and home handles remeber which container they came from. NOTE: This will cause errors if the tested container does not have the required properties setup to specify the handle-jndi properties. Not really sure how to work around this. Revision ChangesPath 1.6 +70 -5 jbosstest/src/main/org/jboss/test/testbean/test/Main.java Index: Main.java === RCS file: /cvsroot/jboss/jbosstest/src/main/org/jboss/test/testbean/test/Main.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Main.java 2000/12/13 01:33:53 1.5 +++ Main.java 2001/05/02 03:07:18 1.6 @@ -8,6 +8,8 @@ import javax.ejb.DuplicateKeyException; import javax.ejb.Handle; import javax.ejb.EJBMetaData; +import javax.ejb.EJBHome; +import javax.ejb.HomeHandle; import java.util.Date; import java.util.Properties; @@ -49,7 +51,7 @@ * * @author a href=mailto:[EMAIL PROTECTED];Marc Fleury/a * @author a href=mailto:[EMAIL PROTECTED];Hugo Pinto/a -* @version $Id: Main.java,v 1.5 2000/12/13 01:33:53 hugo Exp $ +* @version $Id: Main.java,v 1.6 2001/05/02 03:07:18 user57 Exp $ */ public class Main extends junit.framework.TestCase @@ -57,6 +59,9 @@ static boolean deployed = false; static int test = 0; static Date startDate = new Date(); + +protected String namingFactory; +protected String providerURL; public Main(String name) { super(name); @@ -735,8 +740,29 @@ System.out.print(++test+- +Looking up the home AllTypes...); AllTypesHome allTypesHome = (AllTypesHome) ctx.lookup(AllTypes); if (allTypesHome!= null ) System.out.println(ok); -System.out.print(++test+- +Calling findByPrimaryKey on AllTypesHome with name seb...); + +System.out.print(++test+- +Getting the home handle...); +HomeHandle homeHandle = allTypesHome.getHomeHandle(); +System.out.println(OK); + +System.out.print(++test+- +Getting the home back from the handle...); +installInvalidNamingProperties(); +EJBHome aHome = homeHandle.getEJBHome(); +System.out.println(OK); +restoreValidNamingProperties(); + +System.out.print(++test+- +Getting metadata from home...); +EJBMetaData aMetaData = aHome.getEJBMetaData(); +System.out.println(OK); +System.out.print(++test+- +Getting home from metadata...); +installInvalidNamingProperties(); +aHome = aMetaData.getEJBHome(); +System.out.println(OK); +restoreValidNamingProperties(); + +System.out.print(++test+- +Calling findByPrimaryKey on AllTypesHome with name seb...); + AllTypes allTypes = null; try { allTypes = allTypesHome.findByPrimaryKey(seb); @@ -776,8 +802,10 @@ System.out.println(OK); System.out.print(++test+- +getting the bean back from the handle...); +installInvalidNamingProperties(); StatefulSession sfBean = (StatefulSession)sfHandle.getEJBObject(); System.out.println(OK); +restoreValidNamingProperties(); System.out.print(++test+- +calling business method A on stateful: ); System.out.println(OK, result is + sfBean.callBusinessMethodA()); @@ -791,9 +819,11 @@ System.out.println(OK); System.out.print(++test+- +getting the bean back from the handle...); - StatelessSession slBean = (StatelessSession)slHandle.getEJBObject(); +installInvalidNamingProperties(); +StatelessSession slBean = (StatelessSession)slHandle.getEJBObject(); System.out.println(OK); - +restoreValidNamingProperties(); + System.out.print(++test+- +calling business method B on stateless: ); System.out.println(OK, result is + slBean.callBusinessMethodB()); @@ -806,9 +836,11 @@ System.out.println(OK); System.out.print(++test+- +getting the bean back from the handle...); +installInvalidNamingProperties();