Package org.teiid.query.sql.proc

Examples of org.teiid.query.sql.proc.IfStatement


        query.setSelect(new Select(Arrays.asList(new Object[] {new ExpressionSymbol("expr", new Constant(new Integer(1)))}))); //$NON-NLS-1$
        CommandStatement commandStmt = new CommandStatement(query);
        CompareCriteria criteria = new CompareCriteria(new ElementSymbol("x"), CompareCriteria.GT, new Constant(new Integer(1))); //$NON-NLS-1$
        Block block = new Block();
        block.addStatement(commandStmt);
        IfStatement ifStmt = new IfStatement(criteria, block);
        IfStatement ifStmt1 = (IfStatement)ifStmt.clone();
        Block block2 = new Block();
        block2.addStatement(commandStmt);
        ifStmt1.setElseBlock(block2);
        Block block3 = new Block();
        block3.addStatement(ifStmt);
        block3.addStatement(ifStmt1);
        CreateUpdateProcedureCommand command = new CreateUpdateProcedureCommand(block3);
       
View Full Code Here


  public static final IfStatement sample1() {
    Block ifBlock = TestBlock.sample1();
    Block elseBlock = TestBlock.sample2();
    Criteria criteria = TestHasCriteria.sample1();
    return new IfStatement(criteria, ifBlock, elseBlock);
  }
View Full Code Here

  public static final IfStatement sample2() {
    Block ifBlock = TestBlock.sample2();
    Block elseBlock = TestBlock.sample1();
    Criteria criteria = TestHasCriteria.sample2();
    return new IfStatement(criteria, ifBlock, elseBlock);
  }
View Full Code Here

 
  // ################################## ACTUAL TESTS ################################ 


  public void testGetIfBlock() {
    IfStatement b1 = sample1();
        assertTrue("Incorrect IfBlock on statement", b1.getIfBlock().equals(TestBlock.sample1())); //$NON-NLS-1$
  }
View Full Code Here

    IfStatement b1 = sample1();
        assertTrue("Incorrect IfBlock on statement", b1.getIfBlock().equals(TestBlock.sample1())); //$NON-NLS-1$
  }
 
  public void testGetElseBlock() {
    IfStatement b1 = sample1();
        assertTrue("Incorrect IfBlock on statement", b1.getElseBlock().equals(TestBlock.sample2())); //$NON-NLS-1$
  }
View Full Code Here

    IfStatement b1 = sample1();
        assertTrue("Incorrect IfBlock on statement", b1.getElseBlock().equals(TestBlock.sample2())); //$NON-NLS-1$
  }
 
  public void testGetCondition() {
    IfStatement b1 = sample1();
        assertTrue("Incorrect IfBlock on statement", b1.getCondition().equals(TestHasCriteria.sample1())); //$NON-NLS-1$
  }
View Full Code Here

    IfStatement b1 = sample1();
        assertTrue("Incorrect IfBlock on statement", b1.getCondition().equals(TestHasCriteria.sample1())); //$NON-NLS-1$
  }
 
  public void testSelfEquivalence(){
    IfStatement s1 = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1);
  }
View Full Code Here

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

  public void testEquivalence(){
    IfStatement s1 = sample1();
    IfStatement s1a = sample1();
    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1a);
  }
View Full Code Here

    int equals = 0;
    UnitTestUtil.helpTestEquivalence(equals, s1, s1a);
  }
 
  public void testNonEquivalence(){
    IfStatement s1 = sample1();
    IfStatement s2 = sample2();
    int equals = -1;
    UnitTestUtil.helpTestEquivalence(equals, s1, s2);
  }
View Full Code Here

    ElementSymbol sy1 = new ElementSymbol("x"); //$NON-NLS-1$
    List elmnts = new ArrayList(1);
    elmnts.add(sy1);
    CriteriaSelector cs = new CriteriaSelector(CriteriaSelector.LIKE, elmnts);     
      Criteria crit = new HasCriteria(cs);     
      IfStatement ifStmt = new IfStatement(crit, ifblock);     
     
      // other statements
      RaiseErrorStatement errStmt =  new RaiseErrorStatement(new Constant("My Error")); //$NON-NLS-1$
      Block b = new Block();
      b.addStatement(cmdStmt);
View Full Code Here

TOP

Related Classes of org.teiid.query.sql.proc.IfStatement

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.