Package com.puppetlabs.geppetto.pp

Examples of com.puppetlabs.geppetto.pp.MatchingExpression


        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.MATCHING_EXPRESSION: {
        MatchingExpression matchingExpression = (MatchingExpression) theEObject;
        T result = caseMatchingExpression(matchingExpression);
        if(result == null)
          result = caseBinaryOpExpression(matchingExpression);
        if(result == null)
          result = caseBinaryExpression(matchingExpression);
View Full Code Here


  }

  @Test
  public void test_Serialize_MatchingExpression() {
    PuppetManifest pp = pf.createPuppetManifest();
    MatchingExpression me = pf.createMatchingExpression();
    LiteralRegex regex = pf.createLiteralRegex();
    regex.setValue("/[a-z]*/");
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    me.setLeftExpr(v);
    me.setOpName("=~");
    me.setRightExpr(regex);
    pp.getStatements().add(me);

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

    me.setOpName("!~");
    s = serializeFormatted(pp);
    assertEquals("serialization should produce specified result", Sample_Match2, s);
  }
View Full Code Here

  }

  @Test
  public void test_Validate_MatchingExpression_NotOk() {
    PuppetManifest pp = pf.createPuppetManifest();
    MatchingExpression me = pf.createMatchingExpression();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    VariableExpression v2 = pf.createVariableExpression();
    v2.setVarName("$y");

    me.setLeftExpr(v);
    me.setOpName("=~");
    me.setRightExpr(v2);
    pp.getStatements().add(me);

    tester.validate(me).assertError(IPPDiagnostics.ISSUE__UNSUPPORTED_EXPRESSION);

    me.setOpName("~=");
    tester.validate(me).assertAll(
      AssertableDiagnostics.errorCode(IPPDiagnostics.ISSUE__ILLEGAL_OP),
      AssertableDiagnostics.errorCode(IPPDiagnostics.ISSUE__UNSUPPORTED_EXPRESSION));
  }
View Full Code Here

  }

  @Test
  public void test_Validate_MatchingExpression_Ok() {
    PuppetManifest pp = pf.createPuppetManifest();
    MatchingExpression me = pf.createMatchingExpression();
    LiteralRegex regex = pf.createLiteralRegex();
    regex.setValue("/[a-z]*/");
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    me.setLeftExpr(v);
    me.setOpName("=~");
    me.setRightExpr(regex);
    pp.getStatements().add(me);

    tester.validate(me).assertOK();

    me.setOpName("!~");
    tester.validate(me).assertOK();
  }
View Full Code Here

TOP

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

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.