QueryFactory { public AtlasQuery createTermQuery(Request request) throws InvalidQueryException { ResourceDefinition termDefinition = new TermResourceDefinition(); QueryExpression queryExpression = create(request, termDefinition); TermPath termPath = request.getProperty("termPath"); return new AtlasTermQuery(queryExpression, termDefinition, termPath, request); } QueryFactory(); AtlasQuery createTaxonomyQuery(Request request); AtlasQuery createTermQuery(Request request); AtlasQuery createEntityQuery(Request request); AtlasQuery createEntityTagQuery(Request request); static final String PATH_SEP_TOKEN; }
@Test public void testCreateTermQuery() throws Exception { Map<String, Object> requestProps = new HashMap<>(); requestProps.put("name", "test_taxonomy.term1"); requestProps.put("termPath", new TermPath("test_taxonomy.term1")); Request request = new InstanceRequest(requestProps); QueryFactory factory = new QueryFactory(); AtlasTermQuery query = (AtlasTermQuery) factory.createTermQuery(request); QueryExpression queryExpression = query.getQueryExpression(); assertEquals(queryExpression.getClass(), TermQueryExpression.class); assertEquals(queryExpression.getField(), "name"); assertEquals(queryExpression.getExpectedValue(), "test_taxonomy.term1"); assertEquals(query.getRequest(), request); assertEquals(query.getResourceDefinition().getTypeName(), "Term"); }