This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new c7a86fce Revert "CAMEL-15581: Fix loading of XML rest definitions with camel-main" c7a86fce is described below commit c7a86fce7f324b4d80c571f97ddb3fcac197c2f4 Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Fri Sep 25 21:43:12 2020 +0200 Revert "CAMEL-15581: Fix loading of XML rest definitions with camel-main" This reverts commit a95d17c772149a0f3c70243a68532272477c5423. --- core/camel-main/pom.xml | 5 -- .../apache/camel/main/DefaultRoutesCollector.java | 2 +- .../apache/camel/main/xml/MainXmlRestsTest.java | 99 ---------------------- .../org/apache/camel/main/xml/camel-rests.xml | 26 ------ 4 files changed, 1 insertion(+), 131 deletions(-) diff --git a/core/camel-main/pom.xml b/core/camel-main/pom.xml index f4f6c70..8f2cfc9 100644 --- a/core/camel-main/pom.xml +++ b/core/camel-main/pom.xml @@ -115,11 +115,6 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-undertow</artifactId> - <scope>test</scope> - </dependency> - <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-slf4j-impl</artifactId> <scope>test</scope> diff --git a/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java b/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java index bda912e..16e515c 100644 --- a/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java +++ b/core/camel-main/src/main/java/org/apache/camel/main/DefaultRoutesCollector.java @@ -206,7 +206,7 @@ public class DefaultRoutesCollector implements RoutesCollector { Set<InputStream> set = resolver.findResources(part); for (InputStream is : set) { log.debug("Found XML rest from location: {}", part); - RestsDefinition rests = (RestsDefinition) ecc.getXMLRoutesDefinitionLoader().loadRestsDefinition(ecc, is); + RestsDefinition rests = (RestsDefinition) ecc.getXMLRoutesDefinitionLoader().loadRoutesDefinition(ecc, is); if (rests != null) { answer.add(rests); IOHelper.close(is); diff --git a/core/camel-main/src/test/java/org/apache/camel/main/xml/MainXmlRestsTest.java b/core/camel-main/src/test/java/org/apache/camel/main/xml/MainXmlRestsTest.java deleted file mode 100644 index 76f41ca..0000000 --- a/core/camel-main/src/test/java/org/apache/camel/main/xml/MainXmlRestsTest.java +++ /dev/null @@ -1,99 +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.main.xml; - -import java.util.List; - -import org.apache.camel.CamelContext; -import org.apache.camel.main.Main; -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.rest.GetVerbDefinition; -import org.apache.camel.model.rest.RestDefinition; -import org.apache.camel.model.rest.VerbDefinition; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class MainXmlRestsTest { - - @Test - public void testMainRestsCollector() throws Exception { - // will load XML from target/classes when testing - doTestMain("org/apache/camel/main/xml/camel-rests.xml"); - } - - @Test - public void testMainRestsCollectorScan() throws Exception { - // will load XML from target/classes when testing - doTestMain("org/apache/camel/main/xml/camel-res*.xml"); - } - - @Test - public void testMainRestsCollectorScanWildcardDirClasspathPath() throws Exception { - // will load XML from target/classes when testing - doTestMain("org/apache/camel/main/**/camel-res*.xml"); - } - - @Test - public void testMainRestsCollectorScanClasspathPrefix() throws Exception { - // will load XML from target/classes when testing - doTestMain("classpath:org/apache/camel/main/xml/camel-res*.xml"); - } - - @Test - public void testMainRestsCollectorScanInDir() throws Exception { - doTestMain("file:src/test/resources/org/apache/camel/main/xml/camel-res*.xml"); - } - - @Test - public void testMainRestsCollectorScanWildcardDirFilePath() throws Exception { - doTestMain("file:src/test/resources/**/camel-res*.xml"); - } - - @Test - public void testMainRestsCollectorFile() throws Exception { - doTestMain( - "file:src/test/resources/org/apache/camel/main/xml/camel-rests.xml,"); - } - - protected void doTestMain(String xmlRests) throws Exception { - Main main = new Main(); - main.configure().withXmlRests(xmlRests); - main.start(); - - CamelContext camelContext = main.getCamelContext(); - assertNotNull(camelContext); - - List<RestDefinition> restDefinitions = camelContext.adapt(ModelCamelContext.class).getRestDefinitions(); - assertEquals(1, restDefinitions.size()); - - RestDefinition restDefinition = restDefinitions.get(0); - assertEquals("bar", restDefinition.getId()); - assertEquals("/say/hello", restDefinition.getPath()); - - List<VerbDefinition> verbs = restDefinition.getVerbs(); - assertNotNull(verbs); - assertEquals(1, verbs.size()); - - VerbDefinition verbDefinition = verbs.get(0); - assertTrue(verbDefinition instanceof GetVerbDefinition); - - main.stop(); - } -} diff --git a/core/camel-main/src/test/resources/org/apache/camel/main/xml/camel-rests.xml b/core/camel-main/src/test/resources/org/apache/camel/main/xml/camel-rests.xml deleted file mode 100644 index 30a111a..0000000 --- a/core/camel-main/src/test/resources/org/apache/camel/main/xml/camel-rests.xml +++ /dev/null @@ -1,26 +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. - ---> -<rests xmlns="http://camel.apache.org/schema/spring"> - <rest id="bar" path="/say/hello"> - <get uri="/bar"> - <to uri="mock:bar"/> - </get> - </rest> -</rests>