Package com.puppetlabs.geppetto.pp

Examples of com.puppetlabs.geppetto.pp.ExportedCollectQuery


        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.EXPORTED_COLLECT_QUERY: {
        ExportedCollectQuery exportedCollectQuery = (ExportedCollectQuery) theEObject;
        T result = caseExportedCollectQuery(exportedCollectQuery);
        if(result == null)
          result = caseUnaryExpression(exportedCollectQuery);
        if(result == null)
          result = caseICollectQuery(exportedCollectQuery);
View Full Code Here


    String s = serializeFormatted(pp);
    assertEquals("serialization should produce specified result", Sample_Collect, s);

    // -- test exported query
    ExportedCollectQuery eq = pf.createExportedCollectQuery();
    eq.setExpr(predicate);
    ce.setQuery(eq);

    s = serializeFormatted(pp);
    assertEquals("serialization should produce specified result", Sample_Collect_Exported, s);

    // -- test with more complex query
    // -- test non equality
    predicate.setOpName("!=");
    // -- test and / or
    AndExpression and = pf.createAndExpression();
    and.setLeftExpr(predicate);
    OrExpression or = pf.createOrExpression();

    EqualityExpression predicate2 = pf.createEqualityExpression();
    predicate2.setLeftExpr(createNameOrReference("name"));
    predicate2.setOpName("!=");
    predicate2.setRightExpr(createNameOrReference("Darth"));
    EqualityExpression predicate3 = pf.createEqualityExpression();
    predicate3.setLeftExpr(createNameOrReference("name"));
    predicate3.setOpName("!=");
    predicate3.setRightExpr(createNameOrReference("Vader"));
    or.setLeftExpr(predicate2);
    or.setRightExpr(predicate3);
    ParenthesisedExpression pe = pf.createParenthesisedExpression();
    pe.setExpr(or);
    and.setRightExpr(pe);
    eq.setExpr(and);
    s = serializeFormatted(pp);
    assertEquals("serialization should produce specified result", Sample_Collect_Complex, s);

  }
View Full Code Here

    ce.setClassReference(createNameOrReference("A::User::B"));
    tester.validator().checkCollectExpression(ce);
    tester.diagnose().assertOK();

    // -- test exported query
    ExportedCollectQuery eq = pf.createExportedCollectQuery();
    eq.setExpr(predicate);
    ce.setQuery(eq);
    tester.validator().checkCollectExpression(ce);
    tester.diagnose().assertOK();

    // -- test non equality
    predicate.setOpName("!=");
    tester.validator().checkCollectExpression(ce);
    tester.diagnose().assertOK();

    // -- test and / or
    AndExpression and = pf.createAndExpression();
    and.setLeftExpr(predicate);
    OrExpression or = pf.createOrExpression();

    EqualityExpression predicate2 = pf.createEqualityExpression();
    predicate2.setLeftExpr(createNameOrReference("name"));
    predicate2.setOpName("!=");
    predicate2.setRightExpr(createNameOrReference("Darth"));
    EqualityExpression predicate3 = pf.createEqualityExpression();
    predicate3.setLeftExpr(createNameOrReference("name"));
    predicate3.setOpName("!=");
    predicate3.setRightExpr(createNameOrReference("Vader"));

    or.setLeftExpr(predicate2);
    or.setRightExpr(predicate3);
    ParenthesisedExpression pe = pf.createParenthesisedExpression();
    pe.setExpr(or);
    and.setRightExpr(pe);
    eq.setExpr(and);
    tester.validator().checkCollectExpression(ce);
    tester.diagnose().assertOK();

  }
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.pp.ExportedCollectQuery

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.