Package com.puppetlabs.geppetto.pp

Examples of com.puppetlabs.geppetto.pp.LiteralList


        if(result == null)
          result = defaultCase(theEObject);
        return result;
      }
      case PPPackage.LITERAL_LIST: {
        LiteralList literalList = (LiteralList) theEObject;
        T result = caseLiteralList(literalList);
        if(result == null)
          result = caseLiteralExpression(literalList);
        if(result == null)
          result = caseExpression(literalList);
View Full Code Here


  public void test_Serialize_assignArray() throws Exception {
    PuppetManifest pp = pf.createPuppetManifest();
    EList<Expression> statements = pp.getStatements();
    AssignmentExpression assignment = PPFactory.eINSTANCE.createAssignmentExpression();
    assignment.setLeftExpr(createVariable("a"));
    LiteralList pplist = PPFactory.eINSTANCE.createLiteralList();
    assignment.setRightExpr(pplist);
    pplist.getElements().add(createSqString("10"));
    pplist.getElements().add(createSqString("20"));
    statements.add(assignment);
    String fmt = "$a = ['10', '20',]\n";
    String s = serialize(pp);
    assertEquals("serialization should produce same result", fmt, s);
  }
View Full Code Here

      VariableExpression titleExpr = pf.createVariableExpression();
      titleExpr.setVarName("$test");
      subTestValidateExpressionTitles(titleExpr);
    }
    { // -- literal list
      LiteralList titleExpr = pf.createLiteralList();
      titleExpr.getElements().add(this.createNameOrReference("a"));
      titleExpr.getElements().add(this.createNameOrReference("b"));
      subTestValidateExpressionTitles(titleExpr);
    }
    { // -- hasharray access
      AtExpression titleExpr = pf.createAtExpression();
      titleExpr.setLeftExpr(createNameOrReference("Foo"));
      titleExpr.getParameters().add(createNameOrReference("a"));
      subTestValidateExpressionTitles(titleExpr);
    }
    { // -- selector
      SelectorExpression titleExpr = pf.createSelectorExpression();
      SelectorEntry entry = pf.createSelectorEntry();
      titleExpr.getParameters().add(entry);

      SingleQuotedString slhs = pf.createSingleQuotedString();
      slhs.setText("\'x\'");
      LiteralName entrylhs = pf.createLiteralName();
      entrylhs.setValue("a");

      titleExpr.setLeftExpr(slhs);
      entry.setLeftExpr(entrylhs);
      entry.setRightExpr(pf.createLiteralBoolean());
      subTestValidateExpressionTitles(titleExpr);
    }
  }
View Full Code Here

  @Test
  public void test_List_NoNodeModel() throws Exception {
    PuppetManifest pp = pf.createPuppetManifest();
    AssignmentExpression assignment = PPFactory.eINSTANCE.createAssignmentExpression();
    assignment.setLeftExpr(createVariable("a"));
    LiteralList pplist = PPFactory.eINSTANCE.createLiteralList();
    assignment.setRightExpr(pplist);
    pplist.getElements().add(createSqString("10"));
    pplist.getElements().add(createSqString("20"));
    pp.getStatements().add(assignment);
    String fmt = "$a = ['10', '20',]\n";
    String s = serializeFormatted(pp);
    assertEquals("formatting should produce wanted result", fmt, s);
  }
View Full Code Here

  @Test
  public void test_Serialize_assignArray() throws Exception {
    PuppetManifest pp = pf.createPuppetManifest();
    AssignmentExpression assignment = PPFactory.eINSTANCE.createAssignmentExpression();
    assignment.setLeftExpr(createVariable("a"));
    LiteralList pplist = PPFactory.eINSTANCE.createLiteralList();
    assignment.setRightExpr(pplist);
    pplist.getElements().add(createSqString("10"));
    pplist.getElements().add(createSqString("20"));
    pp.getStatements().add(assignment);
    String fmt = "$a = [ '10' , '20' , ]";
    String s = serialize(pp);
    assertEquals("serialization should produce single spaced result", fmt, s);
View Full Code Here

TOP

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

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.