You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by am...@apache.org on 2020/05/15 19:03:58 UTC

[atlas] 02/03: ATLAS-3798: Import percentage display fix.

This is an automated email from the ASF dual-hosted git repository.

amestry pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 214f2a760a1a4c8c3a83b5afaa42fdc36055ff98
Author: Ashutosh Mestry <am...@cloudera.com>
AuthorDate: Fri May 15 11:50:33 2020 -0700

    ATLAS-3798: Import percentage display fix.
---
 .../atlas/repository/store/graph/v2/BulkImporterImpl.java |  4 ++--
 .../repository/store/graph/v2/BulkImportPercentTest.java  | 15 ++++++++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/BulkImporterImpl.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/BulkImporterImpl.java
index 9898fe8..8e17fd4 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/BulkImporterImpl.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/BulkImporterImpl.java
@@ -89,11 +89,11 @@ public class BulkImporterImpl implements BulkImporter {
     }
 
     @VisibleForTesting
-    public static float updateImportProgress(Logger log, int currentIndex, int streamSize, float currentPercent, String additionalInfo) {
+    public static float updateImportProgress(Logger log, long currentIndex, long streamSize, float currentPercent, String additionalInfo) {
         final double tolerance   = 0.000001;
         final int    MAX_PERCENT = 100;
 
-        int     maxSize        = (currentIndex <= streamSize) ? streamSize : currentIndex;
+        long     maxSize        = (currentIndex <= streamSize) ? streamSize : currentIndex;
         if (maxSize <= 0) {
             return currentPercent;
         }
diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/BulkImportPercentTest.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/BulkImportPercentTest.java
index 2fa4c91..1ae98ce 100644
--- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/BulkImportPercentTest.java
+++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v2/BulkImportPercentTest.java
@@ -39,7 +39,7 @@ public class BulkImportPercentTest {
     private List<Integer> percentHolder;
     private Logger log;
 
-    public void setupPercentHolder(int max) {
+    public void setupPercentHolder(long max) {
         percentHolder = new ArrayList<>();
     }
 
@@ -127,6 +127,15 @@ public class BulkImportPercentTest {
     }
 
     @Test
+    public void percentTest_Equal100M() throws Exception {
+        long streamSize = 100000000;
+        double[] expected = fillPercentHolderWith100();
+
+        runWithSize(streamSize);
+        assertEqualsForPercentHolder(expected);
+    }
+
+    @Test
     public void percentTest_Equal4323() throws Exception {
         int streamSize = 4323;
 
@@ -153,7 +162,7 @@ public class BulkImportPercentTest {
         assertTrue((f - MAX_PERCENT_FLOAT) <= 0.0001);
     }
 
-    private void runWithSize(int streamSize) throws Exception {
+    private void runWithSize(long streamSize) throws Exception {
         float currentPercent = 0;
         setupPercentHolder(streamSize);
         for (int currentIndex = 0; currentIndex < streamSize; currentIndex++) {
@@ -161,7 +170,7 @@ public class BulkImportPercentTest {
         }
     }
 
-    private float invokeBulkImportProgress(int currentIndex, int streamSize, float currentPercent) throws Exception {
+    private float invokeBulkImportProgress(int currentIndex, long streamSize, float currentPercent) throws Exception {
         return BulkImporterImpl.updateImportProgress(log, currentIndex, streamSize, currentPercent, "additional info");
     }