Example #1
0
 protected PlanNode sourceNode(
     QueryContext context, PlanNode parent, String selectorName, String... columnNames) {
   PlanNode node = new PlanNode(Type.SOURCE, parent);
   SelectorName selector = selector(selectorName);
   node.addSelector(selector);
   node.setProperty(Property.PROJECT_COLUMNS, columns(context, selector, columnNames));
   node.setProperty(Property.PROJECT_COLUMN_TYPES, columnTypes(context, selector, columnNames));
   return node;
 }
Example #2
0
 protected void assertSelectors(PlanNode node, String... selectors) {
   Set<SelectorName> selectorSet = new HashSet<SelectorName>();
   for (String selectorName : selectors) {
     selectorSet.add(new SelectorName(selectorName));
   }
   assertThat("Selectors don't match", node.getSelectors(), is(selectorSet));
 }
Example #3
0
 @SafeVarargs
 protected final <T> void assertPropertyIsList(
     PlanNode node, Property name, Class<T> valueType, T... values) {
   assertThat(
       "Property value doesn't match",
       node.getPropertyAsList(name, valueType),
       is(Arrays.asList(values)));
 }
Example #4
0
 protected void assertSortOrderBy(PlanNode sortNode, String... selectors) {
   List<SelectorName> expected = new ArrayList<SelectorName>(selectors.length);
   for (String selectorName : selectors) {
     expected.add(new SelectorName(selectorName));
   }
   List<SelectorName> actualSortedBy =
       sortNode.getPropertyAsList(Property.SORT_ORDER_BY, SelectorName.class);
   assertThat("Sort node order-by doesn't match selector name list", actualSortedBy, is(expected));
 }
Example #5
0
 protected void assertProperty(PlanNode node, Property name, Object value) {
   assertThat("Property value doesn't match", node.getProperty(name), is(value));
 }
Example #6
0
 protected void assertSameChildren(PlanNode node, PlanNode... children) {
   assertThat(node.getChildCount(), is(children.length));
   for (int i = 0; i != node.getChildCount(); ++i) {
     assertThat(node.getChild(i).isSameAs(children[i]), is(true));
   }
 }
Example #7
0
 protected void assertChildren(PlanNode node, PlanNode... children) {
   assertThat(node.getChildCount(), is(children.length));
   for (int i = 0; i != node.getChildCount(); ++i) {
     assertThat(node.getChild(i), is(sameInstance(children[i])));
   }
 }
Example #8
0
 protected <T> void assertPropertyIsList(
     PlanNode node, Property name, Class<T> valueType, List<T> values) {
   assertThat("Property value doesn't match", node.getPropertyAsList(name, valueType), is(values));
 }