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));
}
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()));
}
Aggregations