This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 32d781062785bd377576b549473e15376752b7bf Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Sun Feb 14 16:17:21 2021 +0100 camel-vertx-http - Optimize a bit --- .../vertx/http/VertxHttpProducerLoadTest.java | 97 ++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/components/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpProducerLoadTest.java b/components/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpProducerLoadTest.java new file mode 100644 index 0000000..670e076 --- /dev/null +++ b/components/camel-vertx-http/src/test/java/org/apache/camel/component/vertx/http/VertxHttpProducerLoadTest.java @@ -0,0 +1,97 @@ +/* + * 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.component.vertx.http; + +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.util.StopWatch; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Disabled("Manual test") +public class VertxHttpProducerLoadTest extends VertxHttpTestSupport { + + private static final Logger LOG = LoggerFactory.getLogger(VertxHttpProducerLoadTest.class); + + @Override + protected RoutesBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:echo") + .to(getProducerUri()); + + from(getTestServerUri()) + .setBody(constant("Hello World")); + + } + }; + } + + @Test + public void testProducerLoad() throws Exception { + StopWatch watch = new StopWatch(); + for (int i = 0; i < 10000000; i++) { + fluentTemplate.to("direct:echo") + .withHeader("a", "aaa") + .withHeader("b", "bbb") + .withHeader("c", "ccc") + .withHeader("d", "ddd") + .withHeader("e", "eee") + .withHeader("f", "fff") + .withHeader("g", "ggg") + .withHeader("h", "hhh") + .withHeader("i", "iii") + .withHeader("j", "jjj") + .withHeader("a2", "aaa") + .withHeader("b2", "bbb") + .withHeader("c2", "ccc") + .withHeader("d2", "ddd") + .withHeader("e2", "eee") + .withHeader("f2", "fff") + .withHeader("g2", "ggg") + .withHeader("h2", "hhh") + .withHeader("i2", "iii") + .withHeader("j2", "jjj") + .withHeader("a3", "aaa") + .withHeader("b3", "bbb") + .withHeader("c3", "ccc") + .withHeader("d3", "ddd") + .withHeader("e3", "eee") + .withHeader("f3", "fff") + .withHeader("g3", "ggg") + .withHeader("h3", "hhh") + .withHeader("i3", "iii") + .withHeader("j3", "jjj") + .withHeader("a4", "aaa") + .withHeader("b4", "bbb") + .withHeader("c4", "ccc") + .withHeader("d4", "ddd") + .withHeader("e4", "eee") + .withHeader("f4", "fff") + .withHeader("g4", "ggg") + .withHeader("h4", "hhh") + .withHeader("i4", "iii") + .withHeader("j4", "jjj") + .withHeader("myHeader", "msg" + i).send(); + } + LOG.info("Took {} ms", watch.taken()); + } + +}