Search in sources :

Example 11 with JoinPredicate

use of org.teiid.query.sql.lang.JoinPredicate in project teiid by teiid.

the class TestJoinPredicate method testEquals2.

/**
 * Test <code>equals()</code> method of <code>JoinPredicate</code> to
 * verify it properly evaluates the equality of two
 * <code>JoinPredicate</code> objects.
 * <p>
 * This test ensures that two different <code>JoinPredicate</code> objects
 * that were constructed with the same join type and with the same
 * compound criteria evaluate as equal.
 * <p>
 * For example:
 * ... m.g1 LEFT OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
 */
public void testEquals2() {
    // $NON-NLS-1$ //$NON-NLS-2$
    JoinPredicate jp1 = example(JoinType.JOIN_LEFT_OUTER, "e1", "e2");
    // $NON-NLS-1$ //$NON-NLS-2$
    JoinPredicate jp2 = example(JoinType.JOIN_LEFT_OUTER, "e1", "e2");
    // $NON-NLS-1$ //$NON-NLS-2$
    assertTrue("Equivalent join predicate don't compare as equal: " + jp1 + ", " + jp2, jp1.equals(jp2));
}
Also used : JoinPredicate(org.teiid.query.sql.lang.JoinPredicate)

Example 12 with JoinPredicate

use of org.teiid.query.sql.lang.JoinPredicate in project teiid by teiid.

the class TestJoinPredicate method testSelfEquivalence.

/**
 * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
 * <p>
 * This test ensures that the same <code>JoinPredicate</code> object
 * evaluates as equal when it is compared to itself.
 * <p>
 * For example:
 * ... m.g1 FULL OUTER JOIN m.g2 ON m.g1.e1 = m.g2.e1
 */
public void testSelfEquivalence() {
    // $NON-NLS-1$
    JoinPredicate jp1 = example(JoinType.JOIN_FULL_OUTER, "e1");
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, jp1, jp1);
}
Also used : JoinPredicate(org.teiid.query.sql.lang.JoinPredicate)

Example 13 with JoinPredicate

use of org.teiid.query.sql.lang.JoinPredicate in project teiid by teiid.

the class TestJoinPredicate method testCloneEquivalence.

/**
 * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
 * <p>
 * This test ensures that a <code>JoinPredicate</code> object's clone
 * evaluate as equal when compared to the original object.
 * <p>
 * For example:
 * ... m.g1 UNION JOIN m.g2 ON m.g1.e1 = m.g2.e1
 */
public void testCloneEquivalence() {
    // $NON-NLS-1$
    JoinPredicate jp1 = example(JoinType.JOIN_UNION, "e1");
    JoinPredicate jp2 = (JoinPredicate) jp1.clone();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
}
Also used : JoinPredicate(org.teiid.query.sql.lang.JoinPredicate)

Example 14 with JoinPredicate

use of org.teiid.query.sql.lang.JoinPredicate in project teiid by teiid.

the class TestJoinPredicate method testEquals5.

/**
 * Test <code>equals()</code> method of <code>JoinPredicate</code> to
 * verify it properly evaluates the equality of two <code>JoinPredicate</code>
 * objects.
 * <p>
 * This test ensures that two different <code>JoinPredicate</code> objects
 * that were constructed with the same join type but with different
 * compound criteria evaluate as not equal.
 * <p>
 * For example:
 * ... m.g1 CROSS JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
 * ... m.g1 CROSS JOIN m.g2 ON ((m.g1.e2 = m.g2.e2) AND (m.g1.e2 = m.g2.e2))
 */
public void testEquals5() {
    // $NON-NLS-1$ //$NON-NLS-2$
    JoinPredicate jp1 = example(JoinType.JOIN_CROSS, "e1", "e2");
    // $NON-NLS-1$ //$NON-NLS-2$
    JoinPredicate jp2 = example(JoinType.JOIN_CROSS, "e2", "e2");
    // $NON-NLS-1$ //$NON-NLS-2$
    assertTrue("Different join predicate compare as equal: " + jp1 + ", " + jp2, !jp1.equals(jp2));
}
Also used : JoinPredicate(org.teiid.query.sql.lang.JoinPredicate)

Example 15 with JoinPredicate

use of org.teiid.query.sql.lang.JoinPredicate in project teiid by teiid.

the class TestJoinPredicate method testNonEquivalence1.

/**
 * Test a <code>JoinPredicate</code> object using <code>UnitTestUtil.helpTestEquivalence</code>.
 * <p>
 * This test ensures that two different <code>JoinPredicate</code> objects
 * constructed with the same join type but with different criteria evaluate
 * as not equal.
 * <p>
 * For example:
 * ... m.g1 FULL OUTER JOIN m.g2 ON ((m.g1.e1 = m.g2.e1) AND (m.g1.e2 = m.g2.e2))
 * ... m.g1 FULL OUTER JOIN m.g2 ON m.g1.e400 = m.g2.e400
 */
public void testNonEquivalence1() {
    // $NON-NLS-1$ //$NON-NLS-2$
    JoinPredicate jp1 = example(JoinType.JOIN_FULL_OUTER, "e1", "e2");
    // $NON-NLS-1$
    JoinPredicate jp2 = example(JoinType.JOIN_FULL_OUTER, "e400");
    int equals = -1;
    UnitTestUtil.helpTestEquivalence(equals, jp1, jp2);
}
Also used : JoinPredicate(org.teiid.query.sql.lang.JoinPredicate)

Aggregations

JoinPredicate (org.teiid.query.sql.lang.JoinPredicate)15 UnaryFromClause (org.teiid.query.sql.lang.UnaryFromClause)4 HashSet (java.util.HashSet)2 Set (java.util.Set)2 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)2 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)2 ArrayList (java.util.ArrayList)1 CompoundCriteria (org.teiid.query.sql.lang.CompoundCriteria)1 Criteria (org.teiid.query.sql.lang.Criteria)1 FromClause (org.teiid.query.sql.lang.FromClause)1 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)1