This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch sandbox/camel-3.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 330ac6c0aaac5bc015ef7c9473515d1c6caff0db Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Wed Sep 26 20:50:43 2018 +0200 [CAMEL-12818] Remove deprecated stuff --- .../component/avro/AvroHttpSpringProducerTest.java | 2 +- .../avro/AvroNettySpringConsumerTest.java | 2 +- .../avro/AvroNettySpringProducerTest.java | 2 +- .../avro/AvroMarshalAndUnmarshalSpringTest.java | 2 +- .../barcode/BarcodeDataFormatSpringTest.java | 2 +- .../org/apache/camel/cdi/CdiCamelExtension.java | 2 +- .../java/org/apache/camel/cdi/CdiCamelFactory.java | 44 +-- .../src/main/java/org/apache/camel/cdi/Mock.java | 55 ---- .../main/java/org/apache/camel/cdi/RoutesXml.java | 99 ------ .../src/main/java/org/apache/camel/cdi/Uri.java | 18 - .../apache/camel/cdi/bean/MockAnnotationRoute.java | 3 +- .../apache/camel/cdi/test/MockEndpointTest.java | 3 +- .../test/RouteBuildersWithContextNamesTest.java | 4 +- .../cdi/test/UriQualifierWithContextTest.java | 9 +- .../camel/cdi/test/UriWithWrongContextTest.java | 2 +- .../component/consul/policy/ConsulRoutePolicy.java | 362 --------------------- .../consul/policy/ConsulRoutePolicyMain.java | 48 --- .../component/crypto/cms/SpringComponentTest.java | 4 +- .../camel/converter/crypto/PGPDataFormatUtil.java | 150 --------- .../component/crypto/SpringSignatureTest.java | 4 +- .../crypto/SpringCryptoDataFormatTest.java | 4 +- .../converter/crypto/SpringPGPDataFormatTest.java | 4 +- .../cxf/AbstractCXFGreeterRouterTest.java | 2 +- .../CxfConsumerPayloadFaultCauseEnabledTest.java | 2 +- .../cxf/CxfPayLoadMessageXmlBindingRouterTest.java | 2 +- .../cxf/CxfPayLoadSoapHeaderSpringTest.java | 2 +- .../CxfPayloadConsumerNamespaceOnEnvelopeTest.java | 2 +- .../CxfPayloadProducerNamespaceOnEnvelopeTest.java | 2 +- .../cxf/CxfPayloadRouterContentLengthTest.java | 2 +- .../cxf/CxfSpringCustomizedExceptionTest.java | 2 +- .../camel/component/cxf/CxfSpringRouterTest.java | 2 +- .../cxf/converter/PayLoadConvertToPOJOTest.java | 2 +- .../cxf/jms/CxfEndpointJMSConsumerTest.java | 3 +- .../component/cxf/multipart/CXFMultiPartTest.java | 2 +- .../cxf/util/CxfEndpointUtilsWithSpringTest.java | 2 +- .../cxf/wssecurity/camel/WSSecurityRouteTest.java | 2 +- .../component/infinispan/InfinispanConstants.java | 6 - .../InfinispanRemoteQueryProducerIT.java | 3 +- ...melJaxbNoNamespaceSchemaLocationSpringTest.java | 2 +- .../org/apache/camel/jaxb/CamelJaxbSpringTest.java | 2 +- .../jibx/JibxDataFormatSpringDslTest.java | 2 +- .../camel-jms/src/main/docs/jms-component.adoc | 10 +- .../apache/camel/component/jms/JmsComponent.java | 1 - .../camel/component/jms/JmsConfiguration.java | 34 +- .../apache/camel/component/jms/JmsEndpoint.java | 12 - .../jms/JmsEndpointConfigurationTest.java | 6 - .../jms/JmsHeaderFilteringWithSpringTest.java | 2 +- .../component/jms/JmsRouteUsingSpringTest.java | 2 +- .../jms/JmsSpringLoadBalanceFailoverTest.java | 4 +- .../camel/processor/jpa/AbstractJpaTest.java | 2 +- .../component/mongodb3/AbstractMongoDbTest.java | 2 +- .../mongodb3/MongoDbSpringDslOperationsTest.java | 2 +- .../camel-msv/src/main/docs/msv-component.adoc | 3 +- .../script/example/AnyLanguageFilterTest.java | 2 +- .../script/example/BeanShellFilterTest.java | 2 +- .../builder/script/example/GroovyFilterTest.java | 2 +- .../script/example/JavaScriptFilterTest.java | 2 +- .../slack/SlackComponentVerifierExtension.java | 5 +- .../camel/component/slack/SlackConsumer.java | 25 +- .../camel/spring/CamelContextFactoryBean.java | 16 - .../apache/camel/spring/SpringCamelContext.java | 29 -- .../camel/component/log/SpringLogMaskTest.java | 6 +- .../org/apache/camel/spring/SpringTestSupport.java | 3 +- .../spring/example/SpringXPathFilterTest.java | 2 +- .../spring/processor/SpringLogEipMaskTest.java | 4 +- .../camel/spring/processor/SpringTestHelper.java | 2 +- .../remoting/SpringRemotingBeanConverterTest.java | 2 +- .../spring/remoting/SpringRemotingRouteTest.java | 2 +- .../SpringRemotingTwoCamelContextTest.java | 2 +- .../swagger/servlet/RestSwaggerCorsFilter.java | 118 ------- .../camel/swagger/servlet/RestSwaggerServlet.java | 263 --------------- .../servlet/ServletRestApiResponseAdapter.java | 49 --- .../xmlsecurity/SpringXmlSignatureTest.java | 4 +- .../xstream/SpringMarshalDomainObjectJSONTest.java | 2 +- .../dataformat/xstream/SpringMarshalListTest.java | 2 +- .../xstream/SpringMarshalOmitFieldsTest.java | 2 +- .../xstream/SpringXStreamConfigurationTest.java | 2 +- .../jms/springboot/JmsComponentConfiguration.java | 14 - 78 files changed, 101 insertions(+), 1410 deletions(-) diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java index 5067154..aad936c 100644 --- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java +++ b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroHttpSpringProducerTest.java @@ -39,7 +39,7 @@ public class AvroHttpSpringProducerTest extends AvroHttpProducerTest { @Override protected CamelContext createCamelContext() throws Exception { applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-http-producer.xml"); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } @Override diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java index 2beabd2..7941c9c0 100644 --- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java +++ b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringConsumerTest.java @@ -51,7 +51,7 @@ public class AvroNettySpringConsumerTest extends AvroNettyConsumerTest { @Override protected CamelContext createCamelContext() throws Exception { applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-netty-consumer.xml"); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } @Override diff --git a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java index 19b03af..073e284 100644 --- a/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java +++ b/components/camel-avro/src/test/java/org/apache/camel/component/avro/AvroNettySpringProducerTest.java @@ -37,7 +37,7 @@ public class AvroNettySpringProducerTest extends AvroNettyProducerTest { @Override protected CamelContext createCamelContext() throws Exception { applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/avro/avro-netty-producer.xml"); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } @Override diff --git a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java index c80369d..912d433 100644 --- a/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java +++ b/components/camel-avro/src/test/java/org/apache/camel/dataformat/avro/AvroMarshalAndUnmarshalSpringTest.java @@ -27,7 +27,7 @@ public class AvroMarshalAndUnmarshalSpringTest extends AvroMarshalAndUnmarshallT protected CamelContext createCamelContext() throws Exception { applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/avro/springDataFormat.xml"); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } public boolean isUseRouteBuilder() { diff --git a/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatSpringTest.java b/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatSpringTest.java index 4fe967b..6e19939 100644 --- a/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatSpringTest.java +++ b/components/camel-barcode/src/test/java/org/apache/camel/dataformat/barcode/BarcodeDataFormatSpringTest.java @@ -36,7 +36,7 @@ public class BarcodeDataFormatSpringTest extends BarcodeDataFormatCamelTest { @Override protected CamelContext createCamelContext() throws Exception { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/dataformat/barcode/barcodeDataformatSpring.xml"); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java index 92fb721..8143717 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelExtension.java @@ -368,7 +368,7 @@ public class CdiCamelExtension implements Extension { .filter(ip -> getRawType(ip.getType()).getName().startsWith("org.apache.camel")) .map(InjectionPoint::getQualifiers) .flatMap(Set::stream) - .anyMatch(isAnnotationType(Uri.class).or(isAnnotationType(Mock.class)).or(isEqual(DEFAULT))); + .anyMatch(isAnnotationType(Uri.class).or(isEqual(DEFAULT))); } private SyntheticBean<?> camelContextBean(BeanManager manager, Class<?> beanClass, Annotation... qualifiers) { diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelFactory.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelFactory.java index e5e0ca8..9f05405 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelFactory.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/CdiCamelFactory.java @@ -30,7 +30,6 @@ import javax.enterprise.inject.InjectionException; import javax.enterprise.inject.Instance; import javax.enterprise.inject.Produces; import javax.enterprise.inject.Typed; -import javax.enterprise.inject.UnsatisfiedResolutionException; import javax.enterprise.inject.spi.InjectionPoint; import org.apache.camel.CamelContext; @@ -69,9 +68,7 @@ final class CdiCamelFactory { private static ProducerTemplate producerTemplateFromUri(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension, Uri uri) { try { - CamelContext context = uri.context().isEmpty() - ? selectContext(ip, instance, extension) - : selectContext(uri.context(), instance); + CamelContext context = selectContext(ip, instance, extension); ProducerTemplate producerTemplate = context.createProducerTemplate(); Endpoint endpoint = context.getEndpoint(uri.value(), Endpoint.class); producerTemplate.setDefaultEndpoint(endpoint); @@ -101,9 +98,7 @@ final class CdiCamelFactory { private static FluentProducerTemplate fluentProducerTemplateFromUri(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension, Uri uri) { try { - CamelContext context = uri.context().isEmpty() - ? selectContext(ip, instance, extension) - : selectContext(uri.context(), instance); + CamelContext context = selectContext(ip, instance, extension); FluentProducerTemplate producerTemplate = context.createFluentProducerTemplate(); Endpoint endpoint = context.getEndpoint(uri.value(), Endpoint.class); producerTemplate.setDefaultEndpoint(endpoint); @@ -141,9 +136,7 @@ final class CdiCamelFactory { private static MockEndpoint mockEndpointFromUri(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) { Uri uri = getQualifierByType(ip, Uri.class).get(); try { - CamelContext context = uri.context().isEmpty() - ? selectContext(ip, instance, extension) - : selectContext(uri.context(), instance); + CamelContext context = selectContext(ip, instance, extension); return context.getEndpoint(uri.value(), MockEndpoint.class); } catch (Exception cause) { throw new InjectionException("Error injecting mock endpoint annotated with " + uri @@ -151,33 +144,13 @@ final class CdiCamelFactory { } } - // Maintained for backward compatibility reason though this is redundant with @Uri - // see https://issues.apache.org/jira/browse/CAMEL-5553?focusedCommentId=13445936&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13445936 - @Mock - @Produces - @Typed(MockEndpoint.class) - // Qualifiers are dynamically added in CdiCamelExtension - private static MockEndpoint createMockEndpoint(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) { - Mock mock = getQualifierByType(ip, Mock.class).get(); - try { - CamelContext context = mock.context().isEmpty() - ? selectContext(ip, instance, extension) - : selectContext(mock.context(), instance); - return context.getEndpoint(mock.value(), MockEndpoint.class); - } catch (Exception cause) { - throw new InjectionException("Error injecting mock endpoint annotated with " + mock + " into " + ip, cause); - } - } - @Uri("") @Produces // Qualifiers are dynamically added in CdiCamelExtension private static Endpoint endpoint(InjectionPoint ip, @Any Instance<CamelContext> instance, CdiCamelExtension extension) { Uri uri = getQualifierByType(ip, Uri.class).get(); try { - CamelContext context = uri.context().isEmpty() - ? selectContext(ip, instance, extension) - : selectContext(uri.context(), instance); + CamelContext context = selectContext(ip, instance, extension); return context.getEndpoint(uri.value(), Endpoint.class); } catch (Exception cause) { throw new InjectionException("Error injecting endpoint annotated with " + uri + " into " + ip, cause); @@ -200,15 +173,6 @@ final class CdiCamelFactory { return context.getEndpoint(uri, CdiEventEndpoint.class); } - private static <T extends CamelContext> T selectContext(String name, Instance<T> instance) { - for (T context : instance) { - if (name.equals(context.getName())) { - return context; - } - } - throw new UnsatisfiedResolutionException("No Camel context with name [" + name + "] is deployed!"); - } - private static <T extends CamelContext> T selectContext(InjectionPoint ip, Instance<T> instance, CdiCamelExtension extension) { Collection<Annotation> qualifiers = new HashSet<>(ip.getQualifiers()); qualifiers.retainAll(extension.getContextQualifiers()); diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/Mock.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/Mock.java deleted file mode 100644 index bcc4500..0000000 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/Mock.java +++ /dev/null @@ -1,55 +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.cdi; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import javax.enterprise.util.Nonbinding; -import javax.inject.Qualifier; - -/** - * A qualifier for injecting instances of {@link org.apache.camel.component.mock.MockEndpoint} into a bean. - * - * @deprecated Use {@link org.apache.camel.cdi.Uri} instead: - * - * <pre><code> - * {@literal @}Inject - * {@literal @}Uri("mock:outbound") - * MockEndpoint mock; - * </code></pre> - */ -@Deprecated -@Qualifier -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER}) -public @interface Mock { - - /** - * Returns an optional URI used to create the {@code MockEndpoint}. - */ - @Nonbinding - String value() default ""; - - /** - * Returns the name of the Camel context to use to resolve the {@code MockEndpoint}. - */ - @Nonbinding - String context() default ""; - -} diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java deleted file mode 100644 index 6edc7cc..0000000 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.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.cdi; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import javax.xml.bind.JAXBException; - -import org.apache.camel.model.ModelCamelContext; -import org.apache.camel.model.ModelHelper; -import org.apache.camel.model.RoutesDefinition; -import org.apache.camel.util.ObjectHelper; - -/** - * A helper class for loading route definitions from a file, URL or the classpath. - * - * @deprecated Use {@link org.apache.camel.cdi.ImportResource} instead: - * - * <pre><code> - * {@literal @}ImportResource("foo-camel-context.xml") - * class BarBean { - * - * }; - * </code></pre> - */ -@Vetoed -@Deprecated -public final class RoutesXml { - - private RoutesXml() { - //The helper class - } - - /** - * Loads the routes from the given XML content - */ - public static RoutesDefinition loadRoutesFromXML(ModelCamelContext camelContext, String xml) throws JAXBException { - return ModelHelper.createModelFromXml(camelContext, xml, RoutesDefinition.class); - } - - /** - * Loads the routes from the classpath - */ - public static RoutesDefinition loadRoutesFromClasspath(ModelCamelContext camelContext, String uri) throws JAXBException { - InputStream stream = ObjectHelper.loadResourceAsStream(uri); - ObjectHelper.notNull(stream, "Could not find resource '" + uri + "' on the ClassLoader"); - return ModelHelper.createModelFromXml(camelContext, stream, RoutesDefinition.class); - } - - /** - * Loads the routes from a {@link URL} - */ - public static RoutesDefinition loadRoutesFromURL(ModelCamelContext camelContext, URL url) throws JAXBException, IOException { - ObjectHelper.notNull(url, "url"); - return ModelHelper.createModelFromXml(camelContext, url.openStream(), RoutesDefinition.class); - } - - /** - * Loads the routes from a {@link URL} - */ - public static RoutesDefinition loadRoutesFromURL(ModelCamelContext camelContext, String url) throws IOException, JAXBException { - return loadRoutesFromURL(camelContext, new URL(url)); - } - - /** - * Loads the routes from a {@link File} - */ - public static RoutesDefinition loadRoutesFromFile(ModelCamelContext camelContext, File file) throws JAXBException, FileNotFoundException { - ObjectHelper.notNull(file, "file"); - return ModelHelper.createModelFromXml(camelContext, new FileInputStream(file), RoutesDefinition.class); - } - - /** - * Loads the routes from a {@link File} - */ - public static RoutesDefinition loadRoutesFromFile(ModelCamelContext camelContext, String fileName) - throws JAXBException, FileNotFoundException { - return loadRoutesFromFile(camelContext, new File(fileName)); - } - -} \ No newline at end of file diff --git a/components/camel-cdi/src/main/java/org/apache/camel/cdi/Uri.java b/components/camel-cdi/src/main/java/org/apache/camel/cdi/Uri.java index 538f882..b32babc 100644 --- a/components/camel-cdi/src/main/java/org/apache/camel/cdi/Uri.java +++ b/components/camel-cdi/src/main/java/org/apache/camel/cdi/Uri.java @@ -48,20 +48,6 @@ public @interface Uri { */ @Nonbinding String value(); - /** - * Returns the name of the {@code CamelContext} to use to resolve the Camel resource for this URI. - * - * @deprecated Use the {@link ContextName} qualifier to specify the name of the {@code CamelContext} instead: - * <pre><code> - * {@literal @}Inject - * {@literal @}ContextName("foo") - * {@literal @}Uri("seda:bar") - * Endpoint endpoint; - * </code></pre> - */ - @Deprecated - @Nonbinding String context() default ""; - final class Literal extends AnnotationLiteral<Uri> implements Uri { private static final long serialVersionUID = 1L; @@ -81,9 +67,5 @@ public @interface Uri { return uri; } - @Override - public String context() { - return ""; - } } } diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/MockAnnotationRoute.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/MockAnnotationRoute.java index 78aff0c..88333d7 100644 --- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/MockAnnotationRoute.java +++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/bean/MockAnnotationRoute.java @@ -20,7 +20,6 @@ import javax.inject.Inject; import org.apache.camel.Endpoint; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.cdi.Mock; import org.apache.camel.cdi.Uri; import org.apache.camel.component.mock.MockEndpoint; @@ -31,7 +30,7 @@ public class MockAnnotationRoute extends RouteBuilder { private Endpoint directEP; @Inject - @Mock("mock:result") + @Uri("mock:result") private MockEndpoint mockEP; @Override diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java index 7bf0ba7..3f86516 100644 --- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java +++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/MockEndpointTest.java @@ -21,7 +21,6 @@ import javax.inject.Inject; import org.apache.camel.ProducerTemplate; import org.apache.camel.cdi.CdiCamelExtension; -import org.apache.camel.cdi.Mock; import org.apache.camel.cdi.Uri; import org.apache.camel.cdi.bean.DefaultCamelContextBean; import org.apache.camel.cdi.bean.MockAnnotationRoute; @@ -51,7 +50,7 @@ public class MockEndpointTest { private ProducerTemplate defaultInbound; @Inject - @Mock("mock:result") + @Uri("mock:result") private MockEndpoint defaultOutbound; @Deployment diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/RouteBuildersWithContextNamesTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/RouteBuildersWithContextNamesTest.java index 045f80e..c7ec13f 100644 --- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/RouteBuildersWithContextNamesTest.java +++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/RouteBuildersWithContextNamesTest.java @@ -84,9 +84,9 @@ public class RouteBuildersWithContextNamesTest { } @Test - public void sendMessageToFirstInbound(@Uri(value = "direct:inbound", context = "first") + public void sendMessageToFirstInbound(@Uri(value = "direct:inbound") @ContextName("first") ProducerTemplate inbound, - @Uri(value = "mock:outbound", context = "first") + @Uri(value = "mock:outbound") @ContextName("first") MockEndpoint outbound) throws InterruptedException { outbound.expectedMessageCount(1); outbound.expectedBodiesReceived("test"); diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriQualifierWithContextTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriQualifierWithContextTest.java index 5e17b1d..d21e0fc 100644 --- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriQualifierWithContextTest.java +++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriQualifierWithContextTest.java @@ -24,7 +24,6 @@ import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.cdi.CdiCamelExtension; import org.apache.camel.cdi.ContextName; -import org.apache.camel.cdi.Mock; import org.apache.camel.cdi.Uri; import org.apache.camel.cdi.bean.FirstCamelContextBean; import org.apache.camel.component.mock.MockEndpoint; @@ -43,11 +42,11 @@ import static org.apache.camel.component.mock.MockEndpoint.assertIsSatisfied; public class UriQualifierWithContextTest { @Inject - @Uri(value = "mock:outbound", context = "first") + @Uri(value = "mock:outbound") @ContextName("first") private MockEndpoint outbound; @Inject - @Uri(value = "direct:inbound", context = "first") + @Uri(value = "direct:inbound") @ContextName("first") private ProducerTemplate inbound; @Deployment @@ -76,11 +75,11 @@ public class UriQualifierWithContextTest { class UriWithContextRoute extends RouteBuilder { @Inject - @Uri(value = "direct:inbound", context = "first") + @Uri(value = "direct:inbound") @ContextName("first") Endpoint inbound; @Inject - @Mock(value = "mock:outbound", context = "first") + @Uri(value = "mock:outbound") @ContextName("first") MockEndpoint outbound; @Override diff --git a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriWithWrongContextTest.java b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriWithWrongContextTest.java index e6297ab..97fe653 100644 --- a/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriWithWrongContextTest.java +++ b/components/camel-cdi/src/test/java/org/apache/camel/cdi/test/UriWithWrongContextTest.java @@ -68,7 +68,7 @@ public class UriWithWrongContextTest { class UriWithWrongContextRoute extends RouteBuilder { @Inject - @Uri(value = "direct:inbound", context = "second") + @Uri(value = "direct:inbound") @ContextName("second") Endpoint inbound; @Override diff --git a/components/camel-consul/src/main/java/org/apache/camel/component/consul/policy/ConsulRoutePolicy.java b/components/camel-consul/src/main/java/org/apache/camel/component/consul/policy/ConsulRoutePolicy.java deleted file mode 100644 index ee6e3bb..0000000 --- a/components/camel-consul/src/main/java/org/apache/camel/component/consul/policy/ConsulRoutePolicy.java +++ /dev/null @@ -1,362 +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.component.consul.policy; - -import java.math.BigInteger; -import java.util.HashSet; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicReference; - -import com.orbitz.consul.Consul; -import com.orbitz.consul.KeyValueClient; -import com.orbitz.consul.SessionClient; -import com.orbitz.consul.async.ConsulResponseCallback; -import com.orbitz.consul.model.ConsulResponse; -import com.orbitz.consul.model.kv.Value; -import com.orbitz.consul.model.session.ImmutableSession; -import com.orbitz.consul.option.QueryOptions; -import org.apache.camel.CamelContext; -import org.apache.camel.CamelContextAware; -import org.apache.camel.Route; -import org.apache.camel.api.management.ManagedAttribute; -import org.apache.camel.api.management.ManagedResource; -import org.apache.camel.component.consul.ConsulConfiguration; -import org.apache.camel.component.consul.ConsulConstants; -import org.apache.camel.support.RoutePolicySupport; -import org.apache.camel.util.ObjectHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @deprecated use {@link org.apache.camel.component.consul.cluster.ConsulClusterService} and {@link org.apache.camel.impl.cluster.ClusteredRoutePolicy} instead. - */ -@Deprecated -@ManagedResource(description = "Route policy using Consul as clustered lock") -public final class ConsulRoutePolicy extends RoutePolicySupport implements CamelContextAware { - private static final Logger LOGGER = LoggerFactory.getLogger(ConsulRoutePolicy.class); - - private final Object lock = new Object(); - private final AtomicBoolean leader = new AtomicBoolean(false); - private final Set<Route> suspendedRoutes = new HashSet<>(); - private final AtomicReference<BigInteger> index = new AtomicReference<>(BigInteger.valueOf(0)); - - private Route route; - private CamelContext camelContext; - private String serviceName; - private String servicePath; - private ExecutorService executorService; - - private int ttl = 60; - private int lockDelay = 10; - private boolean shouldStopConsumer = true; - private String consulUrl = ConsulConstants.CONSUL_DEFAULT_URL; - - private Consul consul; - private SessionClient sessionClient; - private KeyValueClient keyValueClient; - - private String sessionId; - - public ConsulRoutePolicy() { - } - - public ConsulRoutePolicy(String consulUrl) { - this.consulUrl = consulUrl; - } - - public ConsulRoutePolicy(ConsulConfiguration configuration) throws Exception { - this.consulUrl = configuration.getUrl(); - this.consul = configuration.createConsulClient(camelContext); - } - - @Override - public CamelContext getCamelContext() { - return camelContext; - } - - @Override - public void setCamelContext(CamelContext camelContext) { - this.camelContext = camelContext; - } - - public String getConsulUrl() { - return consulUrl; - } - - public void setConsulUrl(String consulUrl) { - this.consulUrl = consulUrl; - } - - @Override - public void onInit(Route route) { - super.onInit(route); - this.route = route; - } - - @Override - public void onStart(Route route) { - if (!leader.get() && shouldStopConsumer) { - stopConsumer(route); - } - } - - @Override - public void onStop(Route route) { - synchronized (lock) { - suspendedRoutes.remove(route); - } - } - - @Override - public synchronized void onSuspend(Route route) { - synchronized (lock) { - suspendedRoutes.remove(route); - } - } - - @Override - protected void doStart() throws Exception { - ObjectHelper.notNull(camelContext, "camelContext"); - ObjectHelper.notNull(serviceName, "serviceName"); - ObjectHelper.notNull(servicePath, "servicePath"); - - if (consul == null) { - Consul.Builder builder = Consul.builder(); - if (consulUrl != null) { - builder.withUrl(consulUrl); - } - - consul = builder.build(); - } - - if (sessionClient == null) { - sessionClient = consul.sessionClient(); - } - if (keyValueClient == null) { - keyValueClient = consul.keyValueClient(); - } - - if (sessionId == null) { - sessionId = sessionClient.createSession( - ImmutableSession.builder() - .name(serviceName) - .ttl(ttl + "s") - .lockDelay(lockDelay + "s") - .build() - ).getId(); - - LOGGER.debug("SessionID = {}", sessionId); - if (executorService == null) { - executorService = getCamelContext().getExecutorServiceManager().newSingleThreadExecutor(this, "ConsulRoutePolicy"); - } - - setLeader(keyValueClient.acquireLock(servicePath, sessionId)); - - executorService.submit(new Watcher()); - } - - super.doStart(); - } - - @Override - protected void doStop() throws Exception { - super.doStop(); - - if (sessionId != null) { - sessionClient.destroySession(sessionId); - sessionId = null; - } - - if (executorService != null) { - getCamelContext().getExecutorServiceManager().shutdownGraceful(executorService); - } - } - - // ************************************************************************* - // - // ************************************************************************* - - protected void setLeader(boolean isLeader) { - if (isLeader && leader.compareAndSet(false, isLeader)) { - LOGGER.debug("Leadership taken ({}, {})", serviceName, sessionId); - startAllStoppedConsumers(); - } else { - if (!leader.getAndSet(isLeader) && isLeader) { - LOGGER.debug("Leadership lost ({}, {})", serviceName, sessionId); - } - } - } - - private void startConsumer(Route route) { - synchronized (lock) { - try { - if (suspendedRoutes.contains(route)) { - startConsumer(route.getConsumer()); - suspendedRoutes.remove(route); - } - } catch (Exception e) { - handleException(e); - } - } - } - - private void stopConsumer(Route route) { - synchronized (lock) { - try { - if (!suspendedRoutes.contains(route)) { - LOGGER.debug("Stopping consumer for {} ({})", route.getId(), route.getConsumer()); - stopConsumer(route.getConsumer()); - suspendedRoutes.add(route); - } - } catch (Exception e) { - handleException(e); - } - } - } - - private void startAllStoppedConsumers() { - synchronized (lock) { - try { - for (Route route : suspendedRoutes) { - LOGGER.debug("Starting consumer for {} ({})", route.getId(), route.getConsumer()); - startConsumer(route.getConsumer()); - } - - suspendedRoutes.clear(); - } catch (Exception e) { - handleException(e); - } - } - } - - // ************************************************************************* - // Getter/Setters - // ************************************************************************* - - @ManagedAttribute(description = "The route id") - public String getRouteId() { - if (route != null) { - return route.getId(); - } - return null; - } - - @ManagedAttribute(description = "The consumer endpoint", mask = true) - public String getEndpointUrl() { - if (route != null && route.getConsumer() != null && route.getConsumer().getEndpoint() != null) { - return route.getConsumer().getEndpoint().toString(); - } - return null; - } - - public Consul getConsul() { - return consul; - } - - @ManagedAttribute(description = "The consul service name") - public String getServiceName() { - return serviceName; - } - - public void setServiceName(String serviceName) { - this.serviceName = serviceName; - this.servicePath = String.format("/service/%s/leader", serviceName); - } - - @ManagedAttribute(description = "The time to live (seconds)") - public int getTtl() { - return ttl; - } - - public void setTtl(int ttl) { - this.ttl = ttl > 10 ? ttl : 10; - } - - @ManagedAttribute(description = "The lock delay (seconds)") - public int getLockDelay() { - return lockDelay; - } - - public void setLockDelay(int lockDelay) { - this.lockDelay = lockDelay > 10 ? lockDelay : 10; - } - - @ManagedAttribute(description = "Whether to stop consumer when starting up and failed to become master") - public boolean isShouldStopConsumer() { - return shouldStopConsumer; - } - - public void setShouldStopConsumer(boolean shouldStopConsumer) { - this.shouldStopConsumer = shouldStopConsumer; - } - - @ManagedAttribute(description = "Is this route the master or a slave") - public boolean isLeader() { - return leader.get(); - } - - // ************************************************************************* - // Watch - // ************************************************************************* - - private class Watcher implements Runnable, ConsulResponseCallback<Optional<Value>> { - - @Override - public void onComplete(ConsulResponse<Optional<Value>> consulResponse) { - if (isRunAllowed()) { - Optional<Value> value = consulResponse.getResponse(); - if (value.isPresent()) { - Optional<String> sid = value.get().getSession(); - if (sid.isPresent() && ObjectHelper.isNotEmpty(sid.get())) { - // If the key is not held by any session, try acquire a - // lock (become leader) - LOGGER.debug("Try to take leadership ..."); - setLeader(keyValueClient.acquireLock(servicePath, sessionId)); - } else if (!sessionId.equals(sid) && leader.get()) { - // Looks like I've lost leadership - setLeader(false); - } - } - - index.set(consulResponse.getIndex()); - run(); - } - } - - @Override - public void onFailure(Throwable throwable) { - handleException(throwable); - } - - @Override - public void run() { - if (isRunAllowed()) { - // Refresh session - sessionClient.renewSession(sessionId); - - keyValueClient.getValue( - servicePath, - QueryOptions.blockSeconds(ttl / 3, index.get()).build(), - this - ); - } - } - } -} diff --git a/components/camel-consul/src/test/java/org/apache/camel/component/consul/policy/ConsulRoutePolicyMain.java b/components/camel-consul/src/test/java/org/apache/camel/component/consul/policy/ConsulRoutePolicyMain.java deleted file mode 100644 index b93181b..0000000 --- a/components/camel-consul/src/test/java/org/apache/camel/component/consul/policy/ConsulRoutePolicyMain.java +++ /dev/null @@ -1,48 +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.component.consul.policy; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.consul.ConsulConstants; -import org.apache.camel.main.Main; - -public final class ConsulRoutePolicyMain { - - private ConsulRoutePolicyMain() { - } - - public static void main(final String[] args) throws Exception { - Main main = new Main(); - main.addRouteBuilder(new RouteBuilder() { - public void configure() { - ConsulRoutePolicy policy = new ConsulRoutePolicy(); - policy.setConsulUrl(ConsulConstants.CONSUL_DEFAULT_URL); - policy.setServiceName(args[0]); - policy.setTtl(15); - - from("file:///tmp/camel?delete=true") - .routeId(args[1]) - .routePolicy(policy) - .setHeader("ConsulRouteID", simple("${routeId}")) - .setHeader("ConsulServiceName", constant(args[0])) - .to("log:org.apache.camel.component.consul?level=INFO&showAll=true"); - } - }); - - main.run(); - } -} diff --git a/components/camel-crypto-cms/src/test/java/org/apache/camel/component/crypto/cms/SpringComponentTest.java b/components/camel-crypto-cms/src/test/java/org/apache/camel/component/crypto/cms/SpringComponentTest.java index e5b9414..f1664a9 100644 --- a/components/camel-crypto-cms/src/test/java/org/apache/camel/component/crypto/cms/SpringComponentTest.java +++ b/components/camel-crypto-cms/src/test/java/org/apache/camel/component/crypto/cms/SpringComponentTest.java @@ -20,12 +20,14 @@ import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.JndiRegistry; import org.apache.camel.spring.SpringCamelContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringComponentTest extends ComponentTest { protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext("SpringCryptoCmsTests.xml"); + return SpringCamelContext.springCamelContext( + new ClassPathXmlApplicationContext("SpringCryptoCmsTests.xml"), true); } @Override diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java index 1fa1727..533efd0 100644 --- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java +++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/PGPDataFormatUtil.java @@ -22,7 +22,6 @@ import java.io.IOException; import java.io.InputStream; import java.security.NoSuchProviderException; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -31,12 +30,9 @@ import org.apache.camel.CamelContext; import org.apache.camel.util.IOHelper; import org.apache.camel.util.ResourceHelper; import org.bouncycastle.bcpg.sig.KeyFlags; -import org.bouncycastle.openpgp.PGPEncryptedDataList; import org.bouncycastle.openpgp.PGPException; -import org.bouncycastle.openpgp.PGPObjectFactory; import org.bouncycastle.openpgp.PGPPrivateKey; import org.bouncycastle.openpgp.PGPPublicKey; -import org.bouncycastle.openpgp.PGPPublicKeyEncryptedData; import org.bouncycastle.openpgp.PGPPublicKeyRing; import org.bouncycastle.openpgp.PGPPublicKeyRingCollection; import org.bouncycastle.openpgp.PGPSecretKey; @@ -64,31 +60,6 @@ public final class PGPDataFormatUtil { private PGPDataFormatUtil() { } - @Deprecated - public static PGPPublicKey findPublicKey(CamelContext context, String filename, String userid, boolean forEncryption) - throws IOException, PGPException, NoSuchProviderException { - return findPublicKey(context, filename, null, userid, forEncryption); - } - - @Deprecated - public static PGPPublicKey findPublicKey(CamelContext context, String filename, byte[] keyRing, String userid, boolean forEncryption) - throws IOException, PGPException, NoSuchProviderException { - - InputStream is = determineKeyRingInputStream(context, filename, keyRing, forEncryption); - - try { - List<PGPPublicKey> result = findPublicKeys(is, Collections.singletonList(userid), forEncryption); - if (result.isEmpty()) { - return null; - } else { - return result.get(0); - } - } finally { - IOHelper.close(is); - } - - } - public static List<PGPPublicKey> findPublicKeys(CamelContext context, String filename, byte[] keyRing, List<String> userids, boolean forEncryption) throws IOException, PGPException, NoSuchProviderException { InputStream is = determineKeyRingInputStream(context, filename, keyRing, forEncryption); @@ -99,19 +70,6 @@ public final class PGPDataFormatUtil { } } - @Deprecated - public static PGPPublicKey findPublicKeyWithKeyId(CamelContext context, String filename, byte[] keyRing, long keyid, - boolean forEncryption) throws IOException, PGPException, NoSuchProviderException { - InputStream is = determineKeyRingInputStream(context, filename, keyRing, forEncryption); - PGPPublicKey pubKey; - try { - pubKey = findPublicKeyWithKeyId(is, keyid); - } finally { - IOHelper.close(is); - } - return pubKey; - } - public static PGPPublicKeyRingCollection getPublicKeyRingCollection(CamelContext context, String filename, byte[] keyRing, boolean forEncryption) throws IOException, PGPException { InputStream is = determineKeyRingInputStream(context, filename, keyRing, forEncryption); try { @@ -190,14 +148,6 @@ public final class PGPDataFormatUtil { return is; } - private static PGPPublicKey findPublicKeyWithKeyId(InputStream input, long keyid) throws IOException, PGPException, - NoSuchProviderException { - PGPPublicKeyRingCollection pgpSec = - new PGPPublicKeyRingCollection(PGPUtil.getDecoderStream(input), - new BcKeyFingerprintCalculator()); - return pgpSec.getPublicKey(keyid); - } - private static List<PGPPublicKey> findPublicKeys(InputStream input, List<String> userids, boolean forEncryption) throws IOException, PGPException, NoSuchProviderException { @@ -284,99 +234,6 @@ public final class PGPDataFormatUtil { return algorithm == RSA_GENERAL || algorithm == RSA_SIGN || algorithm == DSA || algorithm == ECDSA || algorithm == ELGAMAL_GENERAL; } - @Deprecated - public static PGPPrivateKey findPrivateKey(CamelContext context, String keychainFilename, InputStream encryptedInput, String passphrase) - throws IOException, PGPException, NoSuchProviderException { - return findPrivateKey(context, keychainFilename, null, encryptedInput, passphrase, "BC"); - } - - @Deprecated - public static PGPPrivateKey findPrivateKey(CamelContext context, String keychainFilename, byte[] secKeyRing, - InputStream encryptedInput, String passphrase, String provider) throws IOException, PGPException, NoSuchProviderException { - return findPrivateKey(context, keychainFilename, secKeyRing, encryptedInput, passphrase, null, provider); - } - - @Deprecated - public static PGPPrivateKey findPrivateKey(CamelContext context, String keychainFilename, byte[] secKeyRing, - InputStream encryptedInput, String passphrase, PGPPassphraseAccessor passphraseAccessor, String provider) throws IOException, - PGPException, NoSuchProviderException { - - InputStream keyChainInputStream = determineKeyRingInputStream(context, keychainFilename, secKeyRing, true); - PGPPrivateKey privKey = null; - try { - privKey = findPrivateKey(keyChainInputStream, encryptedInput, passphrase, passphraseAccessor, provider); - } finally { - IOHelper.close(keyChainInputStream); - } - return privKey; - } - - @Deprecated - private static PGPPrivateKey findPrivateKey(InputStream keyringInput, InputStream encryptedInput, String passphrase, - PGPPassphraseAccessor passphraseAccessor, String provider) throws IOException, PGPException, NoSuchProviderException { - PGPSecretKeyRingCollection pgpSec = - new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(keyringInput), - new BcKeyFingerprintCalculator()); - PGPObjectFactory factory = new PGPObjectFactory(PGPUtil.getDecoderStream(encryptedInput), - new BcKeyFingerprintCalculator()); - PGPEncryptedDataList enc; - Object o = factory.nextObject(); - if (o == null) { - throw new PGPException("Provided input is not encrypted."); - } - if (o instanceof PGPEncryptedDataList) { - enc = (PGPEncryptedDataList) o; - } else { - enc = (PGPEncryptedDataList) factory.nextObject(); - } - encryptedInput.reset(); // nextObject() method reads from the InputStream, so rewind it! - Iterator<?> encryptedDataObjects = enc.getEncryptedDataObjects(); - PGPPrivateKey privateKey = null; - PGPPublicKeyEncryptedData encryptedData = null; - while (privateKey == null && encryptedDataObjects.hasNext()) { - encryptedData = (PGPPublicKeyEncryptedData) encryptedDataObjects.next(); - PGPSecretKey pgpSecKey = pgpSec.getSecretKey(encryptedData.getKeyID()); - if (pgpSecKey != null) { - if (passphrase == null && passphraseAccessor != null) { - // get passphrase from accessor - @SuppressWarnings("unchecked") - Iterator<String> userIDs = pgpSecKey.getUserIDs(); - while (passphrase == null && userIDs.hasNext()) { - passphrase = passphraseAccessor.getPassphrase(userIDs.next()); - } - } - privateKey = pgpSecKey.extractPrivateKey(new JcePBESecretKeyDecryptorBuilder().setProvider(provider).build( - passphrase.toCharArray())); - } - } - if (privateKey == null && pgpSec.size() > 0 && encryptedData != null) { - throw new PGPException("Provided input is encrypted with unknown pair of keys."); - } - return privateKey; - } - - @Deprecated - public static PGPSecretKey findSecretKey(CamelContext context, String keychainFilename, String passphrase) throws IOException, - PGPException, NoSuchProviderException { - return findSecretKey(context, keychainFilename, null, passphrase, "BC"); - } - - @Deprecated - public static PGPSecretKey findSecretKey(CamelContext context, String keychainFilename, byte[] secKeyRing, String passphrase, - String userId, String provider) throws IOException, PGPException, NoSuchProviderException { - InputStream keyChainInputStream = determineKeyRingInputStream(context, keychainFilename, secKeyRing, false); - try { - List<PGPSecretKeyAndPrivateKeyAndUserId> secKeys = findSecretKeysWithPrivateKeyAndUserId(keyChainInputStream, - Collections.singletonMap(userId, passphrase), provider); - if (!secKeys.isEmpty()) { - return secKeys.get(0).getSecretKey(); - } - return null; - } finally { - IOHelper.close(keyChainInputStream); - } - } - public static List<PGPSecretKeyAndPrivateKeyAndUserId> findSecretKeysWithPrivateKeyAndUserId(CamelContext context, String keychainFilename, byte[] secKeyRing, Map<String, String> sigKeyUserId2Password, String provider) throws IOException, PGPException, NoSuchProviderException { @@ -388,13 +245,6 @@ public final class PGPDataFormatUtil { } } - @Deprecated - public static PGPSecretKey findSecretKey(CamelContext context, String keychainFilename, byte[] secKeyRing, String passphrase, - String provider) throws IOException, PGPException, NoSuchProviderException { - - return findSecretKey(context, keychainFilename, secKeyRing, passphrase, null, provider); - } - private static List<PGPSecretKeyAndPrivateKeyAndUserId> findSecretKeysWithPrivateKeyAndUserId(InputStream keyringInput, Map<String, String> sigKeyUserId2Password, String provider) throws IOException, PGPException, NoSuchProviderException { PGPSecretKeyRingCollection pgpSec = diff --git a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java index d668224..66a34a4 100644 --- a/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java +++ b/components/camel-crypto/src/test/java/org/apache/camel/component/crypto/SpringSignatureTest.java @@ -27,6 +27,7 @@ import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.JndiRegistry; import org.apache.camel.spring.SpringCamelContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringSignatureTest extends SignatureTests { @@ -35,7 +36,8 @@ public class SpringSignatureTest extends SignatureTests { protected CamelContext createCamelContext() throws Exception { rsaPair = getKeyPair("RSA"); - return SpringCamelContext.springCamelContext("org/apache/camel/component/crypto/SpringSignatureTests.xml"); + return SpringCamelContext.springCamelContext( + new ClassPathXmlApplicationContext("org/apache/camel/component/crypto/SpringSignatureTests.xml"), true); } public static KeyStore keystore() throws Exception { diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java index f472690..4139508 100644 --- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java +++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringCryptoDataFormatTest.java @@ -23,6 +23,7 @@ import javax.crypto.KeyGenerator; import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.spring.SpringCamelContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringCryptoDataFormatTest extends CryptoDataFormatTest { @@ -42,7 +43,8 @@ public class SpringCryptoDataFormatTest extends CryptoDataFormatTest { desEdekey = generator.generateKey(); generator = KeyGenerator.getInstance("AES"); aeskey = generator.generateKey(); - return SpringCamelContext.springCamelContext("/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml"); + return SpringCamelContext.springCamelContext( + new ClassPathXmlApplicationContext("/org/apache/camel/component/crypto/SpringCryptoDataFormatTest.xml"), true); } public static Key getDesKey() { diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringPGPDataFormatTest.java b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringPGPDataFormatTest.java index 1c8d6fa..8deb21f 100644 --- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringPGPDataFormatTest.java +++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/SpringPGPDataFormatTest.java @@ -19,11 +19,13 @@ package org.apache.camel.converter.crypto; import org.apache.camel.CamelContext; import org.apache.camel.spring.SpringCamelContext; import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringPGPDataFormatTest extends AbstractPGPDataFormatTest { protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext("/org/apache/camel/component/crypto/SpringPGPDataFormatTest.xml"); + return SpringCamelContext.springCamelContext( + new ClassPathXmlApplicationContext("/org/apache/camel/component/crypto/SpringPGPDataFormatTest.xml"), true); } @Test diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java index 457e9fb..ff959a8 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/AbstractCXFGreeterRouterTest.java @@ -125,7 +125,7 @@ public abstract class AbstractCXFGreeterRouterTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultCauseEnabledTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultCauseEnabledTest.java index 2da5b86..6412435 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultCauseEnabledTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultCauseEnabledTest.java @@ -110,6 +110,6 @@ public class CxfConsumerPayloadFaultCauseEnabledTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java index be5d4bf..6a2aacf 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadMessageXmlBindingRouterTest.java @@ -85,7 +85,7 @@ public class CxfPayLoadMessageXmlBindingRouterTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java index a647fd8..e04d05b 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayLoadSoapHeaderSpringTest.java @@ -49,7 +49,7 @@ public class CxfPayLoadSoapHeaderSpringTest extends CxfPayLoadSoapHeaderTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } protected ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java index c28e79b..595e833 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java @@ -59,7 +59,7 @@ public class CxfPayloadConsumerNamespaceOnEnvelopeTest extends CamelTestSupport @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } @Before diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java index 3129dca..b6efacd 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java @@ -58,7 +58,7 @@ public class CxfPayloadProducerNamespaceOnEnvelopeTest extends CamelTestSupport @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } @Before diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadRouterContentLengthTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadRouterContentLengthTest.java index c894e7d..6c133d4 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadRouterContentLengthTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadRouterContentLengthTest.java @@ -82,7 +82,7 @@ public class CxfPayloadRouterContentLengthTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } @Before diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java index 3f5dc09..dcc1068 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringCustomizedExceptionTest.java @@ -86,7 +86,7 @@ public class CxfSpringCustomizedExceptionTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java index 740556b..568e54c 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfSpringRouterTest.java @@ -56,7 +56,7 @@ public class CxfSpringRouterTest extends CxfSimpleRouterTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java index d7b1b08..407cbbc 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/converter/PayLoadConvertToPOJOTest.java @@ -62,7 +62,7 @@ public class PayLoadConvertToPOJOTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java index 71e70ca..4d58e56 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jms/CxfEndpointJMSConsumerTest.java @@ -15,6 +15,7 @@ * limitations under the License. */ package org.apache.camel.component.cxf.jms; + import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -49,7 +50,7 @@ public class CxfEndpointJMSConsumerTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } protected ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java index 17b7635..74302f7 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/multipart/CXFMultiPartTest.java @@ -105,7 +105,7 @@ public class CXFMultiPartTest extends CamelTestSupport { protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } protected ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java index 4e48268..195a64c 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/util/CxfEndpointUtilsWithSpringTest.java @@ -48,7 +48,7 @@ public class CxfEndpointUtilsWithSpringTest extends CxfEndpointUtilsTest { @Override protected CamelContext getCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } protected ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wssecurity/camel/WSSecurityRouteTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wssecurity/camel/WSSecurityRouteTest.java index 3d02965..18cd34f 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wssecurity/camel/WSSecurityRouteTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/wssecurity/camel/WSSecurityRouteTest.java @@ -56,7 +56,7 @@ public class WSSecurityRouteTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } private static ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConstants.java b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConstants.java index 0d355e3..083240a 100644 --- a/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConstants.java +++ b/components/camel-infinispan/src/main/java/org/apache/camel/component/infinispan/InfinispanConstants.java @@ -41,10 +41,4 @@ public interface InfinispanConstants { String CACHE_ENTRY_LEAVING = "CacheEntryLeaving"; String CACHE_ENTRY_UPDATED = "CacheEntryUpdated"; - /** - * @deprecated use {@link InfinispanOperation#QUERY} instead. - */ - @Deprecated - String QUERY = "CamelInfinispanOperationQuery"; - } diff --git a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanRemoteQueryProducerIT.java b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanRemoteQueryProducerIT.java index f7cd16e..c92471a 100644 --- a/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanRemoteQueryProducerIT.java +++ b/components/camel-infinispan/src/test/java/org/apache/camel/component/infinispan/InfinispanRemoteQueryProducerIT.java @@ -41,7 +41,6 @@ import org.infinispan.query.remote.client.ProtobufMetadataManagerConstants; import org.junit.Test; import static org.apache.camel.component.infinispan.InfinispanConstants.OPERATION; -import static org.apache.camel.component.infinispan.InfinispanConstants.QUERY; import static org.apache.camel.component.infinispan.InfinispanConstants.QUERY_BUILDER; import static org.apache.camel.component.infinispan.util.UserUtils.USERS; import static org.apache.camel.component.infinispan.util.UserUtils.createKey; @@ -193,7 +192,7 @@ public class InfinispanRemoteQueryProducerIT extends CamelTestSupport { return new Processor() { @Override public void process(Exchange exchange) throws Exception { - exchange.getIn().setHeader(OPERATION, QUERY); + exchange.getIn().setHeader(OPERATION, InfinispanOperation.QUERY); if (builder != null) { exchange.getIn().setHeader(QUERY_BUILDER, builder); } diff --git a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbNoNamespaceSchemaLocationSpringTest.java b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbNoNamespaceSchemaLocationSpringTest.java index 2e43cea..15168d4 100644 --- a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbNoNamespaceSchemaLocationSpringTest.java +++ b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbNoNamespaceSchemaLocationSpringTest.java @@ -38,7 +38,7 @@ public class CamelJaxbNoNamespaceSchemaLocationSpringTest extends CamelJaxbNoNam } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbSpringTest.java b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbSpringTest.java index f6e0f9d..c549fab 100644 --- a/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbSpringTest.java +++ b/components/camel-jaxb/src/test/java/org/apache/camel/jaxb/CamelJaxbSpringTest.java @@ -38,7 +38,7 @@ public class CamelJaxbSpringTest extends CamelJaxbTest { } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } diff --git a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java index 9ce8c25..0f6e2c0 100644 --- a/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java +++ b/components/camel-jibx/src/test/java/org/apache/camel/dataformat/jibx/JibxDataFormatSpringDslTest.java @@ -100,6 +100,6 @@ public class JibxDataFormatSpringDslTest extends CamelTestSupport { } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-jms/src/main/docs/jms-component.adoc b/components/camel-jms/src/main/docs/jms-component.adoc index 2e47252..3d16499 100644 --- a/components/camel-jms/src/main/docs/jms-component.adoc +++ b/components/camel-jms/src/main/docs/jms-component.adoc @@ -426,7 +426,7 @@ with the following path and query parameters: === Spring Boot Auto-Configuration -The component supports 172 options, which are listed below. +The component supports 171 options, which are listed below. @@ -529,7 +529,6 @@ The component supports 172 options, which are listed below. | *camel.component.jms.configuration.test-connection-on-startup* | Specifies whether to test the connection on startup. This ensures that when Camel starts that all the JMS consumers have a valid connection to the JMS broker. If a connection cannot be granted then Camel throws an exception on startup. This ensures that Camel is not started with failed connections. The JMS producers is tested as well. | false | Boolean | *camel.component.jms.configuration.time-to-live* | When sending messages, specifies the time-to-live of the message (in milliseconds). | -1 | Long | *camel.component.jms.configuration.transacted* | Specifies whether to use transacted mode | false | Boolean -| *camel.component.jms.configuration.transacted-in-out* | | | Boolean | *camel.component.jms.configuration.transaction-manager* | The Spring transaction manager to use. | | PlatformTransaction Manager | *camel.component.jms.configuration.transaction-name* | The name of the transaction to use. | | String | *camel.component.jms.configuration.transaction-timeout* | The timeout value of the transaction (in seconds), if using transacted mode. | -1 | Integer @@ -1418,13 +1417,6 @@ messaging: The `transacted` property applies *only* to the InOnly message Exchange Pattern (MEP). -The `transactedInOut` property applies to the -InOut(Request Reply) message -Exchange Pattern (MEP). - -If you want to use transactions for link:request-reply.html[Request -Reply](InOut MEP), you *must* set `transactedInOut=true`. - *Available as of Camel 2.10* You can leverage the diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java index 12d6875..d455567 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsComponent.java @@ -131,7 +131,6 @@ public class JmsComponent extends HeaderFilterStrategyComponent implements Appli JmsConfiguration template = new JmsConfiguration(connectionFactory); template.setTransactionManager(transactionManager); template.setTransacted(true); - template.setTransactedInOut(true); return jmsComponent(template); } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java index 8a471b9..16cf424 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java @@ -252,8 +252,6 @@ public class JmsConfiguration implements Cloneable { @UriParam(label = "transaction", description = "Specifies whether to use transacted mode") private boolean transacted; - @Deprecated - private boolean transactedInOut; @UriParam(defaultValue = "true", label = "transaction,advanced", description = "If true, Camel will create a JmsTransactionManager, if there is no transactionManager injected when option transacted=true.") private boolean lazyCreateTransactionManager = true; @@ -655,18 +653,13 @@ public class JmsConfiguration implements Cloneable { jmsTemplate.setTimeToLive(ttl); } - jmsTemplate.setSessionTransacted(isTransactedInOut()); - if (isTransactedInOut()) { - jmsTemplate.setSessionAcknowledgeMode(Session.SESSION_TRANSACTED); + if (acknowledgementMode >= 0) { + jmsTemplate.setSessionAcknowledgeMode(acknowledgementMode); + } else if (acknowledgementModeName != null) { + jmsTemplate.setSessionAcknowledgeModeName(acknowledgementModeName); } else { - if (acknowledgementMode >= 0) { - jmsTemplate.setSessionAcknowledgeMode(acknowledgementMode); - } else if (acknowledgementModeName != null) { - jmsTemplate.setSessionAcknowledgeModeName(acknowledgementModeName); - } else { - // default to AUTO - jmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE); - } + // default to AUTO + jmsTemplate.setSessionAcknowledgeMode(Session.AUTO_ACKNOWLEDGE); } } return answer; @@ -1359,21 +1352,6 @@ public class JmsConfiguration implements Cloneable { this.transacted = consumerTransacted; } - /** - * Should InOut operations (request reply) default to using transacted mode? - * <p> - * By default this is false as you need to commit the outgoing request before you can consume the input - */ - @Deprecated - public boolean isTransactedInOut() { - return transactedInOut; - } - - @Deprecated - public void setTransactedInOut(boolean transactedInOut) { - this.transactedInOut = transactedInOut; - } - public boolean isLazyCreateTransactionManager() { return lazyCreateTransactionManager; } diff --git a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java index 05fb265..83c14b2 100644 --- a/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java +++ b/components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsEndpoint.java @@ -792,12 +792,6 @@ public class JmsEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade } @ManagedAttribute - @Deprecated - public boolean isTransactedInOut() { - return getConfiguration().isTransactedInOut(); - } - - @ManagedAttribute public boolean isUseMessageIDAsCorrelationID() { return getConfiguration().isUseMessageIDAsCorrelationID(); } @@ -1042,12 +1036,6 @@ public class JmsEndpoint extends DefaultEndpoint implements AsyncEndpoint, Heade } @ManagedAttribute - @Deprecated - public void setTransactedInOut(boolean transactedInOut) { - getConfiguration().setTransactedInOut(transactedInOut); - } - - @ManagedAttribute public void setLazyCreateTransactionManager(boolean lazyCreating) { getConfiguration().setLazyCreateTransactionManager(lazyCreating); } diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java index 4ea9ebb..6ffbd28 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsEndpointConfigurationTest.java @@ -254,7 +254,6 @@ public class JmsEndpointConfigurationTest extends CamelTestSupport { assertTrue(endpoint.getConfiguration().isLazyCreateTransactionManager()); } - @SuppressWarnings("deprecation") @Test public void testDefaultEndpointOptions() throws Exception { JmsEndpoint endpoint = resolveMandatoryEndpoint("jms:queue:Foo", JmsEndpoint.class); @@ -349,12 +348,10 @@ public class JmsEndpointConfigurationTest extends CamelTestSupport { assertFalse(endpoint.isTransacted()); assertFalse(endpoint.isTransferExchange()); assertFalse(endpoint.isTransferException()); - assertFalse(endpoint.isTransactedInOut()); assertFalse(endpoint.isTransferException()); assertFalse(endpoint.isFormatDateHeadersToIso8601()); } - @SuppressWarnings("deprecation") @Test public void testSettingEndpointOptions() throws Exception { JmsEndpoint endpoint = resolveMandatoryEndpoint("jms:queue:Foo", JmsEndpoint.class); @@ -478,9 +475,6 @@ public class JmsEndpointConfigurationTest extends CamelTestSupport { endpoint.setTransacted(true); assertTrue(endpoint.isTransacted()); - endpoint.setTransactedInOut(true); - assertTrue(endpoint.isTransactedInOut()); - endpoint.setTransferExchange(true); assertTrue(endpoint.isTransferExchange()); diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringWithSpringTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringWithSpringTest.java index 9825ad1..789901b 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringWithSpringTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsHeaderFilteringWithSpringTest.java @@ -33,7 +33,7 @@ public class JmsHeaderFilteringWithSpringTest extends JmsHeaderFilteringTest { @Override protected CamelContext createCamelContext() throws Exception { applicationContext = createApplicationContext(); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } private ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringTest.java index 960d8a2..7cba576 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsRouteUsingSpringTest.java @@ -31,7 +31,7 @@ public class JmsRouteUsingSpringTest extends JmsRouteTest { @Override protected CamelContext createCamelContext() throws Exception { applicationContext = createApplicationContext(); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } protected ClassPathXmlApplicationContext createApplicationContext() { diff --git a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java index 2213d20..a50f5f2 100644 --- a/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java +++ b/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.java @@ -18,6 +18,7 @@ package org.apache.camel.component.jms; import org.apache.camel.CamelContext; import org.apache.camel.spring.SpringCamelContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Unit test for Camel loadbalancer failover with JMS @@ -30,7 +31,8 @@ public class JmsSpringLoadBalanceFailoverTest extends JmsLoadBalanceFailoverTest } protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext("org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml"); + return SpringCamelContext.springCamelContext( + new ClassPathXmlApplicationContext("org/apache/camel/component/jms/JmsSpringLoadBalanceFailoverTest.xml"), true); } } \ No newline at end of file diff --git a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/AbstractJpaTest.java b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/AbstractJpaTest.java index 733785d..a0ae850 100644 --- a/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/AbstractJpaTest.java +++ b/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/AbstractJpaTest.java @@ -62,7 +62,7 @@ public abstract class AbstractJpaTest extends CamelTestSupport { @Override protected CamelContext createCamelContext() throws Exception { applicationContext = new ClassPathXmlApplicationContext(routeXml()); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } protected void cleanupRepository() { diff --git a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/AbstractMongoDbTest.java b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/AbstractMongoDbTest.java index 320a465..afbedb7 100644 --- a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/AbstractMongoDbTest.java +++ b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/AbstractMongoDbTest.java @@ -78,7 +78,7 @@ public abstract class AbstractMongoDbTest extends CamelTestSupport { protected CamelContext createCamelContext() throws Exception { applicationContext = new AnnotationConfigApplicationContext(EmbedMongoConfiguration.class); @SuppressWarnings("deprecation") - CamelContext ctx = SpringCamelContext.springCamelContext(applicationContext); + CamelContext ctx = SpringCamelContext.springCamelContext(applicationContext, true); PropertiesComponent pc = new PropertiesComponent("classpath:mongodb.test.properties"); ctx.addComponent("properties", pc); return ctx; diff --git a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbSpringDslOperationsTest.java b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbSpringDslOperationsTest.java index b0e7edc..3d39440 100644 --- a/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbSpringDslOperationsTest.java +++ b/components/camel-mongodb3/src/test/java/org/apache/camel/component/mongodb3/MongoDbSpringDslOperationsTest.java @@ -27,7 +27,7 @@ public class MongoDbSpringDslOperationsTest extends MongoDbOperationsTest { protected CamelContext createCamelContext() throws Exception { applicationContext = new AnnotationConfigApplicationContext(MongoBasicOperationsConfiguration.class); @SuppressWarnings("deprecation") - CamelContext ctx = SpringCamelContext.springCamelContext(applicationContext); + CamelContext ctx = SpringCamelContext.springCamelContext(applicationContext, true); return ctx; } diff --git a/components/camel-msv/src/main/docs/msv-component.adoc b/components/camel-msv/src/main/docs/msv-component.adoc index 1527da0..9b62eb1 100644 --- a/components/camel-msv/src/main/docs/msv-component.adoc +++ b/components/camel-msv/src/main/docs/msv-component.adoc @@ -89,7 +89,7 @@ with the following path and query parameters: |=== -==== Query Parameters (11 parameters): +==== Query Parameters (10 parameters): [width="100%",cols="2,5,^1,2",options="header"] @@ -104,7 +104,6 @@ with the following path and query parameters: | *schemaFactory* (advanced) | To use a custom javax.xml.validation.SchemaFactory | | SchemaFactory | *schemaLanguage* (advanced) | Configures the W3C XML Schema Namespace URI. | http://www.w3.org/2001/XMLSchema | String | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean -| *useDom* (advanced) | Whether DOMSource/DOMResult or SaxSource/SaxResult should be used by the validator. | false | boolean | *useSharedSchema* (advanced) | Whether the Schema instance should be shared or not. This option is introduced to work around a JDK 1.6.x bug. Xerces should not have this issue. | true | boolean |=== // endpoint options: END diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/AnyLanguageFilterTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/AnyLanguageFilterTest.java index 992d96c..6904163 100644 --- a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/AnyLanguageFilterTest.java +++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/AnyLanguageFilterTest.java @@ -40,7 +40,7 @@ public class AnyLanguageFilterTest extends XPathFilterTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/anyLanguageFilter.xml")); + return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/anyLanguageFilter.xml"), true); } } \ No newline at end of file diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/BeanShellFilterTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/BeanShellFilterTest.java index d49284a..dbc1853 100644 --- a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/BeanShellFilterTest.java +++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/BeanShellFilterTest.java @@ -40,7 +40,7 @@ public class BeanShellFilterTest extends XPathFilterTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/beanShellFilter.xml")); + return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/beanShellFilter.xml"), true); } } \ No newline at end of file diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/GroovyFilterTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/GroovyFilterTest.java index b24babd..f191c7e 100644 --- a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/GroovyFilterTest.java +++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/GroovyFilterTest.java @@ -40,6 +40,6 @@ public class GroovyFilterTest extends XPathFilterTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/groovyFilter.xml")); + return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/groovyFilter.xml"), true); } } diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/JavaScriptFilterTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/JavaScriptFilterTest.java index 07ca921..0b3a30a 100644 --- a/components/camel-script/src/test/java/org/apache/camel/builder/script/example/JavaScriptFilterTest.java +++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/example/JavaScriptFilterTest.java @@ -40,7 +40,7 @@ public class JavaScriptFilterTest extends XPathFilterTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/javaScriptFilter.xml")); + return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/builder/script/example/javaScriptFilter.xml"), true); } } \ No newline at end of file diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java index 7eb6650..b4b0d5f 100644 --- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java +++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackComponentVerifierExtension.java @@ -34,7 +34,7 @@ import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; +import org.json.simple.Jsoner; import static org.apache.camel.component.slack.utils.SlackUtils.readResponse; @@ -123,8 +123,7 @@ public class SlackComponentVerifierExtension extends DefaultComponentVerifierExt if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 299) { builder.error(ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, "Invalid token").parameterKey("token").build()); } - JSONParser parser = new JSONParser(); - JSONObject obj = (JSONObject)parser.parse(jsonString); + JSONObject obj = (JSONObject) Jsoner.deserialize(jsonString); if (obj.get("ok") != null && obj.get("ok").equals(false)) { builder.error(ResultErrorBuilder.withCodeAndDescription(VerificationError.StandardCode.AUTHENTICATION, "Invalid token").parameterKey("token").build()); } diff --git a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java index 5c665d5..7e6bb12 100644 --- a/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java +++ b/components/camel-slack/src/main/java/org/apache/camel/component/slack/SlackConsumer.java @@ -35,9 +35,12 @@ import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.message.BasicNameValuePair; +import org.json.simple.DeserializationException; import org.json.simple.JSONObject; +import org.json.simple.JsonArray; +import org.json.simple.JsonObject; +import org.json.simple.Jsoner; import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +54,7 @@ public class SlackConsumer extends ScheduledBatchPollingConsumer { private String timestamp; private String channelId; - public SlackConsumer(SlackEndpoint endpoint, Processor processor) throws IOException, ParseException { + public SlackConsumer(SlackEndpoint endpoint, Processor processor) throws IOException, DeserializationException { super(endpoint, processor); this.slackEndpoint = endpoint; this.channelId = getChannelId(slackEndpoint.getChannel()); @@ -128,7 +131,7 @@ public class SlackConsumer extends ScheduledBatchPollingConsumer { return total; } - private String getChannelId(String channel) throws IOException, ParseException { + private String getChannelId(String channel) throws IOException, DeserializationException { HttpClient client = HttpClientBuilder.create().useSystemProperties().build(); HttpPost httpPost = new HttpPost("https://slack.com/api/channels.list"); @@ -139,24 +142,18 @@ public class SlackConsumer extends ScheduledBatchPollingConsumer { HttpResponse response = client.execute(httpPost); String jsonString = readResponse(response); - JSONParser parser = new JSONParser(); - - JSONObject c = (JSONObject)parser.parse(jsonString); - List list = (List)c.get("channels"); - Iterator it = list.iterator(); - int i = 0; - while (it.hasNext()) { - Object object = (Object)it.next(); - JSONObject singleChannel = (JSONObject)object; + JsonObject c = (JsonObject) Jsoner.deserialize(jsonString); + JsonArray list = (JsonArray) c.getCollection("channels"); + for (JsonObject singleChannel : (List<JsonObject>)(List) list) { if (singleChannel.get("name") != null) { if (singleChannel.get("name").equals(channel)) { if (singleChannel.get("id") != null) { - return (String)singleChannel.get("id"); + return (String) singleChannel.get("id"); } } } - } + return jsonString; } diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java index e1f299f..b089318 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java @@ -122,9 +122,6 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr private String autoStartup; @XmlAttribute @Metadata(defaultValue = "true") private String shutdownEager; - @XmlAttribute @Metadata(defaultValue = "false") - @Deprecated - private String registerEndpointIdsFromRoute; @XmlAttribute private String useMDCLogging; @XmlAttribute @@ -761,19 +758,6 @@ public class CamelContextFactoryBean extends AbstractCamelContextFactoryBean<Spr this.shutdownEager = shutdownEager; } - public String getRegisterEndpointIdsFromRoute() { - return registerEndpointIdsFromRoute; - } - - /** - * Sets whether to register endpoints that has id attribute assigned in the Spring registry. - * <p/> - * This mode is by default false, but can be turned on for backwards compatibility. - */ - public void setRegisterEndpointIdsFromRoute(String registerEndpointIdsFromRoute) { - this.registerEndpointIdsFromRoute = registerEndpointIdsFromRoute; - } - public String getUseMDCLogging() { return useMDCLogging; } diff --git a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java index 68d23b1..0c14573 100644 --- a/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java +++ b/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java @@ -41,7 +41,6 @@ import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.Lifecycle; import org.springframework.context.Phased; import org.springframework.context.event.ContextRefreshedEvent; -import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.Ordered; import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException; @@ -85,15 +84,6 @@ public class SpringCamelContext extends DefaultCamelContext implements Lifecycle * using the Spring API. */ @Deprecated - public static SpringCamelContext springCamelContext(ApplicationContext applicationContext) throws Exception { - return springCamelContext(applicationContext, true); - } - - /** - * @deprecated its better to create and boot Spring the standard Spring way and to get hold of CamelContext - * using the Spring API. - */ - @Deprecated public static SpringCamelContext springCamelContext(ApplicationContext applicationContext, boolean maybeStart) throws Exception { if (applicationContext != null) { // lets try and look up a configured camel context in the context @@ -110,15 +100,6 @@ public class SpringCamelContext extends DefaultCamelContext implements Lifecycle return answer; } - /** - * @deprecated its better to create and boot Spring the standard Spring way and to get hold of CamelContext - * using the Spring API. - */ - @Deprecated - public static SpringCamelContext springCamelContext(String configLocations) throws Exception { - return springCamelContext(new ClassPathXmlApplicationContext(configLocations)); - } - @Override public void start() { // for example from unit testing we want to start Camel later (manually) @@ -221,16 +202,6 @@ public class SpringCamelContext extends DefaultCamelContext implements Lifecycle } } - @Deprecated - public EventEndpoint getEventEndpoint() { - return null; - } - - @Deprecated - public void setEventEndpoint(EventEndpoint eventEndpoint) { - // noop - } - /** * Whether to shutdown this {@link org.apache.camel.spring.SpringCamelContext} eager (first) * when Spring {@link org.springframework.context.ApplicationContext} is being stopped. diff --git a/components/camel-spring/src/test/java/org/apache/camel/component/log/SpringLogMaskTest.java b/components/camel-spring/src/test/java/org/apache/camel/component/log/SpringLogMaskTest.java index c224b5e..ca533b0 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/component/log/SpringLogMaskTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/component/log/SpringLogMaskTest.java @@ -34,7 +34,7 @@ public class SpringLogMaskTest { @Test public void testLogMask() throws Exception { final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/log/SpringLogMaskTest-context.xml"); - SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext); + SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext, true); context.start(); MockEndpoint mock = context.getEndpoint("mock:mask", MockEndpoint.class); ProducerTemplate template = context.createProducerTemplate(); @@ -47,7 +47,7 @@ public class SpringLogMaskTest { @Test public void testLogMaskDisabled() throws Exception { final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/log/SpringLogMaskTest-context.xml"); - SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext); + SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext, true); context.start(); MockEndpoint mock = context.getEndpoint("mock:no-mask", MockEndpoint.class); ProducerTemplate template = context.createProducerTemplate(); @@ -60,7 +60,7 @@ public class SpringLogMaskTest { @Test public void testCustomLogMask() throws Exception { final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/component/log/SpringCustomLogMaskTest-context.xml"); - SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext); + SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext, true); MockMaskingFormatter customFormatter = applicationContext.getBean(Constants.CUSTOM_LOG_MASK_REF, MockMaskingFormatter.class); context.start(); ProducerTemplate template = context.createProducerTemplate(); diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java index 6de29ec..d27d3dd 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/SpringTestSupport.java @@ -24,7 +24,6 @@ import java.util.Set; import org.apache.camel.CamelContext; import org.apache.camel.ContextTestSupport; -import org.apache.camel.core.xml.AbstractCamelContextFactoryBean; import org.apache.camel.impl.DefaultPackageScanClassResolver; import org.apache.camel.impl.scan.AssignableToPackageScanFilter; import org.apache.camel.impl.scan.InvertingPackageScanFilter; @@ -143,7 +142,7 @@ public abstract class SpringTestSupport extends ContextTestSupport { @SuppressWarnings("deprecation") @Override protected CamelContext createCamelContext() throws Exception { - CamelContext context = SpringCamelContext.springCamelContext(applicationContext); + CamelContext context = SpringCamelContext.springCamelContext(applicationContext, true); return context; } diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java index 311dadd..f2c7721 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/example/SpringXPathFilterTest.java @@ -33,7 +33,7 @@ public class SpringXPathFilterTest extends XPathFilterTest { @Override protected CamelContext createCamelContext() throws Exception { - return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/spring/example/xpathFilter.xml")); + return SpringCamelContext.springCamelContext(new ClassPathXmlApplicationContext("org/apache/camel/spring/example/xpathFilter.xml"), true); } } diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringLogEipMaskTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringLogEipMaskTest.java index 4127ad0..6614980 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringLogEipMaskTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringLogEipMaskTest.java @@ -30,7 +30,7 @@ public class SpringLogEipMaskTest { @Test public void testLogEipMask() throws Exception { final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/logEipMaskTest.xml"); - SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext); + SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext, true); MockEndpoint mock = context.getEndpoint("mock:foo", MockEndpoint.class); mock.expectedMessageCount(1); context.start(); @@ -43,7 +43,7 @@ public class SpringLogEipMaskTest { @Test public void testCustomFormatter() throws Exception { final AbstractXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("org/apache/camel/spring/processor/logEipCustomFormatterTest.xml"); - SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext); + SpringCamelContext context = SpringCamelContext.springCamelContext(applicationContext, true); context.start(); MockMaskingFormatter customFormatter = applicationContext.getBean(Constants.CUSTOM_LOG_MASK_REF, MockMaskingFormatter.class); context.createProducerTemplate().sendBody("direct:foo", "mock password=\"my passw0rd!\""); diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java index 81c8699..a9131ec 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/processor/SpringTestHelper.java @@ -45,6 +45,6 @@ public final class SpringTestHelper { } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java index 5a5806e..6d9ec49 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingBeanConverterTest.java @@ -33,7 +33,7 @@ public class SpringRemotingBeanConverterTest extends Assert { public void testBeanRoutes() throws Exception { AbstractXmlApplicationContext applicationContext = createApplicationContext(); - CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext); + CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext, true); Invoker invoker = applicationContext.getBean("invokerProxy", Invoker.class); String response = invoker.invoke(new Bean.SubClass()); diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java index 1729832..a7d0df7 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingRouteTest.java @@ -32,7 +32,7 @@ public class SpringRemotingRouteTest extends Assert { @Test public void testBeanRoutes() throws Exception { AbstractXmlApplicationContext applicationContext = createApplicationContext(); - CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext); + CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext, true); // START SNIPPET: invoke ISay proxy = applicationContext.getBean("sayProxy", ISay.class); diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java index c0dbefd..9629e7b 100644 --- a/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/remoting/SpringRemotingTwoCamelContextTest.java @@ -29,7 +29,7 @@ public class SpringRemotingTwoCamelContextTest extends Assert { @Test public void testProxyWithTwoCamelContext() throws Exception { AbstractXmlApplicationContext applicationContext = createApplicationContext(); - CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext); + CamelContext camelContext = SpringCamelContext.springCamelContext(applicationContext, true); ISay proxy = applicationContext.getBean("sayProxy1", ISay.class); String rc = proxy.say(); diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerCorsFilter.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerCorsFilter.java deleted file mode 100644 index 49a4605..0000000 --- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerCorsFilter.java +++ /dev/null @@ -1,118 +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.swagger.servlet; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Map; -import javax.servlet.Filter; -import javax.servlet.FilterChain; -import javax.servlet.FilterConfig; -import javax.servlet.ServletException; -import javax.servlet.ServletRequest; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletResponse; - -import org.apache.camel.spi.RestConfiguration; - -/** - * A simple CORS filter that can used to allow the swagger ui or other API browsers from remote origins to access the - * Rest services exposes by this Camel swagger component. - * <p/> - * You can configure CORS headers in the init parameters to the Servlet Filter using the names: - * <ul> - * <li>Access-Control-Allow-Origin</li> - * <li>Access-Control-Allow-Methods</li> - * <li>Access-Control-Allow-Headers</li> - * <li>Access-Control-Max-Age</li> - * </ul> - * If a parameter is not configured then the default value is used. - * The default values are defined as: - * <ul> - * <li>{@link RestConfiguration#CORS_ACCESS_CONTROL_ALLOW_ORIGIN}</li> - * <li>{@link RestConfiguration#CORS_ACCESS_CONTROL_ALLOW_METHODS}</li> - * <li>{@link RestConfiguration#CORS_ACCESS_CONTROL_ALLOW_HEADERS}</li> - * <li>{@link RestConfiguration#CORS_ACCESS_CONTROL_MAX_AGE}</li> - * </ul> - * - * @deprecated do not use this directly but use rest-dsl the regular way with rest-dsl configuration. - */ -@Deprecated -public class RestSwaggerCorsFilter implements Filter { - - private final Map<String, String> corsHeaders = new HashMap<>(); - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - String s = filterConfig.getInitParameter("Access-Control-Allow-Origin"); - if (s != null) { - corsHeaders.put("Access-Control-Allow-Origin", s); - } - s = filterConfig.getInitParameter("Access-Control-Allow-Methods"); - if (s != null) { - corsHeaders.put("Access-Control-Allow-Methods", s); - } - s = filterConfig.getInitParameter("Access-Control-Allow-Headers"); - if (s != null) { - corsHeaders.put("Access-Control-Allow-Headers", s); - } - s = filterConfig.getInitParameter("Access-Control-Max-Age"); - if (s != null) { - corsHeaders.put("Access-Control-Max-Age", s); - } - } - - @Override - public void destroy() { - // noop - } - - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - - setupCorsHeaders(res, corsHeaders); - - chain.doFilter(request, response); - } - - private static void setupCorsHeaders(HttpServletResponse response, Map<String, String> corsHeaders) { - // use default value if none has been configured - String allowOrigin = corsHeaders != null ? corsHeaders.get("Access-Control-Allow-Origin") : null; - if (allowOrigin == null) { - allowOrigin = RestConfiguration.CORS_ACCESS_CONTROL_ALLOW_ORIGIN; - } - String allowMethods = corsHeaders != null ? corsHeaders.get("Access-Control-Allow-Methods") : null; - if (allowMethods == null) { - allowMethods = RestConfiguration.CORS_ACCESS_CONTROL_ALLOW_METHODS; - } - String allowHeaders = corsHeaders != null ? corsHeaders.get("Access-Control-Allow-Headers") : null; - if (allowHeaders == null) { - allowHeaders = RestConfiguration.CORS_ACCESS_CONTROL_ALLOW_HEADERS; - } - String maxAge = corsHeaders != null ? corsHeaders.get("Access-Control-Max-Age") : null; - if (maxAge == null) { - maxAge = RestConfiguration.CORS_ACCESS_CONTROL_MAX_AGE; - } - - response.setHeader("Access-Control-Allow-Origin", allowOrigin); - response.setHeader("Access-Control-Allow-Methods", allowMethods); - response.setHeader("Access-Control-Allow-Headers", allowHeaders); - response.setHeader("Access-Control-Max-Age", maxAge); - } - -} diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java deleted file mode 100644 index c784a8e..0000000 --- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/RestSwaggerServlet.java +++ /dev/null @@ -1,263 +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.swagger.servlet; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import io.swagger.jaxrs.config.BeanConfig; -import org.apache.camel.impl.DefaultClassResolver; -import org.apache.camel.spi.ClassResolver; -import org.apache.camel.spi.RestConfiguration; -import org.apache.camel.swagger.RestApiResponseAdapter; -import org.apache.camel.swagger.RestSwaggerSupport; -import org.apache.camel.util.EndpointHelper; -import org.apache.camel.util.ObjectHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import static org.apache.camel.swagger.SwaggerHelper.buildUrl; - -/** - * The default Camel swagger servlet to use when exposing the APIs of the rest-dsl using swagger. - * <p/> - * This requires Camel version 2.15 or better at runtime (and JMX to be enabled). - * - * @deprecated do not use this directly but use rest-dsl the regular way with rest-dsl configuration. - */ -@Deprecated -public class RestSwaggerServlet extends HttpServlet { - - private static final Logger LOG = LoggerFactory.getLogger(RestSwaggerServlet.class); - private final BeanConfig swaggerConfig = new BeanConfig(); - private final RestSwaggerSupport support = new RestSwaggerSupport(); - private final ClassResolver classResolver = new DefaultClassResolver(); - private volatile boolean initDone; - - private String apiContextIdPattern; - private boolean apiContextIdListing; - private boolean translateContextPath = true; - - public String getApiContextIdPattern() { - return apiContextIdPattern; - } - - /** - * Optional CamelContext id pattern to only allow Rest APIs from rest services within CamelContext's which name matches the pattern. - * <p/> - * The pattern uses the rules from {@link org.apache.camel.util.EndpointHelper#matchPattern(String, String)} - * - * @param apiContextIdPattern the pattern - */ - public void setApiContextIdPattern(String apiContextIdPattern) { - this.apiContextIdPattern = apiContextIdPattern; - } - - public boolean isApiContextIdListing() { - return apiContextIdListing; - } - - /** - * Sets whether listing of all available CamelContext's with REST services in the JVM is enabled. If enabled it allows to discover - * these contexts, if <tt>false</tt> then only if there is exactly one CamelContext then its used. - */ - public void setApiContextIdListing(boolean apiContextIdListing) { - this.apiContextIdListing = apiContextIdListing; - } - - public boolean isTranslateContextPath() { - return translateContextPath; - } - - /** - * Sets whether the context path of the request should be translated (true) or used as-is (false) - * Optional, Defaults to true - */ - public void setTranslateContextPath(boolean translateContextPath) { - this.translateContextPath = translateContextPath; - } - - @Override - public void init(final ServletConfig config) throws ServletException { - super.init(config); - Map<String, Object> parameters = new HashMap<>(); - Enumeration en = config.getInitParameterNames(); - while (en.hasMoreElements()) { - String name = (String) en.nextElement(); - Object value = config.getInitParameter(name); - parameters.put(name, value); - } - // when using servlet then use the cors filter to enable cors - if (parameters.get("cors") != null) { - LOG.warn("Use RestSwaggerCorsFilter when uisng this Servlet to enable CORS"); - parameters.remove("cors"); - } - support.initSwagger(swaggerConfig, parameters); - - // allow to configure these options from the servlet config as well - Object pattern = parameters.remove("apiContextIdPattern"); - if (pattern != null) { - apiContextIdPattern = pattern.toString(); - } - Object listing = parameters.remove("apiContextIdListing"); - if (listing != null) { - apiContextIdListing = Boolean.valueOf(listing.toString()); - } - Object translate = parameters.remove("translateContextPath"); - if (translate != null) { - translateContextPath = Boolean.valueOf(translate.toString()); - } - } - - @Override - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - - if (!initDone) { - initBaseAndApiPaths(request); - } - - String contextId = null; - String route = request.getPathInfo(); - String accept = request.getHeader("Accept"); - - // whether to use json or yaml - boolean json = false; - boolean yaml = false; - if (route != null && route.endsWith("/swagger.json")) { - json = true; - route = route.substring(0, route.length() - 13); - } else if (route != null && route.endsWith("/swagger.yaml")) { - yaml = true; - route = route.substring(0, route.length() - 13); - } - if (accept != null && !json && !yaml) { - json = accept.toLowerCase(Locale.US).contains("json"); - yaml = accept.toLowerCase(Locale.US).contains("yaml"); - } - if (!json && !yaml) { - // json is default - json = true; - } - - RestApiResponseAdapter adapter = new ServletRestApiResponseAdapter(response); - - try { - // render list of camel contexts as root - if (apiContextIdListing && (ObjectHelper.isEmpty(route) || route.equals("/"))) { - support.renderCamelContexts(adapter, contextId, apiContextIdPattern, json, yaml, null); - } else { - String name = null; - if (ObjectHelper.isNotEmpty(route)) { - // first part is the camel context - if (route.startsWith("/")) { - route = route.substring(1); - } - // the remainder is the route part - name = route.split("/")[0]; - if (ObjectHelper.isNotEmpty(name)) { - route = route.substring(name.length()); - } - } else { - // listing not enabled then see if there is only one CamelContext and use that as the name - List<String> contexts = support.findCamelContexts(); - if (contexts.size() == 1) { - name = contexts.get(0); - } - } - - boolean match = false; - if (name != null) { - match = true; - if (apiContextIdPattern != null) { - if ("#name#".equals(apiContextIdPattern)) { - // always match as we do not know what is the current CamelContext in a plain servlet - match = true; - } else { - match = EndpointHelper.matchPattern(name, apiContextIdPattern); - } - if (LOG.isDebugEnabled()) { - LOG.debug("Match contextId: {} with pattern: {} -> {}", name, apiContextIdPattern, match); - } - } - } - - if (!match) { - adapter.noContent(); - } else { - support.renderResourceListing(adapter, swaggerConfig, name, route, json, yaml, classResolver, new RestConfiguration()); - } - } - } catch (Exception e) { - LOG.warn("Error rendering Swagger API due " + e.getMessage(), e); - } - } - - private void initBaseAndApiPaths(HttpServletRequest request) throws MalformedURLException { - String base = swaggerConfig.getBasePath(); - if (base == null || !base.startsWith("http")) { - // base path is configured using relative, so lets calculate the absolute url now we have the http request - URL url = new URL(request.getRequestURL().toString()); - if (base == null) { - base = ""; - } - String path = translateContextPath(request); - - // setup host if not configured - if (swaggerConfig.getHost() == null) { - swaggerConfig.setHost(url.getHost()); - if (url.getPort() != 80 && url.getPort() != -1) { - swaggerConfig.setHost(url.getHost() + ":" + url.getPort()); - } else { - swaggerConfig.setHost(url.getHost()); - } - } - swaggerConfig.setBasePath(buildUrl(path, base)); - } - initDone = true; - } - - /** - * We do only want the base context-path and not sub paths - */ - private String translateContextPath(HttpServletRequest request) { - String path = request.getContextPath(); - if (!translateContextPath) { - return path; - } - if (path.isEmpty() || path.equals("/")) { - return ""; - } else { - int idx = path.lastIndexOf("/"); - if (idx > 0) { - return path.substring(0, idx); - } - } - return path; - } - -} \ No newline at end of file diff --git a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/ServletRestApiResponseAdapter.java b/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/ServletRestApiResponseAdapter.java deleted file mode 100644 index e5507df..0000000 --- a/components/camel-swagger-java/src/main/java/org/apache/camel/swagger/servlet/ServletRestApiResponseAdapter.java +++ /dev/null @@ -1,49 +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.swagger.servlet; - -import java.io.IOException; -import javax.servlet.http.HttpServletResponse; - -import org.apache.camel.swagger.RestApiResponseAdapter; - -@Deprecated -public class ServletRestApiResponseAdapter implements RestApiResponseAdapter { - - private final HttpServletResponse response; - - public ServletRestApiResponseAdapter(HttpServletResponse response) { - this.response = response; - } - - @Override - public void setHeader(String name, String value) { - // use set header to avoid adding the same value multiple times (the method should have been named setHeader really) - response.setHeader(name, value); - } - - @Override - public void writeBytes(byte[] bytes) throws IOException { - response.getOutputStream().write(bytes); - } - - @Override - public void noContent() { - response.setStatus(HttpServletResponse.SC_NO_CONTENT); - } - -} diff --git a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java index 4ab53ca..4af9742 100644 --- a/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java +++ b/components/camel-xmlsecurity/src/test/java/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTest.java @@ -33,6 +33,7 @@ import org.apache.camel.component.xmlsecurity.api.XmlSignatureHelper; import org.apache.camel.impl.JndiRegistry; import org.apache.camel.spring.SpringCamelContext; import org.junit.Test; +import org.springframework.context.support.ClassPathXmlApplicationContext; public class SpringXmlSignatureTest extends XmlSignatureTest { @@ -41,7 +42,8 @@ public class SpringXmlSignatureTest extends XmlSignatureTest { protected CamelContext createCamelContext() throws Exception { rsaPair = getKeyPair("RSA", 1024); - return SpringCamelContext.springCamelContext("/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml"); + return SpringCamelContext.springCamelContext( + new ClassPathXmlApplicationContext("/org/apache/camel/component/xmlsecurity/SpringXmlSignatureTests.xml"), true); } public static KeyAccessor getDsaKeyAccessor() { diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalDomainObjectJSONTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalDomainObjectJSONTest.java index 290c183..6d8d831 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalDomainObjectJSONTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalDomainObjectJSONTest.java @@ -42,7 +42,7 @@ public class SpringMarshalDomainObjectJSONTest extends MarshalDomainObjectJSONTe } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalListTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalListTest.java index c7d7201..c8c808d 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalListTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalListTest.java @@ -39,7 +39,7 @@ public class SpringMarshalListTest extends MarshalListTest { } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.java index a9be81a..095bc4a 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringMarshalOmitFieldsTest.java @@ -43,7 +43,7 @@ public class SpringMarshalOmitFieldsTest extends XStreamDataFormatOmitFieldsTest } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.java index 3f54de3..c492a6f 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/SpringXStreamConfigurationTest.java @@ -40,6 +40,6 @@ public class SpringXStreamConfigurationTest extends XStreamConfigurationTest { } }); - return SpringCamelContext.springCamelContext(applicationContext); + return SpringCamelContext.springCamelContext(applicationContext, true); } } diff --git a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java index 3235cc0..e008893 100644 --- a/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java +++ b/platforms/spring-boot/components-starter/camel-jms-starter/src/main/java/org/apache/camel/component/jms/springboot/JmsComponentConfiguration.java @@ -31,7 +31,6 @@ import org.apache.camel.component.jms.MessageListenerContainerFactory; import org.apache.camel.component.jms.ReplyToType; import org.apache.camel.spring.boot.ComponentConfigurationPropertiesCommon; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.boot.context.properties.DeprecatedConfigurationProperty; import org.springframework.core.task.TaskExecutor; import org.springframework.jms.core.JmsOperations; import org.springframework.jms.support.converter.MessageConverter; @@ -1573,8 +1572,6 @@ public class JmsComponentConfiguration * Specifies whether to use transacted mode */ private Boolean transacted = false; - @Deprecated - private Boolean transactedInOut; /** * If true, Camel will create a JmsTransactionManager, if there is no * transactionManager injected when option transacted=true. @@ -2345,17 +2342,6 @@ public class JmsComponentConfiguration this.transacted = transacted; } - @Deprecated - @DeprecatedConfigurationProperty - public Boolean getTransactedInOut() { - return transactedInOut; - } - - @Deprecated - public void setTransactedInOut(Boolean transactedInOut) { - this.transactedInOut = transactedInOut; - } - public Boolean getLazyCreateTransactionManager() { return lazyCreateTransactionManager; }