User: kimptoc
Date: 01/09/07 03:26:44
Modified: src/main/org/jboss/test/testbean/test Main.java
Log:
fixed deprecation warnings
Revision Changes Path
1.11 +49 -49 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.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");
System.out.print(++test+"- "+"Calling getEJBHome() on
StatefulSession...");
- assert("statefulSession.getEJBHome() != null", statefulSession.getEJBHome()
!= null);
+ assertTrue("statefulSession.getEJBHome() != null",
statefulSession.getEJBHome() != null);
System.out.println("ok");
System.out.println(++test+"- "+"Calling Business Method A on
StatefulSession... ");
System.out.println(statefulSession.callBusinessMethodA());
@@ -347,13 +347,13 @@
System.out.println(statefulSession.getPrimaryKey());
System.out.print(++test+"- "+"Get Handle ... ");
Handle statefulHandle = statefulSession.getHandle();
- assert("statefulHandle != null", statefulHandle != null);
+ assertTrue("statefulHandle != null", statefulHandle != null);
System.out.println("OK");
System.out.print(++test+"- "+"Serialize handle and deserialize....");
MarshalledObject mo2 = new MarshalledObject(statefulHandle);
Handle statefulHandle2 = (Handle) mo2.get();
StatefulSession statefulSession2 = (StatefulSession)
statefulHandle2.getEJBObject();
- assert("statefulSession2 != null", statefulSession2 != null);
+ assertTrue("statefulSession2 != null", statefulSession2 != null);
System.out.println("OK");
System.out.println(++test+"- "+"Calling businessMethodB on it...");
System.out.println(statefulSession2.callBusinessMethodB());
@@ -426,7 +426,7 @@
System.out.println("ok");
}
System.out.print(++test+"- "+"Calling getEJBHome() on EntityCMP...");
- assert("enterpriseEntity.getEJBHome() != null",
enterpriseEntity.getEJBHome() != null);
+ assertTrue("enterpriseEntity.getEJBHome() != null",
enterpriseEntity.getEJBHome() != null);
System.out.println("ok");
System.out.print(++test+"- "+"Getting a new reference with findByPK...");
@@ -437,7 +437,7 @@
catch (Exception re) {
re.printStackTrace();
}
- assert("enterpriseEntity2 != null", enterpriseEntity2 != null);
+ assertTrue("enterpriseEntity2 != null", enterpriseEntity2 != null);
System.out.println("ok");
System.out.println(++test+"- "+"Calling Business Method A on
enterpriseEntity... ");
System.out.println(enterpriseEntity.callBusinessMethodA());
@@ -460,7 +460,7 @@
System.out.print(++test+"- "+"Calling getOtherField() on enterpriseEntity
(should be 4)...");
int value = enterpriseEntity.getOtherField();
- assert("enterpriseEntity.getOtherField() == 4", value == 4);
+ assertTrue("enterpriseEntity.getOtherField() == 4", value == 4);
System.out.println("value is "+value+", OK");
System.out.println("***Testing the various local Object class calls");
@@ -477,7 +477,7 @@
System.out.println(enterpriseEntity.getPrimaryKey());
System.out.print(++test+"- "+"Get Handle ... ");
Handle entityHandle = enterpriseEntity.getHandle();
- assert("entityHandle != null", entityHandle != null);
+ assertTrue("entityHandle != null", entityHandle != null);
System.out.println("OK");
System.out.print(++test+"- "+"Serialize handle and deserialize....");
MarshalledObject mo3 = new MarshalledObject(entityHandle);
@@ -538,20 +538,20 @@
System.out.print(++test+"- "+"Looking up home for nextgen.EntityBMP...");
EntityBMPHome bmpHome = (EntityBMPHome) ctx.lookup("nextgen.EntityBMP");
- assert("bmpHome != null", bmpHome != null);
+ assertTrue("bmpHome != null", bmpHome != null);
System.out.println("ok");
// the current test will always return
System.out.print(++test+"- "+"Calling create on the home...");
EntityBMP bmpBean = bmpHome.create("Marc");
- assert("bmpBean != null", bmpBean != null);
+ assertTrue("bmpBean != null", bmpBean != null);
System.out.println("ok");
// Let's call a business method to see the flow of server calls
System.out.print(++test+"- "+"Calling getEJBHome() on EntityBMP...");
- assert("bmpBean.getEJBHome() != null", bmpBean.getEJBHome() != null);
+ assertTrue("bmpBean.getEJBHome() != null", bmpBean.getEJBHome() != null);
System.out.println("ok");
System.out.println(++test+"- "+"Calling business methodA on BMP bean...");
@@ -597,7 +597,7 @@
System.out.print(++test+"- "+"Looking up home for nextgen.EntityPK...");
EntityPKHome pkHome = (EntityPKHome) ctx.lookup("nextgen.EntityPK");
- assert("pkHome != null", pkHome != null);
+ assertTrue("pkHome != null", pkHome != null);
System.out.println("ok");
System.out.print(++test+"- "+"Calling find on the home...");
@@ -615,11 +615,11 @@
}
- assert("pkBean != null", pkBean != null);
+ assertTrue("pkBean != null", pkBean != null);
System.out.println("ok");
System.out.print(++test+"- "+"Retrieving other field...");
- assert("pkBean.getOtherField() == 0", pkBean.getOtherField() == 0);
+ assertTrue("pkBean.getOtherField() == 0", pkBean.getOtherField() == 0);
System.out.print(++test+"- "+"Setting it to 4...");
pkBean.setOtherField(4);
System.out.println("ok");
@@ -629,24 +629,24 @@
// Now we should be able to find it
pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100,1000.0,
"Marc"));
- assert("pkBean != null", pkBean != null);
+ assertTrue("pkBean != null", pkBean != null);
System.out.println("ok");
// check if the other field has been saved
System.out.print(++test+"- "+"Retrieving other field again, should be
4...");
int newValue = pkBean.getOtherField();
- assert("pkBean.getOtherField() == 4", newValue == 4);
+ assertTrue("pkBean.getOtherField() == 4", newValue == 4);
System.out.println("4, ok");
// Get a new EJBObject for this guy
// Now we should be able to find it
System.out.print(++test+"- gettting a new reference ... ") ;
EntityPK pkBean2 = pkHome.findByPrimaryKey(new AComplexPK(true, 10,
100,1000.0, "Marc"));
- assert("findByPrimaryKey AComplexPK", pkBean2 != null);
+ assertTrue("findByPrimaryKey AComplexPK", pkBean2 != null);
System.out.println("ok");
System.out.print(++test+"- Retrieving other field again, should be
4...");
int newValue2 = pkBean2.getOtherField();
- assert("Retrieving other field again, should be 4...", newValue2 == 4);
+ assertTrue("Retrieving other field again, should be 4...", newValue2 == 4);
// Now remove it
System.out.println(++test+"- "+"Removing the bean...");
@@ -655,7 +655,7 @@
{
System.out.println(++test+"- "+"I should not find it...");
pkBean = pkHome.findByPrimaryKey(new AComplexPK(true, 10, 100, 1000.0,
"Marc"));
- assert("findByPrimaryKey should fail", pkBean == null);
+ assertTrue("findByPrimaryKey should fail", pkBean == null);
}
catch (Exception e)
{
@@ -849,95 +849,95 @@
Collection coll = allTypes.getObjectList();
System.out.println("OK");
System.out.print(++test+"- "+"stateful bean ");
- assert(coll.contains(sfBean));
+ assertTrue(coll.contains(sfBean));
System.out.println("OK");
System.out.print(++test+"- "+"stateless bean ");
- assert(coll.contains(slBean));
+ assertTrue(coll.contains(slBean));
System.out.println("OK");
System.out.print(++test+"- "+"entity bean ");
- assert(coll.contains(eeBean));
+ assertTrue(coll.contains(eeBean));
System.out.println("OK");
System.out.println("Testing automatically generated finders");
System.out.print(++test+"- "+"findAll()..");
coll = allTypesHome.findAll();
- assert(coll.contains(allTypes));
+ assertTrue(coll.contains(allTypes));
System.out.println("OK");
System.out.print(++test+"- "+"findByPrimaryKey()...");
AllTypes result = allTypesHome.findByPrimaryKey("seb");
- assert(result.equals(allTypes));
+ assertTrue(result.equals(allTypes));
System.out.println("OK");
System.out.print(++test+"- "+"findByABoolean()..");
coll = allTypesHome.findByABoolean(allTypes.getBoolean());
- assert(coll.contains(allTypes));
+ assertTrue(coll.contains(allTypes));
System.out.println("OK");
System.out.print(++test+"- "+"findByAByte()..");
coll = allTypesHome.findByAByte(allTypes.getByte());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByAShort()..");
coll = allTypesHome.findByAShort(allTypes.getShort());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByAnInt()..");
coll = allTypesHome.findByAnInt(allTypes.getInt());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByALong()..");
coll = allTypesHome.findByALong(allTypes.getLong());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByAFloat()..");
coll = allTypesHome.findByAFloat(allTypes.getFloat());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByADouble()..");
coll = allTypesHome.findByADouble(allTypes.getDouble());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.println("No Char test yet, bug in jdk");
System.out.print(++test+"- "+"findByAString()..");
coll = allTypesHome.findByAString(allTypes.getString());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByADate()..");
coll = allTypesHome.findByADate(allTypes.getDate());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByATimestamp()..");
coll = allTypesHome.findByATimestamp(allTypes.getTimestamp());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByAnObject()..");
coll = allTypesHome.findByAnObject(allTypes.getObject());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByStatefulSession()..");
coll =
allTypesHome.findByStatefulSession((StatefulSession)allTypes.getStateful().getEJBObject());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByStatelessSession()..");
coll =
allTypesHome.findByStatelessSession((StatelessSession)allTypes.getStateless().getEJBObject());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByEnterpriseEntity()..");
coll =
allTypesHome.findByEnterpriseEntity((EnterpriseEntity)allTypes.getEntity().getEJBObject());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.println("Testing finders defined in jaws.xml");
System.out.print(++test+"- "+"findByMinInt()..");
coll = allTypesHome.findByMinInt(0);
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
System.out.print(++test+"- "+"findByIntAndDouble()..");
coll = allTypesHome.findByIntAndDouble(allTypes.getInt(),
allTypes.getDouble());
- assert (coll.contains(allTypes));System.out.println("OK");
+ assertTrue(coll.contains(allTypes));System.out.println("OK");
}
public void testBeanManagedTransactionDemarcation()
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development