ATLAS-1744: updated to address review comments and ATLAS startup failure
Signed-off-by: Madhan Neethiraj <madhan@apache.org>
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.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 @@
* 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 @@
}
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 @@
}
}
} catch (AtlasException e) {
+ LOG.error("Exception while loading configuration ", e);
throw new AtlasBaseException(AtlasErrorCode.INTERNAL_ERROR, "Could not load configuration");
}
}
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 @@
}
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 {
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 @@
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 @@
}
@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);