1 /* 2 * Copyright (C) The Spice Group. All rights reserved. 3 * 4 * This software is published under the terms of the Spice 5 * Software License version 1.1, a copy of which has been included 6 * with this distribution in the LICENSE.txt file. 7 */ 8 package org.codehaus.spice.loggerstore; 9 10 import org.jcontainer.dna.impl.ConsoleLogger; 11 12 /*** 13 * Test case for Configurator 14 * 15 * @author <a href="mailto:mauro.talevi at aquilonia.org">Mauro Talevi</a> 16 * @author Peter Donald 17 */ 18 public class ConfiguratorTestCase 19 extends AbstractTestCase 20 { 21 public ConfiguratorTestCase( final String name ) 22 { 23 super( name ); 24 } 25 26 public void testInvalidConfiguratorType() 27 throws Exception 28 { 29 try 30 { 31 Configurator.createLoggerStore( "blah", 32 "org/codehaus/spice/loggerstore/logging.properties" ); 33 fail( "Expected exception as invalid type specified" ); 34 } 35 catch( final Exception e ) 36 { 37 } 38 } 39 40 public void testLogKitExcaliburConfigurator() 41 throws Exception 42 { 43 runLoggerTest( "logkit-excalibur", Configurator.createLoggerStore( 44 Configurator.LOGKIT_EXCALIBUR, 45 "org/codehaus/spice/loggerstore/logkit-excalibur.xml" ), 46 ConsoleLogger.LEVEL_DEBUG ); 47 runLoggerTest( "logkit-excalibur", Configurator.createLoggerStore( 48 Configurator.LOGKIT_EXCALIBUR, 49 getResource( "logkit-excalibur.xml" ) ), 50 ConsoleLogger.LEVEL_DEBUG ); 51 } 52 53 public void testLogKitExcaliburConfiguratorNoDebug() 54 throws Exception 55 { 56 runLoggerTest( "logkit-excalibur", Configurator.createLoggerStore( 57 Configurator.LOGKIT_EXCALIBUR, 58 "org/codehaus/spice/loggerstore/logkit-excalibur.xml" ), 59 ConsoleLogger.LEVEL_NONE ); 60 runLoggerTest( "logkit-excalibur", Configurator.createLoggerStore( 61 Configurator.LOGKIT_EXCALIBUR, 62 getResource( "logkit-excalibur.xml" ) ), 63 ConsoleLogger.LEVEL_NONE ); 64 } 65 66 public void testLogKitExcaliburConfiguratorNoLog() 67 throws Exception 68 { 69 runLoggerTest( "logkit-excalibur", 70 Configurator.createLoggerStore( 71 Configurator.LOGKIT_EXCALIBUR, 72 "org/codehaus/spice/loggerstore/logkit-excalibur.xml" ) ); 73 runLoggerTest( "logkit-excalibur", 74 Configurator.createLoggerStore( 75 Configurator.LOGKIT_EXCALIBUR, 76 getResource( "logkit-excalibur.xml" ) ) ); 77 } 78 79 public void testLogKitSimpleConfigurator() 80 throws Exception 81 { 82 runLoggerTest( "logkit-simple", Configurator.createLoggerStore( 83 Configurator.LOGKIT_SIMPLE, 84 "org/codehaus/spice/loggerstore/logkit-simple.xml" ), 85 ConsoleLogger.LEVEL_DEBUG ); 86 runLoggerTest( "logkit-simple", Configurator.createLoggerStore( 87 Configurator.LOGKIT_SIMPLE, getResource( "logkit-simple.xml" ) ), 88 ConsoleLogger.LEVEL_DEBUG ); 89 } 90 91 public void testLogKitSimpleConfiguratorNoDebug() 92 throws Exception 93 { 94 runLoggerTest( "logkit-simple", Configurator.createLoggerStore( 95 Configurator.LOGKIT_SIMPLE, 96 "org/codehaus/spice/loggerstore/logkit-simple.xml" ), 97 ConsoleLogger.LEVEL_NONE ); 98 runLoggerTest( "logkit-simple", Configurator.createLoggerStore( 99 Configurator.LOGKIT_SIMPLE, getResource( "logkit-simple.xml" ) ), 100 ConsoleLogger.LEVEL_NONE ); 101 } 102 103 public void testLogKitSimpleConfiguratorNoLog() 104 throws Exception 105 { 106 runLoggerTest( "logkit-simple", 107 Configurator.createLoggerStore( 108 Configurator.LOGKIT_SIMPLE, 109 "org/codehaus/spice/loggerstore/logkit-simple.xml" ) ); 110 runLoggerTest( "logkit-simple", 111 Configurator.createLoggerStore( 112 Configurator.LOGKIT_SIMPLE, 113 getResource( "logkit-simple.xml" ) ) ); 114 } 115 116 public void testLog4JDOMConfigurator() 117 throws Exception 118 { 119 runLoggerTest( "log4j-xml", Configurator.createLoggerStore( 120 Configurator.LOG4J_DOM, 121 "org/codehaus/spice/loggerstore/log4j.xml" ), 122 ConsoleLogger.LEVEL_DEBUG ); 123 runLoggerTest( "log4j-xml", Configurator.createLoggerStore( 124 Configurator.LOG4J_DOM, getResource( "log4j.xml" ) ), 125 ConsoleLogger.LEVEL_DEBUG ); 126 } 127 128 public void testLog4JDOMConfiguratorNoDebug() 129 throws Exception 130 { 131 runLoggerTest( "log4j-xml", Configurator.createLoggerStore( 132 Configurator.LOG4J_DOM, 133 "org/codehaus/spice/loggerstore/log4j.xml" ), 134 ConsoleLogger.LEVEL_NONE ); 135 runLoggerTest( "log4j-xml", Configurator.createLoggerStore( 136 Configurator.LOG4J_DOM, getResource( "log4j.xml" ) ), 137 ConsoleLogger.LEVEL_NONE ); 138 } 139 140 public void testLog4JDOMConfiguratorNoLog() 141 throws Exception 142 { 143 runLoggerTest( "log4j-xml", 144 Configurator.createLoggerStore( Configurator.LOG4J_DOM, 145 "org/codehaus/spice/loggerstore/log4j.xml" ) ); 146 runLoggerTest( "log4j-xml", 147 Configurator.createLoggerStore( Configurator.LOG4J_DOM, 148 getResource( 149 "log4j.xml" ) ) ); 150 } 151 152 public void testLog4JPropertyConfigurator() 153 throws Exception 154 { 155 runLoggerTest( "log4j-properties", Configurator.createLoggerStore( 156 Configurator.LOG4J_PROPERTY, 157 "org/codehaus/spice/loggerstore/log4j.properties" ), 158 ConsoleLogger.LEVEL_DEBUG ); 159 runLoggerTest( "log4j-properties", Configurator.createLoggerStore( 160 Configurator.LOG4J_PROPERTY, getResource( "log4j.properties" ) ), 161 ConsoleLogger.LEVEL_DEBUG ); 162 } 163 164 public void testLog4JPropertyConfiguratorNoDebug() 165 throws Exception 166 { 167 runLoggerTest( "log4j-properties", Configurator.createLoggerStore( 168 Configurator.LOG4J_PROPERTY, 169 "org/codehaus/spice/loggerstore/log4j.properties" ), 170 ConsoleLogger.LEVEL_NONE ); 171 runLoggerTest( "log4j-properties", Configurator.createLoggerStore( 172 Configurator.LOG4J_PROPERTY, getResource( "log4j.properties" ) ), 173 ConsoleLogger.LEVEL_NONE ); 174 } 175 176 public void testLog4JPropertyConfiguratorNoLog() 177 throws Exception 178 { 179 runLoggerTest( "log4j-properties", 180 Configurator.createLoggerStore( 181 Configurator.LOG4J_PROPERTY, 182 "org/codehaus/spice/loggerstore/log4j.properties" ) ); 183 runLoggerTest( "log4j-properties", 184 Configurator.createLoggerStore( 185 Configurator.LOG4J_PROPERTY, 186 getResource( "log4j.properties" ) ) ); 187 } 188 189 public void testJDK14Configurator() 190 throws Exception 191 { 192 runLoggerTest( "jdk14", Configurator.createLoggerStore( 193 Configurator.JDK14, 194 "org/codehaus/spice/loggerstore/logging.properties" ), 195 ConsoleLogger.LEVEL_DEBUG ); 196 runLoggerTest( "jdk14", Configurator.createLoggerStore( 197 Configurator.JDK14, getResource( "logging.properties" ) ), 198 ConsoleLogger.LEVEL_DEBUG ); 199 } 200 201 public void testJDK14ConfiguratorNoDebug() 202 throws Exception 203 { 204 runLoggerTest( "jdk14", Configurator.createLoggerStore( 205 Configurator.JDK14, 206 "org/codehaus/spice/loggerstore/logging.properties" ), 207 ConsoleLogger.LEVEL_NONE ); 208 runLoggerTest( "jdk14", Configurator.createLoggerStore( 209 Configurator.JDK14, getResource( "logging.properties" ) ), 210 ConsoleLogger.LEVEL_NONE ); 211 } 212 213 public void testJDK14ConfiguratorNoLog() 214 throws Exception 215 { 216 runLoggerTest( "jdk14", 217 Configurator.createLoggerStore( Configurator.JDK14, 218 "org/codehaus/spice/loggerstore/logging.properties" ) ); 219 runLoggerTest( "jdk14", 220 Configurator.createLoggerStore( Configurator.JDK14, 221 getResource( 222 "logging.properties" ) ) ); 223 } 224 225 }

This page was automatically generated by Maven