KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > medor > optim > jorm > rdb > TestRdbJormGoUpDecodeRule


1 /**
2  * MEDOR: Middleware Enabling Distributed Object Requests
3  *
4  * Copyright (C) 2001-2003 France Telecom R&D
5  * Contact: alexandre.lefebvre@rd.francetelecom.com
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * Initial developers: M. Alia, S. Chassande-Barrioz, A. Lefebvre
22  */

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 JavaDoc;
40
41 /**
42  * @author S.Chassande-Barrioz
43  */

44 public class TestRdbJormGoUpDecodeRule extends TestJormGoUpDecodeRule {
45
46     /**
47      * main method to launch the tests manually
48      */

49     public static void main(String JavaDoc[] args) {
50         TestRunner.run(suite());
51     }
52
53     /**
54      * This method creates a TestSuite object with the current tests
55      */

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 JavaDoc 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 JavaDoc rules = new ArrayList JavaDoc(2);
84         rules.add(new FlattenQueryTreeRule());
85         rules.add(new JormFlatten2Rdb());
86         return new BasicQueryRewriter(rules);
87     }
88 }
89
Popular Tags