Package org.teiid.query.sql.lang

Examples of org.teiid.query.sql.lang.BetweenCriteria


        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Expression constant1 = new Constant(new Integer(1000));
        Expression constant2 = new Constant(new Integer(2000));
        Criteria crit = new BetweenCriteria(a, constant1, constant2);

        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(crit);
View Full Code Here


        ElementSymbol a = new ElementSymbol("a")//$NON-NLS-1$
        select.addSymbol(a);

        Expression constant1 = new Constant(new Integer(1000));
        Expression constant2 = new Constant(new Integer(2000));
        BetweenCriteria crit = new BetweenCriteria(a, constant1, constant2);
        crit.setNegated(true);
        Query query = new Query();
        query.setSelect(select);
        query.setFrom(from);
        query.setCriteria(crit);
        helpTest("SELECT a from db.g where a NOT BETWEEN 1000 AND 2000"//$NON-NLS-1$
View Full Code Here

       
        assertEquals("Incorrect string for null object", SQLStringVisitor.UNDEFINED, sql); //$NON-NLS-1$
  }
   
    public void testBetweenCriteria1() {
        BetweenCriteria bc = new BetweenCriteria(
            new ElementSymbol("m.g.c1"), //$NON-NLS-1$
            new Constant(new Integer(1000)),
            new Constant(new Integer(2000)) );
        helpTest(bc, "m.g.c1 BETWEEN 1000 AND 2000"); //$NON-NLS-1$
    }
View Full Code Here

            new Constant(new Integer(2000)) );
        helpTest(bc, "m.g.c1 BETWEEN 1000 AND 2000"); //$NON-NLS-1$
    }
   
    public void testBetweenCriteria2() {
        BetweenCriteria bc = new BetweenCriteria(
            new ElementSymbol("m.g.c1"), //$NON-NLS-1$
            new Constant(new Integer(1000)),
            new Constant(new Integer(2000)) );
        bc.setNegated(true);
        helpTest(bc, "m.g.c1 NOT BETWEEN 1000 AND 2000"); //$NON-NLS-1$
    }
View Full Code Here

 
 
  // ################################## TEST HELPERS ################################ 
   
  public static BetweenCriteria example(String element, int lower, int upper, boolean negated) {
        BetweenCriteria criteria = new BetweenCriteria(new ElementSymbol(element),
                                                       new Constant(new Integer(lower)),
                                                       new Constant(new Integer(upper)));
        criteria.setNegated(negated);
    return criteria;       
    }
View Full Code Here

    }
   
  // ################################## ACTUAL TESTS ################################
 
  public void testEquals1() {
        BetweenCriteria c1 = example("x", 1, 20, false); //$NON-NLS-1$
        BetweenCriteria c2 = example("x", 1, 20, false); //$NON-NLS-1$
    assertTrue("Equivalent between criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));         //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

        BetweenCriteria c2 = example("x", 1, 20, false); //$NON-NLS-1$
    assertTrue("Equivalent between criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));         //$NON-NLS-1$ //$NON-NLS-2$
  }

    public void testEquals2() {   
        BetweenCriteria c1 = example("x", 1, 20, true); //$NON-NLS-1$
        BetweenCriteria c2 = (BetweenCriteria)c1.clone();
        assertTrue("Equivalent between criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));              //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

        BetweenCriteria c2 = (BetweenCriteria)c1.clone();
        assertTrue("Equivalent between criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));              //$NON-NLS-1$ //$NON-NLS-2$
    }

    public void testEquals3() {   
        BetweenCriteria c1 = example("x", 1, 20, true); //$NON-NLS-1$
        BetweenCriteria c2 = (BetweenCriteria)c1.clone();
        c2.setNegated(false);
        assertFalse("Criteria should not be equal: " + c1 + ", " + c2, c1.equals(c2));              //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

        c2.setNegated(false);
        assertFalse("Criteria should not be equal: " + c1 + ", " + c2, c1.equals(c2));              //$NON-NLS-1$ //$NON-NLS-2$
    }

  public void testSelfEquivalence(){
        BetweenCriteria c1 = example("x", 1, 20, false); //$NON-NLS-1$
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, c1, c1);
  }
View Full Code Here

    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, c1, c1);
  }

  public void testEquivalence(){
        BetweenCriteria c1 = example("x", 1, 20, false); //$NON-NLS-1$
        BetweenCriteria c2 = example("x", 1, 20, false); //$NON-NLS-1$
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, c1, c2);
  }
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.lang.BetweenCriteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.