Author: rvs
Date: Thu Jun 21 18:19:49 2012
New Revision: 1352642
URL: http://svn.apache.org/viewvc?rev=1352642&view=rev
Log:
BIGTOP-596. move service configuration from groovy code to package xml manifest
file (Johnny Zhang via rvs)
Modified:
incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Service.groovy
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/StateVerifierHBase.groovy
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHDFS.groovy
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml
Modified:
incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Service.groovy
URL:
http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Service.groovy?rev=1352642&r1=1352641&r2=1352642&view=diff
==============================================================================
---
incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Service.groovy
(original)
+++
incubator/bigtop/trunk/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Service.groovy
Thu Jun 21 18:19:49 2012
@@ -63,6 +63,16 @@ class Service {
}
/**
+ * init a System V service via a service(8)
+ *
+ * @return exit code of a service(8) call
+ */
+ public int init() {
+ shRoot.exec("service $svc_name init");
+ return shRoot.ret;
+ }
+
+ /**
* Get a status of a System V service via a service(8)
*
* @return an output of a service(8) call
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=1352642&r1=1352641&r2=1352642&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
Thu Jun 21 18:19:49 2012
@@ -134,6 +134,8 @@ class PackageTestCommon {
String name = svc.getName();
Map runlevels = [:];
+ configService(svc, svc_metadata);
+
// TODO: this should really be taken care of by the matcher
svc.getRunLevels().each {
runlevels[it] = it;
@@ -191,6 +193,36 @@ class PackageTestCommon {
}
}
+ private void configService(Service svc, Map svc_metadata) {
+ Shell shRoot = new Shell("/bin/bash", "root");
+ if (svc_metadata.config != null) {
+ def config = svc_metadata.config;
+ def configfile = svc_metadata.config.configfile;
+
+ def configcontent = "";
+ def property = new TreeMap(config.property);
+ property.keySet().eachWithIndex() {
+ v,j ->
+ configcontent = configcontent + "<property>";
+ property.get(v).eachWithIndex() {
+ obj, i ->
+ if(obj.toString().contains("name")) {
+ configcontent = configcontent + "<name>" + obj.toString()[5..-1]
+ "</name>";
+ } else {
+ configcontent = configcontent + "<value>" +
obj.toString()[6..-1] + "</value>";
+ }
+ };
+ configcontent = configcontent + "</property>";
+ };
+
+ shRoot.exec("""sed -e '/\\/configuration/i \\ $configcontent'
$configfile > temp.xml
+ mv temp.xml $configfile""");
+ }
+ if (svc_metadata.init != null) {
+ svc.init();
+ }
+ }
+
public void checkUsers(Map expectedUsers) {
UGI ugi = new UGI();
Modified:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHBase.groovy
URL:
http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHBase.groovy?rev=1352642&r1=1352641&r2=1352642&view=diff
==============================================================================
---
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHBase.groovy
(original)
+++
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHBase.groovy
Thu Jun 21 18:19:49 2012
@@ -23,16 +23,6 @@ import java.security.MessageDigest
class StateVerifierHBase extends StateVerifier {
static Shell shHBase = new Shell('hbase shell');
- public boolean config() {
- Shell shRoot = new Shell("/bin/bash", "root");
- return 0 == shRoot.exec("""echo '<configuration>
- <property>
- <name>hbase.rootdir</name>
- <value>hdfs://localhost/hbase</value>
- </property>
- </configuration>' >
/etc/hbase/conf/hbase-site.xml""").getRet();
- }
-
public static void createStaticState() {
shHBase.exec("create 't1', 'f1'",
"put 't1', 'r1', 'f1:q', 'val'",
Modified:
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHDFS.groovy
URL:
http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHDFS.groovy?rev=1352642&r1=1352641&r2=1352642&view=diff
==============================================================================
---
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHDFS.groovy
(original)
+++
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/StateVerifierHDFS.groovy
Thu Jun 21 18:19:49 2012
@@ -55,11 +55,6 @@ class StateVerifierHDFS extends StateVer
return (Arrays.equals(digest, MD5.digest()));
} */
- public boolean config() {
- Shell shRoot = new Shell("/bin/bash", "root");
- return 0 == shRoot.exec("sed -i -e
's#<configuration>\$#<configuration><property><name>dfs.safemode.min.datanodes</name><value>1</value></property><property><name>dfs.safemode.extension</name><value>0</value></property>#'
/etc/hadoop/conf/hdfs-site.xml").getRet();
- }
-
public static void createStaticState() {
sh.exec("hadoop fs -put <(echo StateHDFSVErifier) /StateHDFSVErifier");
}
Modified:
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=1352642&r1=1352641&r2=1352642&view=diff
==============================================================================
---
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml
(original)
+++
incubator/bigtop/trunk/bigtop-tests/test-artifacts/package/src/main/resources/package_data.xml
Thu Jun 21 18:19:49 2012
@@ -319,6 +319,7 @@ server.</description>
<runlevel>2</runlevel><runlevel>3</runlevel><runlevel>4</runlevel><runlevel>5</runlevel>
<oninstall>start</oninstall>
<configured>true</configured>
+ <init>true</init>
</zookeeper-server>
</services>
</zookeeper-server>
@@ -487,6 +488,13 @@ server.</description>
<runlevel>2</runlevel><runlevel>3</runlevel><runlevel>4</runlevel><runlevel>5</runlevel>
<oninstall>start</oninstall>
<configured>true</configured>
+ <config>
+ <configfile>/etc/hbase/conf/hbase-site.xml</configfile>
+ <property>
+ <name>hbase.rootdir</name>
+ <value>hdfs://localhost/hbase</value>
+ </property>
+ </config>
</hbase-master>
</services>
</hbase-master>
@@ -681,6 +689,7 @@ namenode, which manages the block locati
<runlevel>2</runlevel><runlevel>3</runlevel><runlevel>4</runlevel><runlevel>5</runlevel>
<oninstall>stop</oninstall>
<configured>false</configured>
+ <init>true</init>
</hadoop-hdfs-namenode>
</services>
</hadoop-hdfs-namenode>