Repository: bigtop
Updated Branches:
refs/heads/master 64c262fca -> 66de460b8
BIGTOP-2315. Added smoke test for apex.
Signed-off-by: Youngwoo Kim
Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo
Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/66de460b
Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/66de460b
Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/66de460b
Branch: refs/heads/master
Commit: 66de460b80777d812cfc5f87af81d9df77ed1d40
Parents: 64c262f
Author: chinmaykolhatkar
Authored: Thu Mar 3 23:08:38 2016 +0530
Committer: Youngwoo Kim
Committed: Thu Apr 7 22:58:33 2016 +0900
--
.../smoke-tests/apex/TestApexSmoke.groovy | 117
bigtop-tests/smoke-tests/apex/build.gradle | 34
bigtop-tests/test-artifacts/apex/pom.xml| 191 +++
.../apex/src/assemble/appPackage.xml| 59 ++
.../java/com/example/myapexapp/Application.java | 41
.../myapexapp/ConsoleOutputOperator.java| 79
.../myapexapp/RandomNumberGenerator.java| 61 ++
.../src/main/resources/META-INF/properties.xml | 28 +++
8 files changed, 610 insertions(+)
--
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/smoke-tests/apex/TestApexSmoke.groovy
--
diff --git a/bigtop-tests/smoke-tests/apex/TestApexSmoke.groovy
b/bigtop-tests/smoke-tests/apex/TestApexSmoke.groovy
new file mode 100644
index 000..dd712c2
--- /dev/null
+++ b/bigtop-tests/smoke-tests/apex/TestApexSmoke.groovy
@@ -0,0 +1,117 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.bigtop.itest.apex
+
+import org.junit.BeforeClass
+import org.junit.AfterClass
+import org.junit.FixMethodOrder
+import org.junit.runners.MethodSorters
+import org.junit.Test
+import static org.junit.Assert.assertTrue
+
+import org.apache.bigtop.itest.shell.Shell
+import org.apache.bigtop.itest.TestUtils
+import org.apache.commons.logging.LogFactory
+import org.apache.commons.logging.Log
+
+import org.junit.runner.RunWith
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+class TestApexSmoke {
+ static private Log LOG = LogFactory.getLog(Object.class);
+
+ static def testDir = "build/resources/test/"
+ static Shell sh = new Shell("/bin/bash -s");
+ static appId = null;
+
+ @AfterClass
+ public static void tearDown() {
+sh.exec('hadoop fs -rm -r -skipTrash datatorrent');
+sh.exec('rm -rf ' + testDir);
+ }
+
+ @BeforeClass
+ static void setUp() {
+sh.exec('pushd ' + testDir,
+'mvn clean package -DskipTests',
+'popd');
+LOG.info('Setup Done. Package ready to launch.');
+ }
+
+ @Test
+ void test1_Start() {
+String apaPath = testDir + "target/myapexapp-1.0-SNAPSHOT.apa";
+LOG.info('Starting apex application...');
+sh.exec('echo "launch ' + apaPath + '" | apex');
+
+String out = sh.getOut()[1].trim();
+LOG.info("ApplicationID: " + out);
+assertTrue(out.contains('{"appId": "application_'));
+out = out.replace('{"appId": "', '');
+appId = out.replace('"}', '');
+LOG.info('Sleeping for 20 sec for application to start...');
+sh.exec('sleep 20');
+sh.exec("yarn application -status " + appId);
+out = sh.getOut();
+for (String item : out) {
+ if (item.contains('Application-Id :')) {
+assertTrue(item.contains(appId));
+ }
+ if (item.contains('Application-Name :')) {
+assertTrue(item.contains('MyFirstApplication'));
+ }
+ if (item.contains('Application-Type :')) {
+assertTrue(item.contains('DataTorrent'));
+ }
+ else if (item.contains('State :')) {
+assertTrue(item.contains('RUNNING'));
+ }
+ else if (item.contains('Final-State :')) {
+assertTrue(item.contains('UNDEFINED'));
+ }
+}
+ }
+
+ @Test
+ void test2_Stop() {
+LOG.info('Stopping apex application..');
+sh.exec('echo "shutdown-app ' +