cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r415299 - in /cocoon/trunk/core: cocoon-core/src/test/java/org/apache/cocoon/util/test/ cocoon-webapp/src/main/webapp/stylesheets/system/
Date Mon, 19 Jun 2006 11:53:53 GMT
Author: cziegeler
Date: Mon Jun 19 04:53:53 2006
New Revision: 415299

URL: http://svn.apache.org/viewvc?rev=415299&view=rev
Log:
Add new test case
Disable xalan status info as it only works with paranoid class loader

Added:
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java
  (with props)
Modified:
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/WildcardHelperTestCase.java
    cocoon/trunk/core/cocoon-webapp/src/main/webapp/stylesheets/system/status2html.xslt

Added: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java?rev=415299&view=auto
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java
(added)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java
Mon Jun 19 04:53:53 2006
@@ -0,0 +1,108 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.util.test;
+
+import junit.framework.TestCase;
+
+import org.apache.avalon.framework.logger.ConsoleLogger;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.cocoon.util.Deprecation;
+import org.apache.cocoon.util.DeprecationException;
+
+/**
+ * Test Cases for the Deprecation class.
+ * @see org.apache.cocoon.util.Deprecation
+ *
+ * @version $Id$
+ */
+public class DeprecationTestCase extends TestCase {
+    public DeprecationTestCase(String name) {
+        super(name);
+    }
+    
+    private Logger originalLogger;
+    private Logger consoleLogger;
+    
+    public void setUp() throws Exception {
+        super.setUp();
+        originalLogger = Deprecation.logger;
+        // Setup a disabled logger: avoids polluting the test output, and also test
+        // that isXXXEnabled also matches the forbidden deprecation level
+        consoleLogger = new ConsoleLogger(ConsoleLogger.LEVEL_DISABLED);
+        Deprecation.setLogger(consoleLogger);
+        Deprecation.setForbiddenLevel(Deprecation.ERROR);
+    }
+    
+    public void tearDown() throws Exception {
+        Deprecation.setLogger(originalLogger);
+        super.tearDown();
+    }
+    
+    public void testPrecond() {
+        // Double check that our logger won't let anything go through, and that
+        // enabled levels are because of the allowed level we've set.
+        assertFalse(consoleLogger.isInfoEnabled());
+        assertFalse(consoleLogger.isWarnEnabled());
+        assertFalse(consoleLogger.isErrorEnabled());
+    }
+    
+    public void testInfoOk() {
+        try {
+            Deprecation.logger.info("testing deprecation logs");
+        } catch(DeprecationException de) {
+            fail("Should not throw an exception");
+        }
+    }
+
+    public void testWarnOk() {        
+        try {
+            Deprecation.logger.warn("testing deprecation logs");
+        } catch(DeprecationException de) {
+            fail("Should not throw an exception");
+        }
+    }
+    
+    public void testErrorFails() {
+        try {
+            Deprecation.logger.error("testing deprecation logs");
+        } catch(DeprecationException de) {
+            return; // success
+        }
+        fail("Should throw an exception");
+    }
+    
+    public void testDebugFails() {
+        Deprecation.setForbiddenLevel(Deprecation.DEBUG);
+        try {
+            Deprecation.logger.debug("testing deprecation logs");
+        } catch(DeprecationException de) {
+            return; // success
+        }
+        fail("Should throw an exception");
+    }
+
+    public void testInfoDisabled() {
+        assertFalse(Deprecation.logger.isInfoEnabled());
+    }
+
+    public void testWarnDisabled() {
+        assertFalse(Deprecation.logger.isWarnEnabled());
+    }
+
+    public void testErrorEnabled() {
+        assertTrue(Deprecation.logger.isErrorEnabled());
+    }
+}

Propchange: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/DeprecationTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/WildcardHelperTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/WildcardHelperTestCase.java?rev=415299&r1=415298&r2=415299&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/WildcardHelperTestCase.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/util/test/WildcardHelperTestCase.java
Mon Jun 19 04:53:53 2006
@@ -1,18 +1,18 @@
 /*
-* Copyright 1999-2006 The Apache Software Foundation
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright 1999-2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.cocoon.util.test;
 
 import java.util.HashMap;
@@ -95,4 +95,14 @@
         assertTrue("Empty url should match empty pattern", result);
     }
 
+    public void testEndPattern() throws Exception {
+        final Map resultMap = new HashMap();
+        final String pattern = "*/";
+        final int[] expr = WildcardHelper.compilePattern(pattern);
+        boolean result = WildcardHelper.match(resultMap, "foo/bar/", expr);
+        assertFalse("Url 'foo/bar/' should not match pattern '*/'.", result);
+
+        result = WildcardHelper.match(resultMap, "foo/", expr);
+        assertTrue("Url 'foo/' should match pattern '*/'", result);
+    }
 }

Modified: cocoon/trunk/core/cocoon-webapp/src/main/webapp/stylesheets/system/status2html.xslt
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/main/webapp/stylesheets/system/status2html.xslt?rev=415299&r1=415298&r2=415299&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/main/webapp/stylesheets/system/status2html.xslt (original)
+++ cocoon/trunk/core/cocoon-webapp/src/main/webapp/stylesheets/system/status2html.xslt Mon
Jun 19 04:53:53 2006
@@ -75,10 +75,11 @@
         <!--
           - Add Xalan / Xerces information using custom Xalan extension
           - (if it's present)
-          -->
+          - Disabled for now as they only work with paranoid class loading!
         <xsl:if test="function-available('xalan:checkEnvironment')">
           <xsl:apply-templates select="xalan:checkEnvironment()"/>
         </xsl:if>
+          -->
       </body>
     </html>
   </xsl:template>



Mime
View raw message