/*
 * 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.sling.launchpad.webapp.integrationtest.servlets.resolution;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.httpclient.NameValuePair;

/** Test for SLING-1069 */
public class HtmlDefaultServletTest extends ResolutionTestBase {

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        // enable the HtmlDefaultServlet before testing
        changeComponent(
            "org.apache.sling.launchpad.testservices.servlets.HtmlDefaultServlet",
            "enable");
    }

    @Override
    protected void tearDown() throws Exception {
        // disable the HtmlDefaultServlet before testing
        changeComponent(
            "org.apache.sling.launchpad.testservices.servlets.HtmlDefaultServlet",
            "disable");
        super.tearDown();
    }

    public void testHtmlExtension() throws IOException {
        assertServlet(
            getContent(testNodeNORT.nodeUrl + ".html", CONTENT_TYPE_PLAIN),
            HTML_DEFAULT_SERVLET_SUFFIX);
    }

    public void testJsonExtension() throws IOException {
        assertNotTestServlet(getContent(testNodeNORT.nodeUrl + ".json",
            CONTENT_TYPE_DONTCARE));
    }

    protected void changeComponent(final String component, final String action)
            throws IOException {
        List<NameValuePair> pars = new ArrayList<NameValuePair>();
        pars.add(new NameValuePair("action", action));
        assertPostStatus(HTTP_BASE_URL + "/system/console/components/"
            + component, HttpServletResponse.SC_OK, pars, null);
    }
}

@@ -1524,38 +1524,37 @@
 lDefaultServlet 
-before
+after
  testing%0A       
@@ -1646,32 +1646,32 @@
 efaultServlet%22,%0A
-
             %22dis
@@ -1674,24 +1674,384 @@
 %22disable%22);%0A
+        // we need to wait a little bit as starting with version 1.1.12 of%0A        // org.apache.sling.resourceresolver, unregistering a resource provider%0A        // forces an async reregistration of the resource resolver factory%0A        try %7B%0A            Thread.sleep(3000);%0A        %7D catch ( final InterruptedException ie ) %7B%0A            // ignore%0A        %7D%0A
         supe

Fix tests when a resource provider is unregistered