Repository: atlas
Updated Branches:
  refs/heads/branch-0.8 d000c3dbb -> 6bc4039aa


ATLAS-2888: Change marker fix for server name. Unit test fix.


Project: http://git-wip-us.apache.org/repos/asf/atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/6bc4039a
Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/6bc4039a
Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/6bc4039a

Branch: refs/heads/branch-0.8
Commit: 6bc4039aad496f345788f97aa53e679f96148f94
Parents: d000c3d
Author: Ashutosh Mestry <[email protected]>
Authored: Mon Oct 1 22:08:30 2018 -0700
Committer: Ashutosh Mestry <[email protected]>
Committed: Mon Oct 1 22:08:30 2018 -0700

----------------------------------------------------------------------
 .../repository/impexp/ExportServiceTest.java    | 38 +++++---------------
 .../impexp/ReplicationEntityAttributeTest.java  |  6 ++--
 2 files changed, 11 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/6bc4039a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
----------------------------------------------------------------------
diff --git 
a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
 
b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
index a4026f6..0d13a5b 100644
--- 
a/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
+++ 
b/repository/src/test/java/org/apache/atlas/repository/impexp/ExportServiceTest.java
@@ -18,39 +18,26 @@
 package org.apache.atlas.repository.impexp;
 
 
-import org.apache.atlas.ApplicationProperties;
-import org.apache.atlas.AtlasConstants;
-import org.apache.atlas.AtlasException;
 import org.apache.atlas.RequestContextV1;
 import org.apache.atlas.TestModules;
 import org.apache.atlas.TestUtilsV2;
 import org.apache.atlas.exception.AtlasBaseException;
-import org.apache.atlas.model.TypeCategory;
-import org.apache.atlas.model.discovery.AtlasSearchResult;
 import org.apache.atlas.model.impexp.AtlasExportRequest;
 import org.apache.atlas.model.impexp.AtlasExportResult;
-import org.apache.atlas.model.impexp.ExportImportAuditEntry;
 import org.apache.atlas.model.instance.AtlasEntity;
 import org.apache.atlas.model.instance.AtlasObjectId;
+import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.typedef.AtlasTypesDef;
 import org.apache.atlas.repository.graph.AtlasGraphProvider;
 import 
org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
-import org.apache.atlas.repository.store.graph.v1.AtlasEntityChangeNotifier;
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStoreV1;
 import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream;
-import org.apache.atlas.repository.store.graph.v1.DeleteHandlerV1;
 import org.apache.atlas.repository.store.graph.v1.EntityGraphMapper;
-import org.apache.atlas.repository.store.graph.v1.SoftDeleteHandlerV1;
 import org.apache.atlas.store.AtlasTypeDefStore;
-import org.apache.atlas.type.AtlasEntityType;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.AfterTest;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Guice;
@@ -67,16 +54,12 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import static org.mockito.Mockito.mock;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
 
 @Guice(modules = TestModules.TestOnlyModule.class)
 public class ExportServiceTest extends ExportImportTestBase {
-    private static final Logger LOG = 
LoggerFactory.getLogger(ExportServiceTest.class);
-
     @Inject
     AtlasTypeRegistry typeRegistry;
 
@@ -92,21 +75,18 @@ public class ExportServiceTest extends ExportImportTestBase 
{
     @Inject
     private ExportImportAuditService auditService;
 
-    private DeleteHandlerV1 deleteHandler = mock(SoftDeleteHandlerV1.class);;
-    private AtlasEntityChangeNotifier mockChangeNotifier = 
mock(AtlasEntityChangeNotifier.class);
+    @Inject
     private AtlasEntityStoreV1 entityStore;
 
     @BeforeTest
     public void setupTest() throws IOException, AtlasBaseException {
         RequestContextV1.clear();
         RequestContextV1.get().setUser(TestUtilsV2.TEST_USER);
-        ZipFileResourceTestUtils.loadBaseModel(typeDefStore, typeRegistry);
+        basicSetup(typeDefStore, typeRegistry);
     }
 
     @BeforeClass
     public void setupSampleData() throws AtlasBaseException {
-        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, 
mockChangeNotifier, graphMapper);;
-
         AtlasTypesDef sampleTypes = TestUtilsV2.defineDeptEmployeeTypes();
         AtlasTypesDef typesToCreate = 
AtlasTypeDefStoreInitializer.getTypesToCreate(sampleTypes, typeRegistry);
 
@@ -114,16 +94,16 @@ public class ExportServiceTest extends 
ExportImportTestBase {
             typeDefStore.createTypesDef(typesToCreate);
         }
 
-        AtlasEntity.AtlasEntitiesWithExtInfo  hrDept = 
TestUtilsV2.createDeptEg2();
-
-        AtlasEntityStream entityStream = new AtlasEntityStream(hrDept);
-        entityStore.createOrUpdate(entityStream, false);
-        LOG.debug("==> setupSampleData: ", 
AtlasEntity.dumpObjects(hrDept.getEntities(), null).toString());
+        AtlasEntity.AtlasEntitiesWithExtInfo  deptEg2 = 
TestUtilsV2.createDeptEg2();
+        AtlasEntityStream entityStream = new AtlasEntityStream(deptEg2);
+        EntityMutationResponse emr = entityStore.createOrUpdate(entityStream, 
false);
+        assertNotNull(emr);
+        assertNotNull(emr.getCreatedEntities());
+        assertTrue(emr.getCreatedEntities().size() > 0);
     }
 
     @AfterClass
     public void clear() throws InterruptedException {
-        Thread.sleep(1000);
         assertAuditEntry(auditService);
         AtlasGraphProvider.cleanup();
     }

http://git-wip-us.apache.org/repos/asf/atlas/blob/6bc4039a/repository/src/test/java/org/apache/atlas/repository/impexp/ReplicationEntityAttributeTest.java
----------------------------------------------------------------------
diff --git 
a/repository/src/test/java/org/apache/atlas/repository/impexp/ReplicationEntityAttributeTest.java
 
b/repository/src/test/java/org/apache/atlas/repository/impexp/ReplicationEntityAttributeTest.java
index 7c89a04..868b732 100644
--- 
a/repository/src/test/java/org/apache/atlas/repository/impexp/ReplicationEntityAttributeTest.java
+++ 
b/repository/src/test/java/org/apache/atlas/repository/impexp/ReplicationEntityAttributeTest.java
@@ -74,9 +74,6 @@ public class ReplicationEntityAttributeTest extends 
ExportImportTestBase {
     private AtlasTypeDefStore typeDefStore;
 
     @Inject
-    private EntityGraphMapper graphMapper;
-
-    @Inject
     ExportService exportService;
 
     @Inject
@@ -85,13 +82,14 @@ public class ReplicationEntityAttributeTest extends 
ExportImportTestBase {
     @Inject
     AtlasServerService atlasServerService;
 
+    @Inject
     private AtlasEntityStoreV1 entityStore;
+
     private ZipSource zipSource;
 
     @BeforeClass
     public void setup() throws IOException, AtlasBaseException {
         basicSetup(typeDefStore, typeRegistry);
-        entityStore = new AtlasEntityStoreV1(deleteHandler, typeRegistry, 
mockChangeNotifier, graphMapper);
         createEntities(entityStore, ENTITIES_SUB_DIR, new String[]{"db", 
"table-columns"});
 
         AtlasType refType = typeRegistry.getType("Referenceable");

Reply via email to