aldettinger commented on a change in pull request #2190: URL: https://github.com/apache/camel-quarkus/pull/2190#discussion_r568725500
########## File path: integration-tests/oaipmh/src/test/java/org/apache/camel/quarkus/component/oaipmh/it/OaipmhTestServer.java ########## @@ -0,0 +1,149 @@ +/* + * 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.camel.quarkus.component.oaipmh.it; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.io.IOUtils; +import org.eclipse.jetty.server.Connector; +import org.eclipse.jetty.server.HttpConfiguration; +import org.eclipse.jetty.server.HttpConnectionFactory; +import org.eclipse.jetty.server.SecureRequestCustomizer; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; +import org.eclipse.jetty.server.SslConnectionFactory; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public final class OaipmhTestServer { + + private static final Logger LOG = LoggerFactory.getLogger(OaipmhTestServer.class); + private static final String PASSWORD = "changeit"; + private static Map<String, String> RESPONSE_CACHE; + + private String context; + private boolean useHttps; + private int port; + private Server server; + + public OaipmhTestServer(String context, int port) { + this(context, port, false); + } + + public OaipmhTestServer(String context, int port, boolean useHttps) { + this.context = context; + this.useHttps = useHttps; + this.port = port; + } + + private static synchronized Map<String, String> getResponseCache() throws IOException { + if (RESPONSE_CACHE == null) { + HashMap<String, String> responseCache = new HashMap<String, String>(); + + ZipInputStream zis = new ZipInputStream(OaipmhTestServer.class.getResourceAsStream("/data.zip")); + + ZipEntry entry = zis.getNextEntry(); + while (entry != null) { + if (!entry.isDirectory()) { + responseCache.put(entry.getName(), IOUtils.toString(zis, StandardCharsets.UTF_8)); + } + entry = zis.getNextEntry(); + } + RESPONSE_CACHE = Collections.unmodifiableMap(responseCache); + } + return RESPONSE_CACHE; + } + + public void startServer() { + server = new Server(port); Review comment: Indeed, let's have a look at this in https://github.com/apache/camel-quarkus/issues/2192 to check if I can achieved to find a solution that is clear and could be applied to main Camel too. To be clear, the idea you mentioned would be to implement a test resource launching a route that consume from camel-http ? ---------------------------------------------------------------- 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