You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by da...@apache.org on 2016/08/23 20:15:02 UTC
apex-core git commit: APEXCORE-512 While processing the "-exactMatch"
flag, immutable list was required.
Repository: apex-core
Updated Branches:
refs/heads/master eedd467e0 -> d651edc60
APEXCORE-512 While processing the "-exactMatch" flag, immutable list was required.
Project: http://git-wip-us.apache.org/repos/asf/apex-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-core/commit/d651edc6
Tree: http://git-wip-us.apache.org/repos/asf/apex-core/tree/d651edc6
Diff: http://git-wip-us.apache.org/repos/asf/apex-core/diff/d651edc6
Branch: refs/heads/master
Commit: d651edc608a14a6f0718b3022e4ad43bca21571e
Parents: eedd467
Author: sandeshh <sa...@gmail.com>
Authored: Mon Aug 22 11:47:32 2016 -0700
Committer: sandeshh <sa...@gmail.com>
Committed: Mon Aug 22 13:26:45 2016 -0700
----------------------------------------------------------------------
.../java/com/datatorrent/stram/cli/ApexCli.java | 2 +-
.../com/datatorrent/stram/cli/ApexCliTest.java | 2 +-
.../stram/client/AppPackageTest.java | 19 +++++++--
.../java/com/example/mydtapp/Application2.java | 43 ++++++++++++++++++++
4 files changed, 60 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/apex-core/blob/d651edc6/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
----------------------------------------------------------------------
diff --git a/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java b/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
index 91d29bd..2ecff9f 100644
--- a/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
+++ b/engine/src/main/java/com/datatorrent/stram/cli/ApexCli.java
@@ -3456,7 +3456,7 @@ public class ApexCli
matchAppName = commandLineInfo.args[1];
}
- List<AppInfo> applications = getAppsFromPackageAndConfig(ap, cp, commandLineInfo.useConfigApps);
+ List<AppInfo> applications = new ArrayList<>(getAppsFromPackageAndConfig(ap, cp, commandLineInfo.useConfigApps));
if (matchAppName != null) {
Iterator<AppInfo> it = applications.iterator();
http://git-wip-us.apache.org/repos/asf/apex-core/blob/d651edc6/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
----------------------------------------------------------------------
diff --git a/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java b/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
index c049e5b..aaf801d 100644
--- a/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
+++ b/engine/src/test/java/com/datatorrent/stram/cli/ApexCliTest.java
@@ -150,7 +150,7 @@ public class ApexCliTest
ApexCli.LaunchCommandLineInfo commandLineInfo = ApexCli
.getLaunchCommandLineInfo(new String[]{"-exactMatch", "-conf", configFile.getAbsolutePath(), appFile.getAbsolutePath(), "MyFirstApplication"});
- commandLineInfo.args = new String[] {"MyFirstApplication"};
+ commandLineInfo.args = new String[] {"testApp", "MyFirstApplication"};
String[] args = cli.getLaunchAppPackageArgs(ap, cp, commandLineInfo, null);
commandLineInfo = ApexCli.getLaunchCommandLineInfo(args);
http://git-wip-us.apache.org/repos/asf/apex-core/blob/d651edc6/engine/src/test/java/com/datatorrent/stram/client/AppPackageTest.java
----------------------------------------------------------------------
diff --git a/engine/src/test/java/com/datatorrent/stram/client/AppPackageTest.java b/engine/src/test/java/com/datatorrent/stram/client/AppPackageTest.java
index 9999f01..0ea760f 100644
--- a/engine/src/test/java/com/datatorrent/stram/client/AppPackageTest.java
+++ b/engine/src/test/java/com/datatorrent/stram/client/AppPackageTest.java
@@ -20,7 +20,9 @@ package com.datatorrent.stram.client;
import java.io.File;
import java.io.IOException;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.codehaus.jettison.json.JSONException;
@@ -90,11 +92,20 @@ public class AppPackageTest
Assert.assertEquals(System.getProperty("apex.version", "3.4.0"), json.getString("dtEngineVersion"));
Assert.assertEquals("lib/*.jar", json.getJSONArray("classPath").getString(0));
- JSONObject application = json.getJSONArray("applications").getJSONObject(0);
- Assert.assertEquals("MyFirstApplication", application.getString("name"));
- Assert.assertEquals("mydtapp-1.0-SNAPSHOT.jar", application.getString("file"));
+ JSONObject application1 = json.getJSONArray("applications").getJSONObject(0);
+ JSONObject application2 = json.getJSONArray("applications").getJSONObject(1);
- JSONObject dag = application.getJSONObject("dag");
+ Map<String, JSONObject> apps = new HashMap<>();
+
+ apps.put(application1.getString("name"), application1);
+ apps.put(application2.getString("name"), application2);
+
+ Assert.assertEquals(true, apps.containsKey("MyFirstApplication"));
+ Assert.assertEquals(true, apps.containsKey("MySecondApplication"));
+
+ Assert.assertEquals("mydtapp-1.0-SNAPSHOT.jar", apps.get("MyFirstApplication").getString("file"));
+
+ JSONObject dag = apps.get("MyFirstApplication").getJSONObject("dag");
Assert.assertTrue("There is at least one stream", dag.getJSONArray("streams").length() >= 1);
Assert.assertEquals("There are two operator", 2, dag.getJSONArray("operators").length());
http://git-wip-us.apache.org/repos/asf/apex-core/blob/d651edc6/engine/src/test/resources/testAppPackage/mydtapp/src/main/java/com/example/mydtapp/Application2.java
----------------------------------------------------------------------
diff --git a/engine/src/test/resources/testAppPackage/mydtapp/src/main/java/com/example/mydtapp/Application2.java b/engine/src/test/resources/testAppPackage/mydtapp/src/main/java/com/example/mydtapp/Application2.java
new file mode 100644
index 0000000..cc4b6d5
--- /dev/null
+++ b/engine/src/test/resources/testAppPackage/mydtapp/src/main/java/com/example/mydtapp/Application2.java
@@ -0,0 +1,43 @@
+/**
+ * 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 com.example.mydtapp;
+
+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="MySecondApplication")
+public class Application2 implements StreamingApplication
+{
+
+ @Override
+ public void populateDAG(DAG dag, Configuration conf)
+ {
+ // Sample DAG with 2 operators
+ // Replace this code with the DAG you want to build
+
+ RandomNumberGenerator rand = dag.addOperator("rand", RandomNumberGenerator.class);
+ StdoutOperator stdout = dag.addOperator("stdout", new StdoutOperator());
+
+ dag.addStream("data", rand.out, stdout.in).setLocality(Locality.CONTAINER_LOCAL);
+ }
+}