Repository: bigtop Updated Branches: refs/heads/master bb86afb3b -> 3e17db895
http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy index 38013b5..2a0ed1c 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasics.groovy @@ -58,8 +58,10 @@ class TestPackagesBasics extends PackageTestCommon { @BeforeClass public static void setUp() { - tryOrFail({repo.addRepo()}, 2, "adding repository failed"); - tryOrFail({(repo.getPm().refresh() == 0)}, 1, "refreshing repository failed"); + tryOrFail({ repo.addRepo() }, 2, "adding repository failed"); + tryOrFail({ + (repo.getPm().refresh() == 0) + }, 1, "refreshing repository failed"); } @AfterClass @@ -71,36 +73,38 @@ class TestPackagesBasics extends PackageTestCommon { 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 -> + 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); + 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; - } + 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 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 = mergeTrees(new XmlParser().parse(TestPackagesBasics.class.getClassLoader(). - getResourceAsStream("package_data.xml")), - new XmlParser().parse(TestPackagesBasics.class.getClassLoader(). - getResourceAsStream("${type}/package_data.xml"))); + getResourceAsStream("package_data.xml")), + new XmlParser().parse(TestPackagesBasics.class.getClassLoader(). + getResourceAsStream("${type}/package_data.xml"))); Map<String, Object[]> res = [:]; @@ -135,35 +139,37 @@ class TestPackagesBasics extends PackageTestCommon { name = pkgName; golden = pkgGolden; // hopefully the following line will go away soon, once PackageInstance becomes more sophisticated - synchronized (pkgs) { pkgs[name] = pkgs[name] ?: PackageInstance.getPackageInstance(pm, name); } + synchronized (pkgs) { + pkgs[name] = pkgs[name] ?: PackageInstance.getPackageInstance(pm, name); + } pkg = pkgs[name]; } - @RunStage(level=-3) + @RunStage(level = -3) @Test - synchronized void testRemoteMetadata() { + synchronized void testRemoteMetadata() { if (!isUpgrade()) { if (pkg.isInstalled()) { checkThat("package $name is already installed and could not be removed", - pkg.remove(), equalTo(0)); + pkg.remove(), equalTo(0)); } checkRemoteMetadata(getMap(golden.metadata), false); } } - @RunStage(level=-2) + @RunStage(level = -2) @Test synchronized void testPackageInstall() { // WARNING: sometimes packages do not install because the server is busy - for (int i=3; pkg.install() && i>0; i--) { + for (int i = 3; pkg.install() && i > 0; i--) { recordFailure("can not install package $name will retry $i times"); } // TODO: we need to come up with a way to abort any further execution to avoid spurious failures checkThat("package $name is expected to be installed", - pm.isInstalled(pkg), equalTo(true)); + pm.isInstalled(pkg), equalTo(true)); pkg.refresh(); } @@ -212,19 +218,22 @@ class TestPackagesBasics extends PackageTestCommon { Map getMapN(Node node) { String packagerType = pm.getType(); Map res = [:]; - node.attributes() + node.attributes() node.children().each { String key = it.name().toString(); - if (key == "tag" && it.attributes()["name"] != null) { // <tag name="foo"/> -> <foo/> + if (key == "tag" && it.attributes()["name"] != null) { + // <tag name="foo"/> -> <foo/> key = it.attributes()["name"]; } def value = null; if (it.children().size() == 0) { // empty tags <foo/> Map attr = it.attributes(); value = (attr.size() > 0) ? attr : key; - } else if (it.children().size() == 1 && it.children().get(0) instanceof java.lang.String) { // text tags <foo>bar</foo> + } else if (it.children().size() == 1 && it.children().get(0) instanceof java.lang.String) { + // text tags <foo>bar</foo> value = it.text(); - } else if (["apt", "yum", "zypper"].contains(key)) { // poor man's XML filtering + } else if (["apt", "yum", "zypper"].contains(key)) { + // poor man's XML filtering res.putAll((packagerType == key) ? getMapN(it) : [:]); } else { value = getMapN(it); @@ -244,10 +253,10 @@ class TestPackagesBasics extends PackageTestCommon { if (res[key] instanceof Map && value instanceof Map) { res[key].putAll(value); } else { - if (!(res[key] instanceof List)) { - res[key] = [res[key]]; - } - res[key].add(value); + if (!(res[key] instanceof List)) { + res[key] = [res[key]]; + } + res[key].add(value); } } } @@ -258,9 +267,9 @@ class TestPackagesBasics extends PackageTestCommon { public void checkRemoval() { checkThat("package $name failed to be removed", - pkg.remove(), equalTo(0)); + pkg.remove(), equalTo(0)); checkThat("package $name is NOT expected to remain installed after removal", - pm.isInstalled(pkg), equalTo(false)); + pm.isInstalled(pkg), equalTo(false)); checkPackageFilesGotRemoved(getMap(golden.content)); } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasicsWithRM.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasicsWithRM.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasicsWithRM.groovy index 913f61b..7ef2cf1 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasicsWithRM.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesBasicsWithRM.groovy @@ -28,7 +28,7 @@ class TestPackagesBasicsWithRM extends TestPackagesBasics { super(pkgName, pkgGolden); } - @RunStage(level=10) + @RunStage(level = 10) @Test void testPackageRemove() { checkRemoval(); http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributed.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributed.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributed.groovy index 32f59c2..f84ce1f 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributed.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributed.groovy @@ -28,17 +28,17 @@ class TestPackagesPseudoDistributed extends TestPackagesBasics { super(pkgName, pkgGolden); } - @RunStage(level=-3) + @RunStage(level = -3) @Test synchronized void testRemoteMetadata() { } - @RunStage(level=-1) + @RunStage(level = -1) @Test void testPackageUpgrade() { if (isUpgrade()) { checkThat("upgrade sequence on a package $name failed to be executed", - BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); + BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedDependency.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedDependency.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedDependency.groovy index 2df72fc..20147e9 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedDependency.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedDependency.groovy @@ -28,17 +28,17 @@ class TestPackagesPseudoDistributedDependency extends TestPackagesBasics { super(pkgName, pkgGolden); } - @RunStage(level=-3) + @RunStage(level = -3) @Test synchronized void testRemoteMetadata() { } - @RunStage(level=-1) + @RunStage(level = -1) @Test void testPackageUpgrade() { if (isUpgrade()) { checkThat("upgrade sequence on a package $name failed to be executed", - BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); + BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedFileContents.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedFileContents.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedFileContents.groovy index 47699d1..61085b5 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedFileContents.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedFileContents.groovy @@ -28,17 +28,17 @@ class TestPackagesPseudoDistributedFileContents extends TestPackagesBasics { super(pkgName, pkgGolden); } - @RunStage(level=-3) + @RunStage(level = -3) @Test synchronized void testRemoteMetadata() { } - @RunStage(level=-1) + @RunStage(level = -1) @Test void testPackageUpgrade() { if (isUpgrade()) { checkThat("upgrade sequence on a package $name failed to be executed", - BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); + BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedServices.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedServices.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedServices.groovy index 0647f93..fb72eec 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedServices.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedServices.groovy @@ -28,17 +28,17 @@ class TestPackagesPseudoDistributedServices extends TestPackagesBasics { super(pkgName, pkgGolden); } - @RunStage(level=-3) + @RunStage(level = -3) @Test synchronized void testRemoteMetadata() { } - @RunStage(level=-1) + @RunStage(level = -1) @Test void testPackageUpgrade() { if (isUpgrade()) { checkThat("upgrade sequence on a package $name failed to be executed", - BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); + BTUpgradeSequence.execute(name, System.getProperty("bigtop.prev.repo.version"), "0.5.0"), equalTo(0)); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedState.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedState.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedState.groovy index 55365aa..05ea260 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedState.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedState.groovy @@ -22,8 +22,8 @@ import org.junit.runner.RunWith @RunWith(Suite.class) @Suite.SuiteClasses([ - TestPackagesPseudoDistributed.class, - TestServices.class, +TestPackagesPseudoDistributed.class, +TestServices.class, ]) class TestPackagesPseudoDistributedState { } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedUpgrade.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedUpgrade.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedUpgrade.groovy index 944204d..7aa8ca6 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedUpgrade.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedUpgrade.groovy @@ -23,11 +23,11 @@ import org.junit.runner.RunWith @RunWith(Suite.class) @Suite.SuiteClasses([ - DeployCDH.class, - TestServicesCreateState.class, - TestPackagesPseudoDistributed.class, - TestServicesCreateStateMissing.class, - TestServicesVerifyState.class, +DeployCDH.class, +TestServicesCreateState.class, +TestPackagesPseudoDistributed.class, +TestServicesCreateStateMissing.class, +TestServicesVerifyState.class, ]) class TestPackagesPseudoDistributedUpgrade { } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedWithRM.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedWithRM.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedWithRM.groovy index d61285d..d268c72 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedWithRM.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestPackagesPseudoDistributedWithRM.groovy @@ -33,12 +33,13 @@ class TestPackagesPseudoDistributedWithRM extends TestPackagesPseudoDistributed super(pkgName, pkgGolden); } - @RunStage(level=1) + @RunStage(level = 1) @Test void testPackageRemove() { checkComplimentary32bitInstall(); checkDaemonStart(); - sleep(3001); // TODO FIXME: CDH-2816 should address the timing of daemons start. + sleep(3001); + // TODO FIXME: CDH-2816 should address the timing of daemons start. checkRemoval(); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServices.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServices.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServices.groovy index 4f20524..9f32fe5 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServices.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServices.groovy @@ -73,21 +73,21 @@ class TestServices { } } - @RunStage(level=-1) + @RunStage(level = -1) @Test void createState() { checkThat("failed to configure service ${svcs.get(0).getName()}", - verifier.config(), equalTo(true)); + verifier.config(), equalTo(true)); svcs.each { checkThat("service ${it.getName()} failed to start", - it.start(), equalTo(0)); + it.start(), equalTo(0)); } sleep(60001); verifier.createState(); checkThat("initial state verification failed", - verifier.verifyState(), equalTo(true)); + verifier.verifyState(), equalTo(true)); svcs.reverseEach { // TODO: we're only trying the best we can here @@ -103,21 +103,21 @@ class TestServices { } } - @RunStage(level=1) + @RunStage(level = 1) @Test void verifyState() { svcs.each { checkThat("failed to configure service ${it.getName()}", - verifier.config(), equalTo(true)); + verifier.config(), equalTo(true)); } svcs.each { checkThat("service ${it.getName()} failed to start", - it.start(), equalTo(0)); + it.start(), equalTo(0)); } sleep(60001); checkThat("state verification failed after daemons got restarted", - verifier.verifyState(), equalTo(true)); + verifier.verifyState(), equalTo(true)); svcs.reverseEach { it.stop(); } sleep(5001); @@ -127,7 +127,7 @@ class TestServices { if (!shRoot.getRet()) { shRoot.exec("kill -9 `ps -U${it} -opid=`"); checkThat("service running under the name of $it is supposed to be stopped, but it is not", - true, equalTo(false)); + true, equalTo(false)); } } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateState.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateState.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateState.groovy index f877411..866eda1 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateState.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateState.groovy @@ -25,14 +25,14 @@ class TestServicesCreateState extends TestServices { @Parameters static Map<String, Object[]> generateTests() { return selectServices(System.getProperty("bigtop.prev.repo.version", - System.getProperty("bigtop.repo.version", "0.6.0"))); + System.getProperty("bigtop.repo.version", "0.6.0"))); } TestServicesCreateState(Map.Entry ent) { super(ent); } - @RunStage(level=1) + @RunStage(level = 1) @Test void verifyState() { } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateStateMissing.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateStateMissing.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateStateMissing.groovy index 7e714ea..35cd271 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateStateMissing.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesCreateStateMissing.groovy @@ -22,7 +22,7 @@ import org.junit.runners.Parameterized.Parameters class TestServicesCreateStateMissing extends TestServicesCreateState { @Parameters static Map<String, Object[]> generateTests() { - return selectServices("${System.getProperty('bigtop.prev.repo.version','0.5.0')}..${System.getProperty('bigtop.repo.version', '0.6.0')}"); + return selectServices("${System.getProperty('bigtop.prev.repo.version', '0.5.0')}..${System.getProperty('bigtop.repo.version', '0.6.0')}"); } TestServicesCreateStateMissing(Map.Entry ent) { http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesVerifyState.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesVerifyState.groovy b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesVerifyState.groovy index b2b1076..36da0e5 100644 --- a/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesVerifyState.groovy +++ b/bigtop-tests/test-artifacts/package/src/main/groovy/org/apache/bigtop/itest/packagesmoke/TestServicesVerifyState.groovy @@ -26,7 +26,7 @@ class TestServicesVerifyState extends TestServices { super(ent); } - @RunStage(level=-1) + @RunStage(level = -1) @Test void createState() { } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/phoenix/src/main/groovy/org/apache/bigtop/itest/phoenix/smoke/TestPhoenixSmoke.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/phoenix/src/main/groovy/org/apache/bigtop/itest/phoenix/smoke/TestPhoenixSmoke.groovy b/bigtop-tests/test-artifacts/phoenix/src/main/groovy/org/apache/bigtop/itest/phoenix/smoke/TestPhoenixSmoke.groovy index df53e5e..68385e0 100644 --- a/bigtop-tests/test-artifacts/phoenix/src/main/groovy/org/apache/bigtop/itest/phoenix/smoke/TestPhoenixSmoke.groovy +++ b/bigtop-tests/test-artifacts/phoenix/src/main/groovy/org/apache/bigtop/itest/phoenix/smoke/TestPhoenixSmoke.groovy @@ -46,11 +46,11 @@ public class TestPhoenixSmoke { // running cluster as well. static void runTest(String testName) { - sh.exec("HBASE_CLASSPATH=" + phoenixClientJar + ":" + phoenixCoreJar + ":" + phoenixCoreTestsJar + + sh.exec("HBASE_CLASSPATH=" + phoenixClientJar + ":" + phoenixCoreJar + ":" + phoenixCoreTestsJar + " hbase org.junit.runner.JUnitCore " + testName); assertTrue(testName + " failed", sh.getRet() == 0); } - + @Test public void testAlterTable() { runTest("org.apache.phoenix.end2end.AlterTableIT") @@ -60,7 +60,7 @@ public class TestPhoenixSmoke { public void testArithmeticQuery() { runTest("org.apache.phoenix.end2end.ArithmeticQueryIT") } - + @Test public void testArray() { runTest("org.apache.phoenix.end2end.ArrayIT") @@ -160,7 +160,7 @@ public class TestPhoenixSmoke { public void testHashJoin() { runTest("org.apache.phoenix.end2end.HashJoinIT") } - + @Test public void testInMemoryOrderBy() { runTest("org.apache.phoenix.end2end.InMemoryOrderByIT") @@ -215,6 +215,7 @@ public class TestPhoenixSmoke { public void testQueryExecWithoutSCN() { runTest("org.apache.phoenix.end2end.QueryExecWithoutSCNIT") } + @Test public void testQuery() { runTest("org.apache.phoenix.end2end.QueryIT") @@ -304,12 +305,12 @@ public class TestPhoenixSmoke { public void testTenantSpecificTablesDDL() { runTest("org.apache.phoenix.end2end.TenantSpecificTablesDDLIT") } - + @Test public void testTenantSpecificTablesDML() { runTest("org.apache.phoenix.end2end.TenantSpecificTablesDMLIT") } - + @Test public void testTenantSpecificViewIndex() { runTest("org.apache.phoenix.end2end.TenantSpecificViewIndexIT") http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/SolrTestBase.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/SolrTestBase.groovy b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/SolrTestBase.groovy index a41883f..ef82b76 100644 --- a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/SolrTestBase.groovy +++ b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/SolrTestBase.groovy @@ -62,7 +62,7 @@ public class SolrTestBase { String fullUrl = _baseURL + url + ((url.indexOf("?") >= 0) ? "&" : "?") + "wt=json" URLConnection conn = new URL(fullUrl).openConnection() BufferedReader res = new BufferedReader(new InputStreamReader( - conn.getInputStream())) + conn.getInputStream())) String inputLine; StringBuilder sb = new StringBuilder() while ((inputLine = res.readLine()) != null) { http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestIndexing.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestIndexing.groovy b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestIndexing.groovy index 97f3edb..756e3ff 100644 --- a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestIndexing.groovy +++ b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestIndexing.groovy @@ -26,7 +26,7 @@ class TestIndexing extends SolrTestBase { // Index a couple of documents def builder = new groovy.json.JsonBuilder() builder([["id": "doc1", "name": URLEncoder.encode("first test document")], - ["id": "doc2", "name": URLEncoder.encode("second test document")]]) + ["id": "doc2", "name": URLEncoder.encode("second test document")]]) doReq(_updatePathJSON + builder.toString() + "&commit=true") } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestPing.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestPing.groovy b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestPing.groovy index f03f1d9..696c661 100644 --- a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestPing.groovy +++ b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestPing.groovy @@ -17,6 +17,7 @@ package org.apache.bigtop.itest.solr.smoke import org.junit.Test + /** * Utterly trivial test to see if the server is running */ http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestSimple.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestSimple.groovy b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestSimple.groovy index 4448e76..e012d7c 100644 --- a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestSimple.groovy +++ b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestSimple.groovy @@ -31,8 +31,8 @@ class TestSimple extends SolrTestBase { //doReq(_updatePathJSON + builder.toString()) StringBuilder sb = new StringBuilder() sb.append("<add><doc><field name=\"id\">doc1</field><field name=\"name\">first test document"). - append("</field></doc><doc><field name=\"id\">doc2</field><field name=\"name\">second test document"). - append("</field></doc></add>") + append("</field></doc><doc><field name=\"id\">doc2</field><field name=\"name\">second test document"). + append("</field></doc></add>") doReq(_updatePathXML + URLEncoder.encode(sb.toString())) testEquals(doReq("/select?q=*:*"), "response.numFound", "2") testEquals(doReq("/select?q=name:\"first+test+document\""), "response.numFound", "1") http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestStatistics.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestStatistics.groovy b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestStatistics.groovy index dff83dd..3a72f57 100644 --- a/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestStatistics.groovy +++ b/bigtop-tests/test-artifacts/solr/src/main/groovy/org/apache/bigtop/itest/solr/smoke/TestStatistics.groovy @@ -24,11 +24,12 @@ import org.junit.Test */ class TestStatistics extends SolrTestBase { @Test - public void testCache() { + public void testCache() { Object res = doReq(_adminPath + "/mbeans?stats=true") ArrayList<Object> beans = res."solr-mbeans" for (int idx = 0; idx < beans.size(); idx++) { - if (beans[idx] instanceof String && "CACHE".equals(beans[idx])) { // Next object is the stats data for caches. + if (beans[idx] instanceof String && "CACHE".equals(beans[idx])) { + // Next object is the stats data for caches. Object hits = beans[idx + 1].filterCache.stats.hits break; } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/spark/src/main/groovy/org/apache/bigtop/itest/spark/TestSparkSmoke.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/spark/src/main/groovy/org/apache/bigtop/itest/spark/TestSparkSmoke.groovy b/bigtop-tests/test-artifacts/spark/src/main/groovy/org/apache/bigtop/itest/spark/TestSparkSmoke.groovy index 400cc92..4fcb67e 100644 --- a/bigtop-tests/test-artifacts/spark/src/main/groovy/org/apache/bigtop/itest/spark/TestSparkSmoke.groovy +++ b/bigtop-tests/test-artifacts/spark/src/main/groovy/org/apache/bigtop/itest/spark/TestSparkSmoke.groovy @@ -44,10 +44,10 @@ public class TestSparkSmoke implements Serializable { @BeforeClass static void setUp() { - sh.exec("pwd") - pwd = sh.out - int lastIndex = pwd.length() - 1 - pwd = pwd.substring(1, lastIndex) + sh.exec("pwd") + pwd = sh.out + int lastIndex = pwd.length() - 1 + pwd = pwd.substring(1, lastIndex) } @Test @@ -79,7 +79,7 @@ public class TestSparkSmoke implements Serializable { String[] jars = [System.getProperty("sparkJar"), org.apache.bigtop.itest.JarContent.getJarURL("groovy.lang.GroovyObject")]; JavaSparkContext sc = new JavaSparkContext("local", "Simple Job", - SPARK_HOME, jars); + SPARK_HOME, jars); JavaRDD<String> logData = sc.textFile(logFile).cache(); http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHBase.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHBase.groovy b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHBase.groovy index 9a277a5..9dbdc7a 100644 --- a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHBase.groovy +++ b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHBase.groovy @@ -59,6 +59,7 @@ public class IntegrationTestSqoopHBase { test.exec("hadoop fs -mkdir $path"); return test.getRet(); } + public static int rmr(String path) { Shell rmr = new Shell("/bin/bash -s"); rmr.exec("hadoop fs -rmr -skipTrash $path"); @@ -66,11 +67,11 @@ public class IntegrationTestSqoopHBase { } public static String mktemps() { - mkdir("IntegrationTestSqoopHBase-${(new Date().getTime())}"); + mkdir("IntegrationTestSqoopHBase-${(new Date().getTime())}"); } @Before - public void setUp () { + public void setUp() { JarContent.unpackJarContainer(IntegrationTestSqoopHBase.class, '.', DATA_DIR); rmr('test_table'); @@ -85,7 +86,7 @@ public class IntegrationTestSqoopHBase { def out = shell.out.join('\n'); assertFalse("Unable to create HBase table by script create-table.hxt", - (out =~ /ERROR/).find()); + (out =~ /ERROR/).find()); } @After @@ -95,7 +96,7 @@ public class IntegrationTestSqoopHBase { } @Test - public void hBaseSqoop () { + public void hBaseSqoop() { def hostname = shell.exec('hostname').out.get(0); def dbURL = "jdbc:mysql://$hostname/testhbase"; def OUTFILE = 'outfile.txt'; @@ -108,6 +109,6 @@ public class IntegrationTestSqoopHBase { // TODO need to conver shell callouts to power tools with Java parsing of // ' 10 column=data:b, timestamp=1301075559859, value=ten' assertEquals("HBase scan output did not match expected output. File: $OUTFILE", - 0, shell.exec("diff -u $OUTFILE expected-hbase-output.txt.resorted").getRet() ); + 0, shell.exec("diff -u $OUTFILE expected-hbase-output.txt.resorted").getRet()); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHive.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHive.groovy b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHive.groovy index eb14fa5..30ffdb3 100644 --- a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHive.groovy +++ b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/integration/sqoop/IntegrationTestSqoopHive.groovy @@ -60,7 +60,7 @@ class IntegrationTestSqoopHive { } @Before - public void setUp () { + public void setUp() { JarContent.unpackJarContainer(IntegrationTestSqoopHive.class, '.', DATA_DIR); // MySQL preparations @@ -85,7 +85,7 @@ class IntegrationTestSqoopHive { } @Test - public void hiveSqoop () { + public void hiveSqoop() { def hostname = shell.exec('hostname').out.get(0); def dbURL = "jdbc:mysql://$hostname/testhive"; //Run Sqoop Hive import now @@ -95,6 +95,6 @@ class IntegrationTestSqoopHive { shell.exec("${HIVE_HOME}/bin/hive -f $DATA_DIR/hive-select-table.hql > $OUTFILE"); assertEquals("Unable to run hive-select-table.hql script", 0, shell.ret); assertEquals("Hive output did not match expected output. File: $OUTFILE", - 0, shell.exec("diff -u $OUTFILE $DATA_DIR/expected-hive-output.txt").getRet() ); + 0, shell.exec("diff -u $OUTFILE $DATA_DIR/expected-hive-output.txt").getRet()); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopExport.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopExport.groovy b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopExport.groovy index 145c1a6..d310a3b 100644 --- a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopExport.groovy +++ b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopExport.groovy @@ -50,15 +50,15 @@ class TestSqoopExport { private static final String MYSQL_COMMAND = "mysql -h $MYSQL_HOST --user=$MYSQL_USER" + - (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); + (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); private static final String MYSQL_DBNAME = System.getProperty("mysql.dbname", "mysqltestdb"); private static final String SQOOP_CONNECTION_STRING = "jdbc:mysql://$MYSQL_HOST/$MYSQL_DBNAME"; private static final String SQOOP_CONNECTION = "--connect jdbc:mysql://$MYSQL_HOST/$MYSQL_DBNAME --username=$MYSQL_USER" + - (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); + (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); static { - System.out.println("SQOOP_CONNECTION string is " + SQOOP_CONNECTION ); + System.out.println("SQOOP_CONNECTION string is " + SQOOP_CONNECTION); } private static final String DATA_DIR = System.getProperty("data.dir", "mysql-files"); private static final String INPUT = System.getProperty("input.dir", "/tmp/input-dir"); @@ -71,7 +71,7 @@ class TestSqoopExport { if (sh.getRet() == 0) { sh.exec("hadoop fs -rmr -skipTrash $INPUT"); assertTrue("Deletion of previous $INPUT from HDFS failed", - sh.getRet() == 0); + sh.getRet() == 0); } sh.exec("hadoop fs -mkdir $INPUT"); assertTrue("Could not create $INPUT directory", sh.getRet() == 0); @@ -90,7 +90,7 @@ class TestSqoopExport { assertTrue("Could not create $INPUT/t_int directory", sh.getRet() == 0); // unpack resource - JarContent.unpackJarContainer(TestSqoopExport.class, '.' , null) + JarContent.unpackJarContainer(TestSqoopExport.class, '.', null) // upload data to HDFS sh.exec("hadoop fs -put $DATA_DIR/sqoop-testtable.out $INPUT/testtable/part-m-00000"); @@ -98,8 +98,8 @@ class TestSqoopExport { sh.exec("hadoop fs -put $DATA_DIR/sqoop-t_date-export.out $INPUT/t_date/part-m-00000"); sh.exec("hadoop fs -put $DATA_DIR/sqoop-t_string.out $INPUT/t_string/part-m-00000"); sh.exec("hadoop fs -put $DATA_DIR/sqoop-t_fp.out $INPUT/t_fp/part-m-00000"); - sh.exec("hadoop fs -put $DATA_DIR/sqoop-t_int.out $INPUT/t_int/part-m-00000"); - + sh.exec("hadoop fs -put $DATA_DIR/sqoop-t_int.out $INPUT/t_int/part-m-00000"); + //create db sh.exec("cat $DATA_DIR/mysql-create-db.sql | $MYSQL_COMMAND"); //create tables @@ -108,12 +108,12 @@ class TestSqoopExport { @AfterClass static void tearDown() { - if ('YES'.equals(System.getProperty('delete.testdata','no').toUpperCase())) { + if ('YES'.equals(System.getProperty('delete.testdata', 'no').toUpperCase())) { sh.exec("hadoop fs -test -e $INPUT"); if (sh.getRet() == 0) { sh.exec("hadoop fs -rmr -skipTrash $INPUT"); assertTrue("Deletion of $INPUT from HDFS failed", - sh.getRet() == 0); + sh.getRet() == 0); } } } @@ -212,7 +212,7 @@ class TestSqoopExport { sh.exec("echo 'use mysqltestdb;select * from t_bool' | $MYSQL_COMMAND --skip-column-names | sed 's/\t/,/g' > t_bool.out"); assertEquals("sqoop export did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_bool-export.out t_bool.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_bool-export.out t_bool.out").getRet()); } @Test @@ -223,7 +223,7 @@ class TestSqoopExport { sh.exec("echo 'use mysqltestdb;select * from t_int' | $MYSQL_COMMAND --skip-column-names | sed 's/\t/,/g' > t_int.out"); assertEquals("sqoop export did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_int.out t_int.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_int.out t_int.out").getRet()); } @Test @@ -234,7 +234,7 @@ class TestSqoopExport { sh.exec("echo 'use mysqltestdb;select * from t_fp' | $MYSQL_COMMAND --skip-column-names | sed 's/\t/,/g' > t_fp.out"); assertEquals("sqoop export did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_fp.out t_fp.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_fp.out t_fp.out").getRet()); } @Test @@ -245,7 +245,7 @@ class TestSqoopExport { sh.exec("echo 'use mysqltestdb;select * from t_date' | $MYSQL_COMMAND --skip-column-names | sed 's/\t/,/g' > t_date.out"); assertEquals("sqoop export did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_date.out t_date.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_date.out t_date.out").getRet()); } @Test @@ -256,7 +256,7 @@ class TestSqoopExport { sh.exec("echo 'use mysqltestdb;select * from t_string' | $MYSQL_COMMAND --skip-column-names | sed 's/\t/,/g' > t_string.out"); assertEquals("sqoop export did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_string.out t_string.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_string.out t_string.out").getRet()); } } http://git-wip-us.apache.org/repos/asf/bigtop/blob/3e17db89/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopImport.groovy ---------------------------------------------------------------------- diff --git a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopImport.groovy b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopImport.groovy index 00ef9fe..c2d7501 100644 --- a/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopImport.groovy +++ b/bigtop-tests/test-artifacts/sqoop/src/main/groovy/org/apache/bigtop/itest/sqoop/TestSqoopImport.groovy @@ -53,15 +53,15 @@ class TestSqoopImport { private static final String MYSQL_COMMAND = "mysql -h $MYSQL_HOST --user=$MYSQL_USER" + - (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); + (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); private static final String MYSQL_DBNAME = System.getProperty("mysql.dbname", "mysqltestdb"); private static final String SQOOP_CONNECTION_STRING = "jdbc:mysql://$MYSQL_HOST/$MYSQL_DBNAME"; private static final String SQOOP_CONNECTION = "--connect jdbc:mysql://$MYSQL_HOST/$MYSQL_DBNAME --username=$MYSQL_USER" + - (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); + (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); static { - System.out.println("SQOOP_CONNECTION string is " + SQOOP_CONNECTION ); + System.out.println("SQOOP_CONNECTION string is " + SQOOP_CONNECTION); } private static final String DATA_DIR = System.getProperty("data.dir", "mysql-files"); private static final String OUTPUT = System.getProperty("output.dir", "/tmp/output-dir"); @@ -74,10 +74,10 @@ class TestSqoopImport { if (sh.getRet() == 0) { sh.exec("hadoop fs -rmr -skipTrash $OUTPUT"); assertTrue("Deletion of previous $OUTPUT from HDFS failed", - sh.getRet() == 0); + sh.getRet() == 0); } // unpack resource - JarContent.unpackJarContainer(TestSqoopImport.class, '.' , null) + JarContent.unpackJarContainer(TestSqoopImport.class, '.', null) // create the database sh.exec("cat $DATA_DIR/mysql-create-db.sql | $MYSQL_COMMAND"); @@ -89,12 +89,12 @@ class TestSqoopImport { @AfterClass static void tearDown() { - if ('YES'.equals(System.getProperty('delete.testdata','no').toUpperCase())) { + if ('YES'.equals(System.getProperty('delete.testdata', 'no').toUpperCase())) { sh.exec("hadoop fs -test -e $OUTPUT"); if (sh.getRet() == 0) { sh.exec("hadoop fs -rmr -skipTrash $OUTPUT"); assertTrue("Deletion of $OUTPUT from HDFS failed", - sh.getRet() == 0); + sh.getRet() == 0); } } } @@ -156,7 +156,7 @@ class TestSqoopImport { assertNotSame(MPersistableEntity.PERSISTANCE_ID_DEFAULT, job.getPersistenceId()); } - protected void runSqoopClient(String tableName=null, String partitionColumn=null, String tableColumns=null, String tableSQL=null, String outputSubdir=null, int extractors=0, int loaders=0) { + protected void runSqoopClient(String tableName = null, String partitionColumn = null, String tableColumns = null, String tableSQL = null, String outputSubdir = null, int extractors = 0, int loaders = 0) { // Connection creation MConnection connection = getClient().newConnection(1L); fillConnectionForm(connection); @@ -168,35 +168,35 @@ class TestSqoopImport { // Connector values MFormList connectorForms = job.getConnectorPart(); - if(tableName != null) { + if (tableName != null) { connectorForms.getStringInput("table.tableName").setValue(tableName); } - if(partitionColumn != null) { + if (partitionColumn != null) { connectorForms.getStringInput("table.partitionColumn").setValue(partitionColumn); } - if(tableColumns != null) { + if (tableColumns != null) { connectorForms.getStringInput("table.columns").setValue(tableColumns); } - if(tableSQL != null) { + if (tableSQL != null) { connectorForms.getStringInput("table.sql").setValue(tableSQL); } // Framework values MFormList frameworkForms = job.getFrameworkPart(); - if(extractors > 0) { + if (extractors > 0) { frameworkForms.getIntegerInput("throttling.extractors").setValue(extractors); } - if(loaders > 0) { + if (loaders > 0) { frameworkForms.getIntegerInput("throttling.loaders").setValue(loaders); } String outSubdir; - if(outputSubdir == null) { + if (outputSubdir == null) { outSubdir = tableName; } else { outSubdir = outputSubdir; @@ -227,7 +227,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/t_bool/part-* > t_bool.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_bool.out t_bool.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_bool.out t_bool.out").getRet()); } @Test @@ -239,7 +239,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/t_int/part-* > t_int.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_int.out t_int.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_int.out t_int.out").getRet()); } @Test @@ -251,7 +251,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/t_fp/part-* > t_fp.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_fp.out t_fp.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_fp.out t_fp.out").getRet()); } @Test @@ -263,7 +263,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/t_date/part-* > t_date.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_date.out t_date.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_date.out t_date.out").getRet()); } @Test @@ -275,7 +275,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/t_string/part-* > t_string.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-t_string.out t_string.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-t_string.out t_string.out").getRet()); } @Test @@ -288,7 +288,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/testtable/part-* > columns.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-columns.out columns.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-columns.out columns.out").getRet()); } @Test @@ -305,7 +305,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/$outputSubdir/part-*0 > num-mappers.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out num-mappers.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out num-mappers.out").getRet()); } @Test @@ -320,7 +320,7 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/$outputSubdir/part-* > query.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-query.out query.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-query.out query.out").getRet()); } @Test @@ -335,10 +335,9 @@ class TestSqoopImport { sh.exec("hadoop fs -cat $OUTPUT/$outputSubdir/part-* > split-by.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out split-by.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out split-by.out").getRet()); } - //----------------------------------------@Ignore("Backward Compatibility")------------------------------------------// // The functionality of the tests below is not currently supported by Sqoop 2. @@ -347,14 +346,14 @@ class TestSqoopImport { @Test public void testImportAllTables() { String SQOOP_CONNECTION_IMPORT_ALL = - "--connect jdbc:mysql://$MYSQL_HOST/mysqltestdb2 --username=$MYSQL_USER" + - (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); + "--connect jdbc:mysql://$MYSQL_HOST/mysqltestdb2 --username=$MYSQL_USER" + + (("".equals(MYSQL_PASSWORD)) ? "" : " --password=$MYSQL_PASSWORD"); sh.exec("sqoop import-all-tables $SQOOP_CONNECTION_IMPORT_ALL --warehouse-dir $OUTPUT/alltables"); assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/alltables/testtable*/part-* > all-tables.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-all-tables.out all-tables.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-all-tables.out all-tables.out").getRet()); } @Ignore("Backward Compatibility") @@ -367,7 +366,7 @@ class TestSqoopImport { assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/append/part-* > append.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-append.out append.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-append.out append.out").getRet()); } @Ignore("Backward Compatibility") @@ -377,7 +376,7 @@ class TestSqoopImport { assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/direct/part-* > direct.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out direct.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out direct.out").getRet()); } @Ignore("Backward Compatibility") @@ -387,7 +386,7 @@ class TestSqoopImport { assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/warehouse-dir/testtable/part-* > warehouse-dir.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out warehouse-dir.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-testtable.out warehouse-dir.out").getRet()); } @Ignore("Backward Compatibility") @@ -397,7 +396,7 @@ class TestSqoopImport { assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/where-clause/part-* > where-clause.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-where-clause.out where-clause.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-where-clause.out where-clause.out").getRet()); } @Ignore("Backward Compatibility") @@ -407,7 +406,7 @@ class TestSqoopImport { assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/null-string/part-* > null-string.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-null-string.out null-string.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-null-string.out null-string.out").getRet()); } @Ignore("Backward Compatibility") @@ -417,7 +416,7 @@ class TestSqoopImport { assertTrue("Sqoop job failed!", sh.getRet() == 0); sh.exec("hadoop fs -cat $OUTPUT/non-null-string/part-* > non-null-string.out"); assertEquals("sqoop import did not write expected data", - 0, sh.exec("diff -u $DATA_DIR/sqoop-null-non-string.out non-null-string.out").getRet()); + 0, sh.exec("diff -u $DATA_DIR/sqoop-null-non-string.out non-null-string.out").getRet()); } }
