Package com.puppetlabs.geppetto.validation.runner

Examples of com.puppetlabs.geppetto.validation.runner.AllModuleReferences


      // builder.append("Diagnostic: Ambiguous reference to: 'snmp::files' \n");

      assertEquals("There should be the expected errors", builder.toString(), errorsToString(chain));

      // Get the exports for nodes
      AllModuleReferences allModuleReferences = br.getAllModuleReferences();

      // Get the map with exports for nodes
      Multimap<String, String> restricted = allModuleReferences.getRestricted();
      int count = 0;
      int numberOfClasses = 0;
      assertEquals("There should be one node", 1, Iterables.size(restricted.keySet()));
      int parameterCount = 0;

      for(String f : restricted.keySet()) {
        count++;
        assertEquals("There should be only 1 restricted container (a node)", 1, count);

        numberOfClasses = Iterables.size(allModuleReferences.getClasses(allModuleReferences.getVisibleExports(new File(
          f))));
        assertEquals("There should be 47 exported classes", 47, numberOfClasses);

        // dumpExports(allModuleReferences.getVisibleExports(new
        // File(f)));

        // API2
        List<AllModuleReferences.ClassDescription> classes = allModuleReferences.getClassDescriptions(allModuleReferences.getVisibleExports(new File(
          f)));
        numberOfClasses = classes.size();
        assertEquals("There should be 47 exported classes", 47, numberOfClasses);

        boolean apacheFound = false;
View Full Code Here


      // builder.append("Diagnostic: Ambiguous reference to: 'snmp::files' \n");

      assertEquals("There should be the expected errors", builder.toString(), errorsToString(chain));

      // Get the exports for nodes
      AllModuleReferences allModuleReferences = br.getAllModuleReferences();

      // Get the map with exports for nodes
      Multimap<String, String> restricted = allModuleReferences.getRestricted();
      int count = 0;
      int numberOfClasses = 0;
      assertEquals("There should be one node", 1, Iterables.size(restricted.keySet()));
      int parameterCount = 0;

      for(String f : restricted.keySet()) {
        count++;
        assertEquals("There should be only 1 restricted container (a node)", 1, count);

        numberOfClasses = Iterables.size(allModuleReferences.getClasses(allModuleReferences.getVisibleExports(new File(
          f))));
        assertEquals("There should be 47 exported classes", 47, numberOfClasses);

        // dumpExports(allModuleReferences.getVisibleExports(new
        // File(f)));

        // API2
        List<AllModuleReferences.ClassDescription> classes = allModuleReferences.getClassDescriptions(allModuleReferences.getVisibleExports(new File(
          f)));
        numberOfClasses = classes.size();
        assertEquals("There should be 47 exported classes", 47, numberOfClasses);

        boolean apacheFound = false;
View Full Code Here

      // StringBuilder builder = new StringBuilder();

      assertEquals("There should be the expected errors", "", errorsToString(chain));

      // Get the exports for nodes
      AllModuleReferences allModuleReferences = br.getAllModuleReferences();

      // Get the map with exports for nodes
      Multimap<String, String> restricted = allModuleReferences.getRestricted();
      int count = 0;
      int numberOfClasses = 0;
      assertEquals("There should be one node", 1, Iterables.size(restricted.keySet()));
      int parameterCount = 0;

      for(String f : restricted.keySet()) {
        count++;
        assertEquals("There should be only 1 restricted container (a node)", 1, count);

        numberOfClasses = Iterables.size(allModuleReferences.getClasses(allModuleReferences.getVisibleExports(new File(
          f))));
        assertEquals("There should be 47 exported classes", 47, numberOfClasses);

        // dumpExports(allModuleReferences.getVisibleExports(new
        // File(f)));

        // API2
        List<AllModuleReferences.ClassDescription> classes = allModuleReferences.getClassDescriptions(allModuleReferences.getVisibleExports(new File(
          f)));
        numberOfClasses = classes.size();
        assertEquals("There should be 47 exported classes", 47, numberOfClasses);

        boolean apacheFound = false;
View Full Code Here

  public void produceGraph(ICancel cancel, String title, File[] roots, OutputStream output, BuildResult buildResult,
      Diagnostic chain) {
    if(title == null)
      title = "Module Dependencies";

    AllModuleReferences all = buildResult.getAllModuleReferences();
    produceGraph(cancel, title, roots, output, all.getRoot(), buildResult.getModuleData(), all, chain);
  }
View Full Code Here

    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));

    // Without constraint that only things on path are validated - there should be two redefinition errors
    //
    assertEquals("There should be no errors", 0, countErrors(chain));
    AllModuleReferences exports = buildResult.getAllModuleReferences();
    // dumpExports(exports);

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/production/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
    assertNotNull("Should have found exported 'aclass'", exporteda);
    Export exportedb = exports.findExportedClass("bclass", visibleExports);
    assertNotNull("Should have found exported 'bclass'", exportedb);
    Export exportedc = exports.findExportedClass("cclass", visibleExports);
    assertNull("Should not have found exported 'cclass'", exportedc);

    Iterable<String> paramsForA = exports.getParameterNames(exporteda, visibleExports);
    assertTrue("Should contain 'aparam'", Iterables.contains(paramsForA, "aparam"));
    assertEquals("Should have one parameter", 1, Iterables.size(paramsForA));

    // Test new API as well
    List<AllModuleReferences.ClassDescription> classes = exports.getClassDescriptions(visibleExports);
    Map<String, ClassDescription> classMap = Maps.newHashMap();
    for(ClassDescription cd : classes)
      classMap.put(cd.getExportedClass().getName(), cd);
    assertTrue("Should contain 'aclass'", classMap.containsKey("aclass"));
    assertTrue("Should contain 'bclass'", classMap.containsKey("bclass"));
View Full Code Here

    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    AllModuleReferences exports = buildResult.getAllModuleReferences();

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
    assertNotNull("Should have found exported 'aclass'", exporteda);
    Export exportedb = exports.findExportedClass("b::bclass", visibleExports);
    assertNotNull("Should have found exported 'bclass'", exportedb);
    Export exportedx = exports.findExportedClass("xclass", visibleExports);
    assertNotNull("Should have found exported 'xclass'", exportedx);
    Export exportedc = exports.findExportedClass("cclass", visibleExports);
    assertNull("Should not have found exported 'cclass'", exportedc);

    Iterable<String> paramsForA = exports.getParameterNames(exporteda, visibleExports);
    assertTrue("Should contain 'aparam'", Iterables.contains(paramsForA, "aparam"));
    assertEquals("Should have one parameter", 1, Iterables.size(paramsForA));

    DiagnosticsAsserter asserter = new DiagnosticsAsserter(chain);
    asserter.assertErrors(
View Full Code Here

    options.setCheckLayout(true);
    options.setCheckModuleSemantics(true);
    options.setCheckReferences(true);
    options.setFileType(FileType.PUPPET_ROOT);
    BuildResult buildResult = vs.validate(chain, root, options, null, SubMonitor.convert(null));
    AllModuleReferences exports = buildResult.getAllModuleReferences();
    // dumpExports(exports);

    Iterable<Export> visibleExports = exports.getVisibleExports(new File("roles/X"));
    Export exporteda = exports.findExportedClass("aclass", visibleExports);
    assertNotNull("Should have found exported 'aclass'", exporteda);
    Export exportedb = exports.findExportedClass("bclass", visibleExports);
    assertNotNull("Should have found exported 'bclass'", exportedb);
    Export exportedc = exports.findExportedClass("cclass", visibleExports);
    assertNull("Should not have found exported 'cclass'", exportedc);

    Iterable<String> paramsForA = exports.getParameterNames(exporteda, visibleExports);
    assertTrue("Should contain 'aparam'", Iterables.contains(paramsForA, "aparam"));
    assertEquals("Should have one parameter", 1, Iterables.size(paramsForA));

    // Test new API as well
    List<AllModuleReferences.ClassDescription> classes = exports.getClassDescriptions(visibleExports);
    Map<String, ClassDescription> classMap = Maps.newHashMap();
    for(ClassDescription cd : classes)
      classMap.put(cd.getExportedClass().getName(), cd);
    assertTrue("Should contain 'aclass'", classMap.containsKey("aclass"));
    assertTrue("Should contain 'bclass'", classMap.containsKey("bclass"));
View Full Code Here

    // return false;
    // p = p.removeLastSegments(2);
    // return NAME_OF_DIR_WITH_RESTRICTED_SCOPE.equals(p.lastSegment());
    // }
    // });
    AllModuleReferences all = ppRunner.getAllModulesState();

    // set the root to allow relative lookup of module exports
    all.setRoot(root);

    // // Debug stuff...
    // for(File f : result.getMap().keySet()) {
    // System.err.println("Exports for file: " + f.toString());
    // for(ExportsPerModule.Export export : result.getMap().get(f)) {
View Full Code Here

TOP

Related Classes of com.puppetlabs.geppetto.validation.runner.AllModuleReferences

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.