1 23 package org.objectweb.medor.optim.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.api.QueryRewriter; 34 import org.objectweb.medor.optim.jorm.JormFlatten2Rdb; 35 import org.objectweb.medor.optim.jorm.TestJormGoUpDecodeRule; 36 import org.objectweb.medor.optim.lib.BasicQueryRewriter; 37 import org.objectweb.medor.optim.lib.FlattenQueryTreeRule; 38 39 import java.util.ArrayList ; 40 41 44 public class TestRdbJormGoUpDecodeRule extends TestJormGoUpDecodeRule { 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(TestRdbJormGoUpDecodeRule.class); 58 } 59 60 public TestRdbJormGoUpDecodeRule() { 61 super("TestRdbJormGoUpDecodeRule", Log.MEDOR_PREFIX + ".optim.jorm.rdb.goupdecode"); 62 } 63 64 public TestRdbJormGoUpDecodeRule(String testName) { 65 super(testName, Log.MEDOR_PREFIX + ".optim.jorm.rdb.goupdecode"); 66 } 67 68 69 public PMapper newMappper() { 70 PMapper m = null; 71 try { 72 m = new MapperJDBC(); 73 ConnectionSpecJDBC cs = new ConnectionSpecJDBC("jdbc:product:basename", "java.lang.String"); 74 m.setConnectionFactory(cs); 75 } 76 catch (PException e) { 77 e.printStackTrace(); 78 } 79 return m; 80 } 81 82 public QueryRewriter createQueryRewriter() { 83 ArrayList rules = new ArrayList (2); 84 rules.add(new FlattenQueryTreeRule()); 85 rules.add(new JormFlatten2Rdb()); 86 return new BasicQueryRewriter(rules); 87 } 88 } 89 | Popular Tags |