Commit 45b84fa2 by Ashutosh Mestry Committed by Madhan Neethiraj

ATLAS-2129: import fix to handle shutdown while in the middle of import (unit test fix)

parent c623835f
......@@ -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;
......
......@@ -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() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment