You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2012/09/10 22:59:49 UTC
svn commit: r1383109 - in /maven/plugins/trunk/maven-invoker-plugin: ./
src/it/script-verify-xml/ src/it/script-verify-xml/src/
src/it/script-verify-xml/src/it/
src/it/script-verify-xml/src/it/minvoker-138/
Author: rfscholte
Date: Mon Sep 10 20:59:49 2012
New Revision: 1383109
URL: http://svn.apache.org/viewvc?rev=1383109&view=rev
Log:
Fix MINVOKER-138: Use groovy-all dependency to have xml support
Added:
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/pom.xml
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/minvoker-138/
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/minvoker-138/pom.xml
maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/verify.groovy
Modified:
maven/plugins/trunk/maven-invoker-plugin/pom.xml
Modified: maven/plugins/trunk/maven-invoker-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/pom.xml?rev=1383109&r1=1383108&r2=1383109&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-invoker-plugin/pom.xml Mon Sep 10 20:59:49 2012
@@ -61,7 +61,7 @@ under the License.
<beanshell-artifactId>bsh</beanshell-artifactId>
<beanshell-version>2.0b4</beanshell-version>
<groovy-groupId>org.codehaus.groovy</groovy-groupId>
- <groovy-artifactId>groovy</groovy-artifactId>
+ <groovy-artifactId>groovy-all</groovy-artifactId>
<groovy-version>2.0.1</groovy-version>
<mavenPluginPluginVersion>3.1</mavenPluginPluginVersion>
</properties>
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/pom.xml?rev=1383109&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/pom.xml Mon Sep 10 20:59:49 2012
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.invoker.its</groupId>
+ <artifactId>script-verify-xml</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <description>Test if the XmlSlurper is still on the classpath.</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <debug>true</debug>
+ <goals>
+ <goal>validate</goal>
+ </goals>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>initialize</phase>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/minvoker-138/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/minvoker-138/pom.xml?rev=1383109&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/minvoker-138/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/src/it/minvoker-138/pom.xml Mon Sep 10 20:59:49 2012
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.invoker.its</groupId>
+ <artifactId>minvoker-138</artifactId>
+ <version>0.1-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+</project>
Added: maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/verify.groovy?rev=1383109&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/verify.groovy (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/script-verify-xml/verify.groovy Mon Sep 10 20:59:49 2012
@@ -0,0 +1,48 @@
+// from http://groovy.codehaus.org/Reading+XML+using+Groovy's+XmlSlurper
+// A lot of examples covering xml assertions
+
+class XmlExamples {
+ static def CAR_RECORDS = '''
+ <records>
+ <car name='HSV Maloo' make='Holden' year='2006'>
+ <country>Australia</country>
+ <record type='speed'>Production Pickup Truck with speed of 271kph</record>
+ </car>
+ <car name='P50' make='Peel' year='1962'>
+ <country>Isle of Man</country>
+ <record type='size'>Smallest Street-Legal Car at 99cm wide and 59 kg in weight</record>
+ </car>
+ <car name='Royale' make='Bugatti' year='1931'>
+ <country>France</country>
+ <record type='price'>Most Valuable Car at $15 million</record>
+ </car>
+ </records>
+ '''
+}
+def records = new XmlSlurper().parseText(XmlExamples.CAR_RECORDS)
+def allRecords = records.car
+assert 3 == allRecords.size()
+def allNodes = records.depthFirst().collect{ it }
+assert 10 == allNodes.size()
+def firstRecord = records.car[0]
+assert 'car' == firstRecord.name()
+assert 'Holden' == firstRecord.@make.text()
+assert 'Australia' == firstRecord.country.text()
+def carsWith_e_InMake = records.car.findAll{ it.@make.text().contains('e') }
+assert carsWith_e_InMake.size() == 2
+// alternative way to find cars with 'e' in make
+assert 2 == records.car.findAll{ it.@make =~ '.*e.*' }.size()
+// makes of cars that have an 's' followed by an 'a' in the country
+assert ['Holden', 'Peel'] == records.car.findAll{ it.country =~ '.*s.*a.*' }.@make.collect{ it.text() }
+def expectedRecordTypes = ['speed', 'size', 'price']
+assert expectedRecordTypes == records.depthFirst().grep{ it.@type != '' }.'@type'*.text()
+assert expectedRecordTypes == records.'**'.grep{ it.@type != '' }.'@type'*.text()
+def countryOne = records.car[1].country
+assert 'Peel' == countryOne.parent().@make.text()
+assert 'Peel' == countryOne.'..'.@make.text()
+// names of cars with records sorted by year
+def sortedNames = records.car.list().sort{ it.@year.toInteger() }.'@name'*.text()
+assert ['Royale', 'P50', 'HSV Maloo'] == sortedNames
+assert ['Australia', 'Isle of Man'] == records.'**'.grep{ it.@type =~ 's.*' }*.parent().country*.text()
+assert 'co-re-co-re-co-re' == records.car.children().collect{ it.name()[0..1] }.join('-')
+assert 'co-re-co-re-co-re' == records.car.'*'.collect{ it.name()[0..1] }.join('-')
\ No newline at end of file