public QueryClient installServlet()

in src/main/java/org/apache/sling/testing/clients/query/QueryClient.java [191:214]


    public QueryClient installServlet() throws ClientException, InterruptedException {
        InputStream bundleStream = TinyBundles.bundle()
                .set("Bundle-SymbolicName", BUNDLE_BSN)
                .set("Bundle-Version", BUNDLE_VERSION)
                .set("Bundle-Name", BUNDLE_NAME)
                .add(QueryServlet.class)
                .build(TinyBundles.withBnd());

        try {
            File bundleFile = File.createTempFile(BUNDLE_BSN + "-" + BUNDLE_VERSION, ".jar");
            Files.copy(bundleStream, bundleFile.toPath(), REPLACE_EXISTING);

            adaptTo(OsgiConsoleClient.class).installBundle(bundleFile, true);
            adaptTo(OsgiConsoleClient.class).waitBundleStarted(BUNDLE_BSN, BUNDLE_START_TIMEOUT, 100);

            LOG.info("query servlet installed at {}", getUrl(QueryServlet.SERVLET_PATH));
        } catch (IOException e) {
            throw new TestingIOException("Failed to create the query servlet bundle", e);
        } catch (TimeoutException e) {
            throw new TestingValidationException("The query servlet bundle did not successfully start", e);
        }

        return this;
    }