/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.solr.core;

import org.apache.solr.handler.StandardRequestHandler;
import org.apache.solr.request.SolrRequestHandler;
import org.apache.solr.util.AbstractSolrTestCase;

public class RequestHandlersTest extends AbstractSolrTestCase {

  public String getSchemaFile() { return "schema.xml"; }
  public String getSolrConfigFile() { return "solrconfig.xml"; }

  
  public void testLazyLoading() {
    SolrCore core = h.getCore();
    SolrRequestHandler handler = core.getRequestHandler( "lazy" );
    assertFalse( handler instanceof StandardRequestHandler ); 
    
    // But it should behave just like the 'defaults' request handler above
    assertU(adoc("id", "42",
                 "name", "Zapp Brannigan"));
    assertU(adoc("id", "43",
                 "title", "Democratic Order of Planets"));
    assertU(adoc("id", "44",
                 "name", "The Zapper"));
    assertU(adoc("id", "45",
                 "title", "25 star General"));
    assertU(adoc("id", "46",
                 "subject", "Defeated the pacifists of the Gandhi nebula"));
    assertU(adoc("id", "47",
                 "text", "line up and fly directly at the enemy death cannons, clogging them with wreckage!"));
    assertU(commit());

    assertQ("lazy request handler returns all matches",
            req("id:[42 TO 47]"),
            "*[count(//doc)=6]"
            );

    assertQ("lazy handler returns fewer matches",
            req("q", "id:[42 TO 47]",   "qt","defaults"),
            "*[count(//doc)=4]"
            );

    assertQ("lazy handler includes highlighting",
            req("q", "name:Zapp OR title:General",   "qt","defaults"),
            "//lst[@name='highlighting']"
            );
  }
  
  public void testPathNormalization()
  {
    SolrCore core = h.getCore();
    SolrRequestHandler h1 = core.getRequestHandler("/update/csv" );
    assertNotNull( h1 );

    SolrRequestHandler h2 = core.getRequestHandler("/update/csv/" );
    assertNotNull( h2 );
    
    assertEquals( h1, h2 ); // the same object
    
    assertNull( core.getRequestHandler("/update/csv/asdgadsgas" ) ); // prefix
  }
}

@@ -828,16 +828,55 @@
 .core;%0A%0A
+import org.apache.solr.SolrTestCaseJ4;%0A
 import o
@@ -988,45 +988,48 @@
 org.
-apache.solr.util.AbstractSolrTestCase
+junit.BeforeClass;%0Aimport org.junit.Test
 ;%0A%0Ap
@@ -1072,16 +1072,8 @@
 nds 
-Abstract
 Solr
@@ -1084,137 +1084,140 @@
 Case
+J4
  %7B%0A
-%0A  public String getSchemaFile() %7B return %22schema.xml%22; %7D%0A  public String getSolrConfigFile() %7B return %22solrconfig.xml%22;
+  @BeforeClass%0A  public static void beforeClass() throws Exception %7B%0A    initCore(%22solrconfig.xml%22, %22schema.xml%22);%0A 
  %7D%0A%0A  
+@Test
 %0A  p
@@ -1419,83 +1419,8 @@
    %0A
-    // But it should behave just like the 'defaults' request handler above%0A
     
@@ -2067,16 +2067,20 @@
    req(%22
+q%22,%22
 id:%5B42 T
@@ -2119,16 +2119,19 @@
 doc)=6%5D%22
+);%0A
 %0A       
@@ -2123,39 +2123,102 @@
 =6%5D%22);%0A%0A        
-    );%0A
+// But it should behave just like the 'defaults' request handler above
 %0A    assertQ(%22la
@@ -2289,33 +2289,27 @@
 TO 47%5D%22,
-  
  %22qt%22,%22
-defaults
+lazy
 %22),%0A    
@@ -2456,25 +2456,19 @@
 al%22,
-  
  %22qt%22,%22
-defaults
+lazy
 %22),%0A
@@ -2528,18 +2528,24 @@
  );%0A  %7D%0A
+%0A
   
+@Test
 %0A  publi

lazy handler test didn't acutally test lazy handler, convert to junit4