db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: jakarta-turbine-torque/src/test/org/apache/torque/om ComboKeyTest.java
Date Thu, 12 Dec 2002 12:53:11 GMT
mpoeschl    2002/12/12 04:53:11

  Modified:    src/java/org/apache/torque/om ComboKey.java
               src/test/org/apache/torque/om ComboKeyTest.java
  Log:
  remove deprecated methods
  
  Revision  Changes    Path
  1.12      +1 -28     jakarta-turbine-torque/src/java/org/apache/torque/om/ComboKey.java
  
  Index: ComboKey.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/om/ComboKey.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ComboKey.java	26 Nov 2002 22:32:55 -0000	1.11
  +++ ComboKey.java	12 Dec 2002 12:53:11 -0000	1.12
  @@ -100,18 +100,6 @@
       }
   
       /**
  -     * Creates a compound ComboKey whose internal representation is a
  -     * String array.
  -     *
  -     * @param keys the key values
  -     * @deprecated ambiguous unnecessary ctor will be removed.
  -     */
  -    public ComboKey(String[] keys)
  -    {
  -        setValue(keys);
  -    }
  -
  -    /**
        * Sets the internal representation to a String array.
        *
        * @param keys the key values
  @@ -130,21 +118,6 @@
       public void setValue(SimpleKey[] keys)
       {
           this.key = keys;
  -    }
  -
  -    /**
  -     * Sets the internal representation using a String array.
  -     *
  -     * @param keys the key values
  -     * @deprecated ambiguous unnecessary method will be removed.
  -     */
  -    public void setValue(String[] keys)
  -    {
  -        this.key = new SimpleKey[keys.length];
  -        for (int i = 0; i < keys.length; i++)
  -        {
  -            this.key[i] = new StringKey(keys[i]);
  -        }
       }
   
       /**
  
  
  
  1.2       +47 -47    jakarta-turbine-torque/src/test/org/apache/torque/om/ComboKeyTest.java
  
  Index: ComboKeyTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-torque/src/test/org/apache/torque/om/ComboKeyTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComboKeyTest.java	23 Sep 2002 06:15:41 -0000	1.1
  +++ ComboKeyTest.java	12 Dec 2002 12:53:11 -0000	1.2
  @@ -54,57 +54,54 @@
    * <http://www.apache.org/>.
    */
   
  -import java.util.ArrayList;
  -import junit.framework.*;
   import junit.framework.Assert;
  +import junit.framework.Test;
   import junit.framework.TestCase;
  -import org.apache.torque.TorqueException;
  -import org.apache.commons.lang.ObjectUtils;
  +import junit.framework.TestSuite;
   
   /**
    * TestCase for ComboKey
  - * 
  + *
    * @author <a href="mailto:drfish@cox.net">J. Russell Smyth</a>
    * @version $Revision$
    */
   public class ComboKeyTest extends TestCase
  -{    
  +{
       private ComboKey c1a = new ComboKey(
  -        new SimpleKey[]{new StringKey("key1"),new StringKey("key2")});
  +        new SimpleKey[]{new StringKey("key1"), new StringKey("key2")});
       private ComboKey c1b = new ComboKey(
  -        new SimpleKey[]{new StringKey("key1"),new StringKey("key2")});
  -    private ComboKey c1c = new ComboKey(new String[]{"key1","key2"});
  +        new SimpleKey[]{new StringKey("key1"), new StringKey("key2")});
       private ComboKey c2a = new ComboKey(
  -        new SimpleKey[]{new StringKey("key3"),new StringKey("key4")});
  +        new SimpleKey[]{new StringKey("key3"), new StringKey("key4")});
       // complex keys for test
       private java.util.Date now = new java.util.Date();
       private ComboKey c3a = new ComboKey(
  -        new SimpleKey[]{new StringKey("key1"),null,new DateKey(now)});
  +        new SimpleKey[]{new StringKey("key1"), null, new DateKey(now)});
       private ComboKey c3b = new ComboKey(new SimpleKey[]{
  -        new StringKey("key1"),null,new DateKey(now)});
  +        new StringKey("key1"), null, new DateKey(now)});
       private ComboKey c4a = new ComboKey(
  -        new SimpleKey[]{new StringKey("key1"),null,new NumberKey(123456)});
  -    
  +        new SimpleKey[]{new StringKey("key1"), null, new NumberKey(123456)});
  +
       /**
        * Simple constructor.
  -     * 
  +     *
        * @param name the name of the test to execute
        */
       public ComboKeyTest(String name)
       {
           super(name);
       }
  -    
  -    
  -    public static void main(java.lang.String[] args) 
  +
  +
  +    public static void main(java.lang.String[] args)
       {
           junit.textui.TestRunner.run(suite());
       }
  -    
  -    public static Test suite() 
  +
  +    public static Test suite()
       {
           TestSuite suite = new TestSuite(ComboKeyTest.class);
  -        
  +
           return suite;
       }
   
  @@ -112,7 +109,7 @@
       {
           Assert.assertTrue(c1a.equals(c1a));
           // Complex key using null and date
  -        // This currently has to use looseEquals as ComboKey.equals(Obj) 
  +        // This currently has to use looseEquals as ComboKey.equals(Obj)
           // does not accept null key values (WHY!)
           Assert.assertTrue(c3a.looseEquals(c3a));
       }
  @@ -121,13 +118,13 @@
   //    {
   //        Assert.assertTrue(c3a.equals(c3a));
   //    }
  -    
  +
       public void testSymmetric()
       {
           Assert.assertTrue(c1a.equals(c1b));
           Assert.assertTrue(c1b.equals(c1a));
       }
  -    
  +
       public void testNull()
       {
           Assert.assertTrue(!c1a.equals(null));
  @@ -138,41 +135,44 @@
           Assert.assertTrue(!c1a.equals(c2a));
       }
   
  -    public void testRoundTripWithStringKeys(){
  +    public void testRoundTripWithStringKeys()
  +    {
           // two strings
           ComboKey oldKey = new ComboKey(
  -            new SimpleKey[]{new StringKey("key1"),new StringKey("key2")});
  +            new SimpleKey[]{new StringKey("key1"), new StringKey("key2")});
           ComboKey newKey = null;
           String stringValue = oldKey.toString();
  -        System.out.println("OldKey as String="+stringValue);
  +        System.out.println("OldKey as String=" + stringValue);
           try
           {
               newKey = new ComboKey(stringValue);
           }
           catch(Exception e)
           {
  -            fail("Exception "+e.getClass().getName()+
  -                " thrown on new ComboKey("+stringValue+"):"+e.getMessage());
  +            fail("Exception " + e.getClass().getName()
  +                     + " thrown on new ComboKey(" + stringValue + "):"
  +                     + e.getMessage());
           }
           Assert.assertEquals(oldKey,newKey);
       }
   
  -    public void testRoundTripWithComplexKey(){
  +    public void testRoundTripWithComplexKey()
  +    {
           // complex key
           ComboKey oldKey = new ComboKey(
  -            new SimpleKey[]{new StringKey("key1"), new NumberKey(12345), 
  +            new SimpleKey[]{new StringKey("key1"), new NumberKey(12345),
               new DateKey(new java.util.Date())});
           ComboKey newKey = null;
           String stringValue = oldKey.toString();
  -        System.out.println("OldKey as String="+stringValue);
  +        System.out.println("OldKey as String=" + stringValue);
           try
           {
               newKey = new ComboKey(stringValue);
           }
           catch(Exception e)
           {
  -            fail("Exception "+e.getClass().getName()+" thrown on new ComboKey("
  -                 +stringValue+"):"+e.getMessage());
  +            fail("Exception " + e.getClass().getName() + " thrown on new ComboKey("
  +                 + stringValue + "):" + e.getMessage());
           }
           Assert.assertEquals(oldKey,newKey);
       }
  @@ -181,37 +181,37 @@
       {
           // with null key
           ComboKey oldKey = new ComboKey(
  -            new SimpleKey[]{new StringKey("key1"),null});
  +            new SimpleKey[]{new StringKey("key1"), null});
           ComboKey newKey = null;
           String stringValue = oldKey.toString();
  -        System.out.println("OldKey as String="+stringValue);
  +        System.out.println("OldKey as String=" + stringValue);
           try
           {
               newKey = new ComboKey(stringValue);
           }
           catch(Exception e)
           {
  -            fail("Exception "+e.getClass().getName()+" thrown on new ComboKey("
  -                 +stringValue+"):"+e.getMessage());
  +            fail("Exception " + e.getClass().getName() + " thrown on new ComboKey("
  +                 + stringValue + "):" + e.getMessage());
           }
  -        // This currently has to use looseEquals as ComboKey.equals(Obj) 
  +        // This currently has to use looseEquals as ComboKey.equals(Obj)
           // does not accept null key values (WHY!)
           Assert.assertTrue(oldKey.looseEquals(newKey));
       }
  -    
  -    
  +
  +
       /** Test of appendTo method, of class org.apache.torque.om.ComboKey. */
  -    public void testAppendTo() 
  +    public void testAppendTo()
       {
           StringBuffer sb = new StringBuffer();
           c1a.appendTo(sb);
  -        Assert.assertEquals("Skey1:Skey2:",sb.toString());
  +        Assert.assertEquals("Skey1:Skey2:", sb.toString());
       }
   
       /** Test of toString method, of class org.apache.torque.om.ComboKey. */
  -    public void testToString() 
  +    public void testToString()
       {
  -        Assert.assertEquals("Skey1::N123456:",c4a.toString());
  -    }    
  +        Assert.assertEquals("Skey1::N123456:", c4a.toString());
  +    }
   }
   
  
  
  

Mime
View raw message