Examples of PuppetManifest


Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  // assertEquals("serialization should produce same result as input", code, s);
  // }

  @Test
  public void test_Serialize_AssignmentExpression() {
    PuppetManifest pp = pf.createPuppetManifest();
    AssignmentExpression ae = pf.createAssignmentExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    b.setValue(true);
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

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

    AtExpression at = pf.createAtExpression();
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  }

  @Test
  public void test_Serialize_HostClassExpression() {
    PuppetManifest pp = pf.createPuppetManifest();
    HostClassDefinition cd = pf.createHostClassDefinition();
    pp.getStatements().add(cd);
    cd.setClassName("testClass");

    String s = serializeFormatted(pp);
    assertEquals("serialization should produce specified result", Sample_ClassDefinition, s);
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

    assertEquals("serialization should produce specified result", code, s);
  }

  @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("!~");
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  }

  @Test
  public void test_Serialize_RelationshipExpression() {
    // -- serialize file { 'file1': } -> file{'file2': } -> file{'file3' : }
    PuppetManifest pp = pf.createPuppetManifest();
    EList<Expression> statements = pp.getStatements();

    RelationshipExpression rel1 = pf.createRelationshipExpression();
    RelationshipExpression rel2 = pf.createRelationshipExpression();
    ResourceExpression r1 = createResourceExpression("file", "file1");
    ResourceExpression r2 = createResourceExpression("file", "file2");
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

   * - $x[a] += expr
   * - a += expr
   */
  @Test
  public void test_Validate_AppendExpression_NotOk() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    pp.getStatements().add(ae);

    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    AtExpression at = pf.createAtExpression();
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

   * Tests append Notok states:
   * - $0 += expr
   */
  @Test
  public void test_Validate_AppendExpression_NotOk_Decimal() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$0");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__ASSIGNMENT_DECIMAL_VAR);

  }
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

   * Tests append Notok states:
   * - $a::b += expr
   */
  @Test
  public void test_Validate_AppendExpression_NotOk_Scope() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$a::b");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__ASSIGNMENT_OTHER_NAMESPACE);

  }
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

   * Tests append ok states:
   * - $x += expr
   */
  @Test
  public void test_Validate_AppendExpression_Ok() {
    PuppetManifest pp = pf.createPuppetManifest();
    AppendExpression ae = pf.createAppendExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$x");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertOK();
  }
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

    tester.validate(pp).assertOK();
  }

  @Test
  public void test_Validate_AssignmentExpression_NotOk() {
    PuppetManifest pp = pf.createPuppetManifest();
    AssignmentExpression ae = pf.createAssignmentExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    LiteralNameOrReference v = createNameOrReference("x");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__NOT_ASSIGNABLE);

  }
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

   * Tests assignment not ok states:
   * - $0 = expr
   */
  @Test
  public void test_Validate_AssignmentExpression_NotOk_Decimal() {
    PuppetManifest pp = pf.createPuppetManifest();
    AssignmentExpression ae = pf.createAssignmentExpression();
    LiteralBoolean b = pf.createLiteralBoolean();
    VariableExpression v = pf.createVariableExpression();
    v.setVarName("$0");
    ae.setLeftExpr(v);
    ae.setRightExpr(b);
    pp.getStatements().add(ae);

    tester.validate(pp).assertError(IPPDiagnostics.ISSUE__ASSIGNMENT_DECIMAL_VAR);
  }
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.