1 23 24 package org.objectweb.jorm.verifier; 25 26 import junit.framework.Test; 27 import junit.framework.TestCase; 28 import junit.framework.TestSuite; 29 import junit.textui.TestRunner; 30 import org.objectweb.jorm.metainfo.api.Manager; 31 import org.objectweb.jorm.metainfo.lib.JormManager; 32 import org.objectweb.jorm.xml2mi.api.Parser; 33 import org.objectweb.jorm.util.lib.BasicClassLoader; 34 import org.objectweb.jorm.util.lib.CompilerLogger; 35 import org.objectweb.util.monolog.api.BasicLevel; 36 import org.objectweb.util.monolog.api.Logger; 37 import org.objectweb.jorm.compiler.lib.Compiler; 38 import org.objectweb.jorm.cmdline.api.CmdLineParser; 39 40 import java.util.Vector ; 41 42 52 public class VerifierCentral extends TestCase { 53 54 57 private static String prefix = 58 "test/deviance/org/objectweb/jorm/verifier/"; 59 60 63 private static String properties = 64 prefix + "jorm.properties"; 65 66 70 private static String mapperOption = 71 "org.objectweb.jorm.cmdline.rdb.RdbMapperOption"; 72 73 77 private static String dbprop = "DBName"; 78 79 82 private static String dbname = "postgres"; 83 84 87 public VerifierCentral(String name) { 88 super(name); 89 } 90 91 94 public static void main(String [] args) { 95 TestRunner.run(suite()); 96 } 97 98 101 protected void setUp() { 102 } 103 104 107 public static Test suite() { 108 return new TestSuite(VerifierCentral.class); 109 } 110 111 116 public void testRefGenClass_RefClass_WithoutClassMapping() { 117 Compiler comp = new Compiler (properties); 118 comp.addInputFileName(prefix+"RefGenClass_RefClass.pd"); 119 comp.addInputFileName(prefix+"aRefClass.pd"); 120 try { 121 CmdLineParser clp = (CmdLineParser) 122 comp.getClassLoader().load(mapperOption); 123 comp.getCompilerParameter().addCPExtension( 124 mapperOption,clp); 125 126 clp.parseProperty(dbprop, dbname); 127 } catch (Exception e) { 128 129 } 130 131 try { 132 assertTrue("a RefGenClass without a ClassMapping (for rdb) does not work", 133 comp.execute()); 134 } catch (Exception e) { 135 } 136 } 137 138 143 public void testClassWithoutClassMapping() { 144 Compiler comp = new Compiler (properties); 145 comp.addInputFileName(prefix+"WithoutClassMapping.pd"); 146 try { 147 CmdLineParser clp = (CmdLineParser) 148 comp.getClassLoader().load(mapperOption); 149 comp.getCompilerParameter().addCPExtension( 150 mapperOption,clp); 151 152 clp.parseProperty(dbprop, dbname); 153 } catch (Exception e) { 154 155 } 156 157 assertTrue("Without ClassMapping does not work", comp.execute()); 158 } 159 160 165 public void testPrimitiveWithoutMapping() { 166 Compiler comp = new Compiler (properties); 167 comp.addInputFileName(prefix+"PrimitiveWithoutMapping.pd"); 168 try { 169 CmdLineParser clp = (CmdLineParser) 170 comp.getClassLoader().load(mapperOption); 171 comp.getCompilerParameter().addCPExtension( 172 mapperOption,clp); 173 174 clp.parseProperty(dbprop, dbname); 175 } catch (Exception e) { 176 177 } 178 179 assertTrue("A PrimitiveType without ValueMapping does not work", 180 comp.execute()); 181 } 182 183 190 public void testRefGenClass_Primitive_WithoutClassMapping() { 191 Compiler comp = new Compiler (properties); 192 comp.addInputFileName(prefix+"RefGenClass_Primitive.pd"); 193 try { 194 CmdLineParser clp = (CmdLineParser) 195 comp.getClassLoader().load(mapperOption); 196 comp.getCompilerParameter().addCPExtension( 197 mapperOption,clp); 198 199 clp.parseProperty(dbprop, dbname); 200 } catch (Exception e) { 201 202 } 203 204 assertTrue("A RefGenClass without a ClassMapping (for rdb) does not work", 205 comp.execute()); 206 } 207 } 208 | Popular Tags |