From fb515206b518de1e796739676df4ac117681668d Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Tue, 22 Mar 2005 06:51:59 +0000 Subject: [PATCH] remove context from request git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163646 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/PluginExecutionRequest.java | 17 +-------------- .../maven/script/marmalade/MarmaladeMojo.java | 21 +++++++++---------- .../script/marmalade/MarmaladeMojoTest.java | 13 ++++++------ 3 files changed, 18 insertions(+), 33 deletions(-) diff --git a/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionRequest.java b/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionRequest.java index 9189af83de..459e91aac5 100644 --- a/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionRequest.java +++ b/maven-plugin/src/main/java/org/apache/maven/plugin/PluginExecutionRequest.java @@ -16,24 +16,19 @@ package org.apache.maven.plugin; * limitations under the License. */ -import java.util.HashMap; import java.util.Map; /** - * @deprecated * @author Jason van Zyl * @version $Id$ + * @deprecated */ public class PluginExecutionRequest { private Map parameters; - private Map context; - public PluginExecutionRequest( Map parameters ) { - context = new HashMap(); - this.parameters = parameters; } @@ -51,14 +46,4 @@ public class PluginExecutionRequest { return parameters.get( key ); } - - public void addContextValue( Object key, Object value ) - { - context.put( key, value ); - } - - public Object getContextValue( String key ) - { - return context.get( key ); - } } diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java index fa8b350077..9dbd61226e 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/MarmaladeMojo.java @@ -25,9 +25,6 @@ import org.codehaus.marmalade.runtime.DefaultContext; import org.codehaus.marmalade.runtime.MarmaladeExecutionContext; import org.codehaus.marmalade.runtime.MarmaladeExecutionException; -import java.util.Iterator; -import java.util.Map; - /** * @author jdcasey */ @@ -42,7 +39,8 @@ public class MarmaladeMojo this.script = script; } - public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) throws Exception + public void execute( PluginExecutionRequest request, PluginExecutionResponse response ) + throws Exception { MarmaladeExecutionContext context = new DefaultContext( request.getParameters() ); @@ -60,13 +58,14 @@ public class MarmaladeMojo response.setExecutionFailure( failure ); } - Map externalizedVars = context.getExternalizedVariables(); - for ( Iterator it = externalizedVars.entrySet().iterator(); it.hasNext(); ) - { - Map.Entry entry = (Map.Entry) it.next(); - - request.addContextValue( entry.getKey(), entry.getValue() ); - } + // TODO: need to be able to pass back results +// Map externalizedVars = context.getExternalizedVariables(); +// for ( Iterator it = externalizedVars.entrySet().iterator(); it.hasNext(); ) +// { +// Map.Entry entry = (Map.Entry) it.next(); +// +// request.addContextValue( entry.getKey(), entry.getValue() ); +// } } } \ No newline at end of file diff --git a/maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade/MarmaladeMojoTest.java b/maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade/MarmaladeMojoTest.java index 3dbef227dd..8d4348f729 100644 --- a/maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade/MarmaladeMojoTest.java +++ b/maven-script/maven-script-marmalade/src/test/java/org/apache/maven/script/marmalade/MarmaladeMojoTest.java @@ -16,6 +16,7 @@ package org.apache.maven.script.marmalade; * limitations under the License. */ +import junit.framework.TestCase; import org.apache.maven.plugin.PluginExecutionRequest; import org.apache.maven.plugin.PluginExecutionResponse; import org.codehaus.marmalade.metamodel.ScriptBuilder; @@ -27,8 +28,6 @@ import org.codehaus.marmalade.parsing.ScriptParser; import java.io.StringReader; import java.util.Collections; -import junit.framework.TestCase; - /** * @author jdcasey */ @@ -38,7 +37,8 @@ public class MarmaladeMojoTest private static final String TEST_SCRIPT = ""; - public void testShouldProduceOutputWithRequest_Dot_ToStringInline() throws Exception + public void testShouldProduceOutputWithRequest_Dot_ToStringInline() + throws Exception { MarmaladeParsingContext parseContext = new DefaultParsingContext(); parseContext.setInput( new StringReader( TEST_SCRIPT ) ); @@ -57,9 +57,10 @@ public class MarmaladeMojoTest mojo.execute( request, response ); - Object result = request.getContextValue( "testvar" ); - - assertEquals( "paramValue/testval", result ); + // TODO: need to be able to pass back results +// Object result = request.getContextValue( "testvar" ); +// +// assertEquals( "paramValue/testval", result ); } } \ No newline at end of file