munendrasn commented on a change in pull request #1665: URL: https://github.com/apache/lucene-solr/pull/1665#discussion_r453169160
########## File path: solr/core/src/test/org/apache/solr/response/TestPushWriter.java ########## @@ -45,26 +46,47 @@ public void testStandardResponse() throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); - OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets.UTF_8); - PushWriter pw = new JSONWriter(osw, - new LocalSolrQueryRequest(null, new ModifiableSolrParams()), new SolrQueryResponse()); - writeData(pw); - osw.flush(); - if (log.isInfoEnabled()) { - log.info("{}", new String(baos.toByteArray(), StandardCharsets.UTF_8)); + Map m; + try (OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets.UTF_8)) { + JSONWriter pw = new JSONWriter(osw, + new LocalSolrQueryRequest(null, new ModifiableSolrParams()), new SolrQueryResponse()); + writeData(null, pw); + osw.flush(); + if (log.isInfoEnabled()) { + log.info("{}", new String(baos.toByteArray(), StandardCharsets.UTF_8)); + } + m = (Map) Utils.fromJSON(baos.toByteArray()); + checkValues(m); } - @SuppressWarnings({"rawtypes"}) - Map m = (Map) Utils.fromJSON(baos.toByteArray()); - checkValues(m); + try (JavaBinCodec jbc = new JavaBinCodec(baos= new ByteArrayOutputStream(), null)) { writeData(jbc); - try (JavaBinCodec jbcUn = new JavaBinCodec()) { - m = (Map) jbcUn.unmarshal(new ByteArrayInputStream(baos.toByteArray())); - } + m = (Map) Utils.fromJavabin(baos.toByteArray()); } checkValues(m); } + public void testXmlWriter() throws Exception { + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); + OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets.UTF_8)) { + XMLWriter xml = new XMLWriter(osw, + new LocalSolrQueryRequest(null, new ModifiableSolrParams()), new SolrQueryResponse()); Review comment: XmlWriter takes SolrQueryRequest as one of the arg. so, I have created localSolrQueryRequest ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org