You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/04/24 18:37:04 UTC
[camel] 02/02: CAMEL-19292: camel-core - Remove experimental LightweightCamelContext
This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 259f1f844a848b0597913b34d0fc63e2c40a3ad7
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Apr 24 20:11:55 2023 +0200
CAMEL-19292: camel-core - Remove experimental LightweightCamelContext
---
.../camel/impl/lw/EnricherLightweightTest.java | 59 ----
.../camel/impl/lw/LightweightContextTest.java | 82 ------
.../camel/impl/lw/PollEnricherLightweightTest.java | 154 ----------
.../camel/impl/lw/SplitterLightweightTest.java | 326 ---------------------
.../dsl/jbang/core/commands/CodeRestGenerator.java | 4 +-
.../apache/camel/dsl/jbang/core/commands/Init.java | 6 +-
.../apache/camel/dsl/jbang/core/commands/Run.java | 4 +-
7 files changed, 7 insertions(+), 628 deletions(-)
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/lw/EnricherLightweightTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/lw/EnricherLightweightTest.java
deleted file mode 100644
index 4cbc5a15dbb..00000000000
--- a/core/camel-core/src/test/java/org/apache/camel/impl/lw/EnricherLightweightTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.impl.lw;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-public class EnricherLightweightTest extends ContextTestSupport {
-
- @Override
- @BeforeEach
- public void setUp() throws Exception {
- setUseLightweightContext(true);
- super.setUp();
- }
-
- @Test
- public void testEnrich() throws Exception {
- MockEndpoint mock = getMockEndpoint("mock:enriched");
- mock.expectedBodiesReceived("res-1", "res-2", "res-3");
-
- template.sendBody("direct:start", 1);
- template.sendBody("direct:start", 2);
- template.sendBody("direct:start", 3);
-
- mock.assertIsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start").enrichWith("direct:resource")
- .body(Integer.class, String.class, (o, n) -> n + o).to("mock:enriched");
-
- // set an empty message
- from("direct:resource").transform().body(b -> "res-");
- }
- };
- }
-}
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/lw/LightweightContextTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/lw/LightweightContextTest.java
deleted file mode 100644
index a63b990c300..00000000000
--- a/core/camel-core/src/test/java/org/apache/camel/impl/lw/LightweightContextTest.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.impl.lw;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.builder.RouteBuilder;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-public class LightweightContextTest extends ContextTestSupport {
-
- @Override
- @BeforeEach
- public void setUp() throws Exception {
- setUseLightweightContext(true);
- super.setUp();
- }
-
- @Test
- public void testCBRCamel() throws Exception {
- getMockEndpoint("mock:other").expectedMessageCount(0);
- getMockEndpoint("mock:camel").expectedMessageCount(1);
- getMockEndpoint("mock:donkey").expectedMessageCount(0);
-
- template.sendBody("direct:start", "Camel rules");
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testCBRDonkey() throws Exception {
- getMockEndpoint("mock:other").expectedMessageCount(0);
- getMockEndpoint("mock:camel").expectedMessageCount(0);
- getMockEndpoint("mock:donkey").expectedMessageCount(1);
-
- template.sendBody("direct:start", "Donkey kong");
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testCBROther() throws Exception {
- getMockEndpoint("mock:other").expectedMessageCount(1);
- getMockEndpoint("mock:camel").expectedMessageCount(0);
- getMockEndpoint("mock:donkey").expectedMessageCount(0);
-
- template.sendBody("direct:start", "Hello World");
-
- assertMockEndpointsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() throws Exception {
- return new RouteBuilder() {
- @Override
- public void configure() throws Exception {
- from("direct:start")
- .choice()
- .when(body().contains("Camel"))
- .to("mock:camel")
- .when(body().contains("Donkey"))
- .to("mock:donkey")
- .otherwise()
- .to("mock:other");
- }
- };
- }
-}
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/lw/PollEnricherLightweightTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/lw/PollEnricherLightweightTest.java
deleted file mode 100644
index 487e285f087..00000000000
--- a/core/camel-core/src/test/java/org/apache/camel/impl/lw/PollEnricherLightweightTest.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.impl.lw;
-
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.ExchangePattern;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.enricher.SampleAggregator;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-public class PollEnricherLightweightTest extends ContextTestSupport {
-
- private static SampleAggregator aggregationStrategy = new SampleAggregator();
-
- protected MockEndpoint mock;
-
- @Override
- @BeforeEach
- public void setUp() throws Exception {
- setUseLightweightContext(true);
- super.setUp();
- mock = getMockEndpoint("mock:mock");
- }
-
- // -------------------------------------------------------------
- // InOnly routes
- // -------------------------------------------------------------
-
- @Test
- public void testPollEnrichInOnly() throws InterruptedException {
- template.sendBody("seda:foo1", "blah");
-
- mock.expectedBodiesReceived("test:blah");
- mock.expectedHeaderReceived(Exchange.TO_ENDPOINT, "seda://foo1");
-
- template.sendBody("direct:enricher-test-1", "test");
-
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testPollEnrichInOnlyWaitWithTimeout() throws InterruptedException {
- // this first try there is no data so we timeout
- mock.expectedBodiesReceived("test:blah");
- mock.expectedHeaderReceived(Exchange.TO_ENDPOINT, "seda://foo2");
- template.sendBody("direct:enricher-test-2", "test");
- // not expected data so we are not happy
- mock.assertIsNotSatisfied();
-
- // now send it and try again
- mock.reset();
- template.sendBody("seda:foo2", "blah");
- template.sendBody("direct:enricher-test-2", "test");
- mock.assertIsSatisfied();
- }
-
- @Test
- public void testPollEnrichInOnlyWaitNoTimeout() throws InterruptedException {
- // use another thread to send it a bit later
- Thread t = new Thread(new Runnable() {
- public void run() {
- try {
- Thread.sleep(250);
- } catch (InterruptedException e) {
- // ignore
- }
- template.sendBody("seda:foo3", "blah");
- }
- });
-
- long start = System.currentTimeMillis();
- mock.expectedBodiesReceived("test:blah");
- mock.expectedHeaderReceived(Exchange.TO_ENDPOINT, "seda://foo3");
- t.start();
- template.sendBody("direct:enricher-test-3", "test");
- // should take approx 1 sec to complete as the other thread is sending a
- // bit later and we wait
- mock.assertIsSatisfied();
- long delta = System.currentTimeMillis() - start;
- assertTrue(delta > 150, "Should take approx 0.25 sec: was " + delta);
- }
-
- // -------------------------------------------------------------
- // InOut routes
- // -------------------------------------------------------------
-
- @Test
- public void testPollEnrichInOut() throws InterruptedException {
- template.sendBody("seda:foo4", "blah");
-
- String result = (String) template.sendBody("direct:enricher-test-4", ExchangePattern.InOut, "test");
- assertEquals("test:blah", result);
- }
-
- @Test
- public void testPollEnrichInOutPlusHeader() throws InterruptedException {
- template.sendBody("seda:foo4", "blah");
-
- Exchange exchange = template.request("direct:enricher-test-4", new Processor() {
- public void process(Exchange exchange) {
- exchange.getIn().setHeader("foo", "bar");
- exchange.getIn().setBody("test");
- }
- });
- assertEquals("bar", exchange.getIn().getHeader("foo"));
- assertEquals("test:blah", exchange.getIn().getBody());
- assertEquals("seda://foo4", exchange.getMessage().getHeader(Exchange.TO_ENDPOINT));
- assertNull(exchange.getException());
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- // -------------------------------------------------------------
- // InOnly routes
- // -------------------------------------------------------------
-
- from("direct:enricher-test-1").pollEnrich("seda:foo1", aggregationStrategy).to("mock:mock");
-
- from("direct:enricher-test-2").pollEnrich("seda:foo2", 1000, aggregationStrategy).to("mock:mock");
-
- from("direct:enricher-test-3").pollEnrich("seda:foo3", -1, aggregationStrategy).to("mock:mock");
-
- // -------------------------------------------------------------
- // InOut routes
- // -------------------------------------------------------------
-
- from("direct:enricher-test-4").pollEnrich("seda:foo4", aggregationStrategy);
- }
- };
- }
-
-}
diff --git a/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java b/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java
deleted file mode 100644
index 5f82d174794..00000000000
--- a/core/camel-core/src/test/java/org/apache/camel/impl/lw/SplitterLightweightTest.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * 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.impl.lw;
-
-import java.io.File;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.apache.camel.CamelException;
-import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.processor.MyAggregationStrategy;
-import org.apache.camel.processor.aggregate.UseLatestAggregationStrategy;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-public class SplitterLightweightTest extends ContextTestSupport {
-
- @Override
- @BeforeEach
- public void setUp() throws Exception {
- setUseLightweightContext(true);
- super.setUp();
- }
-
- @Test
- public void testSendingAMessageUsingMulticastReceivesItsOwnExchange() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob");
-
- // InOnly
- template.send("direct:seqential", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob");
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
-
- Set<String> ids = new HashSet<>();
- Set<String> ids2 = new HashSet<>();
-
- List<Exchange> list = resultEndpoint.getReceivedExchanges();
- for (int i = 0; i < 4; i++) {
- Exchange exchange = list.get(i);
- Message in = exchange.getIn();
- ids.add(in.getMessageId());
- ids2.add(exchange.getExchangeId());
- assertNotNull(in, "The in message should not be null.");
- assertProperty(exchange, Exchange.SPLIT_INDEX, i);
- assertProperty(exchange, Exchange.SPLIT_SIZE, 4);
- }
-
- assertEquals(4, ids.size(), "The sub messages should have unique message ids");
- assertEquals(4, ids2.size(), "The sub messages should have unique exchange ids");
- }
-
- @Test
- public void testSplitterWithAggregationStrategy() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedBodiesReceived("James", "Guillaume", "Hiram", "Rob", "Roman");
-
- Exchange result = template.request("direct:seqential", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob,Roman");
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
- Message out = result.getMessage();
- assertEquals("Roman", out.getBody());
- assertMessageHeader(out, "foo", "bar");
- assertProperty(result, Exchange.SPLIT_INDEX, 4);
- }
-
- @Test
- public void testEmptyBody() {
- Exchange result = template.request("direct:seqential", new Processor() {
- public void process(Exchange exchange) throws Exception {
- exchange.getIn().setHeader("foo", "bar");
- }
- });
-
- assertFalse(result.hasOut(), "Should not have out");
- }
-
- @Test
- public void testSendingAMessageUsingMulticastReceivesItsOwnExchangeParallel() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
-
- resultEndpoint.expectsNoDuplicates(body());
- resultEndpoint.expectedMessageCount(4);
-
- // InOnly
- template.send("direct:parallel", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob");
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
-
- List<Exchange> list = resultEndpoint.getReceivedExchanges();
- Set<Integer> numbersFound = new TreeSet<>();
- final String[] names = { "James", "Guillaume", "Hiram", "Rob" };
-
- for (int i = 0; i < 4; i++) {
- Exchange exchange = list.get(i);
- Message in = exchange.getIn();
- Integer splitCounter = exchange.getProperty(Exchange.SPLIT_INDEX, Integer.class);
- numbersFound.add(splitCounter);
- assertEquals(names[splitCounter], in.getBody());
- assertProperty(exchange, Exchange.SPLIT_SIZE, 4);
- }
-
- assertEquals(4, numbersFound.size());
- }
-
- @Test
- public void testSplitterWithAggregationStrategyParallel() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(5);
-
- Exchange result = template.request("direct:parallel", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob,Roman");
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
- Message out = result.getMessage();
-
- assertMessageHeader(out, "foo", "bar");
- assertEquals((Object) (Integer) 5, result.getProperty("aggregated", Integer.class));
- }
-
- @Test
- public void testSplitterWithAggregationStrategyParallelStreaming() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(5);
- resultEndpoint.expectedBodiesReceivedInAnyOrder("James", "Guillaume", "Hiram", "Rob", "Roman");
-
- Exchange result = template.request("direct:parallel-streaming", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob,Roman");
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
- Message out = result.getMessage();
-
- assertMessageHeader(out, "foo", "bar");
- assertEquals((Object) (Integer) 5, result.getProperty("aggregated", Integer.class));
- }
-
- @Test
- public void testSplitterParallelAggregate() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(5);
- resultEndpoint.expectedBodiesReceivedInAnyOrder("James", "Guillaume", "Hiram", "Rob", "Roman");
-
- Exchange result = template.request("direct:parallelAggregate", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob,Roman");
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
- Message out = result.getMessage();
-
- assertMessageHeader(out, "foo", "bar");
- // we aggregate parallel and therefore its not thread-safe when setting
- // values
- }
-
- @Test
- public void testSplitterWithStreamingAndFileBody() throws Exception {
- URL url = this.getClass().getResource("/org/apache/camel/processor/simple.txt");
- assertNotNull(url, "We should find this simple file here.");
- File file = new File(url.getFile());
- sendToSplitterWithStreaming(file);
- }
-
- @Test
- public void testSplitterWithStreamingAndStringBody() throws Exception {
- sendToSplitterWithStreaming("James,Guillaume,Hiram,Rob,Roman");
- }
-
- public void sendToSplitterWithStreaming(final Object body) throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(5);
- resultEndpoint.expectedHeaderReceived("foo", "bar");
-
- template.request("direct:streaming", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody(body);
- in.setHeader("foo", "bar");
- }
- });
-
- assertMockEndpointsSatisfied();
-
- // check properties with split details is correct
- int size = resultEndpoint.getReceivedExchanges().size();
- for (int i = 0; i < size; i++) {
- Exchange exchange = resultEndpoint.getReceivedExchanges().get(i);
- assertEquals(i, exchange.getProperty(Exchange.SPLIT_INDEX));
- if (i < (size - 1)) {
- assertEquals(Boolean.FALSE, exchange.getProperty(Exchange.SPLIT_COMPLETE));
- // this header cannot be set when streaming is used, except for
- // the last exchange
- assertNull(exchange.getProperty(Exchange.SPLIT_SIZE));
- } else {
- assertEquals(Boolean.TRUE, exchange.getProperty(Exchange.SPLIT_COMPLETE));
- // when we are complete the size is set
- assertEquals(size, exchange.getProperty(Exchange.SPLIT_SIZE));
- }
- }
- }
-
- @Test
- public void testSplitterWithException() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(4);
- resultEndpoint.expectedHeaderReceived("foo", "bar");
-
- MockEndpoint failedEndpoint = getMockEndpoint("mock:failed");
- failedEndpoint.expectedMessageCount(1);
- failedEndpoint.expectedHeaderReceived("foo", "bar");
-
- Exchange result = template.request("direct:exception", new Processor() {
- public void process(Exchange exchange) {
- Message in = exchange.getIn();
- in.setBody("James,Guillaume,Hiram,Rob,Exception");
- in.setHeader("foo", "bar");
- }
- });
-
- boolean b = result.getException() instanceof CamelException;
- assertTrue(b, "The result exchange should have a camel exception");
-
- assertMockEndpointsSatisfied();
- }
-
- @Test
- public void testSplitterWithIterable() throws Exception {
- MockEndpoint resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(4);
- resultEndpoint.expectedBodiesReceived("A", "B", "C", "D");
- final List<String> data = Arrays.asList("A", "B", "C", "D");
- Iterable<String> itb = new Iterable<String>() {
- public Iterator<String> iterator() {
- return data.iterator();
- }
- };
- sendBody("direct:simple", itb);
- resultEndpoint.assertIsSatisfied();
- }
-
- @Override
- protected RouteBuilder createRouteBuilder() {
- return new RouteBuilder() {
- public void configure() {
- onException(CamelException.class).to("mock:failed");
-
- from("direct:seqential").split(body().tokenize(","), new UseLatestAggregationStrategy()).to("mock:result");
- from("direct:parallel").split(body().tokenize(","), new MyAggregationStrategy()).parallelProcessing()
- .to("mock:result");
- from("direct:parallelAggregate").split(body().tokenize(","), new MyAggregationStrategy()).parallelProcessing()
- .parallelAggregate().to("mock:result");
- from("direct:streaming").split(body().tokenize(",")).streaming().to("mock:result");
- from("direct:parallel-streaming").split(body().tokenize(","), new MyAggregationStrategy()).parallelProcessing()
- .streaming().to("mock:result");
- from("direct:exception").split(body().tokenize(",")).aggregationStrategy(new MyAggregationStrategy())
- .parallelProcessing().process(new Processor() {
- public void process(Exchange exchange) throws Exception {
- String string = exchange.getIn().getBody(String.class);
- if ("Exception".equals(string)) {
- throw new CamelException("Just want to throw exception here");
- }
-
- }
- }).to("mock:result");
- from("direct:simple").split(body()).to("mock:result");
- }
- };
- }
-}
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java
index 31431befa54..d7717433872 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CodeRestGenerator.java
@@ -30,7 +30,7 @@ import io.apicurio.datamodels.Library;
import io.apicurio.datamodels.openapi.models.OasDocument;
import org.apache.camel.CamelContext;
import org.apache.camel.generator.openapi.RestDslGenerator;
-import org.apache.camel.impl.lw.LightweightCamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.config.Configurator;
import org.openapitools.codegen.ClientOptInput;
@@ -71,7 +71,7 @@ public class CodeRestGenerator extends CamelCommand {
final JsonNode node = input.endsWith("json") ? readNodeFromJson() : readNodeFromYaml();
OasDocument document = (OasDocument) Library.readDocument(node);
Configurator.setRootLevel(Level.OFF);
- try (CamelContext context = new LightweightCamelContext()) {
+ try (CamelContext context = new DefaultCamelContext()) {
String text = null;
if ("yaml".equalsIgnoreCase(type)) {
text = RestDslGenerator.toYaml(document).generate(context, generateRoutes);
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java
index d67d8642720..1dcfa364866 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Init.java
@@ -28,7 +28,7 @@ import org.apache.camel.dsl.jbang.core.commands.catalog.KameletCatalogHelper;
import org.apache.camel.dsl.jbang.core.common.ResourceDoesNotExist;
import org.apache.camel.github.GistResourceResolver;
import org.apache.camel.github.GitHubResourceResolver;
-import org.apache.camel.impl.lw.LightweightCamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.Resource;
import org.apache.camel.util.FileUtil;
import org.apache.camel.util.IOHelper;
@@ -177,7 +177,7 @@ public class Init extends CamelCommand {
dir.mkdirs();
}
- CamelContext tiny = new LightweightCamelContext();
+ CamelContext tiny = new DefaultCamelContext();
GitHubResourceResolver resolver = new GitHubResourceResolver();
resolver.setCamelContext(tiny);
for (String u : all.toString().split(",")) {
@@ -211,7 +211,7 @@ public class Init extends CamelCommand {
dir.mkdirs();
}
- CamelContext tiny = new LightweightCamelContext();
+ CamelContext tiny = new DefaultCamelContext();
GistResourceResolver resolver = new GistResourceResolver();
resolver.setCamelContext(tiny);
for (String u : all.toString().split(",")) {
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index 0e18d1ff481..32f11444d10 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -54,7 +54,7 @@ import org.apache.camel.dsl.jbang.core.common.LoggingLevelCompletionCandidates;
import org.apache.camel.dsl.jbang.core.common.RuntimeUtil;
import org.apache.camel.dsl.jbang.core.common.VersionHelper;
import org.apache.camel.generator.openapi.RestDslGenerator;
-import org.apache.camel.impl.lw.LightweightCamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.main.KameletMain;
import org.apache.camel.main.download.DownloadListener;
import org.apache.camel.support.ResourceHelper;
@@ -895,7 +895,7 @@ public class Run extends CamelCommand {
final JsonNode node = mapper.readTree(Paths.get(openapi).toFile());
OasDocument document = (OasDocument) Library.readDocument(node);
Configurator.setRootLevel(Level.OFF);
- try (CamelContext context = new LightweightCamelContext()) {
+ try (CamelContext context = new DefaultCamelContext()) {
String out = RestDslGenerator.toYaml(document).generate(context, false);
Files.write(Paths.get(OPENAPI_GENERATED_FILE), out.getBytes());
}