Author: ceki Date: Tue Jun 9 22:23:38 2009 New Revision: 1344 Added: slf4j/trunk/integration/lib/slf4j-nop-1.5.6.jar (contents, props changed) slf4j/trunk/integration/src/test/java/org/slf4j/MultiBindingTest.java Modified: slf4j/trunk/integration/build.xml slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java slf4j/trunk/integration/src/test/java/org/slf4j/VersionMatchTest.java
Log: Added a test for testing MultiBinding behaviour. See also bug http://bugzilla.slf4j.org/show_bug.cgi?id=132 Modified: slf4j/trunk/integration/build.xml ============================================================================== --- slf4j/trunk/integration/build.xml (original) +++ slf4j/trunk/integration/build.xml Tue Jun 9 22:23:38 2009 @@ -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> \ No newline at end of file Added: slf4j/trunk/integration/lib/slf4j-nop-1.5.6.jar ============================================================================== Binary file. No diff available. Added: slf4j/trunk/integration/src/test/java/org/slf4j/MultiBindingTest.java ============================================================================== --- (empty file) +++ slf4j/trunk/integration/src/test/java/org/slf4j/MultiBindingTest.java Tue Jun 9 22:23:38 2009 @@ -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.")); + } +} Modified: slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java ============================================================================== --- slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java (original) +++ slf4j/trunk/integration/src/test/java/org/slf4j/Pre155VersionTest.java Tue Jun 9 22:23:38 2009 @@ -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; Modified: slf4j/trunk/integration/src/test/java/org/slf4j/VersionMatchTest.java ============================================================================== --- slf4j/trunk/integration/src/test/java/org/slf4j/VersionMatchTest.java (original) +++ slf4j/trunk/integration/src/test/java/org/slf4j/VersionMatchTest.java Tue Jun 9 22:23:38 2009 @@ -1,3 +1,4 @@ + package org.slf4j; import java.io.PrintStream; _______________________________________________ dev mailing list dev@slf4j.org http://www.slf4j.org/mailman/listinfo/dev