1 20 package org.enhydra.barracuda.plankton.data; 21 22 import java.io.*; 23 import java.util.*; 24 25 import junit.framework.*; 26 27 import org.apache.log4j.*; 28 import org.enhydra.barracuda.testbed.*; 29 30 31 37 public abstract class PDataTestCases extends StateMapTestCases { 38 42 44 48 public PDataTestCases(String name) { 49 super(name); 50 } 51 52 58 61 public void testParental() { 62 if (logger.isInfoEnabled()) logger.info("testing parental methods"); 63 PData proot = null; 64 PData pchild1 = null; 65 PData pchild2 = null; 66 PData pchild3 = null; 67 68 proot = getPDataInstance(); 70 pchild1 = getPDataInstance(); 71 pchild1.setParent(proot); 72 assertTrue("Parental check 1 failed...basic set/get failure", pchild1.getParent()==proot); 73 pchild1.setParent(null); 74 assertTrue("Parental check 1a failed...set to null failure", pchild1.getParent()==null); 75 pchild1.setParent(pchild1); 76 assertTrue("Parental check 1b failed...allowed parent to be set to self", pchild1.getParent()!=pchild1); 77 78 proot = getPDataInstance(); 80 assertTrue("Parental check 2 failed...invalid default inheritParents value", proot.isInheritParents()==true); 81 proot.setInheritParents(false); 82 assertTrue("Parental check 2a failed...basic set/get failure", proot.isInheritParents()==false); 83 proot.setInheritParents(true); 84 assertTrue("Parental check 2b failed...basic set/get failure", proot.isInheritParents()==true); 85 86 proot = getPDataInstance(); 88 pchild1 = getPDataInstance(); 89 pchild1.setParent(proot); 90 pchild2 = getPDataInstance(); 91 pchild2.setParent(pchild1); 92 assertTrue("Parental check 3 failed...root parent not correctly located", pchild2.getRootParent()==proot); 93 } 94 95 98 public void testSerializable() { 99 if (logger.isInfoEnabled()) logger.info("testing for Serializable"); 100 PData pdata = this.getPDataInstance(); 101 assertTrue("PData instance does not implement Serializable!", pdata instanceof Serializable); 102 } 103 104 105 public abstract PData getPDataInstance(); 107 public abstract PList getPListInstance(); 108 public abstract PMap getPMapInstance(); 109 110 } 111 | Popular Tags |