Search in sources :

Example 1 with QuickSearchParameters

use of org.apache.atlas.model.discovery.QuickSearchParameters in project atlas by apache.

the class AtlasDiscoveryServiceTest method specialCharQuickSearchAssertQFName.

@Test(dataProvider = "specialCharSearchQFName")
public void specialCharQuickSearchAssertQFName(String attrName, SearchParameters.Operator operator, String attrValue, int expected) throws AtlasBaseException {
    QuickSearchParameters params = new QuickSearchParameters();
    params.setTypeName(HIVE_TABLE_TYPE);
    SearchParameters.FilterCriteria filterCriteria = getSingleFilterCondition(attrName, operator, attrValue);
    params.setEntityFilters(filterCriteria);
    params.setLimit(20);
    AtlasQuickSearchResult searchResult = discoveryService.quickSearch(params);
    assertSearchResult(searchResult.getSearchResults(), expected, attrValue);
    if (expected > 0) {
        assertAggregationMetrics(searchResult);
    }
}
Also used : SearchParameters(org.apache.atlas.model.discovery.SearchParameters) QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters) QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters) AtlasQuickSearchResult(org.apache.atlas.model.discovery.AtlasQuickSearchResult)

Example 2 with QuickSearchParameters

use of org.apache.atlas.model.discovery.QuickSearchParameters in project atlas by apache.

the class AtlasDiscoveryServiceTest method specialCharQuickSearch.

@Test(dataProvider = "specialCharQuickSearch")
public void specialCharQuickSearch(String searchValue, int expected) throws AtlasBaseException {
    QuickSearchParameters params = new QuickSearchParameters();
    params.setQuery(searchValue);
    params.setLimit(5);
    params.setOffset(0);
    AtlasQuickSearchResult searchResult = discoveryService.quickSearch(params);
    assertSearchResult(searchResult.getSearchResults(), expected, searchValue);
    if (expected > 0) {
        assertAggregationMetrics(searchResult);
    }
}
Also used : QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters) AtlasQuickSearchResult(org.apache.atlas.model.discovery.AtlasQuickSearchResult)

Example 3 with QuickSearchParameters

use of org.apache.atlas.model.discovery.QuickSearchParameters in project atlas by apache.

the class AtlasDiscoveryServiceTest method specialCharQuickSearchAssertName.

@Test(dataProvider = "specialCharSearchName")
public void specialCharQuickSearchAssertName(String attrName, SearchParameters.Operator operator, String attrValue, int expected) throws AtlasBaseException {
    QuickSearchParameters params = new QuickSearchParameters();
    params.setTypeName(HIVE_TABLE_TYPE);
    SearchParameters.FilterCriteria filterCriteria = getSingleFilterCondition(attrName, operator, attrValue);
    params.setEntityFilters(filterCriteria);
    params.setLimit(20);
    AtlasQuickSearchResult searchResult = discoveryService.quickSearch(params);
    assertSearchResult(searchResult.getSearchResults(), expected, attrValue);
    if (expected > 0) {
        assertAggregationMetrics(searchResult);
    }
}
Also used : SearchParameters(org.apache.atlas.model.discovery.SearchParameters) QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters) QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters) AtlasQuickSearchResult(org.apache.atlas.model.discovery.AtlasQuickSearchResult)

Example 4 with QuickSearchParameters

use of org.apache.atlas.model.discovery.QuickSearchParameters in project atlas by apache.

the class EntityDiscoveryService method createSearchParameters.

public static SearchParameters createSearchParameters(QuickSearchParameters quickSearchParameters) {
    SearchParameters searchParameters = new SearchParameters();
    searchParameters.setQuery(quickSearchParameters.getQuery());
    searchParameters.setTypeName(quickSearchParameters.getTypeName());
    searchParameters.setExcludeDeletedEntities(quickSearchParameters.getExcludeDeletedEntities());
    searchParameters.setIncludeSubTypes(quickSearchParameters.getIncludeSubTypes());
    searchParameters.setLimit(quickSearchParameters.getLimit());
    searchParameters.setOffset(quickSearchParameters.getOffset());
    searchParameters.setEntityFilters(quickSearchParameters.getEntityFilters());
    searchParameters.setAttributes(quickSearchParameters.getAttributes());
    searchParameters.setSortBy(quickSearchParameters.getSortBy());
    searchParameters.setSortOrder(quickSearchParameters.getSortOrder());
    return searchParameters;
}
Also used : SearchParameters(org.apache.atlas.model.discovery.SearchParameters) QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters)

Example 5 with QuickSearchParameters

use of org.apache.atlas.model.discovery.QuickSearchParameters in project atlas by apache.

the class BasicSearchIT method testPostQuickSearch.

@Test
public void testPostQuickSearch() {
    try {
        QuickSearchParameters quickSearchParameters = new QuickSearchParameters();
        quickSearchParameters.setQuery("test");
        quickSearchParameters.setTypeName("hdfs_path");
        AtlasQuickSearchResult result = atlasClientV2.quickSearch(quickSearchParameters);
        List<AtlasEntityHeader> list = result.getSearchResults().getEntities();
        assertEquals(list.size(), 1);
    } catch (AtlasServiceException e) {
        fail(e.getMessage());
    }
}
Also used : QuickSearchParameters(org.apache.atlas.model.discovery.QuickSearchParameters) AtlasQuickSearchResult(org.apache.atlas.model.discovery.AtlasQuickSearchResult) AtlasServiceException(org.apache.atlas.AtlasServiceException) AtlasEntityHeader(org.apache.atlas.model.instance.AtlasEntityHeader) Test(org.testng.annotations.Test)

Aggregations

QuickSearchParameters (org.apache.atlas.model.discovery.QuickSearchParameters)8 AtlasQuickSearchResult (org.apache.atlas.model.discovery.AtlasQuickSearchResult)7 SearchParameters (org.apache.atlas.model.discovery.SearchParameters)4 AtlasEntityHeader (org.apache.atlas.model.instance.AtlasEntityHeader)3 AtlasServiceException (org.apache.atlas.AtlasServiceException)1 Test (org.testng.annotations.Test)1