1 23 24 package com.sun.enterprise.config.serverbeans.validation; 25 26 import junit.framework.*; 27 32 33 public class FrameHolderTest extends TestCase { 34 public void testEquality(){ 35 FrameHolder fh1 = new FrameHolder(); 36 FrameHolder fh2 = new FrameHolder(); 37 assertEquals(fh1, fh2); 38 assertFalse(fh1.equals(new Object ())); 39 assertFalse(fh1.equals(null)); 40 assertEquals(fh1, fh1); 41 fh1.getDomainFrame().put("k", "v"); 42 assertFalse(fh1.equals(fh2)); 43 assertFalse(fh2.equals(fh1)); 44 } 45 46 public void testBasics() { 47 FrameHolder fh = new FrameHolder(); 48 assertNotNull(fh.getDomainFrame()); 49 fh.getDomainFrame().put("k", "v"); 50 assertNotNull(fh.getConfigFrame("config0")); 51 fh.getConfigFrame("config0").inheritFrom(fh.getDomainFrame()); 52 assertEquals("v", fh.getConfigFrame("config0").lookup("k")); 53 assertNotNull(fh.getConfigFrame("config1")); 54 assertFalse(fh.getConfigFrame("config0").equals(fh.getConfigFrame("config1"))); 55 assertNotNull(fh.getServerFrame("frame0")); 56 fh.getServerFrame("frame0").inheritFrom(fh.getConfigFrame("config0")); 57 assertEquals("v", fh.getServerFrame("frame0").lookup("k")); 58 assertNotNull(fh.getClusterFrame("frame0")); 59 fh.getConfigFrame("config1").put("k", "config"); 60 fh.getClusterFrame("frame0").inheritFrom(fh.getConfigFrame("config1")); 61 fh.getServerFrame("frame1").inheritFrom(fh.getClusterFrame("frame0")); 62 assertEquals("config", fh.getServerFrame("frame1").lookup("k")); 63 } 64 65 public FrameHolderTest(String name){ 66 super(name); 67 } 68 69 protected void setUp() { 70 } 71 72 protected void tearDown() { 73 } 74 75 private void nyi(){ 76 fail("Not Yet Implemented"); 77 } 78 79 public static void main(String args[]){ 80 if (args.length == 0){ 81 junit.textui.TestRunner.run(FrameHolderTest.class); 82 } else { 83 junit.textui.TestRunner.run(makeSuite(args)); 84 } 85 } 86 private static TestSuite makeSuite(String args[]){ 87 final TestSuite ts = new TestSuite(); 88 for (int i = 0; i < args.length; i++){ 89 ts.addTest(new FrameHolderTest(args[i])); 90 } 91 return ts; 92 } 93 } 94 | Popular Tags |