You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by db...@apache.org on 2015/02/12 06:48:51 UTC
[5/5] bigtop git commit: BIGTOP-1601. cleanup whitespaces across
test-artifacts
BIGTOP-1601. cleanup whitespaces across test-artifacts
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/3e17db89
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/3e17db89
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/3e17db89
Branch: refs/heads/master
Commit: 3e17db895a0a4bdeacec6c0097e3be0cd93d49e0
Parents: bb86afb
Author: Dasha <da...@wandisco.com>
Authored: Wed Feb 11 22:13:35 2015 -0800
Committer: Dasha <da...@wandisco.com>
Committed: Wed Feb 11 22:13:35 2015 -0800
----------------------------------------------------------------------
.../org/apache/bigtop/itest/Contract.java | 1 +
.../org/apache/bigtop/itest/JUnitUtils.groovy | 32 +-
.../org/apache/bigtop/itest/JarContent.groovy | 26 +-
.../apache/bigtop/itest/LogErrorsUtils.groovy | 10 +-
.../apache/bigtop/itest/ParameterSetter.java | 60 +--
.../org/apache/bigtop/itest/Property.java | 19 +-
.../apache/bigtop/itest/TestListUtils.groovy | 2 +-
.../org/apache/bigtop/itest/TestUtils.groovy | 6 +-
.../org/apache/bigtop/itest/Variable.java | 11 +-
.../itest/failures/AbstractFailure.groovy | 7 +-
.../itest/failures/FailureExecutor.groovy | 9 +-
.../bigtop/itest/failures/FailureVars.groovy | 17 +-
.../failures/NetworkShutdownFailure.groovy | 7 +-
.../itest/failures/ServiceKilledFailure.groovy | 3 +-
.../itest/failures/ServiceRestartFailure.groovy | 3 +-
.../itest/junit/OrderedParameterized.java | 211 ++++----
.../pmanager/AptCmdLinePackageManager.groovy | 16 +-
.../bigtop/itest/pmanager/DEBPackage.groovy | 2 +-
.../itest/pmanager/PackageInstance.groovy | 4 +-
.../bigtop/itest/pmanager/PackageManager.groovy | 60 +--
.../bigtop/itest/pmanager/RPMPackage.groovy | 8 +-
.../pmanager/UrpmiCmdLinePackageManager.groovy | 6 +-
.../pmanager/YumCmdLinePackageManager.groovy | 8 +-
.../pmanager/ZypperCmdLinePackageManager.groovy | 6 +-
.../bigtop/itest/posix/Alternative.groovy | 75 +--
.../org/apache/bigtop/itest/posix/UGI.groovy | 22 +-
.../apache/bigtop/itest/shell/JUnitShell.groovy | 4 +-
.../org/apache/bigtop/itest/shell/OS.groovy | 6 +-
.../org/apache/bigtop/itest/shell/Shell.groovy | 27 +-
.../apache/bigtop/itest/JUnitUtilsTest.groovy | 12 +-
.../apache/bigtop/itest/JarContentTest.groovy | 9 +-
.../bigtop/itest/TestContractGroovy.groovy | 32 +-
.../apache/bigtop/itest/TestContractJava.java | 99 ++--
.../bigtop/itest/TestContractJavaProc.java | 103 ++--
.../bigtop/itest/TestListUtilsTest.groovy | 2 +-
.../IntegrationTestClusterFailures.groovy | 6 +-
.../itest/junit/OrderedParameterizedTest.groovy | 6 +-
.../bigtop/itest/junit/OrderedTest.groovy | 6 +-
.../itest/pmanager/PackageManagerTest.groovy | 22 +-
.../bigtop/itest/posix/AlternativeTest.groovy | 6 +-
.../bigtop/itest/posix/ServiceTest.groovy | 4 +-
.../apache/bigtop/itest/posix/UGITest.groovy | 4 +-
.../itest/crunchsmoke/TestCrunchSmoke.groovy | 22 +-
.../itest/flumesmoke/TestFlumeSmoke.groovy | 14 +-
.../resources/FlumeSmokeBzip2/flume-site.xml | 2 +-
.../resources/FlumeSmokeDeflate/flume-site.xml | 2 +-
.../resources/FlumeSmokeGzip/flume-site.xml | 2 +-
.../itest/giraphsmoke/TestGiraphSmoke.groovy | 40 +-
.../bigtop/itest/hadoop/hcfs/TestCLI.java | 4 +-
.../itest/hadoop/hcfs/TestFuseHCFS.groovy | 216 ++++----
.../itest/hadoop/hdfs/TestBlockRecovery.groovy | 10 +-
.../itest/hadoop/hdfs/TestDFSAdmin.groovy | 44 +-
.../bigtop/itest/hadoop/hdfs/TestDFSCLI.java | 2 +-
.../itest/hadoop/hdfs/TestDistCpIntra.groovy | 28 +-
.../itest/hadoop/hdfs/TestFileAppend.groovy | 38 +-
.../bigtop/itest/hadoop/hdfs/TestFsck.groovy | 2 +-
.../itest/hadoop/hdfs/TestHDFSBalancer.groovy | 14 +-
.../itest/hadoop/hdfs/TestHDFSQuota.groovy | 86 ++--
.../itest/hadoop/hdfs/TestTextSnappy.groovy | 6 +-
.../hadoop/mapreduce/TestHadoopExamples.groovy | 92 ++--
.../hadoop/mapreduce/TestHadoopSmoke.groovy | 10 +-
.../bigtop/itest/hadoop/yarn/TestNode.groovy | 10 +-
.../bigtop/itest/hadoop/yarn/TestRmAdmin.groovy | 12 +-
.../itest/hbase/smoke/IncrementalPELoad.java | 21 +-
.../bigtop/itest/hbase/smoke/TestCopyTable.java | 13 +-
.../itest/hbase/smoke/TestHBaseBalancer.groovy | 4 +-
.../hbase/smoke/TestHBaseCompression.groovy | 8 +-
.../hbase/smoke/TestHBaseImportExport.groovy | 2 +-
.../itest/hbase/smoke/TestHBasePigSmoke.groovy | 38 +-
.../itest/hbase/smoke/TestHBaseSmoke.java | 2 +-
.../hbase/smoke/TestHFileOutputFormat.java | 27 +-
.../itest/hbase/smoke/TestImportTsv.groovy | 14 +-
.../hbase/smoke/TestLoadIncrementalHFiles.java | 24 +-
.../bigtop/itest/hbase/system/Putter.java | 10 +-
.../bigtop/itest/hbase/system/Scanner.java | 14 +-
.../hbase/system/TestConcurrentScanAndPut.java | 46 +-
.../itest/hbase/system/TestLoadAndVerify.java | 89 ++--
.../hbase/system/TestMoveRootMetaRegions.java | 61 +--
.../itest/hbase/system/TestRegionMover.java | 23 +-
.../bigtop/itest/hbase/util/HBaseTestUtil.java | 21 +-
.../hcatalogsmoke/TestHcatalogBasic.groovy | 5 +-
.../bigtop/itest/httpfs/TestHttpFs.groovy | 220 ++++----
.../bigtop/itest/huesmoke/TestHueSmoke.groovy | 20 +-
.../bigtop/itest/iolongevity/TestDFSIO.groovy | 10 +-
.../bigtop/itest/iolongevity/TestSLive.groovy | 48 +-
.../mahout/smoke/TestMahoutExamples.groovy | 496 +++++++++----------
.../itest/ooziesmoke/TestOozieSmoke.groovy | 48 +-
.../bigtop/itest/packagesmoke/BTServices.groovy | 132 ++---
.../packagesmoke/CDHUpgradeSequence.groovy | 6 +-
.../bigtop/itest/packagesmoke/DeployCDH.groovy | 118 ++---
.../itest/packagesmoke/PackageTestCommon.groovy | 219 ++++----
.../packagesmoke/PackageTestErrorProxy.java | 10 +-
.../packagesmoke/PackageTestRepoMgr.groovy | 18 +-
.../itest/packagesmoke/StateVerifier.groovy | 1 +
.../packagesmoke/StateVerifierFlume.groovy | 14 +-
.../packagesmoke/StateVerifierHBase.groovy | 8 +-
.../itest/packagesmoke/StateVerifierHue.groovy | 6 +-
.../packagesmoke/StateVerifierOozie.groovy | 2 +-
.../packagesmoke/StateVerifierSqoop.groovy | 2 +-
.../packagesmoke/StateVerifierZookeeper.groovy | 4 +-
.../packagesmoke/TestPackagesBasics.groovy | 79 +--
.../TestPackagesBasicsWithRM.groovy | 2 +-
.../TestPackagesPseudoDistributed.groovy | 6 +-
...stPackagesPseudoDistributedDependency.groovy | 6 +-
...PackagesPseudoDistributedFileContents.groovy | 6 +-
...TestPackagesPseudoDistributedServices.groovy | 6 +-
.../TestPackagesPseudoDistributedState.groovy | 4 +-
.../TestPackagesPseudoDistributedUpgrade.groovy | 10 +-
.../TestPackagesPseudoDistributedWithRM.groovy | 5 +-
.../itest/packagesmoke/TestServices.groovy | 18 +-
.../packagesmoke/TestServicesCreateState.groovy | 4 +-
.../TestServicesCreateStateMissing.groovy | 2 +-
.../packagesmoke/TestServicesVerifyState.groovy | 2 +-
.../itest/phoenix/smoke/TestPhoenixSmoke.groovy | 13 +-
.../bigtop/itest/solr/smoke/SolrTestBase.groovy | 2 +-
.../bigtop/itest/solr/smoke/TestIndexing.groovy | 2 +-
.../bigtop/itest/solr/smoke/TestPing.groovy | 1 +
.../bigtop/itest/solr/smoke/TestSimple.groovy | 4 +-
.../itest/solr/smoke/TestStatistics.groovy | 5 +-
.../bigtop/itest/spark/TestSparkSmoke.groovy | 10 +-
.../sqoop/IntegrationTestSqoopHBase.groovy | 11 +-
.../sqoop/IntegrationTestSqoopHive.groovy | 6 +-
.../bigtop/itest/sqoop/TestSqoopExport.groovy | 28 +-
.../bigtop/itest/sqoop/TestSqoopImport.groovy | 67 ++-
124 files changed, 1901 insertions(+), 1837 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Contract.java
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Contract.java b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Contract.java
index 1a79df2..31be813 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Contract.java
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Contract.java
@@ -35,5 +35,6 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE)
public @interface Contract {
Variable[] env();
+
Property[] properties();
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JUnitUtils.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JUnitUtils.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JUnitUtils.groovy
index 4433d7d..c7bcd0f 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JUnitUtils.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JUnitUtils.groovy
@@ -32,23 +32,23 @@ public class JUnitUtils {
*/
static boolean executeTests(Class... testClasses) {
def ant = new AntBuilder()
- def res = ant.junit (printsummary:'yes', fork:'yes', forkmode:'once',
- errorproperty: DETECT_ERRORS, failureproperty: DETECT_FAILS) {
- System.getProperties().each { k, v ->
- sysproperty(key: k, value: v)
- }
- classpath {
- System.getProperty('java.class.path').
- split(System.getProperty('path.separator',':')).each {
- pathelement(location: it);
- }
- }
- testClasses.each {
- test(name: it.getName(), todir: System.getProperty(RESULTS_DIR, '.'));
- }
- formatter(type:'xml');
+ def res = ant.junit(printsummary: 'yes', fork: 'yes', forkmode: 'once',
+ errorproperty: DETECT_ERRORS, failureproperty: DETECT_FAILS) {
+ System.getProperties().each { k, v ->
+ sysproperty(key: k, value: v)
+ }
+ classpath {
+ System.getProperty('java.class.path').
+ split(System.getProperty('path.separator', ':')).each {
+ pathelement(location: it);
+ }
+ }
+ testClasses.each {
+ test(name: it.getName(), todir: System.getProperty(RESULTS_DIR, '.'));
+ }
+ formatter(type: 'xml');
}
return !(ant.project.getProperty(DETECT_FAILS) == "true" ||
- ant.project.getProperty(DETECT_ERRORS) == "true");
+ ant.project.getProperty(DETECT_ERRORS) == "true");
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JarContent.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JarContent.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JarContent.groovy
index d376482..59edb40 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JarContent.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/JarContent.groovy
@@ -96,7 +96,8 @@ public abstract class JarContent {
* @param filters list of patterns
* @return filtered-out list of entries
*/
- def static List<String> applyExcludeFilter(final List<String> list, final List<String> filters) {
+ def static List<String> applyExcludeFilter(
+ final List<String> list, final List<String> filters) {
List<String> filtered = list.asList();
ArrayList<String> toRemove = new ArrayList<String>();
@@ -155,10 +156,10 @@ public abstract class JarContent {
public static String getJarName(String baseDir, String namePattern) {
try {
return new File(baseDir).list(
- [accept: {d, f -> f ==~ /$namePattern/ }] as FilenameFilter
+ [accept: { d, f -> f ==~ /$namePattern/ }] as FilenameFilter
).toList().get(0);
} catch (java.lang.IndexOutOfBoundsException ioob) {
- LOG.error ("No $namePattern has been found under $baseDir. Check your installation.");
+ LOG.error("No $namePattern has been found under $baseDir. Check your installation.");
} catch (java.lang.NullPointerException npe) {
LOG.error("No $baseDir exists. Check your installation.");
}
@@ -173,23 +174,23 @@ public abstract class JarContent {
* @param includes
* @throws IOException if can't find class' jar file in the classpath
*/
- public static void unpackJarContainer (Class ref,
- String destination, String includes) throws IOException {
+ public static void unpackJarContainer(Class ref,
+ String destination, String includes) throws IOException {
URL connection = JarContent.getJarURL(ref);
if (connection == null) {
throw new IOException("Class " + ref.getSimpleName() +
- " doesn't belong to any jar file in the classpath");
+ " doesn't belong to any jar file in the classpath");
}
ZipInputStream fis =
new ZipInputStream(connection.openConnection().getInputStream());
- fis.unzip (destination, includes);
+ fis.unzip(destination, includes);
}
- public static unpackJarContainer (String className,
- String destination, String includes) throws IOException {
+ public static unpackJarContainer(String className,
+ String destination, String includes) throws IOException {
Class cl = Class.forName(className)
- unpackJarContainer (cl, destination, includes)
+ unpackJarContainer(cl, destination, includes)
}
private static void bootstrapPlugins() {
@@ -217,7 +218,7 @@ public abstract class JarContent {
if (!entry.isDirectory()) {
new File(dest + File.separator + entry.name).parentFile?.mkdirs()
def output = new FileOutputStream(dest + File.separator
- + entry.name)
+ + entry.name)
output.withStream {
int len;
byte[] buffer = new byte[4096]
@@ -225,8 +226,7 @@ public abstract class JarContent {
output.write(buffer, 0, len);
}
}
- }
- else {
+ } else {
new File(dest + File.separator + entry.name).mkdir()
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/LogErrorsUtils.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/LogErrorsUtils.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/LogErrorsUtils.groovy
index 6f46935..480c4ff 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/LogErrorsUtils.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/LogErrorsUtils.groovy
@@ -22,12 +22,12 @@ import org.apache.bigtop.itest.shell.Shell
public class LogErrorsUtils {
- static void logError (final Shell sh) {
+ static void logError(final Shell sh) {
if (sh.getRet()) {
- println ('Failed command: ' + sh.script);
- println ('\terror code: ' + sh.getRet());
- println ('\tstdout: ' + sh.getOut());
- println ('\tstderr: ' + sh.getErr());
+ println('Failed command: ' + sh.script);
+ println('\terror code: ' + sh.getRet());
+ println('\tstdout: ' + sh.getOut());
+ println('\tstderr: ' + sh.getErr());
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/ParameterSetter.java
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/ParameterSetter.java b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/ParameterSetter.java
index 2930f19..7fa03f2 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/ParameterSetter.java
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/ParameterSetter.java
@@ -41,6 +41,7 @@ public class ParameterSetter {
* with a digit.)
* If an environment variable is required and it is not set, an
* AssertionError is thrown.
+ *
* @param target the test class
* @throws NoSuchFieldException
* @throws IllegalAccessException
@@ -68,10 +69,11 @@ public class ParameterSetter {
* names.
* If an environment variable is required and it is not set, an
* AssertionError is thrown.
- * @param target the test class
+ *
+ * @param target the test class
* @param fieldNames the names of the static fields corresponding to the
- * environment variables; the number of names must match the number of
- * environment variables
+ * environment variables; the number of names must match the number of
+ * environment variables
* @throws NoSuchFieldException
* @throws IllegalAccessException
*/
@@ -103,6 +105,7 @@ public class ParameterSetter {
* If a system property is not set, the parameter is set to a default value.
* Therefore usable default values must be provided in the annotation or else
* test logic must be written to handle the lack thereof.
+ *
* @param target the test class
* @throws NoSuchFieldException
* @throws IllegalAccessException
@@ -117,17 +120,17 @@ public class ParameterSetter {
Field field = target.getDeclaredField(name.replace('.', '_'));
Object value = null;
switch (prop.type()) {
- case STRING:
- value = System.getProperty(name, prop.defaultValue());
- break;
- case INT:
- value = Integer.getInteger(name, prop.intValue());
- break;
- case LONG:
- value = Long.getLong(name, prop.longValue());
- break;
- case BOOLEAN:
- value = Boolean.getBoolean(name);
+ case STRING:
+ value = System.getProperty(name, prop.defaultValue());
+ break;
+ case INT:
+ value = Integer.getInteger(name, prop.intValue());
+ break;
+ case LONG:
+ value = Long.getLong(name, prop.longValue());
+ break;
+ case BOOLEAN:
+ value = Boolean.getBoolean(name);
}
field.setAccessible(true);
field.set(target, value);
@@ -141,10 +144,11 @@ public class ParameterSetter {
* If a system property is not set, the parameter is set to a default value.
* Therefore usable default values must be provided in the annotation or else
* test logic must be written to handle the lack thereof.
- * @param target the test class
+ *
+ * @param target the test class
* @param fieldNames the names of the static fields corresponding to the
- * system properties; the number of names must match the number of
- * system properties
+ * system properties; the number of names must match the number of
+ * system properties
* @throws NoSuchFieldException
* @throws IllegalAccessException
*/
@@ -159,17 +163,17 @@ public class ParameterSetter {
Field field = target.getDeclaredField(fieldNames[i]);
Object value = null;
switch (prop.type()) {
- case STRING:
- value = System.getProperty(name, prop.defaultValue());
- break;
- case INT:
- value = Integer.getInteger(name, prop.intValue());
- break;
- case LONG:
- value = Long.getLong(name, prop.longValue());
- break;
- case BOOLEAN:
- value = Boolean.getBoolean(name);
+ case STRING:
+ value = System.getProperty(name, prop.defaultValue());
+ break;
+ case INT:
+ value = Integer.getInteger(name, prop.intValue());
+ break;
+ case LONG:
+ value = Long.getLong(name, prop.longValue());
+ break;
+ case BOOLEAN:
+ value = Boolean.getBoolean(name);
}
field.setAccessible(true);
field.set(target, value);
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Property.java
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Property.java b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Property.java
index 19cd657..f10a0d3 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Property.java
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Property.java
@@ -21,21 +21,26 @@ package org.apache.bigtop.itest;
import java.lang.annotation.Documented;
/**
- Specifies a parameter to be passed into a test via a system property.
- The parameter may be a String, an int, a long, or a boolean. If the type
- of the parameter is not specified, it defaults to String.
- A default value (String value, int value, long value) may be specified
- for the parameter if its type is not boolean; the default value of a
- boolean parameter is false.
-*/
+ * Specifies a parameter to be passed into a test via a system property.
+ * The parameter may be a String, an int, a long, or a boolean. If the type
+ * of the parameter is not specified, it defaults to String.
+ * A default value (String value, int value, long value) may be specified
+ * for the parameter if its type is not boolean; the default value of a
+ * boolean parameter is false.
+ */
@Documented
public @interface Property {
public static enum Type {
STRING, INT, LONG, BOOLEAN;
}
+
String name();
+
Type type() default Type.STRING;
+
String defaultValue() default "";
+
int intValue() default 0;
+
long longValue() default 0L;
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestListUtils.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestListUtils.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestListUtils.groovy
index 7b762d1..c716486 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestListUtils.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestListUtils.groovy
@@ -33,7 +33,7 @@ public class TestListUtils {
}
List<String> pathArray = pathName.split(FS).toList();
- def prefix = "";
+ def prefix = "";
if (dirPrefix != null)
prefix = dirPrefix;
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy
index f4bc247..b513681 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/TestUtils.groovy
@@ -40,7 +40,7 @@ public class TestUtils {
*/
public static void unpackTestResources(Class ref, String inputDir, String[] inputFiles, String outputDir) {
// Unpack resource
- JarContent.unpackJarContainer(ref, '.' , null);
+ JarContent.unpackJarContainer(ref, '.', null);
// create input dir in HDFS
if (inputDir != null) {
@@ -48,7 +48,7 @@ public class TestUtils {
if (sh.getRet() == 0) {
sh.exec("hadoop fs -rmr -skipTrash ${inputDir}");
assertTrue("Deletion of previous $inputDir from the DFS failed",
- sh.getRet() == 0);
+ sh.getRet() == 0);
}
if (inputFiles != null) {
sh.exec("hadoop fs -mkdir -p ${inputDir}");
@@ -71,7 +71,7 @@ public class TestUtils {
if (sh.getRet() == 0) {
sh.exec("hadoop fs -rmr -skipTrash ${outputDir}");
assertTrue("Deletion of previous examples output from the DFS failed",
- sh.getRet() == 0);
+ sh.getRet() == 0);
}
sh.exec("hadoop fs -mkdir -p ${outputDir}");
assertTrue("Could not create output directory in DFS", sh.getRet() == 0);
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Variable.java
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Variable.java b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Variable.java
index 5753a7c..ff5a084 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Variable.java
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/Variable.java
@@ -21,13 +21,14 @@ package org.apache.bigtop.itest;
import java.lang.annotation.Documented;
/**
- Specifies a parameter to be passed into a test via an environment variable.
- The parameter is a String.
- By default, the parameter is required. If it is required and a non-null value
- cannot be found for it, an error may be thrown.
-*/
+ * Specifies a parameter to be passed into a test via an environment variable.
+ * The parameter is a String.
+ * By default, the parameter is required. If it is required and a non-null value
+ * cannot be found for it, an error may be thrown.
+ */
@Documented
public @interface Variable {
String name();
+
boolean required() default true;
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/AbstractFailure.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/AbstractFailure.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/AbstractFailure.groovy
index f88358f..0505d7f 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/AbstractFailure.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/AbstractFailure.groovy
@@ -101,20 +101,19 @@ public abstract class AbstractFailure implements Runnable {
@Override
public void run() {
try {
- if(failureDelay > 0) {
+ if (failureDelay > 0) {
try {
Thread.sleep(failureDelay)
} catch (InterruptedException e) {
return
}
}
- if(FailureVars.instance.getServiceRestart().equals("true")
+ if (FailureVars.instance.getServiceRestart().equals("true")
|| FailureVars.instance.getServiceKill().equals("true")
|| FailureVars.instance.getNetworkShutdown().equals("true")) {
runFailCommands()
Thread.sleep(FailureVars.instance.getKillDuration())
- }
- else {
+ } else {
if (failureDelay > 0) {
try {
Thread.sleep(failureDelay)
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
index daad092..7471186 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureExecutor.groovy
@@ -31,15 +31,16 @@ public class FailureExecutor implements Runnable {
if (startDelay > 0) {
try {
Thread.sleep(startDelay)
- } catch (InterruptedException e) {}
+ } catch (InterruptedException e) {
+ }
}
- if(restart != null && restart.equals("true")) {
+ if (restart != null && restart.equals("true")) {
serviceRestartExec();
}
- if(kill != null && kill.equals("true")) {
+ if (kill != null && kill.equals("true")) {
serviceKillExec();
}
- if(shutdown != null && shutdown.equals("true")) {
+ if (shutdown != null && shutdown.equals("true")) {
networkShutdownExec();
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
index 6851337..9e9528c 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/FailureVars.groovy
@@ -50,13 +50,13 @@ public class FailureVars {
}
protected FailureVars() {
- if(propertyFile != null) {
+ if (propertyFile != null) {
loadProps();
}
}
public static FailureVars getInstance() {
- if(instance == null) {
+ if (instance == null) {
instance = new FailureVars();
}
return instance;
@@ -65,8 +65,8 @@ public class FailureVars {
private void loadProps() {
try {
File pFile = new File(propertyFile);
- assert(pFile.exists()) : "Failure properties file cannot be read";
- BufferedReader is = new BufferedReader (new InputStreamReader(getClass(pFile)));
+ assert (pFile.exists()): "Failure properties file cannot be read";
+ BufferedReader is = new BufferedReader(new InputStreamReader(getClass(pFile)));
System.out.println("Input Stream Location: " + is);
Properties props = new Properties();
props.load(is);
@@ -82,7 +82,7 @@ public class FailureVars {
startDelay = Long.parseLong(props.getProperty("startdelay"));
killDuration = Long.parseLong(props.getProperty("killduration"));
}
- catch(IOException ioe) {
+ catch (IOException ioe) {
System.out.println(ioe.getMessage());
}
}
@@ -124,8 +124,9 @@ public class FailureVars {
}
public long getKillDuration() {
- return killDuration*1000;
+ return killDuration * 1000;
}
+
public String getTestHost() {
return testHost;
}
@@ -139,7 +140,7 @@ public class FailureVars {
}
public long getStartDelay() {
- return startDelay*1000;
+ return startDelay * 1000;
}
@@ -160,7 +161,7 @@ public class FailureVars {
}
public long getFailureDelay() {
- return failureDelay*1000;
+ return failureDelay * 1000;
}
int getSleepTime() {
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/NetworkShutdownFailure.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/NetworkShutdownFailure.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/NetworkShutdownFailure.groovy
index 15bf797..c3483c2 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/NetworkShutdownFailure.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/NetworkShutdownFailure.groovy
@@ -48,8 +48,8 @@ public class NetworkShutdownFailure extends AbstractFailure {
* @param startDelay time in milliseconds) the failures will wait before start
*/
public NetworkShutdownFailure(String srcHost,
- List<String> dstHosts,
- long startDelay) {
+ List<String> dstHosts,
+ long startDelay) {
super(new ArrayList<String>(), startDelay)
populateCommandsList(srcHost, dstHosts)
@@ -58,7 +58,8 @@ public class NetworkShutdownFailure extends AbstractFailure {
/*
* Populate commands list, making choice between local execution and remote one.
*/
- private void populateCommandsList(String host, List<String> dstHosts){
+
+ private void populateCommandsList(String host, List<String> dstHosts) {
if ("localhost".equalsIgnoreCase(host)) {
dstHosts.each { dstHost ->
failCommands.add(String.format(DROP_INPUT_CONNECTIONS, dstHost))
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceKilledFailure.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceKilledFailure.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceKilledFailure.groovy
index 413f171..2e31448 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceKilledFailure.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceKilledFailure.groovy
@@ -55,7 +55,8 @@ public class ServiceKilledFailure extends AbstractFailure {
/*
* Populate commands list, making choice between local execution and remote one.
*/
- private void populateCommandsList(List<String> hosts, String serviceName){
+
+ private void populateCommandsList(List<String> hosts, String serviceName) {
if (hosts.size() == 1 && "localhost".equalsIgnoreCase(hosts[0])) {
failCommands.add(String.format(KILL_SERVICE_TEMPLATE, serviceName))
restoreCommands.add(String.format(START_SERVICE_TEMPLATE, serviceName))
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceRestartFailure.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceRestartFailure.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceRestartFailure.groovy
index 6dd1005..213a067 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceRestartFailure.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/failures/ServiceRestartFailure.groovy
@@ -55,7 +55,8 @@ public class ServiceRestartFailure extends AbstractFailure {
/*
* Populate commands list, making choice between local execution and remote one.
*/
- private void populateCommandsList(List<String> hosts, String serviceName){
+
+ private void populateCommandsList(List<String> hosts, String serviceName) {
if (hosts.size() == 1 && "localhost".equalsIgnoreCase(hosts[0])) {
failCommands.add(String.format(STOP_SERVICE_TEMPLATE, serviceName))
restoreCommands.add(String.format(START_SERVICE_TEMPLATE, serviceName))
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/junit/OrderedParameterized.java
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/junit/OrderedParameterized.java b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/junit/OrderedParameterized.java
index f86b22d..8df776f 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/junit/OrderedParameterized.java
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/junit/OrderedParameterized.java
@@ -36,15 +36,15 @@ import java.lang.reflect.Modifier;
import java.util.*;
/**
- * This is a modification of a Parameterized JUnit runner (which has been relicensed
+ * This is a modification of a Parameterized JUnit runner (which has been relicensed
* under APL for this very hack BIGTOP-18) that takes care of two things:
- * 1. it lets arrange individual tests into ordered sequence of run stages via adding a
- * a @RunStage(level=X) annotation to the desired testcases (default run stage
- * is 0). Later on run stages are executed according to the order of their levels
- * and testcases within the same run stage have no guaranteed order of execution.
- * 2. it lets give names to the parameterized testcases via making the factory method
- * @Parameters return a Map (mapping names to testcases) instead of a List.
- *
+ * 1. it lets arrange individual tests into ordered sequence of run stages via adding a
+ * a @RunStage(level=X) annotation to the desired testcases (default run stage
+ * is 0). Later on run stages are executed according to the order of their levels
+ * and testcases within the same run stage have no guaranteed order of execution.
+ * 2. it lets give names to the parameterized testcases via making the factory method
+ * @Parameters return a Map (mapping names to testcases) instead of a List.
+ * <p/>
* Here's how to use it:
* <pre>
* public class Example {
@@ -67,120 +67,121 @@ import java.util.*;
* public static Map<String, Object[]> generateTests() {
* HashMap<String, Object[]> res = new HashMap();
* res.put("test name", new Object[] {1, 2});
- return res;
+ * return res;
* }
* }
* </pre>
- *
*/
public class OrderedParameterized extends Suite {
- /**
- * Annotation for a method which provides parameters to be injected into the
- * test class constructor by <code>Parameterized</code>
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(ElementType.METHOD)
- public @interface RunStage {
- int level() default 0;
- };
-
- private class TestClassRunnerForParameters extends
- BlockJUnit4ClassRunner {
- private final String fParameterSetNumber;
-
- private final Map<String, Object[]> fParameterList;
-
- TestClassRunnerForParameters(Class<?> type,
- Map<String, Object[]> parameterList, String i) throws InitializationError {
- super(type);
- fParameterList= parameterList;
- fParameterSetNumber= i;
- }
-
- @Override
- public Object createTest() throws Exception {
- return getTestClass().getOnlyConstructor().newInstance(
- computeParams());
- }
-
- private Object[] computeParams() throws Exception {
- try {
- return fParameterList.get(fParameterSetNumber);
- } catch (ClassCastException e) {
- throw new Exception(String.format(
- "%s.%s() must return a Map from Strings to arrays.",
- getTestClass().getName(), getParametersMethod(
- getTestClass()).getName()));
- }
- }
-
- @Override
- protected List<FrameworkMethod> getChildren() {
- List<FrameworkMethod> c = super.getChildren();
- Collections.sort(c, new Comparator<FrameworkMethod>() {
- public int compare(FrameworkMethod m1, FrameworkMethod m2) {
- RunStage r1 = m1.getAnnotation(RunStage.class);
- RunStage r2 = m2.getAnnotation(RunStage.class);
- return ((r1 != null) ? r1.level() : 0) -
- ((r2 != null) ? r2.level() : 0);
- }
- });
- return c;
- }
-
- @Override
- protected String getName() {
- return String.format("[%s]", fParameterSetNumber);
- }
-
- @Override
- protected String testName(final FrameworkMethod method) {
- return String.format("%s[%s]", method.getName(),
- fParameterSetNumber);
- }
+ /**
+ * Annotation for a method which provides parameters to be injected into the
+ * test class constructor by <code>Parameterized</code>
+ */
+ @Retention(RetentionPolicy.RUNTIME)
+ @Target(ElementType.METHOD)
+ public @interface RunStage {
+ int level() default 0;
+ }
+
+ ;
+
+ private class TestClassRunnerForParameters extends
+ BlockJUnit4ClassRunner {
+ private final String fParameterSetNumber;
+
+ private final Map<String, Object[]> fParameterList;
+
+ TestClassRunnerForParameters(Class<?> type,
+ Map<String, Object[]> parameterList, String i) throws InitializationError {
+ super(type);
+ fParameterList = parameterList;
+ fParameterSetNumber = i;
+ }
- @Override
- protected void validateConstructor(List<Throwable> errors) {
- validateOnlyOneConstructor(errors);
- }
+ @Override
+ public Object createTest() throws Exception {
+ return getTestClass().getOnlyConstructor().newInstance(
+ computeParams());
+ }
- @Override
- protected Statement classBlock(RunNotifier notifier) {
- return childrenInvoker(notifier);
- }
+ private Object[] computeParams() throws Exception {
+ try {
+ return fParameterList.get(fParameterSetNumber);
+ } catch (ClassCastException e) {
+ throw new Exception(String.format(
+ "%s.%s() must return a Map from Strings to arrays.",
+ getTestClass().getName(), getParametersMethod(
+ getTestClass()).getName()));
+ }
}
- private FrameworkMethod getParametersMethod(TestClass testClass)
- throws Exception {
- List<FrameworkMethod> methods= testClass
- .getAnnotatedMethods(Parameterized.Parameters.class);
- for (FrameworkMethod each : methods) {
- int modifiers= each.getMethod().getModifiers();
- if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
- return each;
+ @Override
+ protected List<FrameworkMethod> getChildren() {
+ List<FrameworkMethod> c = super.getChildren();
+ Collections.sort(c, new Comparator<FrameworkMethod>() {
+ public int compare(FrameworkMethod m1, FrameworkMethod m2) {
+ RunStage r1 = m1.getAnnotation(RunStage.class);
+ RunStage r2 = m2.getAnnotation(RunStage.class);
+ return ((r1 != null) ? r1.level() : 0) -
+ ((r2 != null) ? r2.level() : 0);
}
-
- throw new Exception("No public static parameters method on class "
- + testClass.getName());
+ });
+ return c;
}
- private final ArrayList<Runner> runners= new ArrayList<Runner>();
+ @Override
+ protected String getName() {
+ return String.format("[%s]", fParameterSetNumber);
+ }
@Override
- protected List<Runner> getChildren() {
- return runners;
+ protected String testName(final FrameworkMethod method) {
+ return String.format("%s[%s]", method.getName(),
+ fParameterSetNumber);
}
- @SuppressWarnings("unchecked")
- private Map<String, Object[]> getParametersList(TestClass klass) throws Throwable {
- return (Map<String, Object[]>) getParametersMethod(klass).invokeExplosively(null);
+ @Override
+ protected void validateConstructor(List<Throwable> errors) {
+ validateOnlyOneConstructor(errors);
}
- public OrderedParameterized(Class<?> klass) throws Throwable {
- super(klass, Collections.<Runner>emptyList());
- Map<String, Object[]> parametersMap= getParametersList(getTestClass());
- for (Map.Entry<String, Object[]> entry : parametersMap.entrySet())
- runners.add(new TestClassRunnerForParameters(getTestClass().getJavaClass(),
- parametersMap, entry.getKey()));
+ @Override
+ protected Statement classBlock(RunNotifier notifier) {
+ return childrenInvoker(notifier);
+ }
+ }
+
+ private FrameworkMethod getParametersMethod(TestClass testClass)
+ throws Exception {
+ List<FrameworkMethod> methods = testClass
+ .getAnnotatedMethods(Parameterized.Parameters.class);
+ for (FrameworkMethod each : methods) {
+ int modifiers = each.getMethod().getModifiers();
+ if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
+ return each;
}
+
+ throw new Exception("No public static parameters method on class "
+ + testClass.getName());
+ }
+
+ private final ArrayList<Runner> runners = new ArrayList<Runner>();
+
+ @Override
+ protected List<Runner> getChildren() {
+ return runners;
+ }
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object[]> getParametersList(TestClass klass) throws Throwable {
+ return (Map<String, Object[]>) getParametersMethod(klass).invokeExplosively(null);
+ }
+
+ public OrderedParameterized(Class<?> klass) throws Throwable {
+ super(klass, Collections.<Runner>emptyList());
+ Map<String, Object[]> parametersMap = getParametersList(getTestClass());
+ for (Map.Entry<String, Object[]> entry : parametersMap.entrySet())
+ runners.add(new TestClassRunnerForParameters(getTestClass().getJavaClass(),
+ parametersMap, entry.getKey()));
+ }
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/AptCmdLinePackageManager.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/AptCmdLinePackageManager.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/AptCmdLinePackageManager.groovy
index 49d2145..26fd7fd 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/AptCmdLinePackageManager.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/AptCmdLinePackageManager.groovy
@@ -20,13 +20,13 @@ package org.apache.bigtop.itest.pmanager
class AptCmdLinePackageManager extends PackageManager {
// FIXME: NB export DEBIAN_FRONTEND=noninteractive
- String type = "apt";
+ String type = "apt";
String repository_registry = "/etc/apt/sources.list.d/%s.list";
private static final ROOT_URL = "http://us.archive.ubuntu.com/ubuntu/";
public void setDefaults(String defaults) {
- shRoot.exec("debconf-set-selections <<__EOT__\n${defaults}\n__EOT__");
+ shRoot.exec("debconf-set-selections <<__EOT__\n${defaults}\n__EOT__");
}
// FIXME: Debian doesn't have a way ot passing a full description
@@ -47,11 +47,11 @@ class AptCmdLinePackageManager extends PackageManager {
url = ROOT_URL;
if (key) {
- def text = key.toURL().text;
- shRoot.exec("apt-key add - <<__EOT__\n${text}\n__EOT__");
- if (shRoot.getRet()) {
- return shRoot.getRet();
- }
+ def text = key.toURL().text;
+ shRoot.exec("apt-key add - <<__EOT__\n${text}\n__EOT__");
+ if (shRoot.getRet()) {
+ return shRoot.getRet();
+ }
}
return addBinRepo(record, "deb ${url} ${cookie}\ndeb-src ${url} ${cookie}");
@@ -70,7 +70,7 @@ class AptCmdLinePackageManager extends PackageManager {
public List<PackageInstance> search(String name) {
def packages = new ArrayList<PackageInstance>();
shUser.exec("apt-cache search --names-only $name").out.each {
- packages.add(PackageInstance.getPackageInstance (this, ((it =~ /^(.*)( - .*)$/)[0][1])))
+ packages.add(PackageInstance.getPackageInstance(this, ((it =~ /^(.*)( - .*)$/)[0][1])))
}
return packages
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/DEBPackage.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/DEBPackage.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/DEBPackage.groovy
index 6ddd0c4..bdda7cd 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/DEBPackage.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/DEBPackage.groovy
@@ -89,7 +89,7 @@ class DEBPackage extends ManagedPackage {
public List<String> getFiles() {
shUser.exec("env DEBIAN_FRONTEND=noninteractive dpkg -L $name");
- return shUser.out.collect({"$it"});
+ return shUser.out.collect({ "$it" });
}
public List<String> getConfigs() {
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageInstance.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageInstance.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageInstance.groovy
index 1cfc7d9..226b238 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageInstance.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageInstance.groovy
@@ -108,8 +108,8 @@ abstract class PackageInstance {
* @param name package manager dependent name of a package
*/
static public PackageInstance getPackageInstance(PackageManager mgr, String name) {
- PackageInstance pkg = (mgr.type == "apt" ) ? new DEBPackage() :
- new RPMPackage();
+ PackageInstance pkg = (mgr.type == "apt") ? new DEBPackage() :
+ new RPMPackage();
pkg.mgr = mgr;
pkg.name = name;
return pkg;
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
index c8a6178..9e58ed6 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/PackageManager.groovy
@@ -40,17 +40,18 @@ public abstract class PackageManager {
* @param cookie an optional, package manager specific opaque string
* @return int return code of the operation: o in case of success, non-zero otherwise
*/
- abstract public int addBinRepo(String record, String url, String key, String cookie)
- /**
- * Register a binary package repository so that packages can be accessed from it.
- * NOTE: repository management is assumed to follow a KVP API with unique implementation
- * specific keys (records) referencing tuples of information describing a repository
- *
- * @param record a package manager specific KEY portion of the repository registration (null is default)
- * @param url a URL containing the packages constituting the repository (null is default)
- * @param key an optional (can be null) cryptographic key for authenticating the content of the repository
- * @return int return code of the operation: o in case of success, non-zero otherwise
- */
+ abstract
+ public int addBinRepo(String record, String url, String key, String cookie)
+ /**
+ * Register a binary package repository so that packages can be accessed from it.
+ * NOTE: repository management is assumed to follow a KVP API with unique implementation
+ * specific keys (records) referencing tuples of information describing a repository
+ *
+ * @param record a package manager specific KEY portion of the repository registration (null is default)
+ * @param url a URL containing the packages constituting the repository (null is default)
+ * @param key an optional (can be null) cryptographic key for authenticating the content of the repository
+ * @return int return code of the operation: o in case of success, non-zero otherwise
+ */
public int addBinRepo(String record, String url, String key) {
addBinRepo(record, url);
}
@@ -80,7 +81,6 @@ public abstract class PackageManager {
*/
abstract public int refresh()
-
/**
* De-register a binary package repository.
*
@@ -133,9 +133,9 @@ public abstract class PackageManager {
* @param pkg a package that is expected to provide 0, 1 or multiple services
* @return list of Service instances
*/
- public Map<String, Service> getServices(PackageInstance pkg) {
- return pkg.getServices();
- }
+ public Map<String, Service> getServices(PackageInstance pkg) {
+ return pkg.getServices();
+ }
/**
* List a content of a given package
@@ -143,9 +143,9 @@ public abstract class PackageManager {
* @param pkg a package that is expected to provide >1 entry in its content
* @return list file and directory names belong to the package.
*/
- public List<String> getContentList(PackageInstance pkg) {
- return pkg.getFiles();
- }
+ public List<String> getContentList(PackageInstance pkg) {
+ return pkg.getFiles();
+ }
/**
* List config files in a given package
@@ -153,9 +153,9 @@ public abstract class PackageManager {
* @param pkg a package in question
* @return list config file names that belong to the package.
*/
- public List<String> getConfigs(PackageInstance pkg) {
- return pkg.getConfigs();
- }
+ public List<String> getConfigs(PackageInstance pkg) {
+ return pkg.getConfigs();
+ }
/**
* List documentation files in a given package
@@ -163,15 +163,15 @@ public abstract class PackageManager {
* @param pkg a package in question
* @return list documentation file names that belong to the package.
*/
- public List<String> getDocs(PackageInstance pkg) {
- return pkg.getDocs();
- }
+ public List<String> getDocs(PackageInstance pkg) {
+ return pkg.getDocs();
+ }
/**
* type of a package manager. expected to be overwritten by concrete subclasses implementing
* particular package managers (yum, apt, zypper, etc.)
*/
- String type = "abstract"
+ String type = "abstract"
/**
* A registry location for repositories to be added to. Currently all the package managers
@@ -204,11 +204,11 @@ public abstract class PackageManager {
* @deprecated it is now recommended to use getServices() instead
*/
@Deprecated
- public void svc_do(PackageInstance pkg, String action) {
- pkg.getServices().each {
- it."$action"()
- }
- }
+ public void svc_do(PackageInstance pkg, String action) {
+ pkg.getServices().each {
+ it."$action"()
+ }
+ }
/**
* Returns a concrete implementation of PackageManager specific for a given linux
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
index 080cf67..e61668a 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/RPMPackage.groovy
@@ -42,7 +42,7 @@ class RPMPackage extends ManagedPackage {
text.each {
// theoretically RPM can generate multiline output for any field, but we are only allowing description & summary
if (curMetaKey == "description" || ((it =~ /^\s+: /).find() && curMetaKey == "summary")) {
- pkg.meta[curMetaKey] <<= "\n${it.replaceAll(/^\s+:/,'')}";
+ pkg.meta[curMetaKey] <<= "\n${it.replaceAll(/^\s+:/, '')}";
} else {
def m = (it =~ /(\S+)\s*:\s*(.*)/);
if (m.size()) {
@@ -115,17 +115,17 @@ Description: %{DESCRIPTION}
List<String> getFiles() {
shUser.exec("rpm -ql $name | grep -v '^(contains no files)\$'");
- return shUser.out.collect({"$it"});
+ return shUser.out.collect({ "$it" });
}
List<String> getConfigs() {
shUser.exec("rpm -qc $name | grep -v '^(contains no files)\$'");
- return shUser.out.collect({"$it"});
+ return shUser.out.collect({ "$it" });
}
List<String> getDocs() {
shUser.exec("rpm -qd $name | grep -v '^(contains no files)\$'");
- return shUser.out.collect({"$it"});
+ return shUser.out.collect({ "$it" });
}
Map<String, String> getDeps() {
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
index 544131e..7006df2 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/UrpmiCmdLinePackageManager.groovy
@@ -21,8 +21,8 @@ package org.apache.bigtop.itest.pmanager
import org.apache.bigtop.itest.posix.Service
class UrpmiCmdLinePackageManager extends PackageManager {
- String type = "urpmi";
-
+ String type = "urpmi";
+
public void setDefaults(String defaults) {}
public int addBinRepo(String record, String url, String key, String cookie) {
@@ -48,7 +48,7 @@ class UrpmiCmdLinePackageManager extends PackageManager {
public List<PackageInstance> search(String name) {
def packages = new ArrayList<PackageInstance>();
shUser.exec("urpmq ${name} | sed -e 's/|/\\n/g' | uniq").out.each {
- packages.add(PackageInstance.getPackageInstance (this, it))
+ packages.add(PackageInstance.getPackageInstance(this, it))
}
return packages
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/YumCmdLinePackageManager.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/YumCmdLinePackageManager.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/YumCmdLinePackageManager.groovy
index 32eae69..d97824b 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/YumCmdLinePackageManager.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/YumCmdLinePackageManager.groovy
@@ -21,7 +21,7 @@ package org.apache.bigtop.itest.pmanager
import org.apache.bigtop.itest.posix.Service
class YumCmdLinePackageManager extends PackageManager {
- String type = "yum";
+ String type = "yum";
String repository_registry = "/etc/yum.repos.d/%s.repo";
public void setDefaults(String defaults) {}
@@ -31,7 +31,7 @@ class YumCmdLinePackageManager extends PackageManager {
name="${cookie}"
baseurl=${url}
gpgkey=${key}
-gpgcheck=${(key!=null)?1:0}""";
+gpgcheck=${(key != null) ? 1 : 0}""";
return addBinRepo(record, descr);
}
@@ -41,7 +41,7 @@ gpgcheck=${(key!=null)?1:0}""";
return 0;
}
- public int cleanup() {
+ public int cleanup() {
shRoot.exec("yum clean all");
return shRoot.getRet();
}
@@ -50,7 +50,7 @@ gpgcheck=${(key!=null)?1:0}""";
def packages = new ArrayList<PackageInstance>();
shUser.exec("yum --color=never -d 0 search $name").out.each {
if (!(it =~ /^(===================| +: )/)) {
- packages.add(PackageInstance.getPackageInstance (this, it.replaceAll(/\.(noarch|i386|x86_64).*$/, '')))
+ packages.add(PackageInstance.getPackageInstance(this, it.replaceAll(/\.(noarch|i386|x86_64).*$/, '')))
}
}
return packages
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/ZypperCmdLinePackageManager.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/ZypperCmdLinePackageManager.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/ZypperCmdLinePackageManager.groovy
index 22d02db..326ea8c 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/ZypperCmdLinePackageManager.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/pmanager/ZypperCmdLinePackageManager.groovy
@@ -21,9 +21,9 @@ package org.apache.bigtop.itest.pmanager
import org.apache.bigtop.itest.posix.Service
class ZypperCmdLinePackageManager extends PackageManager {
- String type = "zypper";
+ String type = "zypper";
String repository_registry = "/etc/zypp/repos.d/%s.repo";
-
+
private String key_opts = "--gpg-auto-import-keys";
public void setDefaults(String defaults) {}
@@ -51,7 +51,7 @@ class ZypperCmdLinePackageManager extends PackageManager {
public List<PackageInstance> search(String name) {
def packages = new ArrayList<PackageInstance>();
shUser.exec("zypper search $name").out.each {
- packages.add(PackageInstance.getPackageInstance (this, ((it =~ /^(.*|)(.*)(|.*)$/)[0][2])))
+ packages.add(PackageInstance.getPackageInstance(this, ((it =~ /^(.*|)(.*)(|.*)$/)[0][2])))
}
return packages
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Alternative.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Alternative.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Alternative.groovy
index b5f2c27..25b9e9a 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Alternative.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/Alternative.groovy
@@ -26,7 +26,7 @@ class Alternative {
String value;
String status;
- Map alts;
+ Map alts;
Shell shUser = new Shell();
Shell shRoot = new Shell("/bin/bash -s", "root");
@@ -47,23 +47,23 @@ class Alternative {
def m = (it =~ /([^:]+):(.*)/);
if (m.size()) {
String val = (m[0][2]).trim();
- switch(m[0][1]) {
- case "Best" : best = val;
- break;
- case "Value" : value = val;
- break;
- case "Status": status = val;
- break;
+ switch (m[0][1]) {
+ case "Best": best = val;
+ break;
+ case "Value": value = val;
+ break;
+ case "Status": status = val;
+ break;
case "Priority": curAlt["priority"] = val;
- break;
- case "Slaves": curAlt["slaves"] = [:];
- break;
+ break;
+ case "Slaves": curAlt["slaves"] = [:];
+ break;
case "Alternative": alts[val] = [:];
- curAlt = alts[val];
- break;
+ curAlt = alts[val];
+ break;
}
} else if ((it =~ /^ /).find()) {
- curAlt["slaves"][it.trim().replaceAll(/ .*$/,"")] = it.replaceAll(/ \S+ /, "");
+ curAlt["slaves"][it.trim().replaceAll(/ .*$/, "")] = it.replaceAll(/ \S+ /, "");
}
}
}
@@ -79,33 +79,34 @@ class Alternative {
* Current `best' version is /bin/ksh93.
* #
*/
+
private void parse_display(List<String> metadata) {
Map curAlt = [:];
String val;
metadata.each {
- switch(it) {
- case ~/^Current.*version is.*/ :
- best = it.replaceAll(/^Current.*version is\s+/, "").
- replaceAll(/\s*\.$/, "");
- break;
- case ~/.*link currently points to.*/ :
- value = it.replaceAll(/^.*link currently points to\s+/, "");
- break;
- case ~/.* status is .*/ :
- status = it.replaceAll(/^.* status is\s+/, "").
- replaceAll(/\s*\.$/, "");
- break;
- case ~/^ slave .*/ :
- val = it.replaceAll(/^ slave /, "").replaceAll(/:.*$/, "");
- curAlt["slaves"][val] = it.replaceAll(/^.*: /, "").trim();
- break;
- case ~/.*priority.*/ :
- val = it.replaceAll(/ - priority .*$/,"");
- alts[val] = [:];
- curAlt = alts[val];
- curAlt["priority"] = it.replaceAll(/^.* - priority /, "").trim();
- curAlt["slaves"] = [:];
- break;
+ switch (it) {
+ case ~/^Current.*version is.*/:
+ best = it.replaceAll(/^Current.*version is\s+/, "").
+ replaceAll(/\s*\.$/, "");
+ break;
+ case ~/.*link currently points to.*/:
+ value = it.replaceAll(/^.*link currently points to\s+/, "");
+ break;
+ case ~/.* status is .*/:
+ status = it.replaceAll(/^.* status is\s+/, "").
+ replaceAll(/\s*\.$/, "");
+ break;
+ case ~/^ slave .*/:
+ val = it.replaceAll(/^ slave /, "").replaceAll(/:.*$/, "");
+ curAlt["slaves"][val] = it.replaceAll(/^.*: /, "").trim();
+ break;
+ case ~/.*priority.*/:
+ val = it.replaceAll(/ - priority .*$/, "");
+ alts[val] = [:];
+ curAlt = alts[val];
+ curAlt["priority"] = it.replaceAll(/^.* - priority /, "").trim();
+ curAlt["slaves"] = [:];
+ break;
}
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/UGI.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/UGI.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/UGI.groovy
index c47362b..d576b09 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/UGI.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/posix/UGI.groovy
@@ -49,22 +49,22 @@ class UGI {
(new File("/etc/passwd")).eachLine {
// NOTE: the :x bit is a workaround for split to work on strings like +::::::
def chunks = "${it}:x".split(':');
- users[chunks[0]] = [ passwd : chunks[1],
- uid : chunks[2],
- gid : chunks[3],
- descr : chunks[4],
- home : chunks[5],
- shell : chunks[6],
- ];
+ users[chunks[0]] = [passwd: chunks[1],
+ uid: chunks[2],
+ gid: chunks[3],
+ descr: chunks[4],
+ home: chunks[5],
+ shell: chunks[6],
+ ];
tmp_groups[chunks[3]] = chunks[0];
}
(new File("/etc/group")).eachLine {
def chunks = it.split(':');
- groups[chunks[0]] = [ passwd : chunks[1],
- gid : chunks[2],
- users : ((chunks.size() == 4) ? chunks[3].split(',').toList() : []),
- ];
+ groups[chunks[0]] = [passwd: chunks[1],
+ gid: chunks[2],
+ users: ((chunks.size() == 4) ? chunks[3].split(',').toList() : []),
+ ];
if (tmp_groups[chunks[2]] != null) {
groups[chunks[0]].users.add(tmp_groups[chunks[2]]);
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/JUnitShell.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/JUnitShell.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/JUnitShell.groovy
index 5fd6da6..9a03f0a 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/JUnitShell.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/JUnitShell.groovy
@@ -78,8 +78,8 @@ class JUnitShell extends Shell {
if (result != expectedExitCode) {
dumpOutput()
Assert.assertEquals(
- "Wrong exit code of script ${script}" as String,
- expectedExitCode, result)
+ "Wrong exit code of script ${script}" as String,
+ expectedExitCode, result)
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/OS.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/OS.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/OS.groovy
index c76bfb1..198ff8c 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/OS.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/OS.groovy
@@ -34,9 +34,9 @@ class OS {
isLinux = (System.getProperty('os.name') =~ /(?i)linux/).matches();
if (isLinux) {
- linux_flavor = "lsb_release -i -s".execute().text.trim();
- linux_codename = "lsb_release -c -s".execute().text.trim();
- linux_release = "lsb_release -r -s".execute().text.trim();
+ linux_flavor = "lsb_release -i -s".execute().text.trim();
+ linux_codename = "lsb_release -c -s".execute().text.trim();
+ linux_release = "lsb_release -r -s".execute().text.trim();
}
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
index bddff00..b105ee9 100644
--- a/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
+++ b/bigtop-test-framework/src/main/groovy/org/apache/bigtop/itest/shell/Shell.groovy
@@ -67,10 +67,10 @@ class Shell {
*/
Shell exec(Object... args) {
def proc = user ? "sudo -u $user PATH=${System.getenv('PATH')} $shell".execute() :
- "$shell".execute()
+ "$shell".execute()
script = args.join("\n")
if (LOG.isTraceEnabled()) {
- LOG.trace("${shell} << __EOT__\n${script}\n__EOT__");
+ LOG.trace("${shell} << __EOT__\n${script}\n__EOT__");
}
Thread.start {
@@ -86,8 +86,7 @@ class Shell {
// empty String
if (baosErr.size() != 0) {
err = baosErr.toString().split('\n');
- }
- else {
+ } else {
err = new ArrayList<String>();
}
@@ -95,15 +94,15 @@ class Shell {
ret = proc.exitValue()
if (LOG.isTraceEnabled()) {
- if (ret != 0) {
- LOG.trace("return: $ret");
- }
- if (out.size() != 0) {
- LOG.trace("\n<stdout>\n${out.join('\n')}\n</stdout>");
- }
- if (err.size() != 0) {
- LOG.trace("\n<stderr>\n${err.join('\n')}\n</stderr>");
- }
+ if (ret != 0) {
+ LOG.trace("return: $ret");
+ }
+ if (out.size() != 0) {
+ LOG.trace("\n<stdout>\n${out.join('\n')}\n</stdout>");
+ }
+ if (err.size() != 0) {
+ LOG.trace("\n<stderr>\n${err.join('\n')}\n</stderr>");
+ }
}
return this
@@ -123,7 +122,7 @@ class Shell {
*/
@Override
String toString() {
- return signCorrectedReturnCode() + " =>\"" + (script ?: "(no script)") +"\""
+ return signCorrectedReturnCode() + " =>\"" + (script ?: "(no script)") + "\""
}
/**
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JUnitUtilsTest.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JUnitUtilsTest.groovy b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JUnitUtilsTest.groovy
index 1fe3d03..bf66351 100644
--- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JUnitUtilsTest.groovy
+++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JUnitUtilsTest.groovy
@@ -28,7 +28,7 @@ public class JUnitUtilsTest {
@AfterClass
static void tearDown() {
def testReports = ['TEST-org.apache.bigtop.itest.DummyTestError.xml', 'TEST-org.apache.bigtop.itest.DummyTestFail.xml',
- 'TEST-org.apache.bigtop.itest.DummyTestPass.xml', '/tmp/TEST-org.apache.bigtop.itest.DummyTestPass.xml'];
+ 'TEST-org.apache.bigtop.itest.DummyTestPass.xml', '/tmp/TEST-org.apache.bigtop.itest.DummyTestPass.xml'];
testReports.each {
(new File(it)).delete()
}
@@ -36,22 +36,22 @@ public class JUnitUtilsTest {
@Test
void testPassingTest() {
- assertTrue('DummyPass test is reported as failing',
- JUnitUtils.executeTests(DummyTestPass.class));
+ assertTrue('DummyPass test is reported as failing',
+ JUnitUtils.executeTests(DummyTestPass.class));
}
-
+
@Test
void testFailingTest() {
println('Disclaimer: This test expected to show a failure in an embeded testcase')
assertFalse('DummyFail test is reported as passing',
- JUnitUtils.executeTests(DummyTestPass.class, DummyTestFail.class));
+ JUnitUtils.executeTests(DummyTestPass.class, DummyTestFail.class));
}
@Test
void testErrorTest() {
println('Disclaimer: This test expected to show an error in an embeded testcase')
assertFalse('DummyFail test is reported as passing',
- JUnitUtils.executeTests(DummyTestError.class));
+ JUnitUtils.executeTests(DummyTestError.class));
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JarContentTest.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JarContentTest.groovy b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JarContentTest.groovy
index c49f657..b583d8a 100644
--- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JarContentTest.groovy
+++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/JarContentTest.groovy
@@ -29,6 +29,7 @@ class JarContentTest {
def list = JarContent.listContent(env['JAVA_HOME'] + '/lib/tools.jar');
assertTrue("Jar content should be greater than 10", list.size() > 10);
}
+
@Test(expected = IOException.class)
void testJarContentNeg() {
def env = System.getenv();
@@ -36,7 +37,7 @@ class JarContentTest {
JarContent.listContent(env['JAVA_HOME'] + '/lib/nofilelikethat.jar').each {
println it;
}
- assert("IOException should have been thrown");
+ assert ("IOException should have been thrown");
} catch (IOException e) {
throw e;
};
@@ -61,10 +62,10 @@ class JarContentTest {
@Test
void testGetJarName() {
assertEquals("Should've find tools.jar file",
- 'tools.jar',
- JarContent.getJarName(System.getenv()['JAVA_HOME'] + '/lib/', 't.*.jar'));
+ 'tools.jar',
+ JarContent.getJarName(System.getenv()['JAVA_HOME'] + '/lib/', 't.*.jar'));
assertEquals("Should not have found tools.jar file", null,
- JarContent.getJarName(System.getenv()['JAVA_HOME'] + '/lib/', 'nosuch-file.*.jar'));
+ JarContent.getJarName(System.getenv()['JAVA_HOME'] + '/lib/', 'nosuch-file.*.jar'));
}
// ClassNotException is expected to be thrown in case of non-existing class
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractGroovy.groovy
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractGroovy.groovy b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractGroovy.groovy
index 9cfc06c..625a718 100644
--- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractGroovy.groovy
+++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractGroovy.groovy
@@ -29,16 +29,16 @@ import org.apache.bigtop.itest.Variable;
@Contract(
properties = [
- @Property(name="foo.int1", type=Property.Type.INT, intValue=1000),
- @Property(name="foo.int2", type=Property.Type.INT),
- @Property(name="foo.bar1", type=Property.Type.STRING, defaultValue="xyz"),
- @Property(name="foo.bar2", type=Property.Type.STRING),
- @Property(name="foo.bool1", type=Property.Type.BOOLEAN),
- @Property(name="foo.bool2", type=Property.Type.BOOLEAN)
+ @Property(name = "foo.int1", type = Property.Type.INT, intValue = 1000),
+ @Property(name = "foo.int2", type = Property.Type.INT),
+ @Property(name = "foo.bar1", type = Property.Type.STRING, defaultValue = "xyz"),
+ @Property(name = "foo.bar2", type = Property.Type.STRING),
+ @Property(name = "foo.bool1", type = Property.Type.BOOLEAN),
+ @Property(name = "foo.bool2", type = Property.Type.BOOLEAN)
],
env = [
- @Variable(name="HOME"),
- @Variable(name="BIGTOP_UNLIKELY_FOO_ENV", required=false)
+ @Variable(name = "HOME"),
+ @Variable(name = "BIGTOP_UNLIKELY_FOO_ENV", required = false)
]
)
class TestContractGroovy {
@@ -64,24 +64,24 @@ class TestContractGroovy {
@Test
void testPropSettings() {
assertEquals("checking the value of foo_int1 from default value",
- 1000, foo_int1);
+ 1000, foo_int1);
assertEquals("checking the value of foo_int2 from foo.int2",
- 100, foo_int2);
+ 100, foo_int2);
assertEquals("checking the value of foo_bar1 from default value",
- "xyz", foo_bar1);
+ "xyz", foo_bar1);
assertEquals("checking the value of foo_bar2 from unset value",
- "", foo_bar2);
+ "", foo_bar2);
assertEquals("checking the value of foo_bool1 from unset value",
- false, foo_bool1);
+ false, foo_bool1);
assertEquals("checking the value of foo_bar2 from foo.bool2",
- true, foo_bool2);
+ true, foo_bool2);
}
@Test
void testEnvSettings() {
assertEquals("checking the value of \$HOME",
- System.getenv("HOME"), HOME);
+ System.getenv("HOME"), HOME);
assertEquals("checking the value of \$BIGTOP_UNLIKELY_FOO_ENV",
- null, BIGTOP_UNLIKELY_FOO_ENV);
+ null, BIGTOP_UNLIKELY_FOO_ENV);
}
}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractJava.java
----------------------------------------------------------------------
diff --git a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractJava.java b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractJava.java
index 6210835..432ce1e 100644
--- a/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractJava.java
+++ b/bigtop-test-framework/src/test/groovy/org/apache/bigtop/itest/TestContractJava.java
@@ -20,6 +20,7 @@ package org.apache.bigtop.itest;
import org.junit.BeforeClass;
import org.junit.Test;
+
import static org.junit.Assert.*;
import org.apache.bigtop.itest.Contract;
@@ -28,60 +29,60 @@ import org.apache.bigtop.itest.Property;
import org.apache.bigtop.itest.Variable;
@Contract(
- properties = {
- @Property(name="foo.int1", type=Property.Type.INT, intValue=1000),
- @Property(name="foo.int2", type=Property.Type.INT),
- @Property(name="foo.bar1", type=Property.Type.STRING, defaultValue="xyz"),
- @Property(name="foo.bar2", type=Property.Type.STRING),
- @Property(name="foo.bool1", type=Property.Type.BOOLEAN),
- @Property(name="foo.bool2", type=Property.Type.BOOLEAN)
- },
- env = {
- @Variable(name="HOME"),
- @Variable(name="BIGTOP_UNLIKELY_FOO_ENV", required=false)
- }
+ properties = {
+ @Property(name = "foo.int1", type = Property.Type.INT, intValue = 1000),
+ @Property(name = "foo.int2", type = Property.Type.INT),
+ @Property(name = "foo.bar1", type = Property.Type.STRING, defaultValue = "xyz"),
+ @Property(name = "foo.bar2", type = Property.Type.STRING),
+ @Property(name = "foo.bool1", type = Property.Type.BOOLEAN),
+ @Property(name = "foo.bool2", type = Property.Type.BOOLEAN)
+ },
+ env = {
+ @Variable(name = "HOME"),
+ @Variable(name = "BIGTOP_UNLIKELY_FOO_ENV", required = false)
+ }
)
public class TestContractJava {
- public static int foo_int1;
- public static int foo_int2;
- protected static String foo_bar1;
- protected static String foo_bar2;
- private static boolean foo_bool1;
- private static boolean foo_bool2;
+ public static int foo_int1;
+ public static int foo_int2;
+ protected static String foo_bar1;
+ protected static String foo_bar2;
+ private static boolean foo_bool1;
+ private static boolean foo_bool2;
- static String HOME;
- static String BIGTOP_UNLIKELY_FOO_ENV;
+ static String HOME;
+ static String BIGTOP_UNLIKELY_FOO_ENV;
- @BeforeClass
- public static void setUp() throws ClassNotFoundException, InterruptedException, NoSuchFieldException, IllegalAccessException {
- System.setProperty("foo.int2", "100");
- System.setProperty("foo.bool2", "true");
+ @BeforeClass
+ public static void setUp() throws ClassNotFoundException, InterruptedException, NoSuchFieldException, IllegalAccessException {
+ System.setProperty("foo.int2", "100");
+ System.setProperty("foo.bool2", "true");
- ParameterSetter.setProperties(TestContractJava.class);
- ParameterSetter.setEnv(TestContractJava.class);
- }
+ ParameterSetter.setProperties(TestContractJava.class);
+ ParameterSetter.setEnv(TestContractJava.class);
+ }
- @Test
- public void testPropSettings() {
- assertEquals("checking the value of foo_int1 from default value",
- 1000, foo_int1);
- assertEquals("checking the value of foo_int2 from foo.int2",
- 100, foo_int2);
- assertEquals("checking the value of foo_bar1 from default value",
- "xyz", foo_bar1);
- assertEquals("checking the value of foo_bar2 from unset value",
- "", foo_bar2);
- assertEquals("checking the value of foo_bool1 from unset value",
- false, foo_bool1);
- assertEquals("checking the value of foo_bar2 from foo.bool2",
- true, foo_bool2);
- }
+ @Test
+ public void testPropSettings() {
+ assertEquals("checking the value of foo_int1 from default value",
+ 1000, foo_int1);
+ assertEquals("checking the value of foo_int2 from foo.int2",
+ 100, foo_int2);
+ assertEquals("checking the value of foo_bar1 from default value",
+ "xyz", foo_bar1);
+ assertEquals("checking the value of foo_bar2 from unset value",
+ "", foo_bar2);
+ assertEquals("checking the value of foo_bool1 from unset value",
+ false, foo_bool1);
+ assertEquals("checking the value of foo_bar2 from foo.bool2",
+ true, foo_bool2);
+ }
- @Test
- public void testEnvSettings() {
- assertEquals("checking the value of $HOME",
- System.getenv("HOME"), HOME);
- assertEquals("checking the value of $BIGTOP_UNLIKELY_FOO_ENV",
- null, BIGTOP_UNLIKELY_FOO_ENV);
- }
+ @Test
+ public void testEnvSettings() {
+ assertEquals("checking the value of $HOME",
+ System.getenv("HOME"), HOME);
+ assertEquals("checking the value of $BIGTOP_UNLIKELY_FOO_ENV",
+ null, BIGTOP_UNLIKELY_FOO_ENV);
+ }
}