Repository: incubator-atlas Updated Branches: refs/heads/master ca64ef4e8 -> c4fc5b4f5
ATLAS-1744: updated to address review comments and ATLAS startup failure Signed-off-by: Madhan Neethiraj <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/c4fc5b4f Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/c4fc5b4f Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/c4fc5b4f Branch: refs/heads/master Commit: c4fc5b4f557e9a23cd717f885beca3bdb4acf7e5 Parents: ca64ef4 Author: Suma Shivaprasad <[email protected]> Authored: Sat Apr 29 15:24:07 2017 -0700 Committer: Madhan Neethiraj <[email protected]> Committed: Sat Apr 29 15:24:07 2017 -0700 ---------------------------------------------------------------------- .../repository/store/graph/v1/AtlasAbstractDefStoreV1.java | 8 ++++++-- .../src/main/scala/org/apache/atlas/query/QueryParser.scala | 3 --- .../repository/store/graph/AtlasEntityDefStoreV1Test.java | 6 +++++- 3 files changed, 11 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c4fc5b4f/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java ---------------------------------------------------------------------- diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java index dde263b..baf2309 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasAbstractDefStoreV1.java @@ -25,6 +25,8 @@ import org.apache.atlas.model.typedef.AtlasBaseTypeDef; import org.apache.atlas.model.typedef.AtlasStructDef; import org.apache.atlas.query.QueryParser; import org.apache.atlas.type.AtlasTypeRegistry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.List; import java.util.regex.Matcher; @@ -34,13 +36,14 @@ import java.util.regex.Pattern; * Abstract typedef-store for v1 format. */ public abstract class AtlasAbstractDefStoreV1 { + private static final Logger LOG = LoggerFactory.getLogger(AtlasAbstractDefStoreV1.class); protected final AtlasTypeDefGraphStoreV1 typeDefStore; protected final AtlasTypeRegistry typeRegistry; private static final String NAME_REGEX = "[a-zA-Z][a-zA-Z0-9_ ]*"; private static final Pattern NAME_PATTERN = Pattern.compile(NAME_REGEX); - private static final String ALLOW_RESERVED_KEYWORDS = "atlas.types.allowReservedKeywords"; + public static final String ALLOW_RESERVED_KEYWORDS = "atlas.types.allowReservedKeywords"; public AtlasAbstractDefStoreV1(AtlasTypeDefGraphStoreV1 typeDefStore, AtlasTypeRegistry typeRegistry) { this.typeDefStore = typeDefStore; @@ -53,7 +56,7 @@ public abstract class AtlasAbstractDefStoreV1 { } try { - final boolean allowReservedKeywords = ApplicationProperties.get().getBoolean(ALLOW_RESERVED_KEYWORDS, false); + final boolean allowReservedKeywords = ApplicationProperties.get().getBoolean(ALLOW_RESERVED_KEYWORDS, true); if (!allowReservedKeywords && typeDef instanceof AtlasStructDef) { final List<AtlasStructDef.AtlasAttributeDef> attributeDefs = ((AtlasStructDef) typeDef).getAttributeDefs(); @@ -64,6 +67,7 @@ public abstract class AtlasAbstractDefStoreV1 { } } } catch (AtlasException e) { + LOG.error("Exception while loading configuration ", e); throw new AtlasBaseException(AtlasErrorCode.INTERNAL_ERROR, "Could not load configuration"); } } http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c4fc5b4f/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala ---------------------------------------------------------------------- diff --git a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala index d9fd865..8d454e9 100755 --- a/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala +++ b/repository/src/main/scala/org/apache/atlas/query/QueryParser.scala @@ -422,9 +422,6 @@ object QueryParser extends StandardTokenParsers with QueryKeywords with Expressi } def isKeyword(s: String) = queryreservedWords.contains(s) - - def isDelimiter(s: String) = querydelims.contains(s) - } class QueryLexer(val keywords: Seq[String], val delims: Seq[String]) extends StdLexical with ImplicitConversions { http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/c4fc5b4f/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java ---------------------------------------------------------------------- diff --git a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java index 9f69e5b..31fba33 100644 --- a/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java +++ b/repository/src/test/java/org/apache/atlas/repository/store/graph/AtlasEntityDefStoreV1Test.java @@ -19,11 +19,14 @@ package org.apache.atlas.repository.store.graph; import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; +import org.apache.atlas.ApplicationProperties; import org.apache.atlas.AtlasErrorCode; +import org.apache.atlas.AtlasException; import org.apache.atlas.RepositoryMetadataModule; import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.model.typedef.AtlasEntityDef; import org.apache.atlas.repository.graph.AtlasGraphProvider; +import org.apache.atlas.repository.store.graph.v1.AtlasAbstractDefStoreV1; import org.apache.atlas.type.AtlasTypeUtil; import org.testng.Assert; import org.testng.annotations.AfterClass; @@ -58,8 +61,9 @@ public class AtlasEntityDefStoreV1Test { } @Test(dataProvider = "invalidAttributeNameWithReservedKeywords") - public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) { + public void testCreateTypeWithReservedKeywords(AtlasEntityDef atlasEntityDef) throws AtlasException { try { + ApplicationProperties.get().setProperty(AtlasAbstractDefStoreV1.ALLOW_RESERVED_KEYWORDS, false); entityDefStore.create(atlasEntityDef, null); } catch (AtlasBaseException e) { Assert.assertEquals(e.getAtlasErrorCode(), AtlasErrorCode.ATTRIBUTE_NAME_INVALID);
