@Test @TestTarget(ServerVersion.AGM) public void testQueryForStream() throws IOException { handler.addRequest(false, "GET", "/qcbin/rest/domains/domain/projects/project/defects?fields=&query={status[Fixed]}&order-by={}", 200) .responseBody("simply content"); EntityQuery query = new EntityQuery("defect"); query.setValue("status", "Fixed"); query.setPropertyResolved("status", true); String content = IOUtils.toString(entityService.queryForStream(query)); Assert.assertEquals("simply content", content); }
public InputStream queryForStream(EntityQuery query) { EntityRef parent = query.getParent(); if(parent == null) { return restService.getForStream("{0}s?{1}", query.getEntityType(), queryToString(query)); } else { return restService.getForStream("{0}s/{1}/{2}s?{3}", parent.type, parent.id, query.getEntityType(), queryToString(query)); } }
EntityService { public InputStream queryForStream(EntityQuery query) { EntityRef parent = query.getParent(); if(parent == null) { return restService.getForStream("{0}s?{1}", query.getEntityType(), queryToString(query)); } else { return restService.getForStream("{0}s/{1}/{2}s?{3}", parent.type, parent.id, query.getEntityType(), queryToString(query)); } } }
EntityService { public InputStream queryForStream(EntityQuery query) { EntityRef parent = query.getParent(); if(parent == null) { return restService.getForStream("{0}s?{1}", query.getEntityType(), queryToString(query)); } else { return restService.getForStream("{0}s/{1}/{2}s?{3}", parent.type, parent.id, query.getEntityType(), queryToString(query)); } } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); }
EntityService { public InputStream queryForStream(EntityQuery query) { EntityRef parent = query.getParent(); if(parent == null) { return restService.getForStream("{0}s?{1}", query.getEntityType(), queryToString(query)); } else { return restService.getForStream("{0}s/{1}/{2}s?{3}", parent.type, parent.id, query.getEntityType(), queryToString(query)); } } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); void addEntityListener(EntityListener listener); void removeEntityListener(EntityListener listener); void refreshEntity(EntityRef ref); void getEntityAsync(EntityRef ref, EntityListener callback); Entity getEntity(EntityRef ref); EntityList query(EntityQuery query); InputStream queryForStream(EntityQuery query); Entity getDefectLink(int defectId, int linkId); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure, boolean fireUpdate); Entity createEntity(Entity entity, boolean silent); Entity lockEntity(Entity entity, boolean silent); boolean deleteEntity(Entity entity); void unlockEntity(Entity entity); void fireEntityLoaded(final Entity entity, final EntityListener.Event event); void fireEntityNotFound(final EntityRef ref, final boolean removed); void requestCachedEntity(final EntityRef ref, final List<String> properties, final EntityListener callback); }
EntityService { public InputStream queryForStream(EntityQuery query) { EntityRef parent = query.getParent(); if(parent == null) { return restService.getForStream("{0}s?{1}", query.getEntityType(), queryToString(query)); } else { return restService.getForStream("{0}s/{1}/{2}s?{3}", parent.type, parent.id, query.getEntityType(), queryToString(query)); } } EntityService(Project project, RestService restService, MetadataService metadataService, ErrorService errorService); void addEntityListener(EntityListener listener); void removeEntityListener(EntityListener listener); void refreshEntity(EntityRef ref); void getEntityAsync(EntityRef ref, EntityListener callback); Entity getEntity(EntityRef ref); EntityList query(EntityQuery query); InputStream queryForStream(EntityQuery query); Entity getDefectLink(int defectId, int linkId); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure); Entity updateEntity(Entity entity, Set<String> fieldsToUpdate, boolean silent, boolean reloadOnFailure, boolean fireUpdate); Entity createEntity(Entity entity, boolean silent); Entity lockEntity(Entity entity, boolean silent); boolean deleteEntity(Entity entity); void unlockEntity(Entity entity); void fireEntityLoaded(final Entity entity, final EntityListener.Event event); void fireEntityNotFound(final EntityRef ref, final boolean removed); void requestCachedEntity(final EntityRef ref, final List<String> properties, final EntityListener callback);  }