1 64 65 package com.jcorporate.expresso.services.test; 66 67 import com.jcorporate.expresso.core.dbobj.SchemaFactory; 68 import com.jcorporate.expresso.core.registry.MutableRequestRegistry; 69 import com.jcorporate.expresso.core.security.SuperUser; 70 import junit.framework.TestResult; 71 import junit.framework.TestSuite; 72 73 import java.util.Vector ; 74 75 76 83 public class DBTestSuite 84 extends TestSuite { 85 Vector testSchemas = null; 86 87 public DBTestSuite() { 88 } 89 90 protected void addSchema(Vector schemas) 91 throws Exception { 92 TestSystemInitializer.setUp(); 93 94 new MutableRequestRegistry(TestSystemInitializer.getTestContext(), 95 SuperUser.SUPER_USER); 96 97 schemas.add(SchemaFactory.getInstance() 98 .getSchema(com.jcorporate.expresso.core.ExpressoSchema.class.getName())); 99 testSchemas = schemas; 100 } 101 102 106 public static junit.framework.Test suite() 107 throws Exception { 108 return null; 109 } 110 111 114 public void run(TestResult result) { 115 if (testSchemas == null) { 116 testSchemas = new Vector (); 117 } 118 try { 119 addSchema(testSchemas); 120 } catch (Exception e) { 121 e.printStackTrace(); 122 System.out.println("Error adding Schemas: " + e.getMessage()); 123 } 124 125 super.run(result); 126 cleanUp(); 127 } 128 129 public void cleanUp() { 130 SchemaDeleter.setSchemas(testSchemas); 131 SchemaDeleter.deleteSchemas(TestSystemInitializer.getTestContext()); 132 } 133 } 134 | Popular Tags |