You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2003/03/14 00:39:03 UTC
cvs commit: db-ojb/src/ejb/org/apache/ojb/ejb PBClient.java ODMGClient.java
arminw 2003/03/13 15:39:03
Modified: src/ejb/org/apache/ojb/ejb PBClient.java ODMGClient.java
Log:
do some output '.',
when run stress tests
Revision Changes Path
1.8 +16 -7 db-ojb/src/ejb/org/apache/ojb/ejb/PBClient.java
Index: PBClient.java
===================================================================
RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/PBClient.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- PBClient.java 10 Jan 2003 16:52:22 -0000 1.7
+++ PBClient.java 13 Mar 2003 23:39:03 -0000 1.8
@@ -62,11 +62,11 @@
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import java.rmi.RemoteException;
-import java.util.List;
-import java.util.Properties;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
/**
* Test client using the {@link org.apache.ojb.ejb.PBSessionBean}.
@@ -78,6 +78,7 @@
{
Context ctx;
PBSessionRemote bean;
+ static int loops = 500;
public PBClient(String s)
{
@@ -93,8 +94,8 @@
{
// PBClient client = new PBClient();
// client.start();
- String[] arr = {PBClient.class.getName()};
- junit.textui.TestRunner.main(arr);
+ loops = args.length > 0 ? new Integer(args[0]).intValue(): 500;
+ junit.textui.TestRunner.main(new String[]{PBClient.class.getName()});
}
// only used when running outside junit
@@ -206,17 +207,25 @@
public void testStress() throws Exception
{
System.out.println("## PB-api testStress");
- for (int i = 0; i < 500; i++)
+ System.out.println("Stress test will be done with " + loops + " loops");
+ System.out.println("# Store #");
+ for (int i = 0; i < loops; i++)
{
bean.storeObjects(VOHelper.createNewArticleList(1));
+ if(i%10==0)System.out.print(".");
+ if(i%400==0)System.out.println();
}
Collection col = bean.getAllObjects(ArticleVO.class);
+ int i =0;
+ System.out.println("\n# Delete #");
for (Iterator iterator = col.iterator(); iterator.hasNext();)
{
ArticleVO article = (ArticleVO) iterator.next();
List del = new ArrayList();
del.add(article);
bean.deleteObjects(del);
+ if(++i%10==0)System.out.print(".");
+ if(i%400==0)System.out.println();
}
System.out.println("");
System.out.println("## PB-api testStress END ##");
1.9 +13 -4 db-ojb/src/ejb/org/apache/ojb/ejb/ODMGClient.java
Index: ODMGClient.java
===================================================================
RCS file: /home/cvs/db-ojb/src/ejb/org/apache/ojb/ejb/ODMGClient.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ODMGClient.java 10 Jan 2003 16:52:22 -0000 1.8
+++ ODMGClient.java 13 Mar 2003 23:39:03 -0000 1.9
@@ -78,6 +78,7 @@
{
Context ctx;
ODMGSessionRemote sampleBean;
+ static int loops = 500;
public ODMGClient(String s)
{
@@ -91,8 +92,8 @@
public static void main(String[] args)
{
- String[] arr = {ODMGClient.class.getName()};
- junit.textui.TestRunner.main(arr);
+ loops = args.length > 0 ? new Integer(args[0]).intValue(): 500;
+ junit.textui.TestRunner.main(new String[] {ODMGClient.class.getName()});
// ODMGClient client = new ODMGClient();
// client.start();
}
@@ -262,17 +263,25 @@
public void testStress() throws Exception
{
System.out.println("## ODMG-api testStress");
- for (int i = 0; i < 500; i++)
+ System.out.println("Stress test will be done with " + loops + " loops");
+ System.out.println("# Store #");
+ for (int i = 0; i < loops; i++)
{
sampleBean.storeObjects(VOHelper.createNewArticleList(1));
+ if(i%10==0)System.out.print(".");
+ if(i%400==0)System.out.println();
}
Collection col = sampleBean.getAllObjects(ArticleVO.class);
+ System.out.println("\n# Delete #");
+ int i =0;
for (Iterator iterator = col.iterator(); iterator.hasNext();)
{
ArticleVO article = (ArticleVO) iterator.next();
List del = new ArrayList();
del.add(article);
sampleBean.deleteObjects(del);
+ if(++i%10==0)System.out.print(".");
+ if(i%400==0)System.out.println();
}
System.out.println("");
System.out.println("## ODMG-api testStress END ##");