Examples of PPTypeInfo


Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

          break;
        default:
          break;
      }
    }
    PPTypeInfo typeInfo = new PPTypeInfo(typeName, typeDocumentation, propertyMap, parameterMap);
    return typeInfo;
  }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

          break;
        default:
          break;
      }
    }
    PPTypeInfo typeInfo = new PPTypeInfo(typeName, typeDocumentation, propertyMap, parameterMap);
    return typeInfo;
  }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

          }

        }
      }
    }
    return new PPTypeInfo("Type", "", null, parameterMap);

  }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

          // should have at least one argument, the (raw) name of the
          // type
          String typeName = getFirstArg(newTypeCall);
          if(typeName != null) { // just in case there is something
                      // really wrong in parsing
            PPTypeInfo typeInfo = createNagiosTypeInfo(safeGetBodyNode(newTypeCall), "nagios_" + typeName);
            if(typeInfo != null)
              result.add(typeInfo);
          }
        }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

            String typeName = getFirstArg(typeCall);
            if(typeName == null)
              continue;
            Map<String, PPTypeInfo.Entry> propertyMap = Maps.newHashMap();
            propertyMap.put(getFirstArg(callNode), getEntry(callNode));
            result.add(new PPTypeInfo(typeName, "", propertyMap, null));
            continue;
          }
          if(NEWPARAM.equals(callNode.getName())) {
            CallNode typeCall = opCallVisitor.findOpCall(callNode.getReceiver(), "type", "Puppet", "Type");
            if(typeCall == null)
              continue;
            String typeName = getFirstArg(typeCall);
            if(typeName == null)
              continue;
            Map<String, PPTypeInfo.Entry> parameterMap = Maps.newHashMap();
            parameterMap.put(getFirstArg(callNode), getEntry(callNode));
            result.add(new PPTypeInfo(typeName, "", null, parameterMap));
            continue;
          }
          if(NEWCHECK.equals(callNode.getName())) {
            CallNode typeCall = opCallVisitor.findOpCall(callNode.getReceiver(), "type", "Puppet", "Type");
            if(typeCall == null)
              continue;
            String typeName = getFirstArg(typeCall);
            if(typeName == null)
              continue;
            Map<String, PPTypeInfo.Entry> parameterMap = Maps.newHashMap();
            parameterMap.put(getFirstArg(callNode), getEntry(callNode));
            result.add(new PPTypeInfo(typeName, "", null, parameterMap));
          }
          // NOTE: this does probably never occur
          if(ENSURABLE.equals(callNode.getName())) {
            CallNode typeCall = opCallVisitor.findOpCall(callNode.getReceiver(), "type", "Puppet", "Type");
            if(typeCall == null)
              continue;
            String typeName = getFirstArg(typeCall);
            if(typeName == null)
              continue;
            Map<String, PPTypeInfo.Entry> parameterMap = Maps.newHashMap();
            parameterMap.put("ensure", getEntry(callNode));
            result.add(new PPTypeInfo(typeName, "", parameterMap, null));

          }
        }
      }
    }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

          }
        }
          break;

        case META: {
          PPTypeInfo info = helper.getMetaTypeInfo(uri.path(), new InputStreamReader(inputStream));

          MetaType type = PPTPFactory.eINSTANCE.createMetaType();
          type.setName(info.getTypeName());
          type.setDocumentation(info.getDocumentation());
          for(Map.Entry<String, PPTypeInfo.Entry> entry : info.getParameters().entrySet()) {
            Parameter parameter = PPTPFactory.eINSTANCE.createParameter();
            parameter.setName(entry.getKey());
            parameter.setDocumentation(entry.getValue().documentation);
            parameter.setRequired(entry.getValue().isRequired());
            type.getParameters().add(parameter);
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

  protected PPTypeInfo getMetaTypeProperties(Result result) throws IOException, RubySyntaxException {
    if(result.hasErrors())
      throw new RubySyntaxException(result.getIssues());
    PPTypeFinder typeFinder = new PPTypeFinder();
    PPTypeInfo typeInfo = typeFinder.findMetaTypeInfo(result.getAST());
    return typeInfo;
  }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

    if(nagiosLoad)
      return typeFinder.findNagiosTypeInfo(result.getAST());

    List<PPTypeInfo> types = Lists.newArrayList();
    PPTypeInfo typeInfo = typeFinder.findTypeInfo(result.getAST());
    if(typeInfo != null)
      types.add(typeInfo);
    return types;
  }
View Full Code Here

Examples of com.puppetlabs.geppetto.ruby.PPTypeInfo

    RubyHelper helper = new RubyHelper();
    helper.setUp();
    try {
      List<PPTypeInfo> foundTypes = helper.getTypeInfo(aRubyFile);
      assertEquals("Should have found one function", 1, foundTypes.size());
      PPTypeInfo info = foundTypes.get(0);
      assertEquals("Should have found 'thing'", "thing", info.getTypeName());
      assertEquals("Should have found one parameter", 2, info.getParameters().size());
      assertEquals("Should have found two properties", 2, info.getProperties().size());

      PPTypeInfo.Entry nameEntry = info.getParameters().get("name");
      assertNotNull("Should have found a parameter called 'name'", nameEntry);
      assertEquals(
        "Should have found a description of 'name'", "<p>Description of name</p>", nameEntry.getDocumentation());

      // TODO: check "ensure"
      PPTypeInfo.Entry weightEntry = info.getProperties().get("weight");
      assertNotNull("Should have found a property called 'weight'", weightEntry);
      assertEquals(
        "Should have found a description of 'weight'", "<p>Description of weight</p>",
        weightEntry.getDocumentation());

      PPTypeInfo.Entry emptyEntry = info.getProperties().get("empty");
      assertNotNull("Should have found a property called 'weight'", emptyEntry);
      assertEquals("Should have found a missing description of 'empty'", "", emptyEntry.getDocumentation());

    }
    finally {
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.