diff options
author | Brian S. O'Neill <bronee@gmail.com> | 2006-09-08 17:00:16 +0000 |
---|---|---|
committer | Brian S. O'Neill <bronee@gmail.com> | 2006-09-08 17:00:16 +0000 |
commit | 0ffae97e0938b0c9fe2d264b8f5e26be9f6f6f0e (patch) | |
tree | 240a586c54383a0c70f788c2ee9474deacdb1a62 /src/test/java/com/amazon | |
parent | 5746b6ef0b4eff0ff8f9eeb448e3de5f759b916d (diff) |
Make better use of OrderingList class.
Diffstat (limited to 'src/test/java/com/amazon')
3 files changed, 8 insertions, 23 deletions
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<UserAddress>
(addressExecutor, Filter.filterFor(UserAddress.class, "state = ?"));
- StorableProperty<UserAddress> prop = StorableIntrospector
- .examine(UserAddress.class).getAllProperties().get("country");
+ OrderingList<UserAddress> ordering = OrderingList.get(UserAddress.class, "+country");
- List<OrderedProperty<UserAddress>> orderings =
- new ArrayList<OrderedProperty<UserAddress>>();
-
- orderings.add(OrderedProperty.get(prop, Direction.ASCENDING));
-
- addressExecutor = new ArraySortedQueryExecutor<UserAddress>
- (addressExecutor, null, orderings);
+ addressExecutor =
+ new ArraySortedQueryExecutor<UserAddress>(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<OrderedProperty<Address>> createOrdering(String... properties) {
- StorableInfo<Address> info = StorableIntrospector.examine(Address.class);
- Map<String, ? extends StorableProperty<Address>> props = info.getAllProperties();
-
- List<OrderedProperty<Address>> ordered = new ArrayList<OrderedProperty<Address>>();
-
- for (String prop : properties) {
- ordered.add(OrderedProperty.get(props.get(prop), Direction.ASCENDING));
- }
-
- return ordered;
+ protected OrderingList<Address> 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<Address> unsorted = createExecutor(4, 2, 3, 1);
Filter<Address> filter = Filter.getOpenFilter(Address.class);
FilterValues<Address> values = filter.initialFilterValues();
- List<OrderedProperty<Address>> ordered = createOrdering("addressCountry");
+ OrderingList<Address> ordered = createOrdering("addressCountry");
QueryExecutor<Address> executor =
new ArraySortedQueryExecutor<Address>(unsorted, null, ordered);
@@ -65,8 +65,8 @@ public class TestSortedQueryExecutor extends TestQueryExecutor { QueryExecutor<Address> unsorted = createExecutor(1, 2, 3, 4);
Filter<Address> filter = Filter.getOpenFilter(Address.class);
FilterValues<Address> values = filter.initialFilterValues();
- List<OrderedProperty<Address>> handled = createOrdering("addressCountry");
- List<OrderedProperty<Address>> finisher = createOrdering("addressState");
+ OrderingList<Address> handled = createOrdering("addressCountry");
+ OrderingList<Address> finisher = createOrdering("addressState");
QueryExecutor<Address> executor =
new ArraySortedQueryExecutor<Address>(unsorted, handled, finisher);
|