Esempio n. 1
0
 public void registerFileConfiguration(String file) {
   File configFile = new File(sdl.getStoragePath(), file + ".yml");
   checkFile(configFile);
   FileConfiguration fileConfiguration = new FileConfiguration(sdl, configFile);
   fileConfiguration.load();
   configs.put(file, fileConfiguration);
 }
  @org.junit.Test
  public void testGetMissingProperty() {
    FileConfiguration config = new FileConfiguration();

    String val = config.getProperty("test.missing.property");

    if (val != null) {
      fail("'test.missing.property' should not be found");
    }
  }
Esempio n. 3
0
 public void saveYaml(String fileConfiguration) {
   try {
     if (configs.containsKey(fileConfiguration) && !brokenFiles.contains(fileConfiguration)) {
       FileConfiguration saveFile = configs.get(fileConfiguration);
       saveFile.save();
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  @org.junit.Test
  public void testGetProperty() {
    FileConfiguration config = new FileConfiguration();

    String val = config.getProperty("test.property");

    if (val == null) {
      fail("'test.property' not found");
    }

    if (val.equals("testvalue") == false) {
      fail("Unexpected value '" + val + "', expecting 'testvalue'");
    }
  }
Esempio n. 5
0
  private static Configuration resovleConfiguration(String key) {
    String confSource = sysConf.get(DEFAULT_PROPERTY);

    if (confSource.equalsIgnoreCase("FILE")) {
      return FileConfiguration.newInstance(key);
    }
    return null;
  }
  @Test
  public void hasFileConfiguration() throws Exception {
    final FileConfiguration file = config.getFileConfiguration();

    assertThat(file.isEnabled(), is(false));

    assertThat(file.getThreshold(), is(Level.ALL));

    assertThat(file.getCurrentLogFilename(), is("./logs/example.log"));

    assertThat(file.getArchivedLogFilenamePattern(), is("./logs/example-%d.log.gz"));

    assertThat(file.getArchivedFileCount(), is(5));
  }