LEFT | RIGHT |
1 /** | 1 /** |
2 * Copyright (C) 2007 Google Inc. | 2 * Copyright (C) 2007 Google Inc. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Lesser General Public | 5 * modify it under the terms of the GNU Lesser General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2.1 of the License, or (at your option) any later version. | 7 * version 2.1 of the License, or (at your option) any later version. |
8 | 8 |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 private Building b2; | 52 private Building b2; |
53 private Floor b2f1; | 53 private Floor b2f1; |
54 private Office b2f1o1; | 54 private Office b2f1o1; |
55 | 55 |
56 @Override | 56 @Override |
57 protected void setUp() throws Exception { | 57 protected void setUp() throws Exception { |
58 super.setUp(); | 58 super.setUp(); |
59 session.beginTransaction(); | 59 session.beginTransaction(); |
60 | 60 |
61 » s = ModelDataFactory.state("s1"); | 61 s = ModelDataFactory.state("s1"); |
62 » c1 = ModelDataFactory.city("c1", s); | 62 c1 = ModelDataFactory.city("c1", s); |
63 » c2 = ModelDataFactory.city("c2", s); | 63 c2 = ModelDataFactory.city("c2", s); |
64 b1 = ModelDataFactory.building("b1"); | 64 b1 = ModelDataFactory.building("b1"); |
65 // because of the fuzziness in how avg gets computed on hsqldb | 65 // because of the fuzziness in how avg gets computed on hsqldb |
66 // we need to make sure the per-shard avg is a round number, otherwise | 66 // we need to make sure the per-shard avg is a round number, otherwise |
67 // our test will fail | 67 // our test will fail |
68 b1f1 = ModelDataFactory.floor(b1, 1, new BigDecimal(10.00)); | 68 b1f1 = ModelDataFactory.floor(b1, 1, new BigDecimal(10.00)); |
69 b1f2 = ModelDataFactory.floor(b1, 2, new BigDecimal(20.00)); | 69 b1f2 = ModelDataFactory.floor(b1, 2, new BigDecimal(20.00)); |
70 b1f3 = ModelDataFactory.floor(b1, 3, new BigDecimal(30.00)); | 70 b1f3 = ModelDataFactory.floor(b1, 3, new BigDecimal(30.00)); |
71 b1f3o1 = ModelDataFactory.office("NOT LAHGE", b1f3); | 71 b1f3o1 = ModelDataFactory.office("NOT LAHGE", b1f3); |
72 b1f3o2 = ModelDataFactory.office("LAHGE", b1f3); | 72 b1f3o2 = ModelDataFactory.office("LAHGE", b1f3); |
73 session.save(s); | 73 session.save(s); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 public void testMultiOrdering() throws Exception { | 330 public void testMultiOrdering() throws Exception { |
331 Criteria crit = session.createCriteria(Office.class); | 331 Criteria crit = session.createCriteria(Office.class); |
332 crit.addOrder(Order.asc("label")).createCriteria("floor"). | 332 crit.addOrder(Order.asc("label")).createCriteria("floor"). |
333 createCriteria("building").addOrder(Order.desc("name")); | 333 createCriteria("building").addOrder(Order.desc("name")); |
334 List<Office> listResult = list(crit); | 334 List<Office> listResult = list(crit); |
335 List<Office> answer = Lists.newArrayList(b2f1o1, b1f3o2, b1f3o1); | 335 List<Office> answer = Lists.newArrayList(b2f1o1, b1f3o2, b1f3o1); |
336 assertTrue(answer.equals(listResult)); | 336 assertTrue(answer.equals(listResult)); |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
LEFT | RIGHT |