You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bigtop.apache.org by yw...@apache.org on 2016/04/07 16:02:21 UTC
bigtop git commit: BIGTOP-2315. Added smoke test for apex.
Repository: bigtop
Updated Branches:
refs/heads/master 64c262fca -> 66de460b8
BIGTOP-2315. Added smoke test for apex.
Signed-off-by: Youngwoo Kim <yw...@apache.org>
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 <ch...@datatorrent.com>
Authored: Thu Mar 3 23:08:38 2016 +0530
Committer: Youngwoo Kim <yw...@apache.org>
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 0000000..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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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 ' + appId + '" | apex');
+ LOG.info('Sleeping for 20 sec for application to stop...');
+ sh.exec('sleep 20');
+ sh.exec("yarn application -status " + appId);
+ String 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('FINISHED'));
+ }
+ else if (item.contains('Final-State :')) {
+ assertTrue(item.contains('SUCCEEDED'));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/smoke-tests/apex/build.gradle
----------------------------------------------------------------------
diff --git a/bigtop-tests/smoke-tests/apex/build.gradle b/bigtop-tests/smoke-tests/apex/build.gradle
new file mode 100644
index 0000000..cd5f6c2
--- /dev/null
+++ b/bigtop-tests/smoke-tests/apex/build.gradle
@@ -0,0 +1,34 @@
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.
+ */
+def tests_to_include() {
+ return ["TestApexSmoke.groovy"];
+}
+
+sourceSets {
+ test {
+ groovy {
+ resources {
+ srcDirs = [
+ "${BIGTOP_HOME}/bigtop-tests/test-artifacts/apex",
+ ]
+ }
+ srcDirs = [projectDir]
+ exclude { FileTreeElement elem -> (doExclude(elem.getName())) }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/test-artifacts/apex/pom.xml
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/apex/pom.xml b/bigtop-tests/test-artifacts/apex/pom.xml
new file mode 100644
index 0000000..e909d74
--- /dev/null
+++ b/bigtop-tests/test-artifacts/apex/pom.xml
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.example</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <artifactId>myapexapp</artifactId>
+ <packaging>jar</packaging>
+
+ <!-- change these to the appropriate values -->
+ <name>My Apex Application</name>
+ <description>My Apex Application Description</description>
+
+ <properties>
+ <!-- change this if you desire to use a different version of Apex Core -->
+ <apex.version>3.3.0-incubating</apex.version>
+ <apex.apppackage.classpath>lib/*.jar</apex.apppackage.classpath>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.3</version>
+ <configuration>
+ <encoding>UTF-8</encoding>
+ <source>1.7</source>
+ <target>1.7</target>
+ <debug>true</debug>
+ <optimize>false</optimize>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.8</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>target/deps</outputDirectory>
+ <includeScope>runtime</includeScope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>app-package-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.artifactId}-${project.version}-apexapp</finalName>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/assemble/appPackage.xml</descriptor>
+ </descriptors>
+ <archiverConfig>
+ <defaultDirectoryMode>0755</defaultDirectoryMode>
+ </archiverConfig>
+ <archive>
+ <manifestEntries>
+ <Class-Path>${apex.apppackage.classpath}</Class-Path>
+ <DT-Engine-Version>${apex.version}</DT-Engine-Version>
+ <DT-App-Package-Group-Id>${project.groupId}</DT-App-Package-Group-Id>
+ <DT-App-Package-Name>${project.artifactId}</DT-App-Package-Name>
+ <DT-App-Package-Version>${project.version}</DT-App-Package-Version>
+ <DT-App-Package-Display-Name>${project.name}</DT-App-Package-Display-Name>
+ <DT-App-Package-Description>${project.description}</DT-App-Package-Description>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <move file="${project.build.directory}/${project.artifactId}-${project.version}-apexapp.jar"
+ tofile="${project.build.directory}/${project.artifactId}-${project.version}.apa" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <!-- create resource directory for xml javadoc-->
+ <id>createJavadocDirectory</id>
+ <phase>generate-resources</phase>
+ <configuration>
+ <tasks>
+ <delete dir="${project.build.directory}/generated-resources/xml-javadoc"/>
+ <mkdir dir="${project.build.directory}/generated-resources/xml-javadoc"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.9.1</version>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>target/${project.artifactId}-${project.version}.apa</file>
+ <type>apa</type>
+ </artifact>
+ </artifacts>
+ <skipAttach>false</skipAttach>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.apex</groupId>
+ <artifactId>apex-common</artifactId>
+ <version>${apex.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.apex</groupId>
+ <artifactId>apex-engine</artifactId>
+ <version>${apex.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/test-artifacts/apex/src/assemble/appPackage.xml
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/apex/src/assemble/appPackage.xml b/bigtop-tests/test-artifacts/apex/src/assemble/appPackage.xml
new file mode 100644
index 0000000..0547979
--- /dev/null
+++ b/bigtop-tests/test-artifacts/apex/src/assemble/appPackage.xml
@@ -0,0 +1,59 @@
+<!--
+ 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.
+-->
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+ <id>appPackage</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}/target/</directory>
+ <outputDirectory>/app</outputDirectory>
+ <includes>
+ <include>${project.artifactId}-${project.version}.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/target/deps</directory>
+ <outputDirectory>/lib</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/site/conf</directory>
+ <outputDirectory>/conf</outputDirectory>
+ <includes>
+ <include>*.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/META-INF</directory>
+ <outputDirectory>/META-INF</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/app</directory>
+ <outputDirectory>/app</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>${basedir}/src/main/resources/resources</directory>
+ <outputDirectory>/resources</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+</assembly>
+
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/Application.java
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/Application.java b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/Application.java
new file mode 100644
index 0000000..a9663fb
--- /dev/null
+++ b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/Application.java
@@ -0,0 +1,41 @@
+/*
+* 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
+* <p>
+* http://www.apache.org/licenses/LICENSE-2.0
+* <p>
+* 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 com.example.myapexapp;
+
+import org.apache.hadoop.conf.Configuration;
+
+import com.datatorrent.api.annotation.ApplicationAnnotation;
+import com.datatorrent.api.StreamingApplication;
+import com.datatorrent.api.DAG;
+import com.datatorrent.api.DAG.Locality;
+
+@ApplicationAnnotation(name="MyFirstApplication")
+public class Application implements StreamingApplication
+{
+
+ @Override
+ public void populateDAG(DAG dag, Configuration conf)
+ {
+ RandomNumberGenerator randomGenerator = dag.addOperator("randomGenerator", RandomNumberGenerator.class);
+ randomGenerator.setNumTuples(500);
+
+ ConsoleOutputOperator cons = dag.addOperator("console", new ConsoleOutputOperator());
+
+ dag.addStream("randomData", randomGenerator.out, cons.input).setLocality(Locality.CONTAINER_LOCAL);
+ }
+}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/ConsoleOutputOperator.java
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/ConsoleOutputOperator.java b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/ConsoleOutputOperator.java
new file mode 100644
index 0000000..9c2f9b2
--- /dev/null
+++ b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/ConsoleOutputOperator.java
@@ -0,0 +1,79 @@
+/*
+* 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
+* <p>
+* http://www.apache.org/licenses/LICENSE-2.0
+* <p>
+* 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 com.example.myapexapp;
+
+import com.datatorrent.api.DefaultInputPort;
+import com.datatorrent.api.annotation.Stateless;
+import com.datatorrent.common.util.BaseOperator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Stateless
+public class ConsoleOutputOperator extends BaseOperator
+{
+ private static final Logger logger = LoggerFactory.getLogger(ConsoleOutputOperator.class);
+ public final transient DefaultInputPort<Object> input = new DefaultInputPort() {
+ public void process(Object t) {
+ String s;
+ if(ConsoleOutputOperator.this.stringFormat == null) {
+ s = t.toString();
+ } else {
+ s = String.format(ConsoleOutputOperator.this.stringFormat, new Object[]{t});
+ }
+
+ if(!ConsoleOutputOperator.this.silent) {
+ System.out.println(s);
+ }
+
+ if(ConsoleOutputOperator.this.debug) {
+ ConsoleOutputOperator.logger.info(s);
+ }
+
+ }
+ };
+ public boolean silent = false;
+ private boolean debug;
+ private String stringFormat;
+
+ public ConsoleOutputOperator() {
+ }
+
+ public boolean isSilent() {
+ return this.silent;
+ }
+
+ public void setSilent(boolean silent) {
+ this.silent = silent;
+ }
+
+ public boolean isDebug() {
+ return this.debug;
+ }
+
+ public void setDebug(boolean debug) {
+ this.debug = debug;
+ }
+
+ public String getStringFormat() {
+ return this.stringFormat;
+ }
+
+ public void setStringFormat(String stringFormat) {
+ this.stringFormat = stringFormat;
+ }
+}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/RandomNumberGenerator.java
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/RandomNumberGenerator.java b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/RandomNumberGenerator.java
new file mode 100644
index 0000000..63d7c04
--- /dev/null
+++ b/bigtop-tests/test-artifacts/apex/src/main/java/com/example/myapexapp/RandomNumberGenerator.java
@@ -0,0 +1,61 @@
+/*
+* 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
+* <p>
+* http://www.apache.org/licenses/LICENSE-2.0
+* <p>
+* 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 com.example.myapexapp;
+
+import com.datatorrent.api.DefaultOutputPort;
+import com.datatorrent.api.InputOperator;
+import com.datatorrent.common.util.BaseOperator;
+
+/**
+ * This is a simple operator that emits random number.
+ */
+public class RandomNumberGenerator extends BaseOperator implements InputOperator
+{
+ private int numTuples = 100;
+ private transient int count = 0;
+
+ public final transient DefaultOutputPort<Double> out = new DefaultOutputPort<Double>();
+
+ @Override
+ public void beginWindow(long windowId)
+ {
+ count = 0;
+ }
+
+ @Override
+ public void emitTuples()
+ {
+ if (count++ < numTuples) {
+ out.emit(Math.random());
+ }
+ }
+
+ public int getNumTuples()
+ {
+ return numTuples;
+ }
+
+ /**
+ * Sets the number of tuples to be emitted every window.
+ * @param numTuples number of tuples
+ */
+ public void setNumTuples(int numTuples)
+ {
+ this.numTuples = numTuples;
+ }
+}
http://git-wip-us.apache.org/repos/asf/bigtop/blob/66de460b/bigtop-tests/test-artifacts/apex/src/main/resources/META-INF/properties.xml
----------------------------------------------------------------------
diff --git a/bigtop-tests/test-artifacts/apex/src/main/resources/META-INF/properties.xml b/bigtop-tests/test-artifacts/apex/src/main/resources/META-INF/properties.xml
new file mode 100644
index 0000000..023aa05
--- /dev/null
+++ b/bigtop-tests/test-artifacts/apex/src/main/resources/META-INF/properties.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--
+ 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.
+-->
+<configuration>
+ <property>
+ <name>dt.application.MyFirstApplication.operator.randomGenerator.prop.numTuples</name>
+ <value>1000</value>
+ </property>
+ <property>
+ <name>dt.application.MyFirstApplication.operator.console.prop.stringFormat</name>
+ <value>hello world: %s</value>
+ </property>
+</configuration>
+