private boolean visitFile(JsonSchema schema, File file, boolean previousResult) throws Exception {

    if (file.isDirectory()) {
      boolean currentResult = true;

      File[] files = file.listFiles();
      if (files != null) {
        for (File currentFile : files) {
          currentResult = visitFile(schema, currentFile, previousResult) && currentResult;
        }
      }
      return previousResult && currentResult;
    } else if (file.isFile()) {
      if (PATTERN_KERBEROS_DESCRIPTOR_FILENAME.matcher(file.getName()).matches()) {
        LOG.info("Validating " + file.getAbsolutePath());

        JsonNode node = getJsonNodeFromUrl(file.toURI().toURL().toExternalForm());
        Set<ValidationMessage> errors = schema.validate(node);

        if ((errors != null) && !errors.isEmpty()) {
          for (ValidationMessage message : errors) {
            LOG.error(message.getMessage());
          }

          return false;
        }

        return true;
      } else {
        return true;
      }
    }

    return previousResult;
  }
KerberosDescriptorTest tests the stack- and service-level descriptors for certain stacks
and services
ambari-server/src/test/java/org/apache/ambari/server/stack/KerberosDescriptorTest.java