You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ap...@apache.org on 2017/10/23 20:53:54 UTC

atlas git commit: ATLAS-1954: Integration tests for Basic search

Repository: atlas
Updated Branches:
  refs/heads/master c08bac80a -> f4d346423


ATLAS-1954: Integration tests for Basic search


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

Branch: refs/heads/master
Commit: f4d3464232098c7224b8824dd3c961eb25954f8e
Parents: c08bac8
Author: apoorvnaik <ap...@apache.org>
Authored: Fri Sep 29 11:02:00 2017 -0700
Committer: apoorvnaik <ap...@apache.org>
Committed: Mon Oct 23 13:52:30 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/atlas/AtlasBaseClient.java  |  55 ++++-
 client/pom.xml                                  |   5 +
 pom.xml                                         |   1 +
 .../discovery/EntityDiscoveryServiceTest.java   |  19 ++
 .../impexp/ZipFileResourceTestUtils.java        |  28 +--
 .../atlas/utils/TestResourceFileUtils.java      |  90 +++++++
 .../atlas/web/integration/BasicSearchIT.java    | 176 ++++++++++++++
 webapp/src/test/resources/DefaultDB-3-New.zip   | Bin 0 -> 1749068 bytes
 webapp/src/test/resources/hive-db-50-tables.zip | Bin 0 -> 19453 bytes
 .../search-parameters/combination-filters.json  | 185 ++++++++++++++
 .../json/search-parameters/entity-filters.json  | 242 +++++++++++++++++++
 .../json/search-parameters/tag-filters.json     |  16 ++
 12 files changed, 789 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java
----------------------------------------------------------------------
diff --git a/client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java b/client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java
index 1616029..aa1c773 100644
--- a/client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java
+++ b/client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java
@@ -27,8 +27,14 @@ import com.sun.jersey.api.client.config.DefaultClientConfig;
 import com.sun.jersey.api.client.filter.HTTPBasicAuthFilter;
 import com.sun.jersey.api.json.JSONConfiguration;
 import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
+import com.sun.jersey.multipart.FormDataMultiPart;
+import com.sun.jersey.multipart.MultiPart;
+import com.sun.jersey.multipart.file.FileDataBodyPart;
+import org.apache.atlas.model.impexp.AtlasImportRequest;
+import org.apache.atlas.model.impexp.AtlasImportResult;
 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;
@@ -44,6 +50,7 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
+import java.io.File;
 import java.io.IOException;
 import java.net.ConnectException;
 import java.nio.file.Paths;
@@ -58,6 +65,7 @@ public abstract class AtlasBaseClient {
     public static final String ADMIN_VERSION = "admin/version";
     public static final String ADMIN_STATUS = "admin/status";
     public static final String ADMIN_METRICS = "admin/metrics";
+    public static final String ADMIN_IMPORT = "admin/import";
     public static final String HTTP_AUTHENTICATION_ENABLED = "atlas.http.authentication.enabled";
 
     public static final String QUERY = "query";
@@ -78,6 +86,7 @@ public abstract class AtlasBaseClient {
     // With number of retries, this gives a total time of about 20s for the server to start.
     static final int DEFAULT_SLEEP_BETWEEN_RETRIES_MS = 5000;
     private static final Logger LOG = LoggerFactory.getLogger(AtlasBaseClient.class);
+    private static final API IMPORT = new API(BASE_URI + ADMIN_IMPORT, HttpMethod.POST, Response.Status.OK, MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_JSON);
     protected WebResource service;
     protected Configuration configuration;
     private String basicAuthUser;
@@ -315,16 +324,20 @@ public abstract class AtlasBaseClient {
         ClientResponse clientResponse = null;
         int i = 0;
         do {
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Calling API [ {} : {} ] {}", api.getMethod(), api.getNormalizedPath(), requestObject != null ? "<== " + requestObject : "");
+            LOG.info("------------------------------------------------------");
+            LOG.info("Call         : {} {}", api.getMethod(), api.getNormalizedPath());
+            LOG.info("Content-type : {} ", api.getConsumes());
+            LOG.info("Accept       : {} ", api.getProduces());
+            if (requestObject != null) {
+                LOG.info("Request      : {}", requestObject);
             }
 
             WebResource.Builder requestBuilder = resource.getRequestBuilder();
 
             // Set content headers
             requestBuilder
-                    .accept(JSON_MEDIA_TYPE)
-                    .type(JSON_MEDIA_TYPE);
+                    .accept(api.getProduces())
+                    .type(api.getConsumes());
 
             // Set cookie if present
             if (cookie != null) {
@@ -338,21 +351,24 @@ public abstract class AtlasBaseClient {
             }
 
             if (clientResponse.getStatus() == api.getExpectedStatus().getStatusCode()) {
-                if (null == responseType) {
+                if (responseType == null) {
                     return null;
                 }
                 try {
-                    if (responseType.getRawClass() == JSONObject.class) {
+                    if (responseType.getRawClass().equals(JSONObject.class)) {
                         String stringEntity = clientResponse.getEntity(String.class);
                         try {
                             JSONObject jsonObject = new JSONObject(stringEntity);
-                            LOG.info("Response = {}", jsonObject);
+                            LOG.debug("Response = {}", jsonObject);
+                            LOG.info("------------------------------------------------------");
                             return (T) jsonObject;
                         } catch (JSONException e) {
                             throw new AtlasServiceException(api, e);
                         }
                     } else {
                         T entity = clientResponse.getEntity(responseType);
+                        LOG.debug("Response = {}", entity);
+                        LOG.info("------------------------------------------------------");
                         return entity;
                     }
                 } catch (ClientHandlerException e) {
@@ -418,6 +434,15 @@ public abstract class AtlasBaseClient {
         return configuration.getInt(AtlasBaseClient.ATLAS_CLIENT_HA_RETRIES_KEY, AtlasBaseClient.DEFAULT_NUM_RETRIES);
     }
 
+    public AtlasImportResult importData(AtlasImportRequest request, String absoluteFilePath) throws AtlasServiceException {
+        FileDataBodyPart filePart = new FileDataBodyPart("data", new File(absoluteFilePath));
+        MultiPart multipartEntity = new FormDataMultiPart()
+                .field("request", AtlasType.toJson(request), MediaType.APPLICATION_JSON_TYPE)
+                .bodyPart(filePart);
+
+        return callAPI(IMPORT, AtlasImportResult.class, multipartEntity);
+    }
+
     boolean isRetryableException(ClientHandlerException che) {
         return che.getCause().getClass().equals(IOException.class)
                 || che.getCause().getClass().equals(ConnectException.class);
@@ -563,12 +588,20 @@ public abstract class AtlasBaseClient {
     public static class API {
         private final String method;
         private final String path;
+        private final String consumes;
+        private final String produces;
         private final Response.Status status;
 
         public API(String path, String method, Response.Status status) {
+            this(path, method, status, JSON_MEDIA_TYPE, MediaType.APPLICATION_JSON);
+        }
+
+        public API(String path, String method, Response.Status status, String consumes, String produces) {
             this.path = path;
             this.method = method;
             this.status = status;
+            this.consumes = consumes;
+            this.produces = produces;
         }
 
         public String getMethod() {
@@ -586,6 +619,14 @@ public abstract class AtlasBaseClient {
         public Response.Status getExpectedStatus() {
             return status;
         }
+
+        public String getConsumes() {
+            return consumes;
+        }
+
+        public String getProduces() {
+            return produces;
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/client/pom.xml
----------------------------------------------------------------------
diff --git a/client/pom.xml b/client/pom.xml
index b065833..b69c077 100755
--- a/client/pom.xml
+++ b/client/pom.xml
@@ -44,6 +44,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-multipart</artifactId>
+        </dependency>
+
+        <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index f01c341..67b1c96 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1867,6 +1867,7 @@
                     <version>2.7</version>
                     <configuration>
                         <encoding>UTF-8</encoding>
+                        <nonFilteredFileExtensions>zip</nonFilteredFileExtensions>
                     </configuration>
                 </plugin>
 

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java b/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
index 91d163c..ced0aa0 100644
--- a/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
+++ b/repository/src/test/java/org/apache/atlas/discovery/EntityDiscoveryServiceTest.java
@@ -19,16 +19,28 @@ package org.apache.atlas.discovery;
 
 import org.apache.atlas.TestModules;
 import org.apache.atlas.exception.AtlasBaseException;
+import org.apache.atlas.model.discovery.AtlasSearchResult;
+import org.apache.atlas.model.discovery.SearchParameters;
+import org.apache.atlas.model.impexp.AtlasImportRequest;
 import org.apache.atlas.model.typedef.AtlasEntityDef;
+import org.apache.atlas.repository.impexp.ImportService;
+import org.apache.atlas.repository.impexp.ZipSource;
+import org.apache.atlas.repository.store.graph.AtlasEntityStore;
+import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasTypeRegistry;
+import org.apache.atlas.utils.TestResourceFileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Guice;
 import org.testng.annotations.Test;
 
 import javax.inject.Inject;
+import java.io.IOException;
 
+import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.LOG;
+import static org.apache.atlas.repository.impexp.ZipFileResourceTestUtils.loadModelFromJson;
 import static org.testng.Assert.*;
+import static org.testng.Assert.fail;
 
 @Guice(modules = TestModules.TestOnlyModule.class)
 public class EntityDiscoveryServiceTest {
@@ -50,6 +62,12 @@ public class EntityDiscoveryServiceTest {
 
     @Inject
     EntityDiscoveryService discoveryService;
+    @Inject
+    AtlasTypeDefStore typeDefStore;
+    @Inject
+    AtlasEntityStore entityStore;
+    @Inject
+    ImportService importService;
 
 
     @BeforeClass
@@ -122,4 +140,5 @@ public class EntityDiscoveryServiceTest {
         assertNotNull(s);
         return s;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java b/repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java
index cc1d2b3..e9f0d20 100644
--- a/repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java
+++ b/repository/src/test/java/org/apache/atlas/repository/impexp/ZipFileResourceTestUtils.java
@@ -29,6 +29,7 @@ import org.apache.atlas.repository.store.bootstrap.AtlasTypeDefStoreInitializer;
 import org.apache.atlas.store.AtlasTypeDefStore;
 import org.apache.atlas.type.AtlasType;
 import org.apache.atlas.type.AtlasTypeRegistry;
+import org.apache.atlas.utils.TestResourceFileUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.common.StringUtils;
 import org.slf4j.Logger;
@@ -36,7 +37,6 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -44,30 +44,16 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import static org.testng.Assert.*;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
 
 public class ZipFileResourceTestUtils {
     public static final Logger LOG = LoggerFactory.getLogger(ZipFileResourceTestUtils.class);
 
     public static FileInputStream getFileInputStream(String fileName) {
-        String filePath = getFileFromResources(fileName);
-        File f = new File(filePath);
-        FileInputStream fs = null;
-        try {
-            fs = new FileInputStream(f);
-        } catch (FileNotFoundException e) {
-            LOG.error("File could not be found at: %s", filePath, e);
-        }
-        return fs;
-    }
-
-    private static String getFileFromResources(String fileName) {
-        final String userDir = System.getProperty("user.dir");
-        return getFilePath(userDir, fileName);
-    }
-
-    private static String getFilePath(String startPath, String fileName) {
-        return startPath + "/src/test/resources/" + fileName;
+        return TestResourceFileUtils.getFileInputStream(fileName);
     }
 
     public static String getModelJson(String fileName) throws IOException {
@@ -113,7 +99,7 @@ public class ZipFileResourceTestUtils {
     }
 
     public static String getModelJsonFromResources(String fileName) throws IOException {
-        String filePath = getFileFromResources(fileName);
+        String filePath = TestResourceFileUtils.getTestFilePath(fileName);
         File f = new File(filePath);
         String s = FileUtils.readFileToString(f);
         assertFalse(StringUtils.isEmpty(s), "Model file read correctly from resources!");

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/repository/src/test/java/org/apache/atlas/utils/TestResourceFileUtils.java
----------------------------------------------------------------------
diff --git a/repository/src/test/java/org/apache/atlas/utils/TestResourceFileUtils.java b/repository/src/test/java/org/apache/atlas/utils/TestResourceFileUtils.java
new file mode 100644
index 0000000..1a01e3a
--- /dev/null
+++ b/repository/src/test/java/org/apache/atlas/utils/TestResourceFileUtils.java
@@ -0,0 +1,90 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.utils;
+
+import org.apache.atlas.type.AtlasType;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+public class TestResourceFileUtils {
+    private static final Logger LOG = LoggerFactory.getLogger(TestResourceFileUtils.class);
+
+
+    public static String getTestFilePath(String fileName) {
+        final String userDir = System.getProperty("user.dir");
+        String filePath = getTestFilePath(userDir, "", fileName);
+        return filePath;
+    }
+
+    public static FileInputStream getFileInputStream(String fileName) {
+        return getFileInputStream("", fileName);
+    }
+
+    public static FileInputStream getFileInputStream(String subDir, String fileName) {
+        final String userDir = System.getProperty("user.dir");
+        String filePath = getTestFilePath(userDir, subDir, fileName);
+        File f = new File(filePath);
+        FileInputStream fs = null;
+        try {
+            fs = new FileInputStream(f);
+        } catch (FileNotFoundException e) {
+            LOG.error("File could not be found at: {}", filePath, e);
+        }
+        return fs;
+    }
+
+    public static <T> T readObjectFromJson(String subDir, String filename, Class<T> objectClass) throws IOException {
+        final String userDir = System.getProperty("user.dir");
+        String filePath = getTestJsonPath(userDir, subDir, filename);
+        String json = FileUtils.readFileToString(new File(filePath));
+        return AtlasType.fromJson(json, objectClass);
+    }
+
+    public static <T> T readObjectFromJson(String filename, Class<T> objectClass) throws IOException {
+        return readObjectFromJson("", filename, objectClass);
+    }
+
+    public static String getJson(String subDir, String filename) throws IOException {
+        final String userDir = System.getProperty("user.dir");
+        String filePath = getTestJsonPath(userDir, subDir, filename);
+        return FileUtils.readFileToString(new File(filePath));
+    }
+
+    public static String getJson(String filename) throws IOException {
+        return getJson("", filename);
+    }
+
+    private static String getTestFilePath(String startPath, String subDir, String fileName) {
+        if (StringUtils.isNotEmpty(subDir)) {
+            return startPath + "/src/test/resources/" + subDir + "/" + fileName;
+        } else {
+            return startPath + "/src/test/resources/" + fileName;
+        }
+    }
+
+    private static String getTestJsonPath(String startPath, String subDir, String fileName) {
+        return startPath + "/src/test/resources/json/" + subDir + "/" + fileName + ".json";
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/webapp/src/test/java/org/apache/atlas/web/integration/BasicSearchIT.java
----------------------------------------------------------------------
diff --git a/webapp/src/test/java/org/apache/atlas/web/integration/BasicSearchIT.java b/webapp/src/test/java/org/apache/atlas/web/integration/BasicSearchIT.java
new file mode 100644
index 0000000..5806a10
--- /dev/null
+++ b/webapp/src/test/java/org/apache/atlas/web/integration/BasicSearchIT.java
@@ -0,0 +1,176 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.atlas.web.integration;
+
+import com.google.common.collect.ImmutableSet;
+import org.apache.atlas.AtlasServiceException;
+import org.apache.atlas.model.discovery.AtlasSearchResult;
+import org.apache.atlas.model.discovery.SearchParameters;
+import org.apache.atlas.model.impexp.AtlasImportRequest;
+import org.apache.atlas.model.instance.AtlasClassification;
+import org.apache.atlas.model.instance.AtlasEntity;
+import org.apache.atlas.model.instance.EntityMutationResponse;
+import org.apache.atlas.model.typedef.AtlasClassificationDef;
+import org.apache.atlas.model.typedef.AtlasTypesDef;
+import org.apache.atlas.type.AtlasTypeUtil;
+import org.apache.atlas.utils.TestResourceFileUtils;
+import org.codehaus.jackson.annotate.JsonAutoDetect;
+import org.codehaus.jackson.annotate.JsonIgnoreProperties;
+import org.codehaus.jackson.map.annotate.JsonSerialize;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.fail;
+
+public class BasicSearchIT extends BaseResourceIT {
+
+    @BeforeClass
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+
+        String smallDatasetFileName = "hive-db-50-tables.zip";
+        atlasClientV2.importData(new AtlasImportRequest(), TestResourceFileUtils.getTestFilePath(smallDatasetFileName));
+
+        // Create a entity with name/qualified name having special characters
+
+        // Create a test tag
+        if (!atlasClientV2.typeWithNameExists("fooTag")) {
+            AtlasClassificationDef testClassificationDef = AtlasTypeUtil.createTraitTypeDef("fooTag", "Test tag", "1.0", ImmutableSet.<String>of());
+            AtlasTypesDef          typesDef              = new AtlasTypesDef();
+            typesDef.getClassificationDefs().add(testClassificationDef);
+            atlasClientV2.createAtlasTypeDefs(typesDef);
+        }
+
+        try {
+            atlasClientV2.getEntityByAttribute("hdfs_path", new HashMap<String, String>() {{
+                put("qualifiedName", URLEncoder.encode("test$1test+ - && || ! ( ) { } [ ] ^ < > ; : \" % * ` ~", "UTF-8"));
+            }});
+        } catch (AtlasServiceException e) {
+            AtlasEntity hdfsEntity = new AtlasEntity("hdfs_path");
+            hdfsEntity.setGuid("-1");
+            hdfsEntity.setAttribute("description", "1test+ - && || ! ( ) { } [ ] ^ < > ; : \" % * ` ~");
+            hdfsEntity.setAttribute("name", "1test+ - && || ! ( ) { } [ ] ^ < > ; : \" % * ` ~");
+            hdfsEntity.setAttribute("owner", "test");
+            hdfsEntity.setAttribute("qualifiedName", "test$1test+ - && || ! ( ) { } [ ] ^ < > ; : \" % * ` ~");
+            hdfsEntity.setAttribute("path", "/test/foo");
+
+            hdfsEntity.setClassifications(new ArrayList<AtlasClassification>());
+            hdfsEntity.getClassifications().add(new AtlasClassification("fooTag"));
+
+            EntityMutationResponse entityMutationResponse = atlasClientV2.createEntity(new AtlasEntity.AtlasEntityWithExtInfo(hdfsEntity));
+            if (entityMutationResponse.getCreatedEntities() != null) {
+                assertEquals(entityMutationResponse.getCreatedEntities().size(), 1);
+            } else if (entityMutationResponse.getUpdatedEntities() != null) {
+                assertEquals(entityMutationResponse.getUpdatedEntities().size(), 1);
+            } else {
+                fail("Entity should've been created or updated");
+            }
+        }
+
+        // Add a 5s mandatory sleep for allowing index to catch up
+        try {
+            Thread.sleep(5000);
+        } catch (InterruptedException e) {
+            LOG.error("Sleep was interrupted. The search results might be inconsistent.");
+        }
+    }
+
+    @DataProvider
+    public Object[][] basicSearchJSONNames() {
+        return new String[][]{
+                {"search-parameters/entity-filters"},
+                {"search-parameters/tag-filters"},
+                {"search-parameters/combination-filters"}
+        };
+    }
+
+    @Test(dataProvider = "basicSearchJSONNames")
+    public void testDiscoveryWithSearchParameters(String jsonFile) {
+        try {
+            BasicSearchParametersWithExpectation[] testExpectations =
+                    TestResourceFileUtils.readObjectFromJson(jsonFile, BasicSearchParametersWithExpectation[].class);
+            assertNotNull(testExpectations);
+
+            for (BasicSearchParametersWithExpectation testExpectation : testExpectations) {
+                LOG.info("TestDescription  :{}", testExpectation.testDescription);
+                LOG.info("SearchParameters :{}", testExpectation.searchParameters);
+
+                AtlasSearchResult searchResult = atlasClientV2.facetedSearch(testExpectation.searchParameters);
+                if (testExpectation.expectedCount > 0) {
+                    assertNotNull(searchResult.getEntities());
+                    assertEquals(searchResult.getEntities().size(), testExpectation.expectedCount);
+                }
+            }
+        } catch (IOException | AtlasServiceException e) {
+            fail(e.getMessage());
+        }
+    }
+
+    @JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
+    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+    @JsonIgnoreProperties(ignoreUnknown = true)
+    private static class BasicSearchParametersWithExpectation {
+        private String           testDescription;
+        private SearchParameters searchParameters;
+        private int              expectedCount;
+
+        public BasicSearchParametersWithExpectation() {
+        }
+
+        public BasicSearchParametersWithExpectation(final String testDescription, final SearchParameters searchParameters, final int expectedCount) {
+            this.testDescription = testDescription;
+            this.searchParameters = searchParameters;
+            this.expectedCount = expectedCount;
+        }
+
+        public SearchParameters getSearchParameters() {
+            return searchParameters;
+        }
+
+        public void setSearchParameters(final SearchParameters searchParameters) {
+            this.searchParameters = searchParameters;
+        }
+
+        public int getExpectedCount() {
+            return expectedCount;
+        }
+
+        public void setExpectedCount(final int expectedCount) {
+            this.expectedCount = expectedCount;
+        }
+
+        public String getTestDescription() {
+            return testDescription;
+        }
+
+        public void setTestDescription(final String testDescription) {
+            this.testDescription = testDescription;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/webapp/src/test/resources/DefaultDB-3-New.zip
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/DefaultDB-3-New.zip b/webapp/src/test/resources/DefaultDB-3-New.zip
new file mode 100644
index 0000000..f6c7d41
Binary files /dev/null and b/webapp/src/test/resources/DefaultDB-3-New.zip differ

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/webapp/src/test/resources/hive-db-50-tables.zip
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/hive-db-50-tables.zip b/webapp/src/test/resources/hive-db-50-tables.zip
new file mode 100644
index 0000000..fe29f57
Binary files /dev/null and b/webapp/src/test/resources/hive-db-50-tables.zip differ

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/webapp/src/test/resources/json/search-parameters/combination-filters.json
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/json/search-parameters/combination-filters.json b/webapp/src/test/resources/json/search-parameters/combination-filters.json
new file mode 100644
index 0000000..ea8fbda
--- /dev/null
+++ b/webapp/src/test/resources/json/search-parameters/combination-filters.json
@@ -0,0 +1,185 @@
+[
+  {
+    "testDescription": "hdfs_path tagged with fooTag",
+    "searchParameters": {
+      "typeName": "hdfs_path",
+      "excludeDeletedEntities": true,
+      "classification" : "fooTag",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": null,
+      "tagFilters": null,
+      "attributes": [""]
+    },
+    "expectedCount": 1
+  },
+  {
+    "testDescription": "hive_table tagged with fooTag",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification" : "fooTag",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": null,
+      "tagFilters": null,
+      "attributes": [""]
+    },
+    "expectedCount": 0
+  },
+  {
+    "testDescription": "Check entity attributes containing special characters",
+    "searchParameters": {
+      "typeName": "hdfs_path",
+      "excludeDeletedEntities": true,
+      "classification" : "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "condition" : "OR",
+        "criterion" : [
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "!"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "["
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "{"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "#"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "$"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "|"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "&"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "`"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "\""
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "^"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "%"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "~"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "*"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": ":"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": ","
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "< >"
+          },
+          {
+            "attributeName": "name",
+            "operator": "contains",
+            "attributeValue": "( )"
+          }
+        ]
+      },
+      "tagFilters": null,
+      "attributes": [""]
+    },
+    "expectedCount": 1
+  },
+  {
+    "testDescription": "Search using fulltext, entity type and tag",
+    "searchParameters": {
+      "typeName": "hdfs_path",
+      "excludeDeletedEntities": true,
+      "classification" : "fooTag",
+      "query": "test ; \\{ \\} \\[ \\]",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": null,
+      "tagFilters": null,
+      "attributes": [""]
+    },
+    "expectedCount": 1
+  },
+  {
+    "testDescription": "hive_column with fulltext query",
+    "searchParameters": {
+      "typeName": "hive_column",
+      "excludeDeletedEntities": true,
+      "classification" : "",
+      "query": "*col104*",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": null,
+      "tagFilters": null,
+      "attributes": [""]
+    },
+    "expectedCount": 3
+  },
+  {
+    "testDescription": "hdfs_path tagged with fooTag",
+    "searchParameters": {
+      "typeName": "hdfs_path",
+      "excludeDeletedEntities": true,
+      "classification" : "fooTag",
+      "query": "test ; \\{ \\} \\[ \\]",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "qualifiedName",
+        "operator": "contains",
+        "attributeValue" : "+"
+      },
+      "tagFilters": null,
+      "attributes": [""]
+    },
+    "expectedCount": 1
+  }
+]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/webapp/src/test/resources/json/search-parameters/entity-filters.json
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/json/search-parameters/entity-filters.json b/webapp/src/test/resources/json/search-parameters/entity-filters.json
new file mode 100644
index 0000000..0611644
--- /dev/null
+++ b/webapp/src/test/resources/json/search-parameters/entity-filters.json
@@ -0,0 +1,242 @@
+[
+  {
+    "testDescription": "Asset.name contains testtable",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "contains",
+        "attributeValue": "testtable"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  },
+  {
+    "testDescription": "hive_column.name contains 30",
+    "searchParameters": {
+      "typeName": "hive_column",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 25,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "contains",
+        "attributeValue": "30"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 2
+  },
+  {
+    
+    "testDescription": "hive_table matches name testtable_0",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "eq",
+        "attributeValue": "testtable_0"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 1
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 50,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "neq",
+        "attributeValue": "dummy /Table_1@0"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "temporary",
+        "operator": "eq",
+        "attributeValue": "false"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 50,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "temporary",
+        "operator": "neq",
+        "attributeValue": "true"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "startsWith",
+        "attributeValue": "test"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "endsWith",
+        "attributeValue": "0"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 1
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_column",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "name",
+        "operator": "endsWith",
+        "attributeValue": "8"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 18
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "createTime",
+        "operator": "lte",
+        "attributeValue": "1491250084794"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  },
+  {
+    
+    "testDescription": "",
+    "searchParameters": {
+      "typeName": "hive_table",
+      "excludeDeletedEntities": true,
+      "classification": "",
+      "query": "",
+      "limit": 25,
+      "offset": 0,
+      "entityFilters": {
+        "attributeName": "lastAccessTime",
+        "operator": "gte",
+        "attributeValue": "1491248907000"
+      },
+      "tagFilters": null,
+      "attributes": [
+        ""
+      ]
+    },
+    "expectedCount": 3
+  }
+]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/atlas/blob/f4d34642/webapp/src/test/resources/json/search-parameters/tag-filters.json
----------------------------------------------------------------------
diff --git a/webapp/src/test/resources/json/search-parameters/tag-filters.json b/webapp/src/test/resources/json/search-parameters/tag-filters.json
new file mode 100644
index 0000000..5e74328
--- /dev/null
+++ b/webapp/src/test/resources/json/search-parameters/tag-filters.json
@@ -0,0 +1,16 @@
+[
+  {
+    "testDescription": "Search for exact Tag name",
+    "searchParameters": {
+      "entityFilters":null,
+      "tagFilters":null,
+      "attributes":null,
+      "query":null,
+      "excludeDeletedEntities":true,
+      "limit":25,
+      "typeName":null,
+      "classification":"fooTag"
+    },
+    "expectedCount": 1
+  }
+]
\ No newline at end of file