private void validateTimezoneIds(String[] timezonesToCheck) throws Exception {
   ConfigAdapterImpl configAdapter = new ConfigAdapterImpl();
   ResourceLoader loader = Aura.getConfigAdapter().getResourceLoader();
   List<String> failures = Lists.newLinkedList();
   for (String timezone : timezonesToCheck) {
     String equivalent = configAdapter.getAvailableTimezone(timezone);
     if (loader.getResource(
             String.format("/aura/resources/libs_%s.js", equivalent.replace("/", "-")))
         == null) {
       failures.add(equivalent);
     }
   }
   if (!failures.isEmpty()) {
     Collections.sort(failures);
     fail(
         String.format(
             "The following timezone IDs failed to map to a valid resource (%s out of %s): %s",
             failures.size(), timezonesToCheck.length, failures));
   }
 }
Ejemplo n.º 2
0
  @SuppressWarnings("unchecked")
  public static synchronized void refreshSymbols() {
    Reader reader = null;
    try {
      try {

        reader = new InputStreamReader(resourceLoader.getResourceAsStream("jsdoc/symbolSet.json"));
        JsonStreamReader jsonReader = new JsonStreamReader(reader);
        jsonReader
            .disableLengthLimitsBecauseIAmStreamingAndMyMemoryUseIsNotProportionalToTheStreamLength();
        jsonReader.next();
        List<Object> readSymbols = jsonReader.getList();
        symbols = Maps.newTreeMap();
        List<Map<String, Object>> classes = new ArrayList<>();
        for (Object symbol : readSymbols) {
          Map<String, Object> map = (Map<String, Object>) symbol;
          if (!map.containsKey("access")) {
            map.put("access", "public");
          }
          if ("class".equalsIgnoreCase((String) map.get("kind"))) {
            classes.add(map);
            map.put("methods", new ArrayList<Map<String, Object>>());
            if (!map.containsKey("properties")) {
              map.put("properties", new ArrayList<Map<String, Object>>());
            }
          } else if ("function".equalsIgnoreCase((String) map.get("kind"))) {
            for (Map<String, Object> aClass : classes) {
              if (map.get("memberof") != null
                  && map.get("memberof").equals(aClass.get("longname"))) {
                ((List<Map<String, Object>>) aClass.get("methods")).add(map);
              }
            }
          } else if ("member".equalsIgnoreCase((String) map.get("kind"))
              && !map.containsKey("undocumented")
              && map.get("access").equals("public")) {
            for (Map<String, Object> aClass : classes) {
              if (map.get("memberof") != null
                  && map.get("memberof").equals(aClass.get("longname"))) {
                ((List<Map<String, Object>>) aClass.get("properties")).add(map);
              }
            }
          }
        }
        for (Object symbol : readSymbols) {
          Map<String, Object> map = (Map<String, Object>) symbol;
          List<Map<String, Object>> l = (List<Map<String, Object>>) map.get("methods");
          if (l != null) {
            Collections.sort(l, SYMBOL_COMPARATOR);
          }
          l = (List<Map<String, Object>>) map.get("properties");
          if (l != null) {
            Collections.sort(l, SYMBOL_COMPARATOR);
          }
          String name = (String) map.get("name");
          if (name != null && !map.containsKey("undocumented")) {
            symbols.put(name, map);
          }
        }
      } finally {
        if (reader != null) {
          reader.close();
        }
      }
    } catch (IOException e) {
      throw new AuraRuntimeException(e);
    }
  }