Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 07193200CE6 for ; Fri, 15 Sep 2017 20:24:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 05CE41609D1; Fri, 15 Sep 2017 18:24:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 4B55C1609C9 for ; Fri, 15 Sep 2017 20:24:14 +0200 (CEST) Received: (qmail 19792 invoked by uid 500); 15 Sep 2017 18:24:08 -0000 Mailing-List: contact commits-help@atlas.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@atlas.apache.org Delivered-To: mailing list commits@atlas.apache.org Received: (qmail 19783 invoked by uid 99); 15 Sep 2017 18:24:08 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Sep 2017 18:24:08 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0A7DDF55FE; Fri, 15 Sep 2017 18:24:08 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: madhan@apache.org To: commits@atlas.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: atlas git commit: ATLAS-2129: import fix to handle shutdown while in the middle of import (unit test fix) Date: Fri, 15 Sep 2017 18:24:08 +0000 (UTC) archived-at: Fri, 15 Sep 2017 18:24:15 -0000 Repository: atlas Updated Branches: refs/heads/master c623835f5 -> 45b84fa20 ATLAS-2129: import fix to handle shutdown while in the middle of import (unit test fix) Signed-off-by: Madhan Neethiraj Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/45b84fa2 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/45b84fa2 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/45b84fa2 Branch: refs/heads/master Commit: 45b84fa201bdd63cc36094613d33b16741e4fb7a Parents: c623835 Author: Ashutosh Mestry Authored: Fri Sep 15 10:39:42 2017 -0700 Committer: Madhan Neethiraj Committed: Fri Sep 15 10:39:42 2017 -0700 ---------------------------------------------------------------------- .../atlas/repository/store/graph/v1/BulkImporterImpl.java | 5 +++-- .../store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/atlas/blob/45b84fa2/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java index e929d7f..467ced7 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/BulkImporterImpl.java @@ -17,6 +17,7 @@ */ package org.apache.atlas.repository.store.graph.v1; +import com.google.common.annotations.VisibleForTesting; import org.apache.atlas.AtlasErrorCode; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.impexp.AtlasImportResult; @@ -131,8 +132,8 @@ public class BulkImporterImpl implements BulkImporter { return updateImportProgress(LOG, currentIndex + 1, streamSize, currentPercent, lastEntityImported); } - private static float updateImportProgress(Logger log, int currentIndex, int streamSize, float currentPercent, - String additionalInfo) { + @VisibleForTesting + static float updateImportProgress(Logger log, int currentIndex, int streamSize, float currentPercent, String additionalInfo) { final double tolerance = 0.000001; final int MAX_PERCENT = 100; http://git-wip-us.apache.org/repos/asf/atlas/blob/45b84fa2/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java ---------------------------------------------------------------------- diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java index 10becc1..73dfe37 100644 --- a/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java +++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityStoreV1BulkImportPercentTest.java @@ -19,7 +19,6 @@ package org.apache.atlas.repository.store.graph.v1; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.powermock.reflect.Whitebox; import org.slf4j.Logger; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -153,7 +152,7 @@ public class AtlasEntityStoreV1BulkImportPercentTest { } private float invokeBulkImportProgress(int currentIndex, int streamSize, float currentPercent) throws Exception { - return Whitebox.invokeMethod(AtlasEntityStoreV1.class, "updateImportProgress", log, currentIndex, streamSize, currentPercent, "additional info"); + return BulkImporterImpl.updateImportProgress(log, currentIndex, streamSize, currentPercent, "additional info"); } private double[] fillPercentHolderWith100() {