atlas-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject incubator-atlas git commit: ATLAS-1602: fixed IT failures in QuickStart and issues identified in coverity scan
Date Wed, 01 Mar 2017 00:41:04 GMT
Repository: incubator-atlas
Updated Branches:
  refs/heads/master 8bb31fdf9 -> b1717f2e8


ATLAS-1602: fixed IT failures in QuickStart and issues identified in coverity scan

Signed-off-by: Madhan Neethiraj <madhan@apache.org>


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

Branch: refs/heads/master
Commit: b1717f2e8f721765ad0ff5b9cce08cc6de999807
Parents: 8bb31fd
Author: Sarath Subramanian <ssubramanian@hortonworks.com>
Authored: Mon Feb 27 09:32:03 2017 -0800
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Tue Feb 28 16:38:35 2017 -0800

----------------------------------------------------------------------
 .../java/org/apache/atlas/AtlasBaseClient.java  |   2 -
 .../main/java/org/apache/atlas/AtlasClient.java |  11 +-
 .../converters/AtlasInstanceConverter.java      |   5 +
 .../org/apache/atlas/examples/QuickStart.java   | 105 ++++++++++---------
 .../org/apache/atlas/examples/QuickStartV2.java |   4 -
 .../web/resources/DataSetLineageResource.java   |   9 ++
 .../atlas/web/resources/EntityResource.java     |  78 ++++++++++++--
 .../atlas/web/resources/LineageResource.java    |  13 ++-
 .../resources/MetadataDiscoveryResource.java    |   9 ++
 .../atlas/web/resources/TypesResource.java      |  21 ++--
 .../org/apache/atlas/web/util/Servlets.java     |   8 ++
 .../apache/atlas/examples/QuickStartV2IT.java   |  12 ++-
 .../atlas/web/resources/EntityResourceTest.java |   6 +-
 13 files changed, 199 insertions(+), 84 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
index cec5a11..6a34f83 100644
--- a/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasBaseClient.java
@@ -32,7 +32,6 @@ import javax.ws.rs.core.UriBuilder;
 
 import org.apache.atlas.model.metrics.AtlasMetrics;
 import org.apache.atlas.security.SecureClientUtils;
-import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.utils.AuthenticationUtil;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.lang.StringUtils;
@@ -319,7 +318,6 @@ public abstract class AtlasBaseClient {
                         }
                     } else {
                         T entity = clientResponse.getEntity(responseType);
-                        LOG.info("Response = {}", AtlasType.toJson(entity));
                         return entity;
                     }
                 } catch (ClientHandlerException e) {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/client/src/main/java/org/apache/atlas/AtlasClient.java
----------------------------------------------------------------------
diff --git a/client/src/main/java/org/apache/atlas/AtlasClient.java b/client/src/main/java/org/apache/atlas/AtlasClient.java
index 909bd23..d0e6ed4 100755
--- a/client/src/main/java/org/apache/atlas/AtlasClient.java
+++ b/client/src/main/java/org/apache/atlas/AtlasClient.java
@@ -20,8 +20,9 @@ package org.apache.atlas;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableSet;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 import com.sun.jersey.api.client.WebResource;
-import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.Struct;
 import org.apache.atlas.typesystem.TypesDef;
@@ -259,6 +260,8 @@ public class AtlasClient extends AtlasBaseClient {
     @XmlRootElement
     @XmlAccessorType(XmlAccessType.PROPERTY)
     public static class EntityResult {
+        private static final Gson gson = new GsonBuilder().setPrettyPrinting().create();
+
         public static final String OP_CREATED = "created";
         public static final String OP_UPDATED = "updated";
         public static final String OP_DELETED = "deleted";
@@ -314,12 +317,10 @@ public class AtlasClient extends AtlasBaseClient {
         }
 
         @Override
-        public String toString() {
-            return AtlasType.toJson(this);
-        }
+        public String toString() { return gson.toJson(this); }
 
         public static EntityResult fromString(String json) throws AtlasServiceException {
-            return AtlasType.fromJson(json, EntityResult.class);
+            return gson.fromJson(json, EntityResult.class);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
index 8f246e0..287ce15 100644
--- a/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
+++ b/repository/src/main/java/org/apache/atlas/repository/converters/AtlasInstanceConverter.java
@@ -56,6 +56,7 @@ import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -281,24 +282,28 @@ public class AtlasInstanceConverter {
                         case CREATE:
                             List<AtlasEntityHeader> createdEntities = mutatedEntities.get(EntityOperation.CREATE);
                             if (CollectionUtils.isNotEmpty(createdEntities)) {
+                                Collections.reverse(createdEntities);
                                 entityResult.set(EntityResult.OP_CREATED, getGuids(createdEntities));
                             }
                             break;
                         case UPDATE:
                             List<AtlasEntityHeader> updatedEntities = mutatedEntities.get(EntityOperation.UPDATE);
                             if (CollectionUtils.isNotEmpty(updatedEntities)) {
+                                Collections.reverse(updatedEntities);
                                 entityResult.set(EntityResult.OP_UPDATED, getGuids(updatedEntities));
                             }
                             break;
                         case PARTIAL_UPDATE:
                             List<AtlasEntityHeader> partialUpdatedEntities = mutatedEntities.get(EntityOperation.PARTIAL_UPDATE);
                             if (CollectionUtils.isNotEmpty(partialUpdatedEntities)) {
+                                Collections.reverse(partialUpdatedEntities);
                                 entityResult.set(EntityResult.OP_UPDATED, getGuids(partialUpdatedEntities));
                             }
                             break;
                         case DELETE:
                             List<AtlasEntityHeader> deletedEntities = mutatedEntities.get(EntityOperation.DELETE);
                             if (CollectionUtils.isNotEmpty(deletedEntities)) {
+                                Collections.reverse(deletedEntities);
                                 entityResult.set(EntityResult.OP_DELETED, getGuids(deletedEntities));
                             }
                             break;

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/examples/QuickStart.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/examples/QuickStart.java b/webapp/src/main/java/org/apache/atlas/examples/QuickStart.java
index a5d1492..21ecca9 100755
--- a/webapp/src/main/java/org/apache/atlas/examples/QuickStart.java
+++ b/webapp/src/main/java/org/apache/atlas/examples/QuickStart.java
@@ -55,7 +55,7 @@ public class QuickStart {
     public static final String SALES_DB = "Sales";
     public static final String SALES_DB_DESCRIPTION = "Sales Database";
     public static final String SALES_FACT_TABLE = "sales_fact";
-    public static final String FACT_TRAIT = "Fact";
+    public static final String FACT_TRAIT = "Fact_v1";
     public static final String COLUMNS_ATTRIBUTE = "columns";
     public static final String TIME_ID_COLUMN = "time_id";
     public static final String DB_ATTRIBUTE = "db";
@@ -115,16 +115,16 @@ public class QuickStart {
         return urls;
     }
 
-    static final String DATABASE_TYPE = "DB";
-    static final String COLUMN_TYPE = "Column";
-    static final String TABLE_TYPE = "Table";
-    static final String VIEW_TYPE = "View";
-    static final String LOAD_PROCESS_TYPE = "LoadProcess";
-    static final String STORAGE_DESC_TYPE = "StorageDesc";
+    static final String DATABASE_TYPE = "DB_v1";
+    static final String COLUMN_TYPE = "Column_v1";
+    static final String TABLE_TYPE = "Table_v1";
+    static final String VIEW_TYPE = "View_v1";
+    static final String LOAD_PROCESS_TYPE = "LoadProcess_v1";
+    static final String STORAGE_DESC_TYPE = "StorageDesc_v1";
 
     private static final String[] TYPES =
-            {DATABASE_TYPE, TABLE_TYPE, STORAGE_DESC_TYPE, COLUMN_TYPE, LOAD_PROCESS_TYPE, VIEW_TYPE, "JdbcAccess",
-                    "ETL", "Metric", "PII", "Fact", "Dimension", "Log Data"};
+            {DATABASE_TYPE, TABLE_TYPE, STORAGE_DESC_TYPE, COLUMN_TYPE, LOAD_PROCESS_TYPE, VIEW_TYPE, "JdbcAccess_v1",
+                    "ETL_v1", "Metric_v1", "PII_v1", "Fact_v1", "Dimension_v1", "Log Data_v1"};
 
     private final AtlasClient metadataServiceClient;
 
@@ -191,19 +191,19 @@ public class QuickStart {
                 new AttributeDefinition("inputTables", DataTypes.arrayTypeName(TABLE_TYPE),
                     Multiplicity.COLLECTION, false, null));
 
-        HierarchicalTypeDefinition<TraitType> dimTraitDef = TypesUtil.createTraitTypeDef("Dimension",  "Dimension Trait", null);
+        HierarchicalTypeDefinition<TraitType> dimTraitDef = TypesUtil.createTraitTypeDef("Dimension_v1",  "Dimension Trait", null);
 
-        HierarchicalTypeDefinition<TraitType> factTraitDef = TypesUtil.createTraitTypeDef("Fact", "Fact Trait", null);
+        HierarchicalTypeDefinition<TraitType> factTraitDef = TypesUtil.createTraitTypeDef("Fact_v1", "Fact Trait", null);
 
-        HierarchicalTypeDefinition<TraitType> piiTraitDef = TypesUtil.createTraitTypeDef("PII", "PII Trait", null);
+        HierarchicalTypeDefinition<TraitType> piiTraitDef = TypesUtil.createTraitTypeDef("PII_v1", "PII Trait", null);
 
-        HierarchicalTypeDefinition<TraitType> metricTraitDef = TypesUtil.createTraitTypeDef("Metric", "Metric Trait", null);
+        HierarchicalTypeDefinition<TraitType> metricTraitDef = TypesUtil.createTraitTypeDef("Metric_v1", "Metric Trait", null);
 
-        HierarchicalTypeDefinition<TraitType> etlTraitDef = TypesUtil.createTraitTypeDef("ETL", "ETL Trait", null);
+        HierarchicalTypeDefinition<TraitType> etlTraitDef = TypesUtil.createTraitTypeDef("ETL_v1", "ETL Trait", null);
 
-        HierarchicalTypeDefinition<TraitType> jdbcTraitDef = TypesUtil.createTraitTypeDef("JdbcAccess", "JdbcAccess Trait", null);
+        HierarchicalTypeDefinition<TraitType> jdbcTraitDef = TypesUtil.createTraitTypeDef("JdbcAccess_v1", "JdbcAccess Trait", null);
 
-        HierarchicalTypeDefinition<TraitType> logTraitDef = TypesUtil.createTraitTypeDef("Log Data", "LogData Trait",  null);
+        HierarchicalTypeDefinition<TraitType> logTraitDef = TypesUtil.createTraitTypeDef("Log Data_v1", "LogData Trait",  null);
 
         return TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.<StructTypeDefinition>of(),
                 ImmutableList.of(dimTraitDef, factTraitDef, piiTraitDef, metricTraitDef, etlTraitDef, jdbcTraitDef, logTraitDef),
@@ -235,12 +235,12 @@ public class QuickStart {
 
         List<Referenceable> salesFactColumns = ImmutableList
                 .of(rawColumn(TIME_ID_COLUMN, "int", "time id"), rawColumn("product_id", "int", "product id"),
-                        rawColumn("customer_id", "int", "customer id", "PII"),
-                        rawColumn("sales", "double", "product id", "Metric"));
+                        rawColumn("customer_id", "int", "customer id", "PII_v1"),
+                        rawColumn("sales", "double", "product id", "Metric_v1"));
 
         List<Referenceable> logFactColumns = ImmutableList
                 .of(rawColumn("time_id", "int", "time id"), rawColumn("app_id", "int", "app id"),
-                        rawColumn("machine_id", "int", "machine id"), rawColumn("log", "string", "log data", "Log Data"));
+                        rawColumn("machine_id", "int", "machine id"), rawColumn("log", "string", "log data", "Log Data_v1"));
 
         Id salesFact = table(SALES_FACT_TABLE, SALES_FACT_TABLE_DESCRIPTION, salesDB, sd, "Joe", "Managed",
                 salesFactColumns, FACT_TRAIT);
@@ -251,23 +251,23 @@ public class QuickStart {
 
         Id productDim =
                 table(PRODUCT_DIM_TABLE, "product dimension table", salesDB, sd, "John Doe", "Managed",
-                        productDimColumns, "Dimension");
+                        productDimColumns, "Dimension_v1");
 
         List<Referenceable> timeDimColumns = ImmutableList
                 .of(rawColumn("time_id", "int", "time id"), rawColumn("dayOfYear", "int", "day Of Year"),
                         rawColumn("weekDay", "int", "week Day"));
 
         Id timeDim = table(TIME_DIM_TABLE, "time dimension table", salesDB, sd, "John Doe", "External", timeDimColumns,
-                "Dimension");
+                "Dimension_v1");
 
 
-        List<Referenceable> customerDimColumns = ImmutableList.of(rawColumn("customer_id", "int", "customer id", "PII"),
-                rawColumn("name", "string", "customer name", "PII"),
-                rawColumn("address", "string", "customer address", "PII"));
+        List<Referenceable> customerDimColumns = ImmutableList.of(rawColumn("customer_id", "int", "customer id", "PII_v1"),
+                rawColumn("name", "string", "customer name", "PII_v1"),
+                rawColumn("address", "string", "customer address", "PII_v1"));
 
         Id customerDim =
                 table("customer_dim", "customer dimension table", salesDB, sd, "fetl", "External", customerDimColumns,
-                        "Dimension");
+                        "Dimension_v1");
 
 
         Id reportingDB =
@@ -277,33 +277,33 @@ public class QuickStart {
 
         Id salesFactDaily =
                 table(SALES_FACT_DAILY_MV_TABLE, "sales fact daily materialized view", reportingDB, sd, "Joe BI",
-                        "Managed", salesFactColumns, "Metric");
+                        "Managed", salesFactColumns, "Metric_v1");
 
         Id loggingFactDaily =
                 table("log_fact_daily_mv", "log fact daily materialized view", logDB, sd, "Tim ETL", "Managed",
-                        logFactColumns, "Log Data");
+                        logFactColumns, "Log Data_v1");
 
         loadProcess(LOAD_SALES_DAILY_PROCESS, LOAD_SALES_DAILY_PROCESS_DESCRIPTION, "John ETL",
                 ImmutableList.of(salesFact, timeDim),
-                ImmutableList.of(salesFactDaily), "create table as select ", "plan", "id", "graph", "ETL");
+                ImmutableList.of(salesFactDaily), "create table as select ", "plan", "id", "graph", "ETL_v1");
 
-        view(PRODUCT_DIM_VIEW, reportingDB, ImmutableList.of(productDim), "Dimension", "JdbcAccess");
+        view(PRODUCT_DIM_VIEW, reportingDB, ImmutableList.of(productDim), "Dimension_v1", "JdbcAccess_v1");
 
-        view("customer_dim_view", reportingDB, ImmutableList.of(customerDim), "Dimension", "JdbcAccess");
+        view("customer_dim_view", reportingDB, ImmutableList.of(customerDim), "Dimension_v1", "JdbcAccess_v1");
 
         Id salesFactMonthly =
                 table("sales_fact_monthly_mv", "sales fact monthly materialized view", reportingDB, sd, "Jane BI",
-                        "Managed", salesFactColumns, "Metric");
+                        "Managed", salesFactColumns, "Metric_v1");
 
         loadProcess("loadSalesMonthly", "hive query for monthly summary", "John ETL", ImmutableList.of(salesFactDaily),
-                ImmutableList.of(salesFactMonthly), "create table as select ", "plan", "id", "graph", "ETL");
+                ImmutableList.of(salesFactMonthly), "create table as select ", "plan", "id", "graph", "ETL_v1");
 
         Id loggingFactMonthly =
                 table("logging_fact_monthly_mv", "logging fact monthly materialized view", logDB, sd, "Tim ETL",
-                        "Managed", logFactColumns, "Log Data");
+                        "Managed", logFactColumns, "Log Data_v1");
 
         loadProcess("loadLogsMonthly", "hive query for monthly summary", "Tim ETL", ImmutableList.of(loggingFactDaily),
-                ImmutableList.of(loggingFactMonthly), "create table as select ", "plan", "id", "graph", "ETL");
+                ImmutableList.of(loggingFactMonthly), "create table as select ", "plan", "id", "graph", "ETL_v1");
     }
 
     private Id createInstance(Referenceable referenceable) throws Exception {
@@ -315,8 +315,11 @@ public class QuickStart {
         System.out.println("created instance for type " + typeName + ", guid: " + guids);
 
         // return the Id for created instance with guid
-        return new Id(guids.get(guids.size() - 1), referenceable.getId().getVersion(),
-                referenceable.getTypeName());
+        if (guids.size() > 0) {
+            return new Id(guids.get(guids.size() - 1), referenceable.getId().getVersion(), referenceable.getTypeName());
+        }
+
+        return null;
     }
 
     Id database(String name, String description, String owner, String locationUri, String... traitNames)
@@ -411,23 +414,23 @@ public class QuickStart {
     }
 
     private String[] getDSLQueries() {
-        return new String[]{"from DB", "DB", "DB where name=\"Reporting\"", "DB where DB.name=\"Reporting\"",
-                "DB name = \"Reporting\"", "DB DB.name = \"Reporting\"",
-                "DB where name=\"Reporting\" select name, owner", "DB where DB.name=\"Reporting\" select name, owner",
-                "DB has name", "DB where DB has name", "DB, Table", "DB is JdbcAccess",
+        return new String[]{"from DB_v1", "DB_v1", "DB_v1 where name=\"Reporting\"", "DB_v1 where DB_v1.name=\"Reporting\"",
+                "DB_v1 name = \"Reporting\"", "DB_v1 DB_v1.name = \"Reporting\"",
+                "DB_v1 where name=\"Reporting\" select name, owner", "DB_v1 where DB_v1.name=\"Reporting\" select name, owner",
+                "DB_v1 has name", "DB_v1 where DB_v1 has name", "DB_v1, Table_v1", "DB_v1 is JdbcAccess",
             /*
             "DB, hive_process has name",
             "DB as db1, Table where db1.name = \"Reporting\"",
             "DB where DB.name=\"Reporting\" and DB.createTime < " + System.currentTimeMillis()},
             */
-                "from Table", "Table", "Table is Dimension", "Column where Column isa PII", "View is Dimension",
+                "from Table_v1", "Table_v1", "Table_v1 is Dimension_v1", "Column_v1 where Column_v1 isa PII_v1", "View_v1 is Dimension_v1",
             /*"Column where Column isa PII select Column.name",*/
-                "Column select Column.name", "Column select name", "Column where Column.name=\"customer_id\"",
-                "from Table select Table.name", "DB where (name = \"Reporting\")",
-                "DB where (name = \"Reporting\") select name as _col_0, owner as _col_1", "DB where DB is JdbcAccess",
-                "DB where DB has name", "DB Table", "DB where DB has name",
-                "DB as db1 Table where (db1.name = \"Reporting\")",
-                "DB where (name = \"Reporting\") select name as _col_0, (createTime + 1) as _col_1 ",
+                "Column_v1 select Column_v1.name", "Column_v1 select name", "Column_v1 where Column_v1.name=\"customer_id\"",
+                "from Table_v1 select Table_v1.name", "DB_v1 where (name = \"Reporting\")",
+                "DB_v1 where (name = \"Reporting\") select name as _col_0, owner as _col_1", "DB_v1 where DB_v1 is JdbcAccess_v1",
+                "DB_v1 where DB_v1 has name", "DB_v1 Table_v1", "DB_v1 where DB_v1 has name",
+                "DB_v1 as db1 Table where (db1.name = \"Reporting\")",
+                "DB_v1 where (name = \"Reporting\") select name as _col_0, (createTime + 1) as _col_1 ",
             /*
             todo: does not work
             "DB where (name = \"Reporting\") and ((createTime + 1) > 0)",
@@ -441,9 +444,9 @@ public class QuickStart {
             select db1.name as dbName, tab.name as tabName",
             */
                 // trait searches
-                "Dimension",
+                "Dimension_v1",
             /*"Fact", - todo: does not work*/
-                "JdbcAccess", "ETL", "Metric", "PII", "`Log Data`",
+                "JdbcAccess_v1", "ETL_v1", "Metric_v1", "PII_v1", "`Log Data_v1`",
             /*
             // Lineage - todo - fix this, its not working
             "Table hive_process outputTables",
@@ -452,8 +455,8 @@ public class QuickStart {
             "Table as src loop (hive_process outputTables) as dest select src.name as srcTable, dest.name as
             destTable withPath",
             */
-                "Table where name=\"sales_fact\", columns",
-                "Table where name=\"sales_fact\", columns as column select column.name, column.dataType, column"
+                "Table_v1 where name=\"sales_fact\", columns",
+                "Table_v1 where name=\"sales_fact\", columns as column select column.name, column.dataType, column"
                         + ".comment",
                 "from DataSet", "from Process",};
     }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java b/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
index f593d0c..a11351a 100755
--- a/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
+++ b/webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
@@ -350,10 +350,6 @@ public class QuickStartV2 {
             System.out.println("Created entity of type [" + ret.getTypeName() + "], guid: " + ret.getGuid());
         }
 
-        if (ArrayUtils.isNotEmpty(traitNames)) {
-            entitiesClient.addClassifications(ret.getGuid(), toAtlasClassifications(traitNames));
-        }
-
         return ret;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
index c3799cb..14d86f7 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/DataSetLineageResource.java
@@ -98,6 +98,9 @@ public class DataSetLineageResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get lineage inputs graph for table {}", tableName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get lineage inputs graph for table {}", tableName, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get lineage inputs graph for table {}", tableName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -141,6 +144,9 @@ public class DataSetLineageResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get lineage outputs graph for table {}", tableName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get lineage outputs graph for table {}", tableName, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get lineage outputs graph for table {}", tableName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -184,6 +190,9 @@ public class DataSetLineageResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get schema for table {}", tableName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get schema for table {}", tableName, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get schema for table {}", tableName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/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 6a46fca..6d902db 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
@@ -35,7 +35,6 @@ import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
 import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
 import org.apache.atlas.model.instance.EntityMutationResponse;
 import org.apache.atlas.model.instance.GuidMapping;
-import org.apache.atlas.repository.converters.AtlasFormatConverter.ConverterContext;
 import org.apache.atlas.repository.converters.AtlasInstanceConverter;
 import org.apache.atlas.repository.store.graph.AtlasEntityStore;
 import org.apache.atlas.services.MetadataService;
@@ -47,8 +46,6 @@ import org.apache.atlas.typesystem.ITypedReferenceableInstance;
 import org.apache.atlas.typesystem.Referenceable;
 import org.apache.atlas.typesystem.exception.EntityExistsException;
 import org.apache.atlas.typesystem.exception.EntityNotFoundException;
-import org.apache.atlas.typesystem.exception.TraitNotFoundException;
-import org.apache.atlas.typesystem.exception.TypeNotFoundException;
 import org.apache.atlas.typesystem.json.InstanceSerialization;
 import org.apache.atlas.typesystem.types.ValueConversionException;
 import org.apache.atlas.utils.AtlasPerfTracer;
@@ -174,6 +171,9 @@ public class EntityResource {
 
             return Response.created(locationURI).entity(response).build();
 
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
+            throw toWebApplicationException(e);
         } catch(EntityExistsException e) {
             LOG.error("Unique constraint violation for entity entityDef={}", entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.CONFLICT));
@@ -183,6 +183,9 @@ public class EntityResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -276,6 +279,9 @@ public class EntityResource {
 
             JSONObject response = getResponse(result);
             return Response.ok(response).build();
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
+            throw toWebApplicationException(e);
         } catch(EntityExistsException e) {
             LOG.error("Unique constraint violation for entityDef={}", entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.CONFLICT));
@@ -285,6 +291,9 @@ public class EntityResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to persist entity instance entityDef={}", entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -370,6 +379,9 @@ public class EntityResource {
 
             JSONObject response = getResponse(result);
             return Response.ok(response).build();
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType, attribute, value, e);
+            throw toWebApplicationException(e);
         } catch (ValueConversionException ve) {
             LOG.error("Unable to persist entity instance due to a deserialization error {} ", entityJson, ve);
             throw new WebApplicationException(Servlets.getErrorResponse(ve.getCause(), Response.Status.BAD_REQUEST));
@@ -382,6 +394,9 @@ public class EntityResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType, attribute, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType, attribute, value, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to partially update entity {} {}:{}.{}", entityJson, entityType, attribute, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -455,12 +470,18 @@ public class EntityResource {
 
             JSONObject response = getResponse(result);
             return Response.ok(response).build();
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to update entity by GUID {} {} ", guid, entityJson, e);
+            throw toWebApplicationException(e);
         } catch (EntityNotFoundException e) {
             LOG.error("An entity with GUID={} does not exist {} ", guid, entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND));
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to update entity by GUID {} {}", guid, entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to update entity by GUID {} {} ", guid, entityJson, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to update entity by GUID {} {} ", guid, entityJson, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -497,12 +518,18 @@ public class EntityResource {
 
             JSONObject response = getResponse(result);
             return Response.ok(response).build();
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e);
+            throw toWebApplicationException(e);
         } catch (EntityNotFoundException e) {
             LOG.error("An entity with GUID={} does not exist {} ", guid, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND));
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to add property {} to entity id {} {} ", property, guid, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -565,6 +592,9 @@ public class EntityResource {
 
             JSONObject response = getResponse(entityResult);
             return Response.ok(response).build();
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to delete entities {} {} {} {} ", guids, entityType, attribute, value, e);
+            throw toWebApplicationException(e);
         } catch (EntityNotFoundException e) {
             if(guids != null && !guids.isEmpty()) {
                 LOG.error("An entity with GUID={} does not exist ", guids, e);
@@ -575,6 +605,9 @@ public class EntityResource {
         }  catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to delete entities {} {} {} {} ", guids, entityType, attribute, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to delete entities {} {} {} {} ", guids, entityType, attribute, value, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to delete entities {} {} {} {} ", guids, entityType, attribute, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -633,6 +666,9 @@ public class EntityResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Bad GUID={} ", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get instance definition for GUID {}", guid, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get instance definition for GUID {}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -673,6 +709,9 @@ public class EntityResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to get entity list for type {}", entityType, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get entity list for type {}", entityType, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get entity list for type {}", entityType, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -736,8 +775,8 @@ public class EntityResource {
             try {
                 entityInfo = entitiesStore.getByUniqueAttributes(getEntityType(entityType), attributes);
             } catch (AtlasBaseException e) {
-                LOG.error("Cannot find entity with type: {0}, attribute: {1} and value: {2}", entityType, attribute, value);
-                throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+                LOG.error("Cannot find entity with type: {}, attribute: {} and value: {}", entityType, attribute, value);
+                throw toWebApplicationException(e);
             }
 
             String entityDefinition = null;
@@ -763,9 +802,15 @@ public class EntityResource {
 
             return Response.status(status).entity(response).build();
 
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to get instance definition for type={}, qualifiedName={}", entityType, value, e);
+            throw toWebApplicationException(e);
         } catch (IllegalArgumentException e) {
             LOG.error("Bad type={}, qualifiedName={}", entityType, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get instance definition for type={}, qualifiedName={}", entityType, value, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get instance definition for type={}, qualifiedName={}", entityType, value, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -818,6 +863,9 @@ public class EntityResource {
         } catch (IllegalArgumentException e) {
             LOG.error("Unable to get trait definition for entity {}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get trait names for entity {}", guid, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get trait names for entity {}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -872,6 +920,9 @@ public class EntityResource {
         } catch (IllegalArgumentException e) {
             LOG.error("Unable to get trait definition for entity {}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get trait definitions for entity {}", guid, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get trait definitions for entity {}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -925,6 +976,9 @@ public class EntityResource {
         } catch (IllegalArgumentException e) {
             LOG.error("Unable to get trait definition for entity {} and trait {}", guid, traitName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get trait definition for entity {} and trait {}", guid, traitName, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get trait definition for entity {} and trait {}", guid, traitName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -984,6 +1038,9 @@ public class EntityResource {
         } catch  (IllegalArgumentException e) {
             LOG.error("Unable to add trait for entity={} traitDef={}", guid, traitDefinition, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to add trait for entity={} traitDef={}", guid, traitDefinition, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to add trait for entity={} traitDef={}", guid, traitDefinition, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -1036,6 +1093,9 @@ public class EntityResource {
         } catch (IllegalArgumentException e) {
             LOG.error("Unable to delete trait name={} for entity={}", traitName, guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to delete trait name={} for entity={}", traitName, guid, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to delete trait name={} for entity={}", traitName, guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -1087,6 +1147,9 @@ public class EntityResource {
         } catch (AtlasException | IllegalArgumentException e) {
             LOG.error("Unable to get audit events for entity guid={} startKey={}", guid, startKey, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get audit events for entity guid={} startKey={}", guid, startKey, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get audit events for entity guid={} startKey={}", guid, startKey, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -1113,7 +1176,8 @@ public class EntityResource {
 
     public static WebApplicationException toWebApplicationException(AtlasBaseException e) {
         if (e.getAtlasErrorCode() == AtlasErrorCode.CLASSIFICATION_NOT_FOUND
-            || e.getAtlasErrorCode() == AtlasErrorCode.INSTANCE_GUID_NOT_FOUND) {
+            || e.getAtlasErrorCode() == AtlasErrorCode.INSTANCE_GUID_NOT_FOUND
+            || e.getAtlasErrorCode() == AtlasErrorCode.INSTANCE_BY_UNIQUE_ATTRIBUTE_NOT_FOUND) {
             return new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND));
         }
 
@@ -1122,6 +1186,6 @@ public class EntityResource {
             return new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
         }
 
-        return new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
+        return new WebApplicationException(Servlets.getErrorResponse(e, e.getAtlasErrorCode().getHttpCode()));
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
index e8d2d74..e5ec691 100644
--- a/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/LineageResource.java
@@ -99,7 +99,10 @@ public class LineageResource {
             return Response.ok(response).build();
         } catch (AtlasBaseException e) {
             LOG.error("Unable to get lineage inputs graph for entity guid={}", guid, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, e.getAtlasErrorCode().getHttpCode()));
+            throw new WebApplicationException(Servlets.getErrorResponse(e));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get lineage inputs graph for entity guid={}", guid, e);
+            throw e;
         } catch (JSONException e) {
             LOG.error("Unable to get lineage inputs graph for entity guid={}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -143,7 +146,10 @@ public class LineageResource {
             return Response.ok(response).build();
         } catch (AtlasBaseException e) {
             LOG.error("Unable to get lineage outputs graph for entity guid={}", guid, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, e.getAtlasErrorCode().getHttpCode()));
+            throw new WebApplicationException(Servlets.getErrorResponse(e));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get lineage outputs graph for entity guid={}", guid, e);
+            throw e;
         } catch (JSONException e) {
             LOG.error("Unable to get lineage outputs graph for entity guid={}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -192,6 +198,9 @@ public class LineageResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get schema for entity guid={}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get schema for entity guid={}", guid, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get schema for entity={}", guid, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
index 61e833f..3337974 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/MetadataDiscoveryResource.java
@@ -150,6 +150,9 @@ public class MetadataDiscoveryResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get entity list for dslQuery {}", dslQuery, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get entity list for dslQuery {}", dslQuery, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get entity list for dslQuery {}", dslQuery, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -225,6 +228,9 @@ public class MetadataDiscoveryResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get entity list for gremlinQuery {}", gremlinQuery, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get entity list for gremlinQuery {}", gremlinQuery, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get entity list for gremlinQuery {}", gremlinQuery, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -272,6 +278,9 @@ public class MetadataDiscoveryResource {
         } catch (DiscoveryException | IllegalArgumentException e) {
             LOG.error("Unable to get entity list for query {}", query, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get entity list for query {}", query, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get entity list for query {}", query, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
index e731669..db282d8 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
@@ -121,12 +121,12 @@ public class TypesResource {
             return Response.status(ClientResponse.Status.CREATED).entity(response).build();
         } catch (AtlasBaseException e) {
             LOG.error("Type creation failed", e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, e.getAtlasErrorCode().getHttpCode()));
+            throw new WebApplicationException(Servlets.getErrorResponse(e));
         } catch (IllegalArgumentException e) {
             LOG.error("Unable to persist types", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
         } catch (WebApplicationException e) {
-            LOG.error("Unable to persist types due to V2 API error", e);
+            LOG.error("Unable to persist types", e);
             throw e;
         } catch (Throwable e) {
             LOG.error("Unable to persist types", e);
@@ -187,11 +187,14 @@ public class TypesResource {
             response.put(AtlasClient.REQUEST_ID, Servlets.getRequestId());
             response.put(AtlasClient.TYPES, typesResponse);
             return Response.ok().entity(response).build();
-        } catch (AtlasBaseException | IllegalArgumentException e) {
+        } catch (AtlasBaseException e) {
+            LOG.error("Unable to persist types", e);
+            throw new WebApplicationException(Servlets.getErrorResponse(e));
+        } catch (IllegalArgumentException e) {
             LOG.error("Unable to persist types", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
         } catch (WebApplicationException e) {
-            LOG.error("Unable to persist types due to V2 API error", e);
+            LOG.error("Unable to persist types", e);
             throw e;
         } catch (Throwable e) {
             LOG.error("Unable to persist types", e);
@@ -237,10 +240,13 @@ public class TypesResource {
             return Response.ok(response).build();
         } catch (AtlasBaseException e) {
             LOG.error("Unable to get type definition for type {}", typeName, e);
-            throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.NOT_FOUND));
+            throw new WebApplicationException(Servlets.getErrorResponse(e));
         } catch (JSONException | IllegalArgumentException e) {
             LOG.error("Unable to get type definition for type {}", typeName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get type definition for type {}", typeName, e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get type definition for type {}", typeName, e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
@@ -292,7 +298,10 @@ public class TypesResource {
             return Response.ok(response).build();
         } catch (AtlasBaseException e) {
             LOG.warn("TypesREST exception: {} {}", e.getClass().getSimpleName(), e.getMessage());
-            throw new WebApplicationException(Servlets.getErrorResponse(e, e.getAtlasErrorCode().getHttpCode()));
+            throw new WebApplicationException(Servlets.getErrorResponse(e));
+        } catch (WebApplicationException e) {
+            LOG.error("Unable to get types list", e);
+            throw e;
         } catch (Throwable e) {
             LOG.error("Unable to get types list", e);
             throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
----------------------------------------------------------------------
diff --git a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
index c5c0731..926c509 100755
--- a/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
+++ b/webapp/src/main/java/org/apache/atlas/web/util/Servlets.java
@@ -20,6 +20,7 @@ package org.apache.atlas.web.util;
 
 import org.apache.atlas.AtlasClient;
 import org.apache.atlas.LocalServletRequest;
+import org.apache.atlas.exception.AtlasBaseException;
 import org.apache.atlas.utils.ParamChecker;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.io.IOUtils;
@@ -137,6 +138,13 @@ public final class Servlets {
         return url.toString();
     }
 
+    public static Response getErrorResponse(AtlasBaseException e) {
+        String message = e.getMessage() == null ? "Failed with " + e.getClass().getName() : e.getMessage();
+        Response response = getErrorResponse(message, e.getAtlasErrorCode().getHttpCode());
+
+        return response;
+    }
+
     public static Response getErrorResponse(Throwable e, Response.Status status) {
         String message = e.getMessage() == null ? "Failed with " + e.getClass().getName() : e.getMessage();
         Response response = getErrorResponse(message, status);

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java b/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
index eb43384..1449812 100644
--- a/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
+++ b/webapp/src/test/java/org/apache/atlas/examples/QuickStartV2IT.java
@@ -28,6 +28,7 @@ import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageDirection;
 import org.apache.atlas.model.lineage.AtlasLineageInfo.LineageRelation;
 import org.apache.atlas.web.resources.BaseResourceIT;
 import org.codehaus.jettison.json.JSONException;
+import org.testng.Assert;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
@@ -35,6 +36,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
@@ -98,13 +100,13 @@ public class QuickStartV2IT extends BaseResourceIT {
 
     private void verifyColumnsAreAddedToTable(AtlasEntity table) throws JSONException {
         Map<String, Object> tableAttributes = table.getAttributes();
-        List<AtlasEntity> columns = (List<AtlasEntity>) tableAttributes.get("columns");
+        List<Map> columns = (List<Map>) tableAttributes.get("columns");
         assertEquals(4, columns.size());
 
-        Map<String, Object> column = (Map) columns.get(0);
-        Map<String, Object> columnAttributes = (Map) column.get("attributes");
-        assertEquals(QuickStartV2.TIME_ID_COLUMN, columnAttributes.get("name"));
-        assertEquals("int", columnAttributes.get("dataType"));
+        for (Map colMap : columns) {
+            String colGuid = (String) colMap.get("guid");
+            assertNotNull(UUID.fromString(colGuid));
+        }
     }
 
     private void verifyDBIsLinkedToTable(AtlasEntity table) throws AtlasServiceException, JSONException {

http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/b1717f2e/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java b/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
index 2f71378..21060d1 100644
--- a/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
+++ b/webapp/src/test/java/org/apache/atlas/web/resources/EntityResourceTest.java
@@ -69,8 +69,10 @@ public class EntityResourceTest {
         EntityMutationResponse  resp    = new EntityMutationResponse();
         List<AtlasEntityHeader> headers = toAtlasEntityHeaders(guids);
 
-        for (AtlasEntityHeader entity : headers) {
-            resp.addEntity(EntityMutations.EntityOperation.DELETE, entity);
+        if (CollectionUtils.isNotEmpty(headers)) {
+            for (AtlasEntityHeader entity : headers) {
+                resp.addEntity(EntityMutations.EntityOperation.DELETE, entity);
+            }
         }
 
         when(entitiesStore.deleteByIds(guids)).thenReturn(resp);


Mime
View raw message