Package mykeynote.junit

Source Code of mykeynote.junit.ConfigurationTest

package mykeynote.junit;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

import junit.framework.TestCase;
import mykeynote.exceptions.configuration.ConfigurationUnacceptableValue;
import mykeynote.exceptions.configuration.MissingConfigOptionException;
import mykeynote.exceptions.configuration.UniqueFileException;
import mykeynote.exceptions.report.ReportFileCreationException;
import mykeynote.exceptions.report.ReportNotInitializedException;
import mykeynote.server.configuration.Configuration;

public class ConfigurationTest  extends TestCase{
  private File configuration = null;
  private Configuration config = null;
 
  public void setUp() {
    configuration = new File("etc/mykeynote/MyKeyNote.conf.example");
    try {
      config = new Configuration(configuration, true);
      config.readConfigFile();
    } catch (FileNotFoundException e) {
      assertNull(e);
    } catch (IOException e) {
      assertNull(e);
    } catch (MissingConfigOptionException e) {
      assertNull(e);
    } catch (ReportFileCreationException e) {
      assertNull(e);
    } catch (ConfigurationUnacceptableValue e) {
      assertNull(e);
    } catch (UniqueFileException e) {
      assertNull(e);
    }
  }
 
  public void testConfiguration(){
    assertEquals(1000, config.getMaxAllowedConnectedClients());
    assertTrue("Non persistent server is per default allowed",config.getAcceptNP());
    assertTrue("Debug logging is per default allowed",config.getDebugLog());
    assertEquals(100, config.getMaxAllowedConnectedPC());
    assertEquals(100, config.getSolingertimeout());
    try {
      System.out.println(config.getReport().getFileDebugLogFile().getAbsolutePath());
    } catch (ReportNotInitializedException e) {
      assertNull(e);
    }
  }
 
  public void tearDown() {
    try {
      config.finalizeConfiguration();
    } catch (IOException e) {
      assertNull(e);
    }
  }
}
TOP

Related Classes of mykeynote.junit.ConfigurationTest

TOP
Copyright © 2018 www.massapi.com. 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.