You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by rv...@apache.org on 2012/03/08 00:28:35 UTC
svn commit: r1298208 - in
/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package: ./
src/main/groovy/org/apache/bigtop/itest/packagesmoke/ src/main/resources/
src/main/resources/apt/ src/main/resources/urpmi/ src/main/resources/yum/
src/main/resou...
Author: rvs
Date: Wed Mar 7 23:28:34 2012
New Revision: 1298208
URL: http://svn.apache.org/viewvc?rev=1298208&view=rev
Log:
BIGTOP-402. manifests for package testing contain way too many duplicate data
Added:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/apt/
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/apt/package_data.xml
- copied, changed from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_apt.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/urpmi/
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/urpmi/package_data.xml
- copied, changed from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_urpmi.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/yum/
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/yum/package_data.xml
- copied, changed from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_yum.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/zypper/
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/zypper/package_data.xml
- copied, changed from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_zypper.xml
Removed:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_apt.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_urpmi.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_yum.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_zypper.xml
Modified:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/pom.xml
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/PackageTestCommon.groovy
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy
Modified: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/pom.xml
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/pom.xml?rev=1298208&r1=1298207&r2=1298208&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/pom.xml (original)
+++ incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/pom.xml Wed Mar 7 23:28:34 2012
@@ -66,8 +66,8 @@
</goals>
<configuration>
<source><![CDATA[
- ["yum", "zypper", "apt", "urpmi"].each {
- def a = new XmlSlurper().parseText(new File("${project.build.directory}/classes/package_data_${it}.xml").text);
+ ["", "yum", "zypper", "apt", "urpmi"].each {
+ def a = new XmlSlurper().parseText(new File("${project.build.directory}/classes/${it}/package_data.xml").text);
}
println "Manifest XML validated";
]]>
Modified: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/PackageTestCommon.groovy
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/PackageTestCommon.groovy?rev=1298208&r1=1298207&r2=1298208&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/PackageTestCommon.groovy (original)
+++ incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/PackageTestCommon.groovy Wed Mar 7 23:28:34 2012
@@ -374,20 +374,22 @@ class PackageTestCommon {
problemFiles, equalTo([]));
// a bit of debug output
- def newManifest = new MarkupBuilder(new FileWriter("${pkg.name}_manifest.xml"));
+ def newManifest = new MarkupBuilder(new FileWriter("${pkg.name}.xml"));
- newManifest.content() {
- fileMeta = getLsMetadata(pkg.getFiles());
-
- pkg.getFiles().each {
- Map meta = fileMeta[it] ?: [:];
- String node = configs[it] ? "config" : (docs[it] ? "doc " : "file");
- int owners = meta.owners ?: -1;
-
- if (meta.target) {
- "$node"(name : it, owners : owners, perm : meta.perm, user : meta.user, group : meta.group, target : meta.target);
- } else {
- "$node"(name : it, owners : owners, perm : meta.perm, user : meta.user, group : meta.group);
+ newManifest."${pkg.name}" {
+ content {
+ fileMeta = getLsMetadata(pkg.getFiles());
+
+ pkg.getFiles().each {
+ Map meta = fileMeta[it] ?: [:];
+ String node = configs[it] ? "config" : (docs[it] ? "doc " : "file");
+ int owners = meta.owners ?: -1;
+
+ if (meta.target) {
+ "$node"(name : it, owners : owners, perm : meta.perm, user : meta.user, group : meta.group, target : meta.target);
+ } else {
+ "$node"(name : it, owners : owners, perm : meta.perm, user : meta.user, group : meta.group);
+ }
}
}
}
Modified: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy?rev=1298208&r1=1298207&r2=1298208&view=diff
==============================================================================
--- incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy (original)
+++ incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy Wed Mar 7 23:28:34 2012
@@ -69,13 +69,40 @@ class TestPackagesBasics extends Package
repo.removeRepo();
}
+
+ private static void mergeTreeIntoForrest(NodeList forrest, Node tree) {
+ for (it in forrest) {
+ if (it instanceof Node && it.name() == tree.name()) {
+ tree.value().groupBy({(it instanceof Node)?it.name():"-$it"}).each { k,v ->
+ if (v.size() == 1 && v.get(0) instanceof Node) {
+ mergeTreeIntoForrest(it.value(), v.get(0));
+ } else if (v.size() != 1) {
+ it.value().addAll(v);
+ }
+ }
+ return;
+ }
+ }
+ forrest.add(tree);
+ }
+
+ private static Node mergeTrees(Node n1, Node n2) {
+ Node merge = new Node(null, "merge");
+ merge.append(n1);
+ mergeTreeIntoForrest(merge.value(), n2);
+ return (merge.children().size() == 1) ? merge.children().get(0) :
+ merge;
+ }
+
@Parameters
public static Map<String, Object[]> generateTests() {
String type = TestPackagesBasics.pm.getType();
String arch = (new Shell()).exec("uname -m").getOut().get(0).replaceAll(/i.86/,"i386").replaceAll(/x86_64/,"amd64");
String archTranslated = (type == "apt") ? "" : ((arch == "amd64") ? ".x86_64" : ".${arch}");
- def config = new XmlParser().parse(TestPackagesBasics.class.getClassLoader().
- getResourceAsStream("package_data_${type}.xml"));
+ def config = mergeTrees(new XmlParser().parse(TestPackagesBasics.class.getClassLoader().
+ getResourceAsStream("package_data.xml")),
+ new XmlParser().parse(TestPackagesBasics.class.getClassLoader().
+ getResourceAsStream("${type}/package_data.xml")));
Map<String, Object[]> res = [:];
@@ -92,7 +119,13 @@ class TestPackagesBasics extends Package
}
if (name != null && (name =~ selectedTests).find() && !(name =~ skippedTests).find()) {
- res[name] = ([name, it] as Object[]);
+ def strm = TestPackagesBasics.class.getClassLoader().getResourceAsStream("${type}/${name}.xml");
+ if (strm) {
+ Node manifest = mergeTrees(it, new XmlParser().parse(strm));
+ res[name] = ([name, manifest] as Object[]);
+ } else {
+ res[name] = ([name, it] as Object[]);
+ }
}
};
Copied: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/apt/package_data.xml (from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_apt.xml)
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/apt/package_data.xml?p2=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/apt/package_data.xml&p1=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_apt.xml&r1=1297294&r2=1298208&rev=1298208&view=diff
==============================================================================
(empty)
Added: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml?rev=1298208&view=auto
==============================================================================
--- incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml (added)
+++ incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml Wed Mar 7 23:28:34 2012
@@ -0,0 +1,19 @@
+<?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.
+-->
+<packages>
+</packages>
Copied: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/urpmi/package_data.xml (from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_urpmi.xml)
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/urpmi/package_data.xml?p2=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/urpmi/package_data.xml&p1=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_urpmi.xml&r1=1297294&r2=1298208&rev=1298208&view=diff
==============================================================================
(empty)
Copied: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/yum/package_data.xml (from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_yum.xml)
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/yum/package_data.xml?p2=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/yum/package_data.xml&p1=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_yum.xml&r1=1297294&r2=1298208&rev=1298208&view=diff
==============================================================================
(empty)
Copied: incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/zypper/package_data.xml (from r1297294, incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_zypper.xml)
URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/zypper/package_data.xml?p2=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/zypper/package_data.xml&p1=incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data_zypper.xml&r1=1297294&r2=1298208&rev=1298208&view=diff
==============================================================================
(empty)