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 2006/01/05 02:13:49 UTC

svn commit: r366044 - in /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb: broker/ broker/cloneable/ odmg/ odmg/shared/

Author: arminw
Date: Wed Jan  4 17:13:36 2006
New Revision: 366044

URL: http://svn.apache.org/viewcvs?rev=366044&view=rev
Log:
fix getter/setter methods of tests to make it compatible with getter/setter based PersistentField implementations

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToManyTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/ProductGroupWithRemovalAwareCollection.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cloneable/CloneableGroup.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/BatchModeTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/DMapTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/FieldConversionTest_4.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/NamedRootsTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OQLTest.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OdmgExamples.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/Article.java
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/ProductGroup.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/CollectionTest.java Wed Jan  4 17:13:36 2006
@@ -1659,7 +1659,7 @@
             return shelf;
         }
 
-        public void setShelf(BookShelf shelf)
+        public void setShelf(BookShelfIF shelf)
         {
             this.shelf = shelf;
         }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToManyTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToManyTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToManyTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/OneToManyTest.java Wed Jan  4 17:13:36 2006
@@ -54,17 +54,17 @@
 
     	broker.clearCache();
     	pg = (ProductGroupWithRemovalAwareCollection) broker.getObjectByIdentity(pgId);
-    	assertEquals(3,pg.getAllArticles().size());
+    	assertEquals(3,pg.getAllArticlesInGroup().size());
 
-    	pg.getAllArticles().remove(c);
-    	pg.getAllArticles().remove(0);
+    	pg.getAllArticlesInGroup().remove(c);
+    	pg.getAllArticlesInGroup().remove(0);
         broker.beginTransaction();
     	broker.store(pg);
         broker.commitTransaction();
 
     	broker.clearCache();
     	pg = (ProductGroupWithRemovalAwareCollection) broker.getObjectByIdentity(pgId);
-    	assertEquals(1,pg.getAllArticles().size());
+    	assertEquals(1,pg.getAllArticlesInGroup().size());
     }
 
     /**

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/ProductGroupWithRemovalAwareCollection.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/ProductGroupWithRemovalAwareCollection.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/ProductGroupWithRemovalAwareCollection.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/ProductGroupWithRemovalAwareCollection.java Wed Jan  4 17:13:36 2006
@@ -38,7 +38,7 @@
     }
 
     /** return List of all Articles in productgroup*/
-    public RemovalAwareList getAllArticles()
+    public RemovalAwareList getAllArticlesInGroup()
     {
         return allArticlesInGroup;
     }

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cloneable/CloneableGroup.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cloneable/CloneableGroup.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cloneable/CloneableGroup.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/cloneable/CloneableGroup.java Wed Jan  4 17:13:36 2006
@@ -26,18 +26,25 @@
     return super.clone();
   }
 
-  /**
-   * mapped to column KategorieName
-   */
-  public final String getName()
-  {
-    return groupName;
-  }
+    public Integer getId()
+    {
+        return id;
+    }
 
-  public final void setName(String name)
-  {
-    this.groupName = name;
-  }
+    public void setId(Integer id)
+    {
+        this.id = id;
+    }
+
+    public String getGroupName()
+    {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName)
+    {
+        this.groupName = groupName;
+    }
 
   public String toString()
   {

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/BatchModeTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/BatchModeTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/BatchModeTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/BatchModeTest.java Wed Jan  4 17:13:36 2006
@@ -32,7 +32,7 @@
         tx.begin();
 
         ProductGroup pg1 = new ProductGroup();
-        pg1.setName("BatchModeTest ProductGroup #1");
+        pg1.setGroupName("BatchModeTest ProductGroup #1");
         database.makePersistent(pg1);
 
         tx.checkpoint();
@@ -44,7 +44,7 @@
         database.makePersistent(a1);
 
         ProductGroup pg2 = new ProductGroup();
-        pg2.setName("BatchModeTest ProductGroup #2");
+        pg2.setGroupName("BatchModeTest ProductGroup #2");
         database.makePersistent(pg2);
 
         Article a2 = Article.createInstance();

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/DMapTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/DMapTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/DMapTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/DMapTest.java Wed Jan  4 17:13:36 2006
@@ -31,7 +31,7 @@
         Transaction tx = odmg.newTransaction();
         tx.begin();
         productGroup = new ProductGroup();
-        productGroup.setName("DMapTest_" + System.currentTimeMillis() + "_");
+        productGroup.setGroupName("DMapTest_" + System.currentTimeMillis() + "_");
         database.makePersistent(productGroup);
         tx.commit();
     }
@@ -40,7 +40,7 @@
     {
 
         Article a = new Article();
-        a.setArticleName(productGroup.getName() + name);
+        a.setArticleName(productGroup.getGroupName() + name);
         a.setStock(234);
         a.setProductGroup(productGroup);
         return a;

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/FieldConversionTest_4.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/FieldConversionTest_4.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/FieldConversionTest_4.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/FieldConversionTest_4.java Wed Jan  4 17:13:36 2006
@@ -253,6 +253,16 @@
             this.uid = uid;
         }
 
+        public boolean isNodeState()
+        {
+            return nodeState;
+        }
+
+        public void setNodeState(boolean nodeState)
+        {
+            this.nodeState = nodeState;
+        }
+
         public boolean isState()
         {
             return nodeState;

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/LockingMultithreadedTest.java Wed Jan  4 17:13:36 2006
@@ -28,7 +28,7 @@
     // number of updates each thread performs against the object
     private final int objectUpdates = 30;
     // max number of attemps to get a lock
-    private static final int maxAttempts = 100;
+    private static final int maxAttempts = 150;
     private static final int nearMax = (int) (maxAttempts * 0.75);
 
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/NamedRootsTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/NamedRootsTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/NamedRootsTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/NamedRootsTest.java Wed Jan  4 17:13:36 2006
@@ -47,8 +47,8 @@
     private Article createArticle()
     {
         Article example = new Article();
-        example.setArticleName(testProductGroup.getName());
-        example.setProductGroupId(testProductGroup.getId());
+        example.setArticleName(testProductGroup.getGroupName());
+        example.setProductGroupId(testProductGroup.getGroupId());
         return example;
     }
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OQLTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OQLTest.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OQLTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OQLTest.java Wed Jan  4 17:13:36 2006
@@ -631,6 +631,11 @@
             return age;
         }
 
+        public void setAge(int age)
+        {
+            this.age = age;
+        }
+
         public int getNumLegs()
         {
             return numLegs;
@@ -665,6 +670,11 @@
         public int getAge()
         {
             return age;
+        }
+
+        public void setAge(int age)
+        {
+            this.age = age;
         }
 
         public int getAnimalId()

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OdmgExamples.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OdmgExamples.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OdmgExamples.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/OdmgExamples.java Wed Jan  4 17:13:36 2006
@@ -105,7 +105,7 @@
             tx.begin();
 
             ProductGroup pg = new ProductGroup();
-            pg.setName("PG A");
+            pg.setGroupName("PG A");
             Article example = new Article();
             example.setProductGroup(pg);
             pg.addArticle(example);
@@ -229,8 +229,9 @@
                     "select aPG from " + ProductGroup.class.getName() + " where groupName like \"Fruit*\"");
         ProductGroup pg = (ProductGroup) check.get(0);
 
-        assertEquals(pg.getAllArticlesInGroup().size(), results.size());
         assertTrue((results.size() > 0));
+        assertNotNull(pg.getAllArticlesInGroup());
+        assertEquals(pg.getAllArticlesInGroup().size(), results.size());
 
         tx.commit();
 

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/Article.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/Article.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/Article.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/Article.java Wed Jan  4 17:13:36 2006
@@ -1,6 +1,5 @@
 package org.apache.ojb.odmg.shared;
 
-import org.apache.ojb.odmg.shared.ProductGroup;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.apache.commons.lang.builder.EqualsBuilder;
 
@@ -17,7 +16,7 @@
         return new ToStringBuilder(this)
                 .append("articleId", articleId)
                 .append("articleName", articleName)
-                .append("productGroup", (productGroup != null ? productGroup.getName() : null))
+                .append("productGroup", (productGroup != null ? productGroup.getGroupName() : null))
                 .append("productGroupId", productGroupId)
                 .append("isSelloutArticle", isSelloutArticle)
                 .append("minimumStock", minimumStock)

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/ProductGroup.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/ProductGroup.java?rev=366044&r1=366043&r2=366044&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/ProductGroup.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/odmg/shared/ProductGroup.java Wed Jan  4 17:13:36 2006
@@ -9,10 +9,17 @@
  */
 public class ProductGroup implements org.apache.ojb.odmg.TransactionAware, Serializable
 {
-    /** return group id*/
-    public int getId()
+    /** collection containing all articles of a given product group*/
+    private List allArticlesInGroup;
+    /** a textual description of the group*/
+    private String description;
+    /** the unique id of a product group*/
+    private int groupId;
+    /** the name of a group*/
+    private String groupName;
+
+    public ProductGroup()
     {
-        return groupId;
     }
 
     /**return string representation*/
@@ -26,94 +33,37 @@
                 "articles in group: " + allArticlesInGroup;
     }
 
-    public ProductGroup(int pGroupId, String pGroupName,
-                        String pDescription)
+    public int getGroupId()
     {
-        groupId = pGroupId;
-        groupName = pGroupName;
-        description = pDescription;
+        return groupId;
     }
 
-    public ProductGroup()
+    public void setGroupId(int groupId)
     {
+        this.groupId = groupId;
     }
 
-    /** return groupname*/
-    public String getName()
+    public String getGroupName()
     {
         return groupName;
     }
 
-    /** collection containing all articles of a given product group*/
-    private List allArticlesInGroup;
-    /** a textual description of the group*/
-    private String description;
-    /** the unique id of a product group*/
-    private int groupId;
-    /** the name of a group*/
-    private String groupName;
+    public void setGroupName(String groupName)
+    {
+        this.groupName = groupName;
+    }
 
     public String getDescription()
     {
         return description;
     }
 
-    /**
-     * Sets the description.
-     * @param description The description to set
-     */
     public void setDescription(String description)
     {
         this.description = description;
     }
 
     /**
-     * afterAbort will be called after a transaction has been aborted.
-     * The values of fields which get persisted will have changed to
-     * what they were at the begining of the transaction.  This method
-     * should be overridden to reset any transient or non-persistent
-     * fields.
-     */
-    public void afterAbort()
-    {
-        //System.out.println("afterAbort: " + new Identity(this));
-    }
-
-    /**
-     * afterCommit is called only after a successful commit has taken
-     * place.
-     */
-    public void afterCommit()
-    {
-        //System.out.println("afterCommit: " + new Identity(this));
-    }
-
-    /**
-     * beforeAbort is called before a transaction is aborted.
-     */
-    public void beforeAbort()
-    {
-        //System.out.println("beforeAbort: " + new Identity(this));
-    }
-
-    /**
-     * beforeCommit will give an object a chance to kill a
-     * transaction before it is committed.
-     *
-     * To kill a transaction, throw a new TransactionAbortedException.
-     */
-    public void beforeCommit() throws org.odmg.TransactionAbortedException
-    {
-        //System.out.println("beforeCommit: " + new Identity(this));
-    }
-
-
-    /** set groupname*/
-    public void setName(String newName)
-    {
-        groupName = newName;
-    }
-    /**
      * Gets the allArticlesInGroup.
      * @return Returns a List
      */
@@ -126,7 +76,7 @@
      * Sets the allArticlesInGroup.
      * @param allArticlesInGroup The allArticlesInGroup to set
      */
-    public void setAllArticlesInGroup(Vector allArticlesInGroup)
+    public void setAllArticlesInGroup(List allArticlesInGroup)
     {
         this.allArticlesInGroup = allArticlesInGroup;
     }
@@ -141,39 +91,42 @@
     }
 
     /**
-     * Gets the groupId.
-     * @return Returns a int
+     * afterAbort will be called after a transaction has been aborted.
+     * The values of fields which get persisted will have changed to
+     * what they were at the begining of the transaction.  This method
+     * should be overridden to reset any transient or non-persistent
+     * fields.
      */
-    public int getGroupId()
+    public void afterAbort()
     {
-        return groupId;
+        //System.out.println("afterAbort: " + new Identity(this));
     }
 
     /**
-     * Sets the groupId.
-     * @param groupId The groupId to set
+     * afterCommit is called only after a successful commit has taken
+     * place.
      */
-    public void setGroupId(int groupId)
+    public void afterCommit()
     {
-        this.groupId = groupId;
+        //System.out.println("afterCommit: " + new Identity(this));
     }
 
     /**
-     * Gets the groupName.
-     * @return Returns a String
+     * beforeAbort is called before a transaction is aborted.
      */
-    public String getGroupName()
+    public void beforeAbort()
     {
-        return groupName;
+        //System.out.println("beforeAbort: " + new Identity(this));
     }
 
     /**
-     * Sets the groupName.
-     * @param groupName The groupName to set
+     * beforeCommit will give an object a chance to kill a
+     * transaction before it is committed.
+     *
+     * To kill a transaction, throw a new TransactionAbortedException.
      */
-    public void setGroupName(String groupName)
+    public void beforeCommit() throws org.odmg.TransactionAbortedException
     {
-        this.groupName = groupName;
+        //System.out.println("beforeCommit: " + new Identity(this));
     }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org