Examples of SetCriteria


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

       
        Map map = new HashMap();
        map.put(e1, e2);
        map.put(c2, c3);
       
        SetCriteria before = new SetCriteria(e1, values);
        SetCriteria after = new SetCriteria(e2, mappedValues);
        helpTest(before, map, after);
    }
View Full Code Here

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

   
    helpTest(select, "SELECT e1, e2"); //$NON-NLS-1$
  }

  public void testSetCriteria1() {
    SetCriteria sc = new SetCriteria();
    sc.setExpression(new ElementSymbol("e1"));     //$NON-NLS-1$
    sc.setValues(new ArrayList());
   
    helpTest(sc, "e1 IN ()"); //$NON-NLS-1$
  }
View Full Code Here

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

   
    helpTest(sc, "e1 IN ()"); //$NON-NLS-1$
  }

  public void testSetCriteria2() {
    SetCriteria sc = new SetCriteria();
    sc.setExpression(new ElementSymbol("e1"));   //$NON-NLS-1$
    ArrayList values = new ArrayList()
    values.add(new ElementSymbol("e2")); //$NON-NLS-1$
    values.add(new Constant("abc")); //$NON-NLS-1$
    sc.setValues(values);
   
    helpTest(sc, "e1 IN (e2, 'abc')"); //$NON-NLS-1$
  }
View Full Code Here

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

   
    helpTest(sc, "e1 IN (e2, 'abc')"); //$NON-NLS-1$
  }

  public void testSetCriteria3() {
    SetCriteria sc = new SetCriteria();
    sc.setExpression(new ElementSymbol("e1"));   //$NON-NLS-1$
    ArrayList values = new ArrayList()
    values.add(null);
    values.add(new Constant("b")); //$NON-NLS-1$
    sc.setValues(values);
   
    helpTest(sc, "e1 IN (<undefined>, 'b')"); //$NON-NLS-1$
 
View Full Code Here

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

   
    helpTest(sc, "e1 IN (<undefined>, 'b')"); //$NON-NLS-1$
 
   
    public void testSetCriteria4() {
        SetCriteria sc = new SetCriteria();
        sc.setExpression(new ElementSymbol("e1"));   //$NON-NLS-1$
        ArrayList values = new ArrayList();
        values.add(new ElementSymbol("e2")); //$NON-NLS-1$
        values.add(new Constant("abc")); //$NON-NLS-1$
        sc.setValues(values);
        sc.setNegated(true);
        helpTest(sc, "e1 NOT IN (e2, 'abc')"); //$NON-NLS-1$
    }
View Full Code Here

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

        }
        Boolean result = Boolean.FALSE;

        ValueIterator valueIter = null;
        if (criteria instanceof SetCriteria) {
          SetCriteria set = (SetCriteria)criteria;
          if (set.isAllConstants()) {
            boolean exists = set.getValues().contains(new Constant(leftValue, criteria.getExpression().getType()));
            if (!exists) {
              if (set.getValues().contains(Constant.NULL_CONSTANT)) {
                return null;
              }
              return criteria.isNegated();
            }
            return !criteria.isNegated();
View Full Code Here

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

 
 
  // ################################## TEST HELPERS ################################ 

  public static final SetCriteria sample1() {
      SetCriteria c1 = new SetCriteria();
      c1.setExpression(new ElementSymbol("e1")); //$NON-NLS-1$
    List vals = new ArrayList();
    vals.add(new Constant("a")); //$NON-NLS-1$
    vals.add(new Constant("b")); //$NON-NLS-1$
    c1.setValues(vals);
    return c1;
  }
View Full Code Here

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

    c1.setValues(vals);
    return c1;
  }

  public static final SetCriteria sample2() {
      SetCriteria c1 = new SetCriteria();
      c1.setExpression(new ElementSymbol("e2")); //$NON-NLS-1$
    List vals = new ArrayList();
    vals.add(new Constant("c")); //$NON-NLS-1$
    vals.add(new Constant("d")); //$NON-NLS-1$
    c1.setValues(vals);
    return c1;
  }
View Full Code Here

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

  }
   
  // ################################## ACTUAL TESTS ################################
 
  public void testEquals1() {  
      SetCriteria c1 = new SetCriteria();
      c1.setExpression(new ElementSymbol("e1")); //$NON-NLS-1$
    List vals = new ArrayList();
    vals.add(new Constant("a")); //$NON-NLS-1$
    vals.add(new Constant("b")); //$NON-NLS-1$
    c1.setValues(vals);
   
    SetCriteria c2 = (SetCriteria) c1.clone();
   
    assertTrue("Equivalent set criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));         //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here

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

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

  public void testEquals2() {  
      SetCriteria c1 = new SetCriteria();
        c1.setNegated(true);
      c1.setExpression(new ElementSymbol("e1")); //$NON-NLS-1$
    List vals1 = new ArrayList();
    vals1.add(new Constant("a")); //$NON-NLS-1$
    vals1.add(new Constant("b")); //$NON-NLS-1$
    c1.setValues(vals1);
   
      SetCriteria c2 = new SetCriteria();
        c2.setNegated(true);
      c2.setExpression(new ElementSymbol("e1")); //$NON-NLS-1$
    List vals2 = new ArrayList();
    vals2.add(new Constant("b")); //$NON-NLS-1$
    vals2.add(new Constant("a")); //$NON-NLS-1$
    c2.setValues(vals2);
   
    assertTrue("Equivalent set criteria don't compare as equal: " + c1 + ", " + c2, c1.equals(c2));         //$NON-NLS-1$ //$NON-NLS-2$
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.