CAMEL-17675: camel-core - Rest DSL remove support for using inlined routes.
diff --git a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
index e7899c6..a84d087 100644
--- a/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
+++ b/components/camel-blueprint/src/main/java/org/apache/camel/blueprint/handler/CamelNamespaceHandler.java
@@ -1126,15 +1126,9 @@
// rest services can have embedded routes or a singular to
for (RestDefinition rd : camelContext.getExtension(Model.class).getRestDefinitions()) {
for (VerbDefinition vd : rd.getVerbs()) {
- Object o = vd.getToOrRoute();
- if (o instanceof RouteDefinition) {
- RouteDefinition route = (RouteDefinition) o;
- findInputComponents(route.getInput(), components, languages, dataformats);
- findOutputComponents(route.getOutputs(), components, languages, dataformats);
- } else if (o instanceof ToDefinition) {
- findUriComponent(((ToDefinition) o).getUri(), components);
- } else if (o instanceof ToDynamicDefinition) {
- findUriComponent(((ToDynamicDefinition) o).getUri(), components);
+ ToDefinition to = vd.getTo();
+ if (to != null) {
+ findUriComponent(to.getUri(), components);
}
}
}
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.java
deleted file mode 100644
index f03a5c0..0000000
--- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.java
+++ /dev/null
@@ -1,66 +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.test.blueprint.component.rest;
-
-import org.apache.camel.model.ToDefinition;
-import org.apache.camel.model.rest.RestDefinition;
-import org.apache.camel.test.blueprint.CamelBlueprintTestSupport;
-import org.junit.Test;
-
-public class FromRestGetEmbeddedRouteTest extends CamelBlueprintTestSupport {
-
- @Override
- protected String getBlueprintDescriptor() {
- return "org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.xml";
- }
-
- protected int getExpectedNumberOfRoutes() {
- return 3;
- }
-
- @Test
- public void testFromRestModel() throws Exception {
- assertEquals(getExpectedNumberOfRoutes(), context.getRoutes().size());
-
- assertEquals(2, context.getRestDefinitions().size());
- RestDefinition rest = context.getRestDefinitions().get(0);
- assertNotNull(rest);
- assertEquals("/say/hello", rest.getPath());
- assertEquals(1, rest.getVerbs().size());
- ToDefinition to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(0));
- assertEquals("mock:hello", to.getUri());
-
- rest = context.getRestDefinitions().get(1);
- assertNotNull(rest);
- assertEquals("/say/bye", rest.getPath());
- assertEquals(2, rest.getVerbs().size());
- assertEquals("application/json", rest.getVerbs().get(0).getConsumes());
- to = assertIsInstanceOf(ToDefinition.class, rest.getVerbs().get(0).getRoute().getOutputs().get(0));
- assertEquals("mock:bye", to.getUri());
-
- // the rest becomes routes and the input is a seda endpoint created by the DummyRestConsumerFactory
- getMockEndpoint("mock:update").expectedMessageCount(1);
- template.sendBody("seda:post-say-bye", "I was here");
- assertMockEndpointsSatisfied();
-
- String out = template.requestBody("seda:get-say-hello", "Me", String.class);
- assertEquals("Hello World", out);
- String out2 = template.requestBody("seda:get-say-bye", "Me", String.class);
- assertEquals("Bye World", out2);
- }
-
-}
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.xml
deleted file mode 100644
index 6fce700..0000000
--- a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/component/rest/FromRestGetEmbeddedRouteTest.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
- <!-- use a dummy rest consumer factory for the rest engine -->
- <bean id="dummy-rest" class="org.apache.camel.test.blueprint.component.rest.DummyRestConsumerFactory"/>
-
- <camelContext xmlns="http://camel.apache.org/schema/blueprint">
-
- <rest path="/say/hello">
- <get>
- <route>
- <to uri="mock:hello"/>
- <transform>
- <constant>Hello World</constant>
- </transform>
- </route>
- </get>
- </rest>
- <rest path="/say/bye">
- <get consumes="application/json">
- <route>
- <to uri="mock:bye"/>
- <transform>
- <constant>Bye World</constant>
- </transform>
- </route>
- </get>
- <post>
- <to uri="mock:update"/>
- </post>
- </rest>
-
- </camelContext>
-
-</blueprint>
\ No newline at end of file