Author: ningjiang Date: Thu Sep 6 02:03:18 2012 New Revision: 1381457 URL: http://svn.apache.org/viewvc?rev=1381457&view=rev Log: Fixed the CS errors of camel-cdi
Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java?rev=1381457&r1=1381456&r2=1381457&view=diff ============================================================================== --- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java (original) +++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/cdi/RoutesXml.java Thu Sep 6 02:03:18 2012 @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -7,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,7 +31,11 @@ import org.apache.camel.util.ObjectHelpe /** * A helper class for loading route definitions from a file, URL or the classpath */ -public class RoutesXml { +public final class RoutesXml { + + private RoutesXml() { + //The helper class + } /** * Loads the routes from the given XML content @@ -77,7 +80,7 @@ public class RoutesXml { * Loads the routes from a {@link File} */ public static RoutesDefinition loadRoutesFromFile(String fileName) - throws JAXBException, FileNotFoundException { + throws JAXBException, FileNotFoundException { return loadRoutesFromFile(new File(fileName)); } Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java?rev=1381457&r1=1381456&r2=1381457&view=diff ============================================================================== --- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java (original) +++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextConfig.java Thu Sep 6 02:03:18 2012 @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -7,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java?rev=1381457&r1=1381456&r2=1381457&view=diff ============================================================================== --- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java (original) +++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelContextMap.java Thu Sep 6 02:03:18 2012 @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -7,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, Modified: camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java?rev=1381457&r1=1381456&r2=1381457&view=diff ============================================================================== --- camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java (original) +++ camel/trunk/components/camel-cdi/src/main/java/org/apache/camel/component/cdi/internal/CamelExtension.java Thu Sep 6 02:03:18 2012 @@ -88,7 +88,7 @@ public class CamelExtension implements E * @throws Exception In case of exceptions. */ protected void contextAwareness(@Observes ProcessAnnotatedType<CamelContextAware> process) - throws Exception { + throws Exception { AnnotatedType<CamelContextAware> annotatedType = process.getAnnotatedType(); Class<CamelContextAware> javaClass = annotatedType.getJavaClass(); if (CamelContextAware.class.isAssignableFrom(javaClass)) { @@ -194,7 +194,7 @@ public class CamelExtension implements E * Lets force the CDI container to create all beans annotated with @Consume so that the consumer becomes active */ public void startConsumeBeans(@Observes AfterDeploymentValidation event, BeanManager beanManager) - throws Exception { + throws Exception { for (CamelContextBean bean : camelContextBeans) { String name = bean.getCamelContextName(); CamelContext context = getCamelContext(name); Modified: camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java?rev=1381457&r1=1381456&r2=1381457&view=diff ============================================================================== --- camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java (original) +++ camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromClassPathTest.java Thu Sep 6 02:03:18 2012 @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -7,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,12 +28,6 @@ import org.junit.Test; * Checks we can load XML routes from the classpath and use then with CDI */ public class XmlRoutesFromClassPathTest extends CdiTestSupport { - @Produces - @ContextName - public RoutesDefinition createRoutes() throws Exception { - return RoutesXml.loadRoutesFromClasspath("routes.xml"); - } - @Inject @Mock MockEndpoint results; @@ -43,8 +36,14 @@ public class XmlRoutesFromClassPathTest @Uri("direct:start") ProducerTemplate producer; - Object[] expectedBodies = { "body:1", "body:2" }; - + Object[] expectedBodies = {"body:1", "body:2"}; + + @Produces + @ContextName + public RoutesDefinition createRoutes() throws Exception { + return RoutesXml.loadRoutesFromClasspath("routes.xml"); + } + @Test public void xmlRoutesWorkOnClassPath() throws Exception { assertNotNull("results not injected", results); Modified: camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java?rev=1381457&r1=1381456&r2=1381457&view=diff ============================================================================== --- camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java (original) +++ camel/trunk/components/camel-cdi/src/test/java/org/apache/camel/cdi/XmlRoutesFromURLTest.java Thu Sep 6 02:03:18 2012 @@ -1,5 +1,4 @@ /** - * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. @@ -7,7 +6,7 @@ * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -29,11 +28,13 @@ public class XmlRoutesFromURLTest extend @Override public RoutesDefinition createRoutes() throws Exception { - String[] prefixes = { "camel-cdi", "components"}; + String[] prefixes = {"camel-cdi", "components"}; String fileName = "src/test/resources/routes.xml"; File file = new File(fileName); for (String prefix : prefixes) { - if (file.exists()) break; + if (file.exists()) { + break; + } file = new File(prefix, file.getPath()); } assertTrue("The file " + file.getPath() + " does not exist", file.exists());