eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinh...@apache.org
Subject incubator-eagle git commit: [EAGLE-783] Add unit test for eagle-jpm-util.
Date Thu, 17 Nov 2016 12:28:16 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 4874433a5 -> d6e78bec2


[EAGLE-783] Add unit test for eagle-jpm-util.

 - Add unit test for eagle-jpm-util.

https://issues.apache.org/jira/browse/EAGLE-783

Author: r7raul1984 <tangjijun@yhd.com>

Closes #663 from r7raul1984/EAGLE-783.


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/d6e78bec
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/d6e78bec
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/d6e78bec

Branch: refs/heads/master
Commit: d6e78bec28b804f3c6bfaec2f69774a717f5cbaa
Parents: 4874433
Author: r7raul1984 <tangjijun@yhd.com>
Authored: Thu Nov 17 20:28:09 2016 +0800
Committer: wujinhu <wujinhu920@126.com>
Committed: Thu Nov 17 20:28:09 2016 +0800

----------------------------------------------------------------------
 eagle-jpm/eagle-jpm-util/pom.xml                |  12 +++
 .../jpm/util/resourcefetch/model/AppInfo.java   |  25 +++++
 .../util/resourcefetch/model/ClusterInfo.java   |  18 +++-
 .../jpm/util/DefaultJobIdPartitionerTest.java   |  29 +++++
 .../apache/eagle/jpm/util/JSONUtilsTest.java    |  79 ++++++++++++++
 .../jpm/util/JobNameNormalizationTest.java      |  45 ++++++++
 .../org/apache/eagle/jpm/util/UtilsTest.java    |  67 ++++++++++++
 .../jobcounter/JobCountersSerDeserTest.java     |  46 ++++++++
 .../resourcefetch/RMResourceFetcherTest.java    | 105 +++++++++++++++++++
 .../resourcefetch/ha/HAURLSelectorImplTest.java | 102 ++++++++++++++++++
 .../url/JobListServiceURLBuilderImplTest.java   |  37 +++++++
 ...arkCompleteJobServiceURLBuilderImplTest.java |  30 ++++++
 .../url/SparkJobServiceURLBuilderImplTest.java  |  30 ++++++
 .../jpm/util/resourcefetch/url/URLUtilTest.java |  35 +++++++
 .../src/test/resources/clusterinfo.json         |  15 +++
 .../src/test/resources/mrcompleteapp.json       |  54 ++++++++++
 .../src/test/resources/mrrunningapp.json        |  64 +++++++++++
 .../src/test/resources/sparkcompleteapp.json    |  64 +++++++++++
 .../src/test/resources/sparkrunningapp.json     |  64 +++++++++++
 eagle-security/eagle-security-oozie-web/pom.xml |   4 -
 pom.xml                                         |   2 +
 21 files changed, 922 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/pom.xml b/eagle-jpm/eagle-jpm-util/pom.xml
index e424e49..575ea8c 100644
--- a/eagle-jpm/eagle-jpm-util/pom.xml
+++ b/eagle-jpm/eagle-jpm-util/pom.xml
@@ -68,5 +68,17 @@
             <artifactId>commons-codec</artifactId>
             <version>1.9</version>
         </dependency>
+        <dependency>
+            <groupId>org.powermock</groupId>
+            <artifactId>powermock-module-junit4</artifactId>
+            <version>${powermock.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.powermock</groupId>
+            <artifactId>powermock-api-mockito</artifactId>
+            <version>${powermock.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
index f769217..6166a5d 100644
--- a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
+++ b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/AppInfo.java
@@ -207,4 +207,29 @@ public class AppInfo implements Serializable {
         this.runningContainers = runningContainers;
     }
 
+    @Override
+    public String toString() {
+        return "AppInfo{"
+                + "id='" + id + '\''
+                + ", user='" + user + '\''
+                + ", name='" + name + '\''
+                + ", queue='" + queue + '\''
+                + ", state='" + state + '\''
+                + ", finalStatus='" + finalStatus + '\''
+                + ", progress=" + progress
+                + ", trackingUI='" + trackingUI + '\''
+                + ", trackingUrl='" + trackingUrl + '\''
+                + ", diagnostics='" + diagnostics + '\''
+                + ", clusterId='" + clusterId + '\''
+                + ", applicationType='" + applicationType + '\''
+                + ", startedTime=" + startedTime
+                + ", finishedTime=" + finishedTime
+                + ", elapsedTime=" + elapsedTime
+                + ", amContainerLogs='" + amContainerLogs + '\''
+                + ", amHostHttpAddress='" + amHostHttpAddress + '\''
+                + ", allocatedMB=" + allocatedMB
+                + ", allocatedVCores=" + allocatedVCores
+                + ", runningContainers=" + runningContainers
+                + '}';
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/ClusterInfo.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/ClusterInfo.java b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/ClusterInfo.java
index 6e16b7f..82299d9 100644
--- a/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/ClusterInfo.java
+++ b/eagle-jpm/eagle-jpm-util/src/main/java/org/apache/eagle/jpm/util/resourcefetch/model/ClusterInfo.java
@@ -116,4 +116,20 @@ public class ClusterInfo implements Serializable {
     public void setHadoopVersionBuiltOn(String hadoopVersionBuiltOn) {
         this.hadoopVersionBuiltOn = hadoopVersionBuiltOn;
     }
-}
+
+    @Override
+    public String toString() {
+        return "ClusterInfo{"
+                + "id=" + id
+                + ", startedOn=" + startedOn
+                + ", state='" + state + '\''
+                + ", haState='" + haState + '\''
+                + ", resourceManagerVersion='" + resourceManagerVersion + '\''
+                + ", resourceManagerBuildVersion='" + resourceManagerBuildVersion + '\''
+                + ", resourceManagerVersionBuiltOn='" + resourceManagerVersionBuiltOn + '\''
+                + ", hadoopVersion='" + hadoopVersion + '\''
+                + ", hadoopBuildVersion='" + hadoopBuildVersion + '\''
+                + ", hadoopVersionBuiltOn='" + hadoopVersionBuiltOn + '\''
+                + '}';
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/DefaultJobIdPartitionerTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/DefaultJobIdPartitionerTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/DefaultJobIdPartitionerTest.java
new file mode 100644
index 0000000..22b1fdf
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/DefaultJobIdPartitionerTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.eagle.jpm.util;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class DefaultJobIdPartitionerTest {
+    @Test
+    public void testPartition() {
+        DefaultJobIdPartitioner defaultJobIdPartitioner = new DefaultJobIdPartitioner();
+        Assert.assertEquals(0, defaultJobIdPartitioner.partition(5, "application_1479206441898_35343"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JSONUtilsTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JSONUtilsTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JSONUtilsTest.java
new file mode 100644
index 0000000..8e2edc5
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JSONUtilsTest.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
+ *
+ *    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.eagle.jpm.util;
+
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class JSONUtilsTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testGetString() throws ParseException {
+        JSONParser parser = new JSONParser();
+        JSONObject jsonObject = (JSONObject) parser.parse("{\"id\":\"application_1479206441898_30784\",\"isYhd\":\"pms\"}");
+        Assert.assertEquals("application_1479206441898_30784", JSONUtils.getString(jsonObject, "id"));
+    }
+
+    @Test
+    public void testGetBoolean() throws ParseException {
+        JSONParser parser = new JSONParser();
+        JSONObject jsonObject = (JSONObject) parser.parse("{\"id\":\"application_1479206441898_30784\",\"isYhd\":true}");
+        Assert.assertEquals(Boolean.TRUE, JSONUtils.getBoolean(jsonObject, "isYhd"));
+        jsonObject = (JSONObject) parser.parse("{\"id\":\"application_1479206441898_30784\",\"isYhd\":false}");
+        Assert.assertEquals(Boolean.FALSE, JSONUtils.getBoolean(jsonObject, "isYhd"));
+    }
+
+    @Test
+    public void testGetLong() throws ParseException {
+        JSONParser parser = new JSONParser();
+        JSONObject jsonObject = (JSONObject) parser.parse("{\"salary\":2000,\"isYhd\":\"false\"}");
+        Assert.assertEquals(2000, JSONUtils.getLong(jsonObject, "salary"));
+    }
+
+    @Test
+    public void testGetLong1() throws ParseException {
+        thrown.expect(ClassCastException.class);
+        JSONParser parser = new JSONParser();
+        JSONObject jsonObject = (JSONObject) parser.parse("{\"salary\":\"2000\",\"isYhd\":\"false\"}");
+        Assert.assertEquals(2000, JSONUtils.getLong(jsonObject, "salary"));
+    }
+
+
+    @Test
+    public void testGetInt() throws ParseException {
+        JSONParser parser = new JSONParser();
+        JSONObject jsonObject = (JSONObject) parser.parse("{\"salary\":\"2000\",\"isYhd\":\"false\"}");
+        Assert.assertEquals(2000, JSONUtils.getInt(jsonObject, "salary"));
+    }
+
+    @Test
+    public void testGetInt1() throws ParseException {
+        thrown.expect(org.json.JSONException.class);
+        JSONParser parser = new JSONParser();
+        JSONObject jsonObject = (JSONObject) parser.parse("{\"salary\":\"xxx\",\"isYhd\":\"false\"}");
+        Assert.assertEquals(2000, JSONUtils.getInt(jsonObject, "salary"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JobNameNormalizationTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JobNameNormalizationTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JobNameNormalizationTest.java
new file mode 100644
index 0000000..92a16ec
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/JobNameNormalizationTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.eagle.jpm.util;
+
+import com.typesafe.config.Config;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class JobNameNormalizationTest {
+
+
+    @Test
+    public void testNormalization() {
+        Config config = mock(Config.class);
+        when(config.hasPath("job.name.normalization.rules.key")).thenReturn(true);
+        when(config.getString("job.name.normalization.rules.key")).thenReturn(Constants.JOB_NAME_NORMALIZATION_RULES_KEY_DEFAULT);
+        JobNameNormalization jobNameNormalization = org.apache.eagle.jpm.util.JobNameNormalization.getInstance(config);
+        Assert.assertEquals("oozie:launcher-shell-wf_co_xxx_for_xxx_v3-extract_org_data~", jobNameNormalization.normalize("oozie:launcher:T=shell:W=wf_co_xxx_for_xxx_v3:A=extract_org_data:ID=0002383-161115184801730-oozie-oozi-W"));
+        Assert.assertEquals("[HQL]wireless_exclusive_products_sales", jobNameNormalization.normalize("[HQL]wireless_exclusive_products_sales"));
+        Assert.assertEquals("insert overwrite table inter...a.xxx(Stage-3)", jobNameNormalization.normalize("insert overwrite table inter...a.xxx(Stage-3)"));
+        Assert.assertEquals("uuid~", jobNameNormalization.normalize("cfc64640-f679-4d38-9d2c-b9c8310e4398"));
+        Assert.assertEquals("~", jobNameNormalization.normalize("1111/11/11/11"));
+        Assert.assertEquals("YHD~", jobNameNormalization.normalize("YHD1111/11/11/11"));
+        Assert.assertEquals("YHD~", jobNameNormalization.normalize("YHD11111111/11_11"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/UtilsTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/UtilsTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/UtilsTest.java
new file mode 100644
index 0000000..b29a8e0
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/UtilsTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.eagle.jpm.util;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class UtilsTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testDateTimeToLong() {
+        long timestamp = Utils.dateTimeToLong("2016-11-11T19:35:40.715GMT");
+        Assert.assertEquals(1478892940715l, timestamp);
+
+        timestamp = Utils.dateTimeToLong("2016-11-11T19:35:40.715GXMT");
+        Assert.assertEquals(0l, timestamp);
+    }
+
+    @Test
+    public void testParseMemory() {
+        long mem = Utils.parseMemory("");
+        Assert.assertEquals(0l, mem);
+        mem = Utils.parseMemory("1g");
+        Assert.assertEquals(1073741824l, mem);
+        mem = Utils.parseMemory("1m");
+        Assert.assertEquals(1048576l, mem);
+        mem = Utils.parseMemory("1k");
+        Assert.assertEquals(1024, mem);
+        mem = Utils.parseMemory("1t");
+        Assert.assertEquals(1099511627776l, mem);
+        mem = Utils.parseMemory("1p");
+        Assert.assertEquals(1125899906842624l, mem);
+        mem = Utils.parseMemory("10000p");//overflow
+        Assert.assertEquals(-7187745005283311616l, mem);
+    }
+
+    @Test
+    public void testParseMemory1() {
+        thrown.expect(IllegalArgumentException.class);
+        Utils.parseMemory("0.1g");
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/jobcounter/JobCountersSerDeserTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/jobcounter/JobCountersSerDeserTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/jobcounter/JobCountersSerDeserTest.java
new file mode 100644
index 0000000..9f676bd
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/jobcounter/JobCountersSerDeserTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.eagle.jpm.util.jobcounter;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class JobCountersSerDeserTest {
+    @Test
+    public void testSerializeAndDeserialize() {
+        JobCountersSerDeser jobCountersSerDeser = new JobCountersSerDeser();
+        JobCounters jobCounters = new JobCounters();
+        Map<String, Map<String, Long>> counters = new HashMap<>();
+        Map<String, Long> taskCounters = new HashMap<>();
+        taskCounters.put(JobCounters.CounterName.CPU_MILLISECONDS.getName(), 18l);
+        taskCounters.put(JobCounters.CounterName.GC_MILLISECONDS.getName(), 17l);
+        taskCounters.put(JobCounters.CounterName.SPLIT_RAW_BYTES.getName(), 1l);
+        counters.put(JobCounters.GroupName.MapReduceTaskCounter.getName(), taskCounters);
+        jobCounters.setCounters(counters);
+
+        JobCounters jobCounters1 = new JobCounters();
+        jobCounters1.setCounters(jobCountersSerDeser.deserialize(jobCountersSerDeser.serialize(jobCounters)).getCounters());
+
+        Assert.assertEquals(18l,jobCounters1.getCounterValue(JobCounters.CounterName.CPU_MILLISECONDS).longValue());
+        Assert.assertEquals(17l,jobCounters1.getCounterValue(JobCounters.CounterName.GC_MILLISECONDS).longValue());
+        Assert.assertEquals(1l,jobCounters1.getCounterValue(JobCounters.CounterName.SPLIT_RAW_BYTES).longValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/RMResourceFetcherTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/RMResourceFetcherTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/RMResourceFetcherTest.java
new file mode 100644
index 0000000..29429f2
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/RMResourceFetcherTest.java
@@ -0,0 +1,105 @@
+/*
+ * 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.eagle.jpm.util.resourcefetch;
+
+import org.apache.eagle.jpm.util.Constants;
+import org.apache.eagle.jpm.util.resourcefetch.connection.InputStreamUtils;
+import org.apache.eagle.jpm.util.resourcefetch.model.AppInfo;
+import org.apache.eagle.jpm.util.resourcefetch.model.ClusterInfo;
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+import java.io.InputStream;
+import java.util.List;
+
+import static org.mockito.Mockito.when;
+import static org.powermock.api.mockito.PowerMockito.mockStatic;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(InputStreamUtils.class)
+public class RMResourceFetcherTest {
+    @Test
+    public void testCompleteMrJob() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        RMResourceFetcher rmResourceFetcher = new RMResourceFetcher(rmBasePaths);
+        InputStream jsonstream = this.getClass().getResourceAsStream("/mrcompleteapp.json");
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?applicationTypes=MAPREDUCE&state=FINISHED&finishedTimeBegin=1479244718794&anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(jsonstream);
+        String lastFinishedTime = "1479244718794";
+        List<AppInfo> appInfos = rmResourceFetcher.getResource(Constants.ResourceType.COMPLETE_MR_JOB, lastFinishedTime);
+        Assert.assertEquals(2, appInfos.size());
+        Assert.assertEquals("AppInfo{id='application_1326815542473_0001', user='user1', name='insert overwrite table xx.yy...end(Stage-1)', queue='default', state='FINISHED', finalStatus='SUCCEEDED', progress=100.0, trackingUI='History', trackingUrl='http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473_1_1', diagnostics='diagnostics1', clusterId='1326815542473', applicationType='MAPREDUCE', startedTime=1326815573334, finishedTime=1479244718794, elapsedTime=25196, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001', amHostHttpAddress='host.domain.com:8042', allocatedMB=0, allocatedVCores=0, runningContainers=0}", appInfos.get(0).toString());
+        Assert.assertEquals("AppInfo{id='application_1326815542473_0002', user='user1', name='Sleep job', queue='default', state='FINISHED', finalStatus='SUCCEEDED', progress=100.0, trackingUI='History', trackingUrl='http://host.domain.com:8088/proxy/application_1326815542473_0002/jobhistory/job/job_1326815542473_2_2', diagnostics='diagnostics2', clusterId='1326815542473', applicationType='MAPREDUCE', startedTime=1326815641380, finishedTime=1326815789546, elapsedTime=148166, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_1326815542473_0002_01_000001', amHostHttpAddress='host.domain.com:8042', allocatedMB=0, allocatedVCores=0, runningContainers=1}", appInfos.get(1).toString());
+    }
+
+    @Test
+    public void testRunningMrJob() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        RMResourceFetcher rmResourceFetcher = new RMResourceFetcher(rmBasePaths);
+        InputStream jsonstream = this.getClass().getResourceAsStream("/mrrunningapp.json");
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?applicationTypes=MAPREDUCE&state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(jsonstream);
+        List<AppInfo> appInfos = rmResourceFetcher.getResource(Constants.ResourceType.RUNNING_MR_JOB);
+        Assert.assertEquals(2, appInfos.size());
+        Assert.assertEquals("AppInfo{id='application_1479206441898_30784', user='xxx', name='oozie:launcher:T=shell:W=wf_co_xxx_xxx_v3:A=extract_org_data:ID=0002383-161115184801730-oozie-oozi-W', queue='xxx', state='RUNNING', finalStatus='UNDEFINED', progress=95.0, trackingUI='ApplicationMaster', trackingUrl='http://host.domain.com:8088/proxy/application_1479206441898_30784/', diagnostics='', clusterId='1479206441898', applicationType='MAPREDUCE', startedTime=1479328221694, finishedTime=0, elapsedTime=13367402, amContainerLogs='http://host.domain.com:8088/node/containerlogs/container_e11_1479206441898_30784_01_000001/xxx', amHostHttpAddress='host.domain.com:8088', allocatedMB=3072, allocatedVCores=2, runningContainers=2}", appInfos.get(0).toString());
+        Assert.assertEquals("AppInfo{id='application_1479206441898_35341', user='yyy', name='insert overwrite table inter...a.xxx(Stage-3)', queue='yyy', state='RUNNING', finalStatus='UNDEFINED', progress=59.545456, trackingUI='ApplicationMaster', trackingUrl='http://host.domain.com:8088/proxy/application_1479206441898_35341/', diagnostics='', clusterId='1479206441898', applicationType='MAPREDUCE', startedTime=1479341511477, finishedTime=0, elapsedTime=77619, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_e11_1479206441898_35341_01_000005/yyy', amHostHttpAddress='host.domain.com:8042', allocatedMB=27648, allocatedVCores=6, runningContainers=6}", appInfos.get(1).toString());
+    }
+
+    @Test
+    public void testSparkRunningJob() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        RMResourceFetcher rmResourceFetcher = new RMResourceFetcher(rmBasePaths);
+        InputStream jsonstream = this.getClass().getResourceAsStream("/sparkrunningapp.json");
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?applicationTypes=SPARK&state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(jsonstream);
+
+        List<AppInfo> appInfos = rmResourceFetcher.getResource(Constants.ResourceType.RUNNING_SPARK_JOB);
+        Assert.assertEquals(2, appInfos.size());
+        Assert.assertEquals("AppInfo{id='application_1479196259121_1041', user='xxx', name='Spark shell', queue='default', state='RUNNING', finalStatus='UNDEFINED', progress=10.0, trackingUI='ApplicationMaster', trackingUrl='http://host.domain.com:8088/proxy/application_1479196259121_1041/', diagnostics='', clusterId='1479206441898', applicationType='SPARK', startedTime=1479202371723, finishedTime=0, elapsedTime=147954814, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_e09_1479196259121_1041_01_000001/xxx', amHostHttpAddress='host.domain.com:8042', allocatedMB=7168, allocatedVCores=3, runningContainers=3}", appInfos.get(0).toString());
+        Assert.assertEquals("AppInfo{id='application_1478655515028_74912', user='xxx', name='spark-thriftserver', queue='default', state='RUNNING', finalStatus='UNDEFINED', progress=10.0, trackingUI='ApplicationMaster', trackingUrl='http://host.domain.com:8088/proxy/application_1478655515028_74912/', diagnostics='', clusterId='1479206441898', applicationType='SPARK', startedTime=1478844771535, finishedTime=0, elapsedTime=505555002, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_e10_1478655515028_74912_02_000001/xxx', amHostHttpAddress='host.domain.com:8042', allocatedMB=3113984, allocatedVCores=191, runningContainers=191}", appInfos.get(1).toString());
+    }
+
+    @Test
+    public void testCompleteSparkJob() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        RMResourceFetcher rmResourceFetcher = new RMResourceFetcher(rmBasePaths);
+        InputStream jsonstream = this.getClass().getResourceAsStream("/sparkcompleteapp.json");
+        mockStatic(InputStreamUtils.class);
+        long finishedTimeBegin = 1479244718794l;
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?applicationTypes=SPARK&state=FINISHED&finishedTimeBegin=1479244718794&anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(jsonstream);
+        List<AppInfo> appInfos = rmResourceFetcher.getResource(Constants.ResourceType.COMPLETE_SPARK_JOB, String.valueOf(finishedTimeBegin));
+        Assert.assertEquals(2, appInfos.size());
+        Assert.assertEquals("AppInfo{id='application_1479196259121_1041', user='xxx', name='Spark shell', queue='default', state='FINISHED', finalStatus='SUCCEEDED', progress=10.0, trackingUI='ApplicationMaster', trackingUrl='http://host.domain.com:8088/proxy/application_1479196259121_1041/', diagnostics='', clusterId='1479206441898', applicationType='SPARK', startedTime=1479202371723, finishedTime=1479244718794, elapsedTime=147954814, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_e09_1479196259121_1041_01_000001/xxx', amHostHttpAddress='host.domain.com:8042', allocatedMB=7168, allocatedVCores=3, runningContainers=3}", appInfos.get(0).toString());
+        Assert.assertEquals("AppInfo{id='application_1478655515028_74912', user='xxx', name='spark-thriftserver', queue='default', state='FINISHED', finalStatus='SUCCEEDED', progress=10.0, trackingUI='ApplicationMaster', trackingUrl='http://host.domain.com:8088/proxy/application_1478655515028_74912/', diagnostics='', clusterId='1479206441898', applicationType='SPARK', startedTime=1478844771535, finishedTime=1479244718794, elapsedTime=505555002, amContainerLogs='http://host.domain.com:8042/node/containerlogs/container_e10_1478655515028_74912_02_000001/xxx', amHostHttpAddress='host.domain.com:8042', allocatedMB=3113984, allocatedVCores=191, runningContainers=191}", appInfos.get(1).toString());
+    }
+
+
+    @Test
+    public void testGetClusterInfo() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        RMResourceFetcher rmResourceFetcher = new RMResourceFetcher(rmBasePaths);
+        mockStatic(InputStreamUtils.class);
+        InputStream jsonstream = this.getClass().getResourceAsStream("/clusterinfo.json");
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/info?anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(jsonstream);
+        ClusterInfo clusterInfo = rmResourceFetcher.getClusterInfo();
+        Assert.assertEquals("ClusterInfo{id=1324053971963, startedOn=1324053971963, state='STARTED', haState='ACTIVE', resourceManagerVersion='0.23.1-SNAPSHOT', resourceManagerBuildVersion='0.23.1-SNAPSHOT from 1214049 by user1 source checksum 050cd664439d931c8743a6428fd6a693', resourceManagerVersionBuiltOn='Tue Dec 13 22:12:48 CST 2011', hadoopVersion='0.23.1-SNAPSHOT', hadoopBuildVersion='0.23.1-SNAPSHOT from 1214049 by user1 source checksum 11458df3bb77342dca5f917198fad328', hadoopVersionBuiltOn='Tue Dec 13 22:12:26 CST 2011'}", clusterInfo.toString());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/ha/HAURLSelectorImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/ha/HAURLSelectorImplTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/ha/HAURLSelectorImplTest.java
new file mode 100644
index 0000000..8c958a3
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/ha/HAURLSelectorImplTest.java
@@ -0,0 +1,102 @@
+/*
+ * 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.eagle.jpm.util.resourcefetch.ha;
+
+import org.apache.eagle.jpm.util.Constants;
+import org.apache.eagle.jpm.util.resourcefetch.connection.InputStreamUtils;
+import org.apache.eagle.jpm.util.resourcefetch.url.JobListServiceURLBuilderImpl;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+
+import java.io.IOException;
+
+import static org.mockito.Mockito.when;
+import static org.powermock.api.mockito.PowerMockito.mockStatic;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(InputStreamUtils.class)
+public class HAURLSelectorImplTest {
+
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @Test
+    public void testCheckUrl() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        HAURLSelectorImpl haurlSelector = new HAURLSelectorImpl(rmBasePaths, new JobListServiceURLBuilderImpl(), Constants.CompressionType.GZIP);
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088", null, Constants.CompressionType.GZIP)).thenReturn(null);
+        Assert.assertTrue(haurlSelector.checkUrl("http://www.xxx.com:8088"));
+    }
+
+    @Test
+    public void testCheckUrl1() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        HAURLSelectorImpl haurlSelector = new HAURLSelectorImpl(rmBasePaths, new JobListServiceURLBuilderImpl(), Constants.CompressionType.GZIP);
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088", null, Constants.CompressionType.GZIP)).thenThrow(new Exception());
+        Assert.assertFalse(haurlSelector.checkUrl("http://www.xxx.com:8088"));
+    }
+
+    @Test
+    public void testGetSelectedUrl() {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        HAURLSelectorImpl haurlSelector = new HAURLSelectorImpl(rmBasePaths, new JobListServiceURLBuilderImpl(), Constants.CompressionType.GZIP);
+        Assert.assertEquals(rmBasePaths[0], haurlSelector.getSelectedUrl());
+    }
+
+    @Test
+    public void testReSelectUrl() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        HAURLSelectorImpl haurlSelector = new HAURLSelectorImpl(rmBasePaths, new JobListServiceURLBuilderImpl(), Constants.CompressionType.GZIP);
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenThrow(new Exception());
+        when(InputStreamUtils.getInputStream("http://www.yyy.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(null);
+        haurlSelector.reSelectUrl();
+        Assert.assertEquals(rmBasePaths[1], haurlSelector.getSelectedUrl());
+    }
+
+    @Test
+    public void testReSelectUrl1() throws Exception {
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        HAURLSelectorImpl haurlSelector = new HAURLSelectorImpl(rmBasePaths, new JobListServiceURLBuilderImpl(), Constants.CompressionType.GZIP);
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenReturn(null);
+        when(InputStreamUtils.getInputStream("http://www.yyy.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenThrow(new Exception());
+        haurlSelector.reSelectUrl();
+        Assert.assertEquals(rmBasePaths[0], haurlSelector.getSelectedUrl());
+    }
+
+
+    @Test
+    public void testReSelectUrl2() throws Exception {
+        thrown.expect(IOException.class);
+        String[] rmBasePaths = new String[]{"http://www.xxx.com:8088", "http://www.yyy.com:8088"};
+        HAURLSelectorImpl haurlSelector = new HAURLSelectorImpl(rmBasePaths, new JobListServiceURLBuilderImpl(), Constants.CompressionType.GZIP);
+        mockStatic(InputStreamUtils.class);
+        when(InputStreamUtils.getInputStream("http://www.xxx.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenThrow(new Exception());
+        when(InputStreamUtils.getInputStream("http://www.yyy.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", null, Constants.CompressionType.GZIP)).thenThrow(new Exception());
+        haurlSelector.reSelectUrl();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/JobListServiceURLBuilderImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/JobListServiceURLBuilderImplTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/JobListServiceURLBuilderImplTest.java
new file mode 100644
index 0000000..6f9aa97
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/JobListServiceURLBuilderImplTest.java
@@ -0,0 +1,37 @@
+/*
+ * 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.eagle.jpm.util.resourcefetch.url;
+
+import org.apache.eagle.jpm.util.Constants;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class JobListServiceURLBuilderImplTest {
+    @Test
+    public void testBuild() {
+        JobListServiceURLBuilderImpl jobListServiceURLBuilderImpl = new JobListServiceURLBuilderImpl();
+        String finalUrl = jobListServiceURLBuilderImpl.build("http://www.xxx.com:8088/", Constants.JobState.RUNNING.name());
+        Assert.assertEquals("http://www.xxx.com:8088/ws/v1/cluster/apps?state=RUNNING&anonymous=true", finalUrl);
+        finalUrl = jobListServiceURLBuilderImpl.build("http://www.xxx.com:8088/", Constants.JobState.FINISHED.name());
+        Assert.assertEquals("http://www.xxx.com:8088/ws/v1/cluster/apps?state=FINISHED&anonymous=true", finalUrl);
+        finalUrl = jobListServiceURLBuilderImpl.build("http://www.xxx.com:8088/", Constants.JobState.ALL.name());
+        Assert.assertEquals("http://www.xxx.com:8088/ws/v1/cluster/apps&anonymous=true", finalUrl);
+        finalUrl = jobListServiceURLBuilderImpl.build("http://www.xxx.com:8088/", "");
+        Assert.assertEquals(null, finalUrl);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkCompleteJobServiceURLBuilderImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkCompleteJobServiceURLBuilderImplTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkCompleteJobServiceURLBuilderImplTest.java
new file mode 100644
index 0000000..7c8a26b
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkCompleteJobServiceURLBuilderImplTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.eagle.jpm.util.resourcefetch.url;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SparkCompleteJobServiceURLBuilderImplTest {
+    @Test
+    public void testBuild() {
+        SparkCompleteJobServiceURLBuilderImpl sparkCompleteJobServiceURLBuilderImpl = new SparkCompleteJobServiceURLBuilderImpl();
+        String finalUrl = sparkCompleteJobServiceURLBuilderImpl.build("http://www.xxx.com:8088/", "0");
+        Assert.assertEquals("http://www.xxx.com:8088/ws/v1/cluster/apps?applicationTypes=SPARK&state=FINISHED&finishedTimeBegin=0&anonymous=true", finalUrl);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkJobServiceURLBuilderImplTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkJobServiceURLBuilderImplTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkJobServiceURLBuilderImplTest.java
new file mode 100644
index 0000000..fe95d8f
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/SparkJobServiceURLBuilderImplTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.eagle.jpm.util.resourcefetch.url;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class SparkJobServiceURLBuilderImplTest {
+    @Test
+    public void testBuild() {
+        SparkJobServiceURLBuilderImpl sparkJobServiceURLBuilderImpl = new SparkJobServiceURLBuilderImpl();
+        String finalUrl = sparkJobServiceURLBuilderImpl.build("http://www.xxx.com:8088/", "0");
+        Assert.assertEquals("http://www.xxx.com:8088api/v1/applications0", finalUrl);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/URLUtilTest.java
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/URLUtilTest.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/URLUtilTest.java
new file mode 100644
index 0000000..c2e824e
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/resourcefetch/url/URLUtilTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.eagle.jpm.util.resourcefetch.url;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class URLUtilTest {
+    @Test
+    public void testRemoveTrailingSlash() {
+        String url = URLUtil.removeTrailingSlash("http://www.xxx.com:8088/");
+        Assert.assertEquals("http://www.xxx.com:8088", url);
+        url = URLUtil.removeTrailingSlash("http://www.xxx.com:8088//");
+        Assert.assertEquals("http://www.xxx.com:8088", url);
+        url = URLUtil.removeTrailingSlash("http://www.xxx.com:8088");
+        Assert.assertEquals("http://www.xxx.com:8088", url);
+        url = URLUtil.removeTrailingSlash("");
+        Assert.assertEquals("", url);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/resources/clusterinfo.json
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/clusterinfo.json b/eagle-jpm/eagle-jpm-util/src/test/resources/clusterinfo.json
new file mode 100644
index 0000000..ae65760
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/clusterinfo.json
@@ -0,0 +1,15 @@
+{
+  "clusterInfo": {
+    "id": 1324053971963,
+    "startedOn": 1324053971963,
+    "state": "STARTED",
+    "haState": "ACTIVE",
+    "rmStateStoreName": "org.apache.hadoop.yarn.server.resourcemanager.recovery.ZKRMStateStore",
+    "resourceManagerVersion": "0.23.1-SNAPSHOT",
+    "resourceManagerBuildVersion": "0.23.1-SNAPSHOT from 1214049 by user1 source checksum 050cd664439d931c8743a6428fd6a693",
+    "resourceManagerVersionBuiltOn": "Tue Dec 13 22:12:48 CST 2011",
+    "hadoopVersion": "0.23.1-SNAPSHOT",
+    "hadoopBuildVersion": "0.23.1-SNAPSHOT from 1214049 by user1 source checksum 11458df3bb77342dca5f917198fad328",
+    "hadoopVersionBuiltOn": "Tue Dec 13 22:12:26 CST 2011"
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/resources/mrcompleteapp.json
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/mrcompleteapp.json b/eagle-jpm/eagle-jpm-util/src/test/resources/mrcompleteapp.json
new file mode 100644
index 0000000..1b3873a
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/mrcompleteapp.json
@@ -0,0 +1,54 @@
+{
+  "apps": {
+    "app": [
+      {
+        "finishedTime": 1479244718794,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_1326815542473_0001_01_000001",
+        "trackingUI": "History",
+        "state": "FINISHED",
+        "user": "user1",
+        "id": "application_1326815542473_0001",
+        "applicationType": "MAPREDUCE",
+        "clusterId": 1326815542473,
+        "finalStatus": "SUCCEEDED",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "progress": 100,
+        "name": "insert overwrite table xx.yy...end(Stage-1)",
+        "startedTime": 1326815573334,
+        "elapsedTime": 25196,
+        "diagnostics": "diagnostics1",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1326815542473_0001/jobhistory/job/job_1326815542473_1_1",
+        "queue": "default",
+        "allocatedMB": 0,
+        "allocatedVCores": 0,
+        "runningContainers": 0,
+        "memorySeconds": 151730,
+        "vcoreSeconds": 103
+      },
+      {
+        "finishedTime": 1326815789546,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_1326815542473_0002_01_000001",
+        "trackingUI": "History",
+        "state": "FINISHED",
+        "user": "user1",
+        "id": "application_1326815542473_0002",
+        "applicationType": "MAPREDUCE",
+        "clusterId": 1326815542473,
+        "finalStatus": "SUCCEEDED",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "progress": 100,
+        "name": "Sleep job",
+        "startedTime": 1326815641380,
+        "elapsedTime": 148166,
+        "diagnostics": "diagnostics2",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1326815542473_0002/jobhistory/job/job_1326815542473_2_2",
+        "queue": "default",
+        "allocatedMB": 0,
+        "allocatedVCores": 0,
+        "runningContainers": 1,
+        "memorySeconds": 640064,
+        "vcoreSeconds": 442
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/resources/mrrunningapp.json
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/mrrunningapp.json b/eagle-jpm/eagle-jpm-util/src/test/resources/mrrunningapp.json
new file mode 100644
index 0000000..64a20f8
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/mrrunningapp.json
@@ -0,0 +1,64 @@
+{
+  "apps": {
+    "app": [
+      {
+        "id": "application_1479206441898_30784",
+        "user": "xxx",
+        "name": "oozie:launcher:T=shell:W=wf_co_xxx_xxx_v3:A=extract_org_data:ID=0002383-161115184801730-oozie-oozi-W",
+        "queue": "xxx",
+        "state": "RUNNING",
+        "finalStatus": "UNDEFINED",
+        "progress": 95.0,
+        "trackingUI": "ApplicationMaster",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1479206441898_30784/",
+        "diagnostics": "",
+        "clusterId": 1479206441898,
+        "applicationType": "MAPREDUCE",
+        "applicationTags": "",
+        "startedTime": 1479328221694,
+        "finishedTime": 0,
+        "elapsedTime": 13367402,
+        "amContainerLogs": "http://host.domain.com:8088/node/containerlogs/container_e11_1479206441898_30784_01_000001/xxx",
+        "amHostHttpAddress": "host.domain.com:8088",
+        "allocatedMB": 3072,
+        "allocatedVCores": 2,
+        "runningContainers": 2,
+        "memorySeconds": 41051800,
+        "vcoreSeconds": 26728,
+        "preemptedResourceMB": 0,
+        "preemptedResourceVCores": 0,
+        "numNonAMContainerPreempted": 0,
+        "numAMContainerPreempted": 0
+      },
+      {
+        "id": "application_1479206441898_35341",
+        "user": "yyy",
+        "name": "insert overwrite table inter...a.xxx(Stage-3)",
+        "queue": "yyy",
+        "state": "RUNNING",
+        "finalStatus": "UNDEFINED",
+        "progress": 59.545456,
+        "trackingUI": "ApplicationMaster",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1479206441898_35341/",
+        "diagnostics": "",
+        "clusterId": 1479206441898,
+        "applicationType": "MAPREDUCE",
+        "applicationTags": "",
+        "startedTime": 1479341511477,
+        "finishedTime": 0,
+        "elapsedTime": 77619,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_e11_1479206441898_35341_01_000005/yyy",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "allocatedMB": 27648,
+        "allocatedVCores": 6,
+        "runningContainers": 6,
+        "memorySeconds": 4940802,
+        "vcoreSeconds": 1483,
+        "preemptedResourceMB": 0,
+        "preemptedResourceVCores": 0,
+        "numNonAMContainerPreempted": 0,
+        "numAMContainerPreempted": 0
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/resources/sparkcompleteapp.json
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/sparkcompleteapp.json b/eagle-jpm/eagle-jpm-util/src/test/resources/sparkcompleteapp.json
new file mode 100644
index 0000000..857e82c
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/sparkcompleteapp.json
@@ -0,0 +1,64 @@
+{
+  "apps": {
+    "app": [
+      {
+        "id": "application_1479196259121_1041",
+        "user": "xxx",
+        "name": "Spark shell",
+        "queue": "default",
+        "state": "FINISHED",
+        "finalStatus": "SUCCEEDED",
+        "progress": 10.0,
+        "trackingUI": "ApplicationMaster",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1479196259121_1041/",
+        "diagnostics": "",
+        "clusterId": 1479206441898,
+        "applicationType": "SPARK",
+        "applicationTags": "",
+        "startedTime": 1479202371723,
+        "finishedTime": 1479244718794,
+        "elapsedTime": 147954814,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_e09_1479196259121_1041_01_000001/xxx",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "allocatedMB": 7168,
+        "allocatedVCores": 3,
+        "runningContainers": 3,
+        "memorySeconds": 1060342141,
+        "vcoreSeconds": 443798,
+        "preemptedResourceMB": 0,
+        "preemptedResourceVCores": 0,
+        "numNonAMContainerPreempted": 0,
+        "numAMContainerPreempted": 0
+      },
+      {
+        "id": "application_1478655515028_74912",
+        "user": "xxx",
+        "name": "spark-thriftserver",
+        "queue": "default",
+        "state": "FINISHED",
+        "finalStatus": "SUCCEEDED",
+        "progress": 10.0,
+        "trackingUI": "ApplicationMaster",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1478655515028_74912/",
+        "diagnostics": "",
+        "clusterId": 1479206441898,
+        "applicationType": "SPARK",
+        "applicationTags": "",
+        "startedTime": 1478844771535,
+        "finishedTime": 1479244718794,
+        "elapsedTime": 505555002,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_e10_1478655515028_74912_02_000001/xxx",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "allocatedMB": 3113984,
+        "allocatedVCores": 191,
+        "runningContainers": 191,
+        "memorySeconds": 587928280103,
+        "vcoreSeconds": 36318925,
+        "preemptedResourceMB": 0,
+        "preemptedResourceVCores": 0,
+        "numNonAMContainerPreempted": 0,
+        "numAMContainerPreempted": 0
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-jpm/eagle-jpm-util/src/test/resources/sparkrunningapp.json
----------------------------------------------------------------------
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/sparkrunningapp.json b/eagle-jpm/eagle-jpm-util/src/test/resources/sparkrunningapp.json
new file mode 100644
index 0000000..24983fc
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/sparkrunningapp.json
@@ -0,0 +1,64 @@
+{
+  "apps": {
+    "app": [
+      {
+        "id": "application_1479196259121_1041",
+        "user": "xxx",
+        "name": "Spark shell",
+        "queue": "default",
+        "state": "RUNNING",
+        "finalStatus": "UNDEFINED",
+        "progress": 10.0,
+        "trackingUI": "ApplicationMaster",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1479196259121_1041/",
+        "diagnostics": "",
+        "clusterId": 1479206441898,
+        "applicationType": "SPARK",
+        "applicationTags": "",
+        "startedTime": 1479202371723,
+        "finishedTime": 0,
+        "elapsedTime": 147954814,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_e09_1479196259121_1041_01_000001/xxx",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "allocatedMB": 7168,
+        "allocatedVCores": 3,
+        "runningContainers": 3,
+        "memorySeconds": 1060342141,
+        "vcoreSeconds": 443798,
+        "preemptedResourceMB": 0,
+        "preemptedResourceVCores": 0,
+        "numNonAMContainerPreempted": 0,
+        "numAMContainerPreempted": 0
+      },
+      {
+        "id": "application_1478655515028_74912",
+        "user": "xxx",
+        "name": "spark-thriftserver",
+        "queue": "default",
+        "state": "RUNNING",
+        "finalStatus": "UNDEFINED",
+        "progress": 10.0,
+        "trackingUI": "ApplicationMaster",
+        "trackingUrl": "http://host.domain.com:8088/proxy/application_1478655515028_74912/",
+        "diagnostics": "",
+        "clusterId": 1479206441898,
+        "applicationType": "SPARK",
+        "applicationTags": "",
+        "startedTime": 1478844771535,
+        "finishedTime": 0,
+        "elapsedTime": 505555002,
+        "amContainerLogs": "http://host.domain.com:8042/node/containerlogs/container_e10_1478655515028_74912_02_000001/xxx",
+        "amHostHttpAddress": "host.domain.com:8042",
+        "allocatedMB": 3113984,
+        "allocatedVCores": 191,
+        "runningContainers": 191,
+        "memorySeconds": 587928280103,
+        "vcoreSeconds": 36318925,
+        "preemptedResourceMB": 0,
+        "preemptedResourceVCores": 0,
+        "numNonAMContainerPreempted": 0,
+        "numAMContainerPreempted": 0
+      }
+    ]
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/eagle-security/eagle-security-oozie-web/pom.xml
----------------------------------------------------------------------
diff --git a/eagle-security/eagle-security-oozie-web/pom.xml b/eagle-security/eagle-security-oozie-web/pom.xml
index 69c6699..6e6e0b5 100644
--- a/eagle-security/eagle-security-oozie-web/pom.xml
+++ b/eagle-security/eagle-security-oozie-web/pom.xml
@@ -27,10 +27,6 @@
     <artifactId>eagle-security-oozie-web</artifactId>
     <name>eagle-security-oozie-web</name>
     <url>http://maven.apache.org</url>
-    <properties>
-        <powermock.version>1.6.5</powermock.version>
-        <easymock.version>3.4</easymock.version>
-    </properties>
     <dependencies>
         <dependency>
             <groupId>org.apache.eagle</groupId>

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/d6e78bec/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 2479727..bf5f97f 100755
--- a/pom.xml
+++ b/pom.xml
@@ -296,6 +296,8 @@
         <scalatest.version>2.2.4</scalatest.version>
         <mockito.version>1.8.1-rc1</mockito.version>
         <tomcat.embed.version>7.0.55</tomcat.embed.version>
+        <powermock.version>1.6.5</powermock.version>
+        <easymock.version>3.4</easymock.version>
 
         <!-- Machine Learning -->
         <ejml.version>0.25</ejml.version>


Mime
View raw message