This is an automated email from the ASF dual-hosted git repository. bvahdat pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 29919bf3a2d2ef8c59f0f3932937c7b5f5dec251 Author: Babak Vahdat <bvah...@apache.org> AuthorDate: Wed Apr 18 16:53:29 2018 +0200 polish --- .../AggregationStrategyWithPreservationTest.java | 2 +- .../camel/component/telegram/TelegramConsumer.java | 2 -- .../camel/test/blueprint/CamelBlueprintHelper.java | 12 ++++++------ .../camel/test/blueprint/CamelBlueprintTestSupport.java | 15 +++++++-------- .../main/java/org/apache/camel/test/blueprint/Main.java | 3 +-- .../test/blueprint/BlueprintMultipleServiceTest.java | 4 ++-- .../apache/camel/test/karaf/AbstractFeatureTest.java | 2 +- .../apache/camel/test/karaf/CamelKarafTestSupport.java | 10 +++++----- .../camel/test/spring/CamelAnnotationsHandler.java | 4 ++-- .../test/spring/CamelSpringBootExecutionListener.java | 1 - .../camel/test/spring/CamelSpringTestContextLoader.java | 6 +++--- .../apache/camel/test/spring/CamelSpringTestHelper.java | 8 ++++---- .../camel/test/spring/CamelSpringTestSupport.java | 4 ++-- .../test/spring/StopWatchTestExecutionListener.java | 2 +- .../org/apache/camel/test/junit4/CamelTestSupport.java | 16 ++++++++-------- .../org/apache/camel/testng/CamelSpringTestSupport.java | 4 ++-- .../java/org/apache/camel/testng/CamelTestSupport.java | 17 ++++++----------- .../apache/camel/component/thrift/ThriftConsumer.java | 2 +- .../org/apache/camel/component/thrift/ThriftUtils.java | 2 +- .../component/thrift/server/ThriftThreadPoolServer.java | 2 -- .../camel/component/thrift/ThriftConsumerAsyncTest.java | 6 +++--- .../component/thrift/ThriftConsumerSecurityTest.java | 4 ++-- .../camel/component/thrift/ThriftConsumerSyncTest.java | 4 ++-- .../thrift/ThriftConsumerZlibCompressionTest.java | 4 ++-- .../camel/component/thrift/ThriftProducerAsyncTest.java | 12 ++++++------ .../component/thrift/ThriftProducerSecurityTest.java | 10 +++++----- .../camel/component/thrift/ThriftProducerSyncTest.java | 12 ++++++------ .../thrift/ThriftProducerZlibCompressionTest.java | 6 +++--- .../thrift/local/ThriftThreadPoolServerTest.java | 2 +- .../org/apache/camel/component/tika/TikaProducer.java | 3 ++- .../component/twilio/AbstractTwilioTestSupport.java | 2 +- .../component/twitter/AbstractTwitterEndpoint.java | 1 - .../twitter/CommonPropertiesTwitterEndpoint.java | 3 --- .../camel/component/twitter/TwitterConfiguration.java | 2 -- .../apache/camel/component/twitter/TwitterHelper.java | 3 --- .../directmessage/TwitterDirectMessageEndpoint.java | 1 - .../twitter/streaming/TwitterStreamingEndpoint.java | 1 - .../component/twitter/DirectMessageDirectTest.java | 4 ---- .../component/twitter/DirectMessagePollingTest.java | 4 ---- .../component/twitter/SearchByExchangeDirectTest.java | 4 ++-- .../twitter/deprecated/DirectMessageDirectTest.java | 6 ------ .../twitter/deprecated/DirectMessagePollingTest.java | 4 ---- .../twitter/deprecated/SearchByExchangeDirectTest.java | 4 ++-- .../camel/component/undertow/DefaultUndertowHost.java | 3 --- .../camel/component/undertow/UndertowComponent.java | 7 +++---- .../apache/camel/component/undertow/UndertowHelper.java | 2 +- .../component/undertow/handlers/CamelPathHandler.java | 2 +- .../undertow/handlers/CamelPathTemplateHandler.java | 2 +- .../camel/component/undertow/UndertowEndpointTest.java | 1 - .../UndertowProducerThrowExceptionOnFailureTest.java | 4 ++-- ...RestUndertowHttpBindingModeJsonWithContractTest.java | 2 -- .../RestUndertowHttpBindingModeOffWithContractTest.java | 3 --- .../apache/camel/component/undertow/ws/TestClient.java | 4 ++-- .../undertow/ws/UndertowWsConsumerRouteTest.java | 4 ++-- .../undertow/ws/UndertowWsProducerRouteRestartTest.java | 2 +- .../undertow/ws/UndertowWsProducerRouteTest.java | 2 +- .../component/undertow/ws/UndertowWsTwoRoutesTest.java | 4 ++-- ...towWsTwoRoutesToSameEndpointSendToAllHeaderTest.java | 2 +- .../ws/UndertowWsTwoRoutesToSameEndpointTest.java | 2 +- .../component/undertow/ws/UndertowWssRouteTest.java | 2 +- .../univocity/AbstractUniVocityDataFormat.java | 4 ++-- .../apache/camel/dataformat/univocity/Marshaller.java | 2 +- .../univocity/UniVocityFixedWidthDataFormat.java | 2 +- .../apache/camel/dataformat/univocity/Unmarshaller.java | 6 +++--- .../univocity/UniVocityCsvDataFormatMarshalTest.java | 2 +- .../univocity/UniVocityCsvDataFormatUnmarshalTest.java | 2 +- .../UniVocityFixedWidthDataFormatMarshalTest.java | 2 +- .../UniVocityFixedWidthDataFormatUnmarshalTest.java | 2 +- .../camel/dataformat/univocity/UniVocityTestHelper.java | 2 +- .../univocity/UniVocityTsvDataFormatMarshalTest.java | 2 +- .../univocity/UniVocityTsvDataFormatUnmarshalTest.java | 2 +- .../apache/camel/component/weather/WeatherQuery.java | 3 --- .../camel/component/websocket/WebsocketComponent.java | 6 +++--- .../component/websocket/WebsocketComponentServlet.java | 2 +- .../websocket/WebsocketClientCamelRouteTest.java | 2 +- .../websocket/WebsocketComponentRouteExampleTest.java | 2 +- .../websocket/WebsocketComponentServletTest.java | 2 +- .../component/websocket/WebsocketComponentTest.java | 2 +- .../websocket/WebsocketProducerRouteExampleTest.java | 2 +- .../websocket/WebsocketProducerRouteRestartTest.java | 2 +- .../component/websocket/WebsocketRouteExampleTest.java | 2 +- .../WebsocketSSLContextGlobalRouteExampleTest.java | 2 +- .../WebsocketSSLContextInUriRouteExampleTest.java | 2 +- .../websocket/WebsocketSSLRouteExampleTest.java | 2 +- .../camel/component/websocket/WebsocketStaticTest.java | 2 +- .../websocket/WebsocketTwoRoutesExampleTest.java | 2 +- ...tesToSIndividualAndBroadcastEndpointExampleTest.java | 2 +- .../WebsocketTwoRoutesToSameEndpointExampleTest.java | 2 +- .../camel/component/wordpress/WordpressComponent.java | 2 +- .../api/test/WordpressMockServerTestSupport.java | 6 +++--- 90 files changed, 145 insertions(+), 198 deletions(-) diff --git a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java index b430f5e..5201dee 100644 --- a/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java +++ b/components/camel-tarfile/src/test/java/org/apache/camel/processor/aggregate/tarfile/AggregationStrategyWithPreservationTest.java @@ -57,7 +57,7 @@ public class AggregationStrategyWithPreservationTest extends CamelTestSupport { assertTrue("Should be a file in target/out directory", files.length > 0); File resultFile = files[0]; - Set<String> expectedTarFiles = new HashSet<String>(Arrays.asList("another/hello.txt", + Set<String> expectedTarFiles = new HashSet<>(Arrays.asList("another/hello.txt", "other/greetings.txt", "chiau.txt", "hi.txt", "hola.txt")); TarArchiveInputStream tin = new TarArchiveInputStream(new FileInputStream(resultFile)); diff --git a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java index 1799439..d9e4609 100644 --- a/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java +++ b/components/camel-telegram/src/main/java/org/apache/camel/component/telegram/TelegramConsumer.java @@ -48,8 +48,6 @@ public class TelegramConsumer extends ScheduledPollConsumer { TelegramConfiguration config = endpoint.getConfiguration(); - Long realOffset = offset != null ? offset : 0L; - TelegramService service = TelegramServiceProvider.get().getService(); log.debug("Polling Telegram service to get updates"); diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java index 48f41ba..8131f62 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintHelper.java @@ -191,7 +191,7 @@ public final class CamelBlueprintHelper { } // setup felix-connect to use our bundles - Map<String, Object> config = new HashMap<String, Object>(); + Map<String, Object> config = new HashMap<>(); config.put(PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS, bundles); // create pojorsr osgi service registry @@ -202,7 +202,7 @@ public final class CamelBlueprintHelper { public static void disposeBundleContext(BundleContext bundleContext) throws BundleException { try { if (bundleContext != null) { - List<Bundle> bundles = new ArrayList<Bundle>(); + List<Bundle> bundles = new ArrayList<>(); bundles.addAll(Arrays.asList(bundleContext.getBundles())); Collections.reverse(bundles); for (Bundle bundle : bundles) { @@ -299,7 +299,7 @@ public final class CamelBlueprintHelper { flt = "(" + Constants.OBJECTCLASS + "=" + type.getName() + ")"; } Filter osgiFilter = FrameworkUtil.createFilter(flt); - tracker = new ServiceTracker<T, T>(bundleContext, osgiFilter, null); + tracker = new ServiceTracker<>(bundleContext, osgiFilter, null); tracker.open(true); // Note that the tracker is not closed to keep the reference // This is buggy, as the service reference may change i think @@ -432,7 +432,7 @@ public final class CamelBlueprintHelper { * Provides an iterable collection of references, even if the original array is <code>null</code>. */ private static Collection<ServiceReference> asCollection(ServiceReference[] references) { - return references == null ? new ArrayList<ServiceReference>(0) : Arrays.asList(references); + return references == null ? new ArrayList<>(0) : Arrays.asList(references); } /** @@ -454,7 +454,7 @@ public final class CamelBlueprintHelper { * @throws FileNotFoundException is thrown if a bundle descriptor cannot be found */ protected static Collection<URL> getBlueprintDescriptors(String descriptors) throws FileNotFoundException, MalformedURLException { - List<URL> answer = new ArrayList<URL>(); + List<URL> answer = new ArrayList<>(); if (descriptors != null) { // there may be more resources separated by comma Iterator<Object> it = ObjectHelper.createIterator(descriptors); @@ -528,7 +528,7 @@ public final class CamelBlueprintHelper { try { fis = new FileInputStream(file); jis = new JarInputStream(fis); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); for (Map.Entry<Object, Object> entry : jis.getManifest().getMainAttributes().entrySet()) { headers.put(entry.getKey().toString(), entry.getValue().toString()); } diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java index 5e5cbab..e3c7fd3 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java @@ -62,9 +62,9 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { /** Name of a system property that sets camel context creation timeout. */ public static final String SPROP_CAMEL_CONTEXT_CREATION_TIMEOUT = "org.apache.camel.test.blueprint.camelContextCreationTimeout"; - private static ThreadLocal<BundleContext> threadLocalBundleContext = new ThreadLocal<BundleContext>(); + private static ThreadLocal<BundleContext> threadLocalBundleContext = new ThreadLocal<>(); private volatile BundleContext bundleContext; - private final Set<ServiceRegistration<?>> services = new LinkedHashSet<ServiceRegistration<?>>(); + private final Set<ServiceRegistration<?>> services = new LinkedHashSet<>(); /** * Override this method if you don't want CamelBlueprintTestSupport create the test bundle @@ -135,10 +135,10 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { answer.registerService(PropertiesComponent.OVERRIDE_PROPERTIES, extra, null); } - Map<String, KeyValueHolder<Object, Dictionary>> map = new LinkedHashMap<String, KeyValueHolder<Object, Dictionary>>(); + Map<String, KeyValueHolder<Object, Dictionary>> map = new LinkedHashMap<>(); addServicesOnStartup(map); - List<KeyValueHolder<String, KeyValueHolder<Object, Dictionary>>> servicesList = new LinkedList<KeyValueHolder<String, KeyValueHolder<Object, Dictionary>>>(); + List<KeyValueHolder<String, KeyValueHolder<Object, Dictionary>>> servicesList = new LinkedList<>(); for (Map.Entry<String, KeyValueHolder<Object, Dictionary>> entry : map.entrySet()) { servicesList.add(asKeyValueService(entry.getKey(), entry.getValue().getKey(), entry.getValue().getValue())); } @@ -229,7 +229,6 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { System.setProperty("skipStartingCamelContext", "true"); System.setProperty("registerBlueprintCamelContextEager", "true"); - String symbolicName = getClass().getSimpleName(); if (isCreateCamelContextPerClass()) { // test is per class, so only setup once (the first time) boolean first = threadLocalBundleContext.get() == null; @@ -321,14 +320,14 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { * Creates a holder for the given service, which make it easier to use {@link #addServicesOnStartup(java.util.Map)} */ protected KeyValueHolder<Object, Dictionary> asService(Object service, Dictionary dict) { - return new KeyValueHolder<Object, Dictionary>(service, dict); + return new KeyValueHolder<>(service, dict); } /** * Creates a holder for the given service, which make it easier to use {@link #addServicesOnStartup(java.util.List)} */ protected KeyValueHolder<String, KeyValueHolder<Object, Dictionary>> asKeyValueService(String name, Object service, Dictionary dict) { - return new KeyValueHolder<String, KeyValueHolder<Object, Dictionary>>(name, new KeyValueHolder<Object, Dictionary>(service, dict)); + return new KeyValueHolder<>(name, new KeyValueHolder<>(service, dict)); } @@ -340,7 +339,7 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport { if (key != null && value != null) { prop.put(key, value); } - return new KeyValueHolder<Object, Dictionary>(service, prop); + return new KeyValueHolder<>(service, prop); } /** diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java index 6eaf746..870507b 100644 --- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java +++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/Main.java @@ -105,7 +105,6 @@ public class Main extends MainSupport { } else { bundleContext = createBundleContext(bundleName); } - Set<Long> eventHistory = new HashSet<>(); camelContext = CamelBlueprintHelper.getOsgiService(bundleContext, CamelContext.class); if (camelContext == null) { @@ -152,7 +151,7 @@ public class Main extends MainSupport { @Override protected Map<String, CamelContext> getCamelContextMap() { - Map<String, CamelContext> map = new HashMap<String, CamelContext>(1); + Map<String, CamelContext> map = new HashMap<>(1); if (camelContext != null) { map.put(camelContext.getName(), camelContext); } diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintMultipleServiceTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintMultipleServiceTest.java index f22af51..11c132b 100644 --- a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintMultipleServiceTest.java +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintMultipleServiceTest.java @@ -47,10 +47,10 @@ public class BlueprintMultipleServiceTest extends CamelBlueprintTestSupport { @Override @SuppressWarnings("rawtypes") protected void addServicesOnStartup(List<KeyValueHolder<String, KeyValueHolder<Object, Dictionary>>> services) { - Dictionary<String, String> dict1 = new Hashtable<String, String>(); + Dictionary<String, String> dict1 = new Hashtable<>(); dict1.put("component", "fakeservice1"); - Dictionary<String, String> dict2 = new Hashtable<String, String>(); + Dictionary<String, String> dict2 = new Hashtable<>(); dict2.put("component", "fakeservice2"); services.add(asKeyValueService(ComponentResolver.class.getName(), mockComponentOne, dict1)); diff --git a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java index 2639091..bbcc6fa 100644 --- a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java +++ b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/AbstractFeatureTest.java @@ -433,7 +433,7 @@ public abstract class AbstractFeatureTest { * Provides an iterable collection of references, even if the original array is <code>null</code>. */ private static Collection<ServiceReference> asCollection(ServiceReference[] references) { - return references == null ? new ArrayList<ServiceReference>(0) : Arrays.asList(references); + return references == null ? new ArrayList<>(0) : Arrays.asList(references); } } diff --git a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java index 897f60f..397e5d1 100644 --- a/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java +++ b/components/camel-test-karaf/src/main/java/org/apache/camel/test/karaf/CamelKarafTestSupport.java @@ -135,10 +135,10 @@ public class CamelKarafTestSupport extends CamelTestSupport { FutureTask<String> commandFuture; if (principals.length == 0) { - commandFuture = new FutureTask<String>(commandCallable); + commandFuture = new FutureTask<>(commandCallable); } else { // If principals are defined, run the command callable via Subject.doAs() - commandFuture = new FutureTask<String>(new Callable<String>() { + commandFuture = new FutureTask<>(new Callable<String>() { @Override public String call() throws Exception { Subject subject = new Subject(); @@ -333,7 +333,7 @@ public class CamelKarafTestSupport extends CamelTestSupport { } protected void installAssertAndUninstallFeature(String feature) throws Exception { - Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featuresService.listInstalledFeatures())); + Set<Feature> featuresBefore = new HashSet<>(Arrays.asList(featuresService.listInstalledFeatures())); try { featuresService.installFeature(feature); assertFeatureInstalled(feature); @@ -343,7 +343,7 @@ public class CamelKarafTestSupport extends CamelTestSupport { } protected void installAssertAndUninstallFeature(String feature, String version) throws Exception { - Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featuresService.listInstalledFeatures())); + Set<Feature> featuresBefore = new HashSet<>(Arrays.asList(featuresService.listInstalledFeatures())); try { featuresService.installFeature(feature, version); assertFeatureInstalled(feature, version); @@ -353,7 +353,7 @@ public class CamelKarafTestSupport extends CamelTestSupport { } protected void installAssertAndUninstallFeatures(String... feature) throws Exception { - Set<Feature> featuresBefore = new HashSet<Feature>(Arrays.asList(featuresService.listInstalledFeatures())); + Set<Feature> featuresBefore = new HashSet<>(Arrays.asList(featuresService.listInstalledFeatures())); try { for (String curFeature : feature) { featuresService.installFeature(curFeature); diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java index 70f768a..4dacc8a 100644 --- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java +++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelAnnotationsHandler.java @@ -97,7 +97,7 @@ public final class CamelAnnotationsHandler { public static void handleProvidesBreakpoint(ConfigurableApplicationContext context, Class<?> testClass) throws Exception { Collection<Method> methods = getAllMethods(testClass); - final List<Breakpoint> breakpoints = new LinkedList<Breakpoint>(); + final List<Breakpoint> breakpoints = new LinkedList<>(); for (Method method : methods) { if (AnnotationUtils.findAnnotation(method, ProvidesBreakpoint.class) != null) { @@ -224,7 +224,7 @@ public final class CamelAnnotationsHandler { */ public static void handleUseOverridePropertiesWithPropertiesComponent(ConfigurableApplicationContext context, Class<?> testClass) throws Exception { Collection<Method> methods = getAllMethods(testClass); - final List<Properties> properties = new LinkedList<Properties>(); + final List<Properties> properties = new LinkedList<>(); for (Method method : methods) { if (AnnotationUtils.findAnnotation(method, UseOverridePropertiesWithPropertiesComponent.class) != null) { diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java index e6955cd..99240f3 100644 --- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java +++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringBootExecutionListener.java @@ -16,7 +16,6 @@ */ package org.apache.camel.test.spring; -import org.apache.camel.CamelContext; import org.apache.camel.spring.SpringCamelContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java index 583ebca..e28c1ff 100644 --- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java +++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestContextLoader.java @@ -228,7 +228,7 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader { ExcludingPackageScanClassResolver excludingResolver = routeExcludingContext.getBean("excludingResolver", ExcludingPackageScanClassResolver.class); List<Class<?>> excluded = Arrays.asList(excludedClasses); - excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded)); + excludingResolver.setExcludedClasses(new HashSet<>(excluded)); } else { if (LOG.isDebugEnabled()) { LOG.debug("Not enabling package scanning excluded classes as ExcludeRoutes " @@ -310,7 +310,7 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader { */ protected void handleProvidesBreakpoint(GenericApplicationContext context, Class<?> testClass) throws Exception { Collection<Method> methods = getAllMethods(testClass); - final List<Breakpoint> breakpoints = new LinkedList<Breakpoint>(); + final List<Breakpoint> breakpoints = new LinkedList<>(); for (Method method : methods) { if (AnnotationUtils.findAnnotation(method, ProvidesBreakpoint.class) != null) { @@ -442,7 +442,7 @@ public class CamelSpringTestContextLoader extends AbstractContextLoader { */ protected void handleUseOverridePropertiesWithPropertiesComponent(ConfigurableApplicationContext context, Class<?> testClass) throws Exception { Collection<Method> methods = getAllMethods(testClass); - final List<Properties> properties = new LinkedList<Properties>(); + final List<Properties> properties = new LinkedList<>(); for (Method method : methods) { if (AnnotationUtils.findAnnotation(method, UseOverridePropertiesWithPropertiesComponent.class) != null) { diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java index 1c426b4..2b44b15 100644 --- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java +++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestHelper.java @@ -40,9 +40,9 @@ import org.springframework.test.context.TestContext; */ public final class CamelSpringTestHelper { - private static ThreadLocal<String> originalJmxDisabledValue = new ThreadLocal<String>(); - private static ThreadLocal<Class<?>> testClazz = new ThreadLocal<Class<?>>(); - private static ThreadLocal<TestContext> testContext = new ThreadLocal<TestContext>(); + private static ThreadLocal<String> originalJmxDisabledValue = new ThreadLocal<>(); + private static ThreadLocal<Class<?>> testClazz = new ThreadLocal<>(); + private static ThreadLocal<TestContext> testContext = new ThreadLocal<>(); private CamelSpringTestHelper() { } @@ -75,7 +75,7 @@ public final class CamelSpringTestHelper { * Returns all methods defined in {@code clazz} and its superclasses/interfaces. */ public static Collection<Method> getAllMethods(Class<?> clazz) { - Set<Method> methods = new LinkedHashSet<Method>(); + Set<Method> methods = new LinkedHashSet<>(); Class<?> currentClass = clazz; while (currentClass != null) { diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java index d69ebf1..41e404e 100644 --- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java +++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/CamelSpringTestSupport.java @@ -39,7 +39,7 @@ import org.springframework.context.support.GenericApplicationContext; * Do <tt>not</tt> use this class for Spring Boot testing, instead use <code>@RunWith(CamelSpringBootRunner.class)</code>. */ public abstract class CamelSpringTestSupport extends CamelTestSupport { - protected static ThreadLocal<AbstractApplicationContext> threadAppContext = new ThreadLocal<AbstractApplicationContext>(); + protected static ThreadLocal<AbstractApplicationContext> threadAppContext = new ThreadLocal<>(); protected static Object lock = new Object(); protected AbstractApplicationContext applicationContext; @@ -158,7 +158,7 @@ public abstract class CamelSpringTestSupport extends CamelTestSupport { ExcludingPackageScanClassResolver excludingResolver = routeExcludingContext.getBean("excludingResolver", ExcludingPackageScanClassResolver.class); List<Class<?>> excluded = Arrays.asList(excludeRoutes()); - excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded)); + excludingResolver.setExcludedClasses(new HashSet<>(excluded)); return routeExcludingContext; } diff --git a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java index 8796dfe..f8521e3 100644 --- a/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java +++ b/components/camel-test-spring/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java @@ -28,7 +28,7 @@ import org.springframework.test.context.support.AbstractTestExecutionListener; */ public class StopWatchTestExecutionListener extends AbstractTestExecutionListener { - protected static ThreadLocal<StopWatch> threadStopWatch = new ThreadLocal<StopWatch>(); + protected static ThreadLocal<StopWatch> threadStopWatch = new ThreadLocal<>(); /** * Exists primarily for testing purposes, but allows for access to the underlying stop watch instance for a test. diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java index 3b5b53b..59344ae 100644 --- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java +++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/CamelTestSupport.java @@ -98,12 +98,12 @@ public abstract class CamelTestSupport extends TestSupport { public static final String ROUTE_COVERAGE_ENABLED = "CamelTestRouteCoverage"; private static final Logger LOG = LoggerFactory.getLogger(CamelTestSupport.class); - private static final ThreadLocal<Boolean> INIT = new ThreadLocal<Boolean>(); - private static ThreadLocal<ModelCamelContext> threadCamelContext = new ThreadLocal<ModelCamelContext>(); - private static ThreadLocal<ProducerTemplate> threadTemplate = new ThreadLocal<ProducerTemplate>(); - private static ThreadLocal<FluentProducerTemplate> threadFluentTemplate = new ThreadLocal<FluentProducerTemplate>(); - private static ThreadLocal<ConsumerTemplate> threadConsumer = new ThreadLocal<ConsumerTemplate>(); - private static ThreadLocal<Service> threadService = new ThreadLocal<Service>(); + private static final ThreadLocal<Boolean> INIT = new ThreadLocal<>(); + private static ThreadLocal<ModelCamelContext> threadCamelContext = new ThreadLocal<>(); + private static ThreadLocal<ProducerTemplate> threadTemplate = new ThreadLocal<>(); + private static ThreadLocal<FluentProducerTemplate> threadFluentTemplate = new ThreadLocal<>(); + private static ThreadLocal<ConsumerTemplate> threadConsumer = new ThreadLocal<>(); + private static ThreadLocal<Service> threadService = new ThreadLocal<>(); protected volatile ModelCamelContext context; protected volatile ProducerTemplate template; protected volatile FluentProducerTemplate fluentTemplate; @@ -113,7 +113,7 @@ public abstract class CamelTestSupport extends TestSupport { private boolean useRouteBuilder = true; private final DebugBreakpoint breakpoint = new DebugBreakpoint(); private final StopWatch watch = new StopWatch(); - private final Map<String, String> fromEndpoints = new HashMap<String, String>(); + private final Map<String, String> fromEndpoints = new HashMap<>(); private CamelTestWatcher camelTestWatcher = new CamelTestWatcher(); /** @@ -748,7 +748,7 @@ public abstract class CamelTestSupport extends TestSupport { } else { properties.put("java.naming.factory.initial", "org.apache.camel.util.jndi.CamelInitialContextFactory"); } - return new InitialContext(new Hashtable<Object, Object>(properties)); + return new InitialContext(new Hashtable<>(properties)); } /** diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java index 69e23ab..aa5ae35 100644 --- a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java +++ b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelSpringTestSupport.java @@ -33,7 +33,7 @@ import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; public abstract class CamelSpringTestSupport extends CamelTestSupport { - protected static ThreadLocal<AbstractApplicationContext> threadAppContext = new ThreadLocal<AbstractApplicationContext>(); + protected static ThreadLocal<AbstractApplicationContext> threadAppContext = new ThreadLocal<>(); protected static Object lock = new Object(); protected static AbstractApplicationContext applicationContext; @@ -127,7 +127,7 @@ public abstract class CamelSpringTestSupport extends CamelTestSupport { ExcludingPackageScanClassResolver excludingResolver = routeExcludingContext.getBean("excludingResolver", ExcludingPackageScanClassResolver.class); List<Class<?>> excluded = Arrays.asList(excludeRoutes()); - excludingResolver.setExcludedClasses(new HashSet<Class<?>>(excluded)); + excludingResolver.setExcludedClasses(new HashSet<>(excluded)); return routeExcludingContext; } diff --git a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java index 67816d6..2c53cc9 100644 --- a/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java +++ b/components/camel-testng/src/main/java/org/apache/camel/testng/CamelTestSupport.java @@ -63,24 +63,19 @@ import org.testng.annotations.BeforeMethod; */ public abstract class CamelTestSupport extends TestSupport { private static final Logger LOG = LoggerFactory.getLogger(TestSupport.class); - private static final ThreadLocal<Boolean> INIT = new ThreadLocal<Boolean>(); + private static final ThreadLocal<Boolean> INIT = new ThreadLocal<>(); - private static ThreadLocal<ModelCamelContext> threadCamelContext - = new ThreadLocal<ModelCamelContext>(); - private static ThreadLocal<ProducerTemplate> threadTemplate - = new ThreadLocal<ProducerTemplate>(); - private static ThreadLocal<ConsumerTemplate> threadConsumer - = new ThreadLocal<ConsumerTemplate>(); - private static ThreadLocal<Service> threadService - = new ThreadLocal<Service>(); + private static ThreadLocal<ModelCamelContext> threadCamelContext = new ThreadLocal<>(); + private static ThreadLocal<ProducerTemplate> threadTemplate = new ThreadLocal<>(); + private static ThreadLocal<ConsumerTemplate> threadConsumer = new ThreadLocal<>(); + private static ThreadLocal<Service> threadService = new ThreadLocal<>(); protected volatile ModelCamelContext context; protected volatile ProducerTemplate template; protected volatile ConsumerTemplate consumer; protected volatile Service camelContextService; - private boolean useRouteBuilder = true; private final DebugBreakpoint breakpoint = new DebugBreakpoint(); private final StopWatch watch = new StopWatch(); @@ -450,7 +445,7 @@ public abstract class CamelTestSupport extends TestSupport { } else { properties.put("java.naming.factory.initial", "org.apache.camel.util.jndi.CamelInitialContextFactory"); } - return new InitialContext(new Hashtable<Object, Object>(properties)); + return new InitialContext(new Hashtable<>(properties)); } /** diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConsumer.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConsumer.java index 7e467e8..395b7a2 100644 --- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConsumer.java +++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftConsumer.java @@ -107,7 +107,7 @@ public class ThriftConsumer extends DefaultConsumer { Class serverInterface = ThriftUtils.getServerInterface(endpoint.getServicePackage(), endpoint.getServiceName(), endpoint.isSynchronous(), endpoint.getCamelContext()); serviceProxy.setInterfaces(new Class[] {serverInterface}); serverImplementationClass = serviceProxy.createClass(); - serverImplementationInstance = (Object)serverImplementationClass.getConstructor().newInstance(); + serverImplementationInstance = serverImplementationClass.getConstructor().newInstance(); ((Proxy)serverImplementationInstance).setHandler(methodHandler); serverProcessor = ThriftUtils.constructServerProcessor(endpoint.getServicePackage(), endpoint.getServiceName(), serverImplementationInstance, endpoint.isSynchronous(), diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftUtils.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftUtils.java index 58aa77b..a9154f0 100644 --- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftUtils.java +++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/ThriftUtils.java @@ -98,7 +98,7 @@ public final class ThriftUtils { if (asyncClientGetter == null) { throw new IllegalArgumentException("Thrift async client getter not found: " + clientClassName + "." + ThriftConstants.THRIFT_ASYNC_CLIENT_GETTER_NAME); } - asynClientInstance = ObjectHelper.invokeMethod(asyncClientGetter, factoryInstance, (TNonblockingTransport)transport); + asynClientInstance = ObjectHelper.invokeMethod(asyncClientGetter, factoryInstance, transport); } catch (ClassNotFoundException e) { throw new IllegalArgumentException("Thrift sync client class not found: " + clientClassName); diff --git a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java index 2b387e4..2c99c98 100644 --- a/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java +++ b/components/camel-thrift/src/main/java/org/apache/camel/component/thrift/server/ThriftThreadPoolServer.java @@ -143,7 +143,6 @@ public class ThriftThreadPoolServer extends TServer { } private void waitForShutdown() { - int failureCount = 0; while (!stopped_) { try { TTransport client = serverTransport_.accept(); @@ -190,7 +189,6 @@ public class ThriftThreadPoolServer extends TServer { } } catch (TTransportException ttx) { if (!stopped_) { - ++failureCount; LOGGER.warn("Transport error occurred during acceptance of message.", ttx); } } diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java index ae40c3c..5d06a4e 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerAsyncTest.java @@ -169,7 +169,7 @@ public class ThriftConsumerAsyncTest extends CamelTestSupport { final CountDownLatch latch = new CountDownLatch(1); - thriftClient.alltypes(true, (byte)THRIFT_TEST_NUM1, (short)THRIFT_TEST_NUM1, (int)THRIFT_TEST_NUM1, (long)THRIFT_TEST_NUM1, (double)THRIFT_TEST_NUM1, "empty", + thriftClient.alltypes(true, (byte)THRIFT_TEST_NUM1, (short)THRIFT_TEST_NUM1, THRIFT_TEST_NUM1, THRIFT_TEST_NUM1, THRIFT_TEST_NUM1, "empty", ByteBuffer.allocate(10), new Work(THRIFT_TEST_NUM1, THRIFT_TEST_NUM2, Operation.MULTIPLY), new ArrayList<Integer>(), new HashSet<String>(), new HashMap<String, Long>(), new AsyncMethodCallback<Integer>() { @@ -225,8 +225,8 @@ public class ThriftConsumerAsyncTest extends CamelTestSupport { assertNotNull(echoResult); assertTrue(echoResult instanceof Work); - assertEquals(THRIFT_TEST_NUM1, ((Work)echoResult).num1); - assertEquals(Operation.MULTIPLY, ((Work)echoResult).op); + assertEquals(THRIFT_TEST_NUM1, echoResult.num1); + assertEquals(Operation.MULTIPLY, echoResult.op); } @Override diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java index 1eb89f6..dd316f7 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSecurityTest.java @@ -127,8 +127,8 @@ public class ThriftConsumerSecurityTest extends CamelTestSupport { assertNotNull(echoResult); assertTrue(echoResult instanceof Work); - assertEquals(THRIFT_TEST_NUM1, ((Work)echoResult).num1); - assertEquals(Operation.MULTIPLY, ((Work)echoResult).op); + assertEquals(THRIFT_TEST_NUM1, echoResult.num1); + assertEquals(Operation.MULTIPLY, echoResult.op); } @Override diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java index 7405aa3..6abcde1 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerSyncTest.java @@ -92,8 +92,8 @@ public class ThriftConsumerSyncTest extends CamelTestSupport { assertNotNull(echoResult); assertTrue(echoResult instanceof Work); - assertEquals(THRIFT_TEST_NUM1, ((Work)echoResult).num1); - assertEquals(Operation.MULTIPLY, ((Work)echoResult).op); + assertEquals(THRIFT_TEST_NUM1, echoResult.num1); + assertEquals(Operation.MULTIPLY, echoResult.op); } @Override diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java index 5ffb826..e50a509 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftConsumerZlibCompressionTest.java @@ -100,8 +100,8 @@ public class ThriftConsumerZlibCompressionTest extends CamelTestSupport { assertNotNull(echoResult); assertTrue(echoResult instanceof Work); - assertEquals(THRIFT_TEST_NUM1, ((Work)echoResult).num1); - assertEquals(Operation.MULTIPLY, ((Work)echoResult).op); + assertEquals(THRIFT_TEST_NUM1, echoResult.num1); + assertEquals(Operation.MULTIPLY, echoResult.op); } @Override diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java index 9b0953f..6eb2bd0 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerAsyncTest.java @@ -48,7 +48,7 @@ public class ThriftProducerAsyncTest extends ThriftProducerBaseTest { List requestBody = new ArrayList(); final CountDownLatch latch = new CountDownLatch(1); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, THRIFT_TEST_NUM2, Operation.MULTIPLY)); template.asyncCallbackSendBody("direct:thrift-calculate", requestBody, new SynchronizationAdapter() { @@ -81,8 +81,8 @@ public class ThriftProducerAsyncTest extends ThriftProducerBaseTest { List requestBody = new ArrayList(); responseBody = null; - requestBody.add((int)THRIFT_TEST_NUM1); - requestBody.add((int)THRIFT_TEST_NUM2); + requestBody.add(THRIFT_TEST_NUM1); + requestBody.add(THRIFT_TEST_NUM2); template.asyncCallbackSendBody("direct:thrift-add", requestBody, new SynchronizationAdapter() { @@ -113,7 +113,7 @@ public class ThriftProducerAsyncTest extends ThriftProducerBaseTest { final CountDownLatch latch = new CountDownLatch(1); List requestBody = new ArrayList(); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, 0, Operation.DIVIDE)); template.asyncCallbackSendBody("direct:thrift-calculate", requestBody, new SynchronizationAdapter() { @@ -197,10 +197,10 @@ public class ThriftProducerAsyncTest extends ThriftProducerBaseTest { final CountDownLatch latch = new CountDownLatch(1); List requestBody = new ArrayList(); - requestBody.add((boolean)true); + requestBody.add(true); requestBody.add((byte)THRIFT_TEST_NUM1); requestBody.add((short)THRIFT_TEST_NUM1); - requestBody.add((int)THRIFT_TEST_NUM1); + requestBody.add(THRIFT_TEST_NUM1); requestBody.add((long)THRIFT_TEST_NUM1); requestBody.add((double)THRIFT_TEST_NUM1); requestBody.add("empty"); diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java index 030e470..6f0a78b 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSecurityTest.java @@ -75,7 +75,7 @@ public class ThriftProducerSecurityTest extends CamelTestSupport { sslParams.setKeyStore(KEY_STORE_PATH, SECURITY_STORE_PASSWORD); serverTransport = TSSLTransportFactory.getServerSocket(THRIFT_TEST_PORT, THRIFT_CLIENT_TIMEOUT, InetAddress.getByName("localhost"), sslParams); TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport); - args.processor((TProcessor)processor); + args.processor(processor); server = new TThreadPoolServer(args); Runnable simple = new Runnable() { @@ -121,7 +121,7 @@ public class ThriftProducerSecurityTest extends CamelTestSupport { List requestBody = new ArrayList(); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, THRIFT_TEST_NUM2, Operation.MULTIPLY)); Object responseBody = template.requestBody("direct:thrift-secured-calculate", requestBody); @@ -138,7 +138,7 @@ public class ThriftProducerSecurityTest extends CamelTestSupport { List requestBody = new ArrayList(); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, 0, Operation.DIVIDE)); try { @@ -175,10 +175,10 @@ public class ThriftProducerSecurityTest extends CamelTestSupport { List requestBody = new ArrayList(); - requestBody.add((boolean)true); + requestBody.add(true); requestBody.add((byte)THRIFT_TEST_NUM1); requestBody.add((short)THRIFT_TEST_NUM1); - requestBody.add((int)THRIFT_TEST_NUM1); + requestBody.add(THRIFT_TEST_NUM1); requestBody.add((long)THRIFT_TEST_NUM1); requestBody.add((double)THRIFT_TEST_NUM1); requestBody.add("empty"); diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java index 536f45d..411b876 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerSyncTest.java @@ -42,7 +42,7 @@ public class ThriftProducerSyncTest extends ThriftProducerBaseTest { List requestBody = new ArrayList(); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, THRIFT_TEST_NUM2, Operation.MULTIPLY)); Object responseBody = template.requestBody("direct:thrift-calculate", requestBody); @@ -59,8 +59,8 @@ public class ThriftProducerSyncTest extends ThriftProducerBaseTest { List requestBody = new ArrayList(); - requestBody.add((int)THRIFT_TEST_NUM1); - requestBody.add((int)THRIFT_TEST_NUM2); + requestBody.add(THRIFT_TEST_NUM1); + requestBody.add(THRIFT_TEST_NUM2); Object responseBody = template.requestBody("direct:thrift-add", requestBody); @@ -76,7 +76,7 @@ public class ThriftProducerSyncTest extends ThriftProducerBaseTest { List requestBody = new ArrayList(); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, 0, Operation.DIVIDE)); try { @@ -113,10 +113,10 @@ public class ThriftProducerSyncTest extends ThriftProducerBaseTest { List requestBody = new ArrayList(); - requestBody.add((boolean)true); + requestBody.add(true); requestBody.add((byte)THRIFT_TEST_NUM1); requestBody.add((short)THRIFT_TEST_NUM1); - requestBody.add((int)THRIFT_TEST_NUM1); + requestBody.add(THRIFT_TEST_NUM1); requestBody.add((long)THRIFT_TEST_NUM1); requestBody.add((double)THRIFT_TEST_NUM1); requestBody.add("empty"); diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java index e2405b7..2e3da45 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/ThriftProducerZlibCompressionTest.java @@ -62,9 +62,9 @@ public class ThriftProducerZlibCompressionTest extends CamelTestSupport { serverTransport = new TServerSocket(new InetSocketAddress(InetAddress.getByName("localhost"), THRIFT_TEST_PORT), THRIFT_CLIENT_TIMEOUT); TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport); - args.processor((TProcessor)processor); + args.processor(processor); args.protocolFactory(new TBinaryProtocol.Factory()); - args.transportFactory((TTransportFactory)new TZlibTransport.Factory()); + args.transportFactory(new TZlibTransport.Factory()); server = new TThreadPoolServer(args); Runnable simple = new Runnable() { @@ -92,7 +92,7 @@ public class ThriftProducerZlibCompressionTest extends CamelTestSupport { List requestBody = new ArrayList(); - requestBody.add((int)1); + requestBody.add(1); requestBody.add(new Work(THRIFT_TEST_NUM1, THRIFT_TEST_NUM2, Operation.MULTIPLY)); Object responseBody = template.requestBody("direct:thrift-zlib-calculate", requestBody); diff --git a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java index 297729e..b4afff2 100644 --- a/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java +++ b/components/camel-thrift/src/test/java/org/apache/camel/component/thrift/local/ThriftThreadPoolServerTest.java @@ -72,7 +72,7 @@ public class ThriftThreadPoolServerTest extends CamelTestSupport { serverTransport = TSSLTransportFactory.getServerSocket(THRIFT_TEST_PORT, THRIFT_CLIENT_TIMEOUT, InetAddress.getByName("localhost"), sslParams); ThriftThreadPoolServer.Args args = new ThriftThreadPoolServer.Args(serverTransport); - args.processor((TProcessor)processor); + args.processor(processor); args.executorService(this.context().getExecutorServiceManager().newThreadPool(this, "test-server-invoker", 1, 10)); args.startThreadPool(this.context().getExecutorServiceManager().newSingleThreadExecutor(this, "test-start-thread")); args.context(this.context()); diff --git a/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java b/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java index b29f04f..a504d18 100644 --- a/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java +++ b/components/camel-tika/src/main/java/org/apache/camel/component/tika/TikaProducer.java @@ -25,6 +25,7 @@ import java.io.UnsupportedEncodingException; import javax.xml.transform.OutputKeys; import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import javax.xml.transform.stream.StreamResult; @@ -148,7 +149,7 @@ public class TikaProducer extends DefaultProducer { private TransformerHandler getTransformerHandler(OutputStream output, String method, boolean prettyPrint) throws TransformerConfigurationException, UnsupportedEncodingException { - SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance(); + SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler handler = factory.newTransformerHandler(); handler.getTransformer().setOutputProperty(OutputKeys.METHOD, method); handler.getTransformer().setOutputProperty(OutputKeys.INDENT, prettyPrint ? "yes" : "no"); diff --git a/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java b/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java index 80f9174..10f120a 100644 --- a/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java +++ b/components/camel-twilio/src/test/java/org/apache/camel/component/twilio/AbstractTwilioTestSupport.java @@ -47,7 +47,7 @@ public class AbstractTwilioTestSupport extends CamelTestSupport { e); } - Map<String, Object> options = new HashMap<String, Object>(); + Map<String, Object> options = new HashMap<>(); for (Map.Entry<Object, Object> entry : properties.entrySet()) { options.put(entry.getKey().toString(), entry.getValue()); } diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java index cadeb1b..142478f 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/AbstractTwitterEndpoint.java @@ -17,7 +17,6 @@ package org.apache.camel.component.twitter; import org.apache.camel.Consumer; -import org.apache.camel.Endpoint; import org.apache.camel.api.management.ManagedAttribute; import org.apache.camel.component.twitter.consumer.TwitterConsumerPolling; import org.apache.camel.component.twitter.data.EndpointType; diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/CommonPropertiesTwitterEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/CommonPropertiesTwitterEndpoint.java index b6ea399..4772f5b 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/CommonPropertiesTwitterEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/CommonPropertiesTwitterEndpoint.java @@ -16,9 +16,6 @@ */ package org.apache.camel.component.twitter; -import org.apache.camel.Endpoint; -import org.apache.camel.component.twitter.data.EndpointType; - /** * @deprecated This has been introduced to just keep deprecated endpoints working as is. * Remove this once Endpoint{Direct,Event,Polling} is removed. diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java index f4a32bb..9f46012 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterConfiguration.java @@ -17,10 +17,8 @@ package org.apache.camel.component.twitter; import org.apache.camel.component.twitter.data.EndpointType; -import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriParam; import org.apache.camel.spi.UriParams; -import org.apache.camel.spi.UriPath; import org.apache.camel.util.ObjectHelper; import twitter4j.Twitter; import twitter4j.TwitterFactory; diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterHelper.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterHelper.java index af6a219..41690cc 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterHelper.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/TwitterHelper.java @@ -23,9 +23,6 @@ import org.apache.camel.Processor; import org.apache.camel.Producer; import org.apache.camel.component.twitter.consumer.AbstractTwitterConsumerHandler; import org.apache.camel.component.twitter.consumer.DefaultTwitterConsumer; -import org.apache.camel.component.twitter.consumer.TwitterConsumerDirect; -import org.apache.camel.component.twitter.consumer.TwitterConsumerEvent; -import org.apache.camel.component.twitter.consumer.TwitterConsumerPolling; import org.apache.camel.component.twitter.data.ConsumerType; import org.apache.camel.component.twitter.data.StreamingType; import org.apache.camel.component.twitter.data.TimelineType; diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java index 5bd3074..26f8c6f 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/directmessage/TwitterDirectMessageEndpoint.java @@ -25,7 +25,6 @@ import org.apache.camel.component.twitter.TwitterHelper; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriPath; -import org.apache.camel.util.ObjectHelper; /** * The Twitter Direct Message Component consumes/produces user's direct messages. diff --git a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/streaming/TwitterStreamingEndpoint.java b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/streaming/TwitterStreamingEndpoint.java index 49370d2..5a36f9b 100644 --- a/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/streaming/TwitterStreamingEndpoint.java +++ b/components/camel-twitter/src/main/java/org/apache/camel/component/twitter/streaming/TwitterStreamingEndpoint.java @@ -24,7 +24,6 @@ import org.apache.camel.component.twitter.TwitterConfiguration; import org.apache.camel.component.twitter.TwitterHelper; import org.apache.camel.component.twitter.consumer.AbstractTwitterConsumerHandler; import org.apache.camel.component.twitter.data.StreamingType; -import org.apache.camel.component.twitter.data.TimelineType; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.UriEndpoint; import org.apache.camel.spi.UriParam; diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java index 8c7cf14..8ae00af 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessageDirectTest.java @@ -16,13 +16,9 @@ */ package org.apache.camel.component.twitter; -import java.util.Date; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import twitter4j.Twitter; - /** * consumes tweets */ diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java index 8c6938b..99cfef1 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/DirectMessagePollingTest.java @@ -16,13 +16,9 @@ */ package org.apache.camel.component.twitter; -import java.util.Date; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import twitter4j.Twitter; - /** * consumes tweets */ diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java index a3ae18b..b6e9289 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/SearchByExchangeDirectTest.java @@ -69,7 +69,7 @@ public class SearchByExchangeDirectTest extends CamelTwitterTestSupport { @Test public void testSearchTimelineWithDynamicQuerySinceId() throws Exception { - Map<String, Object> headers = new HashMap<String, Object>(); + Map<String, Object> headers = new HashMap<>(); headers.put(TwitterConstants.TWITTER_KEYWORDS, "java"); headers.put(TwitterConstants.TWITTER_SINCEID, new Long(258347905419730944L)); templateHeader.sendBodyAndHeaders(null, headers); @@ -85,7 +85,7 @@ public class SearchByExchangeDirectTest extends CamelTwitterTestSupport { @Test public void testSearchTimelineWithDynamicQuerySinceIdAndMaxId() throws Exception { - Map<String, Object> headers = new HashMap<String, Object>(); + Map<String, Object> headers = new HashMap<>(); headers.put(TwitterConstants.TWITTER_KEYWORDS, "java"); headers.put(TwitterConstants.TWITTER_SINCEID, new Long(258347905419730944L)); headers.put(TwitterConstants.TWITTER_MAXID, new Long(258348815243960320L)); diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java index ab41012..6e51377 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessageDirectTest.java @@ -16,16 +16,10 @@ */ package org.apache.camel.component.twitter.deprecated; -import java.util.Date; - import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; -import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import twitter4j.Twitter; -import twitter4j.TwitterFactory; - /** * consumes tweets */ diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java index 51e95a0..d0338c4 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/DirectMessagePollingTest.java @@ -16,14 +16,10 @@ */ package org.apache.camel.component.twitter.deprecated; -import java.util.Date; - import org.apache.camel.component.twitter.CamelTwitterConsumerTestSupport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import twitter4j.Twitter; - /** * consumes tweets */ diff --git a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java index dcf4ae6..e537d02 100644 --- a/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java +++ b/components/camel-twitter/src/test/java/org/apache/camel/component/twitter/deprecated/SearchByExchangeDirectTest.java @@ -69,7 +69,7 @@ public class SearchByExchangeDirectTest extends CamelTwitterTestSupport { @Test public void testSearchTimelineWithDynamicQuerySinceId() throws Exception { - Map<String, Object> headers = new HashMap<String, Object>(); + Map<String, Object> headers = new HashMap<>(); headers.put(TwitterConstants.TWITTER_KEYWORDS, "java"); headers.put(TwitterConstants.TWITTER_SINCEID, new Long(258347905419730944L)); templateHeader.sendBodyAndHeaders(null, headers); @@ -85,7 +85,7 @@ public class SearchByExchangeDirectTest extends CamelTwitterTestSupport { @Test public void testSearchTimelineWithDynamicQuerySinceIdAndMaxId() throws Exception { - Map<String, Object> headers = new HashMap<String, Object>(); + Map<String, Object> headers = new HashMap<>(); headers.put(TwitterConstants.TWITTER_KEYWORDS, "java"); headers.put(TwitterConstants.TWITTER_SINCEID, new Long(258347905419730944L)); headers.put(TwitterConstants.TWITTER_MAXID, new Long(258348815243960320L)); diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHost.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHost.java index 1c8cd31..69abe3d 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHost.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/DefaultUndertowHost.java @@ -17,15 +17,12 @@ package org.apache.camel.component.undertow; import java.net.URI; -import java.util.function.Supplier; import io.undertow.Undertow; import io.undertow.UndertowOptions; import io.undertow.server.HttpHandler; -import io.undertow.websockets.WebSocketProtocolHandshakeHandler; import org.apache.camel.component.undertow.handlers.CamelRootHandler; -import org.apache.camel.component.undertow.handlers.CamelWebSocketHandler; import org.apache.camel.component.undertow.handlers.NotFoundHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java index 0075a17..bfd2351 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowComponent.java @@ -60,7 +60,7 @@ import org.slf4j.LoggerFactory; public class UndertowComponent extends DefaultComponent implements RestConsumerFactory, RestApiConsumerFactory, RestProducerFactory, VerifiableComponent, SSLContextParametersAware { private static final Logger LOG = LoggerFactory.getLogger(UndertowEndpoint.class); - private Map<UndertowHostKey, UndertowHost> undertowRegistry = new ConcurrentHashMap<UndertowHostKey, UndertowHost>(); + private Map<UndertowHostKey, UndertowHost> undertowRegistry = new ConcurrentHashMap<>(); @Metadata(label = "advanced") private UndertowHttpBinding undertowHttpBinding; @@ -83,8 +83,7 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF @Override protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception { - // Sa ve a copy of the parameters. - Map<String, Object> healthCheckOptions = new HashMap<>(parameters); + new HashMap<>(parameters); URI uriHttpUriAddress = new URI(UnsafeUriCharactersEncoder.encodeHttpURI(remaining)); URI endpointUri = URISupport.createRemainingURI(uriHttpUriAddress, parameters); @@ -200,7 +199,7 @@ public class UndertowComponent extends DefaultComponent implements RestConsumerF } } - Map<String, Object> map = new HashMap<String, Object>(); + Map<String, Object> map = new HashMap<>(); // build query string, and append any endpoint configuration properties if (config.getComponent() == null || config.getComponent().equals("undertow")) { // setup endpoint options diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowHelper.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowHelper.java index ab134a7..c59b8a6 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowHelper.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/UndertowHelper.java @@ -120,7 +120,7 @@ public final class UndertowHelper { if (existing instanceof List) { list = (List<Object>) existing; } else { - list = new ArrayList<Object>(); + list = new ArrayList<>(); list.add(existing); } list.add(value); diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathHandler.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathHandler.java index e557350..82dbc6d 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathHandler.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathHandler.java @@ -26,7 +26,7 @@ import io.undertow.server.handlers.PathHandler; * Extended PathHandler to monitor add/remove handlers. */ public class CamelPathHandler extends PathHandler { - private Map<String, HttpHandler> handlers = new HashMap<String, HttpHandler>(); + private Map<String, HttpHandler> handlers = new HashMap<>(); private String handlerString; public CamelPathHandler(HttpHandler defaultHandler) { diff --git a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathTemplateHandler.java b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathTemplateHandler.java index ff086da..be149b2 100644 --- a/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathTemplateHandler.java +++ b/components/camel-undertow/src/main/java/org/apache/camel/component/undertow/handlers/CamelPathTemplateHandler.java @@ -27,7 +27,7 @@ import io.undertow.server.handlers.PathTemplateHandler; * Extended PathTemplateHandler to monitor add/remove handlers. Also this enables hot swapping a default handler. */ public class CamelPathTemplateHandler implements HttpHandler { - private Map<String, CamelMethodHandler> handlers = new HashMap<String, CamelMethodHandler>(); + private Map<String, CamelMethodHandler> handlers = new HashMap<>(); private Wrapper defaultHandlerWrapper = new Wrapper(); private PathTemplateHandler delegate; private String handlerString; diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowEndpointTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowEndpointTest.java index 4562742..8852e0a 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowEndpointTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowEndpointTest.java @@ -19,7 +19,6 @@ package org.apache.camel.component.undertow; import java.net.URI; import java.net.URISyntaxException; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java index e00e5bd..8bb0a8d 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/UndertowProducerThrowExceptionOnFailureTest.java @@ -35,7 +35,7 @@ public class UndertowProducerThrowExceptionOnFailureTest extends BaseUndertowTes @Test public void testFailWithException() throws Exception { try { - String out = template().requestBody("undertow:http://localhost:{{port}}/fail?throwExceptionOnFailure=true", null, String.class); + template().requestBody("undertow:http://localhost:{{port}}/fail?throwExceptionOnFailure=true", null, String.class); fail("Should throw an exception"); } catch (CamelExecutionException e) { HttpOperationFailedException cause = assertIsInstanceOf(HttpOperationFailedException.class, e.getCause()); @@ -46,7 +46,7 @@ public class UndertowProducerThrowExceptionOnFailureTest extends BaseUndertowTes @Test public void testFailWithException2() throws Exception { try { - String out = fluentTemplate().to("undertow:http://localhost:{{port2}}/test/fail?throwExceptionOnFailure=true") + fluentTemplate().to("undertow:http://localhost:{{port2}}/test/fail?throwExceptionOnFailure=true") .withHeader(Exchange.HTTP_METHOD, "PUT") .withBody("This is not JSON format") .request(String.class); diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeJsonWithContractTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeJsonWithContractTest.java index df293dd..f82c390 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeJsonWithContractTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeJsonWithContractTest.java @@ -17,13 +17,11 @@ package org.apache.camel.component.undertow.rest; import org.apache.camel.Converter; -import org.apache.camel.Exchange; import org.apache.camel.TypeConverters; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.undertow.BaseUndertowTest; import org.apache.camel.model.rest.RestBindingMode; -import org.apache.camel.model.rest.RestDefinition; import org.junit.Test; public class RestUndertowHttpBindingModeJsonWithContractTest extends BaseUndertowTest { diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeOffWithContractTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeOffWithContractTest.java index 432c986..eebccfb 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeOffWithContractTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/rest/RestUndertowHttpBindingModeOffWithContractTest.java @@ -16,16 +16,13 @@ */ package org.apache.camel.component.undertow.rest; -import org.apache.camel.Converter; import org.apache.camel.Exchange; -import org.apache.camel.TypeConverters; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.component.undertow.BaseUndertowTest; import org.apache.camel.model.dataformat.JsonDataFormat; import org.apache.camel.model.dataformat.JsonLibrary; import org.apache.camel.model.rest.RestBindingMode; -import org.apache.camel.model.rest.RestDefinition; import org.junit.Test; public class RestUndertowHttpBindingModeOffWithContractTest extends BaseUndertowTest { diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/TestClient.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/TestClient.java index 7a235a1..98df90d 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/TestClient.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/TestClient.java @@ -55,7 +55,7 @@ public class TestClient { } public TestClient(String url, AsyncHttpClientConfig conf, int count) { - this.received = new ArrayList<Object>(); + this.received = new ArrayList<>(); this.latch = new CountDownLatch(count); this.client = conf == null ? new DefaultAsyncHttpClient() : new DefaultAsyncHttpClient(conf); this.url = url; @@ -89,7 +89,7 @@ public class TestClient { } public <T> List<T> getReceived(Class<T> cls) { - List<T> list = new ArrayList<T>(); + List<T> list = new ArrayList<>(); for (Object o : received) { list.add(getValue(o, cls)); } diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsConsumerRouteTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsConsumerRouteTest.java index 3a25a3f..692c567 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsConsumerRouteTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsConsumerRouteTest.java @@ -280,7 +280,7 @@ public class UndertowWsConsumerRouteTest extends BaseUndertowTest { Set<String> actual = new HashSet<>(); actual.add(exchanges.get(0).getIn().getBody(String.class)); actual.add(exchanges.get(1).getIn().getBody(String.class)); - Assert.assertEquals(new HashSet<String>(Arrays.asList("Test1", "Test2")), actual); + Assert.assertEquals(new HashSet<>(Arrays.asList("Test1", "Test2")), actual); websocket1.sendCloseFrame(); websocket2.sendCloseFrame(); @@ -378,7 +378,7 @@ public class UndertowWsConsumerRouteTest extends BaseUndertowTest { Assert.assertNotNull(key); List<String> messages = connections.get(key); if (messages == null) { - messages = new ArrayList<String>(); + messages = new ArrayList<>(); connections.put(key, messages); } String body = in.getBody(String.class); diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteRestartTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteRestartTest.java index 5a5f6ab..dbd260d 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteRestartTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteRestartTest.java @@ -63,7 +63,7 @@ public class UndertowWsProducerRouteRestartTest extends BaseUndertowTest { } private void doTestWSHttpCall() throws Exception { - final List<Object> received = new ArrayList<Object>(); + final List<Object> received = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(1); AsyncHttpClient c = new DefaultAsyncHttpClient(); diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteTest.java index fc27066..3846999 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsProducerRouteTest.java @@ -44,7 +44,7 @@ public class UndertowWsProducerRouteTest extends BaseUndertowTest { final CountDownLatch latch = new CountDownLatch(1); AsyncHttpClient c = new DefaultAsyncHttpClient(); - final List<Object> received = Collections.synchronizedList(new ArrayList<Object>()); + final List<Object> received = Collections.synchronizedList(new ArrayList<>()); WebSocket websocket = c.prepareGet("ws://localhost:" + getPort() + "/shop") .execute(new WebSocketUpgradeHandler.Builder().addWebSocketListener(new WebSocketListener() { diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesTest.java index 475fbd3..aac40d0 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesTest.java @@ -37,7 +37,7 @@ public class UndertowWsTwoRoutesTest extends BaseUndertowTest { // We call the route WebSocket BAR { - final List<String> received = new ArrayList<String>(); + final List<String> received = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(1); final AsyncHttpClient c = new DefaultAsyncHttpClient(); final WebSocket websocket = c.prepareGet("ws://localhost:" + getPort() + "/bar").execute( @@ -77,7 +77,7 @@ public class UndertowWsTwoRoutesTest extends BaseUndertowTest { // We call the route WebSocket PUB { - final List<String> received = new ArrayList<String>(); + final List<String> received = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(1); final AsyncHttpClient c = new DefaultAsyncHttpClient(); final WebSocket websocket = c.prepareGet("ws://localhost:" + getPort() + "/pub").execute( diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest.java index 0235ad2..8a39f8c 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest.java @@ -37,7 +37,7 @@ public class UndertowWsTwoRoutesToSameEndpointSendToAllHeaderTest extends BaseUn public void testWSHttpCallEcho() throws Exception { // We call the route WebSocket BAR - final List<String> received = new ArrayList<String>(); + final List<String> received = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(2); DefaultAsyncHttpClient c = new DefaultAsyncHttpClient(); diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointTest.java index d1a3b29..4698c2f 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWsTwoRoutesToSameEndpointTest.java @@ -36,7 +36,7 @@ public class UndertowWsTwoRoutesToSameEndpointTest extends BaseUndertowTest { public void testWSHttpCallEcho() throws Exception { // We call the route WebSocket BAR - final List<String> received = new ArrayList<String>(); + final List<String> received = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(2); DefaultAsyncHttpClient c = new DefaultAsyncHttpClient(); diff --git a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWssRouteTest.java b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWssRouteTest.java index 413ae5f..90d9e3a 100644 --- a/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWssRouteTest.java +++ b/components/camel-undertow/src/test/java/org/apache/camel/component/undertow/ws/UndertowWssRouteTest.java @@ -114,7 +114,7 @@ public class UndertowWssRouteTest extends BaseUndertowTest { @Test public void testWSHttpCall() throws Exception { - final List<String> received = new ArrayList<String>(); + final List<String> received = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(10); AsyncHttpClient c = createAsyncHttpSSLClient(); diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java index 5ba5494..b4c8dee 100644 --- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java +++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/AbstractUniVocityDataFormat.java @@ -84,7 +84,7 @@ public abstract class AbstractUniVocityDataFormat<F extends Format, CWS extends synchronized (writerSettingsToken) { if (writerSettings == null) { writerSettings = createAndConfigureWriterSettings(); - marshaller = new Marshaller<W>(headers, headers == null); + marshaller = new Marshaller<>(headers, headers == null); } } } @@ -111,7 +111,7 @@ public abstract class AbstractUniVocityDataFormat<F extends Format, CWS extends return createAndConfigureParserSettings(); } }; - unmarshaller = new Unmarshaller<P>(lazyLoad, asMap); + unmarshaller = new Unmarshaller<>(lazyLoad, asMap); } } } diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java index 1e5d1c1..2f731ce 100644 --- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java +++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Marshaller.java @@ -36,7 +36,7 @@ import static org.apache.camel.util.ExchangeHelper.convertToType; * @param <W> Writer class */ final class Marshaller<W extends AbstractWriter<?>> { - private final LinkedHashSet<String> headers = new LinkedHashSet<String>(); + private final LinkedHashSet<String> headers = new LinkedHashSet<>(); private final boolean adaptHeaders; /** diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java index c68daf7..e3a3d05 100644 --- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java +++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormat.java @@ -203,7 +203,7 @@ public class UniVocityFixedWidthDataFormat extends AbstractUniVocityDataFormat<F if (fieldLengths.length != headers.length) { throw new IllegalArgumentException("The headers and fieldLengths must have the same number of element in order to use the fixed-width format."); } - LinkedHashMap<String, Integer> fields = new LinkedHashMap<String, Integer>(); + LinkedHashMap<String, Integer> fields = new LinkedHashMap<>(); for (int i = 0; i < headers.length; i++) { fields.put(headers[i], fieldLengths[i]); } diff --git a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Unmarshaller.java b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Unmarshaller.java index bf36cca..891c31e 100644 --- a/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Unmarshaller.java +++ b/components/camel-univocity-parsers/src/main/java/org/apache/camel/dataformat/univocity/Unmarshaller.java @@ -58,7 +58,7 @@ final class Unmarshaller<P extends AbstractParser<?>> { */ public Object unmarshal(Reader reader, P parser, HeaderRowProcessor headerRowProcessor) { parser.beginParsing(reader); - Iterator<?> iterator = asMap ? new MapRowIterator<P>(parser, headerRowProcessor) : new ListRowIterator<P>(parser); + Iterator<?> iterator = asMap ? new MapRowIterator<>(parser, headerRowProcessor) : new ListRowIterator<>(parser); return lazyLoad ? iterator : convertToList(iterator); } @@ -70,7 +70,7 @@ final class Unmarshaller<P extends AbstractParser<?>> { * @return a list that contains all the items of the iterator */ private static <T> List<T> convertToList(Iterator<T> iterator) { - List<T> result = new ArrayList<T>(); + List<T> result = new ArrayList<>(); while (iterator.hasNext()) { result.add(iterator.next()); } @@ -187,7 +187,7 @@ final class Unmarshaller<P extends AbstractParser<?>> { String[] headers = headerRowProcessor.getHeaders(); int size = Math.min(row.length, headers.length); - Map<String, String> result = new LinkedHashMap<String, String>(size); + Map<String, String> result = new LinkedHashMap<>(size); for (int i = 0; i < size; i++) { result.put(headers[i], row[i]); } diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatMarshalTest.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatMarshalTest.java index 1e63431..39b168c 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatMarshalTest.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatMarshalTest.java @@ -121,7 +121,7 @@ public final class UniVocityCsvDataFormatMarshalTest extends CamelTestSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { - final Map<String, DataFormat> tests = new HashMap<String, DataFormat>(); + final Map<String, DataFormat> tests = new HashMap<>(); // Default writing of CSV tests.put("default", new UniVocityCsvDataFormat()); diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatUnmarshalTest.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatUnmarshalTest.java index 1909e36..e2c5408 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatUnmarshalTest.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatUnmarshalTest.java @@ -148,7 +148,7 @@ public final class UniVocityCsvDataFormatUnmarshalTest extends CamelTestSupport @Override protected RouteBuilder createRouteBuilder() throws Exception { - final Map<String, DataFormat> tests = new HashMap<String, DataFormat>(); + final Map<String, DataFormat> tests = new HashMap<>(); // Default reading of CSV tests.put("default", new UniVocityCsvDataFormat()); diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatMarshalTest.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatMarshalTest.java index a6e2029..6789da1 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatMarshalTest.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatMarshalTest.java @@ -121,7 +121,7 @@ public final class UniVocityFixedWidthDataFormatMarshalTest extends CamelTestSup @Override protected RouteBuilder createRouteBuilder() throws Exception { - final Map<String, DataFormat> tests = new HashMap<String, DataFormat>(); + final Map<String, DataFormat> tests = new HashMap<>(); // Default writing of fixed-width tests.put("default", new UniVocityFixedWidthDataFormat() diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatUnmarshalTest.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatUnmarshalTest.java index 9f53ca2..9d80c28 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatUnmarshalTest.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityFixedWidthDataFormatUnmarshalTest.java @@ -147,7 +147,7 @@ public final class UniVocityFixedWidthDataFormatUnmarshalTest extends CamelTestS @Override protected RouteBuilder createRouteBuilder() throws Exception { - final Map<String, DataFormat> tests = new HashMap<String, DataFormat>(); + final Map<String, DataFormat> tests = new HashMap<>(); // Default reading of fixed-width tests.put("default", new UniVocityFixedWidthDataFormat() diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTestHelper.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTestHelper.java index b141881..731259f 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTestHelper.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTestHelper.java @@ -41,7 +41,7 @@ final class UniVocityTestHelper { throw new IllegalArgumentException("You must specify key values with an even number."); } - Map<String, String> result = new LinkedHashMap<String, String>(keyValues.length / 2); + Map<String, String> result = new LinkedHashMap<>(keyValues.length / 2); for (int i = 0; i < keyValues.length; i += 2) { result.put(keyValues[i], keyValues[i + 1]); } diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatMarshalTest.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatMarshalTest.java index 6f06a3c..41fc02f 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatMarshalTest.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatMarshalTest.java @@ -121,7 +121,7 @@ public final class UniVocityTsvDataFormatMarshalTest extends CamelTestSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { - final Map<String, DataFormat> tests = new HashMap<String, DataFormat>(); + final Map<String, DataFormat> tests = new HashMap<>(); // Default writing of TSV tests.put("default", new UniVocityTsvDataFormat()); diff --git a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatUnmarshalTest.java b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatUnmarshalTest.java index 90c8287..2b5e1d2 100644 --- a/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatUnmarshalTest.java +++ b/components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityTsvDataFormatUnmarshalTest.java @@ -147,7 +147,7 @@ public final class UniVocityTsvDataFormatUnmarshalTest extends CamelTestSupport @Override protected RouteBuilder createRouteBuilder() throws Exception { - final Map<String, DataFormat> tests = new HashMap<String, DataFormat>(); + final Map<String, DataFormat> tests = new HashMap<>(); // Default reading of TSV tests.put("default", new UniVocityTsvDataFormat()); diff --git a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherQuery.java b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherQuery.java index 9780954..816b163 100644 --- a/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherQuery.java +++ b/components/camel-weather/src/main/java/org/apache/camel/component/weather/WeatherQuery.java @@ -39,12 +39,9 @@ public class WeatherQuery { public String getQuery(String location) throws Exception { String answer = "http://api.openweathermap.org/data/2.5/"; - boolean point = false; - if (weatherConfiguration.getLat() != null && weatherConfiguration.getLon() != null && weatherConfiguration.getRightLon() == null && weatherConfiguration.getTopLat() == null) { location = createLatLonQueryString(); - point = true; } else if (weatherConfiguration.getLat() != null && weatherConfiguration.getLon() != null && weatherConfiguration.getRightLon() != null && weatherConfiguration.getTopLat() != null) { location = "bbox=" + weatherConfiguration.getLon() + "," diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java index c1753cf..443f26c 100644 --- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java +++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponent.java @@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory; public class WebsocketComponent extends UriEndpointComponent implements SSLContextParametersAware { protected static final Logger LOG = LoggerFactory.getLogger(WebsocketComponent.class); - protected static final HashMap<String, ConnectorRef> CONNECTORS = new HashMap<String, ConnectorRef>(); + protected static final HashMap<String, ConnectorRef> CONNECTORS = new HashMap<>(); protected Map<String, WebSocketFactory> socketFactory; protected Server staticResourcesServer; @@ -92,7 +92,7 @@ public class WebsocketComponent extends UriEndpointComponent implements SSLConte /** * Map for storing servlets. {@link WebsocketComponentServlet} is identified by pathSpec {@link String}. */ - private Map<String, WebsocketComponentServlet> servlets = new HashMap<String, WebsocketComponentServlet>(); + private Map<String, WebsocketComponentServlet> servlets = new HashMap<>(); class ConnectorRef { Server server; @@ -126,7 +126,7 @@ public class WebsocketComponent extends UriEndpointComponent implements SSLConte super(WebsocketEndpoint.class); if (this.socketFactory == null) { - this.socketFactory = new HashMap<String, WebSocketFactory>(); + this.socketFactory = new HashMap<>(); this.socketFactory.put("default", new DefaultWebsocketFactory()); } } diff --git a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java index b5362f0..d47a852 100644 --- a/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java +++ b/components/camel-websocket/src/main/java/org/apache/camel/component/websocket/WebsocketComponentServlet.java @@ -35,7 +35,7 @@ public class WebsocketComponentServlet extends WebSocketServlet { private WebsocketConsumer consumer; private String pathSpec; - private ConcurrentMap<String, WebsocketConsumer> consumers = new ConcurrentHashMap<String, WebsocketConsumer>(); + private ConcurrentMap<String, WebsocketConsumer> consumers = new ConcurrentHashMap<>(); private Map<String, WebSocketFactory> socketFactory; public WebsocketComponentServlet(NodeSynchronization sync, String pathSpec, Map<String, WebSocketFactory> socketFactory) { diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java index ad701a1..9267d0a 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketClientCamelRouteTest.java @@ -34,7 +34,7 @@ import org.junit.Test; public class WebsocketClientCamelRouteTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(10); protected int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentRouteExampleTest.java index db021c4..b5c9f51 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentRouteExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentRouteExampleTest.java @@ -34,7 +34,7 @@ import org.junit.Test; public class WebsocketComponentRouteExampleTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(1); protected int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java index d08c1b8..a12410d 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentServletTest.java @@ -56,7 +56,7 @@ public class WebsocketComponentServletTest { @Before public void setUp() throws Exception { - socketFactory = new HashMap<String, WebSocketFactory>(); + socketFactory = new HashMap<>(); socketFactory.put("default", new DefaultWebsocketFactory()); websocketComponentServlet = new WebsocketComponentServlet(sync, null, socketFactory); diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java index ae10722..be2e5e8 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketComponentTest.java @@ -125,7 +125,7 @@ public class WebsocketComponentTest { @Test public void testCreateEndpoint() throws Exception { - Map<String, Object> parameters = new HashMap<String, Object>(); + Map<String, Object> parameters = new HashMap<>(); Endpoint e1 = component.createEndpoint("websocket://foo", "foo", parameters); Endpoint e2 = component.createEndpoint("websocket://foo", "foo", parameters); Endpoint e3 = component.createEndpoint("websocket://bar", "bar", parameters); diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteExampleTest.java index bf4a0e8..67f32fe 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteExampleTest.java @@ -38,7 +38,7 @@ import org.junit.Test; public class WebsocketProducerRouteExampleTest extends CamelTestSupport { - private static List<Object> received = new ArrayList<Object>(); + private static List<Object> received = new ArrayList<>(); private static CountDownLatch latch; protected int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteRestartTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteRestartTest.java index 0036e19..c59a214 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteRestartTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketProducerRouteRestartTest.java @@ -37,7 +37,7 @@ import org.junit.Test; public class WebsocketProducerRouteRestartTest extends CamelTestSupport { private static final String ROUTE_ID = WebsocketProducerRouteRestartTest.class.getSimpleName(); - private static List<Object> received = new ArrayList<Object>(); + private static List<Object> received = new ArrayList<>(); private static CountDownLatch latch; protected int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketRouteExampleTest.java index 9a4e989..38dae7d 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketRouteExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketRouteExampleTest.java @@ -34,7 +34,7 @@ import org.junit.Test; public class WebsocketRouteExampleTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(1); protected int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextGlobalRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextGlobalRouteExampleTest.java index 227283f..fbeee4a 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextGlobalRouteExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextGlobalRouteExampleTest.java @@ -52,7 +52,7 @@ import org.junit.Test; public class WebsocketSSLContextGlobalRouteExampleTest extends CamelTestSupport { private static final String NULL_VALUE_MARKER = CamelTestSupport.class.getCanonicalName(); - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(10); private Properties originalValues = new Properties(); private String pwd = "changeit"; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java index ec44780..91cd54f 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLContextInUriRouteExampleTest.java @@ -52,7 +52,7 @@ import org.junit.Test; public class WebsocketSSLContextInUriRouteExampleTest extends CamelTestSupport { private static final String NULL_VALUE_MARKER = CamelTestSupport.class.getCanonicalName(); - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(10); private Properties originalValues = new Properties(); private String pwd = "changeit"; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java index 5ced879..eaff087 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketSSLRouteExampleTest.java @@ -51,7 +51,7 @@ import org.junit.Test; public class WebsocketSSLRouteExampleTest extends CamelTestSupport { private static final String NULL_VALUE_MARKER = CamelTestSupport.class.getCanonicalName(); - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(10); protected Properties originalValues = new Properties(); protected String pwd = "changeit"; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketStaticTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketStaticTest.java index d652be9..f7d6b5d 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketStaticTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketStaticTest.java @@ -35,7 +35,7 @@ import org.junit.Test; public class WebsocketStaticTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch = new CountDownLatch(1); protected int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java index cd1c5d4..e48f004 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesExampleTest.java @@ -33,7 +33,7 @@ import org.junit.Test; public class WebsocketTwoRoutesExampleTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch; private int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java index 59a14f3..a7f95e8 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest.java @@ -33,7 +33,7 @@ import org.junit.Test; public class WebsocketTwoRoutesToSIndividualAndBroadcastEndpointExampleTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch; private int port; diff --git a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java index d4aee1c..3495c16 100644 --- a/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java +++ b/components/camel-websocket/src/test/java/org/apache/camel/component/websocket/WebsocketTwoRoutesToSameEndpointExampleTest.java @@ -32,7 +32,7 @@ import org.junit.Test; public class WebsocketTwoRoutesToSameEndpointExampleTest extends CamelTestSupport { - private static List<String> received = new ArrayList<String>(); + private static List<String> received = new ArrayList<>(); private static CountDownLatch latch; private int port; diff --git a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java index 0394c9e..0fd6fa4 100644 --- a/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java +++ b/components/camel-wordpress/src/main/java/org/apache/camel/component/wordpress/WordpressComponent.java @@ -76,7 +76,7 @@ public class WordpressComponent extends DefaultComponent { } private WordpressComponentConfiguration copyComponentProperties() throws Exception { - Map<String, Object> componentProperties = new HashMap<String, Object>(); + Map<String, Object> componentProperties = new HashMap<>(); IntrospectionSupport.getProperties(configuration, componentProperties, null, false); // create endpoint configuration with component properties diff --git a/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/test/WordpressMockServerTestSupport.java b/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/test/WordpressMockServerTestSupport.java index 31a64f4..6cec1a1 100644 --- a/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/test/WordpressMockServerTestSupport.java +++ b/components/camel-wordpress/src/test/java/org/apache/camel/component/wordpress/api/test/WordpressMockServerTestSupport.java @@ -62,11 +62,11 @@ public abstract class WordpressMockServerTestSupport { } private static HttpServer createServer(int port) { - final Map<String, String> postsListCreateRequestHandlers = new HashMap<String, String>(); + final Map<String, String> postsListCreateRequestHandlers = new HashMap<>(); postsListCreateRequestHandlers.put("GET", "/data/posts/list.json"); postsListCreateRequestHandlers.put("POST", "/data/posts/create.json"); - final Map<String, String> postsSingleUpdateRequestHandlers = new HashMap<String, String>(); + final Map<String, String> postsSingleUpdateRequestHandlers = new HashMap<>(); postsSingleUpdateRequestHandlers.put("GET", "/data/posts/single.json"); postsSingleUpdateRequestHandlers.put("POST", "/data/posts/update.json"); postsSingleUpdateRequestHandlers.put("DELETE", "/data/posts/delete.json"); @@ -75,7 +75,7 @@ public abstract class WordpressMockServerTestSupport { usersListCreateRequestHandlers.put("GET", "/data/users/list.json"); usersListCreateRequestHandlers.put("POST", "/data/users/create.json"); - final Map<String, String> usersSingleUpdateRequestHandlers = new HashMap<String, String>(); + final Map<String, String> usersSingleUpdateRequestHandlers = new HashMap<>(); usersSingleUpdateRequestHandlers.put("GET", "/data/users/single.json"); usersSingleUpdateRequestHandlers.put("POST", "/data/users/update.json"); usersSingleUpdateRequestHandlers.put("DELETE", "/data/users/delete.json"); -- To stop receiving notification emails like this one, please contact bvah...@apache.org.