QueryFactory { public AtlasQuery createEntityTagQuery(Request request) throws InvalidQueryException { ResourceDefinition entityTagDefinition = new EntityTagResourceDefinition(); QueryExpression queryExpression = create(request, entityTagDefinition); String guid = request.getProperty("id"); return new AtlasEntityTagQuery(queryExpression, entityTagDefinition, guid, 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 testCreateEntityTagQuery() throws Exception { Map<String, Object> requestProps = new HashMap<>(); requestProps.put("id", "entity_id"); requestProps.put("name", "test_taxonomy.term1"); Request request = new InstanceRequest(requestProps); QueryFactory factory = new QueryFactory(); AtlasEntityTagQuery query = (AtlasEntityTagQuery) factory.createEntityTagQuery(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().getClass(), EntityTagResourceDefinition.class); }