1 19 20 package org.netbeans.mdr.test; 21 22 import java.io.*; 23 import java.util.*; 24 import java.net.*; 25 26 import junit.extensions.*; 27 import junit.framework.*; 28 29 import org.netbeans.api.mdr.*; 30 import org.openide.util.Lookup; 31 32 import org.netbeans.mdr.util.*; 33 import org.netbeans.mdr.NBMDRepositoryImpl; 34 import org.netbeans.lib.jmi.xmi.*; 35 import org.netbeans.lib.jmi.mapping.*; 36 37 import org.xml.sax.*; 38 39 import javax.jmi.reflect.*; 40 import javax.jmi.model.*; 41 42 46 public class PackageInheritanceTest extends MDRTestCase { 47 48 public PackageInheritanceTest(String testName) { 49 super (testName); 50 } 51 52 public static void main (String [] args) { 53 junit.textui.TestRunner.run (suite ()); 54 } 55 56 public static Test suite () { 57 TestSuite suite = new TestSuite (); 58 suite.addTestSuite (PackageInheritanceTest.class); 59 60 TestSetup setup = new TestSetup (suite) { 61 public void setUp () { 62 } 64 public void tearDown () { 65 } 66 }; 67 return setup; 68 } 69 70 public void test () { 71 ModelPackage pkg = loadMOFModel ("pkg_inher.xml", "PureMOF"); 72 MofPackage mofPkg = findMofPackage (pkg, "Package_1"); 73 RefPackage pkg_1 = createExtent (mofPkg, "Package_1"); 74 mofPkg = findMofPackage (pkg, "Package_2"); 75 RefPackage pkg_2 = createExtent (mofPkg, "Package_2"); 76 mofPkg = findMofPackage (pkg, "Package_3"); 77 RefPackage pkg_3 = createExtent (mofPkg, "Package_3"); 78 79 try { 80 for (char x = 'A'; x <= 'E'; x++) 81 pkg_3.refClass ("Class_" + x); 82 for (char x = 'A'; x <= 'D'; x++) 83 pkg_2.refClass ("Class_" + x); 84 85 new RandomDataGenerator ().generate (pkg_3, 0, 5); 86 new RandomDataGenerator ().generate (pkg_2, 0, 5); 87 new RandomDataGenerator ().generate (pkg_1, 0, 5); 88 89 pkg_1.refDelete (); 90 pkg_2.refDelete (); 91 pkg_3.refDelete (); 92 pkg.refDelete (); 93 } catch (Exception e) { 94 System.out.println(e); 95 e.printStackTrace (); 96 fail (e.getMessage ()); 97 } 98 } 99 100 } 101 | Popular Tags |