db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: jakarta-ojb/src/ejb/org/apache/ojb/ejb ArticleVO.java CategoryVO.java PersonVO.java ArticleManagerODMGBean.java ArticleManagerPBBean.java ODMGClient.java ODMGSessionBean.java PBClient.java PBSessionBean.java PersonArticleManagerODMGBean.java PersonArticleManagerPBBean.java PersonManagerODMGBean.java PersonManagerPBBean.java StressTestClient.java VOHelper.java
Date Fri, 10 Jan 2003 16:52:23 GMT
arminw      2003/01/10 08:52:23

  Modified:    src/ejb/org/apache/ojb/ejb ArticleManagerODMGBean.java
                        ArticleManagerPBBean.java ODMGClient.java
                        ODMGSessionBean.java PBClient.java
                        PBSessionBean.java
                        PersonArticleManagerODMGBean.java
                        PersonArticleManagerPBBean.java
                        PersonManagerODMGBean.java PersonManagerPBBean.java
                        StressTestClient.java VOHelper.java
  Added:       src/ejb/org/apache/ojb/ejb ArticleVO.java CategoryVO.java
                        PersonVO.java
  Log:
  repair, update ejb-examples
  
  Revision  Changes    Path
  1.5       +8 -9      jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerODMGBean.java
  
  Index: ArticleManagerODMGBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerODMGBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArticleManagerODMGBean.java	10 Jan 2003 11:33:10 -0000	1.4
  +++ ArticleManagerODMGBean.java	10 Jan 2003 16:52:22 -0000	1.5
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
  @@ -103,9 +102,9 @@
       /**
        * @ejb:interface-method
        */
  -    public Article storeArticle(Article article)
  +    public ArticleVO storeArticle(ArticleVO article)
       {
  -        return (Article) this.storeObject(article);
  +        return (ArticleVO) this.storeObject(article);
       }
   
       /**
  @@ -121,7 +120,7 @@
        *
        * @ejb:interface-method
        */
  -    public Article failureStore(Article article)
  +    public ArticleVO failureStore(ArticleVO article)
       {
           storeArticle(article);
           // now we want to rollback
  @@ -131,7 +130,7 @@
       /**
        * @ejb:interface-method
        */
  -    public void deleteArticle(Article article)
  +    public void deleteArticle(ArticleVO article)
       {
           this.deleteObject(article);
       }
  @@ -149,7 +148,7 @@
        */
       public int countArticles()
       {
  -        return this.getCount(Article.class);
  +        return this.getCount(ArticleVO.class);
       }
   
       /**
  @@ -157,7 +156,7 @@
        */
       public Collection getAllArticles()
       {
  -        return this.getAllObjects(Article.class);
  +        return this.getAllObjects(ArticleVO.class);
       }
   
       /**
  @@ -168,7 +167,7 @@
           OQLQuery query = getImplementation().newOQLQuery();
           try
           {
  -            StringBuffer buf = new StringBuffer("select allObjects from " + Article.class.getName());
  +            StringBuffer buf = new StringBuffer("select allObjects from " + ArticleVO.class.getName());
               buf.append(" where articleId not null");
               if (articleName != null) buf.append(" and articleName = " + articleName);
               query.create(buf.toString());
  
  
  
  1.5       +8 -9      jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerPBBean.java
  
  Index: ArticleManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleManagerPBBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ArticleManagerPBBean.java	10 Jan 2003 11:33:10 -0000	1.4
  +++ ArticleManagerPBBean.java	10 Jan 2003 16:52:22 -0000	1.5
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
  @@ -102,9 +101,9 @@
       /**
        * @ejb:interface-method
        */
  -    public Article storeArticle(Article article)
  +    public ArticleVO storeArticle(ArticleVO article)
       {
  -        return (Article) this.storeObject(article);
  +        return (ArticleVO) this.storeObject(article);
       }
   
       /**
  @@ -118,7 +117,7 @@
       /**
        * @ejb:interface-method
        */
  -    public void deleteArticle(Article article)
  +    public void deleteArticle(ArticleVO article)
       {
           this.deleteObject(article);
       }
  @@ -136,7 +135,7 @@
        */
       public int countArticles()
       {
  -        return this.getCount(Article.class);
  +        return this.getCount(ArticleVO.class);
       }
   
       /**
  @@ -144,7 +143,7 @@
        */
       public Collection getAllArticles()
       {
  -        return this.getAllObjects(Article.class);
  +        return this.getAllObjects(ArticleVO.class);
       }
   
       /**
  @@ -152,7 +151,7 @@
        *
        * @ejb:interface-method
        */
  -    public Article failureStore(Article article)
  +    public ArticleVO failureStore(ArticleVO article)
       {
           storeArticle(article);
           // now we want to rollback
  @@ -167,7 +166,7 @@
           PersistenceBroker broker = getBroker();
           Criteria criteria = new Criteria();
           if (articleName != null) criteria.addEqualTo("articleName", articleName);
  -        Query q = new QueryByCriteria(Article.class, null);
  +        Query q = new QueryByCriteria(ArticleVO.class, null);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
           return result;
  
  
  
  1.8       +5 -6      jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGClient.java
  
  Index: ODMGClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGClient.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ODMGClient.java	10 Jan 2003 11:33:10 -0000	1.7
  +++ ODMGClient.java	10 Jan 2003 16:52:22 -0000	1.8
  @@ -55,7 +55,6 @@
    */
   
   import junit.framework.TestCase;
  -import org.apache.ojb.odmg.Article;
   
   import javax.ejb.EJBHome;
   import javax.naming.Context;
  @@ -262,21 +261,21 @@
   
       public void testStress() throws Exception
       {
  -        System.out.println("## testStress");
  +        System.out.println("## ODMG-api testStress");
           for (int i = 0; i < 500; i++)
           {
               sampleBean.storeObjects(VOHelper.createNewArticleList(1));
           }
  -        Collection col = sampleBean.getAllObjects(Article.class);
  +        Collection col = sampleBean.getAllObjects(ArticleVO.class);
           for (Iterator iterator = col.iterator(); iterator.hasNext();)
           {
  -            Article article = (Article) iterator.next();
  +            ArticleVO article = (ArticleVO) iterator.next();
               List del = new ArrayList();
               del.add(article);
               sampleBean.deleteObjects(del);
           }
           System.out.println("");
  -        System.out.println("## testStress END ##");
  +        System.out.println("## ODMG-api testStress END ##");
       }
   
       public void testServerSideMethods() throws RemoteException
  
  
  
  1.9       +13 -14    jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGSessionBean.java
  
  Index: ODMGSessionBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/ODMGSessionBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ODMGSessionBean.java	10 Jan 2003 11:33:10 -0000	1.8
  +++ ODMGSessionBean.java	10 Jan 2003 16:52:22 -0000	1.9
  @@ -54,9 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
  +
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.jboss.ojb.odmg.ODMGFactory;
  @@ -184,7 +183,7 @@
       {
           try
           {
  -            log.info("storeObjects");
  +            if(log.isDebugEnabled()) log.debug("storeObjects");
   
               /* One possibility of storing objects is to use the current transaction
                associated with the container */
  @@ -207,7 +206,7 @@
        */
       public void deleteObjects(List objects)
       {
  -        log.info("deleteObjects");
  +        if(log.isDebugEnabled()) log.debug("deleteObjects");
           db = odmg.getDatabase(null);
           for (Iterator iterator = objects.iterator(); iterator.hasNext();)
           {
  @@ -217,7 +216,7 @@
   
       protected int getObjectCount(Implementation ojb, Class target)
       {
  -        log.info("getObjectCount was called");
  +        if(log.isDebugEnabled()) log.debug("getObjectCount was called");
           DList list;
           try
           {
  @@ -237,8 +236,8 @@
        */
       public int getArticleCount()
       {
  -        log.info("getArticleCount was called");
  -        return getObjectCount(odmg, Article.class);
  +        if(log.isDebugEnabled()) log.debug("getArticleCount was called");
  +        return getObjectCount(odmg, ArticleVO.class);
       }
   
       /**
  @@ -246,8 +245,8 @@
        */
       public int getPersonCount()
       {
  -        log.info("getPersonCount was called");
  -        return getObjectCount(odmg, Person.class);
  +        if(log.isDebugEnabled()) log.debug("getPersonCount was called");
  +        return getObjectCount(odmg, PersonVO.class);
       }
   
       /**
  @@ -256,7 +255,7 @@
       public boolean allInOne(List articles, List persons)
       {
           boolean passedWell = true;
  -        log.info("allInOne method was called");
  +        if(log.isDebugEnabled()) log.debug("allInOne method was called");
           StringBuffer buf = new StringBuffer();
   
           String sep = System.getProperty("line.separator");
  @@ -298,7 +297,7 @@
        */
       public void rollbackTest(List objects)
       {
  -        log.info("rollbackTest method was called");
  +        if(log.isDebugEnabled()) log.debug("rollbackTest method was called");
           storeObjects(objects);
           throw new EJBException("## Testing of rollback behaviour ##");
       }
  @@ -308,7 +307,7 @@
        */
       public void rollbackTest2(List objects)
       {
  -        log.info("rollbackTest2 method was called");
  +        if(log.isDebugEnabled()) log.debug("rollbackTest2 method was called");
           storeObjects(objects);
           odmg.currentTransaction().abort();
       }
  @@ -318,7 +317,7 @@
        */
       public Collection getAllObjects(Class target)
       {
  -        log.info("getAllObjects was called");
  +        if(log.isDebugEnabled()) log.debug("getAllObjects was called");
           OQLQuery query = odmg.newOQLQuery();
           try
           {
  
  
  
  1.7       +22 -1     jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBClient.java
  
  Index: PBClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBClient.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PBClient.java	10 Jan 2003 11:33:10 -0000	1.6
  +++ PBClient.java	10 Jan 2003 16:52:22 -0000	1.7
  @@ -64,6 +64,9 @@
   import java.rmi.RemoteException;
   import java.util.List;
   import java.util.Properties;
  +import java.util.Collection;
  +import java.util.Iterator;
  +import java.util.ArrayList;
   
   /**
    * Test client using the {@link org.apache.ojb.ejb.PBSessionBean}.
  @@ -200,4 +203,22 @@
           assertTrue("Something happened on sever side test method - 'allInOne(...)'", result);
       }
   
  +    public void testStress() throws Exception
  +    {
  +        System.out.println("## PB-api testStress");
  +        for (int i = 0; i < 500; i++)
  +        {
  +            bean.storeObjects(VOHelper.createNewArticleList(1));
  +        }
  +        Collection col = bean.getAllObjects(ArticleVO.class);
  +        for (Iterator iterator = col.iterator(); iterator.hasNext();)
  +        {
  +            ArticleVO article = (ArticleVO) iterator.next();
  +            List del = new ArrayList();
  +            del.add(article);
  +            bean.deleteObjects(del);
  +        }
  +        System.out.println("");
  +        System.out.println("## PB-api testStress END ##");
  +    }
   }
  
  
  
  1.7       +11 -13    jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBSessionBean.java
  
  Index: PBSessionBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PBSessionBean.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- PBSessionBean.java	10 Jan 2003 11:33:10 -0000	1.6
  +++ PBSessionBean.java	10 Jan 2003 16:52:22 -0000	1.7
  @@ -55,11 +55,9 @@
    */
   
   
  -import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.PBKey;
   import org.apache.ojb.broker.PersistenceBroker;
   import org.apache.ojb.broker.PersistenceBrokerException;
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
   import org.apache.ojb.broker.ta.PBFactoryIF;
  @@ -172,7 +170,7 @@
   
       protected PersistenceBroker getBroker()
       {
  -        log.info("getBroker was called");
  +        if(log.isDebugEnabled()) log.debug("getBroker was called");
           return pbf.createPersistenceBroker(pbKey);
       }
   
  @@ -206,7 +204,7 @@
        */
       public Collection getAllObjects(Class target)
       {
  -        log.info("getAllObjects was called");
  +        if(log.isDebugEnabled()) log.debug("getAllObjects was called");
           PersistenceBroker broker = getBroker();
           Query q = new QueryByCriteria(target, null);
           Collection result = broker.getCollectionByQuery(q);
  @@ -219,8 +217,8 @@
        */
       public int getArticleCount()
       {
  -        log.info("getArticleCount was called");
  -        return getCount(Article.class);
  +        if(log.isDebugEnabled()) log.debug("getArticleCount was called");
  +        return getCount(ArticleVO.class);
       }
   
       /**
  @@ -228,8 +226,8 @@
        */
       public int getPersonCount()
       {
  -        log.info("getPersonCount was called");
  -        return getCount(Person.class);
  +        if(log.isDebugEnabled()) log.debug("getPersonCount was called");
  +        return getCount(PersonVO.class);
       }
   
       /**
  @@ -237,7 +235,7 @@
        */
       public List storeObjects(List objects)
       {
  -        log.info("storeObjects was called");
  +        if(log.isDebugEnabled()) log.debug("storeObjects was called");
           PersistenceBroker broker = getBroker();
           List stored = this.storeObjects(broker, objects);
           broker.close();
  @@ -249,7 +247,7 @@
        */
       public void deleteObjects(List objects)
       {
  -        log.info("deleteObjects was called");
  +        if(log.isDebugEnabled()) log.debug("deleteObjects was called");
           PersistenceBroker broker = getBroker();
           this.deleteObjects(broker, objects);
           broker.close();
  @@ -260,7 +258,7 @@
        */
       public boolean allInOne(List articles, List persons)
       {
  -        log.info("allInOne was called");
  +        if(log.isDebugEnabled()) log.debug("allInOne was called");
           StringBuffer buf = new StringBuffer();
           boolean passedWell = true;
           String sep = System.getProperty("line.separator");
  @@ -294,7 +292,7 @@
        */
       public void rollbackTest(List objects)
       {
  -        log.info("rollbackTest was called");
  +        if(log.isDebugEnabled()) log.debug("rollbackTest was called");
           storeObjects(objects);
           throw new EJBException("## Testing of rollback behaviour ##");
       }
  
  
  
  1.5       +2 -3      jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerODMGBean.java
  
  Index: PersonArticleManagerODMGBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerODMGBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersonArticleManagerODMGBean.java	10 Jan 2003 11:33:10 -0000	1.4
  +++ PersonArticleManagerODMGBean.java	10 Jan 2003 16:52:22 -0000	1.5
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  @@ -154,7 +153,7 @@
        *
        * @ejb:interface-method
        */
  -    public void nestedRollback2(Article article, List persons)
  +    public void nestedRollback2(ArticleVO article, List persons)
       {
           ArticleManagerODMGLocal am = getArticleManager();
           PersonManagerODMGLocal pm = getPersonManager();
  
  
  
  1.5       +2 -3      jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerPBBean.java
  
  Index: PersonArticleManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonArticleManagerPBBean.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- PersonArticleManagerPBBean.java	10 Jan 2003 11:33:10 -0000	1.4
  +++ PersonArticleManagerPBBean.java	10 Jan 2003 16:52:22 -0000	1.5
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  @@ -153,7 +152,7 @@
        *
        * @ejb:interface-method
        */
  -    public void nestedRollback2(Article article, List persons)
  +    public void nestedRollback2(ArticleVO article, List persons)
       {
           ArticleManagerPBLocal am = getArticleManager();
           PersonManagerPBLocal pm = getPersonManager();
  
  
  
  1.4       +7 -8      jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerODMGBean.java
  
  Index: PersonManagerODMGBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerODMGBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersonManagerODMGBean.java	10 Jan 2003 11:33:10 -0000	1.3
  +++ PersonManagerODMGBean.java	10 Jan 2003 16:52:22 -0000	1.4
  @@ -55,7 +55,6 @@
    */
   
   import org.apache.ojb.broker.OJBRuntimeException;
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   import org.odmg.OQLQuery;
  @@ -103,9 +102,9 @@
       /**
        * @ejb:interface-method
        */
  -    public Person storePerson(Person person)
  +    public PersonVO storePerson(PersonVO person)
       {
  -        return (Person) this.storeObject(person);
  +        return (PersonVO) this.storeObject(person);
       }
   
       /**
  @@ -119,7 +118,7 @@
       /**
        * @ejb:interface-method
        */
  -    public void deletePerson(Person person)
  +    public void deletePerson(PersonVO person)
       {
           this.deleteObject(person);
       }
  @@ -137,7 +136,7 @@
        */
       public int countPersons()
       {
  -        return this.getCount(Person.class);
  +        return this.getCount(PersonVO.class);
       }
   
       /**
  @@ -145,7 +144,7 @@
        */
       public Collection getAllPersons()
       {
  -        return this.getAllObjects(Person.class);
  +        return this.getAllObjects(PersonVO.class);
       }
   
       /**
  @@ -156,7 +155,7 @@
           OQLQuery query = getImplementation().newOQLQuery();
           try
           {
  -            StringBuffer buf = new StringBuffer("select allObjects from " + Person.class.getName());
  +            StringBuffer buf = new StringBuffer("select allObjects from " + PersonVO.class.getName());
               buf.append(" where id not null");
               if (firstname != null) buf.append(" and firstname = " + firstname);
               if (lastname != null) buf.append(" and lastname = " + lastname);
  
  
  
  1.4       +7 -8      jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerPBBean.java
  
  Index: PersonManagerPBBean.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonManagerPBBean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- PersonManagerPBBean.java	10 Jan 2003 11:33:10 -0000	1.3
  +++ PersonManagerPBBean.java	10 Jan 2003 16:52:22 -0000	1.4
  @@ -55,7 +55,6 @@
    */
   
   import org.apache.ojb.broker.PersistenceBroker;
  -import org.apache.ojb.broker.Person;
   import org.apache.ojb.broker.query.Criteria;
   import org.apache.ojb.broker.query.Query;
   import org.apache.ojb.broker.query.QueryByCriteria;
  @@ -97,9 +96,9 @@
       /**
        * @ejb:interface-method
        */
  -    public Person storePerson(Person person)
  +    public PersonVO storePerson(PersonVO person)
       {
  -        return (Person) this.storeObject(person);
  +        return (PersonVO) this.storeObject(person);
       }
   
       /**
  @@ -113,7 +112,7 @@
       /**
        * @ejb:interface-method
        */
  -    public void deletePerson(Person person)
  +    public void deletePerson(PersonVO person)
       {
           this.deleteObject(person);
       }
  @@ -131,7 +130,7 @@
        */
       public int countPersons()
       {
  -        return this.getCount(Person.class);
  +        return this.getCount(PersonVO.class);
       }
   
       /**
  @@ -139,7 +138,7 @@
        */
       public Collection getAllPersons()
       {
  -        return this.getAllObjects(Person.class);
  +        return this.getAllObjects(PersonVO.class);
       }
   
       /**
  @@ -151,7 +150,7 @@
           Criteria criteria = new Criteria();
           if (firstname != null) criteria.addEqualTo("firstname", firstname);
           if (lastname != null) criteria.addEqualTo("firstname", lastname);
  -        Query q = new QueryByCriteria(Person.class, null);
  +        Query q = new QueryByCriteria(PersonVO.class, null);
           Collection result = broker.getCollectionByQuery(q);
           broker.close();
           return result;
  
  
  
  1.6       +15 -25    jakarta-ojb/src/ejb/org/apache/ojb/ejb/StressTestClient.java
  
  Index: StressTestClient.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/StressTestClient.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StressTestClient.java	10 Jan 2003 11:33:10 -0000	1.5
  +++ StressTestClient.java	10 Jan 2003 16:52:22 -0000	1.6
  @@ -54,7 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
   import org.apache.ojb.broker.util.logging.Logger;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
  @@ -66,6 +65,7 @@
   import java.util.ArrayList;
   import java.util.List;
   import java.util.Properties;
  +import java.math.BigDecimal;
   
   /**
    * Stress test client using the OJB's ODMG and PB api.
  @@ -107,9 +107,9 @@
       /**
        * generate client made ids
        */
  -    public synchronized static int getId()
  +    public synchronized static Integer getId()
       {
  -        return ++id;
  +        return new Integer(++id);
       }
   
       public ThreadGroup getThreadGroup()
  @@ -423,18 +423,13 @@
            * factory method that createa an PerformanceArticle
            * @return the created PerformanceArticle object
            */
  -        private Article createArticle(int id)
  +        private ArticleVO createArticle(int id)
           {
  -            Article a = new Article();
  +            ArticleVO a = new ArticleVO();
               if (clientKeyGeneration) a.setArticleId(getId());
  -            if (clientKeyGeneration) a.setArticleName("New Article " + id);
  -            a.setMinimumStock(100);
  -            a.setOrderedUnits(17);
  -            a.setPrice(0.45);
  -            a.setProductGroupId(111);
  -            a.setStock(234);
  -            a.setSupplierId(4);
  -            a.setUnit("bottle");
  +            if (clientKeyGeneration) a.setName("New Article " + id);
  +            a.setPrice(new BigDecimal(0.45*id));
  +            a.setDescription("description "+id);
               return a;
           }
   
  @@ -462,7 +457,7 @@
           {
               long start = System.currentTimeMillis();
   
  -            bean.getAllObjects(Article.class);
  +            bean.getAllObjects(ArticleVO.class);
   
               long stop = System.currentTimeMillis();
               times[2] = times[2] + (stop - start);
  @@ -547,18 +542,13 @@
            * factory method that createa an PerformanceArticle
            * @return the created PerformanceArticle object
            */
  -        private Article createArticle(int id)
  +        private ArticleVO createArticle(int id)
           {
  -            Article a = new Article();
  +            ArticleVO a = new ArticleVO();
               if (clientKeyGeneration) a.setArticleId(getId());
  -            a.setArticleName("New Performance Article " + id);
  -            a.setMinimumStock(100);
  -            a.setOrderedUnits(17);
  -            a.setPrice(0.45);
  -            a.setProductGroupId(111);
  -            a.setStock(234);
  -            a.setSupplierId(4);
  -            a.setUnit("bottle");
  +            a.setName("New Article " + id);
  +            a.setPrice(new BigDecimal(0.45*id));
  +            a.setDescription("description "+id);
               return a;
           }
   
  @@ -586,7 +576,7 @@
           {
               long start = System.currentTimeMillis();
   
  -            bean.getAllObjects(Article.class);
  +            bean.getAllObjects(ArticleVO.class);
   
               long stop = System.currentTimeMillis();
               times[2] = times[2] + (stop - start);
  
  
  
  1.5       +11 -16    jakarta-ojb/src/ejb/org/apache/ojb/ejb/VOHelper.java
  
  Index: VOHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/ejb/org/apache/ojb/ejb/VOHelper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- VOHelper.java	10 Jan 2003 11:33:10 -0000	1.4
  +++ VOHelper.java	10 Jan 2003 16:52:22 -0000	1.5
  @@ -54,9 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.Article;
  -import org.apache.ojb.broker.Person;
   
  +import java.math.BigDecimal;
   import java.util.ArrayList;
   import java.util.List;
   
  @@ -87,25 +86,21 @@
           return list;
       }
   
  -    public static Article createNewArticle(int counter)
  +    public static ArticleVO createNewArticle(int counter)
       {
  -        Article a = new Article();
  -        a.setArticleName("New Performance Article " + counter);
  -        a.setMinimumStock(10 * counter);
  -        a.setOrderedUnits(17);
  -        a.setPrice(0.45 * counter);
  -        a.setProductGroupId(1);
  -        a.setStock(234);
  -        a.setSupplierId(4);
  -        a.setUnit("bottle " + counter);
  +        ArticleVO a = new ArticleVO();
  +        a.setName("New Performance Article " + counter);
  +        a.setPrice(new BigDecimal(0.45d * counter));
  +        a.setDescription("description " + counter);
           return a;
       }
   
  -    public static Person createNewPerson(int counter)
  +    public static PersonVO createNewPerson(int counter)
       {
  -        Person p = new Person();
  -        p.setFirstname("firstname " + counter);
  -        p.setLastname("lastname " + counter);
  +        PersonVO p = new PersonVO();
  +        p.setFirstName("firstname " + counter);
  +        p.setLastName("lastname " + counter);
  +        p.setGrade("grade" + counter);
           return p;
       }
   }
  
  
  
  1.1                  jakarta-ojb/src/ejb/org/apache/ojb/ejb/ArticleVO.java
  
  Index: ArticleVO.java
  ===================================================================
  package org.apache.ojb.ejb;
  
  import org.apache.commons.lang.builder.ToStringBuilder;
  import org.apache.commons.lang.builder.ToStringStyle;
  
  import java.math.BigDecimal;
  import java.io.Serializable;
  
  /**
   *
   * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
   * @version $Id: ArticleVO.java,v 1.1 2003/01/10 16:52:22 arminw Exp $
   */
  public class ArticleVO implements Serializable
  {
      private Integer articleId;
      private String name;
      private BigDecimal price;
      private String description;
      private Integer categoryId;
      private CategoryVO category;
  
      public ArticleVO(Integer articleId, String name, String description, BigDecimal price,
Integer categoryId)
      {
          this.articleId = articleId;
          this.name = name;
          this.description = description;
          this.price = price;
          this.categoryId = categoryId;
      }
  
      public ArticleVO()
      {
      }
  
      public CategoryVO getCategory()
      {
          return category;
      }
  
      public void setCategory(CategoryVO category)
      {
          this.category = category;
      }
  
      public Integer getArticleId()
      {
          return articleId;
      }
  
      public void setArticleId(Integer articleId)
      {
          this.articleId = articleId;
      }
  
      public String getName()
      {
          return name;
      }
  
      public void setName(String name)
      {
          this.name = name;
      }
  
      public String getDescription()
      {
          return description;
      }
  
      public void setDescription(String description)
      {
          this.description = description;
      }
  
      public BigDecimal getPrice()
      {
          return price;
      }
  
      public void setPrice(BigDecimal price)
      {
          this.price = price;
      }
  
      public Integer getCategoryId()
      {
          return categoryId;
      }
  
      public void setCategoryId(Integer categoryId)
      {
          this.categoryId = categoryId;
      }
  
      public String toString()
      {
          ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
          buf.append("articleId", articleId).
          append("name", name).
          append("description", description).
          append("price", price).
          append("categoryId", categoryId).
          append("category", category);
          return buf.toString();
      }
  }
  
  
  
  1.1                  jakarta-ojb/src/ejb/org/apache/ojb/ejb/CategoryVO.java
  
  Index: CategoryVO.java
  ===================================================================
  package org.apache.ojb.ejb;
  
  import org.apache.commons.lang.builder.ToStringBuilder;
  import org.apache.commons.lang.builder.ToStringStyle;
  
  import java.util.Collection;
  
  /**
   *
   * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
   * @version $Id: CategoryVO.java,v 1.1 2003/01/10 16:52:22 arminw Exp $
   */
  public class CategoryVO
  {
      private Integer categoryId;
      private String categoryName;
      private String description;
      private Collection assignedArticles;
  
      public CategoryVO(Integer categoryId, String categoryName, String description)
      {
          this.categoryId = categoryId;
          this.categoryName = categoryName;
          this.description = description;
      }
  
      public CategoryVO()
      {
      }
  
      public Collection getAssignedArticles()
      {
          return assignedArticles;
      }
  
      public void setAssignedArticles(Collection assignedArticles)
      {
          this.assignedArticles = assignedArticles;
      }
  
      public Integer getCategoryId()
      {
          return categoryId;
      }
  
      public void setCategoryId(Integer categoryId)
      {
          this.categoryId = categoryId;
      }
  
      public String getCategoryName()
      {
          return categoryName;
      }
  
      public void setCategoryName(String categoryName)
      {
          this.categoryName = categoryName;
      }
  
      public String getDescription()
      {
          return description;
      }
  
      public void setDescription(String description)
      {
          this.description = description;
      }
  
      public String toString()
      {
          ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
          buf.append("categoryId", categoryId).
          append("categoryName", categoryName).
          append("description", description).
          append("assignedArticles", assignedArticles);
          return buf.toString();
      }
  }
  
  
  
  1.1                  jakarta-ojb/src/ejb/org/apache/ojb/ejb/PersonVO.java
  
  Index: PersonVO.java
  ===================================================================
  package org.apache.ojb.ejb;
  
  import org.apache.commons.lang.builder.ToStringBuilder;
  import org.apache.commons.lang.builder.ToStringStyle;
  
  import java.io.Serializable;
  
  /**
   *
   * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
   * @version $Id: PersonVO.java,v 1.1 2003/01/10 16:52:22 arminw Exp $
   */
  public class PersonVO implements Serializable
  {
      private Integer personId;
      private String firstName;
      private String lastName;
      private String grade;
  
      public PersonVO(Integer personId, String firstName, String lastName, String grade)
      {
          this.personId = personId;
          this.firstName = firstName;
          this.lastName = lastName;
          this.grade = grade;
      }
  
      public PersonVO()
      {
      }
  
      public Integer getPersonId()
      {
          return personId;
      }
  
      public void setPersonId(Integer personId)
      {
          this.personId = personId;
      }
  
      public String getFirstName()
      {
          return firstName;
      }
  
      public void setFirstName(String firstName)
      {
          this.firstName = firstName;
      }
  
      public String getLastName()
      {
          return lastName;
      }
  
      public void setLastName(String lastName)
      {
          this.lastName = lastName;
      }
  
      public String getGrade()
      {
          return grade;
      }
  
      public void setGrade(String grade)
      {
          this.grade = grade;
      }
  
      public String toString()
      {
          ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
          buf.append("personId", personId).
          append("firstName", firstName).
          append("lastName", lastName).
          append("grade", grade);
          return buf.toString();
      }
  }
  
  
  

Mime
View raw message