Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 26819 invoked from network); 19 Jun 2006 11:54:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jun 2006 11:54:16 -0000 Received: (qmail 9996 invoked by uid 500); 19 Jun 2006 11:54:15 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 9964 invoked by uid 500); 19 Jun 2006 11:54:15 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 9953 invoked by uid 99); 19 Jun 2006 11:54:15 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 04:54:15 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Jun 2006 04:54:14 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 5FAF71A983A; Mon, 19 Jun 2006 04:53:54 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: cvs@cocoon.apache.org From: cziegeler@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060619115354.5FAF71A983A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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 @@ + - Disabled for now as they only work with paranoid class loading! + -->