Changeset 25


Ignore:
Timestamp:
Oct 3, 2010, 10:02:59 PM (14 years ago)
Author:
fmguler
Message:

Refs #3 - Started adding test scenarios. These are in line with the use cases: http://trac.fmguler.com/UtilityProjects/wiki/FmgVen/Development/UseCases

Location:
trunk/fmgVen
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/fmgVen/src/com/fmguler/ven/Ven.java

    r23 r25  
    3636    } 
    3737 
    38     public List list() { 
     38    public List list(Class objectClass) { 
    3939        return null; 
    4040    } 
  • trunk/fmgVen/test/com/fmguler/ven/sample/Sample.java

    r24 r25  
    2121import com.fmguler.ven.sample.domain.SomeDomainObject; 
    2222import java.sql.SQLException; 
     23import java.util.Date; 
     24import java.util.List; 
    2325import java.util.Locale; 
    2426import javax.sql.DataSource; 
     
    3840    public static void main(String[] args) { 
    3941        buildDatabase(); 
    40         test1(); 
     42        testGet(); 
    4143        //rollbackDatabase(); 
    4244    } 
    4345 
    44     public static void test1() { 
     46    /** 
     47     * Test save an object 
     48     */ 
     49    public static void testSave() { 
     50        Ven ven = getVen(); 
     51 
     52        //insert 
     53        SomeDomainObject obj = new SomeDomainObject(); 
     54        obj.setName("name"); 
     55        obj.setDescription("desc"); 
     56        obj.setDate(new Date()); 
     57        ven.save(obj); 
     58        System.out.println(obj); 
     59 
     60        //update 
     61        obj.setName("name update"); 
     62        ven.save(obj); 
     63        System.out.println(obj); 
     64    } 
     65 
     66    /** 
     67     * Test delete an object 
     68     */ 
     69    public static void testDelete() { 
     70        Ven ven = getVen(); 
     71        ven.delete(1, SomeDomainObject.class); 
     72    } 
     73 
     74    /** 
     75     * Test get an object by primary key 
     76     */ 
     77    public static void testGet() { 
    4578        Ven ven = getVen(); 
    4679        SomeDomainObject obj = (SomeDomainObject)ven.get(1, SomeDomainObject.class); 
    4780        System.out.println(obj); 
     81    } 
     82 
     83    /** 
     84     * Test list the collection of objects 
     85     */ 
     86    public static void testList() { 
     87        Ven ven = getVen(); 
     88        List objList = ven.list(SomeDomainObject.class); 
     89        System.out.println(objList); 
     90    } 
     91 
     92    /** 
     93     * Test list the collection of objects by some criteria 
     94     */ 
     95    public static void testListByCriteria() { 
     96        Ven ven = getVen(); 
     97        List objList = ven.list(SomeDomainObject.class/*, criteria */); 
     98        System.out.println(objList); 
    4899    } 
    49100 
Note: See TracChangeset for help on using the changeset viewer.