mirror of https://github.com/qos-ch/slf4j
Added a test for testing MultiBinding behaviour. See also bug http://bugzilla.slf4j.org/show_bug.cgi?id=132
This commit is contained in:
parent
71803619af
commit
cefca8f144
|
|
@ -35,6 +35,15 @@
|
|||
<pathelement location="../slf4j-simple/target/slf4j-simple-${currentVersion}.jar" />
|
||||
</path >
|
||||
|
||||
|
||||
<path id="multiBinding">
|
||||
<pathelement location="xtarget/classes/" />
|
||||
<pathelement location="target/test-classes/" />
|
||||
<pathelement location="../slf4j-api/target/slf4j-api-${currentVersion}.jar" />
|
||||
<pathelement location="./lib/slf4j-simple-1.5.0.jar" />
|
||||
<pathelement location="./lib/slf4j-nop-1.5.6.jar" />
|
||||
</path >
|
||||
|
||||
<!-- this is really very ugly, but it's the only way to circumvent
|
||||
http://jira.codehaus.org/browse/MANTRUN-95
|
||||
-->
|
||||
|
|
@ -47,7 +56,8 @@
|
|||
<target name="testAll" depends="init,
|
||||
testMismatch,
|
||||
testPre155,
|
||||
testMatch">
|
||||
testMatch,
|
||||
testMultiBinding">
|
||||
</target>
|
||||
|
||||
<target name="testMismatch">
|
||||
|
|
@ -74,4 +84,11 @@
|
|||
</junit>
|
||||
</target>
|
||||
|
||||
<target name="testMultiBinding">
|
||||
<junit printsummary="yes" fork="no" haltonfailure="yes">
|
||||
<classpath refid="multiBinding" />
|
||||
<formatter type="plain" />
|
||||
<test fork="yes" todir="target/unit-reports" name="org.slf4j.MultiBindingTest" />
|
||||
</junit>
|
||||
</target>
|
||||
</project>
|
||||
Binary file not shown.
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2009 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.slf4j;
|
||||
|
||||
import java.io.PrintStream;
|
||||
import java.util.Random;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class MultiBindingTest extends TestCase {
|
||||
|
||||
StringPrintStream sps = new StringPrintStream(System.err);
|
||||
PrintStream old = System.err;
|
||||
int diff = 1024 + new Random().nextInt(10000);
|
||||
|
||||
public MultiBindingTest(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
System.setErr(sps);
|
||||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
System.setErr(old);
|
||||
}
|
||||
|
||||
public void test() throws Exception {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
String msg = "hello world " + diff;
|
||||
logger.info(msg);
|
||||
assertTrue("number of lines should be greater than 4", sps.stringList
|
||||
.size() > 4);
|
||||
String s0 = (String) sps.stringList.get(0);
|
||||
assertTrue(s0
|
||||
.contains("SLF4J: Class path contains multiple SLF4J bindins."));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2004-2009 QOS.ch
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
package org.slf4j;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package org.slf4j;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
|
|
|||
Loading…
Reference in New Issue