Package com.puppetlabs.geppetto.pp

Examples of com.puppetlabs.geppetto.pp.ResourceExpression


    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();
    assertEquals("Literal should be same as input", "File", name.getValue());

  }
View Full Code Here


    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");
    ResourceExpression r3 = createResourceExpression("file", "file3");

    rel1.setOpName("->");
    rel1.setLeftExpr(r1);
    rel1.setRightExpr(r2);
    rel2.setOpName("->");
View Full Code Here

    PuppetManifest pp = pf.createPuppetManifest();
    // -- check file { 'file1': } -> file{'file2': } -> file{'file3' : }
    RelationshipExpression rel1 = pf.createRelationshipExpression();
    pp.getStatements().add(rel1);

    ResourceExpression r1 = createResourceExpression("file", "file1");
    LiteralNameOrReference r2 = createNameOrReference("a");

    rel1.setOpName("->");
    rel1.setLeftExpr(r1);
    rel1.setRightExpr(r2);
View Full Code Here

    PuppetManifest pp = pf.createPuppetManifest();
    // -- check file { 'file1': } -> file{'file2': } -> file{'file3' : }
    RelationshipExpression rel1 = pf.createRelationshipExpression();
    RelationshipExpression rel2 = pf.createRelationshipExpression();
    pp.getStatements().add(rel2);
    ResourceExpression r1 = createResourceExpression("file", "'file1'");
    ResourceExpression r2 = createResourceExpression("file", "'file2'");
    ResourceExpression r3 = createResourceExpression("file", "'file3'");

    rel1.setOpName("->");
    rel1.setLeftExpr(r1);
    rel1.setRightExpr(r2);
    rel2.setOpName("->");
View Full Code Here

  }

  protected ResourceExpression createResourceExpression(boolean exported, boolean virtual, boolean additive,
      String type, Expression title, Object... keyValPairs) {

    ResourceExpression re = pf.createResourceExpression();

    Expression resourceExpr = null;
    if(virtual) {
      VirtualNameOrReference resourceName = pf.createVirtualNameOrReference();
      resourceName.setValue(type);
      resourceName.setExported(exported);
      resourceExpr = resourceName;

    }
    else {
      LiteralNameOrReference resourceName = pf.createLiteralNameOrReference();
      resourceName.setValue(type);
      resourceExpr = resourceName;
    }
    re.setResourceExpr(resourceExpr);

    re.getResourceData().add(createResourceBody(additive, title, keyValPairs));
    return re;
  }
View Full Code Here

TOP

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

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.