public static void main(String args[]) throws Exception {
    // cache the initial set of loggers before this test begins
    // to add any loggers
    Enumeration<String> e = logMgr.getLoggerNames();
    List<String> defaultLoggers = getDefaultLoggerNames();
    while (e.hasMoreElements()) {
      String logger = e.nextElement();
      if (!defaultLoggers.contains(logger)) {
        initialLoggerNames.add(logger);
      }
    }
    ;

    String tstSrc = System.getProperty(TST_SRC_PROP);
    File fname = new File(tstSrc, LM_PROP_FNAME);
    String prop = fname.getCanonicalPath();
    System.setProperty(CFG_FILE_PROP, prop);
    logMgr.readConfiguration();

    System.out.println();
    if (checkLoggers() == PASSED) {
      System.out.println(MSG_PASSED);
    } else {
      System.out.println(MSG_FAILED);
      throw new Exception(MSG_FAILED);
    }
  }
Esempio n. 2
0
 private void maybeInitConfigFile() throws RuntimeConfigException {
   String configFilePath = getProperty(configFileKey);
   if (!isNullOrEmptyString(configFilePath)) {
     File configFile = new File(configFilePath);
     // ok set: must be an existing file
     if (!configFile.isFile()) {
       throw createInvalidPropertyValueException(configFileKey, configFile.getPath());
     }
     try {
       this.configFilePath = configFile.getCanonicalPath();
     } catch (IOException e) {
       throw new RuntimeConfigException(e.getMessage(), e);
     }
   }
 }
Esempio n. 3
0
 private void maybeInitHomeDir() throws RuntimeConfigException {
   String homeDirPath = getProperty(homeDirKey);
   if (!isNullOrEmptyString(homeDirPath)) {
     // ok set: must be an existing directory
     File homeDir = new File(homeDirPath);
     if (!homeDir.isDirectory()) {
       throw createInvalidPropertyValueException(homeDirKey, homeDirPath);
     }
     try {
       this.homeDirPath = homeDir.getCanonicalPath();
     } catch (IOException e) {
       throw new RuntimeConfigException(e.getMessage(), e);
     }
   }
 }