コード例 #1
0
  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);
  }
コード例 #2
0
  private void addOuterJoinOrWhereClauseTest3() {
    ExpressionBuilder emp = new ExpressionBuilder();
    Expression expression =
        emp.get("firstName")
            .like("Sarah%")
            .and(emp.get("lastName").like("Smit%"))
            .or(
                emp.getAllowingNull("manager")
                    .get("firstName")
                    .like("Sarah%")
                    .and(emp.getAllowingNull("manager").get("lastName").like("Smit%")));

    ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 2);
    test.setName("OuterJoinOrWhereClauseTest3");
    test.setDescription("Test expression with outer joins");
    test.setExpression(expression);

    addTest(test);
  }
コード例 #3
0
  private void addOuterJoinJoiningTest() {
    ExpressionBuilder emp = new ExpressionBuilder();

    ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 12);
    test.setName("OuterJoinJoiningTest");
    test.setDescription("Test joining with outer joins");
    ReadAllQuery query = new ReadAllQuery(Employee.class);
    query.addJoinedAttribute(emp.getAllowingNull("address"));
    test.setQuery(query);

    addTest(test);
  }
コード例 #4
0
  private void addOuterJoinJoiningComplexTest() {
    ExpressionBuilder emp = new ExpressionBuilder();

    ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Project.class, 15);
    test.setName("OuterJoinJoiningComplexTest");
    test.setDescription("Test joining with outer joins");
    ReadAllQuery query = new ReadAllQuery(Project.class);
    query.addJoinedAttribute(emp.getAllowingNull("teamLeader"));
    test.setQuery(query);

    addTest(test);
  }
コード例 #5
0
  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);
  }
コード例 #6
0
  private void addOuterJoinOrderByTest() {
    ExpressionBuilder emp = new ExpressionBuilder();

    ReadAllExpressionTest test = new ReadAllOuterJoinExpressionTest(Employee.class, 12);
    test.setName("OuterJoinOrderByTest");
    test.setDescription("Test order by with outer joins");
    ReadAllQuery query = new ReadAllQuery(Employee.class);
    query.addOrdering(emp.getAllowingNull("address").get("city"));
    test.setQuery(query);

    addTest(test);
  }
コード例 #7
0
  private void addOuterJoinJoiningTest2() {
    ExpressionBuilder emp = new ExpressionBuilder();

    ReadAllExpressionTest test =
        new ReadAllOuterJoinExpressionTest2(
            org.eclipse.persistence.testing.models.insurance.PolicyHolder.class, 4);
    test.setName("OuterJoinJoiningTest2");
    test.setDescription("Test joining with outer joins");
    ReadAllQuery query =
        new ReadAllQuery(org.eclipse.persistence.testing.models.insurance.PolicyHolder.class);
    query.addJoinedAttribute(emp.getAllowingNull("address"));
    test.setQuery(query);

    addTest(test);
  }
コード例 #8
0
  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);
  }
コード例 #9
0
  private void addOuterJoinAcrossInheritanceTest() {
    ExpressionBuilder emp = new ExpressionBuilder();

    ReadAllExpressionTest test =
        new ReadAllOuterJoinExpressionTest(
            org.eclipse.persistence.testing.models.inheritance.Person.class, 1);
    test.setName("OuterJoinAcrossInheritanceTest");
    test.setDescription("Test joining with outer joins across inheritance");
    ReadAllQuery query =
        new ReadAllQuery(org.eclipse.persistence.testing.models.inheritance.Person.class);

    // This test used to make no sense...
    // query.setSelectionCriteria(emp.getAllowingNull("representitive").get("name").equalOuterJoin("Richard"));
    query.addOrdering(emp.getAllowingNull("representitive").get("name"));
    test.setQuery(query);

    addTest(test);
  }