@Test public void testComplexSelectorQueryPlan() { List<String> ids = new ArrayList<String>(); ids.add(student1.getEntityId()); ids.add(student2.getEntityId()); NeutralQuery constraint = new NeutralQuery(); constraint.addCriteria(new NeutralCriteria("_id", NeutralCriteria.CRITERIA_IN, ids)); List<EntityBody> results = defaultSelectorDocument.aggregate(createQueryPlan("Student", getSelectorQueryPlan()), constraint); assertNotNull("Should not be null", results); assertEquals("Should match", 2, results.size()); EntityBody student = results.get(0); String studentId = (String) student.get("id"); assertTrue("Should be true", student.containsKey("studentSectionAssociations")); assertTrue("Should be true", student.containsKey("name")); assertEquals("Should match", 4, student.keySet().size()); @SuppressWarnings("unchecked") List<EntityBody> studentSectionAssociationList = (List<EntityBody>) student.get("studentSectionAssociations"); assertEquals("Should match", 2, studentSectionAssociationList.size()); EntityBody studentSectionAssociation = studentSectionAssociationList.get(0); String sectionId = (String) studentSectionAssociation.get("sectionId"); assertEquals("Should match", studentId, studentSectionAssociation.get("studentId")); assertTrue("Should be true", studentSectionAssociation.containsKey("sections")); assertTrue("Should be true", studentSectionAssociation.containsKey("sectionId")); assertEquals("Should match", 5, studentSectionAssociation.keySet().size()); @SuppressWarnings("unchecked") List<EntityBody> sectionList = (List<EntityBody>) studentSectionAssociation.get("sections"); assertEquals("Should match", 1, sectionList.size()); EntityBody section = sectionList.get(0); assertEquals("Should match", sectionId, section.get("id")); assertTrue("Should be true", section.containsKey("sectionName")); assertEquals("Should match", 3, section.keySet().size()); }
@Override public List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint) { return executeQueryPlan(selectorQuery, constraint, new ArrayList<EntityBody>(), new Stack<Type>(), true, new MyCounter()); }
DefaultSelectorDocument implements SelectorDocument { @Override public List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint) { return executeQueryPlan(selectorQuery, constraint, new ArrayList<EntityBody>(), new Stack<Type>(), true, new MyCounter()); } }
DefaultSelectorDocument implements SelectorDocument { @Override public List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint) { return executeQueryPlan(selectorQuery, constraint, new ArrayList<EntityBody>(), new Stack<Type>(), true, new MyCounter()); }  }
DefaultSelectorDocument implements SelectorDocument { @Override public List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint) { return executeQueryPlan(selectorQuery, constraint, new ArrayList<EntityBody>(), new Stack<Type>(), true, new MyCounter()); }  @Override List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint); List<EntityBody> getEntitySubList(List<EntityBody> list, String field, String value); }
DefaultSelectorDocument implements SelectorDocument { @Override public List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint) { return executeQueryPlan(selectorQuery, constraint, new ArrayList<EntityBody>(), new Stack<Type>(), true, new MyCounter()); }  @Override List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint); List<EntityBody> getEntitySubList(List<EntityBody> list, String field, String value); static final int EMBEDDED_DOCUMENT_LIMIT; }