[Schmitzm-commits] r1324 - in trunk: src/schmitzm/lang src/skrueger src_junit/schmitzm/lang testresources testresources/schmitzm testresources/schmitzm/lang testresources/schmitzm/lang/resource

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Dec 1 14:26:06 CET 2010


Author: alfonx
Date: 2010-12-01 14:26:03 +0100 (Wed, 01 Dec 2010)
New Revision: 1324

Added:
   trunk/testresources/schmitzm/
   trunk/testresources/schmitzm/lang/
   trunk/testresources/schmitzm/lang/resource/
   trunk/testresources/schmitzm/lang/resource/locales/
Modified:
   trunk/src/schmitzm/lang/LangUtil.java
   trunk/src/skrueger/Sitemap.java
   trunk/src_junit/schmitzm/lang/LangUtilTest.java
Log:
Moved testing resources to testresources (moving otwards astandard maven directory structure very and very slowly carefully)

Modified: trunk/src/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/src/schmitzm/lang/LangUtil.java	2010-12-01 01:34:20 UTC (rev 1323)
+++ trunk/src/schmitzm/lang/LangUtil.java	2010-12-01 13:26:03 UTC (rev 1324)
@@ -119,12 +119,12 @@
 			return "null";
 		return object.getClass().getSimpleName();
 	}
-	
+
 	/**
-	 * Returns a truncated string or empty string if the input string is null. 
+	 * Returns a truncated string or empty string if the input string is null.
 	 */
 	public static String getTrimmedString(String string) {
-		if ( string == null )
+		if (string == null)
 			return "";
 		return string.trim();
 	}
@@ -1434,7 +1434,7 @@
 		Logger.getLogger("com.sun.faces").setLevel(Level.WARN);
 		Logger.getLogger("org.hibernate").setLevel(Level.WARN);
 		Logger.getLogger("net.sf.ehcache.hibernate").setLevel(Level.WARN);
-
+		
 		if (Logger.getRootLogger().getAllAppenders().hasMoreElements())
 			return;
 
@@ -1447,6 +1447,13 @@
 		Logger.getRootLogger().addAppender(appender);
 		Logger.getRootLogger().setLevel(logLevel);
 
+		// Reducing the for libraries.. TODO could be
+		// Math.min(loglevel+2,LEVEL.ERROR)
+		Logger.getLogger("javax.faces").setLevel(Level.WARN);
+		Logger.getLogger("com.sun.faces").setLevel(Level.WARN);
+		Logger.getLogger("org.hibernate").setLevel(Level.WARN);
+		Logger.getLogger("net.sf.ehcache.hibernate").setLevel(Level.WARN);
+
 	}
 
 	/**

Modified: trunk/src/skrueger/Sitemap.java
===================================================================
--- trunk/src/skrueger/Sitemap.java	2010-12-01 01:34:20 UTC (rev 1323)
+++ trunk/src/skrueger/Sitemap.java	2010-12-01 13:26:03 UTC (rev 1324)
@@ -1,10 +1,8 @@
 package skrueger;
 
 import java.io.FileWriter;
-import java.io.IOException;
 import java.io.StringWriter;
 import java.io.Writer;
-import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLEncoder;
 import java.util.Date;
@@ -17,8 +15,6 @@
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
-import net.sf.antcontrib.property.URLEncodeTask;
-
 import org.apache.log4j.Logger;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -196,7 +192,7 @@
 			try {
 				URL url = new URL(se + urlToSitemap);
 
-				urlToSitemap = URLEncoder.encode(urlToSitemap, "UTF8");
+				urlToSitemap = URLEncoder.encode(urlToSitemap);
 
 				url.openConnection().connect();
 

Modified: trunk/src_junit/schmitzm/lang/LangUtilTest.java
===================================================================
--- trunk/src_junit/schmitzm/lang/LangUtilTest.java	2010-12-01 01:34:20 UTC (rev 1323)
+++ trunk/src_junit/schmitzm/lang/LangUtilTest.java	2010-12-01 13:26:03 UTC (rev 1324)
@@ -1,9 +1,14 @@
 package schmitzm.lang;
 
+import static org.junit.Assert.*;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.util.Enumeration;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
 import org.junit.Test;
 
 public class LangUtilTest {
@@ -64,12 +69,25 @@
 	}
 
 	@Test
-		public void testTrimNewlines() {
-			assertEquals("p12", LangUtil.trimNewlines("\np12\n"));
-			assertEquals("p12", LangUtil.trimNewlines("p12\n"));
-			assertEquals("p12", LangUtil.trimNewlines("p12"));
-			assertEquals("", LangUtil.trimNewlines(""));
-			assertEquals(null, LangUtil.trimNewlines(null));
-		}
+	public void testTrimNewlines() {
+		assertEquals("p12", LangUtil.trimNewlines("\np12\n"));
+		assertEquals("p12", LangUtil.trimNewlines("p12\n"));
+		assertEquals("p12", LangUtil.trimNewlines("p12"));
+		assertEquals("", LangUtil.trimNewlines(""));
+		assertEquals(null, LangUtil.trimNewlines(null));
+	}
 
+	@Test
+	public void testInitializeDefaultLogger() {
+		Logger.getRootLogger().removeAllAppenders();
+		LangUtil.initializeDefaultLogger(null, null);
+		assertEquals(Level.DEBUG, Logger.getRootLogger().getLevel());
+		Enumeration allAppenders = Logger.getRootLogger().getAllAppenders();
+		assertNotNull("Has a first appender!", allAppenders.nextElement());
+		assertFalse("More than one appender?!", allAppenders.hasMoreElements());
+
+		assertEquals("Reduced Logging-Level for libs not applied?!",
+				Level.WARN, Logger.getLogger("org.hibernate").getLevel());
+	}
+
 }

Copied: trunk/testresources/schmitzm/lang/resource/locales (from rev 1320, trunk/src_junit/schmitzm/lang/resource/locales)



More information about the Schmitzm-commits mailing list