Return-Path: Delivered-To: apmail-maven-continuum-commits-archive@www.apache.org Received: (qmail 40992 invoked from network); 14 Aug 2006 15:50:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 14 Aug 2006 15:50:18 -0000 Received: (qmail 5718 invoked by uid 500); 14 Aug 2006 15:50:18 -0000 Delivered-To: apmail-maven-continuum-commits-archive@maven.apache.org Received: (qmail 5697 invoked by uid 500); 14 Aug 2006 15:50:18 -0000 Mailing-List: contact continuum-commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: continuum-dev@maven.apache.org Delivered-To: mailing list continuum-commits@maven.apache.org Received: (qmail 5686 invoked by uid 99); 14 Aug 2006 15:50:18 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Aug 2006 08:50:18 -0700 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,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, 14 Aug 2006 08:50:17 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 482E71A981A; Mon, 14 Aug 2006 08:49:57 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r431371 - in /maven/continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/DefaultContinuum.java test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java Date: Mon, 14 Aug 2006 15:49:56 -0000 To: continuum-commits@maven.apache.org From: carlos@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060814154957.482E71A981A@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: carlos Date: Mon Aug 14 08:49:56 2006 New Revision: 431371 URL: http://svn.apache.org/viewvc?rev=431371&view=rev Log: Don't wrap ContinuumException again Added: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java (with props) Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java?rev=431371&r1=431370&r2=431371&view=diff ============================================================================== --- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java (original) +++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/DefaultContinuum.java Mon Aug 14 08:49:56 2006 @@ -170,6 +170,16 @@ } ); } + public void setActionManager( ActionManager actionManager ) + { + this.actionManager = actionManager; + } + + public ActionManager getActionManager() + { + return actionManager; + } + // ---------------------------------------------------------------------- // Projects // ---------------------------------------------------------------------- @@ -2086,18 +2096,22 @@ // Workflow // ---------------------------------------------------------------------- - private void executeAction( String actionName, Map context ) + protected void executeAction( String actionName, Map context ) throws ContinuumException { try { - Action action = actionManager.lookup( actionName ); + Action action = getActionManager().lookup( actionName ); action.execute( context ); } catch ( ActionNotFoundException e ) { throw new ContinuumException( "Error while executing the action '" + actionName + "'.", e ); + } + catch ( ContinuumException e ) + { + throw e; } catch ( Exception e ) { Added: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java?rev=431371&view=auto ============================================================================== --- maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java (added) +++ maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java Mon Aug 14 08:49:56 2006 @@ -0,0 +1,67 @@ +package org.apache.maven.continuum; + +/* + * Copyright 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. + */ + +import java.util.Collections; + +import org.codehaus.plexus.action.Action; +import org.codehaus.plexus.action.ActionManager; +import org.jmock.Mock; +import org.jmock.MockObjectTestCase; + +/** + * Test for {@link DefaultContinuum}. + * + * @author Carlos Sanchez + * @version $Id$ + */ +public class DefaultContinuumUnitTest + extends MockObjectTestCase +{ + + public void testExecuteAction() + throws Exception + { + DefaultContinuum continuum = new DefaultContinuum(); + + Mock actionMock = new Mock( Action.class ); + + Mock actionManagerMock = new Mock( ActionManager.class ); + + actionManagerMock.expects( once() ).will( returnValue( (Action) actionMock.proxy() ) ); + + continuum.setActionManager( (ActionManager) actionManagerMock.proxy() ); + + actionMock.expects( once() ).will( throwException( new ContinuumException( "" ) ) ); + + String exceptionName = ContinuumException.class.getName(); + try + { + continuum.executeAction( "", Collections.EMPTY_MAP ); + fail( exceptionName + " must have been thrown" ); + } + catch ( ContinuumException e ) + { + //expected, check for twice wrapped exception + if ( e.getCause() != null ) + { + assertFalse( exceptionName + " is wrapped in " + exceptionName, e.getCause().getClass() + .equals( ContinuumException.class ) ); + } + } + } +} Propchange: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/DefaultContinuumUnitTest.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"