Modified: incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/CommandExecutorTest.groovy URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/CommandExecutorTest.groovy?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/CommandExecutorTest.groovy (original) +++ incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/CommandExecutorTest.groovy Wed Jan 4 21:12:08 2012 @@ -23,8 +23,11 @@ package npanday.executable.execution; import npanday.executable.CommandExecutor import npanday.executable.ExecutionException +import npanday.executable.execution.quoting.PlexusNativeQuotingStrategy +import npanday.executable.execution.quoting.CustomSwitchAwareQuotingStrategy import org.codehaus.plexus.logging.Logger import org.codehaus.plexus.logging.console.ConsoleLogger +import org.codehaus.plexus.util.Os import org.junit.Test import org.junit.internal.AssumptionViolatedException import org.junit.runner.RunWith @@ -47,9 +50,16 @@ public class CommandExecutorTest @Parameters public static Collection<Object[]> data() { + def osKey = Os.isFamily(Os.FAMILY_WINDOWS) ? "win_" : "x_"; Object[][] data = [ - ["plexus_cli", new PlexusUtilsCommandExecutor()], - ["commons_exec", new CommonsExecCommandExecutor()] + [osKey + "npanday_old", + new PlexusUtilsCommandExecutor()], + [osKey + "unified_simple_quoting", + new UnifiedShellCommandExecutor(new PlexusNativeQuotingStrategy())], + [osKey + "unified_custom_quoting", + new UnifiedShellCommandExecutor(new CustomSwitchAwareQuotingStrategy())], + [osKey + "commons_exec_experimental", + new CommonsExecCommandExecutor()] ]; return Arrays.asList(data); } @@ -98,7 +108,9 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(["a '"], [ - plexus_cli: '"a \'"' + win_npanday_old: '"a \'"', + win_unified_simple_quoting: '"a \'"', + win_unified_custom_quoting: '"a \'"' ]); } @@ -107,7 +119,9 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(["' a"], [ - plexus_cli: '"\' a"' + win_npanday_old: '"\' a"', + win_unified_simple_quoting: '"\' a"', + win_unified_custom_quoting: '"\' a"' ]); } @@ -116,7 +130,9 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(["' a '"], [ - plexus_cli: '"\' a \'"' + win_npanday_old: '"\' a \'"', + win_unified_simple_quoting: '"\' a \'"', + win_unified_custom_quoting: '"\' a \'"' ]); } @@ -125,7 +141,9 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(['a " b'], [ - plexus_cli: '"a " b"' + win_npanday_old: '"a " b"', + win_unified_simple_quoting: '"a \\" b"', + win_unified_custom_quoting: '"a \\" b"' ]); } @@ -134,7 +152,9 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(['a "'], [ - plexus_cli: '"a ""' + win_npanday_old: '"a ""', + win_unified_simple_quoting: '"a \\""', + win_unified_custom_quoting: '"a \\""' ]); } @@ -143,7 +163,9 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(['" a'], [ - plexus_cli: '"" a"' + win_npanday_old: '"" a"', + win_unified_simple_quoting: '"\\" a"', + win_unified_custom_quoting: '"\\" a"' ]); } @@ -152,10 +174,81 @@ public class CommandExecutorTest throws ExecutionException { testArgExpansion(['" a "'], [ - plexus_cli: '" a "' + win_npanday_old: '" a "', + win_unified_simple_quoting: '" a "', // if it yet is quoted, it wont quote again + win_unified_custom_quoting: '"\\" a \\""' // but we want it escaped and quoted again ]); } + @Test + public void testCommandArgSwitchWithSpaceInValue_slashColon() + throws ExecutionException + { + testArgExpansion(['/test:a b'], [ + win_unified_simple_quoting: '"/test:a b"', + win_unified_custom_quoting: '/test:"a b"' + ]); + } + + @Test + public void testCommandArgSwitchWithSpaceInValue_slashEquals() + throws ExecutionException + { + testArgExpansion(['/test=a b'], [ + win_unified_simple_quoting: '"/test=a b"', + win_unified_custom_quoting: '/test="a b"' + ]); + } + + @Test + public void testCommandArgSwitchWithSpaceInValue_minusColon() + throws ExecutionException + { + testArgExpansion(['-test:a b'], [ + win_unified_simple_quoting: '"-test:a b"', + win_unified_custom_quoting: '-test:"a b"' + ]); + } + + @Test + public void testCommandArgSwitchWithSpaceInValue_minusEquals() + throws ExecutionException + { + testArgExpansion(['-test=a b'], [ + win_unified_simple_quoting: '"-test=a b"', + win_unified_custom_quoting: '-test="a b"' + ]); + } + + @Test + public void testCommandArgSwitchWithSpaceInValue_prequotedDouble() + throws ExecutionException + { + testArgExpansion(['/test:"a b"'], [ + win_unified_simple_quoting: '"/test:\\"a b\\""', + win_unified_custom_quoting: '/test:"\\"a b\\""' + ]); + } + + @Test + public void testCommandArgSwitchWithSpaceInValue_prequotedSingle() + throws ExecutionException + { + testArgExpansion(["/test:'a b'"], [ + win_unified_simple_quoting: '"/test:\'a b\'"', + win_unified_custom_quoting: '/test:"\'a b\'"' + ]); + } + + @Test + public void testCscDefineSwitch() + throws ExecutionException + { + def raw = '/define:"CONFIG="Debug",DEBUG=-1,TRACE=-1,_MyType="Windows",PLATFORM="AnyCPU"' + def quoted = '/define:"\\"CONFIG=\\"Debug\\",DEBUG=-1,TRACE=-1,_MyType=\\"Windows\\",PLATFORM=\\"AnyCPU\\""' + testArgExpansion([raw], [win_unified_custom_quoting: quoted]); + } + private def testArgExpansion(ArrayList<String> args, String expected) { cmd.executeCommand("echo", args) @@ -199,11 +292,13 @@ public class CommandExecutorTest { String path = parentPath + File.separator + "sampledirectory"; + File dir = new File(path) + if ( dir.exists() ) dir.deleteDir() + params.clear(); params.add(path); cmd.executeCommand(MKDIR, params); - File dir = new File(path); assertTrue(dir.exists());
Added: incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/switches/SwitchFormatTest.groovy URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/switches/SwitchFormatTest.groovy?rev=1227326&view=auto ============================================================================== --- incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/switches/SwitchFormatTest.groovy (added) +++ incubator/npanday/trunk/components/dotnet-executable/src/test/groovy/npanday/executable/execution/switches/SwitchFormatTest.groovy Wed Jan 4 21:12:08 2012 @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 npanday.executable.execution.switches + +import org.junit.Test + +/** + * @author <a href="mailto:[email protected]">Lars Corneliussen</a> + */ +class SwitchFormatTest +{ + + @Test + void testSimpleSwitch() + { + def format = new SwitchFormat((char) '-', (char) ':') + assert format.isMatchingSwitch("-x:y") == true + def sw = format.parse("-x:y"); + assert sw.name == "x" + assert sw.value == "y" + } + + @Test + void testSimpleSwitch_negative() + { + def format = new SwitchFormat((char) '-', (char) ':') + assert format.isMatchingSwitch("/x:y") == false + assert format.isMatchingSwitch("-x=y") == false + assert format.isMatchingSwitch("-x=z:y") == false + + } + + @Test + void testMsDeployStyleSwitch() + { + def format = new SwitchFormat((char) '-', "\\w+(\\:\\w+)", (char) '=') + assert format.isMatchingSwitch("-x:y=z") == true + def sw = format.parse("-x:y=z"); + assert sw.name == "x:y" + assert sw.value == "z" + } + + @Test + void testParseFromDefinition() + { + def parsed = SwitchFormat.fromStringDefinition("-;\\w+(\\:\\w+);=").toString() + def handCrafted = new SwitchFormat((char) '-', "\\w+(\\:\\w+)", (char) '=').toString() + assert parsed == handCrafted + } +} Modified: incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo (original) +++ incubator/npanday/trunk/components/dotnet-model/compiler-plugins/compiler-plugins.mdo Wed Jan 4 21:12:08 2012 @@ -60,6 +60,18 @@ </description> </field> <field> + <name>pluginConfiguration</name> + <description> + Configuration properties, that will be passed along to npanday.executable.NetExecutable#init() + </description> + <version>1.5.0+</version> + <type>Properties</type> + <association xml.mapStyle="inline"> + <type>String</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> <name>vendor</name> <version>1.0.0+</version> <type>String</type> Modified: incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/groovy/npanday/model/compiler/plugins/io/CompilerPluginXpp3ReaderTest.groovy URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/groovy/npanday/model/compiler/plugins/io/CompilerPluginXpp3ReaderTest.groovy?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/groovy/npanday/model/compiler/plugins/io/CompilerPluginXpp3ReaderTest.groovy (original) +++ incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/groovy/npanday/model/compiler/plugins/io/CompilerPluginXpp3ReaderTest.groovy Wed Jan 4 21:12:08 2012 @@ -35,5 +35,7 @@ class CompilerPluginXpp3ReaderTest assert model.compilerPlugins != null assert model.compilerPlugins.size() == 1 assert model.compilerPlugins[0].vendorVersion == "1" + + assert model.compilerPlugins[0].pluginConfiguration.get("test") == "12345" } } Modified: incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml (original) +++ incubator/npanday/trunk/components/dotnet-model/compiler-plugins/src/test/resources/sample-compiler-plugins.xml Wed Jan 4 21:12:08 2012 @@ -20,6 +20,9 @@ <compilerPlugin> <identifier>Ruby</identifier> <pluginClass>npanday.executable.compiler.impl.RubyCompiler</pluginClass> + <pluginConfiguration> + <test>12345</test> + </pluginConfiguration> <vendor>MICROSOFT</vendor> <vendorVersion>1</vendorVersion> <executable>RubyCompiler.exe</executable> Modified: incubator/npanday/trunk/components/dotnet-model/executable-plugins/executable-plugins.mdo URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/executable-plugins/executable-plugins.mdo?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-model/executable-plugins/executable-plugins.mdo (original) +++ incubator/npanday/trunk/components/dotnet-model/executable-plugins/executable-plugins.mdo Wed Jan 4 21:12:08 2012 @@ -69,6 +69,18 @@ </description> </field> <field> + <name>pluginConfiguration</name> + <description> + Configuration properties, that will be passed along to npanday.executable.NetExecutable#init() + </description> + <version>1.5.0+</version> + <type>Properties</type> + <association xml.mapStyle="inline"> + <type>String</type> + <multiplicity>*</multiplicity> + </association> + </field> + <field> <name>vendor</name> <version>1.0.0+</version> <type>String</type> Modified: incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/groovy/npanday/model/compiler/plugins/io/ExecutablePluginXpp3ReaderTest.groovy URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/groovy/npanday/model/compiler/plugins/io/ExecutablePluginXpp3ReaderTest.groovy?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/groovy/npanday/model/compiler/plugins/io/ExecutablePluginXpp3ReaderTest.groovy (original) +++ incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/groovy/npanday/model/compiler/plugins/io/ExecutablePluginXpp3ReaderTest.groovy Wed Jan 4 21:12:08 2012 @@ -38,5 +38,7 @@ class ExecutablePluginXpp3ReaderTest assert model.executablePlugins[0].probingPaths.size() == 2 assert model.executablePlugins[0].probingPaths[0] == "one" assert model.executablePlugins[0].executableVersion == "5.0" + + assert model.executablePlugins[0].pluginConfiguration.get("test") == "12345" } } Modified: incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/resources/sample-executable-plugins.xml URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/resources/sample-executable-plugins.xml?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/resources/sample-executable-plugins.xml (original) +++ incubator/npanday/trunk/components/dotnet-model/executable-plugins/src/test/resources/sample-executable-plugins.xml Wed Jan 4 21:12:08 2012 @@ -20,6 +20,9 @@ <executablePlugin> <identifier>ncover</identifier> <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass> + <pluginConfiguration> + <test>12345</test> + </pluginConfiguration> <vendor>MICROSOFT</vendor> <executable>NCover.Console</executable> <executableVersion>5.0</executableVersion> Modified: incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WindowsRegistryValueSource.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WindowsRegistryValueSource.java?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WindowsRegistryValueSource.java (original) +++ incubator/npanday/trunk/components/dotnet-registry/src/main/java/npanday/registry/impl/WindowsRegistryValueSource.java Wed Jan 4 21:12:08 2012 @@ -19,7 +19,7 @@ package npanday.registry.impl; * under the License. */ -import hidden.org.codehaus.plexus.interpolation.AbstractValueSource; +import org.codehaus.plexus.interpolation.AbstractValueSource; import npanday.registry.WindowsRegistryAccessException; import npanday.registry.WindowsRegistryAccessProvider; import org.codehaus.plexus.interpolation.ValueSource; Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java (original) +++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/java/npanday/plugin/azure/CreateCloudServicePackageMojo.java Wed Jan 4 21:12:08 2012 @@ -121,7 +121,7 @@ public class CreateCloudServicePackageMo if ( generateConfigurationFile ) { - commands.add( "/generateConfigurationFile:\"" + templateConfigurationFile.getAbsolutePath() + "\"" ); + commands.add( "/generateConfigurationFile:" + templateConfigurationFile.getAbsolutePath() ); } commands.add( "/out:" + packageFile.getAbsolutePath() ); Modified: incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml (original) +++ incubator/npanday/trunk/plugins/azure-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml Wed Jan 4 21:12:08 2012 @@ -20,7 +20,7 @@ <executablePlugin> <profile>CSPACK</profile> - <pluginClass>npanday.executable.impl.CommonsExecNetExecutable</pluginClass> + <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass> <executable>cspack</executable> <executableVersion>1.6</executableVersion> Modified: incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java (original) +++ incubator/npanday/trunk/plugins/maven-test-plugin/src/main/java/npanday/plugin/test/TesterMojo.java Wed Jan 4 21:12:08 2012 @@ -401,7 +401,7 @@ public class TesterMojo extends Abstract // TODO: This should rather be done through a configurable local executable-plugins.xml; then remove nunitcommand getLog().debug( "NPANDAY-1100-008: Platform unsupported, is your npanday-settings.xml configured correctly?", pue ); - CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor(); + CommandExecutor commandExecutor = CommandExecutor.Factory.createDefaultCommmandExecutor(null); commandExecutor.setLogger( new org.codehaus.plexus.logging.AbstractLogger( 0, "nunit-logger" ) { Log log = getLog(); Modified: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/MsDeployUnpackDependenciesMojo.java URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/MsDeployUnpackDependenciesMojo.java?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/MsDeployUnpackDependenciesMojo.java (original) +++ incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/java/npanday/plugin/msdeploy/MsDeployUnpackDependenciesMojo.java Wed Jan 4 21:12:08 2012 @@ -77,12 +77,12 @@ public class MsDeployUnpackDependenciesM { List<String> commands = Lists.newArrayList(); - // this requires npanday.executable.impl.CommonsExecNetExecutable to be used, as it will respect + // this requires npanday.executable.impl.DefaultNetExecutable to be used, as it will respect // the "home-made" quoting commands.add( "-verb:sync" ); - commands.add( "-source:package=\"" + item.getPackageSource().getAbsolutePath() + "\""); - commands.add( "-dest:contentPath=\"" + item.getPackageTarget().getAbsolutePath() + "\"" ); + commands.add( "-source:package=" + item.getPackageSource().getAbsolutePath()); + commands.add( "-dest:contentPath=" + item.getPackageTarget().getAbsolutePath() ); return commands; } Modified: incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml (original) +++ incubator/npanday/trunk/plugins/msdeploy-maven-plugin/src/main/resources/META-INF/npanday/executable-plugins.xml Wed Jan 4 21:12:08 2012 @@ -20,7 +20,20 @@ <executablePlugin> <profile>MSDEPLOY</profile> - <pluginClass>npanday.executable.impl.CommonsExecNetExecutable</pluginClass> + <pluginClass>npanday.executable.impl.DefaultNetExecutable</pluginClass> + <pluginConfiguration> + <!-- + this will allow escaping for switches like this: + -x:y=a b ==> -x:y="a b" + + Configuration is in this format: leadChar;switchNamePattern;valueOperatorChar + + Separate multiple with pipe (|) + --> + <switchformats> + -;\w+(\:\w+);= + </switchformats> + </pluginConfiguration> <vendor>MICROSOFT</vendor> <executable>msdeploy</executable> Modified: incubator/npanday/trunk/pom.xml URL: http://svn.apache.org/viewvc/incubator/npanday/trunk/pom.xml?rev=1227326&r1=1227325&r2=1227326&view=diff ============================================================================== --- incubator/npanday/trunk/pom.xml (original) +++ incubator/npanday/trunk/pom.xml Wed Jan 4 21:12:08 2012 @@ -36,7 +36,7 @@ under the License. <!-- this is what get edited most, so lets put it on the top --> <properties> <mavenVersion>2.2.1</mavenVersion> - <plexus.utils.version>1.5.11</plexus.utils.version> + <plexus.utils.version>1.5.15</plexus.utils.version> <!-- if you want to build NPanday with a specific version, replace this --> <!-- Note: this will cause problems trying to release the first time. We can do
