1 23 package org.objectweb.medor.query.jorm.rdb; 24 25 import junit.framework.Test; 26 import junit.framework.TestSuite; 27 import junit.textui.TestRunner; 28 import org.objectweb.jorm.api.PException; 29 import org.objectweb.jorm.api.PMapper; 30 import org.objectweb.jorm.mapper.rdb.lib.MapperJDBC; 31 import org.objectweb.jorm.mapper.rdb.lib.ConnectionSpecJDBC; 32 import org.objectweb.medor.lib.Log; 33 import org.objectweb.medor.optim.jorm.JormFlatten2Rdb; 34 import org.objectweb.medor.optim.api.QueryRewriter; 35 import org.objectweb.medor.optim.lib.FlattenQueryTreeRule; 36 import org.objectweb.medor.optim.lib.BasicQueryRewriter; 37 import org.objectweb.medor.query.jorm.TestNavigatorNodeFactory; 38 39 import java.util.ArrayList ; 40 41 44 public class TestRdbNavigatorNodeFactory extends TestNavigatorNodeFactory { 45 46 49 public static void main(String [] args) { 50 TestRunner.run(suite()); 51 } 52 53 56 public static Test suite() { 57 return new TestSuite(TestRdbNavigatorNodeFactory.class); 58 } 59 60 public TestRdbNavigatorNodeFactory() { 61 super("TestRdbNavigatorNodeFactory", Log.MEDOR_PREFIX + ".query.jorm.rdb.navigatornode"); 62 } 63 64 public TestRdbNavigatorNodeFactory(String testName) { 65 super(testName, Log.MEDOR_PREFIX + ".query.jorm.rdb.navigatornode"); 66 } 67 68 69 public PMapper newMappper() { 70 PMapper m = null; 71 72 try { 73 m = new MapperJDBC(); 74 ConnectionSpecJDBC cs = 75 new ConnectionSpecJDBC("jdbc:product:basename", "java.lang.String"); 76 m.setConnectionFactory(cs); 77 } 78 catch (PException e) { 79 e.printStackTrace(); 80 } 81 return m; 82 } 83 84 public QueryRewriter createQueryRewriter() { 85 ArrayList rules = new ArrayList (2); 86 rules.add(new FlattenQueryTreeRule()); 87 rules.add(new JormFlatten2Rdb()); 88 return new BasicQueryRewriter(rules); 89 } 90 } 91 | Popular Tags |