db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r600676 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe: direct/SimpleNonStandardOperations.java direct/StatementHelper.java model/Address.java
Date Mon, 03 Dec 2007 20:39:08 GMT
Author: djd
Date: Mon Dec  3 12:39:08 2007
New Revision: 600676

URL: http://svn.apache.org/viewvc?rev=600676&view=rev
Log:
Allow re-use of the Address object in the order entry test framework

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/SimpleNonStandardOperations.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/StatementHelper.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/model/Address.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/SimpleNonStandardOperations.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/SimpleNonStandardOperations.java?rev=600676&r1=600675&r2=600676&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/SimpleNonStandardOperations.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/SimpleNonStandardOperations.java
Mon Dec  3 12:39:08 2007
@@ -26,6 +26,7 @@
 
 import org.apache.derbyTesting.system.oe.client.Operations;
 import org.apache.derbyTesting.system.oe.client.Submitter;
+import org.apache.derbyTesting.system.oe.model.Address;
 import org.apache.derbyTesting.system.oe.model.Customer;
 import org.apache.derbyTesting.system.oe.util.OERandom;
 
@@ -48,6 +49,8 @@
      */
     private final Customer customer = new Customer();
     
+    private final Address address = new Address();
+    
     private final OERandom rand;
 
     public SimpleNonStandardOperations(Connection conn,
@@ -126,7 +129,7 @@
             customer.setMiddle(rs.getString("C_MIDDLE"));
             customer.setLast(rs.getString("C_LAST"));
             
-            customer.setAddress(getAddress(rs, "C_STREET_1"));
+            customer.setAddress(getAddress(address, rs, "C_STREET_1"));
             
             customer.setPhone(rs.getString("C_PHONE"));
             

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/StatementHelper.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/StatementHelper.java?rev=600676&r1=600675&r2=600676&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/StatementHelper.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/direct/StatementHelper.java
Mon Dec  3 12:39:08 2007
@@ -109,16 +109,30 @@
     }
 
     protected Address getAddress(ResultSet rs, String firstColumnName) throws SQLException
{
-        Address address = new Address();
+        return getAddress(new Address(), rs, firstColumnName);
+    }
+    
+    /**
+     * Get the address from a query against an order entry WAREHOUSE, DISTRICT
+     * or CUSTOMER table.
+     * 
+     * @param address Object to fill in
+     * @param rs ResultSet already positioned on the current row.
+     * @param firstColumnName First column that makes up the address.
+     * @throws SQLException
+     */
+    protected Address getAddress(Address address,
+            ResultSet rs, String firstColumnName) throws SQLException {
         
+        address.clear();
+    
         int col = rs.findColumn(firstColumnName);
         address.setStreet1(rs.getString(col++));
         address.setStreet2(rs.getString(col++));
         address.setCity(rs.getString(col++));
         address.setState(rs.getString(col++));
         address.setZip(rs.getString(col));
-        
+
         return address;
     }
-
 }

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/model/Address.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/model/Address.java?rev=600676&r1=600675&r2=600676&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/model/Address.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/system/oe/model/Address.java
Mon Dec  3 12:39:08 2007
@@ -36,6 +36,15 @@
     private String city;
     private String state;
     private String zip;
+    
+    /**
+     * Reset the fields to allow object re-use.
+     *
+     */
+    public void clear()
+    {
+        street1 = street2 = city = state = zip = null;
+    }
 
     public String getCity() {
         return city;



Mime
View raw message