1 package org.apache.torque.adapter; 2 3 21 22 import junit.framework.TestCase; 23 24 import org.apache.torque.util.Query; 25 import org.apache.torque.util.UniqueList; 26 27 public class DBOracleTest extends TestCase 28 { 29 33 public void testSelectColumnsForLimitOffset() 34 { 35 Query query = new Query(); 36 UniqueList input = new UniqueList(); 37 input.add("c1"); 38 input.add("c2"); 39 input.add("c1 a1"); 40 input.add("c1 a2"); 41 input.add("t.c1 a4"); 42 43 query.setSelectClause(new UniqueList(input)); 45 new DBOracle().generateLimits(query, 0, 1); 46 assertEquals(input, query.getSelectClause()); 47 48 input.set(1, "t.c1"); 50 query.setSelectClause(new UniqueList(input)); 51 new DBOracle().generateLimits(query, 0, 1); 52 UniqueList expected = new UniqueList(input); 53 expected.set(1, "t.c1 a0"); 54 assertEquals(expected, query.getSelectClause()); 55 56 input.set(1, "c2"); 58 input.set(0, "t.a1"); 59 query.setSelectClause(new UniqueList(input)); 60 new DBOracle().generateLimits(query, 0, 1); 61 expected = new UniqueList(input); 62 expected.set(0, "t.a1 a0"); 63 assertEquals(query.getSelectClause(), expected); 64 65 input.set(1, "t2.a1"); 67 query.setSelectClause(new UniqueList(input)); 68 new DBOracle().generateLimits(query, 0, 1); 69 expected = new UniqueList(input); 70 expected.set(0, "t.a1 a0"); 71 expected.set(1, "t2.a1 a3"); 72 assertEquals(expected, query.getSelectClause()); 73 } 74 75 } 76 | Popular Tags |