Examples of PuppetManifest


Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  }

  @Test
  public void test_Validate_VirtualResource_NotOk() {
    // -- Resource with a couple of attribute definitions
    PuppetManifest pp = pf.createPuppetManifest();
    EList<Expression> statements = pp.getStatements();
    ResourceExpression re = createVirtualResourceExpression(
      "File", NOTITLE, "owner", createValue("0777"), "group", createValue("0666"), "other", createValue("0555"));
    statements.add(re);
    tester.validator().checkResourceExpression(re);
    tester.diagnose().assertError(IPPDiagnostics.ISSUE__RESOURCE_NOT_VIRTUALIZEABLE);
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  }

  @Test
  public void test_Validate_VirtualResource_Ok() {
    // -- Resource with a couple of attribute definitions
    PuppetManifest pp = pf.createPuppetManifest();
    EList<Expression> statements = pp.getStatements();
    ResourceExpression re = createVirtualResourceExpression(
      "file", "a resource", "owner", createValue("0777"), "group", createValue("0666"), "other",
      createValue("0555"));
    statements.add(re);
    tester.validator().checkResourceExpression(re);
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

    tester.diagnose().assertOK();
  }

  @Test
  public void test_ValidateComplexName() {
    PuppetManifest pp = pf.createPuppetManifest();
    EList<Expression> statements = pp.getStatements();
    ResourceExpression re = createVirtualResourceExpression(
      "monitor::foo", "a resource", "owner", createValue("0777"), "group", createValue("0666"), "other",
      createValue("0555"));
    statements.add(re);
    tester.validator().checkResourceExpression(re);
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

    // just testing one
    { // -- literal string
      AdditiveExpression titleExpr = pf.createAdditiveExpression();
      titleExpr.setLeftExpr(createVariable("a"));
      titleExpr.setRightExpr(createVariable("b"));
      PuppetManifest pp = pf.createPuppetManifest();
      EList<Expression> statements = pp.getStatements();

      ResourceExpression re = createVirtualResourceExpression(
        "monitor::foo", titleExpr, "owner", createValue("0777"), "group", createValue("0666"), "other",
        createValue("0555"));
      statements.add(re);
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  // @fmtOn

  @Test
  public void test_Serialize_CollectExpr() {
    final PuppetManifest pp = pf.createPuppetManifest();
    final CollectExpression ce = pf.createCollectExpression();
    pp.getStatements().add(ce);

    ce.setClassReference(createNameOrReference("User"));
    EqualityExpression predicate = pf.createEqualityExpression();
    predicate.setLeftExpr(createNameOrReference("name"));
    predicate.setOpName("==");
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

  }

  @Test
  public void test_Validate_Collect_Ok() {
    final PuppetManifest pp = pf.createPuppetManifest();
    final CollectExpression ce = pf.createCollectExpression();
    pp.getStatements().add(ce);
    ce.setClassReference(createNameOrReference("User"));
    EqualityExpression predicate = pf.createEqualityExpression();
    predicate.setLeftExpr(createNameOrReference("name"));
    predicate.setOpName("==");
    predicate.setRightExpr(createNameOrReference("Luke"));
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

      IParseResult result = parser.parse(ga.getPuppetManifestRule(), new StringReader(s));
      assertFalse("Should not have errors for: " + s, result.hasSyntaxErrors());
      assertEquals("parsed should be same as input", s, result.getRootNode().getText());
      EObject root = result.getRootASTElement();
      assertTrue("Should be PuppetManifest", root instanceof PuppetManifest);
      PuppetManifest pm = (PuppetManifest) root;
      assertTrue("Manifest should have statements", pm.getStatements().size() > 0);
      EObject expr = pm.getStatements().get(0);
      // if("class".equals(s)) {
      // assertTrue("Should be ResourceExpression", expr instanceof ResourceExpression);
      // }
      // else {
      assertTrue("Should be LiteralNameOrReference", expr instanceof LiteralNameOrReference);
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

    IParseResult result = parser.parse(ga.getPuppetManifestRule(), new StringReader(s));
    assertFalse("Should not have errors for: " + s, result.hasSyntaxErrors());
    assertEquals("parsed should be same as input", s, result.getRootNode().getText());
    EObject root = result.getRootASTElement();
    assertTrue("Should be PuppetManifest", root instanceof PuppetManifest);
    PuppetManifest pm = (PuppetManifest) root;
    assertTrue("Manifest should have statements", pm.getStatements().size() > 0);
    EObject expr = pm.getStatements().get(0);
    assertInstanceOf("Should be ResourceExpression", ResourceExpression.class, expr);
    ResourceExpression resourceExpression = (ResourceExpression) expr;
    assertInstanceOf(
      "Should be LiteralNameOrReference", LiteralNameOrReference.class, resourceExpression.getResourceExpr());
    LiteralNameOrReference name = (LiteralNameOrReference) resourceExpression.getResourceExpr();
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

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

  @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(
View Full Code Here

Examples of com.puppetlabs.geppetto.pp.PuppetManifest

      AssertableDiagnostics.errorCode(IPPDiagnostics.ISSUE__UNSUPPORTED_EXPRESSION));
  }

  @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
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.