1 23 24 package org.objectweb.jorm.xml2mi.lib; 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 MultipleObject extends TestCase { 53 54 57 private static String prefix = 58 "test/deviance/org/objectweb/jorm/parser/lib/"; 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 MultipleObject(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(MultipleObject.class); 109 } 110 111 114 public void testMultipleClass() { 115 try { 116 Compiler comp = new Compiler (properties,"config/logSystem.properties"); 117 comp.addInputFileName(prefix+"MultipleClass.pd"); 118 119 CmdLineParser clp = (CmdLineParser) 120 comp.getClassLoader().load(mapperOption); 121 comp.getCompilerParameter().addCPExtension( 122 mapperOption,clp); 123 124 clp.parseProperty(dbprop, dbname); 125 assertTrue("Multiple Classes does not work", comp.execute()); 126 } catch (Exception e) { 127 128 } 129 } 130 131 134 public void testMultipleGenClass() { 135 try { 136 Compiler comp = new Compiler (properties,"config/logSystem.properties"); 137 comp.addInputFileName(prefix+"MultipleGenClass.pd"); 138 139 CmdLineParser clp = (CmdLineParser) 140 comp.getClassLoader().load(mapperOption); 141 comp.getCompilerParameter().addCPExtension( 142 mapperOption,clp); 143 144 clp.parseProperty(dbprop, dbname); 145 assertTrue("Multiple GenClasses does not work", comp.execute()); 146 } catch (Exception e) { 147 148 } 149 } 150 151 154 public void testMultipleExtension() { 155 try { 156 Compiler comp = new Compiler (properties,"config/logSystem.properties"); 157 comp.addInputFileName(prefix+"MultipleExtension.pd"); 158 159 CmdLineParser clp = (CmdLineParser) 160 comp.getClassLoader().load(mapperOption); 161 comp.getCompilerParameter().addCPExtension( 162 mapperOption,clp); 163 164 clp.parseProperty(dbprop, dbname); 165 assertTrue("Multiple Extension does not work", comp.execute()); 166 } catch (Exception e) { 167 168 } 169 } 170 171 175 public void testMultiplePrimitive() { 176 try { 177 Compiler comp = new Compiler (properties,"config/logSystem.properties"); 178 comp.addInputFileName(prefix+"MultiplePrimitive.pd"); 179 180 CmdLineParser clp = (CmdLineParser) 181 comp.getClassLoader().load(mapperOption); 182 comp.getCompilerParameter().addCPExtension( 183 mapperOption,clp); 184 185 clp.parseProperty(dbprop, dbname); 186 assertTrue("Multiple Primitive does not work", comp.execute()); 187 } catch (Exception e) { 188 189 } 190 } 191 } 192 | Popular Tags |