QueryFactory { public AtlasQuery createEntityQuery(Request request) throws InvalidQueryException { ResourceDefinition entityDefinition = new EntityResourceDefinition(); QueryExpression queryExpression = create(request, entityDefinition); return new AtlasEntityQuery(queryExpression, entityDefinition, 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 testCreateEntityQuery() throws Exception { Map<String, Object> requestProps = new HashMap<>(); requestProps.put("id", "foo"); Request request = new InstanceRequest(requestProps); QueryFactory factory = new QueryFactory(); AtlasEntityQuery query = (AtlasEntityQuery) factory.createEntityQuery(request); QueryExpression queryExpression = query.getQueryExpression(); assertEquals(queryExpression.getClass(), TermQueryExpression.class); assertEquals(queryExpression.getField(), "id"); assertEquals(queryExpression.getExpectedValue(), "foo"); assertEquals(query.getRequest(), request); assertEquals(query.getResourceDefinition().getClass(), EntityResourceDefinition.class); }