Search in sources :

Example 31 with PmsConfiguration

use of net.pms.configuration.PmsConfiguration in project UniversalMediaServer by UniversalMediaServer.

the class UMSUtilsTest method setUp.

/**
 * Set up testing conditions before running the tests.
 * @throws ConfigurationException
 */
@Before
public final void setUp() throws ConfigurationException {
    // Silence all log messages from the PMS code that is being tested
    LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
    context.getLogger(Logger.ROOT_LOGGER_NAME).setLevel(Level.OFF);
    PMS.get();
    PMS.setConfiguration(new PmsConfiguration(false));
}
Also used : PmsConfiguration(net.pms.configuration.PmsConfiguration) LoggerContext(ch.qos.logback.classic.LoggerContext) Before(org.junit.Before)

Example 32 with PmsConfiguration

use of net.pms.configuration.PmsConfiguration in project UniversalMediaServer by UniversalMediaServer.

the class LoggingTest method testDebugLogPropertyDefiner.

/**
 * Test
 */
@Test
public void testDebugLogPropertyDefiner() throws ConfigurationException {
    // Set up PMS configuration
    PMS.get();
    PMS.setConfiguration(new PmsConfiguration());
    DebugLogPropertyDefiner propertyDefiner = new DebugLogPropertyDefiner();
    // Test logFilePath
    propertyDefiner.setKey("logFilePath");
    File file = new File(propertyDefiner.getPropertyValue());
    assertTrue("logFilePathIsDirectory", file.isDirectory());
    assertFalse("logFilePathIsNotFile", file.isFile());
    // Test rootLevel
    propertyDefiner.setKey("rootLevel");
    assertNotNull("ValidLevel", Level.toLevel(propertyDefiner.getPropertyValue(), null));
    // Test logFileName
    propertyDefiner.setKey("logFileName");
    assertTrue("ValidLogFileName", FileUtil.isValidFileName(propertyDefiner.getPropertyValue()));
}
Also used : PmsConfiguration(net.pms.configuration.PmsConfiguration) File(java.io.File) Test(org.junit.Test)

Aggregations

PmsConfiguration (net.pms.configuration.PmsConfiguration)32 File (java.io.File)7 ProcessWrapperImpl (net.pms.io.ProcessWrapperImpl)7 ArrayList (java.util.ArrayList)6 OutputParams (net.pms.io.OutputParams)5 IOException (java.io.IOException)4 ProcessWrapper (net.pms.io.ProcessWrapper)4 LoggerContext (ch.qos.logback.classic.LoggerContext)3 SyslogAppender (ch.qos.logback.classic.net.SyslogAppender)3 ILoggingEvent (ch.qos.logback.classic.spi.ILoggingEvent)3 Appender (ch.qos.logback.core.Appender)3 ConsoleAppender (ch.qos.logback.core.ConsoleAppender)3 FileAppender (ch.qos.logback.core.FileAppender)3 OutputStreamAppender (ch.qos.logback.core.OutputStreamAppender)3 RendererConfiguration (net.pms.configuration.RendererConfiguration)3 PipeProcess (net.pms.io.PipeProcess)3 ThresholdFilter (ch.qos.logback.classic.filter.ThresholdFilter)2 PrintWriter (java.io.PrintWriter)2 StringTokenizer (java.util.StringTokenizer)2 DLNAMediaAudio (net.pms.dlna.DLNAMediaAudio)2