private void addOuterJoinSimpleTest() { // This one does not really make sense, however its simple and tests that the syntax works. ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.getAllowingNull("address").get("city").equal("Ottawa"); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 1); test.setName("OuterJoinSimpleTest"); test.setDescription("Test expression with outer joins"); test.setExpression(expression); addTest(test); }
private void addOuterJoinManyToManyTest() { ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.get("firstName") .like("%") .or(emp.anyOfAllowingNone("projects").get("description").like("%")); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 12); test.setName("OuterJoinManytoManyTest"); test.setDescription("Tests manytomany relationships with outer joins"); test.setExpression(expression); addTest(test); }
private void addOuterJoinDirectCollectionTest() { ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.get("firstName") .equal("Nancy") .or(emp.anyOfAllowingNone("responsibilitiesList").equal("Write lots of Java code.")); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 2); test.setName("OuterJoinDirectCollectionTest"); test.setDescription("Tests direct collection relationships with outer joins"); test.setExpression(expression); addTest(test); }
private void addOuterJoinOrWhereClauseTest2() { ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.get("firstName") .like("Sarah%") .or(emp.getAllowingNull("manager").get("firstName").like("Sarah%")); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 3); test.setName("OuterJoinOrWhereClauseTest2"); test.setDescription("Test expression with outer joins"); test.setExpression(expression); addTest(test); }
private void addOuterJoinOrAnyWhereClauseTest() { ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.get("firstName") .like("Sarah%") .or(emp.anyOfAllowingNone("phoneNumbers").get("areaCode").equal("613")); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 10); test.setName("OuterJoinOrAnyWhereClauseTest"); test.setDescription("Test expression anyof with outer joins"); test.setExpression(expression); addTest(test); }
private void addOuterJoinIsNullTest() { ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.get("firstName") .equal("Bob") .or(emp.getAllowingNull("address").isNull()) .or(emp.getAllowingNull("address").get("city").equal("Ottawa")); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 2); test.setName("OuterJoinIsNullTest"); test.setDescription("Test using isNull with outer joins"); test.setExpression(expression); addTest(test); }
private void addOuterJoinOrWhereClauseTest4() { ExpressionBuilder emp = new ExpressionBuilder(); Expression expression = emp.get("firstName") .like("Bob%") .or( emp.getAllowingNull("address") .get("city") .like("Ot%") .and(emp.getAllowingNull("address").get("city").like("%wa"))); ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 2); test.setName("OuterJoinOrWhereClauseTest4"); test.setDescription("Test expression with outer joins"); test.setExpression(expression); addTest(test); }