From 0ffae97e0938b0c9fe2d264b8f5e26be9f6f6f0e Mon Sep 17 00:00:00 2001 From: "Brian S. O'Neill" Date: Fri, 8 Sep 2006 17:00:16 +0000 Subject: Make better use of OrderingList class. --- .../com/amazon/carbonado/qe/TestJoinedQueryExecutor.java | 12 +++--------- .../java/com/amazon/carbonado/qe/TestQueryExecutor.java | 13 ++----------- .../com/amazon/carbonado/qe/TestSortedQueryExecutor.java | 6 +++--- 3 files changed, 8 insertions(+), 23 deletions(-) (limited to 'src/test/java/com/amazon') diff --git a/src/test/java/com/amazon/carbonado/qe/TestJoinedQueryExecutor.java b/src/test/java/com/amazon/carbonado/qe/TestJoinedQueryExecutor.java index e2c9f5e..7d352ed 100644 --- a/src/test/java/com/amazon/carbonado/qe/TestJoinedQueryExecutor.java +++ b/src/test/java/com/amazon/carbonado/qe/TestJoinedQueryExecutor.java @@ -175,16 +175,10 @@ public class TestJoinedQueryExecutor extends TestQueryExecutor { addressExecutor = new FilteredQueryExecutor (addressExecutor, Filter.filterFor(UserAddress.class, "state = ?")); - StorableProperty prop = StorableIntrospector - .examine(UserAddress.class).getAllProperties().get("country"); + OrderingList ordering = OrderingList.get(UserAddress.class, "+country"); - List> orderings = - new ArrayList>(); - - orderings.add(OrderedProperty.get(prop, Direction.ASCENDING)); - - addressExecutor = new ArraySortedQueryExecutor - (addressExecutor, null, orderings); + addressExecutor = + new ArraySortedQueryExecutor(addressExecutor, null, ordering); return addressExecutor; } diff --git a/src/test/java/com/amazon/carbonado/qe/TestQueryExecutor.java b/src/test/java/com/amazon/carbonado/qe/TestQueryExecutor.java index 4727a56..07558f1 100644 --- a/src/test/java/com/amazon/carbonado/qe/TestQueryExecutor.java +++ b/src/test/java/com/amazon/carbonado/qe/TestQueryExecutor.java @@ -83,17 +83,8 @@ public abstract class TestQueryExecutor extends TestCase { } } - protected List> createOrdering(String... properties) { - StorableInfo
info = StorableIntrospector.examine(Address.class); - Map> props = info.getAllProperties(); - - List> ordered = new ArrayList>(); - - for (String prop : properties) { - ordered.add(OrderedProperty.get(props.get(prop), Direction.ASCENDING)); - } - - return ordered; + protected OrderingList
createOrdering(String... properties) { + return OrderingList.get(Address.class, properties); } static void printPlan(QueryExecutor executor) { diff --git a/src/test/java/com/amazon/carbonado/qe/TestSortedQueryExecutor.java b/src/test/java/com/amazon/carbonado/qe/TestSortedQueryExecutor.java index 9e9906f..8e1eda2 100644 --- a/src/test/java/com/amazon/carbonado/qe/TestSortedQueryExecutor.java +++ b/src/test/java/com/amazon/carbonado/qe/TestSortedQueryExecutor.java @@ -47,7 +47,7 @@ public class TestSortedQueryExecutor extends TestQueryExecutor { QueryExecutor
unsorted = createExecutor(4, 2, 3, 1); Filter
filter = Filter.getOpenFilter(Address.class); FilterValues
values = filter.initialFilterValues(); - List> ordered = createOrdering("addressCountry"); + OrderingList
ordered = createOrdering("addressCountry"); QueryExecutor
executor = new ArraySortedQueryExecutor
(unsorted, null, ordered); @@ -65,8 +65,8 @@ public class TestSortedQueryExecutor extends TestQueryExecutor { QueryExecutor
unsorted = createExecutor(1, 2, 3, 4); Filter
filter = Filter.getOpenFilter(Address.class); FilterValues
values = filter.initialFilterValues(); - List> handled = createOrdering("addressCountry"); - List> finisher = createOrdering("addressState"); + OrderingList
handled = createOrdering("addressCountry"); + OrderingList
finisher = createOrdering("addressState"); QueryExecutor
executor = new ArraySortedQueryExecutor
(unsorted, handled, finisher); -- cgit v1.2.3