And to add a little to this, since it looked ugly below, the $response.response.response.numFound thing is something I'm going to improve to make it leaner and cleaner to get at the actual result set and other response structures. $response is the actual SolrQueryResponse, and navigating that down to numFound through NamedLists and so on is pretty ridiculous looking.
Erik On Jan 9, 2013, at 19:54 , Erik Hatcher wrote: > Marcos - > > I just happen to be tinkering with VrW over the last few days (to get some > big improvements across the board with it and the /browse UI into Solr 5.0, > and maybe eventually 4.x too), so I whipped up such a test case just now. > > Here's the short and sweet version: > > public void testVelocityResponseWriterRegistered() { > QueryResponseWriter writer = > h.getCore().getQueryResponseWriter("velocity"); > assertTrue("VrW registered check", writer instanceof > VelocityResponseWriter); > } > > This required that I put in the test solrconfig.xml <queryResponseWriter > name="velocity" class="solr.VelocityResponseWriter"/> (which was not there > before, as it wasn't needed for the direct VrW test that already was there). > > I added another test too, to check a template from the conf/velocity > directory being rendered like this: > > public void testSolrResourceLoaderTemplate() throws Exception { > assertEquals("0", h.query(req("q","*:*", > "wt","velocity","v.template","test"))); > } > > And I added a conf/velocity/test.vm file with just this in it: > $response.response.response.numFound > > So there ya go... I'll commit these in hopefully the near future along with > the other related stuff. > > I'm curious - what are you using VrW for? > > Erik > > > On Jan 9, 2013, at 17:43 , Marcos Mendez wrote: > >> Hi, >> >> I'm trying to write some tests based on SolrTestCaseJ4 that test using >> velocity in SOLR. I found VelocityResponseWriterTest.java, but this does not >> test that. In fact it has a todo to do what I want to do. >> >> Anyone have an example out there? >> >> I just need to check if velocity is loaded with my configuration. Any help >> is appreciated. >