Repository: atlas Updated Branches: refs/heads/branch-1.0 ff132de0d -> 4823c8ed4
http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java index f5e555d..91dc230 100644 --- a/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java +++ b/webapp/src/main/java/org/apache/atlas/notification/NotificationHookConsumer.java @@ -25,7 +25,7 @@ import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasClientV2; import org.apache.atlas.AtlasException; import org.apache.atlas.AtlasServiceException; -import org.apache.atlas.RequestContextV1; +import org.apache.atlas.RequestContext; import org.apache.atlas.ha.HAConfiguration; import org.apache.atlas.kafka.AtlasKafkaMessage; import org.apache.atlas.listener.ActiveStateChangeHandler; @@ -45,8 +45,8 @@ import org.apache.atlas.v1.model.notification.HookNotificationV1.EntityPartialUp import org.apache.atlas.v1.model.notification.HookNotificationV1.EntityUpdateRequest; import org.apache.atlas.repository.converters.AtlasInstanceConverter; import org.apache.atlas.repository.store.graph.AtlasEntityStore; -import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream; -import org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1; +import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; +import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; import org.apache.atlas.service.Service; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasTypeRegistry; @@ -55,7 +55,6 @@ import org.apache.atlas.web.filters.AuditFilter; import org.apache.atlas.web.filters.AuditFilter.AuditLog; import org.apache.atlas.web.service.ServiceState; import org.apache.commons.configuration.Configuration; -import org.apache.kafka.common.KafkaException; import org.apache.kafka.common.TopicPartition; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -75,7 +74,7 @@ import java.util.concurrent.atomic.AtomicBoolean; */ @Component @Order(4) -@DependsOn(value = {"atlasTypeDefStoreInitializer", "atlasTypeDefGraphStoreV1"}) +@DependsOn(value = {"atlasTypeDefStoreInitializer", "atlasTypeDefGraphStoreV2"}) public class NotificationHookConsumer implements Service, ActiveStateChangeHandler { private static final Logger LOG = LoggerFactory.getLogger(NotificationHookConsumer.class); private static final Logger PERF_LOG = AtlasPerfTracer.getPerfLogger(NotificationHookConsumer.class); @@ -375,7 +374,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl } try { - RequestContextV1 requestContext = RequestContextV1.get(); + RequestContext requestContext = RequestContext.get(); requestContext.setUser(messageUser, null); @@ -406,7 +405,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl } AtlasEntityType entityType = typeRegistry.getEntityTypeByName(partialUpdateRequest.getTypeName()); - String guid = AtlasGraphUtilsV1.getGuidByUniqueAttributes(entityType, Collections.singletonMap(partialUpdateRequest.getAttribute(), (Object)partialUpdateRequest.getAttributeValue())); + String guid = AtlasGraphUtilsV2.getGuidByUniqueAttributes(entityType, Collections.singletonMap(partialUpdateRequest.getAttribute(), (Object)partialUpdateRequest.getAttributeValue())); // There should only be one root entity entities.getEntities().get(0).setGuid(guid); @@ -541,7 +540,7 @@ public class NotificationHookConsumer implements Service, ActiveStateChangeHandl return; } } finally { - RequestContextV1.clear(); + RequestContext.clear(); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java index 27b817c..e5c40d0 100644 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AtlasAuthenticationFilter.java @@ -19,7 +19,6 @@ package org.apache.atlas.web.filters; import org.apache.atlas.ApplicationProperties; -import org.apache.atlas.RequestContextV1; import org.apache.atlas.security.SecurityProperties; import org.apache.atlas.utils.AuthenticationUtil; import org.apache.atlas.web.security.AtlasAuthenticationProvider; http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java index 545f4c2..adf3cf2 100755 --- a/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java +++ b/webapp/src/main/java/org/apache/atlas/web/filters/AuditFilter.java @@ -20,7 +20,7 @@ package org.apache.atlas.web.filters; import org.apache.atlas.AtlasClient; import org.apache.atlas.AtlasException; -import org.apache.atlas.RequestContextV1; +import org.apache.atlas.RequestContext; import org.apache.atlas.authorize.AtlasAuthorizationUtils; import org.apache.atlas.util.AtlasRepositoryConfiguration; import org.apache.atlas.web.util.DateTimeHelper; @@ -73,8 +73,8 @@ public class AuditFilter implements Filter { try { currentThread.setName(formatName(oldName, requestId)); - RequestContextV1.clear(); - RequestContextV1 requestContext = RequestContextV1.get(); + RequestContext.clear(); + RequestContext requestContext = RequestContext.get(); requestContext.setUser(user, userGroups); requestContext.setClientIPAddress(AtlasAuthorizationUtils.getRequestIpAddress(httpRequest)); filterChain.doFilter(request, response); @@ -86,7 +86,7 @@ public class AuditFilter implements Filter { // put the request id into the response so users can trace logs for this request httpResponse.setHeader(AtlasClient.REQUEST_ID, requestId); currentThread.setName(oldName); - RequestContextV1.clear(); + RequestContext.clear(); } } http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java index 4f4f091..e01cba9 100755 --- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java +++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java @@ -38,8 +38,8 @@ import org.apache.atlas.model.legacy.EntityResult; import org.apache.atlas.repository.audit.EntityAuditRepository; import org.apache.atlas.repository.converters.AtlasInstanceConverter; import org.apache.atlas.repository.store.graph.AtlasEntityStore; -import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream; -import org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1; +import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; +import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; @@ -382,7 +382,7 @@ public class EntityResource { Id updateId = updatedEntity.getId(); if (updateId != null && !AtlasTypeUtil.isAssignedGuid(updateId.getId())) { - String guid = AtlasGraphUtilsV1.getGuidByUniqueAttributes(getEntityType(entityType), attributes); + String guid = AtlasGraphUtilsV2.getGuidByUniqueAttributes(getEntityType(entityType), attributes); updatedEntity.setId(new Id(guid, 0, updatedEntity.getTypeName())); } http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java ---------------------------------------------------------------------- diff --git a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java index 6267d3a..4b15992 100644 --- a/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java +++ b/webapp/src/main/java/org/apache/atlas/web/rest/EntityREST.java @@ -23,7 +23,6 @@ import org.apache.atlas.model.audit.EntityAuditEventV2; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.TypeCategory; import org.apache.atlas.model.instance.AtlasClassification; -import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo; import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo; import org.apache.atlas.model.instance.ClassificationAssociateRequest; @@ -32,8 +31,8 @@ import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef; import org.apache.atlas.repository.audit.EntityAuditRepository; import org.apache.atlas.repository.converters.AtlasInstanceConverter; import org.apache.atlas.repository.store.graph.AtlasEntityStore; -import org.apache.atlas.repository.store.graph.v1.AtlasEntityStream; -import org.apache.atlas.repository.store.graph.v1.EntityStream; +import org.apache.atlas.repository.store.graph.v2.AtlasEntityStream; +import org.apache.atlas.repository.store.graph.v2.EntityStream; import org.apache.atlas.type.AtlasClassificationType; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasTypeRegistry; http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java index dbe1a07..b4b88d1 100644 --- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java +++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerKafkaTest.java @@ -29,7 +29,7 @@ import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.v1.model.notification.HookNotificationV1; import org.apache.atlas.repository.converters.AtlasInstanceConverter; import org.apache.atlas.repository.store.graph.AtlasEntityStore; -import org.apache.atlas.repository.store.graph.v1.EntityStream; +import org.apache.atlas.repository.store.graph.v2.EntityStream; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.web.service.ServiceState; http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerTest.java b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerTest.java index f8bd9a1..2618b04 100644 --- a/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerTest.java +++ b/webapp/src/test/java/org/apache/atlas/notification/NotificationHookConsumerTest.java @@ -30,7 +30,7 @@ import org.apache.atlas.v1.model.instance.Referenceable; import org.apache.atlas.v1.model.notification.HookNotificationV1.EntityCreateRequest; import org.apache.atlas.repository.converters.AtlasInstanceConverter; import org.apache.atlas.repository.store.graph.AtlasEntityStore; -import org.apache.atlas.repository.store.graph.v1.EntityStream; +import org.apache.atlas.repository.store.graph.v2.EntityStream; import org.apache.atlas.type.AtlasType; import org.apache.atlas.type.AtlasTypeRegistry; import org.apache.atlas.web.service.ServiceState; http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/test/java/org/apache/atlas/util/RestUtilsTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/util/RestUtilsTest.java b/webapp/src/test/java/org/apache/atlas/util/RestUtilsTest.java index cb6719e..faaa0af 100644 --- a/webapp/src/test/java/org/apache/atlas/util/RestUtilsTest.java +++ b/webapp/src/test/java/org/apache/atlas/util/RestUtilsTest.java @@ -33,9 +33,9 @@ import org.apache.atlas.model.typedef.AtlasTypesDef; import org.apache.atlas.repository.Constants; import org.apache.atlas.repository.converters.TypeConverterUtil; import org.apache.atlas.repository.graphdb.AtlasVertex; -import org.apache.atlas.repository.store.graph.v1.AtlasGraphUtilsV1; -import org.apache.atlas.repository.store.graph.v1.AtlasStructDefStoreV1; -import org.apache.atlas.repository.store.graph.v1.AtlasTypeDefGraphStoreV1; +import org.apache.atlas.repository.store.graph.v2.AtlasGraphUtilsV2; +import org.apache.atlas.repository.store.graph.v2.AtlasStructDefStoreV2; +import org.apache.atlas.repository.store.graph.v2.AtlasTypeDefGraphStoreV2; import org.apache.atlas.type.AtlasEntityType; import org.apache.atlas.type.AtlasStructType; import org.apache.atlas.type.AtlasStructType.AtlasAttribute; @@ -87,8 +87,8 @@ public class RestUtilsTest { testV1toV2toV1Conversion(Arrays.asList(dbV1Type, tableV1Type), new boolean[] { false, false }); } - private AtlasTypeDefGraphStoreV1 makeTypeStore(AtlasTypeRegistry reg) { - AtlasTypeDefGraphStoreV1 result = mock(AtlasTypeDefGraphStoreV1.class); + private AtlasTypeDefGraphStoreV2 makeTypeStore(AtlasTypeRegistry reg) { + AtlasTypeDefGraphStoreV2 result = mock(AtlasTypeDefGraphStoreV2.class); for (AtlasEntityType type : reg.getAllEntityTypes()) { String typeName = type.getTypeName(); @@ -97,13 +97,13 @@ public class RestUtilsTest { when(result.isTypeVertex(eq(typeVertex), any(TypeCategory.class))).thenReturn(true); when(typeVertex.getProperty(eq(Constants.TYPE_CATEGORY_PROPERTY_KEY), eq(TypeCategory.class))).thenReturn(TypeCategory.CLASS); - String attributeListPropertyKey = AtlasGraphUtilsV1.getTypeDefPropertyKey(typeName); + String attributeListPropertyKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(typeName); when(typeVertex.getProperty(eq(attributeListPropertyKey), eq(List.class))).thenReturn(new ArrayList<>(type.getAllAttributes().keySet())); for (AtlasAttribute attribute : type.getAllAttributes().values()) { - String attributeDefPropertyKey = AtlasGraphUtilsV1.getTypeDefPropertyKey(typeName, attribute.getName()); - String attributeJson = AtlasStructDefStoreV1.toJsonFromAttribute(attribute); + String attributeDefPropertyKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(typeName, attribute.getName()); + String attributeJson = AtlasStructDefStoreV2.toJsonFromAttribute(attribute); when(typeVertex.getProperty(eq(attributeDefPropertyKey), eq(String.class))).thenReturn(attributeJson); } @@ -115,15 +115,15 @@ public class RestUtilsTest { } private AtlasAttributeDef convertToJsonAndBack(AtlasTypeRegistry registry, AtlasStructDef structDef, AtlasAttributeDef attributeDef, boolean compositeExpected) throws AtlasBaseException { - AtlasTypeDefGraphStoreV1 typeDefStore = makeTypeStore(registry); + AtlasTypeDefGraphStoreV2 typeDefStore = makeTypeStore(registry); AtlasStructType structType = (AtlasStructType) registry.getType(structDef.getName()); AtlasAttribute attribute = structType.getAttribute(attributeDef.getName()); - String attribJson = AtlasStructDefStoreV1.toJsonFromAttribute(attribute); + String attribJson = AtlasStructDefStoreV2.toJsonFromAttribute(attribute); Map attrInfo = AtlasType.fromJson(attribJson, Map.class); Assert.assertEquals(attrInfo.get("isComposite"), compositeExpected); - return AtlasStructDefStoreV1.toAttributeDefFromJson(structDef, attrInfo, typeDefStore); + return AtlasStructDefStoreV2.toAttributeDefFromJson(structDef, attrInfo, typeDefStore); } private void testV1toV2toV1Conversion(List<ClassTypeDefinition> typesToTest, boolean[] compositeExpected) throws AtlasBaseException { http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java index 98df12b..1a19415 100644 --- a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java +++ b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java @@ -18,7 +18,7 @@ package org.apache.atlas.web.adapters; import org.apache.atlas.AtlasClient; -import org.apache.atlas.RequestContextV1; +import org.apache.atlas.RequestContext; import org.apache.atlas.TestModules; import org.apache.atlas.TestUtilsV2; import org.apache.atlas.model.instance.AtlasClassification; @@ -98,7 +98,7 @@ public class TestEntitiesREST { @AfterMethod public void cleanup() throws Exception { - RequestContextV1.clear(); + RequestContext.clear(); } @Test http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java index 5d048cd..bea86a3 100644 --- a/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java +++ b/webapp/src/test/java/org/apache/atlas/web/adapters/TestEntityREST.java @@ -17,8 +17,8 @@ */ package org.apache.atlas.web.adapters; +import org.apache.atlas.RequestContext; import org.apache.atlas.TestModules; -import org.apache.atlas.RequestContextV1; import org.apache.atlas.TestUtilsV2; import org.apache.atlas.model.instance.AtlasClassification; import org.apache.atlas.model.instance.AtlasClassification.AtlasClassifications; @@ -77,7 +77,7 @@ public class TestEntityREST { @AfterMethod public void cleanup() throws Exception { - RequestContextV1.clear(); + RequestContext.clear(); } private void createTestEntity() throws Exception { http://git-wip-us.apache.org/repos/asf/atlas/blob/4823c8ed/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java ---------------------------------------------------------------------- diff --git a/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java b/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java index a3f5601..5628b17 100644 --- a/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java +++ b/webapp/src/test/java/org/apache/atlas/web/filters/AtlasAuthenticationKerberosFilterTest.java @@ -16,7 +16,7 @@ */ package org.apache.atlas.web.filters; -import org.apache.atlas.RequestContextV1; +import org.apache.atlas.RequestContext; import org.apache.atlas.web.security.BaseSecurityTest; import org.apache.atlas.web.service.EmbeddedServer; import org.apache.commons.configuration.PropertiesConfiguration; @@ -111,7 +111,7 @@ public class AtlasAuthenticationKerberosFilterTest extends BaseSecurityTest { connection.connect(); assertEquals(connection.getResponseCode(), 200); - assertEquals(RequestContextV1.get().getUser(), TESTUSER); + assertEquals(RequestContext.get().getUser(), TESTUSER); return null; } });