[EAGLE-986] HBaseStorage unable to deserialize Deserialize from java
[EAGLE-986] HBaseStorage unable to deserialize from java object bytes
- recover allocatedMB type from int to long
https://issues.apache.org/jira/browse/EAGLE-986
Author: r7raul1984 <tangjijun@yhd.com>
Closes #903 from r7raul1984/EAGLE-986.
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 5b0269d..a410ccf 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
@@ -43,7 +43,7 @@
private long elapsedTime;
private String amContainerLogs;
private String amHostHttpAddress;
- private int allocatedMB;
+ private long allocatedMB;
private int allocatedVCores;
private int runningContainers;
// for HDP 2.7
@@ -186,11 +186,11 @@
this.amHostHttpAddress = amHostHttpAddress;
}
- public int getAllocatedMB() {
+ public long getAllocatedMB() {
return allocatedMB;
}
- public void setAllocatedMB(int allocatedMB) {
+ public void setAllocatedMB(long allocatedMB) {
this.allocatedMB = allocatedMB;
}
diff --git a/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.java b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.java
new file mode 100644
index 0000000..f833962
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/java/org/apache/eagle/jpm/util/TestAppInfoDeserialize.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;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.eagle.common.SerializableUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+public class TestAppInfoDeserialize {
+ @Test
+ public void testAppInfoDeserializeFromByteArray() throws IOException {
+ InputStream appinfostream = this.getClass().getResourceAsStream("/appinfobytelong");
+ //serialize allocatedMB as long byte deserializeto long
+ byte[] bytes = IOUtils.toByteArray(appinfostream);
+ Assert.assertNotNull(bytes);
+ SerializableUtils.deserializeFromByteArray(bytes, "AppInfo Deserialize From ByteArray");
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void testAppInfoDeserializeFromByteArray1() throws IOException {
+ InputStream appinfostream = this.getClass().getResourceAsStream("/appinfobyteint");
+ //serialize allocatedMB as int byte deserialize to long
+ byte[] bytes = IOUtils.toByteArray(appinfostream);
+ SerializableUtils.deserializeFromByteArray(bytes, "AppInfo Deserialize From ByteArray");
+ }
+}
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint
new file mode 100644
index 0000000..6343fe6
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobyteint
Binary files differ
diff --git a/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong
new file mode 100644
index 0000000..f0854c4
--- /dev/null
+++ b/eagle-jpm/eagle-jpm-util/src/test/resources/appinfobytelong
Binary files differ
diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
index 121e80e..85168e3 100644
--- a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
+++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/compareCtrl.js
@@ -44,7 +44,10 @@
// ==================================================================
// = Fetch Job List =
// ==================================================================
- var jobList = $scope.jobList = JPM.findMRJobs($scope.site, $scope.jobDefId);
+ var endTime = new Time();
+ var startTime = endTime.clone().subtract(30, 'day');
+ var condition = JPM.condition({site: $scope.site, jobDefId:$scope.jobDefId});
+ var jobList = $scope.jobList = JPM.list("JobExecutionService", condition, startTime, endTime, [], 10000);
jobList._promise.then(function () {
if(jobList.length <= 1) {
$.dialog({